/* ==========================================================================
   ADMISSIONS WORKSPACE FACELIFT — structural adds (skins folded out, P4-4)
   ==========================================================================

   Flag: ENABLE_ADMISSIONS_REDESIGN (core/settings.py). This stylesheet is only
   linked when the flag is ON (templates/admissions.html); flag OFF serves the
   page byte-identical. The Verification Split (§4) additionally requires
   ENABLE_AW_VERIFY_SPLIT.

   Source design: Claude Design project cf6a41fd, "Admissions Workspace":
   - T1: Night Dispatch skin — one invariant surface, two instants; three-role
     discipline (slate chrome · cyan live · amber decision).
   - T2/2a: Phosphor Pure skin — true-black, ONE green family, all-mono;
     amber stays decision-only (deliberate divergence from TC's phosphor,
     which folded gold into green).
   - T2/2b: Verification Split — review-mode read-only source pane beside the
     note; trust chips become checkable claims.
   The ONLY ambers under both skins: Compile, Send verify-ring, ▲ unsourced
   tier, A&P-awaiting. DR severity ramp (acuity) intentionally untouched.

   SKINS MOVED OUT (P4-4, 2026-08-04): the per-skin token remaps (old §1),
   the skin-shared selector treatments (old §2, keyframes included) and the
   skin toggle (old §5) are gone — reborn as the global Roast Ladder themes
   night-dispatch-warm / phosphor-warm in static/css/roast-ladder-skins.css
   (theme-unification handoff). Legacy localStorage('aw-skin') picks migrate
   to the account theme in static/js/census/roast-ladder.js. The surviving
   skin-agnostic rules keep their rgba(var(--aw-skin-accent-rgb, 0, 255, 208),
   …) fallbacks — stock behavior relied on those fallbacks before, and does
   again now that the token is skin-theme-scoped.

   Structure (old §1/§2/§5-toggle removed; surviving numbers kept stable):
     3. Facelift structural elements (exist only flag-ON; token-styled)
     4. Verification Split (2b) — .awx-verify-split grid + source pane
     5. T2/2a voice-compose dictation routing feedback
   ========================================================================== */

/* ── 3. FACELIFT STRUCTURAL ELEMENTS (exist only flag-ON) ─────────────────
   Token-styled so they render natively under stock AND both skins. */

/* 3a. Shift-header acuity-mix load strip (shift-manager.js _renderAcuityMix).
   Header is flex space-between; the strip wraps to a full-width second row. */
.aw-shift-header { flex-wrap: wrap; }
.aw-acuity-strip {
    flex-basis: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}
.aw-acuity-strip:empty { display: none; }
.aw-acuity-strip-bar {
    display: flex;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    background: var(--term-bg-input);
}
.aw-acuity-strip-seg { display: block; height: 100%; }
.aw-acuity-strip-seg--icu      { background: var(--dr-severity-critical); }
.aw-acuity-strip-seg--emergent { background: var(--dr-severity-worsening); }
.aw-acuity-strip-seg--urgent   { background: var(--dr-severity-improving); }
.aw-acuity-strip-seg--routine  { background: var(--dr-severity-stable); }
.aw-acuity-strip-seg--obs      { background: var(--dr-severity-resolved); }
.aw-acuity-strip-legend { display: flex; gap: 10px; flex-wrap: wrap; }
.aw-acuity-strip-leg {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--term-font-mono);
    font-size: 0.5625rem;
    letter-spacing: 0.05em;
    color: var(--term-fg-muted);
}
.aw-acuity-strip-leg i { width: 5px; height: 5px; border-radius: 1px; }
.aw-acuity-strip-leg--icu i      { background: var(--dr-severity-critical); }
.aw-acuity-strip-leg--emergent i { background: var(--dr-severity-worsening); }
.aw-acuity-strip-leg--urgent i   { background: var(--dr-severity-improving); }
.aw-acuity-strip-leg--routine i  { background: var(--dr-severity-stable); }
.aw-acuity-strip-leg--obs i      { background: var(--dr-severity-resolved); }

/* 3b. Gutter density bars (section-sidebar.js renderTOC). Hidden in stock —
   they replace the title text only under a facelift skin (rule in §2). */
.awx-toc-den {
    display: none;
    position: relative;
    flex: 1 1 auto;
    min-width: 20px;
    height: 4px;
    border-radius: 1px;
    overflow: hidden;
    background: var(--term-bg-input);
}
.awx-toc-den-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    background: var(--term-accent);
    border-radius: 1px;
    opacity: 0.75;
    transition: width var(--term-duration-normal, 300ms) ease;
}

/* 3c. Paste routing stamp under the capture textarea (workspace.js). */
.aw-route-stamp {
    font-family: var(--term-font-mono);
    font-size: 0.6875rem;
    color: var(--term-fg-muted);
}

/* 3d. Verify-count pip on Send to Census (provenance-review.js writes
   data-verify-count; MUST stay a pseudo-element — sendToCensus rewrites the
   button's textContent, destroying any child node). */
.aw-send-census-btn { position: relative; }
.aw-send-census-btn--verify[data-verify-count]::after {
    content: attr(data-verify-count) " \25B2";
    position: absolute;
    top: -8px;
    right: -8px;
    font-family: var(--term-font-mono);
    font-size: 0.5625rem;
    font-weight: 700;
    line-height: 1;
    color: var(--term-gold);
    background: var(--term-bg-void);
    border: 1px solid var(--term-gold-dim);
    border-radius: 8px;
    padding: 2px 5px;
    pointer-events: none;
}

/* ── 4. VERIFICATION SPLIT (T2/2b, flag ENABLE_AW_VERIFY_SPLIT) ───────────
   In review mode the pasted chart docks as a READ-ONLY source pane beside
   the note — checking claims against the chart IS the review activity.
   section-sidebar.js toggles .awx-verify-split on .awx-surface and fills
   #awxSourcePane from #awClinicalData (re-projection, same DOM contract).

   Width honesty (the design's own 1280 math assumes the collapsed rail):
   - ≥1280px AND the admission list collapsed → split active.
   - ≥1560px → split active regardless of list state.
   Anywhere else the pane stays display:none and the canvas keeps its stock
   flex-column flow — no forced list collapse, no layout jumps. */
.awx-source-pane { display: none; }

/* BREADCRUMB (2026-08-04) — grids authored for N children silently accept
   N+1: .awm-intake is the canvas's 4th child (flag-gated by
   enable_aw_manuscript, templates/admissions.html:323) and, unseated, it
   auto-placed into an unbounded implicit row below the note/source track —
   the strip was exiled to the page bottom and the flexible note/source row
   was crushed (the "vertical stretch" issue; the 6063px-tall capture itself
   was not reproducible against this code — see the fence test). Any NEW
   runtime-added canvas child must get an explicit grid-area in BOTH media
   blocks below.
   Fence: tests/playwright/test_aw_verify_split_bounded_2026_08_04.py (red
   pre-fix). Same root pattern on the Transfer Center page: the live-grid
   col-1 void (transfer-ux-polish.css .tc-bottom-panel).
   Evidence: artifacts/layout-refinement-2026-08-04/. */

@media (min-width: 1280px) {
    main.aw-body:not(.aw-body--list-expanded) .awx-surface.awx-verify-split .awx-gutter {
        width: 150px;
        flex: 0 0 150px;
    }
    main.aw-body:not(.aw-body--list-expanded) .awx-surface.awx-verify-split .awx-canvas {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 336px;
        grid-template-rows: auto auto minmax(0, 1fr);
        grid-template-areas: "capture capture" "intake intake" "note source";
    }
    main.aw-body:not(.aw-body--list-expanded) .awx-surface.awx-verify-split .awx-capture { grid-area: capture; }
    main.aw-body:not(.aw-body--list-expanded) .awx-surface.awx-verify-split .awm-intake { grid-area: intake; }
    main.aw-body:not(.aw-body--list-expanded) .awx-surface.awx-verify-split #awSectionSidebar.awx-note-host { grid-area: note; }
    main.aw-body:not(.aw-body--list-expanded) .awx-surface.awx-verify-split .awx-source-pane:not([hidden]) {
        display: flex;
        grid-area: source;
    }
}
@media (min-width: 1560px) {
    .awx-surface.awx-verify-split .awx-gutter {
        width: 150px;
        flex: 0 0 150px;
    }
    .awx-surface.awx-verify-split .awx-canvas {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 336px;
        grid-template-rows: auto auto minmax(0, 1fr);
        grid-template-areas: "capture capture" "intake intake" "note source";
    }
    .awx-surface.awx-verify-split .awx-capture { grid-area: capture; }
    .awx-surface.awx-verify-split .awm-intake { grid-area: intake; }
    .awx-surface.awx-verify-split #awSectionSidebar.awx-note-host { grid-area: note; }
    .awx-surface.awx-verify-split .awx-source-pane:not([hidden]) {
        display: flex;
        grid-area: source;
    }
}

.awx-source-pane {
    flex-direction: column;
    min-height: 0;
    border-left: 1px solid var(--term-border-subtle);
    background: var(--term-bg-base, var(--term-bg-surface));
}
.awx-source-pane-head {
    flex: 0 0 auto;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--term-border-subtle);
    font-family: var(--term-font-mono);
    font-size: 0.5625rem;
    letter-spacing: 0.08em;
    color: var(--term-accent);
    text-transform: uppercase;
}
.awx-source-pane-meta {
    color: var(--term-fg-muted);
    text-transform: none;
    letter-spacing: 0.03em;
}
.awx-source-pane-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin: 0;
    padding: 10px 12px;
    font-family: var(--term-font-mono);
    font-size: 0.6875rem;
    line-height: 1.6;
    color: var(--term-fg-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}
.awx-source-mark {
    background: rgba(var(--aw-skin-accent-rgb, 0, 255, 208), 0.18);
    color: var(--term-fg-primary);
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(var(--aw-skin-accent-rgb, 0, 255, 208), 0.25);
}

/* ==========================================================================
   §5 · T2/2a VOICE COMPOSE — dictation routing feedback (2026-07-07)
   Design: cf6a41fd "Admissions Workspace" 2a. Skin-AGNOSTIC (applies under
   stock/night-dispatch/phosphor whenever ENABLE_ADMISSIONS_REDESIGN loads
   this sheet); needs ENABLE_ADMISSION_VOICE at runtime to ever engage.
   State source: body.aw-dictating (voice-recorder.js _updateUI) + per-section
   routing from section-sidebar.js _noteVoiceRouting. Motion is LIVE-ONLY —
   every animation below requires body.aw-dictating.
   ========================================================================== */

/* Routing pill in the recorder bar: "→ routing to HPI · active section" */
.aw-route-pill {
    display: inline-flex;
    align-items: center;
    font-family: var(--term-font-mono, monospace);
    font-size: 0.5625rem;                 /* 9px — matches recorder chrome */
    letter-spacing: 0.06em;
    color: rgba(var(--aw-skin-accent-rgb, 0, 255, 208), 0.95);
    border: 1px solid rgba(var(--aw-skin-accent-rgb, 0, 255, 208), 0.40);
    background: rgba(var(--aw-skin-accent-rgb, 0, 255, 208), 0.06);
    border-radius: 8px;
    padding: 2px 8px;
    white-space: nowrap;
}
/* Author display beats the UA [hidden] rule — restore explicitly (documented
   bug class; see .tc-note-tab[hidden] in transfer-redesign.css). */
.aw-route-pill[hidden] { display: none; }
/* Pill is meaningful only mid-dictation; belt over the JS hide. */
body:not(.aw-dictating) .aw-route-pill { display: none; }

/* Gutter header gains the dictating stamp while recording */
body.aw-dictating .awx-gutter-count::after {
    content: " · dictating";
    color: rgba(var(--aw-skin-accent-rgb, 0, 255, 208), 0.75);
    font-weight: 400;
}

/* Per-section voice fragment count at the right edge of a TOC row */
.awx-toc-frags {
    margin-left: auto;
    flex: none;
    font-family: var(--term-font-mono, monospace);
    font-size: 0.4375rem;                 /* 7px, like the 2a mock */
    color: rgba(var(--aw-skin-accent-rgb, 0, 255, 208), 0.70);
}

/* Receiving pulse — the section the current utterance just landed in.
   LIVE-ONLY: keyed on body.aw-dictating so nothing pulses after Stop. */
body.aw-dictating .awx-toc-item.is-receiving,
body.aw-dictating .aw-scaffold-section.is-receiving {
    animation: awReceive 1.2s ease-in-out infinite;
}
@keyframes awReceive {
    0%, 100% { box-shadow: inset 0 0 0 1px rgba(var(--aw-skin-accent-rgb, 0, 255, 208), 0.0); }
    50%      { box-shadow: inset 0 0 0 1px rgba(var(--aw-skin-accent-rgb, 0, 255, 208), 0.45); }
}

/* Organized pulse (2026-08-04) — sections a PASTE's slices just routed into.
   Standalone (no body.aw-dictating key): paste organization has no live
   session, and the doctor must SEE the dump being organized. Finite run so
   it reads as an event, not an alarm. */
.awx-toc-item.is-organized,
.aw-scaffold-section.is-organized {
    animation: awOrganized 1.1s ease-in-out 2;
}
@keyframes awOrganized {
    0%, 100% {
        box-shadow: inset 0 0 0 1px rgba(var(--aw-skin-accent-rgb, 0, 255, 208), 0.0);
        background-color: transparent;
    }
    50% {
        box-shadow: inset 0 0 0 1px rgba(var(--aw-skin-accent-rgb, 0, 255, 208), 0.55);
        background-color: rgba(var(--aw-skin-accent-rgb, 0, 255, 208), 0.06);
    }
}
