.ordero-editor {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid rgb(var(--border-800));
    background: rgb(var(--surface-950));
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
.ordero-editor > .rich-editor-controls-row {
    container-type: inline-size;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}
.ordero-editor > .rich-editor-controls-row > [data-rich-toolbar] { flex: 1 1 auto; min-width: 0; }
.rich-editor-component > .rich-editor-field-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
    min-height: 40px;
    margin-top: 0;
    margin-bottom: 8px;
}
.rich-editor-field-type { flex: 1 1 140px; width: 0; }
.rich-editor-field-buttons { display: flex; margin-left: auto; flex-shrink: 0; align-items: center; }
.rich-editor-field-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: transparent;
}
.rich-editor-field-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgb(var(--border-700));
    border-radius: 8px;
    background: rgb(var(--surface-950));
    color: rgb(var(--ink-400));
    transition: background-color 150ms ease, color 150ms ease;
}
.rich-editor-field-actions button:hover:not(:disabled) {
    background: rgb(var(--surface-800));
    color: rgb(var(--ink-heading));
}
.rich-editor-field-actions button svg { width: 20px; height: 20px; }
.rich-editor-field-actions button:focus-visible {
    outline: 2px solid rgb(var(--accent-500));
    outline-offset: 1px;
}
.rich-editor-field-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.35;
}
.ordero-editor > .rich-editor-surface { min-width: 0; }
.ordero-editor:focus-within {
    border-color: rgb(var(--accent-500) / 0.7);
    box-shadow: 0 0 0 3px rgb(var(--accent-500) / 0.08);
}
.ordero-editor:has([data-rich-toggle][aria-expanded=true]) { position: relative; z-index: 50; }
.ordero-editor .ql-toolbar.ql-snow {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: center;
    min-width: 0;
    position: relative;
    border: 0;
    border-radius: 8px;
    background: transparent;
    padding: 0;
    font-family: inherit;
    font-size: 12px;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 160ms ease, transform 180ms ease, visibility 160ms, height 180ms ease,
        padding 180ms ease, border-color 180ms ease;
}
.ordero-editor:focus-within .ql-toolbar.ql-snow { z-index: 2; }
.ordero-editor:not(:focus-within) .ql-toolbar.ql-snow {
    height: 0;
    flex: 0 0 0;
    padding: 0;
    border: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    pointer-events: none;
    overflow: hidden;
}
.ordero-editor .rich-editor-field-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 2px;
}
.rich-editor-primary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-width: 0;
    position: relative;
}
.rich-editor-list-picker { position: relative; }
.rich-editor-list-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 5px;
    color: rgb(var(--ink-400));
}
.rich-editor-list-trigger:hover,
.rich-editor-list-trigger[aria-expanded=true] {
    background: rgb(var(--accent-500) / 0.15);
    color: rgb(var(--accent-400));
}
.rich-editor-list-trigger:focus-visible { outline: 2px solid rgb(var(--accent-500)); outline-offset: 1px; }
.rich-editor-list-trigger svg { width: 18px; height: 18px; }
.rich-editor-list-trigger svg line { stroke: currentColor; stroke-width: 1.35; }
.rich-editor-list-trigger svg circle { fill: currentColor; }
.rich-editor-list-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    z-index: 45;
    min-width: 176px;
    padding: 4px;
    border: 1px solid rgb(var(--border-800));
    border-radius: 8px;
    background: rgb(var(--surface-900));
    box-shadow: 0 6px 18px rgb(0 0 0 / 0.18);
}
.ordero-editor .ql-toolbar.ql-snow .rich-editor-list-menu button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    height: 32px;
    padding: 0 8px;
    color: rgb(var(--ink-300));
    font: inherit;
    text-align: left;
}
.ordero-editor .ql-toolbar.ql-snow .rich-editor-list-menu button::after {
    content: attr(data-label);
    font-family: inherit;
    font-size: 12px;
}
.ordero-editor .ql-toolbar.ql-snow .rich-editor-list-menu button:hover,
.ordero-editor .ql-toolbar.ql-snow .rich-editor-list-menu button.ql-active {
    background: rgb(var(--accent-500) / 0.15);
    color: rgb(var(--accent-400));
}
.ordero-editor .ql-snow .rich-editor-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex: 0 0 auto;
    margin-left: auto;
    width: auto;
    padding: 4px 7px;
    border-radius: 6px;
    color: rgb(var(--ink-400));
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 150ms, color 150ms;
}
.ordero-editor .ql-snow .rich-editor-toggle:hover,
.ordero-editor .ql-snow .rich-editor-toggle[aria-expanded=true] {
    background: rgb(var(--accent-500) / 0.1);
    color: rgb(var(--accent-400));
}
.rich-editor-toggle:focus-visible {
    outline: 2px solid rgb(var(--accent-500));
    outline-offset: 1px;
}
.rich-editor-toggle > svg { width: 20px; height: 20px; }
.ordero-editor .ql-toolbar .ql-formats {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin: 0;
}
.ordero-editor .ql-toolbar .rich-editor-separated {
    border-left: 1px solid rgb(var(--border-800));
    padding-left: 4px;
}
.rich-editor-more {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    z-index: 45;
    width: min(292px, 100%);
    padding: 8px;
    border: 1px solid rgb(var(--border-800));
    border-radius: 8px;
    background: rgb(var(--surface-900));
    box-shadow: 0 6px 18px rgb(0 0 0 / 0.18);
    font-family: inherit;
    font-size: 12px;
}
.rich-editor-more :is(.ql-picker, .ql-picker-label, .ql-picker-item, button) { font-family: inherit; }
.rich-editor-more-enter,
.rich-editor-more-leave { transition: opacity 140ms ease, transform 160ms ease; }
.rich-editor-more-enter-start,
.rich-editor-more-leave-end { opacity: 0; transform: translateY(-5px) scale(0.985); }
.rich-editor-more-enter-end,
.rich-editor-more-leave-start { opacity: 1; transform: translateY(0) scale(1); }
.rich-editor-more-above { top: auto; bottom: calc(100% + 5px); }
.rich-editor-section + .rich-editor-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgb(var(--border-800));
}
.rich-editor-section-title {
    margin: 0 0 4px 4px;
    color: rgb(var(--ink-400));
    font-size: 12px;
    font-weight: 500;
}
.rich-editor-more .ql-formats { flex-wrap: wrap; }
.rich-editor-more .ql-snow button {
    min-width: 30px;
    height: 32px;
    color: rgb(var(--ink-400));
    font-size: 12px;
    font-weight: 400;
    border-radius: 5px;
}
.rich-editor-more .ql-snow .ql-picker-label {
    min-height: 32px;
    color: rgb(var(--ink-300));
    font-size: 12px;
    font-weight: 400;
}
.rich-editor-more .ql-snow .ql-stroke { stroke: rgb(var(--ink-400)); }
.rich-editor-more .ql-snow .ql-fill { fill: rgb(var(--ink-400)); }

@container (max-width: 420px) {
    .ordero-editor .rich-editor-primary { gap: 2px; }
}
.ordero-editor .ql-snow.ql-container { border: 0; font: inherit; }
.ordero-editor .ql-editor {
    min-height: 6rem;
    resize: vertical;
    overflow-y: auto;
    padding: 12px;
    color: rgb(var(--ink-heading));
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}
.ordero-editor .ql-editor.ql-blank::before {
    color: rgb(var(--ink-500));
    font-style: normal;
}
.ordero-editor .ql-snow .ql-stroke { stroke: rgb(var(--ink-heading)); }
.ordero-editor .ql-snow .ql-fill { fill: rgb(var(--ink-heading)); }
.ordero-editor .ql-snow .ql-picker { color: rgb(var(--ink-heading)); }
.ordero-editor .ql-snow button { min-width: 30px; height: 32px; border-radius: 5px; color: rgb(var(--ink-400)); }
.ordero-editor .ql-toolbar.ql-snow .rich-editor-primary > .ql-formats > button:not(.rich-editor-toggle) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.ordero-editor .ql-snow button:not(.rich-editor-toggle) svg {
    width: 18px;
    height: 18px;
}
.ordero-editor .ql-snow .ql-stroke { stroke-width: 1.35; }
.ordero-editor .ql-snow button:hover,
.ordero-editor .ql-snow button.ql-active { background: rgb(var(--accent-500) / 0.15); color: rgb(var(--accent-400)); }
.ordero-editor .ql-snow button:hover .ql-stroke,
.ordero-editor .ql-snow button.ql-active .ql-stroke { stroke: rgb(var(--accent-400)); }
.ordero-editor .ql-snow button:hover .ql-fill,
.ordero-editor .ql-snow button.ql-active .ql-fill { fill: rgb(var(--accent-400)); }
.ordero-editor .ql-snow button:focus-visible,
.ordero-editor .ql-picker-label:focus-visible,
.ordero-editor .ql-picker-item:focus-visible { outline: 2px solid rgb(var(--accent-500)); outline-offset: 1px; }
.ordero-editor .ql-snow .ql-picker-label { min-height: 32px; display: flex; align-items: center; }
.ordero-editor .ql-snow .ql-picker-options {
    z-index: 40;
    max-width: min(260px, 75vw);
    border: 1px solid rgb(var(--border-800));
    border-radius: 6px;
    background: rgb(var(--surface-900));
    color: rgb(var(--ink-heading));
    max-height: min(240px, 40dvh);
    overflow-y: auto;
}
.ordero-editor .ql-snow .ql-picker { height: 32px; }
.ordero-editor .ql-snow .ql-color-picker .ql-picker-options { left: 0; right: auto; }
.ordero-editor .ql-snow .ql-picker.ql-font { width: auto; min-width: 0; flex: 1; }
.ordero-editor .ql-toolbar.ql-snow .ql-picker.ql-font { width: 36px; flex: 0 0 36px; }
.ordero-editor .ql-toolbar.ql-snow .ql-picker.ql-font .ql-picker-options { min-width: 180px; }
.ordero-editor .ql-toolbar.ql-snow .ql-picker.ql-size { width: 42px; flex: 0 0 42px; }
.ordero-editor .ql-toolbar.ql-snow .ql-picker.ql-size .ql-picker-options { min-width: 120px; }
.ordero-editor .ql-toolbar.ql-snow .ql-picker.ql-size .ql-picker-label { padding-left: 4px; padding-right: 8px; }
.ordero-editor .ql-snow .ql-picker-label::before { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ordero-editor .ql-toolbar.ql-snow .ql-picker.ql-size .ql-picker-options { left: auto; right: 0; }
.ordero-editor .ql-toolbar.ql-snow .ql-picker.ql-font .ql-picker-label::before {
    content: "T";
    font-size: 14px;
    font-weight: 600;
}
.ordero-editor .ql-toolbar.ql-snow .ql-picker.ql-size .ql-picker-label::before {
    content: "Aa";
    font-size: 12px;
    font-weight: 600;
}
.ordero-editor .ql-toolbar.ql-snow .ql-picker.ql-size .ql-picker-label::before { margin-right: 3px; }
.ordero-editor .ql-snow .ql-picker.ql-font .ql-picker-label::before,
.ordero-editor .ql-snow .ql-picker.ql-font .ql-picker-item::before,
.ordero-editor .ql-snow .ql-picker.ql-size .ql-picker-label::before,
.ordero-editor .ql-snow .ql-picker.ql-size .ql-picker-item::before { content: attr(data-label); }
.ordero-editor .ql-toolbar.ql-snow .ql-picker.ql-font .ql-picker-label::before { content: "T"; }
@media (min-width: 640px) {
    .ordero-editor .ql-snow button,
    .ordero-editor .ql-snow .ql-picker { min-width: 36px; height: 36px; }
    .ordero-editor .ql-snow .ql-picker-label { min-height: 36px; }
    .ordero-editor .ql-snow button:not(.rich-editor-toggle) svg { width: 20px; height: 20px; }
}
@media (max-width: 639px) {
    .form-builder-actions { z-index: 60; }
    .rich-editor-component > .rich-editor-field-actions-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 44px;
    }
    .rich-editor-field-type { width: 100%; }
    .rich-editor-field-buttons {
        grid-column: 1 / -1;
        grid-row: 1;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        width: 100%;
        margin-left: 0;
    }
    .rich-editor-field-buttons > .rich-editor-field-actions { display: contents; }
    .rich-editor-field-buttons button { width: 100%; margin-left: 0; }
    .ordero-editor:focus-within {
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr);
        align-items: start;
    }
    .ordero-editor:not(:focus-within) > .rich-editor-controls-row { display: none; }
    .ordero-editor:focus-within > .rich-editor-controls-row {
        position: sticky;
        top: var(--rich-toolbar-top, 0px);
        z-index: 40;
        align-self: start;
        width: 44px;
        padding: 2px;
        border-right: 1px solid rgb(var(--border-800));
        background: rgb(var(--surface-950));
        border-radius: 8px 0 0 8px;
        container-type: normal;
    }
    .ordero-editor:focus-within > .rich-editor-surface { grid-column: 2; }
    .ordero-editor > .rich-editor-link-form { grid-column: 1 / -1; }
    .ordero-editor:focus-within .ql-toolbar.ql-snow {
        transform: none;
        transition: none;
        overflow: visible;
    }
    .ordero-editor .ql-toolbar.ql-snow .rich-editor-primary {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 2px;
    }
    .ordero-editor .rich-editor-primary > .ql-formats { display: contents; }
    .ordero-editor .ql-snow .rich-editor-toggle { margin-left: 0; }
    .ordero-editor .ql-snow button { min-width: 40px; height: 44px; }
    .ordero-editor .ql-snow .ql-picker-label { min-height: 44px; }
    .ordero-editor .rich-editor-list-picker { position: static; }
    .ordero-editor .rich-editor-list-menu {
        left: calc(100% + 4px);
        min-width: 0;
        width: min(176px, calc(100vw - 144px));
    }
    .ordero-editor .rich-editor-more,
    .ordero-editor .rich-editor-list-menu,
    .ordero-editor .ql-snow .ql-picker-options {
        top: 0;
        bottom: auto;
        max-height: min(240px, 40dvh);
        overflow-y: auto;
    }
    .ordero-editor .rich-editor-more {
        left: calc(100% + 4px);
        right: auto;
        width: min(240px, calc(100vw - 144px));
    }
    .ordero-editor .rich-editor-more .ql-picker-options {
        position: static;
        max-width: 100%;
    }
    .ordero-editor .ql-editor { scroll-margin-top: var(--rich-toolbar-top, 0px); }
}
.ordero-editor .ql-font-inter,
.ordero-editor .ql-font .ql-picker-item[data-value=inter] { font-family: Inter, sans-serif; }
.ordero-editor .ql-font-lato,
.ordero-editor .ql-font .ql-picker-item[data-value=lato] { font-family: Lato, sans-serif; }
.ordero-editor .ql-font-montserrat,
.ordero-editor .ql-font .ql-picker-item[data-value=montserrat] { font-family: Montserrat, sans-serif; }
.ordero-editor .ql-size .ql-picker-item[data-value=small],
.ordero-editor .ql-size .ql-picker-item[data-value=large],
.ordero-editor .ql-size .ql-picker-item[data-value=huge] { display: none; }
.ordero-editor .ql-font-outfit,
.ordero-editor .ql-font .ql-picker-item[data-value=outfit] { font-family: Outfit, sans-serif; }
.ordero-editor .ql-font-ibm-plex-sans,
.ordero-editor .ql-font .ql-picker-item[data-value=ibm-plex-sans] { font-family: 'IBM Plex Sans', sans-serif; }
.ordero-editor .ql-font-eb-garamond,
.ordero-editor .ql-font .ql-picker-item[data-value=eb-garamond] { font-family: 'EB Garamond', serif; }
.ordero-editor .ql-font-source-serif-4,
.ordero-editor .ql-font .ql-picker-item[data-value=source-serif-4] { font-family: 'Source Serif 4', serif; }
.ordero-editor .ql-font-space-mono,
.ordero-editor .ql-font .ql-picker-item[data-value=space-mono] { font-family: 'Space Mono', monospace; }
.ordero-editor .ql-font-ibm-plex-mono,
.ordero-editor .ql-font .ql-picker-item[data-value=ibm-plex-mono] { font-family: 'IBM Plex Mono', monospace; }
.rich-editor-more .ql-snow button.ql-code { color: rgb(var(--ink-300)); }
.rich-editor-more .ql-snow button.ql-code .ql-stroke { stroke: rgb(var(--ink-300)); }
.rich-editor-more .ql-snow button.ql-code .ql-fill { fill: rgb(var(--ink-300)); }
.rich-text-code,
.formatted-text code.rich-text-code,
.ordero-editor .ql-editor code {
    display: inline-block;
    color: rgb(var(--ink-heading));
    background: rgb(var(--surface-800));
    border: 1px solid rgb(var(--accent-500) / 0.8);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.92em;
    font-weight: 600;
    padding: 0.12em 0.38em;
    border-radius: 0.35em;
}
.ordero-editor .ql-tooltip { display: none; }
.ordero-editor .ql-editor li[data-list=alpha] { counter-increment: list-0; counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8; }
.ordero-editor .ql-editor li[data-list=alpha] > .ql-ui::before { content: counter(list-0, lower-alpha) ". "; }
.ordero-editor .ql-editor li[data-list=alpha].ql-indent-1 { counter-increment: list-1; counter-reset: list-2 list-3 list-4 list-5 list-6 list-7 list-8; }
.ordero-editor .ql-editor li[data-list=alpha].ql-indent-1 > .ql-ui::before { content: counter(list-1, lower-alpha) ". "; }
.ordero-editor .ql-editor li[data-list=alpha].ql-indent-2 { counter-increment: list-2; counter-reset: list-3 list-4 list-5 list-6 list-7 list-8; }
.ordero-editor .ql-editor li[data-list=alpha].ql-indent-2 > .ql-ui::before { content: counter(list-2, lower-alpha) ". "; }
.ordero-editor .ql-editor li[data-list=alpha].ql-indent-3 { counter-increment: list-3; counter-reset: list-4 list-5 list-6 list-7 list-8; }
.ordero-editor .ql-editor li[data-list=alpha].ql-indent-3 > .ql-ui::before { content: counter(list-3, lower-alpha) ". "; }
.ordero-editor .ql-editor li[data-list=alpha].ql-indent-4 { counter-increment: list-4; counter-reset: list-5 list-6 list-7 list-8; }
.ordero-editor .ql-editor li[data-list=alpha].ql-indent-4 > .ql-ui::before { content: counter(list-4, lower-alpha) ". "; }
.ordero-editor .ql-editor li[data-list=alpha].ql-indent-5 { counter-increment: list-5; counter-reset: list-6 list-7 list-8; }
.ordero-editor .ql-editor li[data-list=alpha].ql-indent-5 > .ql-ui::before { content: counter(list-5, lower-alpha) ". "; }
.ordero-editor .ql-editor li[data-list=alpha].ql-indent-6 { counter-increment: list-6; counter-reset: list-7 list-8; }
.ordero-editor .ql-editor li[data-list=alpha].ql-indent-6 > .ql-ui::before { content: counter(list-6, lower-alpha) ". "; }
.ordero-editor .ql-editor li[data-list=alpha].ql-indent-7 { counter-increment: list-7; counter-reset: list-8; }
.ordero-editor .ql-editor li[data-list=alpha].ql-indent-7 > .ql-ui::before { content: counter(list-7, lower-alpha) ". "; }
.ordero-editor .ql-editor li[data-list=alpha].ql-indent-8 { counter-increment: list-8; counter-reset: none; }
.ordero-editor .ql-editor li[data-list=alpha].ql-indent-8 > .ql-ui::before { content: counter(list-8, lower-alpha) ". "; }
@media (prefers-reduced-motion: reduce) {
    .ordero-editor,
    .ordero-editor .ql-toolbar.ql-snow,
    .rich-editor-more-enter,
    .rich-editor-more-leave {
        transition-duration: 0.01ms;
    }
}
