/* ==========================================================================
   SOMANOTES / SOMACURA — ADMISSION WORKSPACE TERMINAL THEME
   ==========================================================================

   Location:  /static/css/admissions.css
   Activator: .aw-page class on <body>
   Version:   1.0.0

   Design DNA:
   Same Phosphor Theatre terminal theme as the note rail and transfer center,
   scoped to .aw-page for standalone page usage. Two-panel layout: admission
   list (360px) + workspace (flex: 1). Workspace hosts patient strip, large
   clinical data textarea, note output area, and action bar.

   Acuity Badges: ICU/Emergent (DR scarlet), Urgent/Step-Down (DR worsening), Routine/Med-Surg (DR stable), Obs (DR resolved/teal)
   Status Badges: pending, data_entry, hp_generated, saved, archived

   Font Dependencies (loaded via Google Fonts in template):
     - JetBrains Mono 300..700       (labels, metadata, code, status)
     - Outfit 200..600               (display headings, section titles)
     - DM Sans 300..500              (clinical body text, form fields)

   ========================================================================== */


/* DR BEACHHEAD: Severity tokens for clinical acuity/status badges.
   These override the --term-status-* workflow colors with semantically
   correct clinical severity colors from the Dark Roast system.
   Delete this block when .aw-page migrates fully to data-theme="dark-roast". */
:root {
    --dr-severity-critical:     #C44C4C;
    --dr-severity-worsening:    #C25F90;
    --dr-severity-improving:    #D4A040;
    --dr-severity-stable:       #879A39;
    --dr-severity-resolved:     #4CC4B4;
    --dr-severity-critical-bg:  rgba(196, 76, 76, 0.10);
    --dr-severity-worsening-bg: rgba(194, 95, 144, 0.10);
    --dr-severity-improving-bg: rgba(212, 160, 64, 0.10);
    --dr-severity-stable-bg:    rgba(135, 154, 57, 0.10);
    --dr-severity-resolved-bg:  rgba(76, 196, 180, 0.10);
    --dr-severity-critical-border:  rgba(196, 76, 76, 0.40);
    --dr-severity-worsening-border: rgba(194, 95, 144, 0.40);
    --dr-severity-improving-border: rgba(212, 160, 64, 0.40);
    --dr-severity-stable-border:    rgba(135, 154, 57, 0.40);
    --dr-severity-resolved-border:  rgba(76, 196, 180, 0.40);
    --dr-scarlet-dim:           rgba(196, 76, 76, 0.40);
    --dr-amber-hot-dim:         rgba(210, 105, 30, 0.40);
    --dr-amber-dim:             rgba(230, 154, 76, 0.40);
    --dr-gold-dim:              rgba(218, 165, 32, 0.40);
    --dr-teal-dim:              rgba(76, 196, 180, 0.40);
    --dr-teal:      #4CC4B4;
    --dr-amber:     #E69A4C;
    --dr-amber-hot: #D2691E;
}


/* ==========================================================================
   S0  UTILITY — VISIBILITY HELPERS
   ========================================================================== */

.hidden, [hidden] { display: none !important; }


/* ==========================================================================
   S1  RESET & PAGE LAYOUT
   ========================================================================== */

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

/* TODO: extract to shared terminal-tokens.css — these ~55 --term-* props are
   duplicated from the terminal theme used in note-rail-terminal.css and
   transfer-center.css. Once a canonical terminal-tokens.css exists, replace
   this block with a <link> import. (L4) */
.aw-page {
    --term-bg-void:       #0C0B0A;
    --term-bg-surface:    #13120F;
    --term-bg-elevated:   #1B1A16;
    --term-bg-header:     #0E0D0B;
    --term-bg-input:      #17160F;
    --term-fg-primary:    #E8E4DC;
    --term-fg-secondary:  #A09888;
    --term-fg-muted:      #8A8278;
    --term-fg-inverse:    #0C0B0A;
    --term-border-subtle:  #1E1C18;
    --term-border-default: #2A2720;
    --term-border-strong:  #3A3630;
    --term-accent:        #00FFD0;
    --term-accent-dim:    rgba(0, 255, 208, 0.40);
    --term-accent-subtle: rgba(0, 255, 208, 0.10);
    --term-accent-ghost:  rgba(0, 255, 208, 0.05);
    --term-gold:          #D4A857;
    --term-gold-dim:      rgba(212, 168, 87, 0.35);
    --term-gold-subtle:   rgba(212, 168, 87, 0.10);
    --term-gold-ghost:    rgba(212, 168, 87, 0.05);
    --term-status-error:      #EF4444;
    --term-status-ready:      #22C55E;
    --term-status-editing:    #F59E0B;
    --term-status-generating: #3B82F6;
    --term-glow-accent:         0 0 8px rgba(0, 255, 208, 0.25), 0 0 24px rgba(0, 255, 208, 0.08);
    --term-glow-accent-intense: 0 0 12px rgba(0, 255, 208, 0.40), 0 0 36px rgba(0, 255, 208, 0.12);
    --term-glow-gold:           0 0 10px rgba(212, 168, 87, 0.15), 0 0 24px rgba(212, 168, 87, 0.06);
    --term-glow-red:            0 0 10px rgba(239, 68, 68, 0.30), 0 0 24px rgba(239, 68, 68, 0.10);
    --term-glow-amber:          0 0 10px rgba(245, 158, 11, 0.25), 0 0 24px rgba(245, 158, 11, 0.08);
    --term-glow-green:          0 0 10px rgba(34, 197, 94, 0.25), 0 0 24px rgba(34, 197, 94, 0.08);
    --term-glow-blue:           0 0 10px rgba(59, 130, 246, 0.25), 0 0 24px rgba(59, 130, 246, 0.08);
    --term-font-mono:    'JetBrains Mono', 'SF Mono', monospace;
    --term-font-display: 'Outfit', 'Inter', sans-serif;
    --term-font-body:    'DM Sans', 'Inter', sans-serif;
    --term-text-xs:   0.6875rem;
    --term-text-sm:   0.8125rem;
    --term-text-base: 0.9375rem;
    --term-text-lg:   1.125rem;
    --term-tracking-wide:    0.05em;
    --term-tracking-wider:   0.10em;
    --term-tracking-widest:  0.20em;
    --term-tracking-display: 0.15em;
    --term-space-xs:  4px;
    --term-space-sm:  8px;
    --term-space-md:  12px;
    --term-space-lg:  16px;
    --term-space-xl:  24px;
    --term-space-2xl: 32px;
    --term-corner-size:   16px;
    --term-corner-offset: 6px;
    --term-corner-width:  2px;
    --term-duration-fast:   150ms;
    --term-duration-normal: 300ms;
    --term-easing: cubic-bezier(0.4, 0, 0.2, 1);
    --term-grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='0.018'/%3E%3C/svg%3E");
    /* D5: gradient stop tokens — replaces hardcoded hex in button gradients */
    --term-accent-hot:  #00DDC0;
    --term-gold-hot:    #C4993A;
    /* D6: text-shadow glow tokens — replaces inline rgba values */
    --term-text-glow-gold:   0 0 16px rgba(212, 168, 87, 0.20);
    --term-text-glow-accent: 0 0 10px rgba(0, 255, 208, 0.30);
    /* Additional: elevation shadow tokens */
    --term-shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.3);
    --term-shadow-modal:      0 8px 32px rgba(0, 0, 0, 0.5);

    background: var(--term-bg-void);
    color: var(--term-fg-primary);
    font-family: var(--term-font-body);
    margin: 0;
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: 360px 1fr;
    height: 100vh;
    position: relative;
}


/* ==========================================================================
   S2  HEADER + NAV
   ========================================================================== */

.aw-header {
    grid-column: 1 / -1;
    background: var(--term-bg-header);
    border-bottom: 1px solid var(--term-border-default);
    padding: var(--term-space-md) var(--term-space-xl);
    display: flex;
    align-items: center;
    gap: var(--term-space-xl);
    position: relative;
    z-index: 10;
    min-height: 52px;
}

/* Gold accent line under header */
.aw-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 15%;
    right: 15%;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        var(--term-gold-dim),
        transparent
    );
    pointer-events: none;
}

/* Brand block */
.aw-header-brand {
    display: flex;
    align-items: center;
    gap: var(--term-space-sm);
    flex-shrink: 0;
}

.aw-logo-mark {
    font-size: 1.25rem;
    color: var(--term-accent);
    text-shadow: var(--term-glow-accent);
}

.aw-logo-link {
    font-family: var(--term-font-display);
    font-size: var(--term-text-lg);
    font-weight: 300;
    letter-spacing: 0.04em;
    color: var(--term-fg-primary);
    text-decoration: none;
    transition: text-shadow var(--term-duration-normal) var(--term-easing);
}

.aw-logo-link:hover {
    text-shadow: var(--term-glow-accent);
}

.aw-logo-accent {
    color: var(--term-accent);
    font-weight: 500;
}

/* Section switcher nav links */
.aw-section-switcher {
    display: flex;
    align-items: center;
    gap: var(--term-space-xl);
    margin-left: var(--term-space-xl);
}

.aw-section-link {
    font-family: var(--term-font-display);
    font-size: var(--term-text-sm);
    font-weight: 400;
    letter-spacing: var(--term-tracking-wider);
    text-transform: uppercase;
    text-decoration: none;
    color: var(--term-fg-muted);
    padding: var(--term-space-sm) 0;
    border-bottom: 2px solid transparent;
    transition: color var(--term-duration-normal) var(--term-easing),
                border-color var(--term-duration-normal) var(--term-easing),
                text-shadow var(--term-duration-normal) var(--term-easing);
}

.aw-section-link:hover {
    color: var(--term-fg-secondary);
    border-bottom-color: var(--term-border-default);
}

.aw-section-link.active {
    color: var(--term-fg-primary);
    border-bottom: 2px solid var(--term-accent);
    text-shadow: var(--term-glow-accent);
}

.aw-section-prefix {
    color: var(--term-accent);
    font-family: var(--term-font-mono);
    font-weight: 700;
    text-shadow: var(--term-text-glow-accent);
    margin-right: 2px;
}

/* Header controls (right side) */
.aw-header-controls {
    display: flex;
    align-items: center;
    gap: var(--term-space-lg);
    margin-left: auto;
}

/* New Admission button */
.aw-new-btn {
    font-family: var(--term-font-display);
    font-size: var(--term-text-sm);
    font-weight: 500;
    letter-spacing: var(--term-tracking-wider);
    text-transform: uppercase;
    color: var(--term-fg-inverse);
    background: linear-gradient(135deg, var(--term-accent), var(--term-accent-hot));
    border: none;
    padding: var(--term-space-sm) var(--term-space-lg);
    cursor: pointer;
    transition: all var(--term-duration-normal) var(--term-easing);
    white-space: nowrap;
}

.aw-new-btn:hover {
    box-shadow: var(--term-glow-accent-intense);
    transform: translateY(-1px);
}

.aw-new-btn:active {
    transform: translateY(0);
}

/* Date filter */
.aw-date-filter {
    display: flex;
    align-items: center;
    gap: var(--term-space-sm);
}

.aw-date-input {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    color: var(--term-fg-primary);
    background: var(--term-bg-input);
    border: 1px solid var(--term-border-default);
    padding: var(--term-space-xs) var(--term-space-sm);
    outline: none;
    transition: border-color var(--term-duration-normal) var(--term-easing);
    color-scheme: dark;
}

.aw-date-input:focus {
    border-color: var(--term-accent);
    box-shadow: var(--term-glow-accent);
}


/* ==========================================================================
   S3  LIST PANEL (LEFT 360px) — ADMISSION CARDS
   ========================================================================== */

/* H4 a11y fix: display:contents on <main> breaks accessibility (main landmark
   loses its box). Changed to a proper grid container that replicates the
   two-column split previously applied via the parent .aw-page grid. */
/* ARCHITECTURE: Two-column body with collapsible list panel.
   Default: list collapsed (80px) giving max workspace width.
   Toggle expands to 360px full list. CSS transition handles animation.
   WHY: Doctors spend most time in the workspace, not switching patients.
   The list only needs to be expanded when selecting a different admission. */
.aw-body {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: 80px 1fr;
    min-height: 0;
    overflow: hidden;
    transition: grid-template-columns 0.2s ease;
}

.aw-body--list-expanded {
    grid-template-columns: 360px 1fr;
}

.aw-list-panel {
    grid-row: 1;
    grid-column: 1;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--term-gold-dim);
    background: var(--term-bg-void);
    position: relative;
    z-index: 2;
}

/* ── Collapsed list view ── */
.aw-list-collapsed {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: var(--term-space-xs) 0;
    gap: 0;
}

.aw-body--list-expanded .aw-list-collapsed {
    display: none;
}

.aw-list-expand-btn {
    background: none;
    border: none;
    border-bottom: 1px solid var(--term-border-subtle);
    color: var(--term-accent);
    font-size: 0.75rem;
    font-family: var(--term-font-mono);
    cursor: pointer;
    padding: 8px 0;
    width: 100%;
    text-align: center;
    letter-spacing: 0.1em;
    transition: background 0.15s, color 0.15s;
}

.aw-list-expand-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--term-fg-primary);
}

.aw-list-collapsed-count {
    font-family: var(--term-font-mono);
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--term-accent);
    text-align: center;
    padding: 6px 0 4px;
    border-bottom: 1px solid var(--term-border-subtle);
    letter-spacing: 0.05em;
    text-shadow: 0 0 8px rgba(100, 200, 220, 0.3);
}

.aw-list-collapsed-cards {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    overflow-y: auto;
    flex: 1;
}

/* Mini-card: initials + first name + status stripe */
.aw-mini-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px 6px;
    cursor: pointer;
    border-left: 3px solid transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.15s, border-color 0.15s;
}

.aw-mini-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

.aw-mini-card--selected {
    border-left-color: var(--term-accent);
    background: rgba(255, 255, 255, 0.06);
}

.aw-mini-card-initials {
    font-family: var(--term-font-mono);
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--term-fg-secondary);
    letter-spacing: 0.06em;
    line-height: 1;
}

.aw-mini-card--selected .aw-mini-card-initials {
    color: var(--term-accent);
    text-shadow: 0 0 6px rgba(100, 200, 220, 0.3);
}

.aw-mini-card-name {
    font-family: var(--term-font-mono);
    font-size: 0.5rem;
    color: var(--term-fg-muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.2;
    letter-spacing: 0.02em;
}

.aw-mini-card--selected .aw-mini-card-name {
    color: var(--term-fg-secondary);
}

.aw-mini-card-status {
    width: 100%;
    height: 3px;
    border-radius: 1px;
    margin-top: 2px;
}

/* Mirror status-dot palette from full card for cross-mode consistency */
.aw-mini-card-status--pending     { background: var(--term-fg-muted); }
.aw-mini-card-status--data_entry  { background: var(--term-status-editing); }
.aw-mini-card-status--hp_generated { background: var(--term-accent); }
.aw-mini-card-status--saved       { background: var(--term-status-ready); }
.aw-mini-card-status--archived    { background: transparent; border: 1px solid var(--term-fg-muted); }

/* ── Expanded list view ── */
.aw-list-expanded {
    display: none;
}

.aw-body--list-expanded .aw-list-expanded {
    display: block;
}

.aw-list-expanded-header {
    display: flex;
    justify-content: flex-end;
    padding: 4px var(--term-space-sm) 0;
}

.aw-list-collapse-btn {
    background: none;
    border: none;
    color: var(--term-fg-muted);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 2px 6px;
    opacity: 0.5;
    transition: opacity 0.15s, color 0.15s;
}

.aw-list-collapse-btn:hover {
    opacity: 1;
    color: var(--term-accent);
}

.aw-admission-list {
    list-style: none;
    margin: 0;
    padding: var(--term-space-sm);
    display: flex;
    flex-direction: column;
    gap: var(--term-space-sm);
}

/* List empty state */
.aw-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--term-space-2xl) var(--term-space-lg);
    gap: var(--term-space-lg);
    min-height: 200px;
}

.aw-list-empty-text {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    color: var(--term-fg-muted);
    letter-spacing: var(--term-tracking-wide);
    text-align: center;
}

/* Smaller ghost button for empty state */
.aw-new-btn-sm {
    font-family: var(--term-font-display);
    font-size: var(--term-text-xs);
    font-weight: 500;
    letter-spacing: var(--term-tracking-wider);
    text-transform: uppercase;
    color: var(--term-accent);
    background: transparent;
    border: 1px solid var(--term-accent-dim);
    padding: var(--term-space-xs) var(--term-space-md);
    cursor: pointer;
    transition: all var(--term-duration-normal) var(--term-easing);
}

.aw-new-btn-sm:hover {
    background: var(--term-accent-ghost);
    box-shadow: var(--term-glow-accent);
}

/* --------------------------------------------------------------------------
   Admission card (LAYERED DEPTH 2026-05-14)
   Two-band scan layout: [status-dot] [name cluster acuity time / cc mrn] [kebab]
   ~64px card height stable across collapsed AND selected states.
   Depth language: triple-layer shadow + permanent status stripe (left edge)
   + selected-only defocused radial halo. No visible borders.
   -------------------------------------------------------------------------- */

.aw-admission-card {
    --aw-stripe-color: var(--term-fg-muted);
    --aw-halo-color:   var(--term-accent);
    --aw-rim-color:    rgba(255, 255, 255, 0.05);

    display: grid;
    grid-template-columns: 14px 1fr auto;
    column-gap: var(--term-space-sm);
    align-items: center;
    position: relative;
    min-height: 84px;
    padding: 14px var(--term-space-md) 14px 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.012), rgba(0,0,0,0.04)),
                var(--term-bg-surface);
    border: none;
    box-shadow:
        inset 0 1px 0 var(--aw-rim-color),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5),
        0 1px 4px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: background var(--term-duration-fast) var(--term-easing),
                box-shadow  var(--term-duration-fast) var(--term-easing),
                transform   var(--term-duration-fast) var(--term-easing);
    z-index: 0;
}

/* L1: permanent semantic left-edge status stripe (color set by [data-status]) */
.aw-admission-card::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--aw-stripe-color);
    opacity: 0.9;
    box-shadow: 1px 0 8px color-mix(in srgb, var(--aw-stripe-color) 28%, transparent);
    pointer-events: none;
}

/* L3: selected-only defocused atmospheric halo (one at a time, structurally) */
.aw-admission-card::before {
    content: '';
    position: absolute;
    left: 34px;
    right: 34px;
    top: -22px;
    height: 42px;
    background: radial-gradient(ellipse at 50% 45%,
        color-mix(in srgb, var(--aw-halo-color) 42%, transparent), transparent 68%);
    filter: blur(20px);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scaleX(0.86);
    transition: opacity var(--term-duration-normal) var(--term-easing),
                transform var(--term-duration-normal) var(--term-easing);
    z-index: -1;
}

.aw-admission-card:hover {
    background: linear-gradient(180deg, rgba(255,255,255,0.018), rgba(0,0,0,0.04)),
                var(--term-bg-elevated);
}

.aw-admission-card.selected {
    --aw-stripe-color: var(--term-accent);
    --aw-rim-color:    rgba(0, 255, 208, 0.56);
    background: linear-gradient(180deg, rgba(0,255,208,0.035), rgba(0,0,0,0.05)),
                var(--term-bg-elevated);
    box-shadow:
        inset 0 1px 0 var(--aw-rim-color),
        inset 0 -1px 0 rgba(0, 0, 0, 0.56),
        0 1px 4px rgba(0, 0, 0, 0.4),
        0 10px 28px rgba(0, 0, 0, 0.34);
    z-index: 3;
}

.aw-admission-card.selected::before {
    opacity: 0.62;
    transform: translateY(0) scaleX(1);
}

.aw-admission-card:focus-visible {
    outline: 1px solid var(--term-accent-dim);
    outline-offset: -1px;
}

/* [data-status] drives stripe + halo color tokens, NOT the dot directly
   (the dot reads from the same custom property — single source of truth). */
.aw-admission-card[data-status="pending"]      { --aw-stripe-color: rgba(138,130,120,0.42); --aw-halo-color: var(--term-accent); }
.aw-admission-card[data-status="data_entry"]   { --aw-stripe-color: var(--term-status-editing); --aw-halo-color: var(--term-gold); }
.aw-admission-card[data-status="hp_generated"] { --aw-stripe-color: var(--term-accent); --aw-halo-color: var(--term-accent); }
.aw-admission-card[data-status="saved"]        { --aw-stripe-color: var(--term-status-ready); --aw-halo-color: var(--term-accent); }
.aw-admission-card[data-status="archived"]     { --aw-stripe-color: rgba(138,130,120,0.28); --aw-halo-color: var(--term-fg-muted); }

/* Status dot: 8px colorblind-redundancy glyph; color inherits the stripe.
   Also serves as drag affordance (grab cursor). */
.aw-card-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--aw-stripe-color);
    box-shadow: 0 0 8px color-mix(in srgb, var(--aw-stripe-color) 32%, transparent);
    cursor: grab;
    transition: box-shadow var(--term-duration-fast) var(--term-easing);
}
.aw-card-status-dot:active { cursor: grabbing; }

/* Pending + archived dots: hollow outline (no fill) — extra colorblind redundancy */
.aw-admission-card[data-status="pending"]  .aw-card-status-dot,
.aw-admission-card[data-status="archived"] .aw-card-status-dot {
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--term-fg-muted);
}

/* Card content grid: name row + cc/mrn row.
   Lifecycle cluster sits between name and acuity (column 2). */
.aw-card-grid {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    column-gap: var(--term-space-sm);
    row-gap: 5px;
    min-width: 0;
    align-items: baseline;
}

/* M2 fishbone thumbnail (INTEGRATION.md): squint-scale lab glyph on cards
   that carry a bounded lab_preview. No labels — the ramp IS the read. */
.aw-card-labs {
    grid-column: 2;  /* under the content grid — the card is a 14px/1fr/auto grid */
    position: relative;
    margin-top: var(--term-space-xs);
    padding: var(--term-space-xs) var(--term-space-xs) 2px;
    border-top: 1px solid color-mix(in srgb, var(--term-fg-muted) 18%, transparent);
}
.aw-card-labs svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: 148px;
}
.aw-card-labs-meta {
    display: flex;
    align-items: baseline;
    gap: var(--term-space-xs);
    margin-bottom: 2px;
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
}
.aw-card-labs-sev {
    color: var(--term-gold);
    font-weight: 500;
    margin-left: auto;
}
.aw-card-labs-counts { color: var(--term-fg-muted); }
.aw-card-labs-crit {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--term-status-critical, #ff6b6b);
    box-shadow: 0 0 6px color-mix(in srgb, var(--term-status-critical, #ff6b6b) 55%, transparent);
    align-self: center;
}

.aw-card-name {
    grid-column: 1;
    grid-row: 1;
    font-family: var(--term-font-display);
    font-size: var(--term-text-base);
    font-weight: 400;
    color: var(--term-fg-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* L4: lifecycle dot cluster — three pipeline stages (intake / H&P / saved).
   Empty = pending, .done = solid teal, .active = single-cycle pulse (4 iter, NOT infinite). */
.aw-card-cluster {
    grid-column: 2;
    grid-row: 1;
    position: relative;
    display: inline-grid;
    grid-template-columns: repeat(3, 7px);
    gap: 5px;
    align-items: center;
    height: 12px;
    padding-top: 1px;
}

.aw-card-cluster-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1px solid var(--term-accent-dim);
    background: transparent;
    opacity: 0.85;
    transition: background var(--term-duration-fast) var(--term-easing),
                border-color var(--term-duration-fast) var(--term-easing);
}
.aw-card-cluster-dot.done {
    background: var(--term-accent);
    border-color: var(--term-accent);
    box-shadow: 0 0 8px rgba(0, 255, 208, 0.32);
    opacity: 1;
}
.aw-card-cluster-dot.active {
    background: rgba(0, 255, 208, 0.18);
    border-color: var(--term-accent);
    animation: aw-cluster-pulse 280ms var(--term-easing) 4;
}

@keyframes aw-cluster-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(0, 255, 208, 0.42); }
    100% { box-shadow: 0 0 0 6px rgba(0, 255, 208, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .aw-card-cluster-dot.active { animation: none; }
    .aw-admission-card,
    .aw-admission-card::before { transition: none; }
}

/* Tooltip with stage timestamps; shown on cluster hover/focus */
.aw-card-cluster-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    width: 220px;
    padding: 8px 10px;
    color: var(--term-fg-secondary);
    background: rgba(27, 26, 22, 0.96);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5),
        0 8px 22px rgba(0, 0, 0, 0.44);
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    line-height: 1.5;
    transform: translate(-50%, 4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--term-duration-fast) var(--term-easing),
                transform var(--term-duration-fast) var(--term-easing);
    z-index: 8;
}
.aw-card-cluster:hover .aw-card-cluster-tooltip,
.aw-card-cluster:focus-within .aw-card-cluster-tooltip {
    opacity: 1;
    transform: translate(-50%, 0);
}

.aw-card-acuity {
    grid-column: 3;
    grid-row: 1;
    font-family: var(--term-font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--term-tracking-wide);
    text-transform: uppercase;
    padding: 1px 6px;
    border: 1px solid currentColor;
    line-height: 1.2;
    white-space: nowrap;
}

.aw-card-time {
    grid-column: 4;
    grid-row: 1;
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    color: var(--term-fg-muted);
    white-space: nowrap;
}

.aw-card-cc {
    grid-column: 1;
    grid-row: 2;
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    color: var(--term-fg-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.aw-card-cc:empty::before {
    content: 'no chief complaint';
    color: var(--term-fg-muted);
    font-style: italic;
    opacity: 0.55;
}

.aw-card-mrn {
    grid-column: 2 / 5;
    grid-row: 2;
    justify-self: end;
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    color: var(--term-fg-muted);
    letter-spacing: var(--term-tracking-wide);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.aw-card-census-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--term-gold);
}


/* --------------------------------------------------------------------------
   S3b  LIST CONTROLS — Sort, Show Archived toggle
   -------------------------------------------------------------------------- */

.aw-list-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--term-space-sm) var(--term-space-sm) 0;
    gap: var(--term-space-sm);
    border-bottom: 1px solid var(--term-border-subtle);
    flex-shrink: 0;
}

.aw-list-sort {
    display: flex;
    align-items: center;
    gap: var(--term-space-xs);
}

.aw-field-label--inline {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    color: var(--term-fg-muted);
    letter-spacing: var(--term-tracking-wide);
    white-space: nowrap;
}

.aw-select--compact {
    font-size: var(--term-text-xs);
    padding: 2px var(--term-space-xs);
    background: var(--term-bg-surface);
    color: var(--term-fg-secondary);
    border: 1px solid var(--term-border-subtle);
    font-family: var(--term-font-mono);
    cursor: pointer;
}

.aw-select--compact:focus {
    border-color: var(--term-accent-dim);
    outline: none;
}

.aw-archived-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    color: var(--term-fg-muted);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.aw-archived-toggle input[type="checkbox"] {
    accent-color: var(--term-accent);
    cursor: pointer;
    margin: 0;
}


/* --------------------------------------------------------------------------
   S3c  CARD KEBAB MENU — replaces hover-only icon column (a11y-reachable)
   -------------------------------------------------------------------------- */

.aw-card-kebab {
    background: transparent;
    border: none;
    color: var(--term-fg-muted);
    cursor: pointer;
    padding: 4px 6px;
    font-size: 16px;
    line-height: 1;
    opacity: 0.45;
    transition: opacity var(--term-duration-fast) var(--term-easing),
                color var(--term-duration-fast) var(--term-easing);
}

.aw-admission-card:hover .aw-card-kebab,
.aw-admission-card:focus-within .aw-card-kebab,
.aw-card-kebab:focus-visible,
.aw-card-kebab[aria-expanded="true"] {
    opacity: 1;
    color: var(--term-fg-secondary);
}

.aw-card-kebab:focus-visible {
    outline: 1px solid var(--term-accent-dim);
    outline-offset: 1px;
}

.aw-card-menu {
    position: absolute;
    top: calc(100% - 4px);
    right: var(--term-space-md);
    z-index: 20;
    min-width: 120px;
    background: var(--term-bg-elevated);
    border: 1px solid var(--term-border-default);
    box-shadow: var(--term-shadow-modal);
    display: flex;
    flex-direction: column;
    padding: 4px 0;
}

.aw-card-menu-item {
    background: transparent;
    border: none;
    color: var(--term-fg-secondary);
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    text-align: left;
    padding: 6px 12px;
    cursor: pointer;
    transition: background var(--term-duration-fast) var(--term-easing),
                color var(--term-duration-fast) var(--term-easing);
}

.aw-card-menu-item:hover,
.aw-card-menu-item:focus-visible {
    background: var(--term-accent-subtle);
    color: var(--term-fg-primary);
    outline: none;
}

.aw-card-menu-item--danger { color: var(--term-fg-muted); }
.aw-card-menu-item--danger:hover,
.aw-card-menu-item--danger:focus-visible {
    background: rgba(239, 68, 68, 0.10);
    color: var(--term-status-error);
}


/* --------------------------------------------------------------------------
   S3d  CARD STATES — Archived, Dragging, Drop Indicator
   -------------------------------------------------------------------------- */

/* Archived card: dimmed; status dot already signals state (hollow outline) */
.aw-card--archived {
    opacity: 0.55;
}

/* Dragging state */
.aw-card--dragging {
    opacity: 0.4;
    border-style: dashed;
    transform: scale(0.98);
}

/* Drop indicator line */
.aw-drop-indicator {
    list-style: none;
    height: 2px;
    background: var(--term-accent);
    border-radius: 1px;
    margin: 0 var(--term-space-sm);
    box-shadow: var(--term-glow-accent);
    animation: aw-drop-pulse 800ms ease-in-out infinite alternate;
}

@keyframes aw-drop-pulse {
    from { opacity: 0.6; }
    to { opacity: 1; }
}


/* ==========================================================================
   S4  WORKSPACE PANEL (RIGHT)
   ========================================================================== */

.aw-workspace {
    grid-row: 1;
    grid-column: 2;
    overflow-y: auto;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Section divider title */
.aw-section-title {
    font-family: var(--term-font-display);
    font-size: var(--term-text-sm);
    font-weight: 300;
    letter-spacing: 0.20em;
    text-transform: uppercase;
    color: var(--term-gold);
    padding: var(--term-space-xl) 0 var(--term-space-sm);
    display: flex;
    align-items: center;
    gap: var(--term-space-sm);
    text-shadow: var(--term-text-glow-gold);
    margin: 0;
}

.aw-section-title::before {
    content: '>';
    font-family: var(--term-font-mono);
    font-weight: 700;
    font-size: var(--term-text-base);
    color: var(--term-accent);
    text-shadow: var(--term-text-glow-accent);
    flex-shrink: 0;
}

.aw-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--term-gold-dim), transparent 80%);
    margin-left: var(--term-space-md);
}

/* Field layout helpers */
.aw-field-group {
    margin-bottom: var(--term-space-md);
}

.aw-field-row {
    display: flex;
    gap: var(--term-space-lg);
}

.aw-field-grow {
    flex: 1;
    min-width: 0;
}

.aw-field-narrow {
    flex: 0 0 120px;
}

.aw-field-label {
    font-family: var(--term-font-display);
    font-size: var(--term-text-xs);
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--term-gold);
    opacity: 0.6;
    margin-bottom: var(--term-space-xs);
    display: block;
}

.aw-field-label::before {
    content: '$ ';
    font-family: var(--term-font-mono);
    color: var(--term-gold-dim);
}

/* Standard inputs and selects */
.aw-input,
.aw-select {
    font-family: var(--term-font-body);
    font-size: var(--term-text-base);
    color: var(--term-fg-primary);
    background: var(--term-bg-input);
    border: none;
    border-bottom: 1px solid var(--term-border-default);
    padding: var(--term-space-sm) var(--term-space-md);
    width: 100%;
    outline: none;
    transition: border-color var(--term-duration-normal) var(--term-easing),
                box-shadow var(--term-duration-normal) var(--term-easing);
    box-sizing: border-box;
}

.aw-input::placeholder {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    color: var(--term-fg-muted);
    opacity: 0.5;
}

.aw-input:focus,
.aw-select:focus {
    border-bottom-color: var(--term-accent);
    box-shadow: 0 1px 0 0 var(--term-accent);
}

.aw-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='%23A09888'%3E%3Cpath d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

/* ── Compact Patient ID Row ──
   WHY: Replaces the 3-row patient info form. Name + MRN + Acuity in one line.
   Everything else (age, sex, DOB, CC, dx) lives in a collapsible details panel
   because the doctor enters all that in the clinical text anyway. */
.aw-patient-id-row {
    display: flex;
    align-items: center;
    gap: var(--term-space-sm);
    padding: var(--term-space-sm) var(--term-space-lg);
    border-bottom: 1px solid var(--term-border-subtle);
    background: var(--term-bg-elevated);
}

.aw-input--inline {
    font-family: var(--term-font-body);
    font-size: var(--term-text-base);
    color: var(--term-fg-primary);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--term-border-subtle);
    padding: 4px var(--term-space-sm);
    outline: none;
    transition: border-color 0.15s;
    flex: 1;
    min-width: 0;
}

.aw-input--inline:focus {
    border-bottom-color: var(--term-accent);
}

.aw-input--inline::placeholder {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    color: var(--term-fg-muted);
    opacity: 0.4;
}

.aw-input--mrn {
    flex: 0 1 140px;
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    letter-spacing: 0.04em;
}

.aw-select--inline {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    color: var(--term-fg-secondary);
    background: transparent;
    border: 1px solid var(--term-border-subtle);
    padding: 3px 24px 3px 6px;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' fill='%23A09888'%3E%3Cpath d='M4 5L0 0h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    width: auto;
    flex: 0 0 auto;
    transition: border-color 0.15s;
}

.aw-select--inline:focus {
    border-color: var(--term-accent);
}

.aw-details-toggle {
    background: none;
    border: none;
    color: var(--term-fg-muted);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 2px 4px;
    opacity: 0.5;
    transition: opacity 0.15s, transform 0.2s;
    flex-shrink: 0;
}

.aw-details-toggle:hover { opacity: 1; }
.aw-details-toggle[aria-expanded="true"] { transform: rotate(180deg); }

/* Collapsible details panel */
.aw-details-panel {
    background: var(--term-bg-surface);
    border-bottom: 1px solid var(--term-border-subtle);
    padding: var(--term-space-xs) var(--term-space-lg);
    overflow: hidden;
}

.aw-details-fields {
    display: flex;
    gap: var(--term-space-md);
    align-items: end;
    flex-wrap: wrap;
}

.aw-detail-field {
    flex: 0 0 auto;
}

.aw-detail-field--grow {
    flex: 1;
    min-width: 120px;
}

.aw-detail-field .aw-field-label {
    font-size: 0.55rem;
    margin-bottom: 2px;
}

.aw-input--compact,
.aw-select--compact {
    font-size: var(--term-text-sm);
    padding: 3px var(--term-space-sm);
}

/* Save status — positioned at end of patient ID row */
.aw-save-status {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    color: var(--term-fg-muted);
    opacity: 0.6;
    padding: 0 var(--term-space-lg);
    text-align: right;
}

.aw-select option {
    background: var(--term-bg-elevated);
    color: var(--term-fg-primary);
}

/* Auto-save indicator */
.aw-save-status {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    letter-spacing: var(--term-tracking-wide);
    color: var(--term-fg-muted);
    text-align: right;
    margin-bottom: var(--term-space-sm);
}


/* ==========================================================================
   S5  PATIENT STRIP
   ========================================================================== */

.aw-patient-strip {
    background: var(--term-bg-elevated);
    border-bottom: 1px solid var(--term-border-default);
    padding: var(--term-space-md) var(--term-space-xl);
    display: flex;
    align-items: center;
    gap: var(--term-space-xl);
    flex-shrink: 0;
    position: relative;
}

/* Accent underline on strip */
.aw-patient-strip::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: var(--term-space-xl);
    right: var(--term-space-xl);
    height: 1px;
    background: linear-gradient(
        to right,
        var(--term-accent-dim),
        transparent 70%
    );
    pointer-events: none;
}

.aw-strip-name {
    font-family: var(--term-font-display);
    font-size: var(--term-text-lg);
    font-weight: 400;
    color: var(--term-fg-primary);
    white-space: nowrap;
}

.aw-strip-mrn {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    color: var(--term-fg-muted);
    letter-spacing: var(--term-tracking-wide);
    white-space: nowrap;
}

.aw-strip-mrn::before {
    content: 'MRN ';
    color: var(--term-gold-dim);
}

.aw-strip-meta {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    color: var(--term-fg-secondary);
    display: flex;
    gap: var(--term-space-lg);
    flex-wrap: wrap;
}

.aw-strip-meta-item {
    white-space: nowrap;
}

.aw-strip-meta-item::before {
    content: '// ';
    color: var(--term-fg-muted);
}

.aw-strip-badges {
    display: flex;
    gap: var(--term-space-sm);
    align-items: center;
    margin-left: auto;
}


/* ==========================================================================
   S6  CLINICAL DATA TEXTAREA
   ========================================================================== */

/* Wrapper provides the glow frame */
.aw-clinical-textarea-wrap {
    position: relative;
    border: 1px solid var(--term-border-default);
    transition: border-color var(--term-duration-normal) var(--term-easing),
                box-shadow var(--term-duration-normal) var(--term-easing);
}

.aw-clinical-textarea-wrap:focus-within {
    border-color: var(--term-accent-dim);
    box-shadow: var(--term-glow-accent);
}

/* The textarea itself — comfortable clinical data entry */
.aw-clinical-textarea {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    line-height: 1.75;
    color: var(--term-fg-primary);
    background: var(--term-bg-input);
    border: none;
    padding: var(--term-space-lg);
    width: 100%;
    min-height: 280px;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    /* Tab-stop friendly; paste-ready for pasted EHR text */
    tab-size: 4;
    white-space: pre-wrap;
    word-break: break-word;
}

.aw-clinical-textarea::placeholder {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    color: var(--term-fg-muted);
    opacity: 0.4;
    line-height: 1.75;
}

/* Textarea char/word count hint */
.aw-clinical-textarea-meta {
    display: flex;
    justify-content: flex-end;
    padding: var(--term-space-xs) var(--term-space-md);
    background: var(--term-bg-input);
    border-top: 1px solid var(--term-border-subtle);
}

/* .aw-clinical-textarea-count removed 2026-08-01 — no such node ever rendered. */


/* ==========================================================================
   S7  ACTION BAR (ANALYZE / SAVE BUTTONS)
   ========================================================================== */

.aw-action-bar {
    display: flex;
    align-items: center;
    gap: var(--term-space-md);
    padding: var(--term-space-lg) var(--term-space-xl);
    border-top: 1px solid var(--term-border-subtle);
    background: var(--term-bg-void);
    flex-shrink: 0;
}

/* Primary: Generate H&P */
.aw-generate-btn {
    flex: 1;
    background: linear-gradient(135deg, var(--term-accent), var(--term-accent-hot));
    border: none;
    color: var(--term-fg-inverse);
    font-family: var(--term-font-display);
    font-size: var(--term-text-sm);
    font-weight: 600;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    padding: var(--term-space-md) var(--term-space-xl);
    min-height: 44px;
    cursor: pointer;
    transition: all var(--term-duration-normal) var(--term-easing);
}

.aw-generate-btn:hover {
    box-shadow: var(--term-glow-accent-intense);
    transform: translateY(-1px);
}

.aw-generate-btn:active {
    transform: translateY(0);
}

.aw-generate-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Secondary ghost button (Save, Copy, etc.) */
.aw-btn {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    font-weight: 500;
    letter-spacing: var(--term-tracking-wide);
    text-transform: uppercase;
    color: var(--term-fg-secondary);
    background: transparent;
    border: 1px solid var(--term-border-default);
    padding: var(--term-space-sm) var(--term-space-lg);
    cursor: pointer;
    min-height: 44px;
    transition: all var(--term-duration-normal) var(--term-easing);
}

.aw-btn:hover {
    border-color: var(--term-accent-dim);
    color: var(--term-fg-primary);
}

/* CLEANUP (2026-03-03): .aw-btn-danger (single-dash) deleted — superseded by
   .aw-btn--danger (BEM, double-dash) defined in S17. HTML uses .aw-btn--danger. */

/* Status field in action bar */
.aw-status-select-wrap {
    flex: 0 0 170px;
}


/* ==========================================================================
   S8  NOTE OUTPUT AREA
   ========================================================================== */

.aw-note-output-section {
    border-top: 1px solid var(--term-border-default);
    background: var(--term-bg-surface);
    position: relative;
    flex-shrink: 0;
}

.aw-note-output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--term-space-md) var(--term-space-xl);
    border-bottom: 1px solid var(--term-border-subtle);
}

.aw-note-output-title {
    font-family: var(--term-font-display);
    font-size: var(--term-text-sm);
    font-weight: 300;
    letter-spacing: var(--term-tracking-display);
    text-transform: uppercase;
    color: var(--term-gold);
    margin: 0;
    text-shadow: var(--term-text-glow-gold);
}

.aw-note-output-actions {
    display: flex;
    gap: var(--term-space-sm);
}

/* Footer row below note output — holds Save H&P button */
.aw-output-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: var(--term-space-md) var(--term-space-xl);
    border-top: 1px solid var(--term-border-subtle);
    background: var(--term-bg-void);
    flex-shrink: 0;
}

.aw-output-footer-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* The actual note text display */
.aw-note-output {
    padding: var(--term-space-xl);
    font-family: var(--term-font-body);
    font-size: var(--term-text-base);
    line-height: 1.7;
    color: var(--term-fg-primary);
    white-space: pre-wrap;
    max-height: 40vh;
    overflow-y: auto;
}

/* Streaming: partial content hint */
.aw-note-output.streaming {
    border-left: 2px solid var(--term-accent-dim);
}

.aw-note-output.streaming::after {
    content: '█';
    color: var(--term-accent);
    animation: aw-cursor-blink 1s step-end infinite;
    font-family: var(--term-font-mono);
}

@keyframes aw-cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}


/* ==========================================================================
   S9  EMPTY STATES
   ========================================================================== */

/* Workspace empty state — no admission selected */
.aw-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: var(--term-space-lg);
    text-align: center;
    padding: var(--term-space-2xl);
}

.aw-empty-icon {
    font-size: 3rem;
    color: var(--term-fg-muted);
    opacity: 0.4;
}

.aw-empty-title {
    font-family: var(--term-font-display);
    font-size: var(--term-text-lg);
    font-weight: 300;
    letter-spacing: var(--term-tracking-wide);
    color: var(--term-fg-secondary);
    margin: 0;
}

.aw-empty-subtitle {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    color: var(--term-fg-muted);
    margin: 0;
    letter-spacing: var(--term-tracking-wide);
}


/* ==========================================================================
   S10  ACUITY & STATUS BADGES
   ========================================================================== */

/* Shared badge base */
.aw-acuity-badge,
.aw-status-badge,
.aw-card-status {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    font-weight: 600;
    letter-spacing: var(--term-tracking-wider);
    text-transform: uppercase;
    padding: 2px 8px;
    border: 1px solid currentColor;
    display: inline-block;
    line-height: 1.4;
    flex-shrink: 0;
}

/* --- Acuity badges --- */
/* CLEANUP (2026-03-03): [data-acuity=*] selectors removed — JS renders
   class-based badges (.aw-acuity--icu, .aw-acuity--emergent, etc.) via
   _acuityClass() in admission-list.js. Data-attribute selectors were dead code.
   Class-based rules with DR severity tokens live in S11c. */

/* --- Status badges --- */

/* pending: worsening — needs attention */
.aw-status-badge[data-status="pending"] {
    color: var(--dr-severity-worsening);
    background: var(--dr-severity-worsening-bg);
    border-color: var(--dr-severity-worsening-border);
    font-weight: 500;
}

/* data_entry: improving — in progress */
.aw-status-badge[data-status="data_entry"] {
    color: var(--dr-severity-improving);
    background: var(--dr-severity-improving-bg);
    border-color: var(--dr-severity-improving-border);
}

/* hp_generated: stable — generated, awaiting EHR review */
.aw-status-badge[data-status="hp_generated"] {
    color: var(--dr-severity-stable);
    background: var(--dr-severity-stable-bg);
    border-color: var(--dr-severity-stable-border);
}

/* saved: resolved — complete */
.aw-status-badge[data-status="saved"] {
    color: var(--dr-severity-resolved);
    background: var(--dr-severity-resolved-bg);
    border-color: var(--dr-severity-resolved-border);
}

/* archived: muted strikethrough */
.aw-status-badge[data-status="archived"] {
    color: var(--term-fg-muted);
    border-color: var(--term-border-subtle);
    text-decoration: line-through;
    opacity: 0.6;
}


/* ==========================================================================
   S11  GRAIN OVERLAY + SCROLLBARS
   ========================================================================== */

/* Film grain overlay */
.aw-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: var(--term-grain);
    background-size: 512px 512px;
    pointer-events: none;
    z-index: 9999;
}

/* Webkit scrollbars */
.aw-list-panel::-webkit-scrollbar,
.aw-workspace::-webkit-scrollbar,
.aw-workspace-inner::-webkit-scrollbar,
.aw-note-output::-webkit-scrollbar {
    width: 6px;
}

.aw-list-panel::-webkit-scrollbar-track,
.aw-workspace::-webkit-scrollbar-track,
.aw-workspace-inner::-webkit-scrollbar-track,
.aw-note-output::-webkit-scrollbar-track {
    background: var(--term-bg-void);
}

.aw-list-panel::-webkit-scrollbar-thumb,
.aw-workspace::-webkit-scrollbar-thumb,
.aw-workspace-inner::-webkit-scrollbar-thumb,
.aw-note-output::-webkit-scrollbar-thumb {
    background: var(--term-border-default);
    border-radius: 3px;
}

.aw-list-panel::-webkit-scrollbar-thumb:hover,
.aw-workspace::-webkit-scrollbar-thumb:hover,
.aw-workspace-inner::-webkit-scrollbar-thumb:hover,
.aw-note-output::-webkit-scrollbar-thumb:hover {
    background: var(--term-border-strong);
}

/* Firefox scrollbars */
.aw-list-panel,
.aw-workspace,
.aw-workspace-inner,
.aw-note-output {
    scrollbar-width: thin;
    scrollbar-color: var(--term-border-default) var(--term-bg-void);
}

/* H4 a11y: screen-reader-only utility */
.aw-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus ring (global for .aw-page) */
.aw-page *:focus-visible {
    outline: 2px solid var(--term-accent);
    outline-offset: 2px;
}

.aw-input:focus-visible,
.aw-select:focus-visible,
.aw-clinical-textarea:focus-visible {
    outline: none;
}


/* ==========================================================================
   S11b  MISSING BUTTON VARIANTS (H1.2, H1.5)
   ========================================================================== */

/* H1.2 — Save H&P button (output footer, gold accent to signal finalization) */
.aw-save-btn {
    background: linear-gradient(135deg, var(--term-gold), var(--term-gold-hot));
    border: none;
    color: var(--term-fg-inverse);
    font-family: var(--term-font-display);
    font-size: var(--term-text-sm);
    font-weight: 600;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    padding: var(--term-space-md) var(--term-space-xl);
    min-height: 44px;
    cursor: pointer;
    transition: all var(--term-duration-normal) var(--term-easing);
}

.aw-save-btn:hover {
    box-shadow: var(--term-glow-gold);
    transform: translateY(-1px);
}

.aw-save-btn:active {
    transform: translateY(0);
}

.aw-save-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* H1.5 — Secondary ghost variant for .aw-btn (Back / cancel actions) */
.aw-btn--secondary {
    color: var(--term-fg-muted);
    border-color: var(--term-border-subtle);
}

.aw-btn--secondary:hover {
    border-color: var(--term-border-default);
    color: var(--term-fg-secondary);
}


/* ==========================================================================
   S11c  PATIENT STRIP CHIP CLASSES (H1.6 — rendered by workspace.js)
   ========================================================================== */

/* Demographic info chip */
.aw-patient-strip .aw-strip-demo {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    color: var(--term-fg-secondary);
    letter-spacing: var(--term-tracking-wide);
    white-space: nowrap;
}

/* Acuity and status chip containers share badge base */
.aw-patient-strip .aw-strip-acuity,
.aw-patient-strip .aw-strip-status {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    font-weight: 600;
    letter-spacing: var(--term-tracking-wider);
    text-transform: uppercase;
    padding: 2px 8px;
    border: 1px solid currentColor;
    display: inline-block;
    line-height: 1.4;
    flex-shrink: 0;
}

/* Acuity chip values — match form select values (routine/urgent/emergent/icu) */
/* DR: --dr-severity-* replaces --term-status-* workflow colors with clinically
   correct severity semantics. Previously "obs" rendered blue (the "generating"
   workflow color), which is semantically inverted for a clinical severity scale. */
.aw-acuity--icu {
    color: var(--dr-severity-critical);
    background: var(--dr-severity-critical-bg);
    border-color: var(--dr-severity-critical-border);
    box-shadow: 0 0 6px rgba(196, 76, 76, 0.20);
}

.aw-acuity--emergent {
    color: var(--dr-severity-critical);
    background: var(--dr-severity-critical-bg);
    border-color: var(--dr-severity-critical-border);
}

.aw-acuity--urgent {
    color: var(--dr-severity-worsening);
    background: var(--dr-severity-worsening-bg);
    border-color: var(--dr-severity-worsening-border);
}

.aw-acuity--routine {
    color: var(--dr-severity-stable);
    background: var(--dr-severity-stable-bg);
    border-color: var(--dr-severity-stable-border);
}

/* Obs: resolved/teal — semantically correct (observation is lowest-acuity) */
.aw-acuity--obs {
    color: var(--dr-severity-resolved);
    background: var(--dr-severity-resolved-bg);
    border-color: var(--dr-severity-resolved-border);
}

/* Status chip values */
/* DR: workflow stages mapped to severity scale — pending=needs attention (worsening),
   data_entry=in progress (improving), hp_generated=awaiting review (stable),
   saved=complete (resolved). Archived stays muted/de-emphasized. */
.aw-status--pending {
    color: var(--dr-severity-worsening);
    background: var(--dr-severity-worsening-bg);
    border-color: var(--dr-severity-worsening-border);
}

.aw-status--data_entry {
    color: var(--dr-severity-improving);
    background: var(--dr-severity-improving-bg);
    border-color: var(--dr-severity-improving-border);
}

.aw-status--hp_generated {
    color: var(--dr-severity-stable);
    background: var(--dr-severity-stable-bg);
    border-color: var(--dr-severity-stable-border);
}

.aw-status--saved {
    color: var(--dr-severity-resolved);
    background: var(--dr-severity-resolved-bg);
    border-color: var(--dr-severity-resolved-border);
}

.aw-status--archived {
    color: var(--term-fg-muted);
    border-color: var(--term-border-subtle);
    text-decoration: line-through;
    opacity: 0.6;
}


/* ==========================================================================
   S12  NEW ADMISSION MODAL
   ========================================================================== */

.aw-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aw-modal[hidden] {
    display: none;
}

.aw-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}

.aw-modal-content {
    position: relative;
    background: var(--term-bg-elevated);
    border: 1px solid var(--term-border-default);
    width: 90%;
    max-width: 540px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    z-index: 1;
    /* Stepped ziggurat corners on modal */
    box-shadow: var(--term-shadow-modal);
}

/* Wide modal modifier — used for help guide modal */
.aw-modal-content--wide {
    max-width: 620px;
}

/* Accent left edge on modal */
.aw-modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, var(--term-accent-dim), transparent);
    pointer-events: none;
}

.aw-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--term-space-lg) var(--term-space-xl);
    border-bottom: 1px solid var(--term-border-subtle);
}

.aw-modal-title {
    font-family: var(--term-font-display);
    font-size: var(--term-text-lg);
    font-weight: 300;
    letter-spacing: var(--term-tracking-display);
    text-transform: uppercase;
    color: var(--term-gold);
    margin: 0;
    text-shadow: var(--term-text-glow-gold);
}

.aw-modal-close {
    font-size: 1.25rem;
    color: var(--term-fg-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: var(--term-space-xs);
    transition: color var(--term-duration-normal) var(--term-easing);
    line-height: 1;
}

.aw-modal-close:hover {
    color: var(--term-fg-primary);
}

.aw-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--term-space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--term-space-md);
}

.aw-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--term-space-md);
    padding: var(--term-space-lg) var(--term-space-xl);
    border-top: 1px solid var(--term-border-subtle);
}

/* Divider for modal sections */
.aw-divider {
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        var(--term-gold-dim) 20%,
        var(--term-gold-dim) 80%,
        transparent
    );
    margin: var(--term-space-md) 0;
    position: relative;
}

/* Fan motif at center of divider */
.aw-divider::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 9px;
    height: 9px;
    background: var(--term-gold-dim);
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    opacity: 0.5;
}


/* ==========================================================================
   S13  LIVE SCAFFOLD (H&P template that fills progressively during data entry)
   ========================================================================== */

/* ARCHITECTURE: The scaffold replaces flat section badges with a spatial H&P
   template preview. Sections are always visible (empty skeleton), then fill
   progressively as the doctor types/dictates. Layout mirrors the final note
   structure so the doctor sees their H&P taking shape in real-time.
   WHY: Spatial orientation is critical during rapid data entry. Doctors need
   to see which parts of the note have data and which still need input.
   TRADEOFF: More vertical space vs much richer visual feedback. */

/* v2.3 structural port (2026-06-08): the legacy two-panel splitter
   (.aw-clinical-with-sidebar { grid 3fr 2fr }) was REMOVED — it was the
   "four disconnected zones" regression. Replaced by the single-canvas shell
   (.awx-axis / .awx-surface / .awx-gutter / .awx-canvas) at the END of this
   file. The textarea + recorder now live inside .awx-canvas > .awx-capture,
   and #awSectionSidebar is re-hosted as the .awx-note-host note surface. */

.aw-section-sidebar {
    background: var(--term-bg-surface);
    border: 1px solid var(--term-border-subtle);
    padding: var(--term-space-md) var(--term-space-lg) var(--term-space-md);
    overflow-y: auto;
    align-self: stretch;
}

/* Counter bar: "4/13 sections  3.2ms" */
.aw-scaffold-counter {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    color: var(--term-fg-muted);
    padding: 0 2px var(--term-space-sm);
    border-bottom: 1px solid var(--term-border-subtle);
    margin-bottom: var(--term-space-sm);
    display: flex;
    align-items: baseline;
    gap: 3px;
}

.aw-scaffold-count {
    color: var(--term-accent);
    font-weight: 600;
}

.aw-scaffold-timing {
    margin-left: auto;
    opacity: 0.5;
    font-size: var(--term-text-xs);
}

/* Section stack */
.aw-scaffold-sections {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* Individual section card */
.aw-scaffold-section {
    padding: 6px 8px 5px;
    border-left: 3px solid transparent;
    transition: border-color var(--term-duration-normal) var(--term-easing),
                background var(--term-duration-normal) var(--term-easing);
}

/* State: empty — dim, just the header */
.aw-scaffold-section--empty {
    opacity: 0.35;
    border-left-color: transparent;
}

/* State: detected — keyword found but no extractable text block */
.aw-scaffold-section--detected {
    opacity: 0.7;
    border-left-color: var(--term-accent-dim);
    background: rgba(255, 255, 255, 0.015);
}

/* State: filled — section header found + text extracted */
.aw-scaffold-section--filled {
    opacity: 1;
    border-left-color: var(--term-accent);
    background: rgba(255, 255, 255, 0.025);
}

/* Auxiliary sections (labs, imaging) — not standalone H&P sections, shown subtly */
.aw-scaffold-section--aux .aw-scaffold-title {
    font-style: italic;
}

/* Section header row: ABBREV  Title  ● */
.aw-scaffold-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    line-height: 1.35;
}

.aw-scaffold-abbrev {
    font-family: var(--term-font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--term-gold);
    min-width: 38px;
    flex-shrink: 0;
}

.aw-scaffold-section--filled .aw-scaffold-abbrev {
    color: var(--term-accent);
}

.aw-scaffold-title {
    font-family: var(--term-font-body);
    font-size: 0.8125rem;
    color: var(--term-fg-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.aw-scaffold-indicator {
    font-size: 0.625rem;
    flex-shrink: 0;
}

.aw-scaffold-ind--empty  { color: var(--term-fg-muted); opacity: 0.4; }
.aw-scaffold-ind--detected { color: var(--term-accent-dim); }
.aw-scaffold-ind--filled { color: var(--term-accent); text-shadow: var(--term-text-glow-accent); }

/* Section content — editable, reads like the actual note */
.aw-scaffold-content {
    font-family: var(--term-font-body);
    font-size: 0.8125rem;
    line-height: 1.65;
    color: var(--term-fg-secondary);
    margin: 4px 0 2px 0;
    padding: var(--term-space-xs) var(--term-space-sm);
    white-space: pre-wrap;
    word-break: break-word;
    outline: none;
    border: 1px solid transparent;
    border-radius: 2px;
    transition: border-color 0.15s, background 0.15s;
    cursor: text;
    min-height: 1.5em;
}

.aw-scaffold-content:hover {
    border-color: var(--term-border-subtle);
    background: rgba(255, 255, 255, 0.015);
}

.aw-scaffold-content:focus {
    border-color: var(--term-accent-dim);
    background: rgba(255, 255, 255, 0.025);
}

/* Edited/refined sections get a subtle left accent */
.aw-scaffold-section--edited .aw-scaffold-content {
    border-left: 2px solid var(--term-gold);
}

/* Refine + Reset action buttons */
.aw-scaffold-actions {
    display: flex;
    gap: var(--term-space-xs);
    justify-content: flex-end;
    margin-bottom: 2px;
}

.aw-scaffold-refine-btn,
.aw-scaffold-reset-btn {
    font-family: var(--term-font-mono);
    font-size: 0.625rem;
    letter-spacing: 0.06em;
    text-transform: lowercase;
    background: none;
    border: 1px solid var(--term-border-subtle);
    color: var(--term-fg-muted);
    padding: 1px 8px;
    cursor: pointer;
    border-radius: 2px;
    transition: color 0.15s, border-color 0.15s;
}

.aw-scaffold-refine-btn:hover {
    color: var(--term-accent);
    border-color: var(--term-accent-dim);
}

.aw-scaffold-reset-btn:hover {
    color: var(--term-gold);
    border-color: var(--term-gold);
}

.aw-scaffold-refine-btn--active {
    color: var(--term-accent);
    border-color: var(--term-accent-dim);
    cursor: wait;
    opacity: 0.7;
}

/* Legacy class kept for chips (structured data overlays) */
.aw-scaffold-preview {
    font-family: var(--term-font-mono);
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--term-fg-secondary);
    margin: 4px 0 2px 0;
    padding-left: var(--term-space-md);
    border-left: 1px solid var(--term-border-subtle);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Structured data chips (vitals, labs, meds from backend parse) */
.aw-scaffold-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 4px 0 2px 0;
    padding-left: var(--term-space-md);
}

.aw-scaffold-chip {
    font-family: var(--term-font-mono);
    font-size: 0.75rem;
    padding: 2px 8px;
    border: 1px solid var(--term-border-subtle);
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
}

/* DR semantic chip colors: vital=teal (live data), lab=amber (reference),
   med=amber-hot (active intervention) */
.aw-scaffold-chip--vital {
    color: var(--dr-teal, var(--term-accent));
    border-color: var(--dr-teal-dim, var(--term-accent-dim));
}

.aw-scaffold-chip--lab {
    color: var(--dr-amber, var(--term-gold));
    border-color: var(--dr-amber-dim, var(--term-border-subtle));
}

.aw-scaffold-chip--med {
    color: var(--dr-amber-hot, var(--term-gold));
    border-color: var(--dr-amber-hot-dim, var(--term-border-subtle));
}

.aw-scaffold-chip--more {
    color: var(--term-fg-muted);
    border-color: var(--term-border-subtle);
    font-style: italic;
}

/* Section groups — visual subsection container for related sections
   (e.g., Background: PMH, Meds, Allergies, SHx, FHx) */
.aw-scaffold-group {
    border: 1px solid var(--term-border-subtle);
    border-radius: 2px;
    margin: 2px 0;
    transition: border-color var(--term-duration-normal) var(--term-easing);
}

.aw-scaffold-group--detected {
    border-color: var(--term-accent-dim);
}

.aw-scaffold-group--filled {
    border-color: var(--term-accent);
}

.aw-scaffold-group-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 3px 6px 2px;
    border-bottom: 1px solid var(--term-border-subtle);
}

.aw-scaffold-group-text {
    font-family: var(--term-font-display);
    font-size: var(--term-text-sm);
    font-weight: 300;
    letter-spacing: var(--term-tracking-widest);
    text-transform: uppercase;
    color: var(--term-gold);
    opacity: 0.55;
}

.aw-scaffold-group--filled .aw-scaffold-group-text {
    opacity: 0.8;
}

.aw-scaffold-group-count {
    font-family: var(--term-font-mono);
    font-size: 0.6875rem;
    color: var(--term-fg-muted);
    opacity: 0.5;
}

.aw-scaffold-group-members {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Grouped sections: tighter padding, individual left border within group container */
.aw-scaffold-section--grouped {
    padding: 4px 8px 3px;
    border-left: 3px solid transparent;
}

.aw-scaffold-section--grouped.aw-scaffold-section--filled {
    border-left-color: var(--term-accent);
}

.aw-scaffold-section--grouped.aw-scaffold-section--detected {
    border-left-color: var(--term-accent-dim);
}

/* Grouped section content inherits base preview styles */
.aw-scaffold-section--grouped .aw-scaffold-preview {
    margin-left: 0;
}

.aw-scaffold-section--grouped .aw-scaffold-chips {
    margin-left: 0;
    padding-left: var(--term-space-md);
}

/* Primary section (A&P) — elevated, visually prominent, more preview space.
   WHY: The assessment & plan is the clinical decision point of the H&P.
   It should immediately stand out in the scaffold — the doctor's eye
   should land here to see the emerging clinical picture. */
.aw-scaffold-section--primary {
    margin-top: var(--term-space-xs);
    padding: 6px 6px 5px;
    border: 1px solid var(--term-border-subtle);
    border-left: 3px solid transparent;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.01);
}

.aw-scaffold-section--primary.aw-scaffold-section--empty {
    opacity: 0.4;
}

.aw-scaffold-section--primary.aw-scaffold-section--detected {
    border-left-color: var(--term-gold);
    background: rgba(255, 255, 255, 0.02);
}

.aw-scaffold-section--primary.aw-scaffold-section--filled {
    border-left-color: var(--term-gold);
    border-color: var(--term-gold);
    background: rgba(255, 255, 255, 0.03);
}

.aw-scaffold-section--primary .aw-scaffold-abbrev {
    color: var(--term-gold);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.aw-scaffold-section--primary.aw-scaffold-section--filled .aw-scaffold-abbrev {
    text-shadow: 0 0 8px rgba(218, 165, 32, 0.4);
}

.aw-scaffold-section--primary .aw-scaffold-title {
    font-weight: 500;
    font-size: 0.875rem;
}

/* A&P content gets full display — this is the most important section */
.aw-scaffold-section--primary .aw-scaffold-preview {
    font-size: 0.8125rem;
    color: var(--term-fg-primary);
    margin-left: 0;
}


/* ==========================================================================
   S14  STATUS SUMMARY BAR (list panel)
   ========================================================================== */

.aw-status-summary {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    letter-spacing: var(--term-tracking-wide);
    color: var(--term-fg-muted);
    padding: var(--term-space-xs) var(--term-space-lg);
    border-bottom: 1px solid var(--term-border-subtle);
    display: flex;
    gap: var(--term-space-lg);
    flex-wrap: wrap;
}

.aw-status-summary:empty {
    display: none;
}

.aw-status-summary .aw-summary-count--pending { color: var(--term-fg-muted); }
.aw-status-summary .aw-summary-count--data_entry { color: var(--term-accent); }
.aw-status-summary .aw-summary-count--hp_generated { color: var(--term-gold); }
.aw-status-summary .aw-summary-count--saved { color: var(--term-status-ready); }

/* Separator pipe rendered by JS between status count spans */
.aw-status-summary-sep { opacity: 0.3; }


/* ==========================================================================
   S15  SEARCH INPUT (list panel)
   ========================================================================== */

.aw-list-search {
    flex: 1;
    min-width: 0;
}

.aw-input--search {
    background: var(--term-bg-input);
    border: none;
    border-bottom: 1px solid var(--term-border-subtle);
    padding: var(--term-space-xs) var(--term-space-md);
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    color: var(--term-fg-primary);
    width: 100%;
    outline: none;
    box-sizing: border-box;
}

.aw-input--search:focus {
    border-bottom-color: var(--term-accent);
}

.aw-input--search::placeholder {
    color: var(--term-fg-muted);
    opacity: 0.5;
}


/* ==========================================================================
   S16  SOURCE DRAWER (reference clinical data during H&P review)
   ========================================================================== */

.aw-source-drawer {
    background: var(--term-bg-void);
    border-bottom: 1px solid var(--term-border-subtle);
    max-height: 200px;
    overflow-y: auto;
}

.aw-source-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--term-space-xs) var(--term-space-lg);
    border-bottom: 1px solid var(--term-border-subtle);
}

.aw-source-drawer-title {
    font-family: var(--term-font-display);
    font-size: var(--term-text-xs);
    font-weight: 300;
    letter-spacing: var(--term-tracking-wider);
    text-transform: uppercase;
    color: var(--term-fg-muted);
}

.aw-source-drawer-content {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    line-height: 1.6;
    color: var(--term-fg-secondary);
    padding: var(--term-space-md) var(--term-space-lg);
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.aw-btn--icon {
    background: transparent;
    border: none;
    color: var(--term-fg-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    min-height: auto;
}

.aw-btn--icon:hover {
    color: var(--term-fg-primary);
}


/* ==========================================================================
   S17  DANGER BUTTON VARIANT
   ========================================================================== */

.aw-btn--danger {
    color: var(--term-status-error);
    border-color: rgba(239, 68, 68, 0.25);
}

.aw-btn--danger:hover {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.04);
    box-shadow: var(--term-glow-red);
}


/* ==========================================================================
   S18  CENSUS LINK (post-save)
   ========================================================================== */

.aw-census-link a {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    color: var(--term-accent);
    text-decoration: none;
    letter-spacing: var(--term-tracking-wide);
}

.aw-census-link a:hover {
    text-shadow: var(--term-text-glow-accent);
}


/* ==========================================================================
   S19  LINT CHIPS (verification badges in output footer)
   ========================================================================== */

.aw-lint-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--term-space-xs);
    flex: 1;
    align-items: center;
}


/* ==========================================================================
   S20  VOICE RECORDER PANEL
   ========================================================================== */

.aw-audio-meter {
    width: 80px;
    height: 6px;
    background: var(--term-bg-input);
    border: 1px solid var(--term-border-subtle);
    overflow: hidden;
}

.aw-audio-meter-bar {
    height: 100%;
    width: 0%;
    background: var(--term-accent);
    transition: width 100ms ease-out;
}

.aw-transcript-panel {
    padding: var(--term-space-sm) var(--term-space-md);
    background: var(--term-bg-input);
    border-top: 1px solid var(--term-border-subtle);
    max-height: 80px;
    overflow-y: auto;
}

.aw-partial-transcript {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    color: var(--term-fg-muted);
    font-style: italic;
}

.aw-transcript {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    color: var(--term-fg-secondary);
    line-height: 1.5;
}


/* ==========================================================================
   S21  LOADING INDICATOR (list panel)
   ========================================================================== */

.aw-loading-indicator {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    color: var(--term-fg-muted);
    text-align: center;
    padding: var(--term-space-2xl);
    letter-spacing: var(--term-tracking-wide);
}


/* ==========================================================================
   S22  HELP BUTTON + GUIDE MODAL CONTENT
   ========================================================================== */

.aw-help-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--term-accent-dim);
    background: transparent;
    color: var(--term-accent);
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--term-duration-normal) var(--term-easing);
    flex-shrink: 0;
}

.aw-help-btn:hover {
    border-color: var(--term-accent);
    box-shadow: var(--term-glow-accent);
    text-shadow: var(--term-text-glow-accent);
}

.aw-guide-section p {
    font-family: var(--term-font-body);
    font-size: var(--term-text-sm);
    color: var(--term-fg-secondary);
    line-height: 1.6;
    margin: 0 0 var(--term-space-xs);
}

.aw-guide-section p:last-child {
    margin-bottom: 0;
}

.aw-guide-heading {
    font-family: var(--term-font-display);
    font-size: var(--term-text-sm);
    font-weight: 300;
    letter-spacing: var(--term-tracking-wider);
    text-transform: uppercase;
    color: var(--term-gold);
    margin: 0 0 var(--term-space-sm);
    text-shadow: var(--term-text-glow-gold);
}

.aw-guide-kbd {
    font-family: var(--term-font-mono);
    font-size: 0.7rem;
    color: var(--term-accent);
    background: var(--term-bg-input);
    border: 1px solid var(--term-border-subtle);
    padding: 1px 5px;
    white-space: nowrap;
}

.aw-guide-shortcut-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--term-space-xs) var(--term-space-xl);
}

@media (max-width: 500px) {
    .aw-guide-shortcut-grid {
        grid-template-columns: 1fr;
    }
}

.aw-guide-shortcut-row {
    display: flex;
    align-items: center;
    gap: var(--term-space-sm);
    font-family: var(--term-font-body);
    font-size: var(--term-text-sm);
    color: var(--term-fg-secondary);
}


/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .aw-admission-card {
        animation: none;
    }

    .aw-note-output.streaming::after {
        animation: none;
        opacity: 1;
    }

    .aw-admission-card:hover,
    .aw-new-btn:hover,
    .aw-generate-btn:hover {
        transform: none;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
    }
}


/* ==========================================================================
   S20  SHIFT HEADER + HISTORY
   ========================================================================== */

.aw-shift-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--term-space-sm) var(--term-space-md);
    background: var(--term-bg-elevated);
    border-bottom: 1px solid var(--term-border-subtle);
    min-height: 38px;
}

.aw-shift-header-content {
    display: flex;
    align-items: center;
    gap: var(--term-space-sm);
    flex: 1;
    min-width: 0;
}

.aw-shift-name {
    font-family: var(--term-font-display);
    font-size: var(--term-text-sm);
    font-weight: 500;
    color: var(--term-gold);
    cursor: pointer;
    padding: 2px var(--term-space-xs);
    border-radius: 3px;
    border: 1px solid transparent;
    transition: border-color var(--term-duration-fast);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.aw-shift-name:hover,
.aw-shift-name:focus-visible {
    border-color: var(--term-gold);
    outline: none;
}

.aw-shift-rename-input {
    font-family: var(--term-font-display);
    font-size: var(--term-text-sm);
    font-weight: 500;
    color: var(--term-gold);
    background: var(--term-bg-void);
    border: 1px solid var(--term-gold);
    border-radius: 3px;
    padding: 2px var(--term-space-xs);
    width: 140px;
    outline: none;
}

.aw-shift-date {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    color: var(--term-fg-muted);
    letter-spacing: 0.5px;
}

.aw-shift-count {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    color: var(--term-fg-secondary);
}

.aw-shift-header-actions {
    display: flex;
    gap: var(--term-space-xs);
    flex-shrink: 0;
}

.aw-shift-btn {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    padding: 2px var(--term-space-sm);
    background: transparent;
    color: var(--term-fg-secondary);
    border: 1px solid var(--term-border-subtle);
    border-radius: 3px;
    cursor: pointer;
    transition: all var(--term-duration-fast);
    white-space: nowrap;
}

.aw-shift-btn:hover {
    color: var(--term-gold);
    border-color: var(--term-gold);
}

.aw-shift-btn--subtle {
    border-color: transparent;
}

.aw-shift-btn--subtle:hover {
    border-color: var(--term-border-subtle);
}

/* Shift History Panel */

.aw-shift-history {
    background: var(--term-bg-surface);
    border-bottom: 1px solid var(--term-border-subtle);
    max-height: 240px;
    overflow-y: auto;
    padding: var(--term-space-xs) 0;
}

.aw-shift-history-loading,
.aw-shift-history-empty {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    color: var(--term-fg-muted);
    padding: var(--term-space-md) var(--term-space-md);
    text-align: center;
}

.aw-shift-history-row {
    display: flex;
    align-items: center;
    gap: var(--term-space-sm);
    padding: var(--term-space-xs) var(--term-space-md);
    cursor: pointer;
    transition: background var(--term-duration-fast);
}

.aw-shift-history-row:hover {
    background: var(--term-bg-elevated);
}

.aw-shift-history-row--active {
    border-left: 2px solid var(--term-gold);
    background: var(--term-gold-ghost);
}

.aw-shift-history-name {
    font-family: var(--term-font-display);
    font-size: var(--term-text-sm);
    font-weight: 400;
    color: var(--term-fg-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aw-shift-history-date {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    color: var(--term-fg-muted);
    flex-shrink: 0;
}

.aw-shift-history-count {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-xs);
    color: var(--term-fg-secondary);
    min-width: 16px;
    text-align: right;
    flex-shrink: 0;
}

/* Census Linked Badge (on admission cards) */

.aw-card-census-badge {
    font-family: var(--term-font-mono);
    font-size: 9px; /* sub-scale: below --term-text-xs */
    letter-spacing: 0.5px;
    padding: 1px 5px;
    background: rgba(34, 197, 94, 0.12);
    color: var(--term-status-ready);
    white-space: nowrap;
}

/* Send to Census Button (output footer) */

.aw-send-census-btn {
    font-family: var(--term-font-display);
    font-size: var(--term-text-sm);
    font-weight: 500;
    padding: var(--term-space-sm) var(--term-space-lg);
    background: var(--term-gold);
    color: var(--term-bg-void);
    border: 1px solid var(--term-gold);
    cursor: pointer;
    transition: all var(--term-duration-normal);
    letter-spacing: var(--term-tracking-wider);
    text-transform: uppercase;
}

.aw-send-census-btn:hover {
    filter: brightness(1.12);
    box-shadow: var(--term-glow-gold);
}

.aw-send-census-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

/* Empty state workflow steps */
.aw-empty-steps {
    list-style: none;
    padding: 0;
    margin: 12px 0 20px;
    text-align: left;
    display: inline-block;
    counter-reset: step;
}
.aw-empty-steps li {
    color: var(--term-text-secondary, #a0a0a0);
    font-size: 0.8rem;
    font-family: var(--term-font, monospace);
    padding: 3px 0 3px 22px;
    position: relative;
}
.aw-empty-steps li::before {
    counter-increment: step;
    content: counter(step) ".";
    position: absolute;
    left: 0;
    color: var(--term-accent, #00ffd0);
    font-weight: 600;
}

/* Start Here strip — 3-step inline guide above the textarea */
.aw-start-here {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: rgba(0,255,208,.04);
    border: 1px solid rgba(0,255,208,.12);
    border-radius: 4px;
    font-family: var(--term-font, monospace);
    font-size: 0.775rem;
    color: var(--term-text-secondary, #a0a0a0);
}
.aw-start-here__step { display: flex; align-items: center; gap: 5px; }
.aw-start-here__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0,255,208,.15);
    color: var(--term-accent, #00ffd0);
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}
.aw-start-here__arrow { color: rgba(0,255,208,.3); font-size: 0.85rem; }
@media (prefers-reduced-motion: reduce) { .aw-start-here { transition: none; } }

/* Sidebar blank-state hint */
.aw-scaffold-hint {
    font-size: 0.75rem;
    color: var(--term-text-secondary, #a0a0a0);
    font-style: italic;
}

/* Inline name prompt — shown when Send to Census is clicked and name is blank */
.aw-name-prompt {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.aw-name-prompt__input {
    flex: 1;
    background: var(--term-bg-input, #0d1117);
    border: 1px solid var(--term-accent, #00ffd0);
    border-radius: 4px;
    color: var(--term-text-primary, #e8e8e8);
    font-family: var(--term-font, monospace);
    font-size: 0.875rem;
    padding: 6px 10px;
    outline: none;
}
.aw-name-prompt__input:focus {
    box-shadow: 0 0 0 2px rgba(0,255,208,.25);
}
.aw-name-prompt__confirm {
    white-space: nowrap;
}
.aw-name-prompt__cancel {
    padding: 6px 8px;
    opacity: 0.6;
}
.aw-name-prompt__cancel:hover { opacity: 1; }


/* ==========================================================================
   S18  SCAFFOLD COMPILE MODE
   ==========================================================================
   WHY: When the doctor clicks "Compile Note", the scaffold sidebar switches
   from individual section cards to a full H&P document view. The compiled
   note streams in progressively and becomes editable once complete.
   ========================================================================== */

.aw-scaffold-compiled {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.aw-scaffold-compiled-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--term-space-sm) var(--term-space-md);
    border-bottom: 1px solid var(--term-border-subtle);
    flex-shrink: 0;
}

.aw-scaffold-compiled-label {
    font-family: var(--term-font-mono);
    font-size: var(--term-text-sm);
    font-weight: 600;
    letter-spacing: var(--term-tracking-wide);
    color: var(--term-accent);
    text-transform: uppercase;
}

.aw-scaffold-back-btn {
    font-family: var(--term-font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    background: none;
    border: 1px solid var(--term-border-subtle);
    color: var(--term-fg-muted);
    padding: 2px 10px;
    cursor: pointer;
    border-radius: 2px;
    transition: color var(--term-duration-fast),
                border-color var(--term-duration-fast);
}

.aw-scaffold-back-btn:hover {
    color: var(--term-fg-primary);
    border-color: var(--term-border-default);
}

.aw-scaffold-compiled-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--term-space-md) var(--term-space-lg);
    font-family: var(--term-font-body);
    font-size: var(--term-text-base);
    line-height: 1.75;
    color: var(--term-fg-primary);
    white-space: pre-wrap;
    word-break: break-word;
    outline: none;
    border: none;
    cursor: text;
}

/* Editable state after stream completes */
.aw-scaffold-compiled-content[contenteditable="true"] {
    border: 1px solid transparent;
    border-radius: 2px;
    transition: border-color 0.15s;
}

.aw-scaffold-compiled-content[contenteditable="true"]:focus {
    border-color: var(--term-accent-dim);
    background: rgba(255, 255, 255, 0.015);
}

/* Streaming animation — subtle pulse while compiling */
.aw-scaffold-compiling .aw-scaffold-compiled-content {
    cursor: wait;
}

.aw-scaffold-compiling .aw-scaffold-compiled-label::after {
    content: '...';
    animation: aw-compile-pulse 1.2s ease-in-out infinite;
}

@keyframes aw-compile-pulse {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 1; }
}

/* ── LLM Section Routing — Preview / Confirmed visual treatment ──
   WHY: Haiku-preview sections get a subtle dotted border to signal "tentative",
   Sonnet-authoritative sections get a solid border to signal "confirmed".
   This gives doctors visual confidence that the LLM has reviewed the content.
   TRADEOFF: Two extra CSS classes vs visual feedback on routing quality. */

.aw-scaffold-section--llm-preview .aw-scaffold-header {
    border-left: 2px dotted var(--dr-amber, #E69A4C);
    padding-left: 6px;
}

.aw-scaffold-section--llm-preview .aw-scaffold-indicator {
    color: var(--dr-amber, #E69A4C);
    opacity: 0.7;
}

.aw-scaffold-section--llm-confirmed .aw-scaffold-header {
    border-left: 2px solid var(--dr-teal, #4CC4B4);
    padding-left: 6px;
}

.aw-scaffold-section--llm-confirmed .aw-scaffold-indicator {
    color: var(--dr-teal, #4CC4B4);
}


/* ==========================================================================
   S20  WORKSPACE LAYERED DEPTH (Track B — 2026-05-14)
   ==========================================================================

   Extends the layered-depth language from cards (S3a) to the right-pane
   workspace surface. Card selection visually binds to the workspace via:
     - workspace pane top specular rim shifts teal when active
     - single defocused halo above the workspace pane (one halo at page scale)
     - surface tier ladder inside the workspace (bg-surface > bg-elevated > bg-input)
     - clinical textarea + action bar + recorder + sidebar all read as layered surfaces

   Selector strategy: scope overrides under `.aw-workspace ...` for slightly
   higher specificity than the baseline S6/S7/S9 rules; uses :has() for
   "card-selected" inference (no JS class additions needed). :has() floor:
   Chrome 105+, Safari 15.4+, Firefox 121+.

   Revert path: delete this entire block; baseline workspace styling above
   continues to function unchanged.
   -------------------------------------------------------------------------- */

/* Workspace pane itself: triple-layer shadow + active-state specular rim */
.aw-workspace {
    background: var(--term-bg-surface);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        inset 0 -1px 0 rgba(0, 0, 0, 0.45),
        inset 1px 0 0 rgba(255, 255, 255, 0.025);
    transition: box-shadow var(--term-duration-normal) var(--term-easing);
}

/* Active state: when a card is selected anywhere in the page,
   the workspace pane's top specular rim shifts teal — visual binding. */
body:has(.aw-admission-card.selected) .aw-workspace {
    box-shadow:
        inset 0 1px 0 rgba(0, 255, 208, 0.32),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5),
        inset 1px 0 0 rgba(0, 255, 208, 0.10);
}

/* Defocused halo above the workspace pane — page-scale focal-plane cue.
   One halo per surface; this is the workspace's; cards get their own (S3a). */
.aw-workspace::before {
    content: '';
    position: absolute;
    left: 8%;
    right: 8%;
    top: -36px;
    height: 72px;
    background: radial-gradient(ellipse at 50% 40%,
        rgba(0, 255, 208, 0.22), transparent 70%);
    filter: blur(40px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--term-duration-normal) var(--term-easing);
    z-index: 0;
}

body:has(.aw-admission-card.selected) .aw-workspace::before {
    opacity: 0.25;
}

/* Workspace-content active surface — sits on top of the void with depth */
.aw-workspace .aw-workspace-content {
    position: relative;
    z-index: 1;
}

/* Patient ID row: elevated tier (one step above the pane background) */
.aw-workspace .aw-patient-id-row {
    background: var(--term-bg-elevated);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        inset 0 -1px 0 rgba(0, 0, 0, 0.45);
}

/* Clinical textarea wrap: override the border-based focus with layered depth. */
.aw-workspace .aw-clinical-textarea-wrap {
    border: none;
    background: var(--term-bg-elevated);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5),
        0 1px 4px rgba(0, 0, 0, 0.4);
    transition: box-shadow var(--term-duration-normal) var(--term-easing);
}

.aw-workspace .aw-clinical-textarea-wrap:focus-within {
    border: none;
    box-shadow:
        inset 0 1px 0 rgba(0, 255, 208, 0.38),
        inset 0 -1px 0 rgba(0, 0, 0, 0.55),
        0 1px 4px rgba(0, 0, 0, 0.4),
        0 0 24px rgba(0, 255, 208, 0.12);
}

/* Clinical textarea itself — deepest tier (input well) */
.aw-workspace .aw-clinical-textarea {
    background: var(--term-bg-input);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35);
}

/* Section sidebar: elevated tier with the same triple-shadow as a card */
.aw-workspace .aw-section-sidebar {
    background: var(--term-bg-elevated);
    border: none;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        inset 0 -1px 0 rgba(0, 0, 0, 0.45),
        0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Scaffold section pills — shape differentiation, not opacity-only.
   Empty = dashed outline | detected = solid dim | filled = solid + teal edge. */
.aw-workspace .aw-scaffold-section--empty {
    border-left: 3px dashed rgba(138, 130, 120, 0.4);
}

.aw-workspace .aw-scaffold-section--detected {
    border-left: 3px solid var(--term-accent-dim);
}

.aw-workspace .aw-scaffold-section--filled {
    border-left: 3px solid var(--term-accent);
    box-shadow: inset 1px 0 8px rgba(0, 255, 208, 0.10);
}

/* Projection states (forward-compatible with the projection-builder pipeline,
   AdmissionSectionProjection.status ∈ {empty, suggested, edited, locked, conflict}).
   `--empty` already styled above; `--edited` already styled in scaffold base.
   Remaining states render once the sidebar renderer surfaces projection state. */
.aw-workspace .aw-scaffold-section--suggested {
    border-left: 3px solid var(--term-accent-dim);
}

.aw-workspace .aw-scaffold-section--locked {
    border-left: 3px solid var(--term-gold);
    box-shadow: inset 1px 0 8px rgba(212, 168, 87, 0.14);
}

/* Locked section gets a small lock glyph on the abbrev — visual redundancy
   so colorblind users see the locked state without relying on hue alone. */
.aw-workspace .aw-scaffold-section--locked .aw-scaffold-abbrev::after {
    content: ' \1f512';
    font-size: 0.6875rem;
    opacity: 0.7;
}

.aw-workspace .aw-scaffold-section--conflict {
    border-left: 3px solid var(--term-status-error);
    box-shadow: inset 1px 0 8px rgba(239, 68, 68, 0.12);
}

.aw-workspace .aw-scaffold-section--conflict .aw-scaffold-abbrev::after {
    content: ' !';
    color: var(--term-status-error);
    font-weight: 700;
}

/* Voice recorder panel: same layered surface treatment */
.aw-workspace .aw-recorder {
    background: var(--term-bg-elevated);
    border: none;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        inset 0 -1px 0 rgba(0, 0, 0, 0.45),
        0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Voice record button — cap pulse iteration at 4 (matches lifecycle dot rule) */
.aw-workspace .aw-rec-dot-pulse {
    animation-iteration-count: 4 !important;
}

/* Action bar: replace top-border with triple-shadow framing */
.aw-workspace .aw-action-bar {
    background: var(--term-bg-elevated);
    border-top: none;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        inset 0 -1px 0 rgba(0, 0, 0, 0.45),
        0 -1px 4px rgba(0, 0, 0, 0.3);
}

/* Primary Compile/Send-to-Census button: gradient + layered-depth specular rim */
.aw-workspace .aw-generate-btn {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        inset 0 -1px 0 rgba(0, 0, 0, 0.32),
        0 4px 12px rgba(0, 0, 0, 0.32);
}

.aw-workspace .aw-generate-btn:hover {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.40),
        inset 0 -1px 0 rgba(0, 0, 0, 0.36),
        0 8px 20px rgba(0, 0, 0, 0.36),
        0 0 32px rgba(0, 255, 208, 0.30);
}

/* Secondary ghost buttons: ditch the border, use triple-shadow */
.aw-workspace .aw-action-bar .aw-btn {
    border: none;
    background: var(--term-bg-surface);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        inset 0 -1px 0 rgba(0, 0, 0, 0.45),
        0 1px 4px rgba(0, 0, 0, 0.3);
}

.aw-workspace .aw-action-bar .aw-btn:hover {
    background: var(--term-bg-elevated);
    color: var(--term-fg-primary);
    box-shadow:
        inset 0 1px 0 rgba(0, 255, 208, 0.32),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5),
        0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Empty state: faint focal halo signals "the focal plane is here, ready" */
.aw-workspace .aw-empty-state {
    position: relative;
}

.aw-workspace .aw-empty-state::before {
    content: '';
    position: absolute;
    inset: 25% 15%;
    background: radial-gradient(ellipse at 50% 50%,
        rgba(0, 255, 208, 0.08), transparent 70%);
    filter: blur(30px);
    opacity: 0.6;
    pointer-events: none;
    z-index: 0;
}

.aw-workspace .aw-empty-state > * {
    position: relative;
    z-index: 1;
}

/* Reduced motion: pin transitions to instant, suppress halo fades */
@media (prefers-reduced-motion: reduce) {
    .aw-workspace,
    .aw-workspace::before,
    .aw-workspace .aw-clinical-textarea-wrap {
        transition: none;
    }
}

/* ============================================================================
   v2.3 SECTION-LEVEL PROVENANCE (provenance-review.js)
   A COMPACT bar above the single signed note (markers / trust profile / peek /
   soft verify gate). States: grounded / doctor / unsourced / uncaptured / verified.
   The old stacked review-doc rules (.awx-prov-review .awx-review-*) were removed
   with the Option-1 audit fix — the JS no longer emits those classes.
   ============================================================================ */

/* section provenance marker */
.awx-mk {
    display: inline-flex; align-items: center; gap: 4px; vertical-align: baseline;
    font-family: var(--term-font-mono); font-size: 0.5625rem; letter-spacing: 0.04em; text-transform: lowercase;
    border: 1px solid var(--term-border-subtle); border-radius: 2px; padding: 0 6px; line-height: 1.7; cursor: pointer;
    background: transparent; transition: color 150ms, border-color 150ms, background 150ms;
}
.awx-mk-g { font-size: 0.6875rem; line-height: 1; }
.awx-mk--grounded { color: var(--term-fg-muted); opacity: 0.6; }
.awx-mk--grounded:hover, .awx-mk--grounded.open { color: var(--term-accent); border-color: var(--term-accent-dim); opacity: 1; }
.awx-mk--doctor { color: var(--term-gold); border-color: var(--term-gold-dim); opacity: 0.85; }
.awx-mk--doctor:hover, .awx-mk--doctor.open { background: var(--term-gold-ghost); opacity: 1; }
.awx-mk--unsourced { color: var(--term-status-error); border-color: rgba(239,68,68,0.5); background: rgba(239,68,68,0.08); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.awx-mk--unsourced:hover, .awx-mk--unsourced.open { background: rgba(239,68,68,0.16); box-shadow: var(--term-glow-red); }
.awx-mk--uncaptured { color: var(--term-fg-muted); border-style: dashed; border-color: var(--term-border-strong); opacity: 0.7; }
.awx-mk--uncaptured:hover, .awx-mk--uncaptured.open { color: var(--term-fg-secondary); opacity: 1; }
.awx-mk--verified { color: var(--term-status-ready); border-color: rgba(34,197,94,0.4); opacity: 0.9; }
.awx-mk--verified:hover, .awx-mk--verified.open { background: rgba(34,197,94,0.10); opacity: 1; }

/* trust banner */
.awx-trust { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 11px 14px; margin-bottom: 16px; background: var(--term-bg-elevated); border: 1px solid var(--term-border-default); border-left: 3px solid var(--term-accent); }
.awx-trust--uncaptured { display: block; border-left-color: var(--term-border-strong); }
.awx-trust-kicker { font-family: var(--term-font-mono); font-size: 0.625rem; letter-spacing: 0.10em; text-transform: uppercase; color: var(--term-fg-muted); }
.awx-trust-pill { display: inline-flex; align-items: center; gap: 5px; font-family: var(--term-font-mono); font-size: 0.6875rem; padding: 2px 9px; border: 1px solid var(--term-border-subtle); border-radius: 2px; color: var(--term-fg-secondary); }
.awx-trust-pill i { font-style: normal; }
.awx-trust-pill--grounded i { color: var(--term-accent); }
.awx-trust-pill--doctor i { color: var(--term-gold); }
.awx-trust-pill--unsourced { color: var(--term-status-error); border-color: rgba(239,68,68,0.4); }
.awx-trust-pill--unsourced i { color: var(--term-status-error); }
.awx-trust-pill--verified i { color: var(--term-status-ready); }
.awx-trust-note { margin-left: auto; font-family: var(--term-font-mono); font-size: 0.6875rem; }
.awx-trust-note--warn { color: var(--term-status-error); }
.awx-trust-note--ok { color: var(--term-status-ready); }
.awx-trust-state { display: flex; align-items: flex-start; gap: 9px; font-family: var(--term-font-mono); font-size: 0.6875rem; line-height: 1.55; color: var(--term-fg-secondary); }
.awx-trust-state-ic { color: var(--term-fg-muted); font-size: 0.95rem; line-height: 1.25; flex-shrink: 0; }
.awx-trust-state b { color: var(--term-fg-primary); font-weight: 600; }
.awx-trust-legend { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 13px; margin: 9px 0 0; padding: 9px 2px 0; border-top: 1px dashed var(--term-border-subtle); font-family: var(--term-font-mono); font-size: 0.5625rem; letter-spacing: 0.03em; color: var(--term-fg-muted); }
.awx-trust-legend span { display: inline-flex; align-items: center; gap: 5px; }
.awx-trust-legend i { font-style: normal; }
.awx-legend-g--grounded { color: var(--term-accent); }
.awx-legend-g--doctor { color: var(--term-gold); }
.awx-legend-g--unsourced { color: var(--term-status-error); }
.awx-legend-g--uncaptured { color: var(--term-fg-muted); }

/* source peek (body-level, position:fixed) */
.awx-source-peek { position: fixed; z-index: 9600; width: 392px; max-width: 92vw; background: var(--term-bg-elevated); border: 1px solid var(--term-border-default); box-shadow: var(--term-shadow-modal, 0 8px 32px rgba(0,0,0,0.5)); }
.awx-source-peek--unsourced { border-color: rgba(239,68,68,0.5); }
.awx-source-peek--uncaptured { border-color: var(--term-border-strong); }
.awx-source-peek-head { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-bottom: 1px solid var(--term-border-subtle); }
.awx-peek-tier { font-family: var(--term-font-mono); font-size: 0.625rem; letter-spacing: 0.05em; text-transform: uppercase; }
.awx-peek-tier--grounded { color: var(--term-accent); }
.awx-peek-tier--doctor { color: var(--term-gold); }
.awx-peek-tier--unsourced { color: var(--term-status-error); font-weight: 700; }
.awx-peek-tier--uncaptured { color: var(--term-fg-muted); }
.awx-peek-tier--verified { color: var(--term-status-ready); }
.awx-source-peek-from { font-family: var(--term-font-mono); font-size: 0.625rem; color: var(--term-fg-muted); margin-left: auto; }
.awx-source-peek-body { padding: 11px; max-height: 260px; overflow-y: auto; }
.awx-peek-frags { display: flex; flex-direction: column; gap: 8px; }
.awx-peek-frag { display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%; background: var(--term-bg-input); border: 1px solid var(--term-border-subtle); border-left: 2px solid var(--term-accent-dim); padding: 8px 10px; cursor: pointer; }
.awx-peek-frag:hover { border-left-color: var(--term-accent); background: var(--term-accent-ghost); }
.awx-peek-frag-src { font-family: var(--term-font-mono); font-size: 0.5625rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--term-accent); }
.awx-peek-frag-raw { font-family: var(--term-font-mono); font-size: 0.8125rem; line-height: 1.55; color: var(--term-fg-secondary); }
.awx-peek-frag-nav { font-family: var(--term-font-mono); font-size: 0.5625rem; color: var(--term-fg-muted); }
.awx-peek-frag:hover .awx-peek-frag-nav { color: var(--term-accent); }
.awx-peek-warn, .awx-peek-info { display: flex; gap: 10px; font-family: var(--term-font-body); font-size: 0.8125rem; line-height: 1.55; }
.awx-peek-warn { color: var(--term-fg-primary); }
.awx-peek-info { color: var(--term-fg-secondary); }
.awx-peek-warn-ic { color: var(--term-status-error); font-size: 1.1rem; line-height: 1.2; flex-shrink: 0; }
.awx-peek-info-ic { color: var(--term-fg-muted); font-size: 1.1rem; line-height: 1.2; flex-shrink: 0; }
.awx-peek-warn b { color: var(--term-status-error); }
.awx-peek-info b { color: var(--term-fg-primary); }
.awx-peek-cap { font-family: var(--term-font-mono); font-size: 0.5625rem; letter-spacing: 0.04em; color: var(--term-fg-muted); margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--term-border-subtle); }
.awx-source-peek-foot { padding: 7px 11px; border-top: 1px solid var(--term-border-subtle); font-family: var(--term-font-mono); font-size: 0.625rem; color: var(--term-fg-muted); }
.awx-source-peek-foot span { color: var(--term-accent); }
.awx-source-peek--unsourced .awx-source-peek-foot span { color: var(--term-status-error); }

/* soft verify gate (body-level overlay) */
.awx-verify-backdrop { position: fixed; inset: 0; z-index: 9800; background: rgba(8,7,6,0.55); display: flex; align-items: center; justify-content: center; }
.awx-verify { width: 470px; max-width: 94vw; max-height: 86vh; display: flex; flex-direction: column; background: var(--term-bg-elevated); border: 1px solid var(--term-border-default); border-left: 3px solid var(--term-status-error); box-shadow: var(--term-shadow-modal, 0 8px 32px rgba(0,0,0,0.5)); }
.awx-verify--clear { border-left-color: var(--term-status-ready); }
.awx-verify-head { padding: 13px 16px; border-bottom: 1px solid var(--term-border-subtle); }
.awx-verify-kicker { font-family: var(--term-font-mono); font-size: 0.625rem; letter-spacing: 0.10em; text-transform: uppercase; color: var(--term-status-error); }
.awx-verify--clear .awx-verify-kicker { color: var(--term-status-ready); }
.awx-verify-title { font-family: var(--term-font-display); font-size: 0.9375rem; color: var(--term-fg-primary); margin-top: 4px; }
.awx-verify-sub { font-family: var(--term-font-mono); font-size: 0.6875rem; color: var(--term-fg-muted); margin-top: 5px; line-height: 1.5; }
.awx-verify-list { padding: 11px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; }
.awx-verify-item { background: var(--term-bg-input); border: 1px solid var(--term-border-subtle); border-left: 2px solid var(--term-status-error); padding: 9px 11px; }
.awx-verify-item--done { border-left-color: var(--term-status-ready); opacity: 0.65; }
.awx-verify-item-h { display: flex; align-items: baseline; gap: 8px; }
.awx-verify-item-sec { font-family: var(--term-font-display); font-size: 0.8125rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--term-gold); }
.awx-verify-item-flag { font-family: var(--term-font-mono); font-size: 0.5625rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--term-status-error); margin-left: auto; }
.awx-verify-item--done .awx-verify-item-flag { color: var(--term-status-ready); }
.awx-verify-item-text { font-family: var(--term-font-body); font-size: 0.8125rem; line-height: 1.55; color: var(--term-fg-secondary); margin: 6px 0 9px; white-space: pre-wrap; }
.awx-verify-ack { font-family: var(--term-font-mono); font-size: 0.6875rem; letter-spacing: 0.05em; color: var(--term-status-ready); background: transparent; border: 1px solid rgba(34,197,94,0.4); padding: 4px 11px; cursor: pointer; }
.awx-verify-ack:hover { background: rgba(34,197,94,0.10); }
.awx-verify-item--done .awx-verify-ack { color: var(--term-fg-muted); border-color: var(--term-border-subtle); pointer-events: none; }
.awx-verify-foot { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--term-border-subtle); }
.awx-verify-anyway { margin-left: auto; font-family: var(--term-font-mono); font-size: 0.6875rem; color: var(--term-fg-muted); background: none; border: none; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.awx-verify-anyway:hover { color: var(--term-fg-secondary); }
.awx-verify-send { margin-left: auto; font-family: var(--term-font-display); font-size: 0.8125rem; font-weight: 600; padding: 8px 16px; background: var(--term-gold); color: var(--term-bg-void); border: 1px solid var(--term-gold); letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer; }
.awx-verify-send--clear { background: var(--term-status-ready); border-color: var(--term-status-ready); }
.awx-verify-cancel { font-family: var(--term-font-mono); font-size: 0.6875rem; color: var(--term-fg-muted); background: none; border: 1px solid var(--term-border-subtle); padding: 6px 12px; cursor: pointer; }
.awx-verify-cancel:hover { color: var(--term-fg-secondary); }
/* Send button signals "attention" when ▲ unverified sections remain */
.aw-send-census-btn--verify { box-shadow: inset 0 0 0 1px rgba(239,68,68,0.55), var(--term-glow-red); }

/* v2.3 audit fix (Option 1): COMPACT provenance bar above the single signed note.
   Replaces the stacked review-doc — the bar attests source capture of the inputs,
   never a second copy of the prose. Per-section detail is behind the disclosure. */
.awx-prov-bar { padding: 12px 18px; border-bottom: 1px solid var(--term-border-default); }
.awx-prov-bar .awx-trust { margin-bottom: 0; }
.awx-prov-bar--stale .awx-trust { border-left-color: var(--term-border-strong); }
.awx-prov-bar--stale .awx-trust-note--ok,
.awx-prov-bar--stale .awx-trust-note--warn { opacity: 0.55; }
.awx-prov-disclosure { font-family: var(--term-font-mono); font-size: 0.625rem; letter-spacing: 0.04em; color: var(--term-accent); background: none; border: 1px solid var(--term-accent-dim); border-radius: 2px; padding: 2px 9px; cursor: pointer; }
.awx-prov-disclosure:hover { background: var(--term-accent-ghost); }
.awx-prov-scope { flex-basis: 100%; font-family: var(--term-font-mono); font-size: 0.5625rem; letter-spacing: 0.03em; color: var(--term-fg-muted); margin-top: 7px; }
.awx-prov-sources { flex-basis: 100%; margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--term-border-subtle); display: flex; flex-direction: column; gap: 4px; }
.awx-prov-src { display: flex; align-items: center; gap: 10px; padding: 3px 5px; border-radius: 2px; transition: background 150ms; }
.awx-prov-src.lit { background: rgba(0,255,208,0.14); box-shadow: inset 2px 0 0 var(--term-accent); }
.awx-prov-src-t { font-family: var(--term-font-display); font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--term-fg-secondary); min-width: 152px; }

/* ============================================================================
   Admissions v2.3 — STRUCTURAL SHELL (single canvas) — ported 2026-06-08
   Replaces the legacy .aw-clinical-with-sidebar 3fr/2fr splitter. Shell layout
   only; paint comes from the already-shipped --term-* tokens. Source of truth:
   .handoffs/admissions-traceability/port/ (PORT-MAP-v2.3.md + v2.3-shell.css).
   ============================================================================ */

/* 1. HEIGHT CHAIN — fixes the dead-space void below the action bar. */
.aw-workspace          { min-height: 0; }
.aw-workspace-content  { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.aw-note-input-section { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* 2. COMPOSITION AXIS — pipeline status row (Target 3). */
.awx-axis { display: flex; flex-wrap: wrap; align-items: center; gap: var(--term-space-lg); padding: 10px var(--term-space-lg); border-bottom: 1px solid var(--term-border-subtle); flex: 0 0 auto; }
.awx-pipeline { display: flex; align-items: center; gap: 14px; }
.awx-stage { display: flex; align-items: center; gap: 7px; font-family: var(--term-font-mono); font-size: 0.625rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--term-fg-muted); }
.awx-stage-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--term-border-strong); flex: 0 0 auto; }
.awx-stage--active { color: var(--term-accent); }
.awx-stage--active .awx-stage-dot { background: var(--term-accent); box-shadow: 0 0 6px var(--term-accent); }
.awx-stage--done { color: var(--term-fg-secondary); }
.awx-stage--done .awx-stage-dot { background: var(--term-status-ready); }
.awx-mode-toggle { display: flex; gap: 4px; }
.awx-mode-btn { font-family: var(--term-font-mono); font-size: 0.625rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--term-fg-muted); background: none; border: 1px solid var(--term-border-subtle); border-radius: 2px; padding: 2px 9px; cursor: pointer; }
.awx-mode-btn--active { color: var(--term-accent); border-color: var(--term-accent-dim); }
.awx-mode-btn:disabled { opacity: 0.4; cursor: default; }
.awx-status-line { margin-left: auto; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.awx-status-line .aw-save-status { margin: 0; }

/* Optimistic-lock reconciliation is base Admissions UI, not manuscript-only. */
.aw-workspace-conflicts { flex: 1 1 100%; order: 3; margin: 8px 0 0; padding: 10px 12px; border: 1px solid var(--term-status-error); border-left-width: 3px; background: var(--term-bg-elevated); color: var(--term-fg-primary); }
.aw-workspace-conflicts h3 { margin: 0 0 4px; font: 600 0.75rem/1.3 var(--term-font-display); letter-spacing: 0.05em; text-transform: uppercase; }
.aw-workspace-conflicts p { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.aw-workspace-conflict { margin-top: 8px; padding: 8px; border: 1px solid var(--term-border-default); }
.aw-workspace-conflict h4 { margin: 0 0 4px; font-size: 0.8rem; }
.aw-workspace-conflict button, #awWorkspaceConflictRetry { margin: 6px 6px 0 0; padding: 4px 8px; color: var(--term-fg-primary); background: var(--term-bg-input); border: 1px solid var(--term-border-strong); border-radius: 2px; cursor: pointer; }
.aw-workspace-conflict button:focus-visible, #awWorkspaceConflictRetry:focus-visible { outline: 2px solid var(--term-accent); outline-offset: 2px; }
@media (max-width: 760px) { .aw-workspace-conflicts { max-width: 100%; } }

/* 3. SURFACE — gutter (left) | canvas (right), one plane (Target 1). */
.awx-surface { flex: 1; min-height: 0; display: flex; }

.awx-gutter { width: 188px; flex: 0 0 188px; border-right: 1px solid var(--term-border-subtle); display: flex; flex-direction: column; overflow-y: auto; }
.awx-gutter-head { flex: 0 0 auto; position: sticky; top: 0; background: var(--term-bg-base); padding: var(--term-space-md) var(--term-space-md) 8px; }
.awx-gutter-count { font-family: var(--term-font-mono); font-size: 0.6875rem; color: var(--term-fg-secondary); }
.awx-gutter-count b { color: var(--term-accent); }
.awx-prog { height: 3px; overflow: hidden; background: var(--term-border-subtle); border-radius: 2px; margin-top: 6px; }
.awx-prog-fill { height: 100%; width: 0%; background: var(--term-accent); transition: width var(--term-duration-normal, 0.3s) ease; }
.awx-gutter-list { flex: 1; padding: 6px; }
.awx-gutter-group { font-family: var(--term-font-mono); font-size: 0.5625rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--term-fg-muted); padding: 8px 8px 3px; }
.awx-toc-item { display: flex; align-items: center; gap: 9px; padding: 4px 8px; border-radius: 2px; cursor: pointer; color: var(--term-fg-secondary); }
.awx-toc-item:hover { background: var(--term-accent-ghost); }
.awx-toc-item--active { background: var(--term-accent-ghost); box-shadow: inset 2px 0 0 var(--term-accent); }
.awx-toc-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; background: var(--term-border-strong); }
.awx-toc-item--filled .awx-toc-dot { background: var(--term-accent); }
.awx-toc-item--detected .awx-toc-dot { background: var(--term-gold, var(--term-accent-dim)); }
.awx-toc-abbrev { width: 36px; flex: 0 0 36px; font-family: var(--term-font-mono); font-size: 0.625rem; color: var(--term-fg-muted); }
.awx-toc-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.75rem; }

/* canvas = capture (top, fixed) + note (below, fills + scrolls) */
.awx-canvas { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.awx-capture { flex: 0 0 auto; border-bottom: 1px solid var(--term-border-subtle); padding: var(--term-space-md) var(--term-space-lg); display: flex; flex-direction: column; gap: var(--term-space-md); }

/* capture textarea = the doctor's notepad (type / paste / dictate, unstructured). A bit
   more room to work, but still capped so it never crowds out the note below — big pastes
   scroll inside it rather than ballooning the canvas. */
.awx-capture .aw-clinical-textarea { display: block; width: 100%; box-sizing: border-box; min-height: 136px; max-height: 260px; resize: none; }
/* recorder now sits INSIDE the capture (fixes the unstyled "Dictate" pill) */
.awx-capture .aw-recorder { display: flex; align-items: center; gap: var(--term-space-md); }

/* 4. NOTE HOST — this IS #awSectionSidebar, re-parented into the canvas. */
#awSectionSidebar.awx-note-host { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: none; border: none; padding: 0; }
#awSectionSidebar.awx-note-host .aw-scaffold-counter { flex: 0 0 auto; padding: 8px var(--term-space-lg); border-bottom: 1px solid var(--term-border-subtle); }
.awx-note { flex: 1; min-height: 0; overflow-y: auto; padding: var(--term-space-md) var(--term-space-lg); }
/* compiled review path already scrolls via .aw-scaffold-compiled-content */
#awSectionSidebar.awx-note-host .aw-scaffold-compiled { flex: 1; min-height: 0; }

/* 5. ACTION BAR — lives in the axis row (de-zoo 2026-07-31): the note keeps
   the vertical space the old full-width bottom bar occupied. Compact styling
   scoped to the axis so the base .aw-action-bar rules don't drag the chrome in. */
.awx-axis .aw-action-bar {
    border: none;
    background: none;
    box-shadow: none;
    padding: 0;
    gap: var(--term-space-sm, 8px);
    flex-shrink: 1;
}
.awx-axis .aw-action-bar .aw-generate-btn {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 5px 18px;
    font-size: 0.6875rem;
}
.awx-axis .aw-action-bar .aw-btn,
.awx-axis .aw-action-bar .aw-send-census-btn {
    min-height: 30px;
    padding: 5px 14px;
    font-size: 0.6875rem;
}
.awx-action-hint { font-family: var(--term-font-mono); font-size: 0.6875rem; color: var(--term-fg-muted); }
.awx-action-hint:empty { display: none; }

/* ============================================================================
   Admissions v2.5 — SOURCE-CAPTURE REVIEW (provenance ON the note) — 2026-06-08
   Per-section compiled-review nodes with a tier-colored CHIP in each header and an
   inline source DRAWER under each body (replaces the v2.3 stacked bar + floating peek).
   Render branch is substrate-gated (provenance-review.js); the flat compiled view
   (the flags-OFF daily driver) is untouched — node layout is scoped to --review.
   Source of truth: HANDOFF-v2.5.md + somaNotesAdmissions v2.5 (canonical).html.
   ============================================================================ */

/* node-mode scroll/layout — scoped to --review so the flat path keeps its own scroll */
#awSectionSidebar.awx-note-host .aw-scaffold-compiled--review { display: flex; flex-direction: column; }
.aw-scaffold-compiled--review .aw-scaffold-compiled-header { flex: 0 0 auto; }
.aw-scaffold-compiled--review .awx-review { flex: 1; min-height: 0; overflow-y: auto; }

.awx-review { padding: var(--term-space-lg) var(--term-space-xl) var(--term-space-2xl); }
.awx-review-doc { max-width: 760px; }
.awx-review-sec { margin-bottom: var(--term-space-xl); scroll-margin-top: 8px; }
.awx-review-h {
    font-family: var(--term-font-display); font-size: var(--term-text-sm, 0.8125rem); font-weight: 500; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--term-gold); margin: 0 0 6px; display: flex; align-items: center; gap: 8px;
}
.awx-review-h::before { content: '>'; font-family: var(--term-font-mono); color: var(--term-accent); }
.awx-review-body {
    font-family: var(--term-font-body); font-size: var(--term-text-base, 0.9375rem); line-height: 1.85; color: var(--term-fg-primary);
    position: relative; padding: 4px 8px; border-radius: 2px; white-space: pre-wrap;
    transition: background var(--term-duration-fast, 150ms);
}
.awx-review-body:focus { outline: none; background: rgba(255,255,255,0.02); }
.awx-review-body--unsourced {
    text-decoration: underline; text-decoration-style: dashed; text-decoration-thickness: 1px;
    text-underline-offset: 5px; text-decoration-color: var(--term-status-error);
    background: rgba(239,68,68,0.05); box-shadow: inset 2px 0 0 var(--term-status-error);
}
.awx-review-body--uncaptured { color: var(--term-fg-secondary); box-shadow: inset 2px 0 0 var(--term-border-strong); }
.awx-review-body--verified { box-shadow: inset 2px 0 0 var(--term-status-ready); }
.awx-review-sec.lit .awx-review-body { background: rgba(0,255,208,0.14); box-shadow: inset 2px 0 0 var(--term-accent); }

/* chip extras the v2.3 base (.awx-mk) didn't have: label, caret, shared variant */
.awx-mk-l { line-height: 1; }
.awx-mk-car { font-size: 0.62rem; opacity: 0.7; transition: transform 160ms ease; margin-left: 1px; }
.awx-mk.open .awx-mk-car { transform: rotate(180deg); }
.awx-mk--shared { color: var(--term-accent); border-color: var(--term-accent-dim); opacity: 0.7; }
.awx-mk--shared:hover { color: var(--term-accent); background: var(--term-accent-ghost); opacity: 1; }
.awx-mk--shared .awx-mk-car { transition: transform 160ms ease; }
.awx-mk--shared:hover .awx-mk-car { transform: translateY(-2px); }

/* inline source drawer — under the section body, multi-open, pushes content down */
.awx-srcdrawer { max-height: 0; overflow: hidden; transition: max-height 240ms ease; }
.awx-review-sec.src-open .awx-srcdrawer { max-height: 520px; overflow-y: auto; }
.awx-srcdrawer-in { margin-top: 9px; border: 1px solid var(--term-border-default);
    border-left: 3px solid var(--term-border-strong); background: var(--term-bg-input); padding: 10px 12px; }
.awx-srcdrawer-in--grounded { border-left-color: var(--term-accent); }
.awx-srcdrawer-in--doctor   { border-left-color: var(--term-gold); }
.awx-srcdrawer-in--unsourced{ border-left-color: var(--term-status-error); }
.awx-srcdrawer-in--verified { border-left-color: var(--term-status-ready); }
.awx-srcdrawer-cap { font-family: var(--term-font-mono); font-size: 0.62rem; color: var(--term-fg-muted); margin-bottom: 4px; }
.awx-srcdrawer-cap b { color: var(--term-gold); }
.awx-srcfrag { border-left: 2px solid var(--term-accent-dim); padding: 1px 0 1px 10px; margin: 8px 0; }
.awx-srcfrag-meta { font-family: var(--term-font-mono); font-size: 0.56rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--term-fg-muted); margin-bottom: 3px; }
.awx-srcfrag-origin { color: var(--term-accent); }
.awx-srcdrawer-in--doctor .awx-srcfrag { border-left-color: var(--term-gold-dim); }
.awx-srcdrawer-in--doctor .awx-srcfrag-origin { color: var(--term-gold); }
.awx-srcfrag-text { font-family: var(--term-font-mono); font-size: 0.8rem; line-height: 1.62; color: var(--term-fg-secondary); white-space: pre-wrap; }
.awx-srcdrawer-foot { font-family: var(--term-font-mono); font-size: 0.56rem; color: var(--term-fg-muted); margin-top: 9px; padding-top: 7px; border-top: 1px dashed var(--term-border-subtle); }
.awx-conf--high { color: var(--term-fg-secondary); }
.awx-conf--low  { color: var(--term-gold); }
.awx-conf--na   { color: var(--term-fg-muted); }
.awx-srcwarn { display: flex; gap: 10px; font-family: var(--term-font-body); font-size: 0.8rem; line-height: 1.55; color: var(--term-fg-primary); }
.awx-srcwarn-ic { color: var(--term-status-error); font-size: 1.05rem; line-height: 1.2; flex: 0 0 auto; }
.awx-srcwarn b { color: var(--term-status-error); }
.awx-srcwarn--ok { color: var(--term-fg-secondary); }
.awx-srcwarn--ok b { color: var(--term-status-ready); }

/* trust banner: shared-source variant + the stale (note-edited) state */
.awx-trust--shared { border-left-color: var(--term-accent); }
.awx-trust-pill--shared i { color: var(--term-accent); }
.awx-trust--stale { border-left-color: var(--term-border-strong); }
.awx-trust--stale .awx-trust-note--ok, .awx-trust--stale .awx-trust-note--warn { opacity: 0.55; }
.awx-sharedsrc-toggle { font-family: var(--term-font-mono); font-size: 0.625rem; letter-spacing: 0.04em; color: var(--term-accent); background: none; border: 1px solid var(--term-accent-dim); border-radius: 2px; padding: 2px 9px; cursor: pointer; }
.awx-sharedsrc-toggle:hover { background: var(--term-accent-ghost); }

/* the ONE shared-source chart panel — shown once under the document, back-referenced by chips */
.awx-sharedsrc { max-height: 0; overflow: hidden; transition: max-height 280ms ease; margin: 0 auto var(--term-space-xl); max-width: 760px; }
.awx-sharedsrc.open { max-height: 560px; overflow-y: auto; }
.awx-sharedsrc-head { display: flex; align-items: baseline; gap: 10px; padding: 9px 12px 6px; }
.awx-sharedsrc-k { font-family: var(--term-font-mono); font-size: 0.6875rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--term-accent); }
.awx-sharedsrc-meta { font-family: var(--term-font-mono); font-size: 0.56rem; color: var(--term-fg-muted); margin-left: auto; }
.awx-sharedsrc-body { font-family: var(--term-font-mono); font-size: 0.8rem; line-height: 1.62; color: var(--term-fg-secondary); white-space: pre-wrap; padding: 0 12px; border-left: 3px solid var(--term-accent-dim); margin: 0 12px; }
.awx-sharedsrc-foot { font-family: var(--term-font-mono); font-size: 0.56rem; color: var(--term-fg-muted); padding: 8px 12px 10px; }
.awx-sharedsrc.flash { animation: awx-shared-flash 1.6s ease; }
@keyframes awx-shared-flash { 0%, 100% { background: transparent; } 25% { background: rgba(0,255,208,0.12); } }
