/* ==========================================================================
   ADMISSIONS WORKSPACE FACELIFT — candidate skins + structural adds
   ==========================================================================

   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.

   Structure:
     1. Per-skin token remaps (each also defines --aw-skin-accent-rgb so the
        shared rules in §2 are written once)
     2. Skin-shared selector treatments on body[data-aw-skin] (any skin)
     3. Facelift structural elements (exist only flag-ON; token-styled)
     4. Verification Split (2b) — .awx-verify-split grid + source pane
     5. Skin toggle button
   ========================================================================== */

/* ── 1a. NIGHT DISPATCH token remap ────────────────────────────────────────
   body.aw-page[data-aw-skin] (0,2,1) beats the .aw-page token block (0,1,0)
   in admissions.css regardless of load order. */
body.aw-page[data-aw-skin="night-dispatch"] {
    --aw-skin-accent-rgb: 89, 214, 197;

    /* Backgrounds — graphite-blue family */
    --term-bg-void:       #070B10;
    --term-bg-surface:    #0E151C;
    --term-bg-elevated:   #101820;
    --term-bg-header:     #0A0F14;
    --term-bg-input:      #0D141B;

    /* Foreground — cool slate ramp */
    --term-fg-primary:    #F2F7FA;
    --term-fg-secondary:  #9FB0BC;
    --term-fg-muted:      #5E7280;
    --term-fg-inverse:    #081014;

    /* Borders */
    --term-border-subtle:  #1C2833;
    --term-border-default: #22303C;
    --term-border-strong:  #31424F;

    /* Accent: electric teal → calm cyan (live role) */
    --term-accent:        #59D6C5;
    --term-accent-hot:    #8FE8DB;
    --term-accent-dim:    rgba(89, 214, 197, 0.45);
    --term-accent-subtle: rgba(89, 214, 197, 0.10);
    --term-accent-ghost:  rgba(89, 214, 197, 0.05);

    /* Gold → amber (decision role) */
    --term-gold:          #F2A93B;
    --term-gold-hot:      #E29A2E;
    --term-gold-dim:      rgba(242, 169, 59, 0.50);
    --term-gold-subtle:   rgba(242, 169, 59, 0.10);
    --term-gold-ghost:    rgba(242, 169, 59, 0.05);

    /* Status */
    --term-status-error:      #E0564F;
    --term-status-editing:    #D4A040;
    --term-status-generating: #59D6C5;

    /* Glows recomputed for the calmer hues */
    --term-glow-accent:         0 0 8px rgba(89, 214, 197, 0.30), 0 0 24px rgba(89, 214, 197, 0.10);
    --term-glow-accent-intense: 0 0 12px rgba(89, 214, 197, 0.45), 0 0 36px rgba(89, 214, 197, 0.14);
    --term-glow-gold:           0 0 10px rgba(242, 169, 59, 0.20), 0 0 24px rgba(242, 169, 59, 0.08);
    --term-glow-red:            0 0 10px rgba(224, 86, 79, 0.30), 0 0 24px rgba(224, 86, 79, 0.10);
    --term-glow-amber:          0 0 10px rgba(242, 169, 59, 0.25), 0 0 24px rgba(242, 169, 59, 0.08);
    --term-text-glow-gold:      0 0 16px rgba(242, 169, 59, 0.20);
    --term-text-glow-accent:    0 0 10px rgba(89, 214, 197, 0.30);

    /* Tokens referenced by admissions.css but never defined anywhere (latent):
       --term-bg-base (gutter sticky head — transparent today), and the
       --term-text-* aliases whose hex fallbacks render. */
    --term-bg-base:        #0C1218;
    --term-text-primary:   #F2F7FA;
    --term-text-secondary: #9FB0BC;
}

/* ── 1b. PHOSPHOR PURE token remap (T2/2a) ─────────────────────────────────
   True-black CRT, one green family, mono only. Parity with the shipped TC
   phosphor block EXCEPT gold: here amber stays decision-only per the 2a
   spec ("One green family; amber stays decision-only; red is REC"). */
body.aw-page[data-aw-skin="phosphor-pure"] {
    --aw-skin-accent-rgb: 69, 224, 166;

    --term-bg-void:       #060907;
    --term-bg-surface:    #0B120D;
    --term-bg-elevated:   #121B15;
    --term-bg-header:     #070B08;
    --term-bg-input:      #0B120D;

    --term-fg-primary:    #D6EBDD;
    --term-fg-secondary:  #8FAF9A;
    --term-fg-muted:      #567A63;
    --term-fg-inverse:    #060907;

    --term-border-subtle:  #1D2B21;
    --term-border-default: #2A3D2F;
    --term-border-strong:  #3A5245;

    --term-accent:        #45E0A6;
    --term-accent-hot:    #E9FFF2;
    --term-accent-dim:    rgba(69, 224, 166, 0.40);
    --term-accent-subtle: rgba(69, 224, 166, 0.10);
    --term-accent-ghost:  rgba(69, 224, 166, 0.05);

    /* Decision amber (NOT green — the admissions divergence) */
    --term-gold:          #F2A93B;
    --term-gold-hot:      #E29A2E;
    --term-gold-dim:      rgba(242, 169, 59, 0.50);
    --term-gold-subtle:   rgba(242, 169, 59, 0.10);
    --term-gold-ghost:    rgba(242, 169, 59, 0.05);

    --term-status-error:      #E05B4F;
    --term-status-editing:    #F2A93B;
    --term-status-generating: #45E0A6;

    --term-glow-accent:         0 0 8px rgba(69, 224, 166, 0.25), 0 0 24px rgba(69, 224, 166, 0.08);
    --term-glow-accent-intense: 0 0 12px rgba(69, 224, 166, 0.40), 0 0 36px rgba(69, 224, 166, 0.12);
    --term-glow-gold:           0 0 10px rgba(242, 169, 59, 0.20), 0 0 24px rgba(242, 169, 59, 0.08);
    --term-glow-red:            0 0 10px rgba(224, 91, 79, 0.30), 0 0 24px rgba(224, 91, 79, 0.10);
    --term-glow-amber:          0 0 10px rgba(242, 169, 59, 0.25), 0 0 24px rgba(242, 169, 59, 0.08);
    --term-text-glow-gold:      0 0 16px rgba(242, 169, 59, 0.20);
    --term-text-glow-accent:    0 0 10px rgba(69, 224, 166, 0.35);

    --term-bg-base:        #080D0A;
    --term-text-primary:   #D6EBDD;
    --term-text-secondary: #8FAF9A;

    /* One type family: everything mono, per 2a/TC-4b spec */
    --term-font-display: var(--term-font-mono);
    --term-font-body:    var(--term-font-mono);
}

/* Phosphor glow on primary accents — restrained, text-shadow only. */
body[data-aw-skin="phosphor-pure"] .aw-logo-mark,
body[data-aw-skin="phosphor-pure"] .aw-card-name {
    text-shadow: 0 0 8px var(--term-accent-dim);
}

/* Night Dispatch flight-strip card names (TC 4a precedent). */
body[data-aw-skin="night-dispatch"] .aw-card-name {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.95em;
}
body[data-aw-skin="night-dispatch"] .aw-admission-card[data-status="pending"] {
    --aw-stripe-color: #43535F;
}

/* ── 2. SKIN-SHARED SELECTOR TREATMENTS (any skin; stock = attr absent) ──── */

/* Amber decision buttons. Compile is a cyan gradient in stock — under the
   facelift skins the decision role owns it. */
body[data-aw-skin] .aw-generate-btn {
    background: linear-gradient(135deg, #F2A93B, #E29A2E);
    color: #14100A;
    box-shadow: 0 2px 12px rgba(242, 169, 59, 0.18);
}
body[data-aw-skin] .aw-generate-btn:hover {
    box-shadow: var(--term-glow-gold), 0 2px 12px rgba(242, 169, 59, 0.25);
}

/* Verify ring: red-static in stock → amber pulse (the ▲ tier is amber here). */
body[data-aw-skin] .aw-send-census-btn--verify {
    box-shadow: inset 0 0 0 1px rgba(242, 169, 59, 0.65), var(--term-glow-amber);
    animation: aw-skin-amber 1.8s ease-in-out infinite;
}

/* Unsourced tier: red → amber (chip, body underline). */
body[data-aw-skin] .awx-mk--unsourced {
    color: #F2A93B;
    border-color: rgba(242, 169, 59, 0.5);
    background: rgba(242, 169, 59, 0.08);
}
body[data-aw-skin] .awx-mk--unsourced:hover,
body[data-aw-skin] .awx-mk--unsourced.open {
    background: rgba(242, 169, 59, 0.16);
    box-shadow: var(--term-glow-amber);
}
body[data-aw-skin] .awx-review-body--unsourced {
    text-decoration-color: #F2A93B;
    background: rgba(242, 169, 59, 0.05);
    box-shadow: inset 2px 0 0 #F2A93B;
}

/* Back-reference flash + lit section: electric-teal literals → skin accent. */
body[data-aw-skin] .awx-review-sec.lit .awx-review-body {
    background: rgba(var(--aw-skin-accent-rgb), 0.14);
}

/* Selected admission card: raw rgba(0,255,208) rim/tint → skin accent. */
body[data-aw-skin] .aw-admission-card.selected {
    --aw-rim-color: rgba(var(--aw-skin-accent-rgb), 0.50);
    background: linear-gradient(180deg, rgba(var(--aw-skin-accent-rgb), 0.05), rgba(0, 0, 0, 0.05)),
                var(--term-bg-elevated);
}

/* Workspace halo behind the selected patient: teal literal → skin accent. */
body[data-aw-skin]:has(.aw-admission-card.selected) .aw-workspace::before {
    background: radial-gradient(ellipse at 50% 40%, rgba(var(--aw-skin-accent-rgb), 0.20), transparent 70%);
}

/* Pipeline axis: stages become pills; the active stage breathes. */
body[data-aw-skin] .awx-stage {
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 2px 9px;
}
body[data-aw-skin] .awx-stage--active {
    border-color: var(--term-accent-dim);
    background: var(--term-accent-ghost);
    animation: aw-skin-ring 2s ease-in-out infinite;
}
body[data-aw-skin] .awx-mode-btn--active {
    background: var(--term-accent-ghost);
}

/* Capture well: skin-accent focus rim (the live input surface). */
body[data-aw-skin] .aw-clinical-textarea:focus-visible {
    border-color: rgba(var(--aw-skin-accent-rgb), 0.40);
    box-shadow: inset 0 1px 0 rgba(var(--aw-skin-accent-rgb), 0.25), 0 0 18px rgba(var(--aw-skin-accent-rgb), 0.06);
}

/* Scaffold filled edge glow: teal literal → skin accent. */
body[data-aw-skin] .aw-workspace .aw-scaffold-section--filled {
    box-shadow: inset 1px 0 8px rgba(var(--aw-skin-accent-rgb), 0.10);
}

/* A&P awaiting = the decision point. Amber dashed edge while empty — one of
   the four permitted ambers. */
body[data-aw-skin] .aw-workspace .aw-scaffold-section--primary.aw-scaffold-section--empty {
    opacity: 0.75;
    border-left: 3px dashed rgba(242, 169, 59, 0.65);
}
body[data-aw-skin] .aw-scaffold-section--primary.aw-scaffold-section--empty .aw-scaffold-abbrev {
    color: #F2A93B;
}
body[data-aw-skin] .awx-toc-item--empty[data-toc="assessment"] .awx-toc-abbrev {
    color: #F2A93B;
}

/* Facelift gutter = coverage map: abbrev + density bar, no title text
   (the design's own gutter drops titles; stock keeps them). */
body[data-aw-skin] .awx-toc-title { display: none; }
body[data-aw-skin] .awx-toc-den { display: block; }

@keyframes aw-skin-ring {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--aw-skin-accent-rgb), 0); }
    50%      { box-shadow: 0 0 0 4px rgba(var(--aw-skin-accent-rgb), 0.16); }
}
@keyframes aw-skin-amber {
    0%, 100% { box-shadow: inset 0 0 0 1px rgba(242, 169, 59, 0.65), 0 0 0 0 rgba(242, 169, 59, 0); }
    50%      { box-shadow: inset 0 0 0 1px rgba(242, 169, 59, 0.65), 0 0 0 4px rgba(242, 169, 59, 0.20); }
}

/* ── 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; }

@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 minmax(0, 1fr);
        grid-template-areas: "capture capture" "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 #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 minmax(0, 1fr);
        grid-template-areas: "capture capture" "note source";
    }
    .awx-surface.awx-verify-split .awx-capture { grid-area: capture; }
    .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. SKIN TOGGLE (skin-toggle.js inserts into .aw-header-controls) ────── */
.aw-skin-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--term-font-mono);
    font-size: 0.5625rem;
    letter-spacing: 0.08em;
    color: var(--term-fg-muted);
    background: none;
    border: 1px solid var(--term-border-default);
    border-radius: 9px;
    padding: 4px 10px;
    cursor: pointer;
    white-space: nowrap;
}
.aw-skin-toggle:hover {
    color: var(--term-fg-secondary);
    border-color: var(--term-border-strong);
}
.aw-skin-toggle .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--term-gold);
    flex: 0 0 auto;
}

/* ==========================================================================
   §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); }
}
