/* transfer-ux-polish.css
 * Transfer Center — UX overhaul Phase 1 (2026-07-30, flag ENABLE_TC_UX_POLISH)
 *
 * WHY this file exists: the surface's clinical information architecture is
 * strong, but its visual language fails the doctor — sub-11px all-caps
 * everywhere, dim-on-dim contrast, and nested box chrome. Phase 1 establishes
 * the token foundation and the two "trust" workstreams on top of it:
 *   S-NC  note confidence      — the saved note as a first-class artifact
 *   S-OW  One Well chart materials — permanent, always-editable rail lane
 *
 * PRECEDENCE: loaded LAST on /transfer (after transfer-tapestry.css and the
 * episode sheet). Token overrides use body.tc-page.tc-ux-polish[data-page=...]
 * — specificity (0,3,1), equal to the tapestry's token block, so load order
 * decides — and they apply regardless of the named-skin cycle (the polish is
 * not a skin; it is the floor every skin stands on). Flag-OFF ships zero
 * bytes: the link tag is Jinja-gated in transfer.html.
 *
 * Contracts kept:
 * - No markup relocation is required by this sheet alone; S-OW's lane markup
 *   is emitted flag-gated from transfer.html.
 * - Nothing below 11px (0.6875rem) renders for text under this flag. Caps
 *   stay only on true section labels, with tracking retained.
 * - One accent = one meaning (unchanged from the tapestry): teal = live/
 *   evidence/primary action, gold = chrome/labels, amber = decision/warn.
 * - No animation except state pulses already owned by the recorder chrome;
 *   prefers-reduced-motion kills anything new we add.
 *
 * PHASE 2 (2026-08-01) — design-token foundation + component grammar:
 *   D1  contrast floor  — near-white body text; meta/labels >= 4.5:1 at 11px
 *   D2  all-sans type   — serif removed everywhere (Outfit display, DM Sans
 *       body, JetBrains Mono data); --tux-text-* is the only scale
 *   D3  button grammar  — exactly four tiers (primary/secondary/tertiary/
 *       danger), existing controls migrated via CSS only
 *   D4  chip/badge      — one grammar, explicit is-selected / is-selectable /
 *       is-disabled / is-danger states
 *   D5  color contract  — documented below the token block; the two known
 *       violations enforced here
 */

/* ==========================================================================
   COLOR CONTRACT (Phase 2, owner decision 2026-08-01) — one hue = one meaning.
   Every hue on this surface answers "what does this mean?", never "what looks
   nice":
     teal  (#4CC4B4, --term-accent/live) = live / confirmed / primary action
     amber (--term-status-editing #E69A4C family) = decision-required / warning
     red   (--term-status-error #C44C4C / --tc-arc-critical #FF7474) = critical
           or danger ONLY — never decoration, never a default tone
     gold  (#BFA162, --term-gold)        = chrome / labels / brass frame
     green (--term-status-ready #22C55E) = ACCEPT / positive status ONLY
   Verified 2026-08-01: .tc-clinical-knot.is-critical's red is NOT a default
   tone — clinical-story-map.js factTone() only returns 'critical' when the
   fact model's priority is 'critical' (factPriority(), lines 87-99), so the
   red knot shape/border is fact-derived and satisfies the contract as-is.
   The two violations that were NOT fact-derived are corrected in section 8.
   ========================================================================== */

body.tc-page.tc-ux-polish[data-page="transfer"] {
    /* ---- Type scale (4px-based rem ladder; floor is 11px) ---------------- */
    /* Phase 2: --tux-text-* is the ONLY scale under the flag. 13px (md) and
       the new 15px step fill the 12→16 jump. */
    --tux-text-xs:   0.6875rem;  /* 11px — metadata floor, section labels */
    --tux-text-sm:   0.75rem;    /* 12px — secondary UI */
    --tux-text-md:   0.8125rem;  /* 13px — UI body (intermediate step) */
    --tux-text-lg:   0.875rem;   /* 14px — clinical prose (note, transcript) */
    --tux-text-15:   0.9375rem;  /* 15px — intermediate emphasis step */
    --tux-text-xl:   1rem;       /* 16px — emphasis */
    --tux-text-hero: 1.375rem;   /* 22px — state hero (gist headline) */

    /* ---- Contrast floor (Phase 2, owner decision: near-white body) --------
       Measured against --term-bg-void #0D0805 (L≈0.0027) and, second figure,
       --term-bg-surface #130D08 (L≈0.0044). Floor: 4.5:1 for any text,
       including 11px caps labels. The tapestry's --term-fg-muted #8B7355
       (≈4.4:1 on void) and the canvas's --tc-arc-faint #637878 (≈3.96:1 on
       its well) are both UNDER the floor — nothing below --tux-fg-faint may
       carry text under this flag. */
    --tux-fg-faint:    #9C8465;  /* ≈5.7:1 void / ≈5.6:1 surface — tertiary hints only */
    --tux-fg-meta:     #B49B74;  /* ≈7.7:1 / ≈7.4:1 — labels + metadata at 11px */
    --tux-fg-body:     #EDE6DA;  /* ≈16.1:1 / ≈15.5:1 — near-white reading text */
    --tux-fg-strong:   #FFF7EE;  /* ≈18.9:1 / ≈18.3:1 — emphasis */

    /* ---- All-sans (Phase 2, owner decision: serif removed everywhere) -----
       The tapestry (transfer-tapestry.css:84) re-points --term-font-display
       to a serif stack at equal specificity (0,3,1) — load order decides, and
       this sheet is last. phosphor-pure's all-mono display (0,1,1) also
       yields. One override re-voices every consumer (logo, card names,
       decision mains, accept tag, NOW nucleus, generate button). */
    --term-font-display: 'Outfit', 'Inter', sans-serif;

    /* ---- Spacing scale (4px base) ---------------------------------------- */
    --tux-space-1: 4px;
    --tux-space-2: 8px;
    --tux-space-3: 12px;
    --tux-space-4: 16px;
    --tux-space-5: 24px;
    --tux-space-6: 32px;

    /* ---- Surfaces: hairlines over boxes ----------------------------------- */
    --tux-hairline:        rgba(191, 161, 98, 0.18);
    --tux-hairline-strong: rgba(191, 161, 98, 0.32);
    --tux-radius:          8px;
    --tux-radius-sm:       6px;
    --tux-panel-bg:        rgba(27, 19, 12, 0.55); /* --term-bg-elevated lifted */

    /* ---- Focus: one visible ring everywhere under the flag ---------------- */
    --tux-focus-ring: 0 0 0 2px rgba(76, 196, 180, 0.55);
}

/* ==========================================================================
   1 · TYPE FLOOR — the worst sub-11px offenders, bumped to the floor.
   Each selector was verified sub-11px in its owning sheet. Bumps are to
   --tux-text-xs (11px) except clinical prose, which goes to --tux-text-lg.
   Color moves to the contrast-safe meta where the source used fg-muted.
   ========================================================================== */

/* Rail bay headers + card decision meta (transfer-redesign.css: 0.5rem) */
body.tc-ux-polish .tc-rail-bay {
    font-size: var(--tux-text-xs);
    color: var(--tux-fg-meta);
}
body.tc-ux-polish .tc-card-dispo-word,
body.tc-ux-polish .tc-card-call-time {
    font-size: var(--tux-text-xs);
}

/* Field + column labels (transfer-center.css / canvas sheets: ~0.62-0.66rem) */
body.tc-ux-polish .tc-field-label,
body.tc-ux-polish .tc-col-label {
    font-size: var(--tux-text-xs);
    color: var(--tux-fg-meta);
}

/* 2026-08-01: labels that carry a real Phosphor icon in markup (e.g. the
   header DATE label, tc-field-label--icon) suppress the legacy '$ '
   pseudo-glyph from transfer-center.css:949. */
body.tc-ux-polish .tc-field-label--icon::before {
    content: none;
}

/* Footer note tab + status (the reopen affordance — must be legible) */
body.tc-ux-polish .tc-note-tab,
body.tc-ux-polish .tc-note-status {
    font-size: var(--tux-text-xs);
}

/* Chart-materials formatted view hint (0.5rem) */
body.tc-ux-polish .tcv-hint {
    font-size: var(--tux-text-xs);
}

/* ==========================================================================
   2 · FOCUS + SELECTION — one consistent treatment under the flag.
   ========================================================================== */
body.tc-ux-polish :is(button, [role="button"], input, select, textarea, a):focus-visible {
    outline: none;
    box-shadow: var(--tux-focus-ring);
}
body.tc-ux-polish ::selection {
    background: rgba(76, 196, 180, 0.28);
    color: var(--tux-fg-strong);
}

/* ==========================================================================
   3 · S-NC NOTE CONFIDENCE (Workstream A, 2026-07-30)
   The saved note as a first-class artifact: a wider reading column, prose
   set for reading, a persistent saved chip, Generate→View mode, and the
   rail-card note badge.
   ========================================================================== */

/* The reading column widens from 480px (a rail) to a true measure. Drawer
   width and the episode-tapestry dock margin share --tc-note-drawer-w, so
   one token moves both. */
body.tc-page.tc-ux-polish[data-page="transfer"] {
    --tc-note-drawer-w: clamp(26rem, 32vw, 38rem);
}

/* Note prose: 14px / 1.6 — the note is READ here, then copied into the EHR. */
body.tc-ux-polish .tc-note-output {
    font-size: var(--tux-text-lg);
    line-height: 1.6;
    color: var(--tux-fg-body);
    padding: var(--tux-space-5) var(--tux-space-6);
}
body.tc-ux-polish .tc-note-section {
    font-size: var(--tux-text-sm);
    letter-spacing: 0.08em;
    margin: 1.5em 0 0.4em;
}

/* Footer artifact chip (tcNoteTab): always solid, legible, beside Generate —
   the persistent "your note exists and is saved" signal. */
body.tc-ux-polish .tc-note-tab {
    display: inline-flex;
    align-items: center;
    gap: var(--tux-space-2);
    min-height: 2.4rem;
    padding: 0.45rem 0.8rem;
    font-size: var(--tux-text-xs);
    letter-spacing: 0.06em;
    color: var(--tux-fg-body);
    border: 1px solid var(--term-accent-dim, rgba(76, 196, 180, 0.4));
    border-style: solid; /* kills the dashed "promise" treatment */
    border-radius: var(--tux-radius-sm);
    background: rgba(76, 196, 180, 0.08);
    cursor: pointer;
}
body.tc-ux-polish .tc-note-tab:hover,
body.tc-ux-polish .tc-note-tab:focus-visible {
    background: rgba(76, 196, 180, 0.16);
    color: var(--tux-fg-strong);
}
body.tc-ux-polish .tc-note-tab-glyph { color: var(--term-accent, #4CC4B4); }
body.tc-ux-polish .tc-note-tab[hidden] { display: none; }

/* Generate→View mode: the primary advertises the artifact it opens.
   B1 (2026-07-30): was a solid saturated-teal block — the loudest element on
   the screen, off the surface's muted language, and its 0.10em-tracked
   uppercase label clipped inside the 320px rail footer.
   Phase 2 (2026-08-01): VIEW TRANSFER NOTE is the SECONDARY tier (full-
   contrast outline, teal accent language) — the note already exists, so the
   button re-opens rather than creates. One line, sized to content: the
   Phase 1 wrap (white-space:normal) produced a 2-3 line label in the rail
   footer, and transfer-center.css:1658's min-width:260px out-sized the
   content. Both yield here. */
body.tc-ux-polish .tc-generate-btn[data-mode="view"] {
    background: color-mix(in srgb, var(--term-accent, #4CC4B4) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--term-accent, #4CC4B4) 55%, transparent);
    color: var(--term-accent, #4CC4B4);
    letter-spacing: 0.06em;
    padding: 0.55rem var(--term-space-lg, 16px);
    white-space: nowrap;
    line-height: 1.25;
}
body.tc-ux-polish .tc-generate-btn[data-mode="view"]:hover {
    background: color-mix(in srgb, var(--term-accent, #4CC4B4) 18%, transparent);
    border-color: var(--term-accent, #4CC4B4);
    color: var(--tux-fg-strong, #FFF7EE);
    box-shadow: none;
    transform: none;
}
/* The footer's "Note · Saved" pill + button share one rail-width row: the
   button takes exactly its content width (never the full footer, never a
   wrapped label). Beats transfer-center.css:1658's min-width:260px. */
body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-workspace-footer .tc-generate-btn[data-mode="view"] {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
}

/* B4 (2026-07-30): the drawer foot was three dim ghost buttons — the doctor
   looked for "new note" and found nothing actionable.
   Phase 2 (2026-08-01): the drawer foot now speaks the four-tier grammar
   (section 6): New Note = SECONDARY (outlined, full contrast — it rebuilds
   the artifact, it is not the drawer's primary), Copy = SECONDARY with a
   visible border (the fg-secondary-on-border-default ghost read as
   disabled), Save Note = PRIMARY (the one filled teal action — the drawer's
   commit verb). New Note keeps its left-most slot. */
body.tc-ux-polish #tcRegenerateNoteBtn {
    order: -1;
    margin-right: auto;
}
body.tc-ux-polish #tcNoteModal .tc-note-modal-actions .tc-btn,
body.tc-ux-polish #tcNoteModal .tc-note-modal-actions .tc-btn-primary {
    padding: 0.45rem 0.9rem;
    font-size: var(--tux-text-sm, 0.75rem);
    letter-spacing: 0.04em;
}

/* Rail card saved-note glyph (name line). */
body.tc-ux-polish .tc-card-note-badge {
    margin-left: 0.35em;
    font-size: var(--tux-text-xs);
    color: var(--term-accent, #4CC4B4);
}

/* ==========================================================================
   4 · S-OW ONE WELL CHART MATERIALS (Workstream B, 2026-07-30)
   The permanent, always-editable rail lane. Contracts:
   - The textarea is ALWAYS the visible, editable element; the underlay is a
     backdrop (syntax-highlight pattern), never a cover.
   - Grid mechanics per the amended plan: the episode 5-row grid governs live
     (it out-specifies the canvas 2-row grid), so the lane extends THAT grid;
     every live-restored child gets an explicit hide-or-place — no implicit
     rows anywhere.
   - Sizing is container-driven: docked clamp / one-click expand. No drag
     grips, no JS measurement, no position:fixed.
   ========================================================================== */

/* ---- Lane chrome ---------------------------------------------------------- */
body.tc-ux-polish .tc-one-well {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--tux-hairline-strong);
    border-radius: var(--tux-radius);
    background: var(--tux-panel-bg);
}
body.tc-ux-polish .tc-one-well__head {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: var(--tux-space-2);
    padding: var(--tux-space-1) var(--tux-space-2) var(--tux-space-1) var(--tux-space-3);
    border-bottom: 1px solid var(--tux-hairline);
    font-size: var(--tux-text-xs);
    color: var(--tux-fg-meta);
    cursor: pointer;
    user-select: none;
}
/* Phase 1 (2026-08-01): header-row collision fixes. "Chart materials" +
   "3,293 chars" + "Saved · HH:MM" + Expand/Clear crowd one rail-width row.
   Order of yield: the char count ellipsizes first, the saved stamp keeps its
   full width (a clipped "Saved · 10:5" reads as broken chrome), the title
   never wraps to a second line. */
body.tc-ux-polish .tc-one-well__title {
    flex: 0 0 auto;
    white-space: nowrap;
    letter-spacing: 0.08em;
    color: var(--tux-fg-body);
}
body.tc-ux-polish .tc-one-well__meta {
    display: inline-flex;
    flex: 0 1 auto;
    align-items: baseline;
    gap: var(--tux-space-2);
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}
body.tc-ux-polish .tc-one-well__count {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
body.tc-ux-polish .tc-one-well__save {
    flex: 0 0 auto;
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--term-accent, #4CC4B4);
}
body.tc-ux-polish .tc-one-well__actions {
    display: inline-flex;
    flex: 0 0 auto;
    gap: var(--tux-space-1);
    margin-left: auto;
    white-space: nowrap;
}
body.tc-ux-polish .tc-one-well__action {
    padding: 0.1rem 0.45rem;
    border: 1px solid var(--tux-hairline);
    border-radius: var(--tux-radius-sm);
    background: transparent;
    color: var(--tux-fg-meta);
    font-size: var(--tux-text-xs);
    cursor: pointer;
}
body.tc-ux-polish .tc-one-well__action:hover,
body.tc-ux-polish .tc-one-well__action:focus-visible {
    color: var(--tux-fg-strong);
    border-color: var(--tux-hairline-strong);
}
body.tc-ux-polish .tc-one-well__action--undo {
    color: var(--term-accent, #4CC4B4);
    border-color: var(--term-accent-dim, rgba(76, 196, 180, 0.4));
}

/* ---- Body: underlay backdrop + transparent-text textarea ------------------ */
body.tc-ux-polish .tc-one-well__body {
    position: relative;
    flex: 1 1 0%;
    min-height: 0;
}
/* The label is duplicated by the lane header; keep the node (form semantics)
   but take it out of the visual flow. */
body.tc-ux-polish .tc-one-well #tcChartMaterialsField {
    position: relative;
    max-width: none;
    margin: 0;
    height: 100%;
    min-height: 0;
}
body.tc-ux-polish .tc-one-well #tcChartMaterialsField > .tc-field-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
body.tc-ux-polish .tc-one-well__underlay {
    position: absolute;
    inset: 0;
    overflow: hidden;
    color: var(--tux-fg-body);
    background: var(--term-bg-elevated, #1B140C);
    border-radius: 3px;
    /* Underlay has no border; the textarea's 1px border must be compensated
       so painted text lands on the same origin. */
    padding: calc(var(--term-space-sm, 8px) + 1px) calc(var(--term-space-md, 12px) + 1px);
}
/* METRIC PARITY — one rule, both layers. Any drift here is double-vision
   text; touch these two selectors together or not at all. */
body.tc-ux-polish .tc-one-well__underlay,
body.tc-ux-polish .tc-one-well #tcChartMaterials {
    font-family: var(--term-font-body);
    font-size: var(--tux-text-md);
    line-height: 1.6;
    letter-spacing: normal;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    tab-size: 4;
    box-sizing: border-box;
}
body.tc-ux-polish .tc-one-well #tcChartMaterials {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    resize: none;
    field-sizing: fixed; /* the 07-28 one-line collapse bug */
    padding: var(--term-space-sm, 8px) var(--term-space-md, 12px);
    background: transparent;
    caret-color: var(--tux-fg-strong);
    overflow-y: auto;
}
/* FAIL-OPEN (H4, 2026-07-30): transparency only once JS has provably painted
   the underlay — a dead module leaves a plain, readable textarea. */
body.tc-ux-polish .tc-one-well[data-one-well-ready="1"] #tcChartMaterials {
    color: transparent;          /* the underlay paints the text */
}
body.tc-ux-polish .tc-one-well #tcChartMaterials::placeholder {
    color: var(--tux-fg-meta);
    opacity: 1;
}
body.tc-ux-polish .tc-one-well[data-one-well-ready="1"] #tcChartMaterials::selection {
    background: rgba(76, 196, 180, 0.35);
    color: transparent;          /* no ghosting over the underlay */
}
/* Underlay line styles: FLAT — every rendered line is exactly one text line
   or drift accumulates below the first header (the overlay-era .tcv-header
   carried margin/padding/border-top; those are cover-mode metrics). */
body.tc-ux-polish .tc-one-well__underlay .tcv-header {
    margin: 0;
    padding: 0;
    border: 0;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--term-gold, #D4A857);
}
body.tc-ux-polish .tc-one-well__underlay .tcv-blank { height: 1.6em; }
body.tc-ux-polish .tc-one-well__underlay .tcv-hi { color: var(--term-red, #E55A50); font-weight: 600; }
body.tc-ux-polish .tc-one-well__underlay .tcv-lo { color: var(--term-blue, #5B9BD5); font-weight: 600; }

/* ---- Desktop grid (>=1200px): insert the lane as col-2 row above NOW ------ */
@media (min-width: 1200px) {
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] #tcWorkspaceForm {
        grid-template-rows:
            auto                            /* 1 topbar */
            clamp(9rem, 18vh, 10rem)        /* 2 origin */
            clamp(11rem, 32vh, 26rem)       /* 3 ONE WELL (col 2) */
            minmax(7.5rem, 1fr)             /* 4 canvas + NOW */
            clamp(10rem, 20vh, 11.5rem)     /* 5 canvas + decision */
            auto;                           /* 6 canvas + footer */
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-one-well {
        grid-column: 2;
        grid-row: 3;
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-episode-now { grid-row: 4; }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-decision-spine { grid-row: 5; }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-workspace-footer { grid-row: 6; }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-bottom-panel { grid-row: 3 / 7; }
    /* The origin's chart cell is empty under polish — drop its 14rem floor. */
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-episode-origin {
        grid-template-rows: auto auto;
    }
    /* Expanded: the lane takes the rail (~7fr of the flex band); NOW
       collapses to its own header strip, one click back. */
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"].tc-one-well-expanded #tcWorkspaceForm {
        grid-template-rows:
            auto
            clamp(9rem, 18vh, 10rem)
            minmax(0, 7fr)
            auto
            clamp(10rem, 20vh, 11.5rem)
            auto;
    }
    body.tc-one-well-expanded .tc-episode-now #tcEpisodeNowSummary { display: none; }
    /* The "Edit transfer details" overlay shifts one row down with the lane
       inserted; the lane stays visible above it (never covered). */
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] #tcWorkspaceForm[data-origin-details="open"] .tc-columns { grid-row: 4; }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] #tcWorkspaceForm[data-origin-details="open"] .tc-decision-detail { grid-row: 5; }
}

/* ---- Live call: strip, suppresses, and the expanded survey ----------------
   Every rule that un-hides a form child during live must beat the canvas
   child sweep (0,5,0, !important) and/or the episode restores ((1,4,1),
   !important) — specificity here is load-bearing and fenced by
   tests/js/transfer-one-well-2026-07-30.test.mjs. */

/* The lane survives the live child sweep in every state (strip or expanded). */
body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"].tc-clinical-live
    #tcWorkspaceForm.tc-workspace-form > .tc-one-well {
    display: flex !important;
}
/* Origin + decision-spine restores suppressed: the canvas owns the call.
   Footer stays visible (Generate/View-note reachable mid-call). */
body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"].tc-clinical-live
    #tcWorkspaceForm > .tc-episode-origin,
body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"].tc-clinical-live
    #tcWorkspaceForm > .tc-decision-spine {
    display: none !important;
}
/* Strip mode (live, not expanded): the header line IS the lane. */
body.tc-clinical-live.tc-ux-polish:not(.tc-one-well-expanded) .tc-one-well .tc-one-well__body {
    display: none;
}
body.tc-clinical-live.tc-ux-polish:not(.tc-one-well-expanded) .tc-one-well #tcOneWellClear {
    display: none;
}
/* Expanded-live: the field must beat the canvas live hide ((1,2,0),
   !important), and the decision-detail lanes (pre-transport + specialist —
   owner decision 2026-07-30: the retired sheet was their only mid-call path)
   reveal under the well. */
body.tc-clinical-canvas-on.tc-clinical-live.tc-one-well-expanded.tc-ux-polish
    .tc-one-well #tcChartMaterialsField {
    display: block !important;
}
body.tc-clinical-canvas-on.tc-clinical-live.tc-one-well-expanded.tc-ux-polish
    #tcWorkspaceForm.tc-workspace-form > .tc-decision-detail {
    display: grid !important;
    grid-column: 1 / -1;
    grid-row: 4;
    max-height: 9rem;
    overflow-y: auto;
    min-width: 0;
}
/* Renderer-failure fallback: keep the lane reachable there too. */
body[data-tc-episode-fallback="1"].tc-clinical-live.tc-ux-polish
    #tcWorkspaceForm > .tc-one-well {
    display: flex !important;
}

/* Live grid mechanics (>=1200px — the episode 5-row grid is the one that
   governs live; extend IT, never the canvas 2-row grid). Row 2 (origin) and
   row 5 (decision) collapse to 0 because their children are hidden — a
   display:none item does NOT collapse its track. */
@media (min-width: 1200px) {
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"].tc-clinical-live #tcWorkspaceForm {
        grid-template-rows: auto 0 auto minmax(7.5rem, 1fr) 0 auto;
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"].tc-clinical-live
        #tcWorkspaceForm.tc-workspace-form > .tc-one-well {
        grid-column: 1 / -1;
        grid-row: 3;
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"].tc-clinical-live .tc-bottom-panel {
        grid-row: 4 / 7;
    }
    /* Expanded-live survey: well ~5fr full width, decision-detail lanes
       beneath it (row 4), canvas + NOW below. */
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"].tc-clinical-live.tc-one-well-expanded #tcWorkspaceForm {
        grid-template-rows: auto 0 minmax(0, 5fr) auto minmax(0, 4fr) auto;
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"].tc-clinical-live.tc-one-well-expanded .tc-episode-now {
        grid-row: 5;
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"].tc-clinical-live.tc-one-well-expanded .tc-bottom-panel {
        grid-row: 5 / 7;
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"].tc-clinical-live.tc-one-well-expanded
        #tcWorkspaceForm.tc-workspace-form > .tc-one-well {
        grid-column: 1 / -1;
        grid-row: 3;
    }
}

/* ---- Sub-desktop stack (<1200px): DOM-order flow, docked height ----------- */
@media (max-width: 1199.98px) {
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-one-well {
        grid-column: 1;
        grid-row: auto;
        height: clamp(11rem, 32vh, 26rem);
        margin-top: 0.65rem;
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"].tc-one-well-expanded .tc-one-well {
        height: 60vh;
    }
}

/* ---- A1 (2026-07-30): accept block clipped inside the decision spine -------
   The spine card (decision row, col 2) is ~11.5rem, but its content — DECISION
   label + 4-way buttons + accept block (bed chips / destination / tier / bed
   req'd) — measures ~26rem. The accept block sat below the fold of an
   internally-scrolling card with no scroll affordance: the bed chips were
   effectively unreachable, which is a capture-path break (chips-cheap fields
   must be clickable), and the visible sliver read as a duplicate "Accept" row.
   Fix: (1) compact the accept block to two tight rows, (2) rebalance the grid
   so the decision row can hold it — one-well and origin yield a little, the
   flexible canvas row keeps its floor. overflow-y:auto stays as the
   short-viewport fallback, but at normal laptop heights nothing clips. */
@media (min-width: 1200px) {
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] #tcWorkspaceForm {
        grid-template-rows:
            auto                            /* 1 topbar */
            clamp(7.5rem, 13vh, 9rem)       /* 2 origin */
            clamp(9rem, 24vh, 20rem)        /* 3 ONE WELL (col 2) */
            minmax(4rem, 1fr)               /* 4 canvas + NOW */
            clamp(13.5rem, 30.5vh, 18.5rem) /* 5 canvas + decision */
            auto;                           /* 6 canvas + footer */
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-decision-spine {
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        /* Phase 1 (2026-08-01): belt-and-braces with the chip wrap below —
           with overflow-y:auto the x-axis would compute as auto and show a
           raw horizontal scrollbar for any stray wide child; nothing in the
           rail is meant to scroll sideways. */
        overflow-x: hidden;
        padding: 0.45rem 0.62rem;
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-decision-spine::before {
        margin-bottom: 6px;
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-decision-spine .tc-decision-btn {
        min-height: 2.45rem;
    }
    /* The census-link pill renders INSIDE the accept block — keep it to one
       quiet line so it doesn't re-inflate the spine past the track. */
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-accept-block .tc-census-link {
        width: 100%;
        font-size: var(--tux-text-xs, 0.6875rem);
        line-height: 1.25;
    }
    /* Compact accept block: tag line dropped (the DECISION label already names
       the group; the block's aria structure is unchanged), chips one small
       row, destination + tier side-by-side, bed req'd inline. */
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-accept-block {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.3rem 0.45rem;
        margin-top: 0.45rem;
        padding: 0.45rem 0 0;
        border-top: 1px solid var(--term-border-subtle, #2A2720);
        background: none;
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-accept-block-tag {
        display: none;
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-accept-unit {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        width: 100%;
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-accept-unit .tc-bed-chips {
        display: flex;
        /* Phase 1 (2026-08-01): was nowrap — 5 chips (~281px) exceeded the
           272-320px rail's inner width, and the spine's overflow-y:auto made
           the x-axis compute as auto → a raw horizontal scrollbar in the
           decision rail. Wrap instead: chips break to a tidy second row and
           stay fully clickable (Phase 2 chip work builds on this). */
        flex-wrap: wrap;
        gap: 0.25rem;
        width: auto;
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-accept-unit .tc-bed-chip {
        padding: 0.14rem 0.32rem;
        font-size: var(--tux-text-xs, 0.6875rem);
        line-height: 1.3;
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-accept-routing {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.3rem 0.45rem;
        width: 100%;
    }
    /* The selects carry aria-labels and placeholder options ("— Destination —",
       "— Tier —"), so the visible text labels are redundant chrome. */
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-accept-routing > .tc-accept-label,
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-accept-unit > .tc-accept-label {
        display: none;
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-accept-routing .tc-select {
        flex: 1 1 7.5rem;
        width: auto;
        min-width: 0;
        padding-block: 0.18rem;
        font-size: var(--tux-text-xs, 0.6875rem);
        /* Phase 1 (2026-08-01): the rail-width select hard-cut the destination
           ("AMCK (Avera McKen") with no affordance — ellipsis signals the
           truncation (full text via the options' title attrs). */
        text-overflow: ellipsis;
    }
    /* Phase 1 (2026-08-01): the voice-extraction badge ("Confirmed HH:MM")
       injected next to #tcDestination joins this flex row — never let it
       shrink/split, or it overlaps the select and orphans its tail. */
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-accept-routing .tc-provenance {
        flex: 0 0 auto;
    }
    body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-accept-bedreq {
        font-size: var(--tux-text-xs, 0.6875rem);
        white-space: nowrap;
    }
}

/* ---- A2 (2026-07-30): Edit Source edited invisibly -------------------------
   Clicking "Edit Source" moves focus into the chart-materials textarea, but
   the formatted underlay (.tc-one-well__underlay) stays painted over the exact
   same box — the doctor types into an editor they cannot see and the button
   reads as dead. When the origin field reports editing mode, the underlay
   yields so the focused textarea is what renders. */
body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"]
    .tc-one-well__body:has(#tcChartMaterialsField[data-origin-source-mode="editing"])
    .tc-one-well__underlay {
    display: none;
}
/* While editing, the textarea becomes the visible face again: the ready-state
   transparency (underlay paints the text) is lifted and it gets an editor
   surface, or the doctor is typing into a blank-looking box. */
body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"]
    .tc-one-well[data-one-well-ready="1"]
    #tcChartMaterialsField[data-origin-source-mode="editing"] #tcChartMaterials {
    color: var(--tux-fg-strong, #E8E2D9);
    background: var(--term-bg-void, #0E0D0B);
}
body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"]
    .tc-one-well[data-one-well-ready="1"]
    #tcChartMaterialsField[data-origin-source-mode="editing"] #tcChartMaterials::selection {
    color: inherit;
}

/* ---- B2 (2026-07-30): Patient arc active tab -------------------------------
   Was a tinted pill with a saturated glow underline (rgb(89,225,207)) — off
   the flat terminal tab language used everywhere else on the surface. Flatten:
   no tint, square corners, token-teal 2px underline carries the active state. */
body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"]
    .tc-clinical-canvas__switcher button {
    border-radius: 0;
}
body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"]
    .tc-clinical-canvas__switcher button[aria-pressed="true"] {
    background: transparent;
    box-shadow: inset 0 -2px 0 var(--term-accent, #4CC4B4);
    color: var(--tux-fg-strong, #E8E2D9);
}

/* ---- B3 (2026-07-30): NOW gist hero ----------------------------------------
   Rendered at clamp(1.25rem, 2.3vw, 1.8rem) in the display serif — a 29px
   editorial float dominating a sparse clinical panel ("mechanical valve").
   Bring it to the polish hero token. Phase 2: the display face is now Outfit
   (serif removed everywhere), so the hero takes --term-font-display. */
body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"]
    .tc-now-nucleus__fact .tc-clinical-knot__value {
    font-family: var(--term-font-display, 'Outfit', sans-serif);
    font-size: var(--tux-text-hero, 1.375rem);
    font-weight: 550;
}

/* ---- B5 (2026-07-30): Origin strip values ----------------------------------
   Values wrapped mid-cell (the MRN gap marker carried its icon onto a second
   line; the raw ISO call time clipped mid-string). One line each, ellipsis —
   the strip is a scan surface, wrapped fragments read as broken grid. */
body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-episode-origin__value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- B6 (2026-07-30): call-control hierarchy --------------------------------
   CALL LOGISTICS (the dispatch path — the actual "make the call" action) and
   CALL DIRECT shared one button class and read as equals; IPHONE competed at
   the same weight. One primary per row: logistics keeps the action accent,
   direct + iphone recede to quiet ghosts. */
body.tc-page.tc-ux-polish .tc-twilio-direct-call-btn {
    background: transparent;
    border-color: var(--term-border-default, #2A2720);
    color: var(--tux-fg-meta, #A68B66);
    font-weight: 500;
}
body.tc-page.tc-ux-polish .tc-twilio-direct-call-btn:hover {
    border-color: var(--term-accent, #4CC4B4);
    color: var(--term-accent, #4CC4B4);
}
body.tc-page.tc-ux-polish .tc-iphone-pair-btn {
    background: transparent;
    border-color: transparent;
    color: var(--tux-fg-meta, #A68B66);
    font-size: var(--tux-text-xs, 0.6875rem);
    letter-spacing: 0.08em;
    opacity: 0.85;
}
body.tc-page.tc-ux-polish .tc-iphone-pair-btn:hover {
    color: var(--tux-fg-strong, #E8E2D9);
    opacity: 1;
}

/* ---- B7 (2026-07-30): mode-chip subtitle ------------------------------------
   "TRANSFER WORKSPACE / Call intake and …" duplicates the TRANSFER CENTER nav
   tab and truncates mid-word in the header. The nav tab already names the
   page — the chip keeps its label, the subtitle goes. TC-scoped: other pages
   keep their chip detail. */
body.tc-page.tc-ux-polish[data-page="transfer"] .sn-mode-chip__detail {
    display: none;
}

/* ---- B8 (2026-07-30): left-rail collapsed strips ----------------------------
   Outcomes / Open loops render as full-width stacked strips above the call
   list, costing two cards' worth of rail before a single transfer is visible.
   Compact them to quiet one-line rows. */
body.tc-page.tc-ux-polish .tc-outcomes-btn,
body.tc-page.tc-ux-polish .tc-open-loops-btn {
    padding-block: 0.3rem;
    font-size: var(--tux-text-xs, 0.6875rem);
    min-height: 0;
    opacity: 0.85;
}
body.tc-page.tc-ux-polish .tc-outcomes-btn:hover,
body.tc-page.tc-ux-polish .tc-open-loops-btn:hover {
    opacity: 1;
}

/* ---- P1 (2026-08-01): rail bottom continuation fade -------------------------
   The transfer list cuts cards mid-card at the panel's bottom edge with no
   signal that more sit below. A short mask fade on the scrolling panel reads
   as "continues" without eating a card's worth of rail. */
body.tc-page.tc-ux-polish .tc-list-panel {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 2.75rem), transparent 100%);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 2.75rem), transparent 100%);
}

/* ==========================================================================
   5 · PHASE 2 TYPE + CONTRAST SWEEP (2026-08-01)
   The known sub-floor / dim spots, moved onto the raised --tux-* tokens.
   Nothing here goes below 11px or below --tux-fg-faint.
   ========================================================================== */

/* Episode-origin eyebrow labels (ORIGIN/PATIENT/AGE/SEX/MRN/CALL TIME/
   FACILITY — the referral + contact identity block) + the NOW panel label:
   0.55rem fg-muted → 11px --tux-fg-meta (≈7.4:1 on the panel). */
body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-episode-origin__label,
body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-episode-now__label {
    color: var(--tux-fg-meta);
    font-size: var(--tux-text-xs);
}
/* Origin source/contact row ("Source not supplied · Edit Source"): 0.62rem. */
body.tc-page.tc-ux-polish[data-tc-episode-tapestry="1"] .tc-episode-origin__source {
    font-size: var(--tux-text-xs);
    color: var(--tux-fg-meta);
}

/* Story-map eyebrow ("N FACTS LINKED TO THE CALL", 0.58rem): teal is the
   live/evidence hue per the color contract — only the size was sub-floor. */
body.tc-ux-polish .tc-transfer-arc__eyebrow {
    font-size: var(--tux-text-xs);
}

/* Provenance summary ("9/11 lines traced to source"): fg-muted ≈4.4:1 → meta. */
body.tc-ux-polish .tc-prov-summary {
    color: var(--tux-fg-meta);
    font-size: var(--tux-text-xs);
}

/* "Select any knot to illuminate its exact source" hint: --tc-arc-faint
   measures ≈3.96:1 on the canvas well (transfer-clinical-canvas.css:637's own
   note) — under the floor. The canvas's own muted step (≈7.6:1) carries it. */
body.tc-ux-polish .tc-now-nucleus__provenance {
    color: var(--tc-arc-muted, #98AAA9);
    font-size: var(--tux-text-xs);
}

/* "Bed req'd" — an interactive checkbox label resting at fg-muted read as
   inactive chrome. Full-contrast body text; it is a capture-path control. */
body.tc-ux-polish .tc-accept-bedreq {
    color: var(--tux-fg-body);
}

/* Sidebar card diagnosis: the clinical gist of the card was 13px mono at
   fg-secondary, reading as tertiary chrome (and slanted next to the name).
   Roman body face, 12px floor, near-white — it is why the doctor opens the
   card. */
body.tc-ux-polish .tc-card-diagnosis {
    font-family: var(--term-font-body, 'DM Sans', sans-serif);
    font-style: normal;
    font-size: var(--tux-text-sm);
    color: var(--tux-fg-body);
}

/* Note-drawer masthead: the loom voices it in its own serif var
   (--tc-loom-serif, transfer-loom.css:171), which the token override cannot
   reach. Under the flag it takes the display sans like every other heading.
   (1,2,1) beats body[data-tc-loom]'s (1,1,1) regardless of sheet order. */
body.tc-page.tc-ux-polish #tcNoteModalTitle {
    font-family: var(--term-font-display, 'Outfit', sans-serif);
}

/* ==========================================================================
   6 · PHASE 2 BUTTON GRAMMAR (2026-08-01)
   Exactly four tiers. Class API (applied in the template by the markup
   workstream); the ID migrations below move the EXISTING controls onto the
   same grammar via CSS only.
     .tc-btn--primary   filled teal — ONE per region, the region's commit verb
     .tc-btn--secondary outlined, full contrast — the default action
     .tc-btn--tertiary  borderless ghost — quiet, reversible affordances
     .tc-btn--danger    red outline, isolated — destructive only
   Teal fill carries inverse text at ≈9.1:1 (--term-fg-inverse #130D08 on
   #4CC4B4, L 0.4465 vs 0.0044). Red text/border #EF4444 ≈5.3:1 on the void.
   ========================================================================== */
body.tc-ux-polish .tc-btn--primary,
body.tc-ux-polish .tc-btn--secondary,
body.tc-ux-polish .tc-btn--tertiary,
body.tc-ux-polish .tc-btn--danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--tux-space-2);
    min-height: 2.4rem;
    padding: 0.45rem 0.95rem;
    border-radius: var(--tux-radius-sm);
    font-family: var(--term-font-display, 'Outfit', sans-serif);
    font-size: var(--tux-text-sm);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
}
body.tc-ux-polish .tc-btn--primary {
    background: var(--term-accent, #4CC4B4);
    border: 1px solid transparent;
    color: var(--term-fg-inverse, #130D08);
}
body.tc-ux-polish .tc-btn--primary:hover,
body.tc-ux-polish .tc-btn--primary:focus-visible {
    background: color-mix(in srgb, var(--term-accent, #4CC4B4) 88%, #FFFFFF);
    box-shadow: var(--term-glow-accent);
}
body.tc-ux-polish .tc-btn--secondary {
    background: transparent;
    border: 1px solid var(--tux-hairline-strong);
    color: var(--tux-fg-body);
}
body.tc-ux-polish .tc-btn--secondary:hover,
body.tc-ux-polish .tc-btn--secondary:focus-visible {
    border-color: var(--tux-fg-meta);
    color: var(--tux-fg-strong);
    background: rgba(255, 247, 238, 0.04);
}
body.tc-ux-polish .tc-btn--tertiary {
    background: transparent;
    border: 1px solid transparent;
    color: var(--tux-fg-meta);
}
body.tc-ux-polish .tc-btn--tertiary:hover,
body.tc-ux-polish .tc-btn--tertiary:focus-visible {
    color: var(--tux-fg-strong);
    background: rgba(255, 247, 238, 0.05);
}
body.tc-ux-polish .tc-btn--danger {
    background: transparent;
    border: 1px solid color-mix(in srgb, var(--term-block, #EF4444) 55%, transparent);
    color: var(--term-block, #EF4444);
}
body.tc-ux-polish .tc-btn--danger:hover,
body.tc-ux-polish .tc-btn--danger:focus-visible {
    border-color: var(--term-block, #EF4444);
    background: rgba(239, 68, 68, 0.08);
}

/* ---- Migrations (CSS-only; no template edits in this workstream) ---------- */

/* #tcGenerateBtn (generate mode) → PRIMARY, palette-conformant teal. The base
   gold fill (transfer-center.css:1567) is the hyper-saturated orange block —
   off the contract (gold = chrome, not action) and the loudest thing on the
   surface. Teal = primary action. */
body.tc-ux-polish .tc-generate-btn:not([data-mode="view"]) {
    background: var(--term-accent, #4CC4B4);
    border: 1px solid transparent;
    color: var(--term-fg-inverse, #130D08);
}
body.tc-ux-polish .tc-generate-btn:not([data-mode="view"]):hover,
body.tc-ux-polish .tc-generate-btn:not([data-mode="view"]):focus-visible {
    background: color-mix(in srgb, var(--term-accent, #4CC4B4) 88%, #FFFFFF);
    box-shadow: var(--term-glow-accent);
}

/* Note-drawer footer: Save Note → PRIMARY (was gold .tc-btn-primary); New
   Note + Copy → SECONDARY. Copy's base ghost (fg-secondary on border-default)
   read as disabled — the secondary tier's visible border fixes that. */
body.tc-ux-polish #tcSaveNoteBtn {
    background: var(--term-accent, #4CC4B4);
    border: 1px solid transparent;
    color: var(--term-fg-inverse, #130D08);
}
body.tc-ux-polish #tcSaveNoteBtn:hover,
body.tc-ux-polish #tcSaveNoteBtn:focus-visible {
    background: color-mix(in srgb, var(--term-accent, #4CC4B4) 88%, #FFFFFF);
    box-shadow: var(--term-glow-accent);
}
body.tc-ux-polish #tcRegenerateNoteBtn,
body.tc-ux-polish #tcCopyNoteBtn {
    background: transparent;
    border: 1px solid var(--tux-hairline-strong);
    color: var(--tux-fg-body);
}
body.tc-ux-polish #tcRegenerateNoteBtn:hover,
body.tc-ux-polish #tcRegenerateNoteBtn:focus-visible,
body.tc-ux-polish #tcCopyNoteBtn:hover,
body.tc-ux-polish #tcCopyNoteBtn:focus-visible {
    border-color: var(--tux-fg-meta);
    color: var(--tux-fg-strong);
    background: rgba(255, 247, 238, 0.04);
}

/* ==========================================================================
   7 · PHASE 2 CHIP/BADGE SYSTEM (2026-08-01)
   One chip grammar, four explicit states (class API for the markup
   workstream):
     is-selected   filled + check/strong affordance — THE chosen value
     is-selectable full-contrast outline — an available choice, never dimmed
                   below the contrast floor
     is-disabled   dimmed — ONLY for truly disabled controls (never for
                   merely-unselected options)
     is-danger     red outline — destructive choice
   A merely-unselected option is is-selectable, NEVER is-disabled.
   ========================================================================== */

/* ---- Decision grid (.tc-decision-btn) -------------------------------------
   Two stock rules made the unchosen dispositions read as disabled: the 0.78
   resting opacity and, once a decision locks, the 0.4 + saturate(0.35)
   recede (transfer-center.css:5512/5541). PENDING/ROADSIDE/DECLINE are
   re-selectable choices at every moment — full contrast, no desaturation.
   The chosen button still dominates via fill + ✓ + lift. */
body.tc-ux-polish .tc-disposition-on .tc-decision-btn {
    opacity: 1;
    color: var(--tux-fg-body);
}
body.tc-ux-polish .tc-disposition-on .tc-decision-buttons:has(.is-active) .tc-decision-btn:not(.is-active) {
    opacity: 1;
    filter: none;
}
/* Decision sublabels ("→ McKennan", "specialist", "local mgmt", "no
   transfer"): 0.625rem fg-muted was BOTH sub-floor and sub-contrast — the
   qualifier that disambiguates the four options read as disabled text. */
body.tc-ux-polish .tc-decision-btn-sub,
body.tc-ux-polish .tc-disposition-on .tc-decision-btn.is-active .tc-decision-btn-sub {
    font-size: var(--tux-text-xs);
    color: var(--tux-fg-meta);
}

/* ---- Bed chips (.tc-bed-chip) ----------------------------------------------
   Resting = is-selectable (boundary-hardened in the base sheet). .active =
   is-selected, and it must be unmistakable at a glance mid-call: filled gold
   with inverse text (≈7.8:1) replaces the gold-ghost wash. */
body.tc-ux-polish .tc-bed-chip {
    color: var(--tux-fg-body);
}
body.tc-ux-polish .tc-bed-chip.active {
    background: var(--term-gold, #BFA162);
    border-color: var(--term-gold, #BFA162);
    color: var(--term-fg-inverse, #130D08);
    font-weight: 700;
    box-shadow: none;
}

/* ---- Sidebar badges ---------------------------------------------------------
   UNCLASSIFIED urgency was the loudest element on the card (bordered caps
   chip competing with the patient name): quiet hairline outline, meta ink.
   PENDING status becomes a filled borderless pill — a different SHAPE
   language from the square urgency outline, so the two no longer read as a
   toggle pair. */
body.tc-ux-polish .tc-urgency-badge:not([data-urgency]),
body.tc-ux-polish .tc-urgency-badge[data-urgency=""],
body.tc-ux-polish .tc-urgency-badge[data-urgency="0"] {
    color: var(--tux-fg-meta);
    border-color: var(--tux-hairline);
    background: transparent;
    font-weight: 500;
    text-shadow: none;
}
body.tc-ux-polish .tc-status-badge {
    border-radius: 999px;
}
body.tc-ux-polish .tc-status-badge[data-status="pending"] {
    color: var(--tux-fg-meta);
    border-color: transparent;
    background: var(--term-gold-ghost, rgba(191, 161, 98, 0.05));
}

/* ==========================================================================
   8 · PHASE 2 COLOR-CONTRACT ENFORCEMENT (2026-08-01)
   The two red violations that were NOT fact-derived (contract block above).
   ========================================================================== */

/* Call Logistics row: the leading handset was the 📞 color emoji — RED on
   every platform, and red = critical/danger only on this surface. Swap it
   for the Phosphor handset in gold (chrome/label hue for row titles): the
   ::before paints the icon, ::first-letter collapses the emoji glyph (the
   strong's flex layout yields to inline-block so ::first-letter applies).
   The row's primary-action teal stays on the Call button itself. */
body.tc-ux-polish .tc-capture-option--primary .tc-capture-option-copy strong {
    display: inline-block;
}
body.tc-ux-polish .tc-capture-option--primary .tc-capture-option-copy strong::before {
    content: "\e3b8"; /* .ph.ph-phone */
    font-family: "Phosphor";
    color: var(--term-gold, #BFA162);
    margin-right: 0.45em;
    -webkit-font-smoothing: antialiased;
}
body.tc-ux-polish .tc-capture-option--primary .tc-capture-option-copy strong::first-letter {
    font-size: 0;
}
/* The row's Call button carries the same emoji in its label ("📞 Call
   Logistics"). JS never rewrites the button's own text (call status goes to
   #tcTwilioStatus — call-recorder.js _updateTwilioUI), so collapsing its
   first glyph is safe. The icon inherits the button's action-teal text
   color. inline-flex yields to inline-block so ::first-letter applies. */
body.tc-ux-polish .tc-capture-option--primary .tc-twilio-call-btn {
    display: inline-block;
}
body.tc-ux-polish .tc-capture-option--primary .tc-twilio-call-btn::before {
    content: "\e3b8"; /* .ph.ph-phone */
    font-family: "Phosphor";
    margin-right: 0.45em;
    -webkit-font-smoothing: antialiased;
}
body.tc-ux-polish .tc-capture-option--primary .tc-twilio-call-btn::first-letter {
    font-size: 0;
}

/* Clinical-knot critical red: VERIFIED fact-derived (see the contract block
   — factTone() only emits 'critical' from fact priority), so the red knot
   shape stays. Nothing to correct; this note fences the finding so the next
   audit doesn't re-flag it. */

@media (prefers-reduced-motion: reduce) {
    body.tc-ux-polish *,
    body.tc-ux-polish *::before,
    body.tc-ux-polish *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
