/* ==========================================================================
   THE CONVERSE BUILDER - shell + tokens (builder-design-bible.md, section 3.1)

   Every --conv-* token is DERIVED from a --theme-* token, so a tenant theme
   (a dark one included) re-skins the builder for free. No raw colours here or
   in any conv-*.css file (Tests/ConversationBuilderPortalTests enforces it).

   File ownership (one per lane, all linked from index.html):
     conv-builder.css  - tokens, page shell, header, tab bar, banners, list page,
                         the new-conversation modal            (skeleton)
     conv-canvas.css   - canvas, cards, connectors              (canvas lane)
     conv-drawer.css   - the config drawer + sections           (drawer lane)
     conv-commands.css - menus, hover toolbar, + picker         (commands lane)
     conv-rail.css     - left rail, copilot dock, settings tab  (rail lane)
     conv-tokens.css   - the leveled [[ picker + token field    (token picker lane)
     conv-preview.css  - the page split + the preview dock      (preview lane)
   ========================================================================== */

.conv-builder {
    --conv-canvas-bg: var(--theme-background-subtle);
    --conv-canvas-dot: color-mix(in srgb, var(--theme-border-subtle) 70%, transparent);
    --conv-node-bg: var(--theme-background-raised);
    --conv-node-border: var(--theme-border);
    /* THE LINES MUST READ ON ANY THEME (Kirk, 2026-11-20: "the lines in builder are way too light"). A connector is how the
       canvas says what follows what - structure, not decoration - so it is drawn from the theme's muted TEXT colour mixed
       into the canvas, never from a border token: a workspace whose theme has pale borders made every line all but
       invisible. 70% is about 3 to 1 against the canvas on the default theme (a graphic that carries meaning needs that). */
    --conv-edge: color-mix(in srgb, var(--theme-text-muted) 70%, var(--conv-canvas-bg));

    /* THE FOUR FAMILIES (--conv-ask / -say / -act / -flow / -end and their -soft / -ink) live on :root in root.css
       since the look (bible section 11): Ask, Say, Act and Flow mean the same on every page. The builder's own copy
       is retired - one definition, so the builder and the home can never disagree about a family's hue. */

    /* The selection ring wears the selected moment's family hue (set per card as --conv-fam). */
    --conv-select: var(--conv-fam, var(--conv-ask));

    --conv-issue-warn: var(--theme-warning);
    --conv-issue-error: var(--theme-danger);
    --conv-motion: var(--theme-transition, 150ms ease);

    font-family: var(--theme-font);
    color: var(--theme-text);
}

/* Family hooks - one card shape, four hues. */
.conv-builder .conv-fam-ask { --conv-fam: var(--conv-ask); --conv-fam-soft: var(--conv-ask-soft); }
.conv-builder .conv-fam-say { --conv-fam: var(--conv-say); --conv-fam-soft: var(--conv-say-soft); }
.conv-builder .conv-fam-act { --conv-fam: var(--conv-act); --conv-fam-soft: var(--conv-act-soft); }
.conv-builder .conv-fam-flow { --conv-fam: var(--conv-flow); --conv-fam-soft: var(--conv-flow-soft); }
.conv-builder .conv-fam-neutral { --conv-fam: var(--conv-end); --conv-fam-soft: var(--conv-end-soft); }

/* ── The full-bleed layout (an App Page that owns the viewport) ─────────── */

.conv-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    background: var(--theme-background);
}

.conv-shell {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: var(--theme-background);
}

.conv-body {
    position: relative;
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Row 1: back, panel, title + state line, history, undo / redo, Save ── */

/* Row 1 wears THE SHELL BAR'S LOOK (portal-look-and-feel.md 3.4, Kirk's decision 7 - the builder must never be a
   second style): the shell bar's height (--wf-shellbar-h, 56px), the shell's icon-button spec (36px, round on the tenant's button radius), the crumb type on
   the way back, the same Ask pill (.wf-shellbar-ask, nav-side.css) and the same bell (NeedsYouBell). It stays on the
   raised band with row 2 - the canvas owns the viewport under it (bible 4). */
.conv-header {
    display: flex;
    align-items: center;
    gap: 8px;
    height: var(--wf-shellbar-h);
    padding: 0 20px 0 16px;
    border-bottom: 1px solid var(--theme-border-subtle);
    background: var(--theme-background-raised);
}

.conv-header .conv-icon-btn,
.conv-header .wf-shell-iconbtn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: var(--wf-radius-pill);
    font-size: 17px;
}

.conv-header .wf-shell-iconbtn:hover,
.conv-header .wf-shell-iconbtn.is-on {
    background: var(--theme-background-hover);
}

.conv-header .wf-shell-dot {
    border-color: var(--theme-background-raised);
}

.conv-header-sep {
    width: 1px;
    height: 22px;
    margin: 0 6px;
    background: var(--wf-line);
}

.conv-header-left,
.conv-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1 1 0;
    min-width: 0;
}

.conv-header-right {
    justify-content: flex-end;
}

.conv-header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 2 1 0;
    min-width: 0;
}

.conv-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 2px 8px;
    border: 1px solid transparent;
    border-radius: var(--theme-radius-button);
    background: transparent;
    color: var(--theme-text-emphasis);
    font-size: var(--theme-font-size-lg);
    font-weight: 600;
    cursor: text;
    transition: border-color var(--conv-motion), background var(--conv-motion);
}

.conv-title:hover,
.conv-title:focus-visible {
    border-color: var(--theme-border-subtle);
    background: var(--theme-background-hover);
    outline: none;
}

.conv-title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conv-title .bi {
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-sm);
}

.conv-title-input {
    width: min(420px, 100%);
    padding: 3px 8px;
    border: 1px solid var(--conv-ask);
    border-radius: var(--theme-radius-button);
    background: var(--theme-background-raised);
    color: var(--theme-text-emphasis);
    font: inherit;
    font-size: var(--theme-font-size-lg);
    font-weight: 600;
    text-align: center;
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--conv-ask) 18%, transparent);
}

.conv-stateline {
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.conv-stateline.is-busy {
    color: var(--theme-text-secondary);
}

.conv-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid transparent;
    border-radius: var(--theme-radius-button);
    background: transparent;
    color: var(--theme-text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: background var(--conv-motion), color var(--conv-motion), border-color var(--conv-motion);
}

.conv-icon-btn:hover:not(:disabled),
.conv-icon-btn:focus-visible {
    background: var(--theme-background-hover);
    color: var(--theme-text-emphasis);
    outline: none;
}

a.conv-icon-btn { text-decoration: none; }

.conv-icon-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.conv-icon-btn.is-on {
    background: var(--conv-ask-soft);
    color: var(--conv-ask);
}

/* Back to Conversations in the shell bar's CRUMB type: 13px, muted, 500; primary ink on hover. */
.conv-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--wf-radius-pill);
    background: transparent;
    color: var(--theme-text-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--conv-motion), color var(--conv-motion);
}

.conv-back:hover,
.conv-back:focus-visible {
    background: var(--theme-background-hover);
    color: var(--wf-primary-ink);
    outline: none;
}

.conv-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius-button);
    background: var(--theme-background-raised);
    color: var(--theme-text);
    font: inherit;
    font-size: var(--theme-font-size-sm);
    font-weight: 500;
    /* An <a class="conv-btn"> (the Conversations header's Classic list / Experiences) is a button, never an underlined link. */
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--conv-motion), border-color var(--conv-motion), box-shadow var(--conv-motion);
}

.conv-btn:hover:not(:disabled),
.conv-btn:focus-visible {
    background: var(--theme-background-hover);
    outline: none;
}

.conv-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.conv-btn-primary {
    border-color: var(--conv-ask);
    background: var(--conv-ask);
    color: var(--theme-text-on-primary);
}

.conv-btn-primary:hover:not(:disabled),
.conv-btn-primary:focus-visible {
    background: var(--theme-primary-hover);
    box-shadow: var(--theme-shadow);
}

.conv-btn-danger {
    border-color: var(--conv-issue-error);
    color: var(--conv-issue-error);
}

.conv-btn-quiet {
    border-color: transparent;
    background: transparent;
}

.conv-save {
    position: relative;
}

.conv-save-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--conv-issue-error);
    box-shadow: 0 0 0 2px var(--theme-background-raised);
}

/* ── Row 2: layout picker, tabs, Test, Publish ─────────────────────────── */

.conv-tabbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    border-bottom: 1px solid var(--theme-border-subtle);
    background: var(--theme-background-raised);
    min-height: 44px;
}

.conv-tabbar-left,
.conv-tabbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 0;
}

.conv-tabbar-right {
    justify-content: flex-end;
}

.conv-tabs {
    display: flex;
    align-items: stretch;
    gap: 4px;
    align-self: stretch;
}

.conv-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    border: 0;
    background: transparent;
    color: var(--theme-text-secondary);
    font: inherit;
    font-size: var(--theme-font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: color var(--conv-motion);
}

.conv-tab::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: transparent;
    transition: background var(--conv-motion);
}

.conv-tab:hover,
.conv-tab:focus-visible {
    color: var(--theme-text-emphasis);
    outline: none;
}

.conv-tab.is-active {
    color: var(--theme-text-emphasis);
}

.conv-tab.is-active::after {
    background: var(--conv-ask);
}

.conv-select {
    padding: 4px 8px;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius-button);
    background: var(--theme-background-raised);
    color: var(--theme-text);
    font: inherit;
    font-size: var(--theme-font-size-sm);
}

/* The Publish switch: the conversation's live state, not a mode of the editor. */
.conv-publish {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 4px 10px;
    border: 1px solid var(--theme-border);
    border-radius: 999px;
    background: var(--theme-background-raised);
    font-size: var(--theme-font-size-sm);
    color: var(--theme-text);
}

.conv-publish-label {
    white-space: nowrap;
}

.conv-publish-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--conv-issue-warn);
}

.conv-switch {
    position: relative;
    width: 40px;
    height: 22px;
    border: 0;
    border-radius: 999px;
    background: var(--theme-border);
    cursor: pointer;
    transition: background var(--conv-motion);
}

.conv-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--theme-background-raised);
    box-shadow: var(--theme-shadow);
    transition: transform var(--conv-motion);
}

.conv-switch.is-on {
    background: var(--theme-success);
}

.conv-switch.is-on::after {
    transform: translateX(18px);
}

.conv-switch:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.conv-switch:focus-visible {
    outline: 2px solid var(--conv-ask);
    outline-offset: 2px;
}

/* ── Banners, toast, placeholders, skeleton ───────────────────────────── */

.conv-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 12px 16px 0;
    padding: 10px 14px;
    border: 1px solid var(--theme-border);
    border-left: 4px solid var(--theme-info);
    border-radius: var(--theme-radius);
    background: var(--theme-background-raised);
    box-shadow: var(--theme-shadow);
    font-size: var(--theme-font-size-sm);
}

.conv-banner--warn { border-left-color: var(--conv-issue-warn); }
.conv-banner--danger { border-left-color: var(--conv-issue-error); }

.conv-banner-icon {
    font-size: 1.1rem;
    line-height: 1.3;
    color: var(--theme-info);
}

.conv-banner--warn .conv-banner-icon { color: var(--conv-issue-warn); }
.conv-banner--danger .conv-banner-icon { color: var(--conv-issue-error); }

.conv-banner-body {
    flex: 1;
    min-width: 0;
}

.conv-banner-title {
    font-weight: 600;
    color: var(--theme-text-emphasis);
}

.conv-banner-list {
    margin: 6px 0 0;
    padding-left: 18px;
    color: var(--theme-text-secondary);
}

/* The server's own words under a banner (a failed draft autosave) - quiet, never the headline. */
.conv-banner-detail {
    margin-top: 4px;
    color: var(--theme-text-secondary);
    overflow-wrap: anywhere;
}

.conv-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.conv-toast {
    position: absolute;
    left: 50%;
    bottom: 24px;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(560px, calc(100% - 32px));
    padding: 10px 16px;
    border-radius: var(--theme-radius);
    background: var(--theme-text-emphasis);
    color: var(--theme-background-raised);
    box-shadow: var(--theme-shadow-lg);
    font-size: var(--theme-font-size-sm);
    transform: translateX(-50%);
    animation: conv-toast-in 200ms ease;
}

.conv-toast .bi {
    color: var(--conv-ask-soft);
}

/* The toast's Undo (Add an action - CONVERSATION-BUILDER.md section 32): takes back exactly the edit the toast reports. */
.conv-toast-undo {
    flex: none;
    margin-left: 4px;
    padding: 3px 10px;
    border: 1px solid color-mix(in srgb, var(--theme-background-raised) 45%, transparent);
    border-radius: var(--theme-radius-button);
    background: transparent;
    color: var(--theme-background-raised);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--conv-motion);
}

.conv-toast-undo:hover {
    background: color-mix(in srgb, var(--theme-background-raised) 16%, transparent);
}

.conv-toast-undo:focus-visible {
    outline: 0;
    box-shadow: var(--theme-focus-ring);
}

@keyframes conv-toast-in {
    from { opacity: 0; transform: translate(-50%, 6px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.conv-placeholder {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    background: var(--conv-canvas-bg);
}

.conv-placeholder-card {
    max-width: 440px;
    padding: 28px 28px 24px;
    border: 1px solid var(--theme-border-subtle);
    border-radius: var(--theme-radius);
    background: var(--conv-node-bg);
    box-shadow: var(--theme-shadow);
    text-align: center;
}

.conv-placeholder-card .bi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    border-radius: 14px;
    background: var(--conv-ask-soft);
    color: var(--conv-ask);
    font-size: 1.4rem;
}

.conv-placeholder-title {
    margin-bottom: 6px;
    color: var(--theme-text-emphasis);
    font-weight: 600;
}

.conv-placeholder-body {
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-sm);
}

.conv-skeleton {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 56px;
    flex: 1;
    padding: 48px 16px;
    background: var(--conv-canvas-bg);
}

.conv-skeleton-card {
    width: 280px;
    height: 76px;
    border-radius: var(--theme-radius);
    background: linear-gradient(90deg, var(--conv-node-bg) 0%, var(--theme-background-hover) 50%, var(--conv-node-bg) 100%);
    background-size: 200% 100%;
    box-shadow: var(--theme-shadow);
    animation: conv-shimmer 1.4s ease-in-out infinite;
}

.conv-skeleton-card.is-slim {
    width: 240px;
    height: 52px;
}

@keyframes conv-shimmer {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

/* The left-panel placeholder until the rail lane lands. */
.conv-rail-slot {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 280px;
    flex: 0 0 280px;
    padding: 16px;
    border-right: 1px solid var(--theme-border-subtle);
    background: var(--theme-background-raised);
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-sm);
}

.conv-rail-slot-title {
    color: var(--theme-text-emphasis);
    font-weight: 600;
}

/* ── Unsaved-changes dialog ───────────────────────────────────────────── */

/* Every backdrop is THE ONE SCRIM (--wf-scrim + a 3px blur). It used to mix --theme-text-emphasis, which is LIGHT on
   a dark tenant - the dialog sat on a pale wash. */
.conv-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--wf-scrim);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.conv-dialog {
    width: min(440px, 100%);
    padding: 22px 24px 20px;
    border-radius: var(--theme-radius);
    background: var(--theme-background-raised);
    box-shadow: var(--theme-shadow-lg);
}

.conv-dialog-title {
    margin-bottom: 6px;
    color: var(--theme-text-emphasis);
    font-size: var(--theme-font-size-lg);
    font-weight: 600;
}

.conv-dialog-body {
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-sm);
}

.conv-dialog-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

/* ── The conversations list ───────────────────────────────────────────── */

.conv-list {
    padding: 24px 24px 48px;
}

.conv-list-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.conv-list-title {
    margin: 0;
    color: var(--theme-text-emphasis);
    font-size: var(--theme-font-size-2xl);
    font-weight: 700;
}

.conv-list-sub {
    margin: 4px 0 0;
    color: var(--theme-text-secondary);
}

.conv-list-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.conv-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 240px;
    padding: 6px 12px;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius-button);
    background: var(--theme-background-raised);
    color: var(--theme-text-muted);
}

.conv-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--theme-text);
    font: inherit;
    outline: none;
}

.conv-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.conv-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 16px 14px;
    border: 1px solid var(--theme-border-subtle);
    border-left: 4px solid var(--conv-ask);
    border-radius: var(--theme-radius);
    background: var(--conv-node-bg);
    box-shadow: var(--theme-shadow);
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: box-shadow var(--conv-motion), transform var(--conv-motion);
}

.conv-card:hover,
.conv-card:focus-within {
    box-shadow: var(--theme-shadow-lg);
    transform: translateY(-1px);
    outline: none;
}

/* While its ⋯ menu is open the card holds still: the lift's transform would make it the containing block of the menu's
   fixed click-catcher and keep the menu inside the card's own layer. It rises above its neighbours instead
   (.wf-action-menu-host, pages.css). */
.conv-card:has(.wf-action-menu-list) {
    transform: none;
}

/* The card's first row: its name (the link, stretched over the whole card) and its ⋯ menu above that link. */
.conv-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.conv-card-link {
    color: var(--theme-text-emphasis);
    text-decoration: none;
}

.conv-card-link::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.conv-card-link:focus-visible {
    outline: none;
}

.conv-card-link:focus-visible::after {
    outline: 2px solid var(--conv-ask);
    outline-offset: 2px;
}

.conv-card .conv-act-menu {
    position: relative;
    z-index: 1;
    flex: none;
}

.conv-card-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: -4px -6px 0 0;
    border: 0;
    border-radius: var(--theme-radius-button);
    background: transparent;
    color: var(--theme-text-muted);
    cursor: pointer;
    transition: background var(--conv-motion), color var(--conv-motion);
}

.conv-card-more:hover,
.conv-card-more:focus-visible,
.conv-card-more.open {
    background: var(--theme-background-subtle);
    color: var(--theme-text-emphasis);
}

@media (pointer: coarse) {
    .conv-card-more {
        width: 44px;
        height: 44px;
    }
}

.conv-list-category {
    width: auto;
    min-width: 180px;
}

.conv-card-name {
    color: var(--theme-text-emphasis);
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.conv-card-desc {
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.conv-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-xs);
}

.conv-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--theme-background-subtle);
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-xs);
}

.conv-chip.is-live {
    background: color-mix(in srgb, var(--theme-success) 14%, var(--theme-background-raised));
    color: var(--theme-success);
}

.conv-chip.is-ahead {
    background: color-mix(in srgb, var(--conv-issue-warn) 16%, var(--theme-background-raised));
    color: var(--theme-text-emphasis);
}

.conv-empty {
    max-width: 520px;
    margin: 48px auto;
    text-align: center;
    color: var(--theme-text-secondary);
}

.conv-empty .conv-banner-actions {
    justify-content: center;
}

/* ── New conversation - open with AI (bible section 7.0) ──────────────── */

.conv-newconv-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10vh 16px 16px;
    background: var(--wf-scrim);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    animation: conv-fade 200ms ease;
}

.conv-newconv {
    position: relative;
    width: min(720px, 100%);
    padding: 32px 32px 24px;
    border-radius: calc(var(--theme-radius) * 2);
    background: var(--theme-background-raised);
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--conv-ask) 22%, transparent),
        0 0 60px 8px color-mix(in srgb, var(--conv-ask) 22%, transparent),
        var(--theme-shadow-lg);
    animation: conv-rise 240ms ease;
}

.conv-newconv-close {
    position: absolute;
    top: 12px;
    right: 12px;
}

.conv-newconv-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.conv-newconv-spark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--conv-ask-soft);
    color: var(--conv-ask);
    font-size: 1.3rem;
}

.conv-newconv-title {
    margin: 0;
    color: var(--theme-text-emphasis);
    font-size: var(--theme-font-size-xl);
    font-weight: 700;
}

.conv-newconv-sub {
    margin: 4px 0 0;
    color: var(--theme-text-secondary);
}

.conv-newconv-prompt {
    position: relative;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    background: var(--theme-background);
    transition: border-color var(--conv-motion), box-shadow var(--conv-motion);
}

.conv-newconv-prompt:focus-within {
    border-color: var(--conv-ask);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--conv-ask) 18%, transparent);
}

.conv-newconv-prompt textarea {
    display: block;
    width: 100%;
    min-height: 112px;
    padding: 14px 104px 14px 16px;
    border: 0;
    border-radius: var(--theme-radius);
    background: transparent;
    color: var(--theme-text);
    font: inherit;
    resize: vertical;
    outline: none;
}

.conv-newconv-prompt textarea::placeholder {
    color: var(--theme-text-placeholder);
}

.conv-newconv-prompt-actions {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: flex;
    gap: 6px;
}

.conv-newconv-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: var(--conv-ask);
    color: var(--theme-text-on-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: transform var(--conv-motion), box-shadow var(--conv-motion);
}

.conv-newconv-send:hover:not(:disabled),
.conv-newconv-send:focus-visible {
    box-shadow: var(--theme-shadow-lg);
    transform: translateY(-1px);
    outline: none;
}

.conv-newconv-send:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.conv-newconv-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.conv-newconv-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--theme-border);
    border-radius: 999px;
    background: var(--theme-background-raised);
    color: var(--theme-text);
    font: inherit;
    font-size: var(--theme-font-size-sm);
    cursor: pointer;
    transition: border-color var(--conv-motion), background var(--conv-motion), color var(--conv-motion);
}

.conv-newconv-chip .bi {
    color: var(--conv-ask);
}

.conv-newconv-chip:hover:not(:disabled),
.conv-newconv-chip:focus-visible {
    border-color: var(--conv-ask);
    background: var(--conv-ask-soft);
    color: var(--theme-text-emphasis);
    outline: none;
}

.conv-newconv-chip:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.conv-newconv-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-xs);
}

.conv-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--theme-text-secondary);
    font: inherit;
    font-size: var(--theme-font-size-sm);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.conv-link:hover,
.conv-link:focus-visible {
    color: var(--conv-ask);
    outline: none;
}

.conv-link:disabled {
    opacity: .5;
    cursor: not-allowed;
}

@keyframes conv-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes conv-rise {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: none; }
}

/* ── "Try the new builder" - on the CLASSIC canvas (outside .conv-builder) ─ */

.conv-try {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    padding: 8px 12px;
    border: 1px solid color-mix(in srgb, var(--theme-primary) 30%, var(--theme-border));
    border-radius: var(--theme-radius);
    background: color-mix(in srgb, var(--theme-primary) 8%, var(--theme-background-raised));
    color: var(--theme-text);
    font-size: var(--theme-font-size-sm);
}

.conv-try .bi {
    color: var(--theme-primary);
}

.conv-try a {
    margin-left: auto;
    color: var(--theme-primary);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.conv-try a:hover {
    text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
    .conv-builder *,
    .conv-newconv-backdrop,
    .conv-newconv,
    .conv-toast {
        animation: none !important;
        transition: none !important;
    }
}
