/* ==========================================================================
   THE CONVERSE BUILDER - the experience canvas (PLAN 5.9, wave 4)

   An experience (or a collection) as a horizontal timeline read left to right:
   the trigger card, one column per moment something can start (a stage that
   waits opens the next column, one that starts right away stacks beside the
   one before it - SequenceLayout), connectors that say in words how each
   column starts, the end. The same card shape and family hues as the
   conversation canvas (bible 3.2 / 3.3); the shell, rail, drawer and preview
   dock are the builder's own classes - this file owns only conv-seq-*.

   Tokens only - --theme-* / --conv-* / --wf-*, no raw colours
   (Tests/ConversationBuilderPortalTests). prefers-reduced-motion turns every
   animation and transition off. At phone width the columns stay a scroller of
   their own, never the page.
   ========================================================================== */

/* ── The work area ─────────────────────────────────────────────────────── */

.conv-seq-shell {
    min-width: 0;
}

/* The row under the tab bar: the rail, then the work (the builder's .conv-body - a row). Its own name: the card's text
   column is .conv-seq-body (a column), and the two once shared it - the page stacked the rail over the canvas. */
.conv-seq-page {
    min-width: 0;
}

.conv-seq-main {
    position: relative;
    display: flex;
    flex: 1;
    min-width: 0;
    min-height: 0;
}

.conv-seq-work {
    position: relative;
    display: flex;
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.conv-seq-canvas {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding: 32px 32px 48px;
    background-color: var(--conv-canvas-bg);
    background-image: radial-gradient(var(--conv-canvas-dot) 1px, transparent 1.2px);
    background-size: 16px 16px;
    outline: none;
}

.conv-seq-canvas:focus-visible {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--conv-ask) 40%, transparent);
}

/* The drawer covers the right of the work area; the timeline keeps room to scroll out from under it. */
.conv-seq-work.has-drawer .conv-seq-canvas {
    padding-right: calc(min(440px, 100%) + 32px);
}

.conv-seq-track {
    display: flex;
    align-items: flex-start;
    gap: 0;
    width: max-content;
    min-height: 100%;
}

/* ── Columns ───────────────────────────────────────────────────────────── */

.conv-seq-col {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 264px;
    flex: 0 0 auto;
}

.conv-seq-col--start,
.conv-seq-col--end {
    width: 220px;
}

.conv-seq-col--first {
    width: 300px;
}

/* ── The connector between columns: a line, its words, a + ─────────────── */

.conv-seq-link {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: 132px;
    flex: 0 0 auto;
    padding-top: 22px;
}

.conv-seq-link.is-empty,
.conv-seq-link.is-next {
    width: 72px;
}

.conv-seq-line {
    position: absolute;
    top: 34px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--conv-edge);
}

.conv-seq-link.is-rule .conv-seq-line {
    background: repeating-linear-gradient(90deg, var(--conv-flow) 0 6px, transparent 6px 11px);
}

.conv-seq-linkwords {
    position: relative;
    z-index: 1;
    max-width: 124px;
    margin-top: 22px;
    padding: 2px 8px;
    border-radius: var(--wf-radius-pill);
    background: var(--conv-canvas-bg);
    color: var(--theme-text-secondary);
    font-size: var(--theme-font-size-xs);
    line-height: 1.35;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.conv-seq-link.is-rule .conv-seq-linkwords {
    color: var(--conv-flow);
}

/* The + on a connector (and after the last column). */
.conv-seq-insert {
    position: absolute;
    top: 22px;
    left: 50%;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    translate: -50% 0;
    border: 1px solid var(--theme-border);
    border-radius: var(--wf-radius-pill);
    background: var(--theme-background-raised);
    color: var(--theme-text-muted);
    font-size: 14px;
    cursor: pointer;
    opacity: .7;
    transition: opacity var(--conv-motion), color var(--conv-motion), border-color var(--conv-motion), scale var(--conv-motion);
}

.conv-seq-link:hover .conv-seq-insert,
.conv-seq-insert:focus-visible {
    opacity: 1;
    color: var(--conv-ask);
    border-color: var(--conv-ask);
    scale: 1.08;
}

.conv-seq-insert:focus-visible {
    outline: 2px solid var(--theme-focus-ring);
    outline-offset: 2px;
}

/* A connector under the pointer (a drag included) lights as the place a drop lands. */
.conv-seq-link:hover .conv-seq-line {
    background: color-mix(in srgb, var(--conv-ask) 60%, var(--conv-edge));
}

/* A column that starts ON ITS OWN later in the order (Immediately, or When a rule holds - SequenceLayout's OnItsOwn) waits
   for none of the cards to its left: no line joins it to the column before it - its words carry the trigger's glyph, and
   the lead from the trigger card (below) feeds it. */
.conv-seq-link.is-own .conv-seq-line {
    display: none;
}

.conv-seq-link.is-own .conv-seq-linkwords > .bi {
    margin-right: 3px;
}

.conv-seq-link.is-sent .conv-seq-linkwords {
    color: var(--conv-act);
}

/* ── The lead from the trigger card ────────────────────────────────────────
   Bible 3.4: orthogonal, 12px rounded elbows, dashed like a Go To, ending in an arrowhead. It rises from the trigger card,
   runs along the gutter above the timeline (the track keeps room for it) and drops onto every column that starts on its
   own, in the trigger card's hue. */

.conv-seq-track.has-lead {
    --conv-seq-lead-y: -22px;
    --conv-seq-drop-x: 40px;
    padding-top: 30px;
}

.conv-seq-col.is-lead-start,
.conv-seq-col.is-lead-pass,
.conv-seq-col.is-lead-drop {
    position: relative;
}

/* The rise from the trigger card, turning along the gutter. */
.conv-seq-col.is-lead-start::before {
    content: "";
    position: absolute;
    top: var(--conv-seq-lead-y);
    left: 50%;
    right: 0;
    height: calc(var(--conv-seq-lead-y) * -1);
    border-top: 2px dashed var(--conv-act);
    border-left: 2px dashed var(--conv-act);
    border-top-left-radius: 12px;
    pointer-events: none;
}

/* Straight on, over a connector or a column it passes. */
.conv-seq-link.is-lead-pass::before,
.conv-seq-col.is-lead-pass::before {
    content: "";
    position: absolute;
    top: var(--conv-seq-lead-y);
    left: 0;
    right: 0;
    border-top: 2px dashed var(--conv-act);
    pointer-events: none;
}

/* The last column it reaches: the gutter's last stretch, turning down onto the card. */
.conv-seq-col.is-lead-drop:not(.is-lead-pass)::before {
    content: "";
    position: absolute;
    top: var(--conv-seq-lead-y);
    left: 0;
    width: var(--conv-seq-drop-x);
    height: calc(var(--conv-seq-lead-y) * -1 - 7px);
    border-top: 2px dashed var(--conv-act);
    border-right: 2px dashed var(--conv-act);
    border-top-right-radius: 12px;
    pointer-events: none;
}

/* The drop onto the column's first card - a branch down from the lead where it runs on, and the arrowhead. */
.conv-seq-drop {
    position: absolute;
    top: var(--conv-seq-lead-y);
    left: calc(var(--conv-seq-drop-x) - 2px);
    height: calc(var(--conv-seq-lead-y) * -1 - 7px);
    pointer-events: none;
}

.conv-seq-col.is-lead-pass > .conv-seq-drop {
    border-left: 2px dashed var(--conv-act);
}

.conv-seq-drop::after {
    content: "";
    position: absolute;
    bottom: -7px;
    left: -4px;
    border-top: 7px solid var(--conv-act);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}

/* ── The trigger card and the end ──────────────────────────────────────── */

.conv-seq-trigger,
.conv-seq-end {
    --conv-select: var(--conv-fam, var(--conv-act));
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--conv-node-border);
    border-radius: var(--theme-radius);
    background: var(--conv-node-bg);
    box-shadow: var(--theme-shadow);
    color: var(--theme-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: box-shadow var(--conv-motion), border-color var(--conv-motion);
}

.conv-seq-trigger:hover,
.conv-seq-end:hover {
    box-shadow: var(--theme-shadow-lg);
}

.conv-seq-trigger:focus-visible,
.conv-seq-end:focus-visible {
    outline: 2px solid var(--theme-focus-ring);
    outline-offset: 2px;
}

.conv-seq-trigger-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.conv-seq-trigger-title,
.conv-seq-end-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--theme-text-emphasis);
    font-size: 13px;
    font-weight: 600;
}

.conv-seq-trigger-line,
.conv-seq-end-sub {
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-xs);
    line-height: 1.35;
    word-break: break-word;
}

.conv-seq-end {
    flex-direction: column;
    gap: 4px;
    border-style: dashed;
}

.conv-seq-end.is-selected {
    border-color: var(--conv-select);
    border-style: solid;
    box-shadow: 0 0 0 2px var(--conv-select), var(--theme-shadow-lg);
}

/* ── The first-add card (an empty experience) ──────────────────────────── */

.conv-seq-firstadd {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 24px 18px;
    border: 2px dashed var(--theme-border);
    border-radius: var(--theme-radius);
    background: var(--theme-background-raised);
    color: var(--theme-text-muted);
    font: inherit;
    cursor: pointer;
    transition: border-color var(--conv-motion), color var(--conv-motion);
}

.conv-seq-firstadd:hover:not(:disabled),
.conv-seq-firstadd:focus-visible {
    border-color: var(--conv-ask);
    color: var(--conv-ask);
}

.conv-seq-firstadd > .bi {
    font-size: 22px;
}

.conv-seq-firstadd-title {
    color: var(--theme-text-emphasis);
    font-weight: 600;
}

.conv-seq-firstadd-hint {
    font-size: var(--theme-font-size-xs);
    text-align: center;
}

/* ── A card ────────────────────────────────────────────────────────────── */

.conv-seq-card {
    --conv-select: var(--conv-fam, var(--conv-ask));
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 12px 12px 16px;
    border: 1px solid var(--conv-node-border);
    border-radius: var(--theme-radius);
    background: var(--conv-node-bg);
    box-shadow: var(--theme-shadow);
    color: var(--theme-text);
    cursor: pointer;
    user-select: none;
    animation: conv-seq-in var(--conv-motion);
    transition: box-shadow var(--conv-motion), border-color var(--conv-motion), transform var(--conv-motion), opacity 200ms ease;
}

/* The 4px family edge. */
.conv-seq-card::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 4px;
    border-radius: var(--theme-radius) 0 0 var(--theme-radius);
    background: var(--conv-fam, var(--conv-end));
}

@keyframes conv-seq-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
}

.conv-seq-card:hover {
    box-shadow: var(--theme-shadow-lg);
    transform: translateY(-1px);
}

/* While its menu is open the card holds still (no lift): a transform would keep the menu inside the card's own layer,
   under the cards below it in the column. It rises above them instead (.wf-action-menu-host, pages.css). Its entrance
   (conv-seq-in) is left alone: it has long finished and leaves nothing behind, and taking it away here would play it
   again - the card fading and sliding in - every time the menu closes. */
.conv-seq-card:has(.wf-action-menu-list) {
    transform: none;
}

.conv-seq-card.is-selected {
    border-color: var(--conv-select);
    box-shadow:
        0 0 0 2px var(--conv-select),
        0 0 0 6px color-mix(in srgb, var(--conv-select) 20%, transparent),
        var(--theme-shadow-lg);
}

.conv-seq-card.has-warn {
    border-color: color-mix(in srgb, var(--conv-issue-warn) 60%, var(--conv-node-border));
}

.conv-seq-card.has-error {
    border-color: var(--conv-issue-error);
}

.conv-seq-card.is-dragging {
    opacity: .45;
}

.conv-seq-num {
    position: absolute;
    top: -9px;
    left: 12px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--wf-radius-pill);
    background: var(--conv-fam, var(--conv-end));
    color: var(--theme-text-on-primary);
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}

.conv-seq-ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--conv-fam-soft, var(--conv-end-soft));
    color: var(--conv-fam, var(--conv-end));
    font-size: 1rem;
}

.conv-seq-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.conv-seq-title {
    color: var(--theme-text-emphasis);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.conv-seq-sub {
    color: var(--theme-text-muted);
    font-size: 12px;
    line-height: 1.35;
    word-break: break-word;
}

.conv-seq-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.conv-seq-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 1px 8px;
    border: 1px solid var(--theme-border-subtle);
    border-radius: var(--wf-radius-pill);
    background: var(--theme-background-subtle);
    color: var(--theme-text-secondary);
    font-size: 11px;
    line-height: 1.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-seq-chip.is-warn {
    border-color: color-mix(in srgb, var(--theme-warning) 45%, transparent);
    background: var(--wf-warning-soft);
    color: var(--wf-warning-ink);
}

.conv-seq-chip.is-act {
    border-color: color-mix(in srgb, var(--conv-act) 40%, transparent);
    background: var(--conv-act-soft);
    color: var(--conv-act);
}

.conv-seq-chip-x {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font-size: 12px;
    cursor: pointer;
    opacity: .7;
}

.conv-seq-chip-x:hover:not(:disabled) {
    opacity: 1;
}

/* The issue badge in the card's corner. */
.conv-seq-badge {
    position: absolute;
    top: -9px;
    right: 10px;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    border-radius: var(--wf-radius-pill);
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.conv-seq-badge.is-warn {
    background: var(--conv-issue-warn);
    color: var(--theme-text-emphasis);
}

.conv-seq-badge.is-error {
    background: var(--conv-issue-error);
    color: var(--theme-text-on-danger);
}

/* The hover toolbar - on hover, on the selected card and when a tool has the focus. */
.conv-seq-tools {
    position: absolute;
    top: -16px;
    right: 36px;
    display: flex;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--theme-border-subtle);
    border-radius: var(--wf-radius-pill);
    background: var(--theme-background-raised);
    box-shadow: var(--theme-shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--conv-motion);
}

.conv-seq-card:hover .conv-seq-tools,
.conv-seq-card.is-selected .conv-seq-tools,
.conv-seq-tools:focus-within {
    opacity: 1;
    pointer-events: auto;
}

.conv-seq-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: var(--wf-radius-pill);
    background: none;
    color: var(--theme-text-secondary);
    font-size: 13px;
    cursor: pointer;
}

.conv-seq-tool:hover:not(:disabled) {
    background: var(--theme-background-hover);
    color: var(--theme-text-emphasis);
}

.conv-seq-tool:disabled {
    opacity: .4;
    cursor: default;
}

.conv-seq-tool:focus-visible {
    outline: 2px solid var(--theme-focus-ring);
    outline-offset: 1px;
}

/* The card menu sits under the card (the shared menu look - wf-action-menu-*). */
.conv-seq-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 30;
    min-width: 240px;
}

/* A stage that starts beside the one before it: its words above it in the stack. */
.conv-seq-stackchip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    align-self: flex-start;
    margin: 2px 0 -2px;
    padding: 1px 8px;
    border-radius: var(--wf-radius-pill);
    background: var(--conv-canvas-bg);
    color: var(--theme-text-muted);
    font-size: 11px;
}

/* "+ Alongside" under a stack (a collection: "+ Add an experience"). */
.conv-seq-beside {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 10px;
    border: 1px dashed var(--theme-border);
    border-radius: var(--theme-radius);
    background: none;
    color: var(--theme-text-muted);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    opacity: .75;
    transition: opacity var(--conv-motion), color var(--conv-motion), border-color var(--conv-motion);
}

.conv-seq-beside:hover,
.conv-seq-beside:focus-visible {
    opacity: 1;
    color: var(--conv-ask);
    border-color: var(--conv-ask);
}

/* ── The tab bar's kind chip and Publish, the copilot head ─────────────── */

.conv-seq-publish {
    white-space: nowrap;
}

.conv-seq-kindchip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: var(--wf-radius-pill);
    background: var(--conv-act-soft);
    color: var(--conv-act);
    font-size: var(--theme-font-size-xs);
    font-weight: 600;
}

.conv-seq-copilot-head {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--theme-border-subtle);
    border-radius: var(--wf-radius-pill);
}

.conv-seq-copilot-mode {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border: 0;
    border-radius: var(--wf-radius-pill);
    background: none;
    color: var(--theme-text-secondary);
    font: inherit;
    font-size: var(--theme-font-size-xs);
    cursor: pointer;
}

.conv-seq-copilot-mode.is-on {
    background: var(--conv-ask-soft);
    color: var(--conv-ask);
    font-weight: 600;
}

.conv-seq-copilot-lead {
    margin: 0 0 8px;
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-sm);
}

/* ── The library, the issues ───────────────────────────────────────────── */

.conv-seq-lib-group {
    margin: 10px 2px 4px;
    color: var(--theme-text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.conv-seq-lib {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--theme-radius-button);
    cursor: grab;
}

.conv-seq-lib:hover {
    background: var(--theme-background-hover);
}

.conv-seq-lib.is-added {
    cursor: default;
    opacity: .65;
}

.conv-seq-lib-ic {
    color: var(--conv-ask);
}

.conv-seq-lib-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--theme-font-size-sm);
}

.conv-seq-lib-done {
    color: var(--theme-success);
}

.conv-seq-issues {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.conv-seq-issue {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--theme-border-subtle);
    border-radius: var(--theme-radius-button);
    background: var(--theme-background-raised);
    color: var(--theme-text);
    font: inherit;
    font-size: var(--theme-font-size-sm);
    text-align: left;
    cursor: pointer;
}

.conv-seq-issue.is-error > .bi {
    color: var(--conv-issue-error);
}

.conv-seq-issue.is-warn > .bi {
    color: var(--conv-issue-warn);
}

.conv-seq-issue:hover {
    background: var(--theme-background-hover);
}

.conv-seq-issue-text {
    flex: 1;
    min-width: 0;
}

.conv-seq-issue-code {
    color: var(--theme-text-muted);
    font-family: var(--theme-font-mono);
    font-size: 10px;
}

/* ── The drawers' own pieces (the drawer itself is conv-drawer.css) ────── */

/* A stage, the end or a member: the builder's drawer, a little room below its last section; its footer's two actions wrap
   onto two lines on a narrow screen rather than run off it. */
.conv-seq-drawer {
    padding-bottom: 8px;
}

.conv-seq-drawer .conv-drawer-foot {
    flex-wrap: wrap;
    gap: 8px;
}

.conv-seq-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.conv-seq-grow {
    flex: 1;
    min-width: 0;
}

.conv-seq-wide {
    width: 100%;
}

.conv-seq-pad {
    padding: 0 16px 16px;
}

.conv-seq-note {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 6px 0 0;
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-xs);
    line-height: 1.4;
}

.conv-seq-words,
.conv-seq-rule-words {
    margin: 0 0 6px;
    color: var(--theme-text);
    font-size: var(--theme-font-size-sm);
    line-height: 1.45;
    word-break: break-word;
}

.conv-seq-rule {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.conv-seq-facts {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
}

.conv-seq-fact {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.conv-seq-factlink {
    color: var(--conv-ask);
    font-weight: 600;
    text-decoration: none;
}

.conv-seq-factlink:hover {
    text-decoration: underline;
}

/* A fact's value with a link beside it (the stage's bound context and its Review). */
.conv-seq-factvalue {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.conv-seq-muted {
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-xs);
}

.conv-seq-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.conv-seq-role {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border: 1px solid var(--theme-border);
    border-radius: var(--wf-radius-pill);
    background: none;
    color: var(--theme-text-secondary);
    font: inherit;
    font-size: var(--theme-font-size-xs);
    cursor: pointer;
}

.conv-seq-role.is-on {
    border-color: var(--conv-ask);
    background: var(--conv-ask-soft);
    color: var(--conv-ask);
}

.conv-seq-minutes {
    width: 96px;
}

.conv-seq-hooks {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.conv-seq-hooks-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.conv-seq-hooks-add {
    max-width: 100%;
}

.conv-seq-hooks-raw {
    margin: 0;
    padding: 8px;
    border-radius: var(--theme-radius-button);
    background: var(--theme-background-subtle);
    color: var(--theme-text-secondary);
    font-family: var(--theme-font-mono);
    font-size: 11px;
    white-space: pre-wrap;
    word-break: break-all;
}

.conv-seq-textarea {
    width: 100%;
    min-height: 72px;
    resize: vertical;
}

/* ── The settings tab (its cards are the builder's conv-settings-*) ────── */

.conv-seq-settings {
    flex: 1;
    min-width: 0;
    overflow: auto;
}

/* ── The insert dialog ─────────────────────────────────────────────────── */

/* Its own class - never .conv-seq-insert, the canvas's 26px + button (a dialog wearing it shrank and lost its background). */
.conv-seq-insert-dialog {
    width: min(480px, 100%);
}

.conv-seq-insert-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: min(50vh, 420px);
    margin-top: 8px;
    overflow: auto;
}

.conv-seq-insert-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--theme-radius-button);
    background: none;
    color: var(--theme-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.conv-seq-insert-row:hover,
.conv-seq-insert-row:focus-visible {
    background: var(--theme-background-hover);
}

.conv-seq-insert-row > .bi {
    color: var(--conv-ask);
}

/* ── The test visit's dock (its frame is the builder's conv-preview-*) ─── */

.conv-seq-dock-title {
    display: inline-flex;
    flex: 1;
    min-width: 0;
    align-items: center;
    gap: 6px;
    color: var(--theme-text-emphasis);
    font-weight: 600;
}

.conv-seq-dock .conv-preview-context-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.conv-seq-dock-stages {
    display: flex;
    gap: 4px;
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
    overflow-x: auto;
}

.conv-seq-dock-stage {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
    max-width: 180px;
    padding: 2px 10px 2px 2px;
    border: 1px solid var(--theme-border-subtle);
    border-radius: var(--wf-radius-pill);
    color: var(--theme-text-secondary);
    font-size: 11px;
}

.conv-seq-dock-stage.is-done {
    color: var(--theme-success);
}

.conv-seq-dock-stage.is-skipped {
    opacity: .55;
    text-decoration: line-through;
}

.conv-seq-dock-stage.is-current {
    border-color: var(--conv-ask);
    background: var(--conv-ask-soft);
    color: var(--conv-ask);
}

.conv-seq-dock-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: var(--wf-radius-pill);
    background: var(--theme-background-subtle);
    font-weight: 600;
}

.conv-seq-dock-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conv-seq-dock-note {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
    color: var(--conv-act);
    font-size: var(--theme-font-size-sm);
}

/* Check a record: the answer lists every conversation, one per row, with its word (starts when sent / waits / not sent). */
.conv-seq-dock-check {
    align-items: stretch;
    text-align: left;
}

.conv-seq-dock-stages.is-check {
    flex-direction: column;
    gap: 6px;
    margin: 6px 0;
    overflow: visible;
}

.conv-seq-dock-stages.is-check .conv-seq-dock-stage {
    max-width: none;
    padding: 4px 10px 4px 4px;
    border-radius: var(--theme-radius);
    font-size: 12px;
}

.conv-seq-dock-stages.is-check .conv-seq-dock-stage.is-ready {
    border-color: color-mix(in srgb, var(--conv-act) 45%, var(--theme-border-subtle));
}

.conv-seq-dock-stages.is-check .conv-seq-dock-stage.is-skipped {
    text-decoration: none;
}

.conv-seq-dock-word {
    margin-left: auto;
    padding-left: 8px;
    color: var(--theme-text-muted);
    white-space: nowrap;
}

.conv-seq-dock-stage.is-ready .conv-seq-dock-word {
    color: var(--conv-act);
}

.conv-seq-dock-between {
    align-items: stretch;
    text-align: center;
}

.conv-seq-dock-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.conv-seq-dock-records {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    max-height: 220px;
    overflow: auto;
}

.conv-seq-dock-record {
    padding: 6px 8px;
    border: 0;
    border-radius: var(--theme-radius-button);
    background: none;
    color: var(--theme-text);
    font: inherit;
    font-size: var(--theme-font-size-sm);
    text-align: left;
    cursor: pointer;
}

.conv-seq-dock-record:hover {
    background: var(--theme-background-hover);
}

.conv-seq-dock-record.is-on {
    background: var(--conv-ask-soft);
    color: var(--conv-ask);
    font-weight: 600;
}

/* The pasted keys (the classic Qualify's raw-anchor entry): a quiet toggle under the list and a monospaced box. */
.conv-seq-paste-toggle {
    align-self: flex-start;
}

.conv-seq-paste {
    width: 100%;
    font-family: var(--theme-font-mono);
    font-size: 12px;
    resize: vertical;
}

.conv-seq-paste[aria-invalid="true"] {
    border-color: var(--conv-issue-error);
}

/* ── Phone width: the columns narrow, the drawer and dock cover the work ─ */

@media (max-width: 767px) {
    /* Row 1 wraps: back, the panel, the classic link and the actions on the first line, the name and its state below. */
    .conv-seq-shell .conv-header {
        flex-wrap: wrap;
        height: auto;
        min-height: var(--wf-shellbar-h);
        padding: 6px 8px;
        row-gap: 2px;
    }

    .conv-seq-shell .conv-header-center {
        order: 3;
        flex: 1 1 100%;
    }

    .conv-seq-shell .conv-header-left {
        flex: 0 0 auto;
    }

    .conv-seq-shell .conv-header-right {
        flex: 1 1 auto;
        gap: 2px;
    }

    /* The rail's Copilot is the canvas's own Ask, one tap away - the shell's Ask pill steps aside at the phone width. */
    .conv-seq-shell .conv-header-sep,
    .conv-seq-shell .conv-header .wf-shellbar-ask,
    .conv-seq-backlabel {
        display: none;
    }

    /* Row 2 wraps too: the kind and the tabs, then Test and Publish. */
    .conv-seq-shell .conv-tabbar {
        flex-wrap: wrap;
        padding: 6px 8px;
        row-gap: 6px;
    }

    .conv-seq-shell .conv-tabbar-left {
        flex: 0 0 auto;
    }

    .conv-seq-shell .conv-tabbar-right {
        flex: 1 1 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .conv-seq-canvas {
        padding: 20px 16px 32px;
    }

    .conv-seq-work.has-drawer .conv-seq-canvas {
        padding-right: 16px;
    }

    .conv-seq-col {
        width: 220px;
    }

    .conv-seq-col--start,
    .conv-seq-col--end {
        width: 180px;
    }

    .conv-seq-col--first {
        width: min(280px, calc(100vw - 120px));
    }

    .conv-seq-link {
        width: 96px;
    }

    .conv-seq-tools {
        right: 8px;
    }

    .conv-builder .conv-seq-dock {
        position: absolute;
        inset: 0;
        width: auto;
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .conv-seq-card,
    .conv-seq-insert,
    .conv-seq-trigger,
    .conv-seq-end,
    .conv-seq-tools,
    .conv-seq-beside,
    .conv-seq-firstadd {
        animation: none;
        transition: none;
    }

    .conv-seq-card:hover {
        transform: none;
    }
}
