.orbit-rich-reference-editor {
    position: relative;
    display: block;
    width: 100%;
    color: var(--orbit-rich-reference-editor-text-color, currentColor);
    --orbit-rich-reference-editor-padding-block: 0.75rem 0.75rem;
    --orbit-rich-reference-editor-padding-inline: 0.75rem 0.75rem;
    --orbit-rich-reference-editor-border-radius: 8px;
    --orbit-rich-reference-editor-line-height: inherit;
    --orbit-rich-reference-editor-font: inherit;
    --orbit-rich-reference-editor-letter-spacing: normal;
    --orbit-rich-reference-editor-text-align: left;
    --orbit-rich-reference-editor-min-height: 0px;
}

.orbit-rich-reference-editor__header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.55rem;
    margin-bottom: 0.45rem;
}

.orbit-rich-reference-editor__mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem;
    border: 1px solid var(--border-primary);
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-secondary) 88%, transparent);
}

.orbit-rich-reference-editor__mode-btn {
    border: 0;
    border-radius: 999px;
    padding: 0.34rem 0.72rem;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.orbit-rich-reference-editor__mode-btn.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.orbit-rich-reference-editor__mode-btn:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent-primary) 45%, transparent);
    outline-offset: 1px;
}

.orbit-rich-reference-editor__overlay,
.orbit-rich-reference-editor__textarea {
    min-height: max(8rem, var(--orbit-rich-reference-editor-min-height));
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.orbit-rich-reference-editor__overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: inherit;
    display: none;
}

.orbit-rich-reference-editor__overlay-body {
    min-height: 100%;
    padding-block: var(--orbit-rich-reference-editor-padding-block);
    padding-inline: var(--orbit-rich-reference-editor-padding-inline);
    color: var(--orbit-rich-reference-editor-text-color, currentColor);
    line-height: var(--orbit-rich-reference-editor-line-height);
    font: var(--orbit-rich-reference-editor-font);
    letter-spacing: var(--orbit-rich-reference-editor-letter-spacing);
    text-align: var(--orbit-rich-reference-editor-text-align);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.orbit-rich-reference-editor__textarea {
    position: relative;
    z-index: 1;
    background: transparent;
    color: inherit;
    caret-color: var(--orbit-rich-reference-editor-text-color, currentColor);
}

.orbit-rich-reference-editor[data-reference-editor-mode='source'] .orbit-rich-reference-editor__textarea {
    color: var(--orbit-rich-reference-editor-text-color, currentColor);
    -webkit-text-fill-color: currentColor;
}

.orbit-rich-reference-editor__token {
    display: inline-block;
    margin: 0 0.08rem;
    padding: 0.04rem 0.42rem;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--accent-primary) 30%, var(--border-primary));
    background: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-secondary));
    color: color-mix(in srgb, var(--accent-primary) 62%, var(--text-primary));
    font-weight: 600;
}

.orbit-rich-reference-editor__token--missing {
    border-style: dashed;
    color: var(--text-secondary);
}

.orbit-rich-reference-editor__token--relationship-mention {
    border-style: dashed;
    background: color-mix(in srgb, var(--accent-primary) 6%, var(--bg-secondary));
    color: color-mix(in srgb, var(--accent-primary) 48%, var(--text-primary));
}

.orbit-rich-reference-editor__sentinel {
    opacity: 0;
}
