/* ==========================================================================
   Cyntelligence SOC Platform - Enterprise Design System
   Professional dark-first design for Security Operations Centers
   ==========================================================================
   Brand Refresh v2 (2026-04-23):
   - Primary brand color shifted from blue (#3B82F6) to "Cyntel Copper"
     (#D97706, warm amber) with full 50-900 ramp. Blue is preserved as
     --info-color and all legacy --primary-color references resolve to
     copper via the same token name (so existing templates keep working).
   - Surfaces formalized into a 4-tier z-axis: --surface-0 (deepest) →
     --surface-3 (floating). Legacy aliases (--bg-color, --card-bg,
     --input-bg, --panel-bg) route through surface tokens.
   - New display serif (Newsreader) for editorial hero moments — risk
     scores, empty states, large numerals. Inter/JetBrains Mono unchanged.
   - Tighter radii: sm 6→3px, md 8→5px, lg 12→8px. Reserves larger radii
     for explicitly "hero" surfaces (matches the operator/terminal feel).
   - New --sev-X-quiet-bg + --sev-X-border tokens for acknowledged /
     resolved severity states (outline-only, desaturated fills).
   - Analytic accents (--accent-purple/cyan/teal/pink/indigo) sit
     deliberately OUTSIDE the semantic severity palette; v1 color tokens
     --purple-color / --cyan-color / --orange-color alias onto them.
   See `New Design/colors_and_type_v2.css` for the source-of-truth spec.
   ========================================================================== */

/* Newsreader (v2 editorial hero serif) is loaded via the non-blocking
   <link> in app.py's <head> alongside Inter + JetBrains Mono, at the 400..700
   range these pages actually use. The render-blocking `@import` that used to
   live here (Newsreader 200..800, duplicating the link) was removed in Wave 4
   §E — a CSS @import serialises the font fetch behind the stylesheet parse. */

/* ==========================================================================
   TYPED TOKEN REGISTRATION (@property) — 2026 platform P1
   --------------------------------------------------------------------------
   Registering a custom property gives it a TYPE and an initial-value, which
   makes our worst token bug structurally impossible. Recap of that bug class
   (§10.194/195): a `var(--nope, <literal>)` fallback shipped a WCAG AA failure
   because the literal never theme-flips, and bare `var(--nope)` was worse —
   invalid at computed-value time, silently dropped, and invisible to a linter
   that only flags literals. Rule 10 polices it from the outside; this closes
   it from the inside: a registered token can never be invalid, it falls back
   to its declared initial-value.

   THREE RULES, each load-bearing — read before adding a token here:

   1. `inherits: true` ALWAYS. Custom properties inherit by default; declaring
      a design token with `inherits: false` would silently stop it reaching
      descendants and break every component that reads it from an ancestor.
   2. Only register tokens that ALWAYS have one meaning. Do NOT register the
      caller-supplied PARAM_TOKENS (--lrow-cols, --cyn-accent, --pv-score) —
      giving those a default makes a page that forgot to set one render
      plausibly-wrong instead of failing visibly, which is strictly worse.
      Do NOT register the JS-set ones either (--mx/--my/--mc).
   3. initial-value = the DARK (:root) value. Registration does not fight the
      theme: html.light-mode / body.light-mode still override normally. It only
      decides what happens when a token was never defined at all.

   Registration is also what makes an <angle> animatable — see .cyn-sweep.
   Supported in every current engine; older ones ignore the at-rule and get
   exactly today's behaviour.
   ========================================================================== */
@property --surface-0       { syntax: "<color>"; inherits: true; initial-value: #060607; }
@property --surface-1       { syntax: "<color>"; inherits: true; initial-value: #0A0A0B; }
@property --surface-2       { syntax: "<color>"; inherits: true; initial-value: #151517; }
@property --surface-3       { syntax: "<color>"; inherits: true; initial-value: #1D1D20; }
@property --panel-bg        { syntax: "<color>"; inherits: true; initial-value: #121214; }
@property --text-color      { syntax: "<color>"; inherits: true; initial-value: rgba(237, 234, 226, 0.92); }
@property --text-secondary  { syntax: "<color>"; inherits: true; initial-value: rgba(237, 234, 226, 0.58); }
@property --text-tertiary   { syntax: "<color>"; inherits: true; initial-value: rgba(237, 234, 226, 0.52); }
@property --text-disabled   { syntax: "<color>"; inherits: true; initial-value: rgba(237, 234, 226, 0.38); }
@property --text-on-accent  { syntax: "<color>"; inherits: true; initial-value: #1A1206; }
@property --border-hairline { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, 0.09); }
@property --border-default  { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, 0.12); }
@property --border-strong   { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, 0.22); }
@property --success-color   { syntax: "<color>"; inherits: true; initial-value: #10B981; }
@property --warning-color   { syntax: "<color>"; inherits: true; initial-value: #F59E0B; }
@property --danger-color    { syntax: "<color>"; inherits: true; initial-value: #EF4444; }
@property --info-color      { syntax: "<color>"; inherits: true; initial-value: #5FA8B5; }
/* Animatable typed angle — the reason a conic sweep can be transitioned at
   all. An unregistered <angle> is just a string and does not interpolate. */
@property --cyn-sweep       { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

/* ==========================================================================
   INTERPOLATE-SIZE — 2026 platform P1
   Lets height/block-size animate to `auto`, retiring the max-height guess.
   We carry 63 hardcoded max-height declarations and 8 files that measure
   scrollHeight in JS purely to fake this; both are guesses that clip when
   content outgrows them (measured in the audit preview: 90px shown of 556px
   real content — 466px silently cut off).
   Enabled at :root so it applies to the whole document, and gated so engines
   without it keep exactly today's behaviour. See .cyn-reveal below.
   ========================================================================== */
@supports (interpolate-size: allow-keywords) {
  :root { interpolate-size: allow-keywords; }
}

/* --- Core Theme Variables (base palette) --- */
:root, html.chrome-light #main-navbar {
  /* ============================================================
     BRAND PRIMITIVES — the palette of record, in the brand's own names.
     See BRAND.md §2. Everything below this block is a ROLE; this block is
     the PALETTE. The two layers were previously collapsed, so the product
     spoke only in roles (`--danger-color`) while the published brand kit
     and the marketing site spoke in names (Exposed). That gap is how the
     kit ended up declaring nine colours of which the app used one: with no
     shared vocabulary there was nothing to notice the drift against.

     ⚠ THESE ARE CONSTANTS. They are never re-declared per theme, which is
     deliberate and load-bearing: a primitive that theme-flips would drag
     the derived-token baking trap (see the note at --hover-bg) into the
     palette layer itself. Where a role needs a different value per theme
     — success does — the ROLE switches which primitive it points at. The
     primitive keeps its meaning.

     Use these names for new tokens. `--exposed` says what it means;
     `--danger-color` says only where it is used.
     ============================================================ */
  --void:        #0A0A0B;   /* page ground, dark            */
  --redact:      #151517;   /* raised panel, dark           */
  --paper:       #F2EEE4;   /* page ground light; link ink on dark */
  --ash:         #8A867E;   /* muted ink                    */
  --amber:       #D97706;   /* THE brand accent             */
  --amber-lit:   #F9A93C;   /* brighten — dark grounds only */
  --bronze:      #B45309;   /* the ramp step below amber    */
  --exposed:     #E5484D;   /* danger — identical in both themes */
  --contained:   #3DD68C;   /* success, dark                */
  /* The light counterpart of Contained: SAME hue (151deg) and saturation,
     lightness 53.9% -> 35%. Not a different green — #3DD68C measures 1.72:1
     on the light canvas, and substituting rather than stepping is exactly how
     Tailwind emerald got in. BRAND.md §2, "the derivation rule". */
  --contained-l: #1F935B;

  /* ============================================================
     SURFACES — formal 4-tier z-axis (v2)
     Tier 0 = world / deepest, Tier 3 = floating / input.
     Legacy aliases below keep v1 templates working unchanged.
     ============================================================ */
  /* v3 "Field Dossier" dark palette (2026-07-03): neutral near-black void
     replaces the v2 blue-tinted navy. Matches the marketing site exactly
     (void #0A0A0B, redact #151517). Ladder: 06 → 0A → 15 → 1D. */
  --surface-0:       #060607;
  --surface-1:       var(--void);
  --surface-2:       var(--redact);
  --surface-3:       #1D1D20;
  --surface-overlay: rgba(10, 10, 11, 0.78);

  --bg-color:        var(--surface-1);
  --bg-deeper:       var(--surface-0);
  --card-bg:         var(--surface-2);
  --panel-bg:        #121214;
  --input-bg:        var(--surface-3);
  --button-bg:       var(--surface-3);
  --button-bg-hover: #26262A;
  --button-text:     #ffffff;

  /* ── Text (v2 opacities: primary 0.90 / secondary 0.62 / disabled 0.42) */
  --text-color:      rgba(237, 234, 226, 0.92);   /* warm dossier paper-white */
  --text-primary:    var(--text-color);
  --text-secondary:  rgba(237, 234, 226, 0.58);
  /* De-emphasis floor for real CONTENT (captions, eyebrows, hints, micro
   * table headers). ~4.9:1 on --surface-1 — the lowest alpha that still
   * clears WCAG AA at small sizes. --text-disabled (.38, ~3.1:1) FAILS AA
   * and is reserved for genuinely disabled controls (UI_POLISH_AUDIT P0-10). */
  --text-tertiary:   rgba(237, 234, 226, 0.52);
  --text-disabled:   rgba(237, 234, 226, 0.38);
  --text-on-accent:  #1A1206;   /* dark ink for amber backgrounds */

  /* ── Borders & dividers (v2 formal tiers)
   * Spec §2.3 alphas: hairline 0.07 / default 0.12 / strong 0.22.
   * Hairline sits on card edges at rest; default appears on inputs and
   * active cards; strong is for emphasized edges. */
  --border-hairline: rgba(255, 255, 255, 0.09);
  --border-default:  rgba(255, 255, 255, 0.12);
  --border-strong:   rgba(255, 255, 255, 0.22);
  --input-border:    var(--border-default);

  /* ============================================================
     BRAND — "Cyntel Copper" (v2 primary)
     A warm amber-copper deliberately OUTSIDE the semantic
     severity palette. Used for: primary CTAs, selected nav/tab
     underline, focus rings, brand marks, empty-state art.
     Never for severity states, charts, or alerts.
     ============================================================ */
  --brand-50:   #FEF6E9;
  --brand-100:  #FCE9C9;
  --brand-200:  #FAD79E;
  --brand-300:  #FBC56A;
  --brand-400:  var(--amber-lit);   /* hover state */
  --brand-500:  var(--amber);       /* primary — matches the marketing site */
  --brand-600:  var(--bronze);
  --brand-700:  #92400E;
  --brand-800:  #78350F;
  --brand-900:  #451A03;
  --brand:        var(--brand-500);
  --brand-hover:  var(--brand-400);
  --brand-active: var(--brand-600);
  --brand-tint:   rgba(217, 119, 6, 0.14);
  --brand-glow:   rgba(217, 119, 6, 0.28);
  /* Text selection: an amber wash in both themes, the THEME'S OWN INK on
     it. Dark mode used to paint --text-on-accent (the dark ink for solid
     amber buttons) over the 28 % glow on the near-black ground: 1.39:1,
     selected text invisible (2026-09-09). 45 % wash + paper-white = 7.8:1;
     tests/test_selection_contrast.py holds both themes at AA. */
  --selection-bg: rgba(217, 119, 6, 0.45);
  --selection-fg: var(--text-color);
  /* Phosphor — the kit's fourth brand colour, a lit amber for emphasis on the
     data surfaces. It was published to partners but existed in the app only as
     --cc-phosphor, a literal inside one component's private block. Promoted so
     the token exists where the rest of the brand does; --cc-phosphor now
     aliases it rather than re-declaring the hex. */
  --phosphor:     #FFC04D;   /* primitive; see BRAND.md §2 */

  /* --primary-* routes to brand in v2. Blue is preserved as --info-color
     for templates that want to opt-back-in to blue for a specific element. */
  --primary-color: var(--brand);
  --primary-hover: var(--brand-hover);

  /* ── Semantic / status (unchanged in hue — domain convention) */
  --success-color: var(--contained);   /* 10.55:1 on the page */
  --success-hover: #059669;
  --warning-color: #F59E0B;
  --warning-hover: #D97706;
  --danger-color:  var(--exposed);     /* 5.06:1 on the page */
  --danger-hover:  #DC2626;
  --info-color:    #5FA8B5;   /* v3: muted teal (was blue #3B82F6) — no blue in dossier */
  --info-hover:    #4E8F9C;
  --error-color:   var(--danger-color);
  --link-color:    var(--paper);  /* links read as the brightest text + hover→amber, no cool tint (dossier v3).
                                Was #F2ECE0, a warm white that existed nowhere else in the company — a near-miss on
                                the kit's Paper. Using the real token is also very slightly better: 17.08 vs 16.82. */
  --shadow-sm:     0 1px 2px rgba(0, 0, 0, 0.35);

  /* ── Analytic accents (non-status, distinct from severity). v1 aliases
     --purple-color / --cyan-color / --orange-color are kept for back-compat. */
  --accent-purple: #9A8CD0;   /* MITRE / analysis */
  --accent-cyan:   #5FA8B5;   /* IOC / telemetry */
  --accent-teal:   #5EEAD4;
  --accent-pink:   #F9A8D4;
  --accent-indigo: #818CF8;
  --purple-color:  var(--accent-purple);
  --cyan-color:    var(--accent-cyan);
  --orange-color:  var(--brand);  /* any v1 "orange" now renders as brand copper */

  /* ============================================================
     SEVERITY — with QUIET variants for resolved/acknowledged
     Each severity has three surfaces:
       loud   solid filled badge — "needs your attention"
       quiet  outline only, desaturated — "acknowledged / context"
       text   standalone text color on dark
     ============================================================ */
  --sev-critical:          #DC2626;
  --sev-critical-bg:       rgba(220, 38, 38, 0.18);
  --sev-critical-quiet-bg: rgba(220, 38, 38, 0.06);
  --sev-critical-border:   rgba(220, 38, 38, 0.45);
  --sev-critical-text:     #FCA5A5;
  --sev-high:              #EA580C;
  --sev-high-bg:           rgba(234, 88, 12, 0.18);
  --sev-high-quiet-bg:     rgba(234, 88, 12, 0.06);
  --sev-high-border:       rgba(234, 88, 12, 0.45);
  --sev-high-text:         #FDBA74;
  --sev-medium:            #D97706;
  --sev-medium-bg:         rgba(217, 119, 6, 0.18);
  --sev-medium-quiet-bg:   rgba(217, 119, 6, 0.06);
  --sev-medium-border:     rgba(217, 119, 6, 0.45);
  --sev-medium-text:       #FCD34D;
  --sev-low:               #2563EB;
  --sev-low-bg:            rgba(37, 99, 235, 0.18);
  --sev-low-quiet-bg:      rgba(37, 99, 235, 0.06);
  --sev-low-border:        rgba(37, 99, 235, 0.40);
  --sev-low-text:          #93C5FD;
  --sev-info:              #6B7280;
  --sev-info-bg:           rgba(107, 114, 128, 0.15);
  --sev-info-quiet-bg:     rgba(107, 114, 128, 0.06);
  --sev-info-border:       rgba(107, 114, 128, 0.35);
  --sev-info-text:         #D1D5DB;

  /* ── Glow / Glass */
  --glow-brand:   rgba(217, 119, 6, 0.22);   /* amber emphasis */
  --glow-primary: rgba(217, 119, 6, 0.12);   /* legacy name, now brand-colored */
  --glow-success: rgba(16, 185, 129, 0.18);
  --glow-danger:  rgba(239, 68, 68, 0.20);
  --glow-warning: rgba(245, 158, 11, 0.08);
  --glass-bg: rgba(21, 21, 23, 0.85);
  --glass-border: var(--border-hairline);
  --glass-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);

  /* Motion — easing tokens
   * Default transitions use --transition-fast / --transition-normal, which
   * still ship a plain `ease` curve for back-compat with ~70 existing
   * consumers. New code should prefer the named-curve tokens below:
   *   --ease-out-quart    smooth decel; good for single-element transitions
   *                       (hover lift, card entrance, modal open)
   *   --ease-in-out-quart symmetric curve; pair transitions that go both ways
   *                       (tab switch, accordion, staggered reveals)
   *   --ease-out-expo     exaggerated decel; use sparingly for emphasis
   *                       (hero entrance, "new thing arrived" notifications)
   * These replace the feel of app-default `ease` with curves that modern
   * design systems use (Material Design, Radix, Vercel). Once these are in,
   * the app stops feeling like a 2015 form wizard. */
  /* v2 spec: fast 0.14s / normal 0.22s / hover 0.18s. Durations shortened
   * from v1's 0.15/0.25 to feel tighter against the operator/terminal
   * aesthetic. Motion signals state change only — no bounces or springs. */
  /* ⚠ THE DURATION SCALE — the ONE place a motion time is written (2026-10-11).
     Before this there were three: these tokens, the chart kit's own
     --cyn-ms-* set, and the same numbers again as literals in its JS — plus
     73 transitions with 18 literal durations of their own, most a near-miss
     of a token (0.15 beside 0.14, 0.2 beside 0.18). CSS reads these with
     var(); JS reads them with getComputedStyle (cyn-charts-motion.js,
     Cyntel.animateNumber), so a retune here reaches both. Durations never
     change per theme, so deriving from them on :root bakes nothing wrong.
       fast   micro feedback: colour, border, a fade
       hover  button/link hover; a state change inside a chart
       normal small reveals, a chip, a menu
       panel  drawers and side panes sliding in
       enter  a chart's marks arriving
       data   bar and gauge fills
       count  a figure counting up
       draw   a line drawing itself */
  --dur-fast:   140ms;
  --dur-hover:  180ms;
  --dur-normal: 220ms;
  --dur-panel:  240ms;
  --dur-enter:  420ms;
  --dur-data:   600ms;
  --dur-count:  700ms;
  --dur-draw:   900ms;
  /* Entry choreography: marks land in reading order, this far apart, and the
     last one never waits longer than the cap. */
  --stagger-step: 40ms;
  --stagger-cap:  280ms;
  /* What `transition: all` was standing in for. `all` also animates width,
     padding and margin — a layout pass every frame, and a hover that resizes
     instead of recolouring — so a rule that wants "whatever changes on hover"
     writes `transition: var(--transition-fast); transition-property:
     var(--paint-props)` and gets only what the compositor or a repaint can do. */
  --paint-props: color, background-color, border-color, outline-color, box-shadow,
                 opacity, transform, filter, fill, stroke, text-decoration-color;
  --transition-fast: var(--dur-fast) ease;
  --transition-normal: var(--dur-normal) ease;
  --ease-out-quart:    cubic-bezier(0.25, 1, 0.5, 1);
  --ease-in-out-quart: cubic-bezier(0.76, 0, 0.24, 1);
  --ease-out-expo:     cubic-bezier(0.16, 1, 0.3, 1);
  /* Pre-composed transition values for new code */
  --transition-hover:  var(--dur-hover) var(--ease-out-quart);
  --transition-smooth: var(--dur-panel) var(--ease-out-quart);
  /* Slow, deliberate data-viz reveals — bar/gauge fills, chart draw-ins.
     Longer than UI motion on purpose: the eye should track the value
     landing. Zeroed by the reduced-motion block like every other motion. */
  --transition-data:   var(--dur-data) var(--ease-out-quart);

  /* ── THE TYPE SCALE (2026-10-11, owner-approved from a preview of three).
     The two interface faces, Inter and JetBrains Mono, set on FIVE sizes:

       11      --text-xs       labels, values, metadata — and the FLOOR:
                               nothing a person reads is smaller
       12.5    --text-sm       row text, notes, secondary copy
       14      --text-md       body, prose, rows that wrap
       16      --text-lg       row and section titles
       22      --text-section  figures and section headings

     It was 34 sizes, a median page using 13, with 37% of text under 11px
     and fractions like 8.05 and 9.36 from em arithmetic (October interface
     audit, V2). Newsreader, the editorial face, is NOT on this scale: its
     ledes and hero figures keep the sizes they were drawn at (the Command
     Centre's 64px figure, the 38-46px ledes). The preview's "strict" option
     collapsed those to one 40px step and flattened the hero; it was declined.

     ⚠ A new interface size goes through one of the five tokens, never a
     literal: tests/test_type_scale.py fails on a font-size under 24px that is
     not a token (Newsreader, the brand mark and print excepted).

     The legacy names below are KEPT as aliases so nothing that reads them
     breaks; several now land on the same step. */
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
  --font-display: 'Newsreader', 'Source Serif 4', 'Source Serif Pro', Georgia, serif;

  --text-3xs: 0.6875rem;  /* 11px  alias of --text-xs (was 9px, the old floor) */
  --text-2xs: 0.6875rem;  /* 11px  alias of --text-xs (was 10px) */
  --text-xs: 0.6875rem;   /* 11px  STEP 1 - labels, values, metadata; the floor */
  --text-sm: 0.78125rem;  /* 12.5px STEP 2 - row text, notes, badges (was 12px) */
  --text-base: 0.875rem;  /* 14px  alias of --text-md (was 13px) */
  --text-md: 0.875rem;    /* 14px  STEP 3 - body, prose, form inputs */
  --text-lg: 1rem;        /* 16px  STEP 4 - row and section titles */
  --text-lede: 1rem;      /* 16px  alias of --text-lg (was 18px) */
  --text-xl: 1.375rem;    /* 22px  alias of --text-section (was 20px) */
  --text-section: 1.375rem; /* 22px STEP 5 - figures, section headings */
  --text-2xl: 1.375rem;   /* 22px  alias of --text-section (was 24px) */
  --text-3xl: 2rem;       /* 32px  - hero stat numbers (display tier, off the scale) */

  /* Display scale — NEW in v2. Use for hero moments: risk scores,
     empty-state hero numerals, editorial headlines. */
  --text-display-sm: clamp(2rem, 1.2rem + 4vw, 3rem);       /*  32→48px  fluid */
  --text-display-md: clamp(2.75rem, 1.5rem + 6vw, 4.5rem);  /*  44→72px  fluid */
  --text-display-lg: clamp(3.5rem, 1rem + 12vw, 7.5rem);    /*  56→120px fluid */
  --text-display-xl: clamp(4rem, 0.5rem + 16vw, 11rem);     /*  64→176px fluid (desktop unchanged, shrinks on mobile) */

  /* Line Height — v2 spec §3.4: tight 1.2 / snug 1.35 / normal 1.5 / relaxed 1.6.
   * Bumped from v1's 1.4/1.5 so body copy breathes properly at the new
   * 13px body size. Display typography (Newsreader hero moments) should
   * opt into --leading-tight directly. */
  --leading-tight:   1.2;
  --leading-snug:    1.35;
  --leading-normal:  1.5;
  --leading-relaxed: 1.6;

  /* Tracking */
  --tracking-tight:  -0.02em;
  --tracking-snug:   -0.01em;
  --tracking-normal: 0;
  --tracking-wide:   0.06em;
  --tracking-caps:   0.12em;   /* for uppercase micro-labels */

  /* Measure — the maximum LINE LENGTH for anything that wraps.
   *
   * ⚠ NAMED FOR THE CHARACTER COUNT, NOT FOR THE `ch` VALUE, because those are
   * not the same number. `1ch` is the advance of the digit "0", which in Inter
   * is wider than the average character: measured in page, per element, on the
   * app's own copy, 1ch = 1.19-1.26 characters (mean 1.23). JetBrains Mono is
   * 1.00 by construction, which is why the mono token's value equals its name.
   *
   * ⚠ MEASURE THAT RATIO IN THE PAGE, NEVER ON A SYNTHESIZED SPAN. A bare
   * `font-family:'Inter'` resolves to a different face than the vendored one
   * this app serves and reports 1.42 — a fifth off, and the first pass of this
   * work shipped that number into a preview before it was caught.
   *
   * The caps that predated these tokens were written as if `ch` meant
   * characters, so `82ch` admitted 101 and `104ch` admitted 128, and prose on
   * /collection reached 228 characters per line at 1440 while the SAME copy
   * measured 84 on a 500px viewport. Below 992px nothing here changes; the
   * narrow layout already holds a good measure on its own. */
  --measure-prose: 88ch;   /* ~108 characters — running prose, the default */
  --measure-note: 104ch;   /* ~128 characters — supporting and secondary copy */
  --measure-cap:  120ch;   /* ~148 characters — hard ceiling for anything wrapping */
  --measure-mono: 120ch;   /* ~120 characters — monospace blocks */
  /* ⚠ WIDENED 2026-10-06, owner decision on the rendered page. The 2026-09-10
   * values (53/61/73/75ch, ~65-90 characters) stopped running prose at half
   * its column, so a case description ran 893px tall beside a 978px column
   * it used 468px of. These are the pre-September caps again, now expressed
   * as tokens: /collection's longest line goes 76 -> 114 characters, still
   * half the 228 the tokens were introduced to stop. The record lede goes
   * further and fills its column — page-archetypes.css `.pa-lede-band--record`. */

  /* Spacing Scale (4px base) — v2 adds space-10 (64px) */
  --space-0:  2px;
  --space-1:  4px;
  --space-1h: 6px;    /* half-step for compact elements */
  --space-2:  8px;
  --space-2h: 10px;   /* half-step for medium gaps */
  --space-3:  12px;
  --space-3h: 14px;   /* half-step — dense card/control padding */
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-7:  32px;
  --space-8:  40px;
  --space-9:  48px;
  --space-10: 64px;

  /* Border Radius — v2 tighter than v1 (was 6/8/12).
     Reserves larger radii for explicitly "hero" surfaces. */
  --sidebar-width: 0px;
  --radius-xs:   2px;   /* dividers, rule marks */
  --radius-sm:   3px;   /* badges, small buttons (was 6px) */
  --radius-md:   4px;   /* cards, inputs (was 8px) */
  --radius-lg:   6px;   /* modals, hero surfaces (was 12px) */
  --radius-full: 9999px;
  --border-radius: var(--radius-md);

  /* Shadows — v2 lets the lightness delta between surface tiers carry the
     z-axis; shadows are quieter than v1. */
  --shadow-card:         none;
  --shadow-card-hover:   0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-elevated:     0 6px 20px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.18);
  --shadow-dropdown:     0 12px 36px rgba(0, 0, 0, 0.5), 0 2px 10px rgba(0, 0, 0, 0.25);
  /* Top of the elevation scale — the two surfaces that float over everything.
     Modal centred over a scrim; drawer slides in from the inline-end edge
     (hence the negative x-offset). Theme-flipped below so they don't dump a
     hard black shadow onto a white page. */
  --shadow-modal:        0 20px 60px rgba(0, 0, 0, 0.4);
  --shadow-drawer:       -12px 0 30px rgba(0, 0, 0, 0.25);
  --shadow-drawer-rtl:    12px 0 30px rgba(0, 0, 0, 0.25);   /* the same, for a drawer on the left */
  --shadow-glow-brand:   0 0 24px var(--glow-brand);
  --shadow-glow-primary: 0 0 20px var(--glow-brand);  /* legacy alias → brand */
  --shadow-glow-danger:  0 0 20px rgba(239, 68, 68, 0.15);

  /* Z-Index Scale */
  --z-base: 1;
  --z-sidebar: 10;
  --z-sticky: 15;
  --z-expand-tab: 20;
  --z-footer: 1020;
  --z-navbar: 1030;
  --z-sidebar-mobile: 1045;
  --z-overlay: 1040;
  --z-modal: 9000;
  --z-toast: 9500;
  --z-max: 9999;

  /* Common Dark Values (reusable instead of hardcoding) */
  --dark-bg:    var(--surface-0);
  --dark-card:  var(--surface-2);
  --dark-input: var(--surface-3);
  --dark-hover: #26262A;

  /* v2 changelog: "Gradient tokens removed. The brand-to-purple gradient
   * reads as '2019 fintech.' Where gradients remain (login background,
   * empty-state art), they're inline, intentional, and out of the token
   * system." --accent-gradient + --accent-gradient-subtle previously
   * lived here; both are retired. The three remaining usages (login
   * card top-stripe, 2FA card top-stripe, one AI panel accent) now
   * carry an inline gradient per the v2 rule. */

  /* Chart Series — dossier v3: amber-anchored + muted violet/teal counterpoints
     + green/red semantic + bronze/ash, so multi-series charts read warm and on
     the "no blue" dossier palette while staying 8-distinct. (Was blue at idx 2,
     pink at 6, bright teal at 8.) */
  --chart-1: var(--brand-500);      /* amber */
  --chart-2: var(--brand-400);      /* amber-lit (was --info-color blue) */
  --chart-3: var(--accent-purple);  /* muted violet */
  --chart-4: var(--accent-cyan);    /* muted teal */
  --chart-5: var(--success-color);  /* green (semantic) */
  --chart-6: var(--brand-600);      /* bronze (was --accent-pink) */
  --chart-7: var(--warning-color);  /* gold */
  --chart-8: var(--sev-info);       /* ash-neutral (was --accent-teal bright) */

  /* Theme-aware overlays for modals / backdrops / scrims. Dark mode: opaque
     black. Light mode overrides below to a much lighter
     translucent gray so modal backdrops don't look like a black hole on
     white pages. */
  --overlay-backdrop: rgba(0, 0, 0, 0.62);
  --overlay-soft:     rgba(0, 0, 0, 0.35);
  --overlay-faint:    rgba(0, 0, 0, 0.12);

  /* Focus ring — v2 ships copper glow (was blue in v1). Affects every
     focus-visible element in the app. */
  /* ⚠ SOLID, NOT THE GLOW. This was `var(--brand-glow)` — the brand amber
     at .28 alpha — which composites to 1.48:1 on this ground against the 3:1
     WCAG 2.2 1.4.11 wants of a focus indicator. Eight rules were drawing a
     ring nobody could see. Measured 2026-09-10; --brand-glow itself is left
     alone because it is a decorative glow elsewhere.
     ⚠ RE-DECLARED IN THE LIGHT BLOCK TOO — a custom property is substituted
     where it is DECLARED, so a :root-only definition would bake this amber
     onto paper (§10.6). */
  --focus-ring: 0 0 0 2px var(--primary-color);

  /* ── Undefined-token sweep (§10.195) ────────────────────────────────────
     Five tokens the app already USED but nobody ever DEFINED. A var() naming a
     token with no definition is invalid at computed-value time and silently
     drops to the property's initial value — which the design-token linter could
     not see, because every one of its rules fires on a LITERAL. Rule 10
     (no-undefined-token) now catches the class; these are its first fixes.

     Two of them derive their value from a token that already theme-flips, which
     is the P0-12 / --cc-lift pattern. Note carefully that this does NOT mean
     "no per-theme override is needed" — that is what §10.194 claimed and it is
     wrong for any BODY-ONLY theme selector. A derived token is substituted where
     it is DECLARED and inherits the baked result, so a selector that never
     matches <html> cannot re-resolve it. See the trap note on --hover-bg. */

  /* Row / item hover wash — the ONE hover recipe (index.html's --cc-hover was a
     second, identical one; it is gone, its two usages now point here). Was used
     undefined by .cyn-finding, code_leaks, source_coverage and
     strategic_brief_v1 — two with no fallback at all, so the hover did NOTHING.
     Mixing from --text-color lightens on the dark canvas and darkens on light.

     !! SUBSTITUTION TRAP — still live, and after the focus-mode retirement it
     rests on a SINGLE load-bearing line. A custom property is substituted at
     computed-value time ON THE ELEMENT WHERE IT IS DECLARED, then inherits the
     BAKED result. So the var(--text-color) here resolves against :root (= html)
     and nothing downstream re-resolves it. Light works WITHOUT an override only
     because shared.js puts .light-mode on <html> AS WELL AS <body> (see
     _applyTheme), so `html.light-mode` re-declares --text-color on :root's own
     element and this re-substitutes. Make that body-only and light silently
     bakes the DARK ink: a warm-white row-hover wash on a white card. That was
     measured on focus mode before it was retired — #fefefe on #ffffff,
     luminance delta 0.0086 — and it is the same failure light would hit.

     Any FUTURE body-only surface that re-declares a base token must also
     re-declare everything derived from it. `.aia-body` (ai_analyst.css theme
     lock) is exactly such a selector today: it re-declares --text-color and so
     must never use var(--hover-bg) without re-declaring it. Same for
     --success-bg. */
  --hover-bg: color-mix(in srgb, var(--text-color) 5%, transparent);

  /* Status tint + its INK. The severity ramp has --sev-*-bg at 18% alpha paired
     with a darker --sev-*-text for AA on light; the status ramp had neither, so
     ground_truth_samples' "labelled" badge asked for --success-bg and got no
     background at all. --success-bg mirrors the 18% recipe.
     --success-text is a separate, darker ink for the same reason --sev-*-text
     exists: --success-color is a FILL, and measured on the light tint it lands
     at 3.03:1 — a WCAG AA fail, and the identical mistake as the KEV badge
     (3.04:1) that started this. Emerald-800 measures 6.17:1 (light) / 6.46:1
     (focus) / 5.42:1 (dark). Overridden per theme below — do not re-derive it
     from --success-color. */
  --success-bg: color-mix(in srgb, var(--success-color) 18%, transparent);
  --success-text: var(--contained);

  /* Chrome height — the masthead nav (2026-08-01) is a 24px utility tier over
     the 56px bar, so 80px on desktop. ⚠ EVERY chrome-anchored offset consumes
     this token now (body padding, .preview-pane, .filter-sidebar, the mobile
     sidebar overlay, the sidebar min-height) — the five bare `56px` copies
     were moved onto it in the same change, because a second tier with five
     stale anchors is five surfaces sliding under the nav. The ≤991px media
     block flips it back to 56px when the utility tier hides; var() re-resolves
     at use-time, so consumers follow (this is USE, not derivation — the baked-
     token trap in CLAUDE.md §10.6 applies only to tokens derived from it). */
  /* ⚠ 56px, NOT 80px, SINCE 2026-08-02: the 24px utility tier above the
     bar was removed (app.py) and this token was its sum. The <=991px
     override that used to flip it back went with it — there is nothing
     left to flip. */
  --nav-height: 56px;
  /* What the window must keep clear for a FIXED footer. 0 since 2026-10-12:
     the footer is the last thing on the page at every width (the owner's
     call, from a preview). /knowledge keeps its fixed footer and re-declares
     38px on its body. Every "clear the footer" offset reads this — the body's
     height, the drawers' bottoms, the filter rail, the techniques layout — so
     it is one fact in one place, not five literals. */
  --footer-h: 0px;

  /* Bootstrap .btn-close is a near-black SVG glyph, so on the dark canvas it is
     invisible without an invert. Overridden to `none` on the light + focus
     themes below. Applied globally to .btn-close (search "btn-close-filter"). */
  --btn-close-filter: invert(1);

  /* ══════════════════════════════════════════════════════════════════════
     REDESIGN v2 — the handoff's vocabulary
     REDESIGN/css/tokens.reference.css

     That file says: "Where a name below matches one of yours, the value is
     what the mockups assume — reconcile, do not duplicate."

     So this block ALIASES wherever the value already exists in this file and
     only declares a literal where nothing equivalent was found. Seven names
     already agreed exactly (--void, --paper, --amber, --sev-critical,
     --sev-critical-text, --sev-high, --sev-high-text) and are not repeated
     here at all.

     ⚠ Aliases are `var()` references, so they are substituted at
     computed-value time ON THE ELEMENT WHERE THEY ARE DECLARED — here, :root.
     Light mode re-declares its inks on <html> (shared.js puts .light-mode on
     the root element as well as body), which IS :root's own element, so these
     re-resolve correctly. `.aia-body` is body-only and re-declares
     --text-color, so anything below that derives from it will bake the dark
     value inside that surface. Do not use --ink/--ink-3/--ink-4 on the
     analyst surface without re-declaring them there. See §10.6 of CLAUDE.md.
     ══════════════════════════════════════════════════════════════════════ */

  /* ── Ground. Two recessed steps, no third. ─────────────────────────── */
  --void-2:   var(--surface-0);   /* #060607 — chrome bar, lede, composer  */
  --surface:  var(--redact);      /* #151517 — form controls, bubbles      */

  /* ── Ink. The handoff's ladder is five steps; this file already had four
        of them under different names, and they are OFF BY ONE against the
        handoff's numbering — the handoff's --ink-3 is this file's
        --text-secondary, not --text-tertiary. Mapping them by number
        rather than by value would have shifted every note one step darker. */
  --ink:    var(--text-color);       /* 0.92 — 13.9:1 body                 */
  --ink-2:  rgba(237, 234, 226, 0.72);  /* 8.9:1 — NEW, no equivalent      */
  --ink-3:  var(--text-secondary);   /* 0.58 —  5.9:1 notes, captions      */
  --ink-4:  var(--text-tertiary);    /* 0.52 —  4.9:1 labels, meta. FLOOR. */

  /* ── Accent. --amber already agrees; these two existed under app names. */
  --amber-hot: var(--amber-lit);      /* #F9A93C links, hover, source pills */
  --amber-ink: var(--text-on-accent); /* #1A1206 text ON amber — 5.8:1      */
  /* ── The primary button under the cursor. Two tokens, because a hover has
        to move BOTH halves: the label steps to the theme's strongest ink and
        the fill steps AWAY from it, so the pair gains contrast rather than
        losing it. Not --primary-hover, which brightens on dark (--brand-400)
        — no amber light enough to brighten can carry --paper at 4.5.

        Dark: the brand ramp (32.1deg / 94.6%) at 31% lightness — the first
        step down that carries --paper at 4.5 (4.97 measured) while the fill
        itself still clears the 3:1 UI floor on --void-2 (3.51). The literal
        it replaced, #c46a05, held --paper at 3.35. Registered in
        scripts/lint_contrast (`press-ink on press`, `press on band`) and in
        tests/test_archetype_contrast so the pair cannot drift. */
  --amber-press:     #9A5404;
  --amber-press-ink: var(--paper);
  /* ⚠ THE ACCENT AS A WORD. Third member of the FILL-vs-TEXT split that
        --sev-critical/--sev-critical-text and --sev-high/--sev-high-text
        already carry, and it was the missing one.

        --amber and --amber-hot are registered at the 3.0 UI ratio, for RULES
        and EYEBROWS. That registration is honest: --primary-color is pinned at
        #C96E06 precisely because one step darker fails 3:1 as a button fill.
        But it measures 3.37:1 on the light ground, so every use of it as a
        readable word inherits a promise nobody made — scripts/lint_contrast
        says so at `tag kev on ground`, after --amber-hot shipped a 9.5px
        ledger tag at 3.37:1. It happened again on `.pa-blind-n`, the numeral
        on the closing pair: 5.87:1 dark, 3.20:1 light, on every archetype page.

        So: same hue (32.1deg) and saturation (94.6%) as the brand, lightness
        33% instead of 40.5%. That is the FIRST step down the brand ramp that
        clears 4.5:1 on all three light grounds — 4.77 on --void, 5.19 on
        --void-2, 4.61 on --surface. Dark needs no step: --amber is already
        6.21:1 there.

        Use it for accent-coloured TEXT. Leave --amber on rules, fills,
        borders and dots. */
  --amber-text: var(--amber);         /* #D97706 — 6.21:1 on --void         */

  /* ── Rules. The weight difference carries meaning: 1px between ROWS,
        2px between SECTIONS. Declared literally — the existing
        --border-* tokens are a different ladder and conflating them would
        make a row rule and a section rule indistinguishable. */
  --rule:        rgba(255, 255, 255, 0.12);
  --rule-strong: rgba(255, 255, 255, 0.14);
  --card-edge:   rgba(255, 255, 255, 0.10);

  /* ── Severity. --sev-medium/-low are deliberately DE-COLOURED here.
        This file currently ships --sev-medium: #D97706 (the brand amber)
        and --sev-low: #2563EB (a blue). Amber-as-medium collides with amber
        -as-accent, so a medium row reads as an action; and the blue is the
        "cool tint" that --link-color: var(--paper) was set to remove
        ("no cool tint (dossier v3)", line 124). The originals are left
        untouched above so nothing existing shifts; these are what the
        redesign's own components resolve. */
  --sev-medium-v2: var(--ink-3);
  --sev-low-v2:    var(--ink-4);
  --ok: var(--contained);            /* #3DD68C remediated, providers agree */

  /* ── The light shell (Modernist): print, exports, the mark spec, the
        marketing side. Same structure, different material. This is NOT the
        app's light THEME — it is a separate ground the Gate archetype and
        the mark render on, which is why these are literals and not aliases
        of the .light-mode palette. */
  --lt-ground:   #f3f2f2;
  --lt-ink:      #201e1d;
  --lt-muted:    #605d5d;
  --lt-hairline: #c9c5c5;
  --lt-accent:   #ec3013;

  /* ── Type. Three faces with one job each.
        --font-display and --font-mono are NOT redeclared: this file already
        defines both, with strictly longer fallback chains than the handoff's
        ('Source Serif 4' / 'Fira Code' etc). The handoff CSS references the
        unsuffixed names, so it picks up the better stacks for free. Only the
        name this file was missing is bridged. */
  --font-body: var(--font-sans);
  /* --font-brand is Archivo, and MARK.md makes it a hard prerequisite: it is
     NOT vendored yet, so the mark and wordmark cannot be outlined. Declared
     with a real fallback so nothing renders in a random serif meanwhile. */
  --font-brand: 'Archivo', 'Inter', system-ui, sans-serif;

  /* Display — the lede, and nothing on the page competes with it. */
  --t-lede:       300 38px/1.2 var(--font-display);
  --t-lede-hero:  300 46px/1.08 var(--font-display);  /* the Command Centre hero only (29 Aug drawing) */
  --t-hero-num:   300 64px/1 var(--font-display);     /* the hero signature figure */
  /* A profile's SUBJECT — the name, in the band it shares with the judgement.
     Lighter than the dossier masthead (--t-mast, 500) on purpose: a masthead
     sits alone in its own band and can carry weight, but here the name and a
     30px lede are read together and a 500 name overpowers the sentence that
     actually says something. Handoff 10b: Newsreader 300 44px, -.02em. */
  --t-subject:    300 44px/1 var(--font-display);
  /* A lede that SHARES its band with a title. Smaller and set over a longer
     measure than --t-lede so it reads as the paragraph under a name rather
     than a second headline. Two display sizes in one band always compete;
     this is the one that steps down. Handoff 10b: 30px/1.28, -.01em, 22em. */
  --t-lede-sub:   300 30px/1.28 var(--font-display);
  --t-page-h1:    400 34px/1.0 var(--font-display);
  --t-order-num:  300 40px/1 var(--font-display);
  --t-stat-num:   300 34px/1 var(--font-display);
  --t-section-h:  600 22px/1.3 var(--font-sans);    /* was 19px: on the scale */

  /* Body */
  --t-prose:        14px/1.7 var(--font-sans);    /* was 14.5px */
  --t-prose-tight:  14px/1.65 var(--font-sans);
  --t-row:          14px/1.4 var(--font-sans);    /* was 13.5px */
  /* Prose INSIDE a ledger row. 12.5px/1 is not a smaller --t-row, it is the
     same LINE BOX as --t-value-lg (.lrow-id) — which is what keeps a ledger
     with a title column exactly as tall as one without. --t-row's 1.4 is a
     wrapping line-height and makes a 20px box in an 11+11+12.5+1 = 36px row;
     that is the defect tests/test_v2_ledger_contract has caught three times.
     Sans, not mono: a vulnerability summary is a sentence, not a value. */
  --t-row-prose:    12.5px/1 var(--font-sans);
  --t-row-title:    600 16px/1.35 var(--font-sans);
  --t-secondary:    12.5px/1.5 var(--font-sans);
  --t-note:         12.5px/1.55 var(--font-sans); /* was 11.5px: read, not glanced at */

  /* Mono. The tracking is what makes these read as labels, not as data —
     it is applied by the component, not carried in the shorthand. */
  --t-eyebrow:   600 11px/1 var(--font-mono);  /* ls .24em UPPER (was 10px) */
  --t-colhead:   11px/1 var(--font-mono);      /* ls .14em UPPER (was 9.5px) */
  /* ⚠ 1.1, NOT 1, AND THE .1 IS THE WHOLE POINT. `10px/1` gives the line box
     exactly the font size, but JetBrains Mono's ascender+descender run to
     ~1.1em — so an 11px glyph run sat in a 10px box and the overflow went
     DOWNWARD. Every component built on this token centred its line box
     correctly and still rendered its text 1px high: measured on
     /profiles/<id>, the malware pills came out 3px above / 4px below and the
     activity tabs 4px / 5px. One token, eighteen call sites, the same 1px
     everywhere — which is why it reads as "the pills and the tabs are
     misaligned" rather than as one component being wrong.
     1.1 is the glyph height, so the box fits the text exactly: 4/4 and 5/5,
     measured. 1.2 overshoots and lands 1px high again in the other
     direction. Costs 1px of component height and buys optical centring. */
  --t-pill:      11px/1.1 var(--font-mono);    /* ls .08em (was 10px; 1.1 still the glyph height) */
  --t-figure:    22px/1 var(--font-mono);
  --t-figure-lg: 500 22px/1 var(--font-mono);  /* the figures STRIP under the hero (was 24px) */
  --t-value:     11px/1 var(--font-mono);
  --t-value-lg:  12.5px/1 var(--font-mono);

  /* ── Space. These are LAYOUT constants, not steps on the --space-* scale.
        --gutter happens to equal --space-7 (32px) today; aliasing them would
        couple "the page gutter" to "spacing step 7" so that retuning the
        scale silently moves every band's padding. Kept literal on purpose. */
  --gutter:      32px;   /* page + band horizontal padding. NEVER localised. */
  --chrome-h:    44px;   /* THE chrome bar height, every page, with or
                            without actions. It was content-sized — 34px for
                            a bar of 11px type, 47px once a 24px action
                            button landed in it — so it changed height as you
                            moved between pages of one product, and 24 of the
                            55 templates fill `chrome_actions`. 44 is the
                            smallest height that gives the spec's 24px button
                            the 10px of air the rest of the system uses, and
                            it centres 11px type. PATTERNS §2 fixes the bar's
                            padding at 11px; that padding is what made the
                            height an accident, so the height is the constant
                            now and the padding follows from it.             */
  --band-y:      26px;   /* vertical padding inside a band                   */
  --band-y-lg:   32px;   /* the lede band only                               */
  --row-y:       11px;   /* ledger row vertical padding                      */
  --row-indent:  11px;   /* ledger row LEFT padding — clears the severity
                            spine. THE HEADER ROW MUST CARRY THE SAME VALUE
                            or every column label sits 11px left of its
                            values. This was a real defect twice.            */
  --col-gap:     14px;   /* ledger column gap; row gap is 0                  */
  --side-col:    340px;  /* signature / aside column                         */
  --side-gap:    48px;   /* main-to-aside gap                                */
  --rail:        244px;  /* filter rail                                      */
  --pane:        480px;  /* preview slide-over                               */
  /* THE PAGE MEASURE. The width a page is allowed to occupy on a wide
     monitor, capped so the eye never crosses dead horizontal space. Four
     places read it (the ultrawide-centering block at the end of this file
     states all four) and they must not drift: a filter page and a filter-less
     page landing on different measures is the inconsistency this token
     exists to prevent. */
  --page-measure: 1560px;
  /* Bulk-bar clearance: whatever a fixed footer takes (--footer-h, 0 since
     the footer scrolls with the page) plus breathing room. It was 54px — 38
     of footer and 16 of air — and stayed a token because two files place the
     bar (shared.css for the pre-redesign callers, page-archetypes.css for the
     migrated ones) and they must not drift. ⚠ DERIVED, so baked on :root
     (§10.6): body.ksf-page re-declares it with --footer-h. */
  --bulk-bottom: calc(var(--footer-h) + var(--space-4));

  /* ── Radius is zero. Everywhere. Selects included. ─────────────────── */
  --radius: 0;
}

html.light-mode, body.light-mode, html.chrome-light body #main-navbar {
  /* Surfaces remapped for light mode: the WARM dossier paper ramp, the light
     counterpart of the void. Was a cool blue-grey pearl (#E8EBF2/#F6F7FB/
     #F1F3F9) left over from the pre-rebrand palette, which put the app's two
     halves on visibly different grounds -- mobile migrated both schemes a year
     earlier and web light never followed. Tier-0 is Paper, the published brand
     token; Tier-2 (where cards live) stays pure white for maximum content
     contrast.
     !! --surface-0 is PINNED at #F2EEE4. --primary-color measures 3.17:1 on it;
     one step darker (#EDE7D9) drops to 2.98:1 and fails the 3:1 UI floor. */
  --surface-0:  var(--paper);
  --surface-1:  #F8F5EE;
  --surface-2:  #FFFFFF;
  --surface-3:  #F5F1E9;
  --bg-color:   var(--surface-1);
  --card-bg:    var(--surface-2);
  --panel-bg:   #F3EFE7;
  --input-bg:   var(--surface-2);
  --button-bg:  var(--surface-3);
  --button-bg-hover: #EDE8DC;
  --button-text: rgba(26, 18, 6, 0.72);
  /* Text opacities are tuned to the same MEASURED contrasts as the dark ramp,
   * not to the same alpha numbers — a bright canvas eats more of a dark ink
   * than a near-black one gives back. Dark reads 13.91 / 5.88 / 4.91 on its
   * page canvas; light reads 12.83 / 5.99 / 4.88 on #F8F5EE.
   * The alphas moved with the 2026-07-26 warm migration (.90/.68/.62 ->
   * .89/.67/.61) precisely so the MEASURED numbers stay put: warm ink on warm
   * paper is a different pairing, and matching the alphas would have changed
   * the readability. Matching the ratios is the point.
   * Was .62/.56, which put tertiary at 4.04:1 — a WCAG AA FAIL, in the one
   * token whose whole job is to be the AA floor. Raising tertiary alone would
   * have collapsed it into secondary (.60 vs .62 is not a ramp step), so the
   * pair moved together. Gated by scripts/lint_contrast. */
  --text-color:     rgba(26, 18, 6, 0.89);
  --text-primary:   var(--text-color);
  --text-secondary: rgba(26, 18, 6, 0.67);
  --text-tertiary:  rgba(26, 18, 6, 0.61);  /* AA de-emphasis floor: 4.88:1 on --bg-color */
  --text-disabled:  rgba(26, 18, 6, 0.42);
  --text-on-accent: #1A1206;
  --border-hairline: rgba(26, 18, 6, 0.07);
  --border-default:  rgba(26, 18, 6, 0.15);
  --border-strong:   rgba(26, 18, 6, 0.28);
  --input-border:    var(--border-default);
  /* Links follow the DARK theme's rule, mirrored: the strongest ink, with the
     colour shift carried by an amber underline / hover rather than a hue. Dark
     uses #F2EEE4, Paper; light uses full-strength warm ink
     against the .89 body ramp -- the same "links are the most present text"
     relationship. Was #2563EB, the exact blue the dossier deleted. */
  --link-color:    #1A1206;
  /* Primary keeps the brand's exact HUE and SATURATION (32.1deg / 94.6%) and
     drops only lightness, 43.7% -> 40.5%. --brand itself is NOT touched: it
     stays #D97706 in the ramp above, which is the value pinned to the
     marketing site and used by the dark dossier theme.
     Why: `var(--brand)` measures 2.98:1 on this canvas — under the 3:1 WCAG
     1.4.11 floor for a UI component (a primary button's fill against the page
     is exactly that). The old comment here claimed "the ramp values already
     work on light backgrounds"; measured, they did not. #C96E06 reads 3.43:1
     on --bg-color and still clears 3:1 on every other light surface (3.08:1 on
     the deepest, --surface-0), while keeping --text-on-accent at 5.03:1 on the
     fill — darkening further to --brand-600 would push that button label BELOW
     AA (3.68:1), which is why this is a 3-point nudge and not a ramp step.
     Re-measured 2026-07-26 against the warm ramp: 3.37:1 on --bg-color, 3.67:1
     on the white card, 3.17:1 on --surface-0, label 5.05:1. Owner picked this
     over --brand-600 to keep light MIRRORING dark's amber-fill/dark-ink
     signature rather than inverting it to a dark fill with a light label.
     !! --primary-hover DARKENS here. It used to be --brand-400 (#F9A93C) "so
     hover still brightens" -- correct on a void, wrong on paper: that measured
     1.79:1 against the light canvas, so hovering a primary button made it very
     nearly disappear. #C06806 is 3.69:1 with the ink label still at 4.61:1. */
  --primary-color: #C96E06;
  --primary-hover: #C06806;
  /* ⚠ AND THE ACCENT-AS-A-WORD VALUE, WHICH MUST BE DECLARED HERE, NOT
     DERIVED. `--amber-text: var(--amber)` in the dark :root bakes #D97706 on
     the element it is declared on, and an element that later re-declares
     --amber does NOT re-resolve it (CLAUDE.md §10.6). page-archetypes.css
     re-declares --amber in its own `html.light-mode, body.light-mode` block,
     which lands on the same element as this one and runs AFTER it — so if
     this were `var(--amber)` the light theme would silently keep the dark
     accent. The literal is the point.

     #A45A05 is the brand hue/saturation at 33% lightness. --primary-color
     stops at 40.5% because a button FILL owes 3:1 and one step darker fails
     it; a WORD owes 4.5:1 and #C96E06 gives 3.37 on --void. Measured: 4.77 on
     --void, 5.19 on --void-2, 4.61 on --surface. Registered as a pair in
     scripts/lint_contrast (`amber-text on ground`) so it cannot drift. */
  --amber-text:    #A45A05;
  /* The pressed fill flips OPERATION on paper, the way --hover-bg does — the
     label is already the darkest ink there, so the fill steps LIGHTER (44%)
     to move away from it — 5.13:1 under --text-color, and the fill still
     reads 3.15:1 against the white band it sits on. The ink stays
     --amber-ink: there is no stronger ink to step to on paper. Literal, not
     derived, for the reason --amber-text gives above. */
  --amber-press:     #DA7806;
  --amber-press-ink: var(--amber-ink);
  /* Semantic tones are darker LIGHTNESS STEPS of the kit hues in light mode.
     Exposed #E5484D happens to clear the 3:1 UI floor on paper as-is (3.38:1
     worst surface), so danger is now ONE value across both themes. Contained
     #3DD68C does not -- it is a bright mint and measures 1.72:1 on this canvas
     -- so success drops lightness 53.9% -> 35% at the same hue/saturation,
     exactly the way --primary-color steps down from --brand. */
  --error-color:   var(--exposed);
  --success-color: var(--contained-l);
  --warning-color: #C96E06;   /* same value + same reason as --primary-color above */
  --danger-color:  var(--exposed);
  --info-color:    #38707A;   /* dossier cyan — was #2563EB, the banned blue */
  --shadow-sm:     0 1px 3px rgba(0, 0, 0, 0.06);
  /* .btn-close's glyph is already dark ink — no invert on a light canvas. */
  --btn-close-filter: none;
  /* Emerald-800 ink for the --success-bg tint: --success-color measures only
     3.03:1 on it here (AA fail); this measures 6.17:1. Sibling of --sev-*-text.
     --hover-bg / --success-bg need NO override in this block: shared.js puts
     .light-mode on <html> as well as <body>, so `html.light-mode` re-declares
     --text-color / --success-color on :root's own element and both color-mixes
     re-substitute. See the substitution-trap note at --hover-bg. (§10.195) */
  --success-text: #187246;
  /* Theme-aware overlays: light mode uses a softer scrim. */
  --overlay-backdrop: rgba(26, 18, 6, 0.35);
  --overlay-soft:     rgba(26, 18, 6, 0.15);
  --overlay-faint:    rgba(26, 18, 6, 0.06);
  /* Brand glow at lower alpha for light backgrounds */
  --brand-glow:   rgba(217, 119, 6, 0.22);
  --selection-bg: rgba(217, 119, 6, 0.28);   /* 12.8:1 with the dark ink on paper */
  --selection-fg: #1A1206;
  /* Solid here too, and for the same measurement: the glow was 1.25:1 on
     paper. --primary-color is the light accent, pinned by this block. */
  --focus-ring:   0 0 0 2px var(--primary-color);
  --sev-critical-bg: rgba(220, 38, 38, 0.08);
  --sev-critical-text: #B91C1C;
  --sev-critical-quiet-bg: rgba(220, 38, 38, 0.04);
  --sev-high-bg: rgba(234, 88, 12, 0.08);
  --sev-high-text: #9A3412;
  --sev-high-quiet-bg: rgba(234, 88, 12, 0.04);
  --sev-medium-bg: rgba(217, 119, 6, 0.08);
  --sev-medium-text: #92400E;
  --sev-medium-quiet-bg: rgba(217, 119, 6, 0.04);
  /* The SOLID medium fill (status dots, stat-card rails, .cyn-finding borders)
     is the same amber as --warning-color and failed the same 3:1 UI floor here
     at 2.98:1 — the rest of the severity ramp clears it on this canvas
     (critical 4.51, high 3.32, low 4.83, info 4.52). Hue and saturation are
     unchanged, so the domain colour convention holds. Now 3.43:1. */
  --sev-medium: #C96E06;
  --sev-low-bg: rgba(37, 99, 235, 0.08);
  --sev-low-text: #1D4ED8;
  --sev-low-quiet-bg: rgba(37, 99, 235, 0.04);
  --sev-info-bg: rgba(107, 114, 128, 0.08);
  /* Gray-600, not the gray-500 --sev-info fill. Every other severity already
     had a darker dedicated ink for light mode (critical #B91C1C, high #9A3412,
     medium #92400E, low #1D4ED8); info was left pointing at its own fill and
     measured 4.38:1 on its 8% tint — an AA fail. Now 6.85:1. */
  --sev-info-text: #57534E;
  --glow-primary: rgba(217, 119, 6, 0.10);
  --glow-brand:   rgba(217, 119, 6, 0.22);
  --glow-success: rgba(5, 150, 105, 0.06);
  --glow-danger: rgba(220, 38, 38, 0.06);
  --glow-warning: rgba(217, 119, 6, 0.06);
  --glass-bg: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(26, 18, 6, 0.08);
  --glass-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 4px 16px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-dropdown: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-modal:  0 20px 60px rgba(0, 0, 0, 0.18);
  --shadow-drawer: -12px 0 30px rgba(0, 0, 0, 0.12);
  --shadow-drawer-rtl: 12px 0 30px rgba(0, 0, 0, 0.12);
}

/* --- Light Mode: comprehensive element overrides --- */
body.light-mode .card-panel,
body.light-mode .stat-card,
body.light-mode .chart-card {
  background: #fff;
  border-color: rgba(0,0,0,0.08);
}
body.light-mode .section-label {
  color: var(--text-secondary);
}
body.light-mode .badge,
body.light-mode .tag,
body.light-mode code {
  background: rgba(0,0,0,0.04);
}
body.light-mode select option {
  background: #fff;
  color: #1A1206;
}
/* admin-table light-mode now handled by shared data-table/admin-table aliases */
body.light-mode .metric-card {
  border-color: rgba(0,0,0,0.08);
}
/* ⚠ `body.light-mode .empty-msg { color: rgba(26,18,6,.48) }` WAS HERE AND WAS
   THE LIGHT HALF OF A LIVE AA FAILURE. It is (0,2,1) against the page rule's
   (0,1,0), so it WON — the console's `.empty-msg { color: var(--ink-3) }` never
   applied in light at all, and the page's `opacity: 0.4` then scaled this
   literal to .19 alpha on a white card: 1.52:1 at 13px. A literal never reaches
   the token layer, which is why the light ramp moving twice (the 2026-07-26
   warm migration, the tertiary fix that raised the AA floor off 4.04:1) left
   this value behind both times. `--ink-3` follows the theme; nothing needs to
   restate it here. Same shape as the 14 rgba() borders page-archetypes.css
   documents at its light branch. */
body.light-mode input::placeholder,
body.light-mode textarea::placeholder {
  color: rgba(26,18,6,0.42);
}
body.light-mode .btn-outline-theme, html.chrome-light body #main-navbar .btn-outline-theme {
  color: rgba(26, 18, 6, 0.72);
  background: #F3EFE7;
  border-color: rgba(0,0,0,0.08);
}
body.light-mode .btn-outline-theme:hover, html.chrome-light body #main-navbar .btn-outline-theme:hover {
  background: #EDE8DC;
}
body.light-mode .toast-notification {
  background: #fff;
  border-color: rgba(0,0,0,0.08);
  color: #1A1206;
}
body.light-mode .page-header {
  border-bottom-color: rgba(0,0,0,0.06);
}
body.light-mode .severity-badge.critical, body.light-mode span.sev-critical { background: rgba(220,38,38,0.12); color: #B91C1C; }
body.light-mode .severity-badge.high, body.light-mode span.sev-high { background: rgba(234,88,12,0.12); color: #9A3412; }  /* WCAG AA: 5.8:1 (was #C2410C at 2.8:1) */
body.light-mode .severity-badge.medium, body.light-mode span.sev-medium { background: rgba(217,119,6,0.12); color: #92400E; }  /* WCAG AA: 5.5:1 (was #B45309 at 2.9:1) */
body.light-mode .severity-badge.low, body.light-mode span.sev-low { background: rgba(37,99,235,0.12); color: #1D4ED8; }
/* Hide scrollbar on sidebar (all modes) */
.filter-sidebar {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.filter-sidebar:hover {
  scrollbar-color: var(--button-bg) transparent;
}
.filter-sidebar::-webkit-scrollbar { width: 4px; }
.filter-sidebar::-webkit-scrollbar-thumb { background: transparent; border-radius: 2px; }
.filter-sidebar:hover::-webkit-scrollbar-thumb { background: var(--button-bg); }

/* --- Base Resets --- */
*, *::before, *::after { box-sizing: border-box; }

/* --- Base Body (fallback for standalone pages) --- */
html {
  background-color: var(--bg-color);
}
body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  transition: background-color var(--dur-hover) ease, color var(--dur-hover) ease;
  /* Typography polish —
   * - antialiased / grayscale: crisper glyph rendering on Retina
   *   + HiDPI monitors, matches what macOS Safari does by default.
   *   Without this, Inter renders subpixel-style on Chromium which
   *   picks up coloured fringes on dark backgrounds.
   * - "cv11" ss01 / calt: Inter's character variants and contextual
   *   alternates — slightly tighter spacing, better lowercase 'a'
   *   forms in small sizes. "tnum" makes digits tabular so tables of
   *   numbers (IOC IDs, CVE scores, timestamps, stat counters)
   *   have vertically-aligned columns instead of proportional widths.
   * - text-rendering: optimizeLegibility enables kerning pairs +
   *   ligatures globally. Default ('auto') often skips kerning on
   *   small text. */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "tnum" 1, "cv11" 1, "ss01" 1, "calt" 1;
  text-rendering: optimizeLegibility;
}

/* Tighter tracking for large headings — Inter's default spacing is
 * tuned for body text, at display sizes the letters feel too airy.
 * -0.015em on headings 1-2 + -0.01em on 3-4 is a standard "tight"
 * editorial look without being cramped. */
h1, h2, .h1, .h2 { letter-spacing: var(--tracking-tight); }
h3, h4, .h3, .h4 { letter-spacing: -0.01em; }

/* Uppercase micro-labels (section titles, table thead, badge text)
 * get EXTRA tracking — uppercase glyphs are taller than lowercase
 * relative to their sidebearings, so the default spacing looks
 * cramped. Existing .sortable headers + .empty-state-section rules
 * already bump their own letter-spacing; this covers the rest. */
.uppercase-label, [style*="text-transform:uppercase"]:not(h1):not(h2):not(h3) {
  letter-spacing: 0.04em;
}

/* Numeric-heavy data cells get tabular explicitly in case a parent
 * somewhere overrode it via font-feature-settings shorthand. */
.data-table td, .admin-table td,
.metric-val, .stat-value, .case-number,
code, kbd, .font-mono, [class*="font-mono"] {
  font-variant-numeric: tabular-nums;
}

/* v2 spec §3.6: code blocks + inline code render in JetBrains Mono, not
 * the browser's default monospace (Consolas on Windows, Menlo on Mac).
 * Without an explicit font-family, these elements fall through to the UA
 * default which varies per OS and breaks typographic consistency. */
code, pre, .code-block {
  font-family: var(--font-mono);
}
/* Inline code takes the ink of the sentence it sits in. Nothing here ever set
   a colour, so Bootstrap's reboot did — #d63384, a pink the palette does not
   contain, at 4.40:1 on the dark ground and below it on paper, under every
   field name a pair note quotes (`sla_due_at`, `info`) on alerts, cases and
   indicators. Measured live 2026-09-05. The mono face is what marks it as
   code; inheriting keeps it at whatever floor its context already clears. */
code { color: inherit; }
/* ⚠ And it takes the type scale's 11px step, not Bootstrap's `.875em`. A
   relative size lands wherever its parent puts it — 10.94px in a 12.5px note,
   9.6px in an 11px label — and those fractions are what the 2026-10-11 scale
   removed. JetBrains Mono at 11 sits level with Inter at 12.5-14. */
code { font-size: var(--text-xs); }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--button-bg); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--button-bg-hover); }
* { scrollbar-width: thin; scrollbar-color: var(--button-bg) transparent; }

/* Light-mode scrollbar (needs visible contrast against the paper canvas) */
body.light-mode ::-webkit-scrollbar-thumb { background: #DDD5C4; }
body.light-mode ::-webkit-scrollbar-thumb:hover { background: #BFB6A2; }
body.light-mode * { scrollbar-color: #DDD5C4 transparent; }

/* --- Selection --- the pair is a token per theme; see --selection-bg */
::selection { background: var(--selection-bg); color: var(--selection-fg); }

/* --- Respond workspace station strip (§respond-workspace, 2026-07-23) ---
   Queue | Alerts | Cases: one workspace, three stations, three URLs.
   Rendered by ui.respond_shell() above the page header on /triage, /alerts,
   /cases and /cases/<id>. Count chips filled by shared.js from the same
   /api/nav/counts fetch as the navbar badge. */
.respond-shell {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  /* No negative tuck: the strip is rendered INSIDE the page header now
     (page_header aside=…), not as a sibling above it. */
}
.rs-station {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1h) var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}
.rs-station:hover { color: var(--text-color); background: var(--hover-bg); text-decoration: none; }
.rs-station:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.rs-station.active {
  color: var(--primary-color);
  background: var(--brand-tint);
  border-color: color-mix(in srgb, var(--brand) 35%, transparent);
}
.rs-station i { font-size: var(--text-base); }
.rs-count {
  font-size: var(--text-xs);
  line-height: 18px;
  padding: 0 var(--space-2);
  border-radius: 0;
  background: var(--input-bg);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.rs-station.active .rs-count { background: var(--brand); color: var(--surface-1); }

/* --- Page Header --- */
.page-header {
  padding: 24px 0 18px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--input-border);
  position: relative;
}
.page-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-color), transparent);
}
.page-header h1, .page-header h2, .page-header h3, .page-header h4 {
  font-weight: 700;
  font-size: var(--text-xl);  /* legacy levels on not-yet-migrated pages */
  margin: 0;
  letter-spacing: -0.3px;
}
/* §page-header-standard: the canonical page title is an h1 at 24px (--text-2xl,
   documented as "page titles"). The old rule glued a decorative icon next to
   the title via flex+gap; the standard DROPS title icons — section identity
   lives in the sidebar — so no flex here. See the page_header() macro. */
.page-header h1 {
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
}
.page-header p,
.page-header .page-description {
  /* Was `color: var(--text-color); opacity: .45` → effective ~3.5:1, AA fail.
   * opacity-as-color is also unauditable and dims child icons (P0-10). */
  color: var(--text-secondary);
  font-size: var(--text-base);
  margin-top: var(--space-1);
  margin-bottom: 0;
  font-weight: 400;
  line-height: var(--leading-relaxed);
}
/* §page-header-standard: reusable header layout used by the page_header() macro. */
.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}
.page-header-titles { min-width: 0; }
/* title + inline badge/pill (page_header badge=) — keeps a status chip beside
   the <h1> without letting it inherit the 24px title size */
.page-title-line { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
/* Right-hand header column: page_header(aside=…) stacked above the actions.
   Both end-aligned so the strip and the action button share one right edge
   regardless of how tall the title/subtitle block is. */
.page-header-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  flex-shrink: 0;
}
.page-breadcrumb {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  /* No opacity. --text-secondary is already the ramp step for "quieter than
   * body", and dimming it a further 25% took it to 3.74:1 dark / 3.46:1 light
   * against AA's 4.5. Surfaced when scripts/lint_contrast learned to model
   * `opacity` as an alpha multiplier — before that the pair was measured as
   * though the token were opaque, which it never is here. */
  margin-bottom: var(--space-1h);
}
.page-breadcrumb a { color: inherit; text-decoration: none; }
.page-breadcrumb a:hover { color: var(--primary-color); }
/* Cleaner than the legacy opacity:0.45 subtitle — a real muted token. */
.page-subtitle {
  color: var(--text-secondary);
  font-size: var(--text-base);
  margin: var(--space-1) 0 0;
  font-weight: 400;
  line-height: var(--leading-relaxed);
}
@media (max-width: 768px) {
  .page-header-row { flex-direction: column; align-items: stretch; }
  .page-header-actions { margin-top: var(--space-2); }
}

/* --- Stat Value / Label (inline stat displays) --- */
.stat-value {
  /* v2 spec §3.6: inline stat numbers share the KPI Newsreader treatment.
   * Templates that want a smaller or plain-sans stat should override
   * font-family/size locally. */
  font-family: var(--font-display);
  font-size: 1.5rem /* drawn size, Newsreader */;
  font-weight: 500;
  font-variation-settings: "opsz" 60;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  line-height: var(--leading-tight);
}
.stat-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  /* Was color+opacity:.5 → ~4.1:1 at 11px, AA fail (P0-10). */
  color: var(--text-secondary);
  margin-top: 2px;
}

/* --- Glass Card --- */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--glass-shadow);
  transition: border-color var(--transition-normal);
}
.glass-card:hover {
  border-color: rgba(217, 119, 6, 0.2);
}

/* --- Result Card --- */
.result-card {
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
  position: relative;
}
.result-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-color), var(--cyan-color));
  opacity: 0;
  transition: opacity var(--transition-normal);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.result-card:hover::before { opacity: 1; }
.result-card:hover {
  border-color: rgba(217, 119, 6, 0.2);
  box-shadow: var(--shadow-card-hover);
}
.result-card h5 {
  color: var(--primary-color);
  font-weight: 600;
  font-size: var(--text-lg);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- Data Tables --- */
.data-table, .admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}
.data-table th, .admin-table th {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--input-border);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-color);
  opacity: 0.65;  /* WCAG AA: 4.8:1 at 11px text (was 0.5 at 3.8:1) */
  white-space: nowrap;
  /* Sticky: header row stays visible while the long body scrolls inside
   * its overflow container. background is opaque so row content doesn't
   * show through as it scrolls under. z-index keeps it above any row-
   * level borders and sticky first-column cells. */
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 2;
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 1;
}
.data-table td, .admin-table td {
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--input-border);  /* crisp hairline, matches th + the Alerts queue (was the fainter --glass-border) */
  transition: background-color var(--transition-fast);
  vertical-align: middle;
  color: var(--text-color);
}
body.light-mode .data-table th,
body.light-mode .admin-table th {
  background: var(--panel-bg);
}
body.light-mode .data-table tr:hover td,
body.light-mode .admin-table tr:hover td {
  background-color: rgba(217, 119, 6, 0.05);  /* brand copper @ 5% — was blue in v1 */
}
.data-table tr:hover td, .admin-table tr:hover td { background-color: rgba(217, 119, 6, 0.07); }
/* Left-edge accent on hover: a 3px primary-colour bar appears on the
 * first cell of the row. Implemented as an inset box-shadow (not a
 * border-left + padding trick) so there's zero layout shift between
 * hover states. Rows that are clickable pick up an obvious
 * "selectable" affordance without cluttering non-hover state. */
.data-table tbody tr:hover td:first-child,
.admin-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--primary-color);
}
/* Header's sticky background wins over any hover box-shadow; explicit
 * reset keeps the header visually clean. */
.data-table thead tr:hover td:first-child,
.admin-table thead tr:hover td:first-child { box-shadow: none; }
/* Keyboard-navigation active row (J/K/Arrow keys move this). Stronger
 * visual treatment than hover — left-edge rail stays lit AND the row
 * gets a warmer background + a faint ring — so users know which row
 * Enter will open. Separate from :hover so simultaneous mouse-hover
 * on a different row doesn't take precedence. */
.data-table tbody tr.kbd-active td,
.admin-table tbody tr.kbd-active td {
  background-color: rgba(217, 119, 6, 0.11);  /* brand copper @ 11% — keyboard-active */
}
.data-table tbody tr.kbd-active td:first-child,
.admin-table tbody tr.kbd-active td:first-child {
  box-shadow: inset 3px 0 0 var(--primary-color);
}
body.light-mode .data-table tbody tr.kbd-active td,
body.light-mode .admin-table tbody tr.kbd-active td {
  background-color: rgba(217, 119, 6, 0.08);
}
.data-table tr:last-child td, .admin-table tr:last-child td { border-bottom: none; }

/* --- Page Tabs (horizontal navigation bar) ---
 * Promoted from ransomware.html / attack_surface.html inline styles. Use
 * this pattern whenever a page has 3-6 mutually-exclusive content sections
 * and needs a visible top-level switcher. The admin console uses it as a
 * group switcher above its sidebar. Each .page-tab-pane is hidden until
 * its matching .page-tab is active.
 *
 *   <div class="page-tabs">
 *     <button class="page-tab active" data-tab="a">Tab A</button>
 *     <button class="page-tab"        data-tab="b">Tab B</button>
 *   </div>
 *   <div class="page-tab-pane active" data-tab="a">…</div>
 *   <div class="page-tab-pane"        data-tab="b">…</div>
 */
.page-tabs {
  display: flex;
  gap: 0;
  margin-bottom: var(--space-4);
  /* Hairline (1px) matches .nav-tabs so both tab systems have the same
   * edge weight. Was 2px in v1 — the extra pixel felt heavy below the
   * uppercase tab labels. */
  border-bottom: 1px solid var(--input-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.page-tab {
  /* v2 spec §10.25: page-level tab system now shares the boxed treatment
   * with .nav-tabs. Active state renders as a filled panel that lifts
   * above the page background (surface-2 on surface-1). Uppercase label
   * + letter-spacing kept — that's the visual signature that distinguishes
   * page-tabs (top-level section switcher) from nav-tabs (sub-navigation).
   *
   * For the admin.html special case where page-tabs sit on a card-bg
   * wrapper, the active fill is overridden to surface-3 in that scope
   * so the active state stays visible. */
  padding: var(--space-2h) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  /* The idle→hover→active ramp is TOKEN-driven, not opacity-driven. It used to
   * be --text-color at .65 → .95 → 1, and the idle step measured 4.40:1 in
   * light against AA's 4.5 — a tab label 0.1 short of legible. Opacity was
   * duplicating the ink ramp badly; --text-secondary IS the idle step, is
   * audited on this ground, and leaves hover free to go to full --text-color
   * as an actual increase rather than a smaller decrease. */
  color: var(--text-secondary);
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: transparent;
  margin-bottom: -1px;  /* overlap the parent's bottom hairline */
  transition: background var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast),
              opacity var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}
.page-tab:hover:not(.active) {
  /* No opacity: with the idle step now on --text-secondary at full strength,
   * a 0.95 here would DIM the hover state instead of lifting it. The colour
   * change to full --text-color is the lift. */
  color: var(--text-color);
  background: var(--brand-tint);
  border-color: var(--input-border);
}
.page-tab.active {
  /* No `opacity: 1` — its job was resetting the idle dim, and there is no
   * longer an idle dim to reset. A declaration whose job has gone is drift. */
  background: var(--card-bg);
  /* top / right+left / bottom — bottom blends with content panel */
  border-color: var(--input-border) var(--input-border) var(--card-bg);
  color: var(--primary-color);
}
.page-tab:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.page-tab i,
.page-tab .cyn-icon {
  font-size: var(--text-xs);
  opacity: 0.85;
}
.page-tab.active i,
.page-tab.active .cyn-icon { opacity: 1; }
.page-tab-pane { display: none; }
.page-tab-pane.active { display: block; }

/* --- Tab Bar (lightweight variant, v2 §10.27) ---
 * CANONICAL tab system for NEW code (IMP-E). The two others — .page-tabs
 * (above) and the Bootstrap .nav-tabs override (below) — are legacy; prefer
 * .tab-bar for new surfaces.
 * The third tab system in the app, used for simple 2-3 tab switches
 * inside a page's content area. Mechanically identical to .nav-tabs
 * (boxed active state, copper hover tint, paper-fold bottom edge),
 * but the button selector targets bare <button> children so templates
 * don't have to wrap each tab in <li class="nav-item"><a class="nav-link">.
 *
 *   <div class="tab-bar">
 *     <button class="active" onclick="…">Feed</button>
 *     <button onclick="…">Analytics</button>
 *   </div>
 *
 * Consumers: dashboard.html (Feed / Analytics), telegram_groups.html,
 * bulk_ioc.html. Replaces 3 near-identical local CSS blocks (was a
 * 2px bare underline pattern in each). */
.tab-bar {
  display: flex;
  gap: 0;
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--input-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-bar button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: var(--space-2h) var(--space-4);
  margin-bottom: -1px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  /* Token-driven idle step, same change and same reason as .page-tab. */
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1h);
  transition: background var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast),
              opacity var(--transition-fast);
}
.tab-bar button:hover:not(.active) {
  /* Colour, not opacity — see .page-tab:hover:not(.active). This rule set no
   * colour at all before, relying on the parent's dimmed --text-color, so the
   * hover lift was 0.65→0.95 of an already-failing ink. */
  color: var(--text-color);
  background: var(--brand-tint);
  border-color: var(--input-border);
}
.tab-bar button.active {
  /* No `opacity: 1` — see .page-tab.active. */
  font-weight: 600;
  /* --amber-text, not --primary-color: a 12px WORD on the card, and the fill
     token measured 3.67:1 on the white card in light (2026-09-05). */
  color: var(--amber-text);
  background: var(--card-bg);
  border-color: var(--input-border) var(--input-border) var(--card-bg);
}
.tab-bar button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.tab-bar button i,
.tab-bar button .cyn-icon { opacity: 0.75; }
.tab-bar button.active i,
.tab-bar button.active .cyn-icon { opacity: 1; }
/* Content panes paired with .tab-bar (same contract as .page-tab-pane). */
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* --- Data Tables v2: opt-in modifiers ---
 * Added 2026-04-19 as part of the UI polish wave 13 (feature-dev Point 3).
 * Pages adopt incrementally by adding these modifier classes to their
 * existing <table class="data-table">; no HTML structural changes needed.
 *
 *   <table class="data-table data-table-zebra data-table-sortable">
 *     <thead>
 *       <tr>
 *         <th class="sortable" data-sort-type="str">Domain</th>
 *         <th class="sortable c-num" data-sort-type="num">Risk</th>
 *         <th data-priority="low">Notes</th>  <!-- hidden on <768px -->
 *       </tr>
 *     </thead>
 *     ...
 *   </table>
 *
 * Then call Cyntel.enhanceTable(tableEl) once to wire sort clicks.
 */

/* Zebra striping retired (2026-07-11): the crisp full-bleed row divider does
 * the row separation now, matching the Alerts queue (which has no zebra). The
 * .data-table-zebra / .admin-table-zebra classes are kept as inert no-ops so
 * existing markup needn't be touched; do NOT re-add alt-row shading. */

/* ── Full-bleed table frame — the "Alerts look" ─────────────────────────────
 * The crisp look on the Alerts queue = the bordered box IS the frame, rows
 * bleed edge-to-edge to it, no zebra. Two ways to get it on a real <table>:
 *   • .panel.table-host — a .panel that hosts a data table: the panel's own
 *     border+radius becomes the frame; the table bleeds to it while the
 *     title / filter-chips / pagination children stay inset (like #alerts-list
 *     with its toolbar above it).
 *   • .data-table-card — a standalone bordered frame for a table with no
 *     surrounding panel (e.g. a bare tab-pane table).
 * The table wrapper scrolls horizontally; corners follow the ransomware
 * precedent (bg-matched, no clip) so wide tables never get cut off. */
.panel.table-host { padding: 0; box-shadow: none; }
.panel.table-host > .panel-title { padding: var(--space-3h) var(--space-4) var(--space-2h); margin: 0; }
.panel.table-host > .filter-chips,
.panel.table-host > .active-filters,
.panel.table-host > .active-filter-chips { padding: 0 var(--space-4) var(--space-2h); margin: 0; }
.panel.table-host > .toolbar-row { padding: var(--space-3) var(--space-4) var(--space-2h); margin: 0; }
.panel.table-host > .pagination-wrapper { padding: var(--space-2h) var(--space-4); }
.panel.table-host > .table-responsive { overflow-x: auto; }

.data-table-card {
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  overflow-x: auto;
  /* Second host for the `tbl` container (see .table-responsive below).
     .data-table-card is the standalone-frame sibling of .table-responsive,
     so a table framed this way must adapt identically — otherwise the same
     table gets density steps in a panel and none in a tab-pane. Covers
     phishing #candTable, the cve_intelligence JS results table, and the
     telegram_discovery #groupsList host. */
  container-type: inline-size;
  container-name: tbl;
}

/* RTL: the hover row-rail moves to the inline-start (right) edge. */
[dir="rtl"] .data-table tbody tr:hover td:first-child,
[dir="rtl"] .admin-table tbody tr:hover td:first-child,
[dir="rtl"] .data-table.data-table-hover-lift tbody tr:hover td:first-child {
  box-shadow: inset -3px 0 0 0 var(--primary-color);
}

/* Hover lift via inset box-shadow on first cell (gives subtle left-border
 * indicator for scan-tracking the current row without adding real borders
 * that would collapse with cell borders). */
.data-table.data-table-hover-lift tbody tr:hover td:first-child,
.admin-table.admin-table-hover-lift tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 0 var(--primary-color);
}

/* Density modifiers — .compact existed already (padding-only), .dense is
 * a stronger variant that also reduces font-size and tightens line-height */
.data-table.data-table-dense th,
.data-table.data-table-dense td,
.admin-table.admin-table-dense th,
.admin-table.admin-table-dense td {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  line-height: var(--leading-tight);
}

/* Numeric columns — right-align + tabular-nums keeps digits aligned so
 * 1,234 and 56,789 stack on their decimal positions. Apply .c-num to BOTH
 * the <th> and all <td>s in the column (no :nth-child magic; easier to
 * read in HTML). */
.data-table th.c-num,
.data-table td.c-num,
.admin-table th.c-num,
.admin-table td.c-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Sortable column headers — click to toggle asc/desc. Caret is rendered
 * via ::after pseudo-element so the sort helper only needs to toggle
 * .c-sort-asc / .c-sort-desc on the <th>. */
.data-table th.sortable,
.admin-table th.sortable {
  cursor: pointer;
  user-select: none;
  padding-right: 26px;          /* leave room for caret */
  position: relative;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}
.data-table th.sortable:hover,
.admin-table th.sortable:hover {
  opacity: 1;                    /* un-dim the dimmed header on hover */
  color: var(--primary-color);
}
.data-table th.sortable::after,
.admin-table th.sortable::after {
  content: "\f0dc";              /* fa-sort (both arrows, neutral state) */
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
  font-weight: 900;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--text-2xs);
  opacity: 0.35;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}
.data-table th.sortable.c-sort-asc::after,
.admin-table th.sortable.c-sort-asc::after {
  content: "\f0de";              /* fa-sort-up */
  opacity: 1;
  color: var(--primary-color);
}
.data-table th.sortable.c-sort-desc::after,
.admin-table th.sortable.c-sort-desc::after {
  content: "\f0dd";              /* fa-sort-down */
  opacity: 1;
  color: var(--primary-color);
}

/* Mobile column priority — hides non-essential columns under breakpoints
 * without forcing horizontal scroll. Apply data-priority to BOTH the <th>
 * and every <td> in the column. Three tiers so pages can hide aggressively
 * only on the smallest screens. */
@media (max-width: 1024px) {
  .data-table [data-priority="low"],
  .admin-table [data-priority="low"] { display: none; }
}
@media (max-width: 768px) {
  .data-table [data-priority="medium"],
  .admin-table [data-priority="medium"] { display: none; }
}
@media (max-width: 480px) {
  .data-table [data-priority="high"],
  .admin-table [data-priority="high"] { display: none; }
}

/* IMP-D: responsive card-stack for data tables. data-priority hides low-value
 * columns on mobile, but a wide table can still end up an unlabelled scroll/
 * single column. Opt in instead by adding .data-table--stack to the <table>
 * and data-label="Column" to each <td>: the header hides and every row becomes
 * a label:value card, so all columns stay readable + labelled.
 * (Reference: GitHub's mobile table treatment.)
 * The rules themselves live at the END of this file, next to the container-
 * query blocks — see "Container-query density + restructure" — so the
 * viewport-keyed and container-keyed copies sit side by side and stay in sync. */

/* Overflow-scroll affordance — a gradient on the right edge of the
 * wrapper when the table overflows horizontally. Tells users they can
 * scroll sideways without needing a visible scrollbar (mobile hides
 * those by default). Applied via .table-responsive which already exists
 * and wraps data-tables in most pages. */
.table-responsive {
  position: relative;
  /* CONTAINER QUERIES for the shared table system (2026 P1).
     Declaring the container is inert by itself; the @container tbl blocks that
     read it live at the END of this file (see "Container-query density +
     restructure"), because they must come AFTER the max-width:768px mobile
     block to win the cascade. .data-table-card is the second tbl host. */
  container-type: inline-size;
  container-name: tbl;
}
.table-responsive.is-scrollable-x::after {
  content: "";
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 36px;
  background: linear-gradient(to left, var(--card-bg), transparent);
  pointer-events: none;
  opacity: 0.75;
}

/* ============================================================================
   Canonical list-row (.lrow) — the shared faux-table for interactive record
   lists. Row-system unification (2026-07-12): extracted from Detection Lab's
   grid so Alerts / CVE / IOC / Ransomware can share ONE row shell instead of
   four page-local copies. This owns only the grid shell, header, hover, and
   group-header; per-page cell-content classes stay page-local. Column template
   is supplied per page via the --lrow-cols custom property (set on .lrows), so
   column count/widths stay page-tunable without new classes. Pairs with the
   shared .preview-* slide-over drawer + Cyntel.renderPagination.
   ============================================================================ */
.lrow-wrap {
  overflow-x: auto; border: 1px solid var(--input-border);
  border-radius: var(--radius-md); background: var(--card-bg);
  /* CONTAINER QUERIES — 2026 platform P1.
     Makes the row system respond to ITS OWN width rather than the viewport's.
     This is the fix for the "four row systems" drift the UI re-audit found:
     the same .lrow renders full-width on a list page, ~420px inside the shared
     .preview-* slide-over, and narrower again in a split pane — situations a
     viewport media query cannot tell apart, which is exactly why the variants
     were forked in the first place. One definition now covers all three.
     Declaring the container is inert on its own; only the @container blocks
     below read it, and engines without support keep the wide layout. */
  container-type: inline-size;
  container-name: lrow;
}
/* .lrows: the inner container; each page sets --lrow-cols (+ optional min-width) here */
.lrow-head, .lrow {
  display: grid;
  grid-template-columns: var(--lrow-cols);
  column-gap: var(--space-2h);
  padding: 0 var(--space-2h);
  align-items: center;
}
.lrow-head { background: color-mix(in srgb, var(--text-color) 3%, transparent); border-bottom: 1px solid var(--input-border); }
.lrow-head .th {
  font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-secondary); padding: var(--space-2h) var(--space-1);
  text-align: start; display: flex; align-items: center; gap: var(--space-1); white-space: nowrap;
}
.lrow-head .th.sortable { cursor: pointer; user-select: none; }
.lrow-head .th.sortable:hover { color: var(--text-color); }
.lrow-head .th .ar { font-style: normal; opacity: 0; color: var(--primary-color); }
.lrow-head .th.asc .ar, .lrow-head .th.desc .ar { opacity: 1; }
.lrow-head .th.asc .ar::before { content: "\25B2"; }
.lrow-head .th.desc .ar::before { content: "\25BC"; }
.lrow { border-bottom: 1px solid var(--input-border); min-height: var(--space-9); cursor: pointer; transition: background var(--transition-fast); }
.lrow:last-child { border-bottom: none; }
.lrow:hover { background: color-mix(in srgb, var(--primary-color) 6%, transparent); }
/* default cell typography; per-page cells override font/color as needed */
.lrow > * {
  padding: var(--space-2) var(--space-1); font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--text-secondary); min-width: 0; text-align: start; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.lrow .sev-badge { justify-self: start; }

/* ── @container: the row adapts to its own box — MOVED 2026-08-25 ──────────
   The two `@container lrow` blocks that lived here are now in
   page-archetypes.css §7b, immediately after `.lrow-head, .lrow`.

   THEY COULD NEVER WORK FROM THIS FILE. `.lrow-head, .lrow` in
   page-archetypes.css re-declares `display` and `grid-template-columns` at the
   same (0,1,0) specificity; an @container prelude adds no specificity of its
   own; and every archetype emits that sheet from `{% block head %}`, after
   app.py has already emitted this one. Source order broke the tie the wrong
   way, so the wide template held at EVERY container width and both blocks were
   dead code on all 36 pages that render a ledger.

   Nothing is lost by their leaving: no template emits `.lrow` / `.lrow-head` /
   `.lrow-wrap` without extending an archetype, so there is no consumer of this
   file that is not also a consumer of that one. If a LEGACY page ever grows a
   ledger again it needs its own copy HERE — not a move back, which would only
   re-break the archetype pages. tests/test_ledger_narrow_collapse.py pins all
   of this. */
/* group-by header row spanning the grid (max-severity dot + collapse) */
.lrow-group { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-2h); background: color-mix(in srgb, var(--text-color) 2.5%, transparent); border-bottom: 1px solid var(--input-border); cursor: pointer; font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-secondary); }
.lrow-group .tri { transition: transform var(--transition-fast); }
.lrow-group.open .tri { transform: rotate(90deg); }
.lrow-group b { color: var(--text-color); font-weight: 500; }
.lrow-group .cnt { color: var(--text-color); }
.lrow-group .gd { width: 7px; height: 7px; border-radius: var(--radius-sm); background: var(--text-secondary); flex: none; }
.lrow-group .gd.critical { background: var(--sev-critical-text); }
.lrow-group .gd.high { background: var(--sev-high-text); }
.lrow-group .gd.medium { background: var(--sev-medium-text); }
.lrow-group .gd.low { background: var(--sev-low-text); }

/* --- Filter Chips ---
 * A pill row showing active filters above a data-table. Clicking the ×
 * removes the filter and fires a callback. Driven by Cyntel.renderFilterChips.
 *
 *   <div id="myChips" class="filter-chips"></div>
 *   Cyntel.renderFilterChips('#myChips',
 *     [{ key: 'sev', label: 'Severity: High' }],
 *     (key) => { removeFilter(key); });
 */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  min-height: 40px;
  align-items: center;
}
.filter-chips:empty {
  display: none;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1h);
  padding: 4px 4px 4px 10px;
  background: var(--overlay-soft);
  border: 1px solid var(--input-border);
  border-radius: 0;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-color);
  line-height: 1;
  transition: var(--transition-fast); transition-property: var(--paint-props);
}
.filter-chip:hover {
  background: var(--glow-primary);
  border-color: var(--primary-color);
}
.filter-chip .chip-remove {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  width: 20px; height: 20px;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: var(--text-xs);
  transition: var(--transition-fast); transition-property: var(--paint-props);
  padding: 0;
}
.filter-chip .chip-remove:hover {
  background: var(--sev-critical-bg);
  color: var(--sev-critical-text);
}
.filter-chip.filter-chip-clear {
  /* "Clear all" variant — no × button, different color */
  padding: 4px 10px;
  color: var(--sev-critical-text);
  background: var(--sev-critical-bg);
  border-color: var(--sev-critical-bg);
  cursor: pointer;
}
.filter-chip.filter-chip-clear:hover {
  background: var(--sev-critical);
  color: #fff;
}

/* --- Severity Badges (Opacity-Based for Dark Mode) --- */
/* .sev-badge base moved to its single canonical definition further down
 * (search "the ONE canonical base"). This v1 base was value-identical after
 * cascade with the v2 one, so it was removed (UI_POLISH_AUDIT Wave 3). The
 * colour-variant selectors below stay — they carry the `.critical`/
 * `.sev-badge-critical`/`.tag.sev-critical` naming scheme used by 6 templates. */
.sev-badge-critical, .sev-badge.critical, span.sev-critical, .tag.sev-critical {
  background: var(--sev-critical-bg);
  color: var(--sev-critical-text);
  border: 1px solid rgba(220, 38, 38, 0.2);
}
.sev-badge-high, .sev-badge.high, span.sev-high, .tag.sev-high {
  background: var(--sev-high-bg);
  color: var(--sev-high-text);
  border: 1px solid rgba(234, 88, 12, 0.2);
}
.sev-badge-medium, .sev-badge.medium, span.sev-medium, .tag.sev-medium {
  background: var(--sev-medium-bg);
  color: var(--sev-medium-text);
  border: 1px solid rgba(217, 119, 6, 0.2);
}
.sev-badge-low, .sev-badge.low, span.sev-low, .tag.sev-low {
  background: var(--sev-low-bg);
  color: var(--sev-low-text);
  border: 1px solid rgba(37, 99, 235, 0.2);
}
.sev-badge-info, .sev-info {
  background: var(--sev-info-bg);
  color: var(--sev-info-text);
  border: 1px solid rgba(107, 114, 128, 0.2);
}

/* §W11 / audit F-001 — TLP traffic-light badges
 * FIRST.org TLP 2.0 markings displayed on every CTI surface that renders
 * a card / envelope / brief / citation. The four colors are spec — do
 * not theme-shift them, the meaning depends on the colour matching the
 * standard. Compact pill shape matches sev-badge so they nest cleanly.
 */
.tlp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  font-family: var(--font-mono, monospace);
}
/* Leading colour dot (the gap:4px above reserves room for it). Moved here
   from a duplicate .tlp-badge block that was de-duped — see UI-6. */
.tlp-badge::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; background: currentColor; flex: 0 0 auto;
}
/* TLP:CLEAR (formerly TLP:WHITE under v1) */
.tlp-badge.tlp-clear,
.tlp-badge.tlp-white {
  background: rgba(255, 255, 255, 0.12);
  color: #F9FAFB;
  border-color: rgba(255, 255, 255, 0.45);
}
.tlp-badge.tlp-green {
  background: rgba(34, 197, 94, 0.15);
  color: #4ADE80;
  border-color: rgba(34, 197, 94, 0.45);
}
.tlp-badge.tlp-amber {
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  border-color: rgba(245, 158, 11, 0.45);
}
/* TLP:AMBER+STRICT — same hue as amber but a stronger border to
 * signal the additional do-not-redistribute restriction. */
.tlp-badge.tlp-amber-strict {
  background: rgba(245, 158, 11, 0.20);
  color: #FBBF24;
  border-color: #F59E0B;
  border-width: 2px;
}
.tlp-badge.tlp-red {
  background: rgba(220, 38, 38, 0.15);
  color: #F87171;
  border-color: rgba(220, 38, 38, 0.55);
}
body.light-mode .tlp-badge.tlp-clear,
body.light-mode .tlp-badge.tlp-white {
  background: #FAF8F4;
  color: #121214;
  border-color: #A8A096;
}
body.light-mode .tlp-badge.tlp-green {
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
  border-color: rgba(34, 197, 94, 0.55);
}
body.light-mode .tlp-badge.tlp-amber {
  background: rgba(245, 158, 11, 0.12);
  color: #92400E;
  border-color: rgba(245, 158, 11, 0.55);
}
body.light-mode .tlp-badge.tlp-amber-strict {
  background: rgba(245, 158, 11, 0.18);
  color: #78350F;
  border-color: #B45309;
  border-width: 2px;
}
body.light-mode .tlp-badge.tlp-red {
  background: rgba(220, 38, 38, 0.12);
  color: #991B1B;
  border-color: rgba(220, 38, 38, 0.55);
}

/* --- PAP (Permissible Actions Protocol) badges (UI-7) ---
 * Governs what ACTIONS may be taken on the intel (vs TLP = who may SEE it).
 * Enforced server-side since migration 049 but previously had no UI. Same
 * 4-level scheme as TLP, deliberately distinct: a DASHED border + a SQUARE
 * marker (TLP uses solid border + round dot) so the two are never confused.
 * Theme-aware via semantic tokens. */
.pap-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; border: 1px dashed currentColor;
  font-family: var(--font-mono, monospace);
}
.pap-badge::before {
  content: ''; width: 7px; height: 7px; border-radius: 1px;  /* square = PAP */
  display: inline-block; background: currentColor; flex: 0 0 auto;
}
.pap-badge.pap-clear, .pap-badge.pap-white { color: var(--text-secondary); }
.pap-badge.pap-green { color: var(--success-color); }
.pap-badge.pap-amber, .pap-badge.pap-amber-strict { color: var(--warning-color); }
.pap-badge.pap-red { color: var(--danger-color); }

/* Legacy badge classes (backward compat — map to new system) */
.badge-safe, .badge-clean { background: var(--sev-low-bg) !important; color: var(--sev-low-text) !important; border: 1px solid rgba(37, 99, 235, 0.2); }
.badge-warning, .badge-medium { background: var(--sev-medium-bg) !important; color: var(--sev-medium-text) !important; border: 1px solid rgba(217, 119, 6, 0.2); }
.badge-danger, .badge-high, .badge-critical { background: var(--sev-critical-bg) !important; color: var(--sev-critical-text) !important; border: 1px solid rgba(220, 38, 38, 0.2); }
.badge-info { background: rgba(217, 119, 6, 0.12) !important; color: var(--sev-medium-text) !important; border: 1px solid rgba(217, 119, 6, 0.2); }
.badge-unknown { background: var(--sev-info-bg) !important; color: var(--sev-info-text) !important; border: 1px solid rgba(107, 114, 128, 0.2); }

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
}
/* Case-lifecycle status colours (§respond-workspace row unification,
   2026-07-23). Promoted from cases.html's local <style> when case_detail
   became the second consumer — the detail header used to hand-roll an
   inline-styled badge (hardcoded rgba(255,255,255,.1) — an invisible wash in
   light mode) while the list rendered the same status through these classes.
   Blue/amber family on purpose: status states are banned from copper. */
.status-badge.status-open          { background: rgba(217, 119, 6, 0.15);  color: var(--link-color); }
.status-badge.status-investigating { background: rgba(251, 191, 36, 0.15); color: var(--warning-color); }
.status-badge.status-containment   { background: rgba(249, 115, 22, 0.15); color: var(--orange-color); }
.status-badge.status-closed,
.status-badge.status-remediated    { background: rgba(16, 185, 129, 0.15); color: var(--success-color); }
.status-badge.status-false_positive { background: rgba(100, 116, 139, 0.15); color: var(--text-secondary); }
.status-badge-success { background: rgba(16, 185, 129, 0.12); color: #6EE7B7; border: 1px solid rgba(16, 185, 129, 0.2); }
.status-badge-warning { background: rgba(245, 158, 11, 0.12); color: #FCD34D; border: 1px solid rgba(245, 158, 11, 0.2); }
.status-badge-error   { background: rgba(239, 68, 68, 0.12); color: #FCA5A5; border: 1px solid rgba(239, 68, 68, 0.2); }
.status-badge-pending { background: rgba(107, 114, 128, 0.12); color: #D1D5DB; border: 1px solid rgba(107, 114, 128, 0.2); }
.status-badge-active  { background: rgba(217, 119, 6, 0.12); color: #FCD34D; border: 1px solid rgba(217, 119, 6, 0.2); }

/* --- Pill depth (premium polish) ---
 * Adds a 1px inset top-highlight to every pill-shaped classification
 * badge so they read as dimensional glass chips rather than flat fills.
 * The highlight is white with 8% alpha — subtle enough that it doesn't
 * change the badge's color identity in either theme, but enough to
 * catch the eye and make the UI feel less 2013.
 *
 * Grouped attribute selectors keep the rule short; the explicit list
 * for span.sev-* is needed because those classes don't start with
 * `sev-badge-`. */
[class^="sev-badge-"], .sev-badge,
span.sev-critical, span.sev-high, span.sev-medium, span.sev-low, span.sev-info,
.tag.sev-critical, .tag.sev-high, .tag.sev-medium, .tag.sev-low,
.status-badge, [class^="status-badge-"],
.tlp-badge, .priority-badge,
[class^="badge-"] {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
/* In light mode the white highlight vanishes into the light background.
 * Swap to a faint dark inner-ring instead so the pill still has a sense
 * of edge. Same visual weight, different direction. */
body.light-mode [class^="sev-badge-"], body.light-mode .sev-badge,
body.light-mode span.sev-critical, body.light-mode span.sev-high, body.light-mode span.sev-medium, body.light-mode span.sev-low, body.light-mode span.sev-info,
body.light-mode .tag.sev-critical, body.light-mode .tag.sev-high, body.light-mode .tag.sev-medium, body.light-mode .tag.sev-low,
body.light-mode .status-badge, body.light-mode [class^="status-badge-"],
body.light-mode .tlp-badge, body.light-mode .priority-badge,
body.light-mode [class^="badge-"] {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   Unified Shared Components (consolidated from templates)
   ========================================================================== */

/* --- Stat Card (single definition for all pages) --- */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--brand-glow);
}
.stat-card .stat-icon {
  font-size: var(--text-lg);
  color: var(--primary-color);
  margin-bottom: var(--space-1);
  opacity: 0.7;
}
.stat-card h3 {
  margin: 0;
  /* v2 spec §3.6: KPI numbers render in Newsreader for editorial weight
   * (matches the metric-card preview spec). opsz 60 opens up the glyphs
   * at display size; tabular-nums keeps number columns aligned across
   * a row of stat cards. -0.035em tracking is the spec's display tight. */
  font-family: var(--font-display);
  font-size: 1.5rem /* drawn size, Newsreader */;
  font-weight: 500;
  font-variation-settings: "opsz" 60;
  letter-spacing: -0.035em;
  color: var(--text-color);
  font-variant-numeric: tabular-nums;
  line-height: var(--leading-tight);
}
.stat-card p {
  margin: var(--space-1) 0 0;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-color);
  opacity: 0.65;  /* WCAG AA: raised from 0.5 for small text contrast */
}
.stat-card.stat-danger  { border-left: 3px solid var(--sev-critical); }
.stat-card.stat-warning { border-left: 3px solid var(--sev-medium); }
.stat-card.stat-info    { border-left: 3px solid var(--info-color); }
.stat-card.stat-success { border-left: 3px solid var(--success-color); }

/* --- Stats Row Grid --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

/* --- Panel / Card Container --- */
.panel {
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-card);
}
.panel-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 var(--space-3);
  color: var(--text-color);
  opacity: 0.55;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.panel-title i { color: var(--primary-color); opacity: 0.6; }

/* --- Toolbar Row --- */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-2);
}
.toolbar .btn {
  font-size: var(--text-sm);
  padding: var(--space-1h) var(--space-3h);
  border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════════════════════════════════
   Shared Pagination component (Cyntel.renderPagination)
   ──────────────────────────────────────────────────────────────────
   One set of styles for every paginated list in the app. Before
   this block existed, Dashboard / CVE / IOC pages each had their
   own pagination CSS — which meant every page had a different
   dark-mode bug to fix independently (IOC's per-page <select> was
   white in dark mode because the per-page local CSS didn't set
   theme tokens). Now any page using Cyntel.renderPagination gets
   the theme-aware treatment for free.

   The markup this styles:
     <div class="pagination">
       <span class="pagination-info">Showing X-Y of Z items</span>
       <div class="pagination-controls">
         <select class="pagination-page-size">…</select>  (optional)
         <div class="pagination-pages">
           <button class="pg-btn">«</button>
           <button class="pg-btn">‹ Prev</button>
           <button class="pg-btn">1</button>
           <button class="pg-btn active">2</button>
           <span class="pg-ellipsis">…</span>
           <button class="pg-btn">79</button>
           <button class="pg-btn">Next ›</button>
           <button class="pg-btn">»</button>
         </div>
       </div>
     </div>

   The Cyntel.renderPagination helper applies the .pagination
   class at render time, so container <div>s only need to exist
   empty — the helper handles class, display, and contents. */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-4);
  padding: var(--space-2) 0;
}
.pagination-info {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  /* No opacity — see .page-breadcrumb. This is the line that says which rows
   * you are looking at out of how many; 3.78:1 dark / 3.53:1 light. */
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.pagination-page-size {
  padding: 4px 8px;
  font-size: var(--text-sm);
  /* Theme-aware — previously the IOC page's <select> inherited
     user-agent defaults (white-on-white in dark mode). Using
     tokens here fixes it everywhere at once. */
  background: var(--button-bg);
  color: var(--text-color);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.pagination-page-size:hover {
  border-color: var(--primary-color);
}
.pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pagination .pg-btn {
  min-width: 34px;
  padding: 4px 10px;
  font-size: var(--text-sm);
  background: var(--button-bg);
  color: var(--text-color);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast);
}
.pagination .pg-btn:hover:not(:disabled):not(.active) {
  border-color: var(--primary-color);
  color: var(--primary-color);
}
.pagination .pg-btn.active {
  background: var(--primary-color);
  color: var(--text-on-accent);
  border-color: var(--primary-color);
}
.pagination .pg-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.pagination .pg-ellipsis {
  padding: 0 6px;
  color: var(--text-secondary);
  opacity: 0.5;
  user-select: none;
}

/* --- Info Banner --- */
.info-banner {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  color: var(--text-color);
  font-size: var(--text-base);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.info-banner i {
  color: var(--info-color);
  font-size: var(--text-lg);
  opacity: 0.7;
}

/* --- Tabular Numerals (global for data-heavy views) --- */
.data-table td, .admin-table td,
.stat-card h3,
.stats-row h3 {
  font-variant-numeric: tabular-nums;
}

/* Compact table variant (for dense data like intelligence trends) */
.data-table.compact th, .admin-table.compact th { padding: var(--space-1h) var(--space-2); }
.data-table.compact td, .admin-table.compact td { padding: var(--space-1h) var(--space-2); }

/* --- Input Groups --- */
.input-group-modern {
  position: relative;
  display: flex;
  gap: 0;
}
.input-group-modern .form-control {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  border-right: none;
  padding: 12px 16px;
  font-size: var(--text-md);
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-color);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}
.input-group-modern .form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--glow-primary);
  outline: none;
}
.input-group-modern .btn {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 12px 22px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* --- Global Form Controls --- */
.form-control,
/* ⚠ ONE SELECTOR LIST WAS DOING TWO JOBS, and the second one outranked the
   design system. Split, 2026-08-05.

   The COLOUR half is a theme override and stays exactly as it was: `!important`
   on background, border and ink, unbeatable on purpose, because a control must
   take the app's theme whatever component class it wears.

   The GEOMETRY half — radius, padding, font-size, transition — is a DEFAULT, and
   defaults are supposed to lose. At `input[type="text"]` it is (0,1,1), which
   beats every single-class rule in page-archetypes.css, and it beat three of
   them in one week:

     · `.pa-search` — the ledger toolbar's search rendered 43px tall beside
       34.75px selects and 4px off their centre line.
     · `.cn-section input` — every console field kept a 3px radius while the
       fields beside it were square, which needed an !important reset block.
     · `select.form-control` — its Bootstrap chevron survived the archetype's
       `background` shorthand and TILED about twenty-five times per dropdown.

   `:where()` matches identically and contributes ZERO specificity, so the same
   declarations now behave as the defaults they were written to be.

   ⚠ IT MOVED ELEVEN LEGACY CONTROLS TOO, and that is the fix reaching further
   than expected rather than a regression. /bulk_ioc's `.ioc-input` asks for
   `border-radius: var(--radius-sm)` and `font-size: var(--text-base)`; this
   block was forcing --radius-md and --text-md over it, so the page had never
   once rendered the geometry it declares. Measured before and after on its
   sixteen controls: 4px → 3px and 14px → 13px on the eleven that wear
   `.ioc-input`, colour and border unchanged. A page-local class overridden by a
   default is the same defect as an archetype class overridden by one; it was
   simply on a page nobody had measured. */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"],
input[type="search"],
input[type="tel"],
select.form-control,
select.form-select,
textarea.form-control {
  background-color: var(--input-bg) !important;
  border: 1px solid var(--input-border) !important;
  color: var(--text-color) !important;
}
:where(input[type="text"]),
:where(input[type="email"]),
:where(input[type="password"]),
:where(input[type="number"]),
:where(input[type="date"]),
:where(input[type="url"]),
:where(input[type="search"]),
:where(input[type="tel"]),
:where(select.form-control),
:where(select.form-select),
:where(textarea.form-control) {
  border-radius: var(--radius-md);
  padding: var(--space-2h) var(--space-3h);
  font-size: var(--text-md);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}
.form-control:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
select.form-control:focus,
select.form-select:focus,
textarea.form-control:focus {
  /* v2 spec §10.8: use the --focus-ring token (2px brand glow) so every
   * focusable surface in the app shares one consistent ring. The 3px
   * ring used in v1 (--glow-primary at 0.10 alpha) was noticeably
   * thicker than buttons' focus-visible rings — this unifies them. */
  border-color: var(--brand) !important;
  box-shadow: var(--focus-ring) !important;
  outline: none;
  background-color: var(--input-bg) !important;
  color: var(--text-color) !important;
}
/* Baseline theming for a bare native <select> so the many unclassed selects
   pick up the dossier tokens. Lowest specificity + no !important — any
   .form-*/.filter-group rule above, or an inline style, still wins. */
select {
  background-color: var(--input-bg);
  color: var(--text-color);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
}
textarea.form-control {
  resize: vertical;
  padding: 12px 16px;
}

/* --- Placeholder Text (WCAG AA: 0.55 opacity gives ~5.5:1 contrast) --- */
::placeholder {
  color: var(--text-color) !important;
  opacity: 0.55 !important;
}
::-webkit-input-placeholder {
  color: var(--text-color) !important;
  opacity: 0.55 !important;
}
::-moz-placeholder {
  color: var(--text-color) !important;
  opacity: 0.55 !important;
}
:-ms-input-placeholder {
  color: var(--text-color) !important;
  opacity: 0.55 !important;
}

/* --- Select Dropdown Arrow (dark mode) --- */
select.form-select,
select.form-control {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238b95a5' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  padding-right: 2.5rem;
  appearance: none;
  -webkit-appearance: none;
}

/* --- Disabled / Readonly States --- */
.form-control:disabled,
.form-control[readonly],
input:disabled,
select:disabled,
textarea:disabled {
  background-color: var(--button-bg) !important;
  color: var(--text-color) !important;
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- Select Option Styling --- */
select option {
  background-color: var(--card-bg);
  color: var(--text-color);
}

/* --- Form Labels --- */
.form-label {
  font-weight: 600;
  font-size: var(--text-xs);
  margin-bottom: var(--space-1);
  /* Was `--text-color` at `opacity: .6`, i.e. body ink dimmed 40% — 3.90:1 in
   * light against AA's 4.5, on the label telling you what to type into a
   * field. The intent was "quieter than body", and the ramp already has a step
   * for that; using it means the value is tuned once, in the ramp, instead of
   * re-derived per rule by an opacity nobody measured. */
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* --- Buttons (Primary / Secondary / Ghost / Danger / Success) ---
 *
 * Brand v2 full recipe (2026-04-23). Rewritten from scratch to match the
 * spec in New Design/components_v2.css and the preview at
 * New Design/preview/buttons.html. The v1 conventions this pass retires:
 *
 *   v1: padding: 8px 18px   ->  v2: height: 32px + padding: 0 12px
 *   v1: border-radius: 3px  ->  v2: border-radius: 5px (--radius-md)
 *   v1: font-size: 13px     ->  v2: font-size: 12px (--text-sm)
 *   v1: translateY(-1px) lift on hover  ->  v2: no lift, flat interaction
 *   v1: gloss highlight gradient        ->  v2: solid surface, no gloss
 *   v1: hover elevates shadow           ->  v2: hover adds glow-brand halo
 *
 * Font-weight stays 600, letter-spacing tightens to 0.01em, gap between
 * icon and label is 6px. Sizing is now height-based (via --btn-h custom
 * prop) so .btn-sm/.btn-lg only need to override the height and padding
 * — no rewrite of per-variant rules required.
 */

/* Shared recipe for every button variant. Applied to any element that
 * carries one of the variant classes below. */
.btn-primary, .btn-gradient,
.btn-secondary, .btn-outline,
.btn-ghost,
.btn-danger,
.btn-success {
  --btn-h: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-1h);
  height: var(--btn-h);
  padding: 0 var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--transition-hover),
              border-color var(--transition-hover),
              color var(--transition-hover),
              box-shadow var(--transition-hover);
}
.btn-primary:focus-visible, .btn-gradient:focus-visible,
.btn-secondary:focus-visible, .btn-outline:focus-visible,
.btn-ghost:focus-visible,
.btn-danger:focus-visible,
.btn-success:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.btn-primary:disabled, .btn-gradient:disabled,
.btn-secondary:disabled, .btn-outline:disabled,
.btn-ghost:disabled,
.btn-danger:disabled,
.btn-success:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}
/* Icons inside buttons track the button font size. */
.btn-primary .cyn-icon, .btn-gradient .cyn-icon,
.btn-secondary .cyn-icon, .btn-outline .cyn-icon,
.btn-ghost .cyn-icon,
.btn-danger .cyn-icon,
.btn-success .cyn-icon { width: 14px; height: 14px; flex-shrink: 0; }

/* Primary — filled copper, dark ink, brand-glow on hover. */
.btn-primary, .btn-gradient {
  background: var(--brand);
  color: var(--text-on-accent);
  border-color: var(--brand);
}
.btn-primary:hover, .btn-gradient:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-glow-brand);
}
.btn-primary:active, .btn-gradient:active {
  background: var(--brand-active);
  border-color: var(--brand-active);
  box-shadow: none;
}

/* Secondary — outline, copper-tints on hover. */
.btn-secondary, .btn-outline {
  background: transparent;
  color: var(--text-color);
  border-color: var(--border-default);
}
.btn-secondary:hover, .btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.btn-secondary:active, .btn-outline:active {
  background: var(--brand-tint);
}

/* Ghost — no border, low-emphasis, surface-3 hover wash. */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--surface-3, var(--input-bg));
  color: var(--text-color);
}

/* Danger — solid red, white text. */
.btn-danger {
  background: var(--danger-color);
  color: #fff;
  border-color: var(--danger-color);
}
.btn-danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  color: #fff;
}
/* Outline danger — the token version, overriding Bootstrap's default red so it
   tracks --danger-color across dark/light/focus (used by the delete-rule button
   on alerts). The .btn base (padding/size) comes from Bootstrap's .btn. */
.btn-outline-danger {
  background: transparent;
  color: var(--danger-color);
  border-color: var(--danger-color);
}
.btn-outline-danger:hover {
  background: var(--danger-color);
  border-color: var(--danger-color);
  color: #fff;
}
/* Outline warning — amber, token version (parallels .btn-outline-danger). For
   caution actions like "Retire" that aren't destructive enough for danger-red
   but need more weight than a ghost button. Tracks --warning-color across
   dark/light/focus; fills to dark ink on hover. The .btn base (padding/size)
   comes from Bootstrap's .btn — replaces per-button inline color/border. */
.btn-outline-warning {
  background: transparent;
  color: var(--warning-color);
  border-color: var(--warning-color);
}
.btn-outline-warning:hover {
  background: var(--warning-color);
  border-color: var(--warning-color);
  color: var(--text-on-accent);
}

/* Success — solid green, white text. Kept for legacy call sites; v2 spec
 * itself doesn't define a success button (uses toasts / status chips). */
.btn-success {
  background: var(--success-color);
  color: #fff;
  border-color: var(--success-color);
}
.btn-success:hover {
  background: var(--success-hover);
  border-color: var(--success-hover);
  color: #fff;
}

/* ─── .btn-add — small filled primary action ─────────────────────────
 * Promoted from templates/admin.html on 2026-05-01 because admin
 * sub-pages (ai_health, source_coverage, uae_radar, ai_evals) extend
 * the external admin layout — which means admin.html's local
 * `<style>` block is NOT inherited. The buttons rendered unstyled
 * (browser-default white-grey on a dark background — the issue
 * the user flagged on /admin/ai-health).
 *
 * Now defined here in shared.css so EVERY page that uses .btn-add
 * gets the themed treatment automatically. Same visual baseline as
 * .btn-primary.btn-sm but with a more compact padding for inline
 * "Refresh" / "Add" / "Save" actions in toolbars and forms.
 *
 * All design tokens — works in dark / light mode and tracks
 * any future brand refresh.
 */
.btn-add {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1h) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: var(--leading-tight);
  border: 1px solid var(--primary-color);
  border-radius: var(--radius-sm);
  background: var(--primary-color);
  color: var(--text-on-accent, #fff);
  cursor: pointer;
  transition: background var(--transition-fast),
              border-color var(--transition-fast),
              transform var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}
.btn-add:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--text-on-accent, #fff);
  transform: translateY(-1px);
}
.btn-add:active {
  transform: translateY(0);
}
.btn-add:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.btn-add:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn-add .cyn-icon,
.btn-add i {
  font-size: 0.95em;
}

/* Icon-only button */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--btn-h, 32px);
  height: var(--btn-h, 32px);
  padding: 0;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-color);
  opacity: 0.5;
  cursor: pointer;
  transition: var(--transition-fast); transition-property: var(--paint-props);
}
.btn-icon:hover {
  background: var(--button-bg);
  opacity: 1;
  border-color: var(--input-border);
}

/* Size modifiers — v2 height-based sizing. Override --btn-h + padding
 * + font-size; height, gap, border-radius all inherit from the base
 * .btn-primary/.btn-secondary/etc. rule so one modifier fits every
 * variant. Matches New Design/components_v2.css exactly. */

/* Small — height 26px */
.btn-sm {
  --btn-h: 26px;
  padding: 0 var(--space-2h);
  font-size: var(--text-sm);
}

/* Medium — same as default; kept for explicit sizing on dense surfaces. */
.btn-md {
  --btn-h: 32px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
}

/* Large — height 40px */
.btn-lg {
  --btn-h: 40px;
  padding: 0 18px;
  font-size: var(--text-md);
}

/* Extra-small — for dense table rows / toolbars / tag chips. Not part of
 * the formal v2 spec but used across the existing app, so we preserve it. */
.btn-xs {
  /* ⚠ 24px IS THE FLOOR, AND THIS WAS 22. Two pixels under WCAG 2.5.8, which
     made every extra-small button fail wherever it sat beside another one —
     and on a row of actions it always does. One declaration was
     "Acknowledge"/"Dismiss" on /alerts, "Confirm phishing" on /phishing and
     "False positive" on /indicators. Do not take it below 24 again. */
  --btn-h: 24px;
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
  line-height: var(--leading-tight);
}

/* Outline modifier — use alongside btn-primary/btn-danger/etc. to get a
   transparent background with a colored border that fills on hover.
   Example: <button class="btn-primary btn-outline-fill"> */
.btn-primary.btn-outline-fill {
  background: transparent;
  color: var(--primary-color);
}
.btn-primary.btn-outline-fill:hover {
  background: var(--primary-color);
  color: var(--text-on-accent, #fff);
}
.btn-danger.btn-outline-fill {
  background: transparent;
  color: var(--danger-color);
}
.btn-danger.btn-outline-fill:hover {
  background: var(--danger-color);
  color: #fff;
}

/* --- Icon sizing utilities ------------------------------------------------
   Templates were hardcoding <i style="font-size:28px"> / <i style="font-size:
   0.5em"> in 30+ places, leading to drift. Use these instead. Sizes map to
   the typography scale so everything scales together if a user bumps font
   size up via browser zoom.
*/
.icon-xs  { font-size: var(--text-xs); line-height: 1; }
.icon-sm  { font-size: var(--text-sm); line-height: 1; }
.icon-md  { font-size: var(--text-md); line-height: 1; }
.icon-lg  { font-size: var(--text-lg); line-height: 1; }
.icon-xl  { font-size: var(--text-xl); line-height: 1; }
.icon-2xl { font-size: var(--text-2xl); line-height: 1; }

/* (removed .spinner-icon — superseded by the canonical .cyn-spin below.) */

/* --- Theme-aware modal backdrop ------------------------------------------
   Canonical class for dimming behind modals, detail panels, and overlays.
   Uses the --overlay-backdrop token so light mode gets a softer
   scrim automatically. Templates were rolling their own rgba(0,0,0,0.6)
   which made modals look like a black hole on light-mode pages.
*/
.modal-backdrop-theme {
  position: fixed;
  inset: 0;
  background: var(--overlay-backdrop);
  z-index: var(--z-overlay);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* --- Screen-reader-only text ---------------------------------------------
   Hide text visually while keeping it available to screen readers.
   Used for <label> elements on icon-only buttons and hidden form labels.
   .sr-only is the older Bootstrap 4 name; .visually-hidden is Bootstrap 5's
   modern name. Both aliases so either works. The :focus-visible variant
   allows skip-links to become visible when focused.
*/
.sr-only,
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.sr-only-focusable:focus,
.sr-only-focusable:focus-visible,
.visually-hidden-focusable:focus,
.visually-hidden-focusable:focus-visible {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: var(--space-2) var(--space-4) !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
}

/* --- Standardized filter/search input --- */
.filter-input, .search-input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-color);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.filter-input:focus, .search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(217, 119, 6,0.12);
}
.filter-input::placeholder, .search-input::placeholder {
  color: var(--text-disabled);
}

/* --- Collapsible Sections --- */
.collapsible-header {
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: var(--space-3h) 18px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition-normal); transition-property: var(--paint-props);
  margin-bottom: 0;
  user-select: none;
  font-weight: 600;
  font-size: var(--text-md);
}
.collapsible-header:hover {
  border-color: var(--primary-color);
}
.collapsible-header h5, .collapsible-header h4 {
  margin: 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.collapsible-header .arrow {
  transition: transform var(--transition-normal);
  color: var(--primary-color);
  font-size: var(--text-base);
}
.collapsible-header.active .arrow { transform: rotate(180deg); }
.collapsible-header.active {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border-bottom-color: transparent;
}
.collapsible-content {
  display: none;
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 18px;
  animation: slideDown 0.2s ease;
}
.collapsible-content.active { display: block; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: var(--z-max);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

/* --- Toast stack depth ---
 * When multiple toasts pile up, the older ones fade + shrink slightly
 * so the newest has visual prominence. macOS Notification Centre uses
 * a similar stacking treatment. Positional via :nth-last-child so
 * "newest" = the last DOM node; no JS coordination needed.
 *
 * transition matches the values used by the toast slide-in so when
 * a new toast arrives and the prior newest demotes to 2nd-newest,
 * the demotion animates smoothly instead of snapping.
 *
 * Excludes `.leaving` so an exiting toast's slide-out animation isn't
 * fighting the stack-depth transform. */
.toast-notification:not(.leaving) {
  transition:
    transform var(--dur-normal) var(--ease-out-expo),
    opacity var(--dur-normal) ease,
    box-shadow var(--dur-normal) ease;
}
/* Second-newest: subtly demoted */
.toast-container .toast-notification:not(.leaving):nth-last-child(2) {
  transform: scale(0.97);
  opacity: 0.88;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
/* Third-newest: further demoted */
.toast-container .toast-notification:not(.leaving):nth-last-child(3) {
  transform: scale(0.94);
  opacity: 0.72;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
/* Fourth-and-older: clamped floor so a flood of toasts doesn't fade
 * into invisibility. Still readable; still clearly background. */
.toast-container .toast-notification:not(.leaving):nth-last-child(n+4) {
  transform: scale(0.91);
  opacity: 0.55;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}
@media (prefers-reduced-motion: reduce) {
  /* With motion disabled, drop the scale so there's no size-based
   * hierarchy cue — just the opacity which conveys the same info
   * without any animated transition. */
  .toast-container .toast-notification:not(.leaving):nth-last-child(2),
  .toast-container .toast-notification:not(.leaving):nth-last-child(3),
  .toast-container .toast-notification:not(.leaving):nth-last-child(n+4) {
    transform: none;
  }
}
.toast-notification {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  color: var(--text-color);
  font-size: var(--text-base);
  min-width: 280px;
  max-width: 400px;
  /* Entrance only. Exit is driven by the .leaving class (applied by JS
     when the progress bar drains, or the user clicks the ×) so we can
     swap the animation without racing CSS-only timers. */
  animation: toastSlideIn 0.28s var(--ease-out-expo);
  backdrop-filter: blur(12px);
  position: relative;  /* anchor for the .toast-progress child */
  overflow: hidden;    /* clip the progress bar to the rounded corners */
}
.toast-notification.toast-success { border-left: 3px solid var(--success-color); }
.toast-notification.toast-success i { color: var(--success-color); }
.toast-notification.toast-success .toast-progress { background: var(--success-color); }
.toast-notification.toast-danger { border-left: 3px solid var(--danger-color); }
.toast-notification.toast-danger i { color: var(--danger-color); }
.toast-notification.toast-danger .toast-progress { background: var(--danger-color); }
.toast-notification.toast-warning { border-left: 3px solid var(--warning-color); }
.toast-notification.toast-warning i { color: var(--warning-color); }
.toast-notification.toast-warning .toast-progress { background: var(--warning-color); }
.toast-notification.toast-info { border-left: 3px solid var(--info-color); }
.toast-notification.toast-info i { color: var(--info-color); }
/* v2: info toasts drain in copper (brand), not info-blue — matches the
 * "copper for in-progress / sync" rule in preview/toasts.html. */
.toast-notification.toast-info .toast-progress { background: var(--brand); }

/* Drain bar — 2px strip at the bottom that empties left→right over 5s.
 * Animation is paused on hover so analysts get as long as they need
 * to read; once the bar finishes it fires animationend and JS adds
 * .leaving to animate the toast out. CSS is the source of truth for
 * the timing, no setTimeout / JS timer involved. */
.toast-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--info-color);
  opacity: 0.55;
  transform-origin: left center;
  animation: toastProgress 5s linear forwards;
}
.toast-notification:hover .toast-progress,
.toast-notification:focus-within .toast-progress { animation-play-state: paused; }
/* An error has no countdown: it stays until its close button is pressed. */
.toast-notification.toast-sticky .toast-progress { display: none; }

.toast-notification.leaving {
  animation: toastSlideOut 0.22s ease-in forwards;
  pointer-events: none;
}

.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-color);
  opacity: 0.4;
  cursor: pointer;
  font-size: var(--text-lg);
  padding: 0 2px;
  line-height: 1;
  transition: opacity var(--transition-fast);
}
.toast-close:hover { opacity: 1; }

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(24px); }
}
@keyframes toastProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}
/* Respect user motion preferences: no slide/drain animations, but the
 * toast still appears + auto-dismisses via a plain JS timeout fallback
 * handled in shared.js. */
@media (prefers-reduced-motion: reduce) {
  .toast-notification, .toast-notification.leaving { animation: none; }
  .toast-progress { animation: none; opacity: 0; }
}

/* --- Loading / Spinner ---
   (.loading-spinner removed — superseded by the canonical .cyn-spin below.
   @keyframes spin is kept; .cyn-spin uses it.) */
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Canonical loaders (use ONLY these two; don't hand-roll spinners) ───
 *  1. Inline / in-button "working…"  →  .cyn-spin  (below)
 *  2. Panel / section / overlay load →  the branded .cy-loader
 *     (Cyntel.strokeDraw / Cyntel.bracketScan — see below)
 *
 *  .cyn-spin is a 1em border-ring that inherits `currentColor`, so it sits
 *  inline like an icon and matches whatever button/text it lives in. It
 *  replaces every ad-hoc `fa-spinner fa-spin`, `.spinner-icon` and
 *  `.loading-spinner` the app used to scatter around.
 *    <button><i class="cyn-spin"></i> Saving…</button>
 *    <span class="cyn-spin cyn-spin--lg"></span>            (bigger, e.g. 1.6em)
 */
.cyn-spin {
  display: inline-block;
  width: 1em; height: 1em;
  vertical-align: -0.125em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.cyn-spin--lg { width: 1.6em; height: 1.6em; border-width: 3px; }
.cyn-spin--sm { width: 0.85em; height: 0.85em; }
@media (prefers-reduced-motion: reduce) { .cyn-spin { animation-duration: 1.8s; } }

/* --- Bracket Scan — branded SVG loader (v2) -------------------------
 * Fits the threat-intel SOC aesthetic better than a generic border
 * spinner: four corner brackets pulse in a clockwise sequence while
 * a horizontal scan line sweeps top ↔ bottom — reads as a radar lock
 * or sensor sweep. All strokes use `currentColor` so any parent can
 * retint by setting `color:` (defaults to copper brand). Transparent
 * background — inherits whatever surface the loader sits on.
 *
 * Drop-in markup:
 *   <div class="cy-loader cy-loader--bracket-scan" role="status"
 *        aria-live="polite" aria-label="Loading">
 *     <svg viewBox="0 0 120 120" fill="none" aria-hidden="true">
 *       <path class="cy-bracket cy-bracket--tl" d="M20 36 V20 H36"/>
 *       <path class="cy-bracket cy-bracket--tr" d="M84 20 H100 V36"/>
 *       <path class="cy-bracket cy-bracket--br" d="M100 84 V100 H84"/>
 *       <path class="cy-bracket cy-bracket--bl" d="M36 100 H20 V84"/>
 *       <line class="cy-scan-line" x1="28" y1="60" x2="92" y2="60"/>
 *     </svg>
 *   </div>
 *
 * Size modifiers: add .cy-loader--xs / --sm / --md / --lg / --xl
 * (20 / 28 / 40 / 64 / 96 px). Default is 40px (md).
 *
 * For dynamic JS rendering, Cyntel.bracketScan({size:'lg', label:'Scanning…'})
 * returns a fully-wired HTML string. */
.cy-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  width: 40px;
  height: 40px;
  line-height: 0;
  flex-shrink: 0;
}
.cy-loader svg { width: 100%; height: 100%; }
.cy-loader--xs { width: 20px; height: 20px; }
.cy-loader--sm { width: 28px; height: 28px; }
.cy-loader--md { width: 40px; height: 40px; }
.cy-loader--lg { width: 64px; height: 64px; }
.cy-loader--xl { width: 96px; height: 96px; }

.cy-loader .cy-bracket {
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.cy-loader .cy-scan-line {
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 4 3;
  opacity: 0.6;
}

/* Bracket Scan animation — clockwise corner pulse + vertical scan sweep. */
.cy-loader--bracket-scan .cy-bracket {
  animation: cy-bracket-pulse 1.8s ease-in-out infinite;
}
.cy-loader--bracket-scan .cy-bracket--tl { animation-delay: 0s; }
.cy-loader--bracket-scan .cy-bracket--tr { animation-delay: 0.45s; }
.cy-loader--bracket-scan .cy-bracket--br { animation-delay: 0.9s; }
.cy-loader--bracket-scan .cy-bracket--bl { animation-delay: 1.35s; }
.cy-loader--bracket-scan .cy-scan-line {
  animation: cy-scan-sweep 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes cy-bracket-pulse {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 1; }
}
@keyframes cy-scan-sweep {
  0%   { transform: translateY(-24px); opacity: 0; }
  8%   { opacity: 1; }
  45%  { transform: translateY(24px);  opacity: 1; }
  55%  { opacity: 0; }
  100% { transform: translateY(-24px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .cy-loader--bracket-scan .cy-bracket,
  .cy-loader--bracket-scan .cy-scan-line { animation: none; }
  .cy-loader--bracket-scan .cy-bracket   { opacity: 1; }
  .cy-loader--bracket-scan .cy-scan-line { display: none; }
}

/* --- Stroke Draw — branded SVG loader (v2, Loader 02 in the CY set) -
 * Pen-plotter animation: the Cyntel "CY" monogram (Terminal Mark 09)
 * redraws itself on a 3-second loop. Strokes appear in sequence — the
 * "C" bracket first, then the Y's two branches meeting at a stem —
 * then the cursor blinks in. All strokes use `currentColor` (parent
 * sets `color:` to retint). Transparent background, inherits surface.
 *
 * Spec source: New Design/CY Loading Indicators.html (Loader 02).
 *
 * Drop-in markup:
 *   <div class="cy-loader cy-loader--stroke-draw cy-loader--lg"
 *        role="status" aria-live="polite" aria-label="Loading">
 *     <svg viewBox="0 0 120 120" fill="none" aria-hidden="true">
 *       <path class="cy-bracket-l" d="M 50 30 L 24 60 L 50 90"/>
 *       <path class="cy-branch-l"  d="M 64 44 L 76 60"/>
 *       <path class="cy-branch-r"  d="M 92 44 L 76 60"/>
 *       <path class="cy-stem"      d="M 76 60 L 76 90"/>
 *       <rect class="cy-cursor"    x="98" y="86" width="6" height="10" rx="1"/>
 *     </svg>
 *   </div>
 *
 * Size modifiers are shared with Bracket Scan (.cy-loader--xs/sm/md/lg/xl).
 * For dynamic JS rendering, Cyntel.strokeDraw({size:'lg', label:'…'}). */
.cy-loader--stroke-draw path,
.cy-loader--stroke-draw rect {
  stroke: currentColor;
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cy-loader--stroke-draw .cy-cursor {
  fill: currentColor;
  stroke: none;
  opacity: 0;
  animation: cy-stroke-cursor 3s ease-in-out infinite;
}
.cy-loader--stroke-draw .cy-bracket-l {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: cy-stroke-draw-l 3s ease-in-out infinite;
}
.cy-loader--stroke-draw .cy-branch-l {
  stroke-dasharray: 35;
  stroke-dashoffset: 35;
  animation: cy-stroke-draw-s 3s ease-in-out infinite 0.45s;
}
.cy-loader--stroke-draw .cy-branch-r {
  stroke-dasharray: 35;
  stroke-dashoffset: 35;
  animation: cy-stroke-draw-s 3s ease-in-out infinite 0.7s;
}
.cy-loader--stroke-draw .cy-stem {
  stroke-dasharray: 35;
  stroke-dashoffset: 35;
  animation: cy-stroke-draw-s 3s ease-in-out infinite 0.95s;
}
/* The "l" (long) variant covers the 100-unit C bracket; the "s" variant
 * covers the three 35-unit Y pieces. Both end at the same 3s mark so all
 * strokes fade out together before the next loop. */
@keyframes cy-stroke-draw-l {
  0%                { stroke-dashoffset: 100; opacity: 1; }
  40%, 78%          { stroke-dashoffset: 0;   opacity: 1; }
  92%, 100%         { stroke-dashoffset: 0;   opacity: 0; }
}
@keyframes cy-stroke-draw-s {
  0%                { stroke-dashoffset: 35; opacity: 1; }
  40%, 78%          { stroke-dashoffset: 0;  opacity: 1; }
  92%, 100%         { stroke-dashoffset: 0;  opacity: 0; }
}
@keyframes cy-stroke-cursor {
  0%, 85%  { opacity: 0; }
  88%, 100% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .cy-loader--stroke-draw path,
  .cy-loader--stroke-draw rect,
  .cy-loader--stroke-draw .cy-cursor { animation: none !important; }
  .cy-loader--stroke-draw path       { stroke-dashoffset: 0 !important; }
  .cy-loader--stroke-draw .cy-cursor { opacity: 1 !important; }
}

/* Inline wrapper for loader + caption (the JS helper's Cyntel.bracketScan
 * with a `label` renders through this). */
.cy-loader-wrap {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.cy-loader-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* --- Pulse Dot --- */
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success-color);
  display: inline-block;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* --- Fade In Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.4s ease-out; }
.fade-in-delay-1 { animation: fadeIn 0.4s ease-out 0.08s both; }
.fade-in-delay-2 { animation: fadeIn 0.4s ease-out 0.16s both; }
.fade-in-delay-3 { animation: fadeIn 0.4s ease-out 0.24s both; }

/* --- Command palette (Ctrl+K) polish ---
 * Entrance animation + fuzzy match highlighting. The palette itself
 * is DOM-built in shared.js with inline styles; these rules layer
 * on top for the polish-only concerns. */
.cmd-match {
  /* Matched characters from the fuzzy scorer, rendered inside
   * <mark> tags. Gives the user a "why did this rank?" cue. No
   * background tint -- just a slight color lift + bold weight
   * so the highlight reads as emphasis, not a highlighter-pen
   * smear across a line already tight with other signals. */
  background: transparent;
  color: var(--primary-color);
  font-weight: 700;
  padding: 0;
}
.cmd-entering {
  animation: cmdPaletteIn 180ms var(--ease-out-expo);
}
.cmd-backdrop-entering {
  animation: cmdBackdropIn 140ms ease-out;
}
@keyframes cmdPaletteIn {
  from { opacity: 0; transform: translateX(-50%) scale(0.96) translateY(-4px); }
  to { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}
@keyframes cmdBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .cmd-entering, .cmd-backdrop-entering { animation: none; }
}

/* --- Keyboard shortcut overlay (?-key help modal) ---
 * Opens on "?" via shared.js's global keydown listener. Reuses the
 * .um-modal-overlay + .um-modal shell (so the entrance animation and
 * backdrop come for free), and adds its own structural + decorative
 * classes for the per-section groupings and tactile key pills. */
.um-modal.shortcuts-modal { width: 560px; }
.shortcuts-section { margin-bottom: var(--space-4); }
.shortcuts-section:last-child { margin-bottom: 0; }
.shortcuts-section-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--input-border);
}
.shortcuts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 6px 0;
  font-size: var(--text-sm);
  color: var(--text-color);
}
.shortcuts-row + .shortcuts-row { border-top: 1px dashed transparent; }
.shortcuts-label { flex: 1; }
.shortcuts-keys { display: inline-flex; align-items: center; gap: 4px; }
.shortcuts-keys .kbd-plus {
  font-size: var(--text-2xs);
  color: var(--text-secondary);
  opacity: 0.6;
  margin: 0 1px;
}
/* Tactile key pill -- slight 3D lift via extra bottom border + shadow,
 * so the key looks like it sits above the modal surface. Mono font
 * keeps letter widths consistent across the whole list. */
.shortcuts-keys kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 22px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-bottom-width: 2px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-color);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 1px 0 rgba(0, 0, 0, 0.15);
  line-height: 1;
}
body.light-mode .shortcuts-keys kbd {
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.05), 0 1px 0 rgba(0, 0, 0, 0.08);
}

/* --- Global page fade-in ---
 * Every page loads with a short opacity transition so navigation
 * doesn't feel like a hard cut. 140ms is short enough that analysts
 * don't perceive it as latency, but long enough to soften the
 * render-paint boundary. No JS involved -- pure CSS animation runs
 * on every page load AND on history navigation (back/forward), which
 * is what we want.
 *
 * The `both` fill mode keeps the initial frame at opacity 0 before
 * the animation starts, eliminating any flash of the fully-rendered
 * body at native opacity. Scope is intentionally `body` (not html or
 * main content) so modals / toasts mounted later via JS aren't
 * double-faded when they appear.
 *
 * Deliberately separate from the .fade-in utility above (400ms, used
 * by explicit content cards and containers) -- this one is shorter
 * and automatic; .fade-in is longer and opt-in per element. */
/* ⚠ ONLY WHERE THERE IS NO VIEW TRANSITION (2026-10-11). Since
 * `@view-transition { navigation: auto }` (bottom of this file) the browser
 * cross-fades every navigation itself, and this fade stacked on top of it:
 * the new page's body started at opacity 0 INSIDE the cross-fade, so content
 * arrived late and the navbar — named so that it would hold still — faded
 * with everything else. Kept for browsers without view transitions, where it
 * is still the only thing softening the cut. The test is
 * `view-transition-class`, not `view-transition-name`: the NAME arrived with
 * same-page transitions (Chrome 111, Safari 18.0), two releases before the
 * cross-page ones this depends on; the CLASS arrived with them (Chrome 125/126,
 * Safari 18.2), so the gap where a browser gets neither is one release wide. */
@supports not (view-transition-class: none) {
  body {
    animation: pageFadeIn var(--dur-fast) ease-out both;
  }
}
@keyframes pageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
}

/* --- Empty State (with illustration support) ---
 * Canonical empty-state block. Use Cyntel.renderEmpty() from JS for dynamic
 * renders, or drop the markup structure inline for server-rendered pages:
 *
 *   <div class="empty-state">
 *     <div class="empty-state-icon"><i class="fas fa-inbox"></i></div>
 *     <div class="empty-state-title">No articles yet</div>
 *     <div class="empty-state-subtitle">Feeds run every 30 minutes.
 *       New articles appear here automatically.</div>
 *     <a href="/settings" class="btn-primary empty-state-cta">Configure feeds</a>
 *   </div>
 *
 * Modifiers:
 *   .empty-state.empty-state-compact   — tighter padding for in-card empties
 *   .empty-state.empty-state-inline    — fits inside a narrow column
 */
.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-5);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}
.empty-state.empty-state-compact {
  padding: var(--space-5) var(--space-4);
  min-height: 120px;
}
.empty-state.empty-state-inline {
  min-height: 80px;
  padding: var(--space-4) var(--space-3);
}
.empty-state .empty-state-icon {
  /* Upgraded from a flat 72px faint-overlay disc to a floating
   * "orb" with radial gradient fill + soft ring + diffuse glow.
   * Still theme-aware (everything alpha-derived from primary) so
   * light mode keeps its own feel. The transition below
   * is intentional -- on hover over a CTA inside the empty state,
   * the orb's position is re-layouted by the parent and the
   * transition smooths that motion. */
  width: 80px; height: 80px;
  border-radius: var(--radius-full);
  background: radial-gradient(circle at 50% 40%,
                              rgba(217, 119, 6, 0.18),
                              rgba(217, 119, 6, 0.02) 70%);
  border: 1px solid rgba(217, 119, 6, 0.18);
  box-shadow:
    0 0 0 6px rgba(217, 119, 6, 0.04),   /* diffuse halo */
    0 10px 30px rgba(217, 119, 6, 0.10); /* lift shadow */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  transition: var(--transition-normal); transition-property: var(--paint-props);
}
body.light-mode .empty-state .empty-state-icon {
  /* Softer on light mode — the box-shadow halo would be too dark. */
  background: radial-gradient(circle at 50% 40%,
                              rgba(217, 119, 6, 0.12),
                              rgba(217, 119, 6, 0.02) 70%);
  box-shadow:
    0 0 0 6px rgba(217, 119, 6, 0.03),
    0 4px 16px rgba(217, 119, 6, 0.06);
}
.empty-state.empty-state-compact .empty-state-icon {
  width: 52px; height: 52px;
  margin-bottom: var(--space-3);
}
.empty-state.empty-state-inline .empty-state-icon {
  width: 40px; height: 40px;
  margin-bottom: var(--space-2);
}
.empty-state .empty-state-icon i,
.empty-state > i {
  /* Bumped from 0.55 -> 0.75 opacity so the icon reads more
   * clearly against the new gradient-filled orb. Size bumped
   * from text-2xl to 28px for more visual weight; the orb is
   * now 80px so a slightly bigger glyph stays proportional. */
  font-size: 28px;
  color: var(--primary-color);
  opacity: 0.75;
  display: block;
  margin: 0;
}
.empty-state.empty-state-compact .empty-state-icon i { font-size: var(--text-xl); }
.empty-state.empty-state-inline  .empty-state-icon i { font-size: var(--text-lg); }
.empty-state p {
  font-size: var(--text-md);
  margin: 0;
  /* §20.7. Was `opacity: 0.5` over an inherited colour, and it COMPOUNDED:
     /uae_radar sets `.empty-state { color: var(--text-secondary) }`, so the
     paragraph rendered at .58 x .5 = .29 alpha and measured 2.27:1 dark /
     2.15:1 light at 14px — the lowest reading in this sweep. The role is the
     same one `.empty-state-subtitle` two rules down already names correctly:
     the quiet body of an empty state, one ramp step below the title. */
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}
.empty-state .empty-state-title {
  /* v2 spec §3.6: empty-state headlines are editorial — Newsreader display
   * serif. The quieter serif voice makes "nothing here yet" feel
   * intentional rather than broken (the same reason Apple's Mail, Linear,
   * and Vercel use serif for empty states). opsz 24 keeps glyphs readable
   * at smaller title sizes. */
  font-family: var(--font-display);
  font-size: 1.25rem /* drawn size, Newsreader */;
  font-weight: 500;
  font-variation-settings: "opsz" 24;
  letter-spacing: -0.015em;
  color: var(--text-color);
  /* `opacity: 0.95` was here. It dimmed the title by 5% — .874 alpha instead
     of .92, no measurable contrast consequence — and that is exactly why it
     went: it bought nothing and it made the empty-state rule need a threshold
     ("no opacity below 0.9") instead of a rule ("no opacity on ink"). A
     threshold invites the next one to be 0.89. See §20.7 and the guards in
     tests/test_chrome_and_order_contract.py. */
  margin-bottom: var(--space-2);
}
.empty-state.empty-state-inline .empty-state-title { font-size: var(--text-md); }
.empty-state .empty-state-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  max-width: 360px;
  margin: 0 auto var(--space-4);
  line-height: var(--leading-relaxed);
}
.empty-state.empty-state-inline .empty-state-subtitle {
  font-size: var(--text-sm);
  max-width: 280px;
  margin-bottom: var(--space-3);
}
.empty-state .empty-state-cta,
.empty-state .btn {
  margin-top: var(--space-2);
}

/* --- Tags --- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--panel-bg);
  border: 1px solid var(--input-border);
  border-radius: 4px;
  padding: 2px 8px;
  margin: 2px;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: var(--transition-fast); transition-property: var(--paint-props);
}
.tag:hover {
  border-color: var(--primary-color);
  background: var(--glow-primary);
}

/* --- Mono/Hash Display --- */
.hash-display, .mono-text {
  font-family: var(--font-mono);
  word-break: break-all;
  font-size: var(--text-sm);
  color: var(--primary-color);
}

/* --- Alert Overrides --- */
.alert {
  border-radius: var(--radius-sm);
  border: none;
  font-size: var(--text-md);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}
.alert-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
  border-left: 3px solid var(--success-color);
}
.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
  border-left: 3px solid var(--danger-color);
}
.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
  border-left: 3px solid var(--warning-color);
}
.alert-info {
  background: rgba(255, 255, 255, 0.1);
  color: var(--info-color);
  border-left: 3px solid var(--info-color);
}

/* --- Footer --- */
/* THE LAST THING ON THE PAGE, NOT CHROME (2026-10-12; phones since 10-11).
   Fixed, it held 38px of every screen to print one decorative line, over the
   foot of every ledger. /knowledge is the exception — fixed layers over an
   empty document, where a static footer lands at the top — and keeps it
   fixed, with --footer-h re-declared for the offsets that clear it. */
.app-footer {
  position: static !important;
  padding: 10px 0;
  border-top: 1px solid var(--input-border);
  text-align: center;
  /* --text-tertiary, NOT --text-color under an opacity: the row used to sit
     at `opacity: 0.4`, which put an 11px line at 2.94:1 on every page and the
     version string at 1.37:1 under a second inline dim. The de-emphasis the
     opacity was reaching for is what the tertiary token IS — the AA floor,
     4.9:1 dark / 4.88:1 light — measured live 2026-09-05. */
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: var(--font-mono);
  background: var(--dark-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
body.light-mode .app-footer {
  background: #ffffff;
}
body.ksf-page { --footer-h: 38px; --bulk-bottom: calc(var(--footer-h) + var(--space-4)); }
body.ksf-page .app-footer {
  position: fixed !important; bottom: 0 !important; left: 0; right: 0;
  z-index: var(--z-footer);
}
/* The body is the scroll container under the fixed navbar; it stops
   --footer-h short of the window, which is 0 wherever the footer scrolls. */
html {
  height: 100vh;
  overflow: hidden;
}
body {
  height: calc(100vh - var(--footer-h)) !important;
  overflow-y: auto !important;
  padding-top: var(--nav-height) !important;  /* chrome height token — see :root */
  padding-bottom: 0 !important;
}

.app-footer .container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* --- Quill Editor Dark Theme --- */
.ql-toolbar.ql-snow {
  border-color: var(--input-border) !important;
  background: var(--panel-bg);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.ql-container.ql-snow {
  border-color: var(--input-border) !important;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.ql-editor {
  color: var(--text-color);
  font-family: var(--font-sans);
  min-height: 200px;
  font-size: var(--text-md);
}
.ql-snow .ql-stroke { stroke: var(--text-color) !important; }
.ql-snow .ql-fill { fill: var(--text-color) !important; }
.ql-snow .ql-picker-label { color: var(--text-color) !important; }
.ql-snow .ql-picker-options {
  background: var(--card-bg) !important;
  border-color: var(--input-border) !important;
}

/* --- Breadcrumb --- */
.breadcrumb-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--text-color);
  opacity: 0.5;
  margin-bottom: 4px;
}
.breadcrumb-bar a { color: var(--primary-color); text-decoration: none; }
.breadcrumb-bar a:hover { opacity: 0.8; }

/* --- Stat Indicators --- */
.stat-up { color: var(--success-color); }
.stat-down { color: var(--danger-color); }
.stat-neutral { color: var(--text-color); opacity: 0.5; }

/* --- Responsive --- */
@media (max-width: 768px) {
  /* Page headers */
  .page-header { padding: 12px 0 10px; }
  .page-header h1, .page-header h2, .page-header h3 { font-size: var(--text-lg); }
  .page-header p { font-size: var(--text-xs) !important; }

  /* Cards */
  .glass-card, .result-card { padding: var(--space-3h); }
  .card-panel { padding: 12px; }

  /* Stat cards — 2 columns instead of 5 */
  .stat-card { padding: 10px 12px; }
  .stat-card h3 { font-size: var(--text-xl) !important; }
  .stat-card p { font-size: var(--text-xs) !important; }

  /* Stat grids — force 2-col */
  [style*="grid-template-columns:repeat(5"] { grid-template-columns: repeat(2, 1fr) !important; }
  [style*="grid-template-columns:repeat(4"] { grid-template-columns: repeat(2, 1fr) !important; }
  [style*="grid-template-columns:repeat(3"] { grid-template-columns: repeat(2, 1fr) !important; }

  /* Tables — horizontal scroll */
  .data-table, .admin-table { font-size: var(--text-xs); }
  .data-table td, .data-table th, .admin-table td, .admin-table th { padding: 6px 8px; white-space: nowrap; }

  /* Forms */
  .input-group-modern .form-control { padding: var(--space-2h) var(--space-3h); }
  .input-group-modern .btn { padding: 10px 16px; }

  /* Toast */
  .toast-notification { min-width: 200px; max-width: 92vw; font-size: var(--text-xs); }

  /* Command palette */
  #cmdPalette { width: 95vw !important; top: 10% !important; }

  /* Buttons */
  .btn-primary, .btn-secondary { font-size: var(--text-xs); padding: 6px 12px; }

  /* Charts — prevent overflow */
  canvas { max-width: 100% !important; }

  /* Section labels */
  .section-label { font-size: var(--text-xs); }

  /* Navbar adjustments */
  .navbar .nav-link { font-size: var(--text-xs); padding: 6px 8px !important; }

  /* Hide non-essential columns on mobile */
  .data-table .hide-mobile, .admin-table .hide-mobile { display: none; }

  /* Phishing page — stack columns */
  .bento-grid { grid-template-columns: 1fr !important; }
  .bento-lg, .bento-wide { grid-column: span 1 !important; }

  /* AI chat — full width */
  .chat-container { padding: 8px !important; }

  /* Severity badges — smaller on mobile */
  .severity-badge { font-size: var(--text-3xs); padding: 1px 5px; }
}

/* ============================================================================
   Container-query density + restructure for the shared table system (2026 P1).

   ⚠ POSITION IS LOAD-BEARING — do not move these blocks back up beside
   `.table-responsive`. The `@media (max-width: 768px)` block directly above
   sets `.data-table td, .data-table th, … { padding: 6px 8px }` at the SAME
   specificity (0,1,1) as the selectors here, so source order decides the tie.
   When these lived up at the .table-responsive declaration the mobile rule
   silently won and every density step below 768px was dead. Measured
   2026-07-18: at a 696px viewport, containers of 900/700/640/500/420px all
   rendered an identical 6px/8px — the steps did nothing on any phone. (Only
   font-size appeared to work, by the accident that the mobile block sets it on
   `.data-table` (0,1,0) which loses to `.data-table td` (0,1,1) here.)

   The mobile rule is deliberately LEFT IN PLACE as the fallback for any table
   that has no `tbl` container host, so a container-less table keeps its old
   mobile density instead of silently reverting to desktop padding.

   Elements that declare `container-name: tbl`: .table-responsive, .data-table-card.
   ============================================================================ */

/* Density steps keyed to the TABLE'S OWN box, not the viewport — so a table
   in a narrow drawer tightens even on a 4K display. Padding and type only:
   no column is hidden and no cell is restructured, so this cannot change
   what the operator can read, only how much fits before scrolling. */
@container tbl (max-width: 640px) {
  .data-table th, .admin-table th,
  .data-table td, .admin-table td {
    padding: var(--space-1h) var(--space-1);
    font-size: var(--text-xs);
  }
}
@container tbl (max-width: 420px) {
  .data-table th, .admin-table th,
  .data-table td, .admin-table td {
    padding: var(--space-1) var(--space-0);
    font-size: var(--text-2xs);
  }
}

/* ── .data-table--stack — the card-stack restructure ────────────────────────
   Two gates, same rules. Keeping them adjacent is the point: they must stay
   in sync, and they were 2000 lines apart before.

   This is the answer to "only the .lrow grid can restructure when narrow; a
   table can only get denser" — not true. A <table> can drop its header, turn
   every row into a block card and every cell into a label:value pair, which is
   exactly what .lrow's narrow mode does. It just needed the container gate. */
@media (max-width: 768px) {
  /* VIEWPORT gate — unchanged behaviour, the mobile card-stack. */
  .data-table--stack thead { display: none; }
  .data-table--stack tbody tr {
    display: block;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-2);
    padding: var(--space-1h) var(--space-2);
    background: var(--surface-2, var(--card-bg));
  }
  .data-table--stack tbody td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-3);
    padding: var(--space-1) 0 !important;
    border: none !important;
    text-align: right;
    white-space: normal;
  }
  /* The column label, pulled from the td's data-label attribute. */
  .data-table--stack tbody td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-weight: 700;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    text-align: left;
  }
  /* A full-width cell (e.g. a "title" row) can opt out of the two-column
   * label:value split with .stack-full. */
  .data-table--stack tbody td.stack-full { display: block; text-align: left; }
  .data-table--stack tbody td.stack-full[data-label]::before { display: block; margin-bottom: var(--space-0); }
}
@container tbl (max-width: 560px) {
  /* CONTAINER gate — the case a media query cannot see: the same table inside
     the ~420px .preview-* drawer, or a split pane, on a 4K display.

     Purely ADDITIVE. 560px is low enough that a full-width table never reaches
     it before the 768px gate above has already stacked it, so nothing that
     stacks today changes — only narrow HOSTS gain the behaviour. Chrome math:
     above 992px the sidebar takes 260px + 24px padding a side, so the box is
     ≈ viewport − 308 (viewport 992 → ≈684); at ≤992px the sidebar collapses and
     the box is ≈ viewport − 32 (viewport 768 → ≈736). A full-width table only
     reaches a 560px box at ≈592px viewport, well inside the media gate's range.
     560 also matches the .lrow restructure threshold, so both row systems
     change shape at the same box width. */
  .data-table--stack thead { display: none; }
  .data-table--stack tbody tr {
    display: block;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-2);
    padding: var(--space-1h) var(--space-2);
    background: var(--surface-2, var(--card-bg));
  }
  .data-table--stack tbody td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-3);
    padding: var(--space-1) 0 !important;
    border: none !important;
    text-align: right;
    white-space: normal;
  }
  .data-table--stack tbody td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-weight: 700;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    text-align: left;
  }
  .data-table--stack tbody td.stack-full { display: block; text-align: left; }
  .data-table--stack tbody td.stack-full[data-label]::before { display: block; margin-bottom: var(--space-0); }
}

/* Filter sidebar — full screen overlay on mobile.
   NOTE: This MUST match the breakpoint of the `left: -100vw` hiding rule
   (max-width: 992px), NOT max-width: 768px, otherwise tablet-range viewports
   (769-992px) fall through to the desktop `width: 260px` and the sidebar only
   occupies ~30% instead of covering the screen. Same applies to any page that
   lacks a viewport meta tag — mobile browsers default to a ~980px virtual
   viewport which skips a 768px media query entirely. On 2026-04-15 this bug
   caused the sidebar to occupy ~70% of physical screen width on iPhone
   because 260px of a 980px virtual viewport rendered as 260 * (375/980) ~=
   99 physical px, or ~27% — but on the OPEN state the full 260px panel sat
   above the 375px toggle area as a not-fully-obscured strip. Fixed by
   (a) adding viewport meta to the five missing templates and (b) widening
   this override to 992px to match the hiding rule. */
@media (max-width: 992px) {
  .filter-sidebar { width: 85vw !important; }
}

/* ── Intelligence Picture: indicator (IOC) chips — light-mode contrast fix ──
   The page's own rule `.ip-ind { background: var(--surface-overlay) }` used a
   DARK-ONLY modal-scrim token (rgba(7,10,18,.72) — no light-mode override) as
   the chip background AND set no explicit text color, so in light mode the
   chips rendered dark-on-dark and were unreadable (the inherited text is dark
   in light mode). Re-skin here with theme-aware tokens so they read correctly
   in both themes. Higher specificity (.copyable, which every chip carries) wins
   over the template's `.ip-ind` regardless of stylesheet order. Kept in
   shared.css rather than the template to avoid a concurrently-edited file. */
.ip-ind.copyable {
  background: var(--surface-3);
  color: var(--text-color);
  border: 1px solid var(--border-default);
}

/* ── Mobile: Notification panel ── */
@media (max-width: 768px) {
  #notifPanel {
    width: calc(100vw - 16px) !important;
    max-width: 360px !important;
    right: 8px !important;
    left: auto !important;
  }
}
@media (max-width: 480px) {
  #notifPanel {
    width: calc(100vw - 16px) !important;
    right: 8px !important;
    left: 8px !important;
    max-width: none !important;
  }
}

/* ── Mobile: Nav tabs horizontal scroll ── */
@media (max-width: 768px) {
  .nav-tabs {
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior: contain;
    flex-wrap: nowrap !important;
    scrollbar-width: none;       /* Firefox */
  }
  .nav-tabs::-webkit-scrollbar { display: none; }  /* Chrome/Safari */
  .nav-tabs .nav-link {
    padding: 8px 12px !important;
    font-size: var(--text-sm) !important;
  }
  .nav-tabs .nav-item { flex-shrink: 0; }
}
@media (max-width: 480px) {
  .nav-tabs .nav-link {
    padding: 8px 10px !important;
    font-size: var(--text-xs) !important;
  }
  .nav-tabs .nav-link i { display: none; } /* Hide icons on very small screens */
}

/* ── Mobile: Touch targets (WCAG 44px minimum) ── */
@media (max-width: 768px) {
  .btn-primary, .btn-secondary, .btn-outline-theme, .iu-btn, .pi-btn {
    min-height: 44px;
    padding: var(--space-2h) var(--space-3h) !important;
    font-size: var(--text-sm) !important;
  }
  .navbar .btn-outline-theme { min-height: 44px; min-width: 44px; }
  /* iOS zoom prevention: inputs must be >= 16px */
  input, select, textarea,
  .filter-sidebar .filter-group select,
  .filter-sidebar .filter-group input,
  .form-control, .form-select {
    min-height: 44px;
    font-size: var(--text-lg) !important;  /* prevents iOS auto-zoom on focus */
  }
  /* Toast notifications — keep within viewport */
  .toast-container { right: 8px !important; left: 8px !important; top: 60px !important; }
  .toast-notification { min-width: auto !important; max-width: 100% !important; }
}

/* ── Mobile: Intelligence page grids ── */
@media (max-width: 768px) {
  .iu-stats { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  .iu-grid { grid-template-columns: 1fr !important; gap: 10px !important; }
  .iu-card { padding: 12px !important; }
  .iu-card h6 { font-size: var(--text-xs) !important; }
  .iu-stat .val { font-size: var(--text-lg) !important; }
  .iu-stat .lbl, .iu-stat .sub, .iu-stat .entity { font-size: var(--text-3xs) !important; }
  .iu-table td, .iu-table th { padding: 6px 6px !important; font-size: var(--text-2xs) !important; }
  .iu-full { grid-column: 1 / -1 !important; }
}
@media (max-width: 480px) {
  .iu-stats { grid-template-columns: repeat(2, 1fr) !important; }
  .iu-stat { padding: 10px !important; }
  .iu-stat .val { font-size: var(--text-md) !important; }
}

/* ── Mobile: Chart height reduction ── */
@media (max-width: 480px) {
  .iu-card canvas, .pi-card canvas, .it-card canvas { max-height: 220px !important; }
  [style*="height:300px"], [style*="height:320px"], [style*="height:360px"] { height: 220px !important; }
}

/* ── Mobile: Tooltips viewport-safe ── */
@media (max-width: 768px) {
  .iu-info .iu-tip, .pi-info .pi-info-text {
    min-width: 200px !important;
    max-width: calc(100vw - 32px) !important;
    left: auto !important;
    right: -8px !important;
    transform: none !important;
  }
}

/* ── Mobile: Modal overlays — ensure dismissible ── */
@media (max-width: 768px) {
  .ta-detail-panel, .ta-detail-overlay,
  [style*="position:fixed"][style*="inset:0"],
  [style*="position: fixed"][style*="inset: 0"] {
    max-width: 100vw !important;
  }
  .ta-detail-panel { width: 95vw !important; max-width: 95vw !important; }
}

/* ── Mobile: Table horizontal scroll wrapper ── */
@media (max-width: 768px) {
  .iu-card, .pi-card, .it-card, .glass-card, .card-panel {
    overflow-x: auto;
  }
  .iu-table, .pi-table, .data-table, .admin-table {
    min-width: 420px; /* Allow scroll but less aggressive than 500px */
  }
}

/* ── Mobile: Alert banners ── */
@media (max-width: 768px) {
  .iu-alert, .pi-alert, .it-alert-banner {
    padding: 10px 12px !important;
    font-size: var(--text-xs) !important;
  }
  .iu-alert-title, .pi-alert-title { font-size: var(--text-xs) !important; }
  .iu-alert-narrative, .pi-alert-narrative { font-size: var(--text-2xs) !important; }
}

/* ── Mobile: Discourse pills wrap ── */
@media (max-width: 768px) {
  .iu-disc, .pi-disc, .signal-pills { gap: 6px !important; }
  .iu-disc-pill, .pi-disc-pill, .signal-pill {
    min-width: 120px !important;
    padding: 6px 10px !important;
    font-size: var(--text-2xs) !important;
  }
}

/* ── Mobile: CVE toggle buttons ── */
@media (max-width: 768px) {
  .iu-cve-toggle, .pi-cve-toggle {
    padding: 6px 12px !important;
    min-height: 36px;
  }
}

/* ── Mobile: Fix bottom content cutoff ── */
@media (max-width: 768px) {
  html { height: auto !important; overflow: auto !important; }
  /* --footer-h, not the 50px that once cleared a fixed footer here. */
  body { height: auto !important; min-height: 100vh; overflow-y: auto !important; padding-bottom: var(--footer-h) !important; }
}

/* The phone-only footer block (2026-10-11) is gone: its rules — a static
   footer, no body padding for it, drawers to the edge, /knowledge fixed,
   no view-transition on a footer that scrolls — are the base rules at
   every width since 2026-10-12. See "--- Footer ---" and --footer-h.
   Only that view-transition rule stays here, scoped as it was. */
body:not(.ksf-page) .app-footer { view-transition-name: none; }

/* ── Mobile: Header layout ── */
@media (max-width: 768px) {
  .iu-header, .pi-header, .it-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  .iu-header-actions, .pi-header-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .page-header h1, .page-header h2, .page-header h3 { font-size: var(--text-md); }
  [style*="grid-template-columns:repeat(2"] { grid-template-columns: 1fr !important; }
  .stat-card h3 { font-size: var(--text-lg) !important; }
  #cmdPalette { width: 98vw !important; top: 5% !important; }
  .navbar { padding: 0 8px !important; }
  .card-panel { padding: 10px; }
}

/* --- Skeleton Loader ---
 * Shimmer-animated placeholders to show during async data fetches. Use
 * Cyntel.renderSkeleton(container, type, count) from JS, or drop the
 * markup inline for server-rendered pre-hydration state.
 *
 *   <div class="skeleton skeleton-card">
 *     <div class="skeleton-line w-75"></div>
 *     <div class="skeleton-line w-50"></div>
 *     <div class="skeleton-line w-25"></div>
 *   </div>
 *
 * The shimmer uses --overlay-soft / --overlay-faint so it adapts to
 * dark / light mode automatically. Base swatch pulls from
 * --button-bg for the same reason.
 */
.skeleton {
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--overlay-faint) 35%,
    var(--overlay-soft) 50%,
    var(--overlay-faint) 65%,
    transparent 100%
  );
  animation: shimmer 1.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.skeleton-line {
  height: 12px;
  border-radius: var(--radius-sm);
  background: var(--button-bg);
  margin-bottom: var(--space-2);
}
.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-line.skeleton-line-sm { height: 8px; }
.skeleton-line.skeleton-line-lg { height: 18px; }
.skeleton-line.skeleton-line-xl { height: 28px; }
.skeleton-line.w-100 { width: 100%; }
.skeleton-line.w-90  { width: 90%; }
.skeleton-line.w-75  { width: 75%; }
.skeleton-line.w-60  { width: 60%; }
.skeleton-line.w-50  { width: 50%; }
.skeleton-line.w-33  { width: 33%; }
.skeleton-line.w-25  { width: 25%; }
.skeleton-line.w-15  { width: 15%; }
.skeleton-circle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--button-bg);
}
.skeleton-circle.skeleton-circle-sm { width: 24px; height: 24px; }
.skeleton-circle.skeleton-circle-lg { width: 56px; height: 56px; }

/* Skeleton presets (drop-in loading placeholders) */
.skeleton-card {
  padding: var(--space-4);
  min-height: 120px;
}
.skeleton-card .skeleton-line:first-child { height: 20px; margin-bottom: var(--space-3); }

.skeleton-stat {
  padding: var(--space-4);
  text-align: center;
  min-height: 100px;
}
.skeleton-stat .skeleton-line { margin: var(--space-2) auto; }
.skeleton-stat .skeleton-line:first-child { height: 28px; width: 60%; }
.skeleton-stat .skeleton-line:last-child  { width: 45%; }

.skeleton-chart {
  min-height: 280px;
  padding: var(--space-4);
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: var(--space-2);
}
.skeleton-chart .skeleton-bar {
  flex: 1;
  background: var(--button-bg);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  min-width: 12px;
  max-width: 40px;
}

.skeleton-list {
  padding: var(--space-3);
}
.skeleton-list .skeleton-list-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--input-border);
}
.skeleton-list .skeleton-list-row:last-child { border-bottom: none; }
.skeleton-list .skeleton-list-row .skeleton-line { margin-bottom: var(--space-1); }

/* Skeleton: table row placeholders */
.skeleton-table-row td {
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--input-border);
}
.skeleton-table-row .skeleton-line {
  height: 10px;
  margin: 0;
}
.skeleton-table-row.skeleton-table-row-dense td { padding: var(--space-1) var(--space-3); }

/* --- Micro-interaction: Focus Ring --- */
.focus-ring:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* --- Truncate Text --- */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.text-truncate-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Kbd / Shortcut Badge --- */
kbd {
  background: var(--button-bg);
  border: 1px solid var(--input-border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  color: var(--text-color);
  box-shadow: 0 1px 1px rgba(0,0,0,0.15);
}

/* --- Divider --- */
.divider {
  border: none;
  border-top: 1px solid var(--input-border);
  margin: var(--space-6) 0;
  opacity: 0.5;
}

/* .accent-top utility retired in v2 — the 2px brand-to-purple top
 * stripe was a v1 signature and reads as "2019 fintech." No templates
 * reference .accent-top; the 2 that used --accent-gradient directly
 * (login + 2FA card top-stripes) now carry the gradient inline, per
 * the v2 rule that gradients stay intentional and outside the token
 * system. */

/* --- Nav Tabs — unified "boxed" treatment (v2) ---
 * The active tab renders as a filled panel that appears to attach to the
 * content surface below it. This is the treatment the CVE / IOC / Alerts /
 * MITRE / Threat-Scoring pages already used locally in their inline
 * <style> blocks — consolidated here so every `.nav-tabs` group across
 * the app gets the same affordance.
 *
 * Why boxed and not a bare copper underline (spec §10.5 literal):
 *   - 4 of 8 tab consumers already shipped the boxed look; moving to it
 *     breaks fewer users' habits than breaking four pages.
 *   - The filled active state scans better on dashboards where tabs sit
 *     above dense data tables — "which tab is active?" answers itself.
 *   - Copper color on the label + copper-tinted hover preserves the
 *     brand accent per §10.5's intent without relying on a single 2px
 *     underline as the sole affordance.
 *
 * Mechanics: the tab has a matching card-bg bottom border that blends
 * with the content panel, and margin-bottom: -1px pulls the tab down
 * by 1px so its bottom edge overlaps the `.nav-tabs { border-bottom }`
 * grey hairline — producing the "paper fold" effect where active-tab
 * fill merges seamlessly with the panel underneath. */
.nav-tabs {
  border-bottom: 1px solid var(--input-border);
  gap: 0;
}
.nav-tabs .nav-link {
  color: var(--text-color);
  opacity: 0.65;
  border: 1px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: var(--space-2h) var(--space-4);
  margin-bottom: -1px;  /* overlap the parent's bottom hairline */
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast),
              opacity var(--transition-fast);
}
.nav-tabs .nav-link:hover:not(.active) {
  color: var(--text-color);
  opacity: 0.95;
  border-color: var(--input-border);
  background: var(--brand-tint);  /* copper tint, not blue (was rgba(255, 255, 255, 0.06) in v1) */
}
.nav-tabs .nav-link.active {
  color: var(--primary-color) !important;
  opacity: 1;
  font-weight: 600;
  background: var(--card-bg) !important;
  /* top / right+left / bottom — bottom blends with the panel below */
  border-color: var(--input-border) var(--input-border) var(--card-bg) !important;
}
.nav-tabs .nav-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.nav-tabs .nav-link i,
.nav-tabs .nav-link .cyn-icon { opacity: 0.7; }
.nav-tabs .nav-link.active i,
.nav-tabs .nav-link.active .cyn-icon { opacity: 1; }

/* --- Chart Card --- */
.chart-card {
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-card);
}
.chart-card h5, .chart-card h6 {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-color);
  opacity: 0.55;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.chart-card h5 i, .chart-card h6 i {
  color: var(--primary-color);
  opacity: 0.6;
}

/* --- Card Panel (generic container) --- */
.card-panel {
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}

/* --- Metric Card (KPI stat box) --- */
.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast),
              box-shadow var(--transition-fast),
              border-color var(--transition-fast);
}
/* Hover/focus lift — works for both <div> metric cards and <a>
 * metric cards (Detection & Response cards on the dashboard are
 * link-wrapped). :focus-visible rather than :focus so mouse-clicks
 * don't leave the ring behind.
 */
a.metric-card:hover,
.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  border-color: var(--primary-color);
}
a.metric-card:focus-visible,
.metric-card:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-color: var(--primary-color);
}
.metric-card h3 {
  /* v2 spec §3.6: metric KPI numbers in Newsreader display serif —
   * matches preview/metric-card.html (opsz 60, weight 500, tabular-nums). */
  font-family: var(--font-display);
  font-size: 1.5rem /* drawn size, Newsreader */;
  font-weight: 500;
  font-variation-settings: "opsz" 60;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  line-height: var(--leading-tight);
  margin: 0 0 var(--space-1);
}
.metric-card p {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

/* --- Section Label (section heading) ---
 * v2: mono-typed uppercase rubric in copper with a leading "— " em-dash.
 * Example: "— KEY METRICS". Spec lives in New Design/README.md §Content
 * Fundamentals and preview/*.html headers. Pages that want the v1
 * muted-white label can opt out with .section-label--neutral. */
.section-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--brand);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.section-label::before {
  content: '—';
  color: var(--brand);
  margin-right: var(--space-1);
  font-weight: 400;
  /* Use a horizontal bar glyph rather than a hyphen; line up baseline
   * with the label text instead of the em-dash's slight lift. */
  line-height: 1;
}
.section-label i,
.section-label .cyn-icon { color: var(--brand); opacity: 0.9; }

/* Opt-out: templates that want the v1 muted-gray label (no em-dash,
 * no copper) can add .section-label--neutral. */
.section-label--neutral {
  font-family: var(--font-sans);
  color: var(--text-color);
  opacity: 0.4;
  letter-spacing: 1px;
}
.section-label--neutral::before { content: none; }
.section-label--neutral i,
.section-label--neutral .cyn-icon { color: var(--primary-color); opacity: 0.6; }

/* --- Modal Styling (Enterprise) --- */
.modal-backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  color: var(--text-color);
}
.modal-header {
  border-bottom: 1px solid var(--input-border);
  padding: var(--space-4) var(--space-5);
}
.modal-body { padding: var(--space-5); }
.modal-footer {
  border-top: 1px solid var(--input-border);
  padding: var(--space-3) var(--space-5);
}
.modal-title {
  font-weight: 600;
  font-size: var(--text-lg);
}
/* Bootstrap's .btn-close is a hard-coded near-black SVG glyph, so on the dark
   canvas it is a black X on a dark surface — effectively invisible. Every page
   that noticed re-fixed it locally (telegram_groups inverted it; pir_coverage
   reached for a var(--btn-close-filter) that was never defined and so got
   `none`); change_password + setup_2fa never noticed and shipped an invisible
   dismiss control. One themed token, applied once, covers all four. (§10.195) */
.btn-close { filter: var(--btn-close-filter); }

/* --- Admin / Form Modals (um-modal pattern) ---
 * Transition-based open/close (not @keyframes) so the animation
 * naturally reverses when the .show class is removed. Previously
 * .show add ran a keyframe entrance but .show remove jumped straight
 * to display:none with no exit animation.
 *
 * How it works:
 *   - Base (.um-modal-overlay without .show): display:none, backdrop
 *     transparent, dialog at scale(0.96) translateY(8px) opacity 0.
 *   - .show added: display flips to flex immediately via the discrete
 *     transition (allow-discrete). @starting-style forces the initial
 *     opacity/transform values to the hidden state so the transition
 *     has somewhere to animate *from*, producing a fade + scale-up.
 *   - .show removed: transition plays in reverse (fade + scale-down),
 *     then display flips back to none once the 220ms transition ends.
 *
 * Needs `transition-behavior: allow-discrete` + `@starting-style` —
 * Chromium 117+, Firefox 129+, Safari 17.5+. Older browsers lose the
 * nice entrance but exit still works via opacity/transform transition
 * before the display:none kicks in. Acceptable degradation.
 */
.um-modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0);
  /* Must clear the navbar (1030) and notification panel (1050), otherwise the
   * scrim renders *under* them and they stay clickable while a modal is open
   * (UI_POLISH_AUDIT P0-11). Cyntel.confirm used to patch this inline. */
  z-index: var(--z-modal);
  align-items: center; justify-content: center;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: background var(--dur-fast) ease,
              backdrop-filter var(--dur-fast) ease,
              -webkit-backdrop-filter var(--dur-fast) ease,
              display var(--dur-normal) allow-discrete;
}
.um-modal-overlay .um-modal {
  /* Dialog starts offset + shrunk + invisible. Transitions to the
   * final shape when the parent gets .show. */
  opacity: 0;
  transform: scale(0.96) translateY(8px);
  transition: opacity var(--dur-normal) var(--ease-out-expo),
              transform var(--dur-normal) var(--ease-out-expo);
}
.um-modal-overlay.show {
  display: flex;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.um-modal-overlay.show .um-modal {
  opacity: 1;
  transform: none;
}
/* @starting-style fires the transition *from* the hidden state on first
 * apply. Without this, the transition has no starting point when the
 * element was display:none, so it'd jump straight to the final state. */
@starting-style {
  .um-modal-overlay.show {
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
  }
  .um-modal-overlay.show .um-modal {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .um-modal-overlay, .um-modal-overlay .um-modal { transition: none; }
}

/* ─── Bootstrap modal entrance → aligned onto the .um-modal signature ───
 * The two Bootstrap `.modal.fade` modals (telegram_groups, pir_coverage) used
 * Bootstrap's default 0.3s drop-from-top; the app's own .um-modal rises with a
 * 220ms ease-out-expo scale(.96). This makes Bootstrap adopt that same motion
 * so every modal opens the same way. shared.css loads after Bootstrap, so this
 * wins on cascade. TRANSFORM ONLY — opacity/visibility stay Bootstrap's, so a
 * modal can never get stuck invisible if the markup differs. (UI_POLISH_AUDIT
 * Wave 3.) */
.modal.fade .modal-dialog {
  transform: scale(0.96) translateY(8px);
  transition: transform var(--dur-normal) var(--ease-out-expo);
}
.modal.show .modal-dialog {
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .modal.fade .modal-dialog { transition: none; }
}
.um-modal {
  background: var(--card-bg); border: 1px solid var(--input-border);
  border-radius: var(--radius-md); width: 520px; max-width: 95vw;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-modal);   /* was 0 20px 60px rgba(0,0,0,.4); tokenised — now softer on light */
}
.um-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--input-border);
}
.um-modal-header h5 {
  margin: 0; font-size: var(--text-md); font-weight: 600; color: var(--text-color);
}
.um-modal-close {
  background: none; border: none; color: var(--text-color); opacity: 0.5;
  font-size: var(--text-lg); cursor: pointer; transition: opacity var(--transition-fast);
}
.um-modal-close:hover { opacity: 1; }

/* ⚠ THE ADMIN CONSOLE'S CONTROLS HAD NO FOCUS RULE AT ALL — 22 focusable
   elements across the user-management surfaces, measured 2026-09-10. They took
   the browser default, which on this ground reads as a different product's
   ring. Grouped rather than written eight times: the declaration is identical
   for all of them, and one rule is one place to audit.
   `outline: none` is safe ONLY because the box-shadow replaces it — never
   write the first half without the second. */
.um-btn:focus-visible,
.um-btn-ghost:focus-visible,
.um-btn-go:focus-visible,
.um-dangerbtn:focus-visible,
.um-minibtn:focus-visible,
.um-modal-close:focus-visible,
.um-panel-x:focus-visible,
.um-pw-field .um-pw-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.um-modal-body { padding: var(--space-5); }
.um-modal-footer {
  padding: var(--space-3) var(--space-5); border-top: 1px solid var(--input-border);
  display: flex; justify-content: flex-end; gap: var(--space-2h);
}

/* --- Cyntel.prompt / alert / confirm dialog internals ---
   Shared primitive styles for the themed dialog body. The dialog itself
   reuses .um-modal-overlay + .um-modal + .um-modal-header/body/footer;
   these two classes cover the pieces the JS helper injects: the message
   paragraph and the prompt input. Matching .um-form-group input
   treatment so focus + colors are consistent with the rest of the app. */
.cd-msg {
  margin: 0 0 var(--space-3); color: var(--text-color);
  font-size: var(--text-sm); line-height: var(--leading-relaxed);
}
/* A choice inside a confirmation (the domain delete's "also purge" box). */
.cd-check { display: flex; align-items: flex-start; gap: var(--space-2); cursor: pointer; }
.cd-check input { margin-top: var(--space-1); flex: none; }
/* Evidence inside a confirmation. Added 2026-09-08 for "this account still
   holds N open cases": a warning line plus the cases themselves, because a
   count without the case numbers leaves the admin nowhere to go next. Amber,
   not red — the dialog's own danger styling already carries the destructive
   weight, and a second red would flatten the distinction. */
.um-warn {
  color: var(--warning-color);
  border-inline-start: 2px solid var(--warning-color);
  padding-inline-start: var(--space-3);
}
.um-workload {
  margin: 0 0 var(--space-3); padding-inline-start: var(--space-5);
  font-size: var(--text-sm); line-height: var(--leading-relaxed);
  color: var(--text-secondary); max-height: 9rem; overflow-y: auto;
}
.um-workload a { color: var(--primary-color); }
.um-workload-more { list-style: none; margin-inline-start: calc(-1 * var(--space-4));
  color: var(--text-secondary); font-style: italic; }

.cd-input {
  width: 100%; padding: var(--space-2) var(--space-3); font-size: var(--text-base);
  background: var(--input-bg); border: 1px solid var(--input-border);
  border-radius: var(--radius-sm); color: var(--text-color);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.cd-input:focus {
  outline: none; border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--glow-primary);
}

.um-form-group { margin-bottom: var(--space-4); }
.um-form-group label {
  display: block; font-size: var(--text-sm); font-weight: 600;
  color: var(--text-color); margin-bottom: var(--space-1);
}
/* Inputs, selects, and textareas share the same chrome so modals with
 * a mix of field types (e.g. New Case: title + description + category
 * + severity) look unified. `font-family: inherit` keeps textareas
 * from falling back to the browser-default monospace, which would
 * visibly clash with the rest of the modal. */
.um-form-group input, .um-form-group select, .um-form-group textarea {
  width: 100%; padding: var(--space-2) var(--space-3); font-size: var(--text-base);
  border: 1px solid var(--input-border); border-radius: var(--radius-sm);
  background: var(--input-bg); color: var(--text-color); box-sizing: border-box;
  font-family: inherit;
}
.um-form-group input:focus, .um-form-group select:focus, .um-form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  /* Box-shadow adds a second visual indicator alongside the border-
   * color change — keyboard users relying on focus tracking need the
   * extra contrast for WCAG 2.1 SC 2.4.7 (Focus Visible). */
  box-shadow: 0 0 0 3px var(--glow-primary);
}
.um-form-group textarea { resize: vertical; min-height: 72px; line-height: var(--leading-normal); }
/* Side-by-side field layout for two or three short selects that belong
 * together (Category + Severity + TLP, etc). Collapses to a single column
 * on narrow screens so small phones don't get a horizontally-squished mess. */
.um-form-row { display: flex; gap: var(--space-3); }
.um-form-row .um-form-group { flex: 1; margin-bottom: var(--space-4); }
@media (max-width: 560px) {
  .um-form-row { flex-direction: column; gap: 0; }
}

/* --- Chip / tag input ---
 * Used by Cyntel.chipInput() in cyntel-helpers.js. The wrap looks like a
 * single input field but contains pill-shaped chips plus a trailing
 * free-text input. Typed text becomes a chip on Enter, comma, or blur.
 * Backspace on an empty input pops the most recent chip. */
.um-chip-input-wrap {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--input-border); border-radius: var(--radius-sm);
  background: var(--input-bg); min-height: 38px; align-items: center;
  cursor: text;  /* so clicking anywhere in the wrap focuses the input */
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.um-chip-input-wrap:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--glow-primary);
}
.um-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 4px 2px 8px;
  background: rgba(217, 119, 6,0.15); color: var(--primary-color);
  border-radius: 3px; font-size: var(--text-xs); font-weight: 500;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.um-chip-remove {
  background: none; border: none; color: inherit; cursor: pointer;
  padding: 0 2px; font-size: var(--text-md); line-height: 1; opacity: 0.6;
  transition: opacity var(--transition-fast);
}
.um-chip-remove:hover { opacity: 1; }
.um-chip-input {
  flex: 1; min-width: 100px; border: none; outline: none;
  background: transparent; color: var(--text-color);
  font-size: var(--text-base); padding: 2px 0;
}
/* Override the inherited :focus ring from .um-form-group because the
 * wrap already shows the focus state via :focus-within. */
.um-form-group .um-chip-input:focus { box-shadow: none; border: none; }

/* UI-6: a duplicate TLP-badge block lived here (a second .tlp-badge rule + a
 * ::before dot + unprefixed .tlp-white/green/amber/red with hardcoded hex). It
 * conflicted with the canonical, theme-aware .tlp-badge definition above and
 * was deleted; the dot moved up there. All templates use class tlp-badge plus
 * tlp-<level>, which the prefixed rules above cover. */

/* --- Back link (pill-shaped nav affordance) ---
 * Replaces bare "← Back to X" text links on detail pages with a
 * proper pill-shaped button. Hover slides the arrow left (reinforces
 * the "going back" direction) + fills a subtle background. Active
 * state scales down slightly for press feedback. The pill isn't
 * emphasised enough to compete with the primary action button on
 * the same page — it's a secondary affordance by design. */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: var(--space-1h) var(--space-3h) var(--space-1h) var(--space-3);
  border-radius: 0;  /* square, like every control (BRAND.md §4b) */
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--input-border);
  transition:
    color var(--transition-fast),
    background var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}
.back-link i {
  font-size: var(--text-xs);
  transition: transform var(--transition-fast), color var(--transition-fast);
}
.back-link:hover {
  color: var(--text-color);
  background: var(--input-bg);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.08);
}
.back-link:hover i {
  /* -3px matches the arrow-style "wiggle" that most modern apps use
   * for back links. Subtle enough not to feel like motion-sickness;
   * enough to reinforce what the link does. */
  transform: translateX(-3px);
  color: var(--primary-color);
}
.back-link:active { transform: scale(0.98); }
.back-link:focus-visible {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--glow-primary);
}

/* --- Search input with clear-button (.search-input-wrapper) ---
 * Drop-in wrapper for any text/search input that needs an inline
 * "× clear" affordance. Markup:
 *
 *   <div class="search-input-wrapper">
 *     <input type="text" placeholder="Search...">
 *     <button type="button" class="search-input-clear" aria-label="Clear search">&times;</button>
 *   </div>
 *
 * Cyntel.bindSearchInputClear() (cyntel-helpers.js) handles the
 * show/hide of the × based on the input's current value, plus the
 * click-to-clear + dispatch-input-event so any oninput listener
 * re-fires. Pure progressive enhancement — without JS the input
 * still works, only the × is non-functional.
 *
 * Width respects whatever the parent layout dictates; the wrapper
 * only adds positioning context for the absolutely-placed button. */
.search-input-wrapper {
  position: relative;
  display: block;
}
.search-input-wrapper > input {
  width: 100%;
  padding-right: 28px;        /* leave room for the × button */
}
.search-input-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  display: none;              /* shown via .has-value, see below */
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-color);
  opacity: 0.5;
  font-size: var(--text-lg);
  line-height: 1;
  cursor: pointer;
  transition: opacity var(--transition-fast),
              background var(--transition-fast);
}
.search-input-wrapper.has-value .search-input-clear {
  display: inline-flex;
}
.search-input-clear:hover {
  opacity: 1;
  background: var(--input-bg);
}
.search-input-clear:focus-visible {
  opacity: 1;
  outline: 2px solid var(--primary-color);
  outline-offset: 1px;
}

/* --- Copy-on-click ---
 * Any element with class .copyable becomes click-to-copy — shows a
 * pointer cursor, primary-coloured hover, and a copy glyph that
 * fades in on hover. Actual copying is handled by a document-level
 * click listener in cyntel-helpers.js. The element can specify an
 * override copy value via data-copy="..." (useful when the display
 * text is truncated or includes context the user doesn't want). */
.copyable {
  cursor: copy;
  position: relative;
  transition: color var(--transition-fast);
}
.copyable:hover {
  color: var(--primary-color);
}
.copyable::after {
  content: '\f0c5';                /* fa-copy (solid) */
  font-family: 'Font Awesome 6 Free', 'Font Awesome 5 Free';
  font-weight: 900;
  margin-left: 5px;
  font-size: var(--text-2xs);
  opacity: 0;
  transition: opacity var(--transition-fast);
  color: var(--primary-color);
}
.copyable:hover::after {
  opacity: 0.65;
}

/* --- Inline edit (Cyntel.inlineEdit) ---
 * Marks up elements as click-to-edit. On hover, a subtle bg tint +
 * a small pen icon signals "this is editable"; on click, the element
 * is replaced by an input/textarea for quick edit. Used on case
 * detail title + description so analysts don't need to open the
 * Edit modal for single-field tweaks. */
.inline-editable {
  cursor: text;
  transition: background var(--transition-fast);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  margin: -2px -6px;  /* cancels the hover padding shift */
  position: relative;
}
.inline-editable:hover {
  background: rgba(217, 119, 6, 0.08);
}
.inline-editable:hover::after {
  content: '\f303';                /* fa-pen */
  font-family: 'Font Awesome 6 Free', 'Font Awesome 5 Free';
  font-weight: 900;
  margin-left: 8px;
  font-size: var(--text-2xs);
  opacity: 0.6;
  color: var(--primary-color);
  vertical-align: middle;
}
.inline-edit-wrap {
  display: flex; flex-direction: column; gap: 4px;
  margin: -2px -6px;  /* align with the editable's negative margins */
}
.inline-edit-field {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--primary-color);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  color: var(--text-color);
  font: inherit;  /* match the replaced element's typography exactly */
  box-shadow: 0 0 0 3px var(--glow-primary);
  outline: none;
  resize: vertical;
}
.inline-edit-hint {
  font-size: var(--text-2xs);
  color: var(--text-secondary);
  opacity: 0.6;
  padding-left: var(--space-1);
  letter-spacing: 0.02em;
}

/* Density-mode CSS (body.density-compact) was removed 2026-04-29
 * along with the navbar toggle button + JS handler. The default
 * "comfortable" sizing is the only mode now. */

/* --- Slide-over detail pane (generic) ---
 * 560px right-hand panel that slides in for "quick look" previews
 * without leaving the list view. Originally built for /cases under
 * the `.case-preview-*` prefix; now promoted to a generic `.preview-*`
 * family that any list can adopt. Both selectors are accepted so
 * existing cases.html markup keeps working.
 *
 * Sits ABOVE content but BELOW modals (z-index 1000 vs modal 9000)
 * so opening a confirm from within the pane layers correctly.
 *
 * Transform-based slide-in so it doesn't reflow the page. Backdrop
 * is a separate half-opacity layer — click outside = close. */
.case-preview-backdrop,
.preview-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-hover) ease;
}
.case-preview-backdrop.show,
.preview-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
.case-preview-pane,
.preview-pane {
  position: fixed;
  top: var(--nav-height);           /* below the navbar (token — see :root) */
  inset-inline-end: 0;              /* logical: the LEFT edge in Arabic, like .pa-pane */
  bottom: var(--footer-h);          /* above a fixed footer, if any (:root) */
  width: 560px;
  max-width: calc(100vw - 40px);
  background: var(--card-bg);
  border-inline-start: 1px solid var(--input-border);
  box-shadow: var(--shadow-drawer);   /* was -12px 0 30px rgba(0,0,0,.25); tokenised — theme-aware */
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--dur-panel) var(--ease-out-expo);
}
.case-preview-pane.show,
.preview-pane.show { transform: translateX(0); }
/* The drawers opened on the physical right in Arabic while every .pa-pane
   opened on the left: two drawer families, two sides. Both follow the inline
   end now, and the hidden offset follows the anchor. */
[dir="rtl"] .case-preview-pane:not(.show),
[dir="rtl"] .preview-pane:not(.show) { transform: translateX(-100%); }
/* Its shadow falls toward the page, so it mirrors with the side. */
[dir="rtl"] .case-preview-pane,
[dir="rtl"] .preview-pane { box-shadow: var(--shadow-drawer-rtl); }
@media (prefers-reduced-motion: reduce) {
  .case-preview-pane,
  .preview-pane { transition: none; }
  .case-preview-backdrop,
  .preview-backdrop { transition: none; }
}

.case-preview-header,
.preview-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--input-border);
  flex-shrink: 0;
}
.case-preview-title-row,
.preview-title-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-2); margin-bottom: var(--space-2);
}
.case-preview-number,
.preview-number {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--primary-color);
  letter-spacing: 0.04em;
}
/* Canonical close-button used by every slide-over / modal / preview
 * surface. Matches .preview-pane's header (where it sits on the
 * right of the title row), the legacy .case-preview-* family, and
 * is the migration target for older bespoke close-buttons across
 * the app (.ta-detail-close, .group-modal-close, .graph-close,
 * inline &times; buttons in attack_surface / phishing / detection).
 *
 * Sized for both pointer + touch (32x32 min hit area) and includes
 * a visible focus ring for keyboard navigation. The font-size: 22px
 * sets the glyph size for both the &times; HTML entity and any
 * <i class="fas fa-times"> icon callers want to swap in. */
.case-preview-close,
.preview-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;   /* square, like every control (BRAND.md §4b) */
  color: var(--text-color);
  opacity: 0.55;
  font-size: var(--text-section);
  line-height: 1;
  cursor: pointer;
  transition: opacity var(--transition-fast),
              background var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast);
}
.case-preview-close:hover,
.preview-close:hover {
  opacity: 1;
  background: var(--input-bg);
  border-color: var(--input-border);
}
.case-preview-close:focus-visible,
.preview-close:focus-visible {
  opacity: 1;
  outline: 2px solid var(--primary-color);
  outline-offset: 1px;
}
.case-preview-close:active,
.preview-close:active {
  background: var(--button-bg-hover);
}
/* Variant for absolute-positioned close buttons (used inside panels
 * that don't have a .preview-header but need a close glyph in the
 * top-right corner — e.g. attack_surface IP detail, phishing analysis). */
.preview-close--floating {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}
.case-preview-title,
.preview-title {
  font-size: var(--text-lg); font-weight: 700; margin: 0 0 10px;
  line-height: 1.3; word-break: break-word;
}
.case-preview-meta,
.preview-meta {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.case-preview-body,
.preview-body {
  flex: 1; overflow-y: auto; padding: 20px 24px;
}
.case-preview-footer,
.preview-footer {
  padding: var(--space-3h) var(--space-6);
  border-top: 1px solid var(--input-border);
  display: flex; justify-content: flex-end; gap: var(--space-2);
  flex-shrink: 0;
}

/* "Open preview" affordance on list rows. Apply to a <td> cell and
   the whole row gets a subtle arrow column that becomes visible on
   hover — signals the row is clickable without each page having to
   invent its own arrow. */
.preview-trigger-cell {
  width: 28px; text-align: center; color: var(--text-disabled);
  font-size: var(--text-xs);
}
tr:hover .preview-trigger-cell { color: var(--primary-color); }
.preview-trigger-btn {
  background: none; border: none; padding: 4px 6px;
  color: inherit; cursor: pointer; border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
.preview-trigger-btn:hover {
  background: var(--button-bg);
}
.preview-trigger-btn:focus-visible {
  outline: 2px solid var(--primary-color); outline-offset: -2px;
}

/* Section headers inside preview bodies */
.preview-section {
  margin-bottom: var(--space-4);
}
.preview-section-title {
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  display: inline-flex; align-items: center; gap: var(--space-1h);
}
.preview-section-title i { color: var(--primary-color); opacity: 0.7; }
.preview-kv {
  display: grid; grid-template-columns: max-content 1fr;
  gap: 6px var(--space-3);
  font-size: var(--text-sm);
}
.preview-kv dt {
  color: var(--text-secondary);
  font-weight: 500;
}
.preview-kv dd {
  margin: 0;
  color: var(--text-color);
  word-break: break-word;
}
.preview-empty {
  text-align: center; padding: var(--space-5) var(--space-3);
  color: var(--text-disabled); font-size: var(--text-sm);
}
.preview-loading {
  padding: var(--space-5);
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.preview-loading i { margin-right: var(--space-1h); }

.preview-tags {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-bottom: 16px;
}
.preview-section { margin-bottom: 20px; }
.preview-section:last-child { margin-bottom: 0; }
.preview-section-label {
  font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; opacity: 0.55; margin-bottom: 8px;
}
.preview-description {
  font-size: var(--text-sm); line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
  padding: 10px 12px;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
}
.preview-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin-bottom: 20px;
}
.preview-stat {
  text-align: center;
  padding: 12px 8px;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--input-border);
}
.preview-stat-val {
  font-size: var(--text-xl); font-weight: 700;
  color: var(--primary-color); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.preview-stat-lbl {
  font-size: var(--text-2xs); text-transform: uppercase;
  letter-spacing: 0.06em; opacity: 0.55; margin-top: 4px;
}
.preview-tl-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--glass-border);
  font-size: var(--text-xs);
  line-height: 1.45;
}
.preview-tl-row:last-child { border-bottom: none; }
.preview-tl-actor { font-weight: 600; margin-right: 6px; }
.preview-tl-comment { opacity: 0.85; }
.preview-tl-time { display: block; font-family: var(--font-mono); opacity: 0.4; font-size: var(--text-2xs); margin-top: 2px; }

/* --- Analytics grid (Cases analytics tab) ---
 * 2-column chart grid inside the Analytics view. Collapses to a single
 * column under 900px so each chart keeps a readable minimum width.
 * Individual cards get a subtle border + title line so the grid reads
 * as structured panels rather than a blob of canvases. */
.analytics-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 900px) {
  .analytics-grid { grid-template-columns: 1fr; }
}
.analytics-card {
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
}
.analytics-card-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.55;
  margin-bottom: var(--space-2);
}

/* --- Active filter chips ---
 * Rendered above list tables by Cyntel.renderFilterChips to show
 * which filters are currently applied. Each chip has an × for
 * one-click removal. "Clear all" appears when 2+ are active.
 * Hidden (display:none) by the helper when no filters are set, so
 * the chip row doesn't occupy vertical space on unfiltered views. */
.active-filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  margin: 0 0 var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px dashed var(--input-border);
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 10px;
  border-radius: 0;
  background: rgba(217, 119, 6, 0.10);
  border: 1px solid rgba(217, 119, 6, 0.25);
  font-size: var(--text-xs);
  color: var(--text-color);
  line-height: var(--leading-tight);
}
.filter-chip-label {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.65;
  font-weight: 600;
  font-size: var(--text-2xs);
}
.filter-chip-value {
  font-weight: 500;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filter-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  color: inherit;
  opacity: 0.55;
  font-size: var(--text-md);
  line-height: 1;
  transition: opacity var(--transition-fast);
}
.filter-chip-remove:hover { opacity: 1; }
.filter-chip-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary-color);
  padding: 3px 6px;
  font-size: var(--text-xs);
  font-weight: 600;
  margin-left: auto;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
.filter-chip-clear:hover { background: rgba(217, 119, 6, 0.08); }

/* --- Bulk action bar ---
 * Floating toolbar that slides up from the bottom-centre when the user
 * ticks at least one row checkbox on a list view. Used by /cases today;
 * the class names are deliberately generic so it can be reused on other
 * list pages (IOCs, alerts, phishing candidates) without renaming.
 *
 * Fixed positioning + translate-based transition gives a non-layout-
 * shift entrance — the bar never pushes page content up or down when
 * it appears/disappears, so pagination clicks don't become a moving
 * target while the analyst is mid-drag. */
.bulk-action-bar {
  position: fixed; left: 50%;
  /* Clear of a fixed footer where there is one, with breathing room
   * (--bulk-bottom, :root) — the footer scrolls with the page since
   * 2026-10-12, so that is 16px off the window's edge. z-index stays
   * above --z-footer (1020) for /knowledge, the one fixed footer. */
  bottom: var(--bulk-bottom);
  transform: translate(-50%, calc(100% + var(--space-5)));
  /* off-screen by default — translated down by its own height + gap */
  display: flex; align-items: center; gap: var(--space-2);
  flex-wrap: wrap; max-width: calc(100vw - var(--space-4) * 2);
  padding: var(--space-2) var(--space-3);
  background: var(--card-bg); border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4), 0 0 0 1px rgba(0,0,0,0.05);
  z-index: 1030;  /* above --z-footer (1020), below --z-modal (9000) */
  /* NB: --transition-normal already contains an easing ("0.22s ease") — a
   * second timing function after it makes the declaration invalid CSS and
   * the bar snaps instead of sliding (UI_POLISH_AUDIT P0-1). */
  transition: transform var(--transition-smooth),
              opacity var(--transition-fast);
  opacity: 0; pointer-events: none;
}
.bulk-action-bar.show {
  transform: translate(-50%, 0);
  opacity: 1; pointer-events: auto;
}
/* ⚠ LOGICAL. The bulk bar reads "2 selected" — the number, then a gap, then
   the word — so both of these are gaps AFTER their element in reading order,
   not gaps on the right. Under `dir=rtl` a physical `right` puts the space on
   the wrong side of the count and the number collides with the noun it
   belongs to. This bar is the shared macro on seven pages, so the RTL defect
   was on all seven at once. */
.bulk-count {
  font-size: var(--text-sm); color: var(--text-color);
  white-space: nowrap; padding-inline-end: var(--space-1);
}
.bulk-count strong {
  color: var(--primary-color); font-weight: 700; margin-inline-end: 3px;
}
.bulk-divider {
  width: 1px; height: 20px; background: var(--input-border);
  margin: 0 var(--space-1);
}
/* Both emitted by the bulk_bar() macro for the v2 bar (PATTERNS.md §6b), and
   therefore rendered on the FIVE callers still on this pre-redesign shell as
   well. Defined here so they are not undefined classes on those five: the
   noun stays visible ("2 exposures selected" is this shell's copy), and the
   pre-delete divider is just a divider until page-archetypes.css thickens it
   to the 2px §6b asks for. */
.bulk-count-noun { display: inline; }
.bulk-divider--hard { width: 1px; }
.bulk-select {
  padding: 4px 8px; font-size: var(--text-xs);
  background: var(--input-bg); color: var(--text-color);
  border: 1px solid var(--input-border); border-radius: var(--radius-sm);
  min-width: 110px; cursor: pointer;
}
.bulk-select:focus {
  outline: none; border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--glow-primary);
}
@media (max-width: 720px) {
  /* On narrow screens the bar takes the full width and stacks so each
   * action still has room to breathe. Without this it overflows off
   * the right edge and some buttons become unreachable.
   * Uses the same 54px bottom offset as the desktop rule above so the
   * app-footer never clips the bar regardless of viewport size. */
  .bulk-action-bar {
    left: var(--space-3); right: var(--space-3); bottom: 54px;
    transform: translateY(calc(100% + var(--space-5)));
    max-width: none;
  }
  .bulk-action-bar.show { transform: translateY(0); }
  .bulk-divider { display: none; }
}
.um-hint {
  font-size: var(--text-xs); color: var(--text-color); opacity: 0.5; margin-top: 3px;
}
.um-modules-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-1h); margin-top: var(--space-1h);
}
.um-module-check {
  display: flex; align-items: center; gap: var(--space-1h);
  padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm);
  font-size: var(--text-sm); color: var(--text-color); cursor: pointer;
  transition: background var(--transition-fast);
}
.um-module-check:hover { background: rgba(217, 119, 6,0.08); }
.um-module-check input[type="checkbox"] { accent-color: var(--primary-color); }
/* The `i` rule that sat here styled the per-module FontAwesome glyph. e4b9bda
   removed the last emitter when the console went type-only, and the `icon`
   field left the RBAC payload with it — both module editors are label-only. */
.um-pw-field { position: relative; }
.um-pw-field .um-pw-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-color); opacity: 0.4;
  cursor: pointer; font-size: var(--text-sm);
}
.um-pw-field .um-pw-toggle:hover { opacity: 0.8; }

/* ── User management panels (Create user / Edit user) ─────────────────────
   REDESIGN/latest "Cyntelligence - Create User.dc.html". SCOPED to
   `.um-modal--panel`, deliberately: `um-*` dresses every admin modal — orgs,
   chip inputs, confirms — and restyling the base would redesign eleven dialogs
   nobody asked about. The overlay, the .show transition and the ids the JS
   reads are untouched; only the two user modals opt in.

   ⚠ EVERY VALUE HERE IS A TOKEN, AND THE SOURCE DESIGN IS NOT.
   The .dc.html is authored in raw hex and `rgba(255,255,255,.16)` borders —
   correct for a canvas that only ever renders dark, fatal here. PATTERNS §18
   records this exact transcription happening 14 times in page-archetypes.css:
   a literal never reaches the token layer, so `lint_contrast` passed all 56
   pairs while every one of those borders composited to 1.00–1.02:1 against the
   light ground — form-control borders, row hovers and fences all INVISIBLE in
   light mode. The design's palette IS this system's (its #D97706 and #F9A93C
   are --amber and --amber-lit exactly), so mapping is recovery, not
   approximation. Two roles differ by one ramp step: the panel takes
   --surface-2 (#151517) where the canvas drew #0E0E10, and the inset takes
   --surface-0 (#060607) which is exact. The RELATIONSHIP the design depends on
   — inset darker than panel — holds in both themes. */
.um-modal--panel {
  width: 600px; max-width: calc(100vw - var(--space-6));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-top: 2px solid var(--primary-color);
  padding: 0;
}
.um-panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-hairline);
}
.um-eyebrow {
  font-family: var(--font-mono); font-size: var(--text-2xs);
  letter-spacing: .28em; text-transform: uppercase; color: var(--text-secondary);
}
.um-panel-title {
  font-family: var(--font-display); font-size: 1.5rem /* drawn size, Newsreader */; font-weight: 400;
  letter-spacing: -.01em; color: var(--text-color); margin-top: var(--space-1);
}
/* The subject of an EDIT — a username is data, so it is set in mono and in the
   accent, the same way an id is treated everywhere else in the product. */
.um-panel-title .um-subject {
  font-family: var(--font-mono); font-size: var(--text-xl); color: var(--amber-text);
}
.um-panel-x {
  font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-secondary);
  background: none; border: 1px solid var(--border-strong);
  width: 28px; height: 28px; flex: none; cursor: pointer; line-height: 1;
}
.um-panel-x:hover { color: var(--amber-text); border-color: var(--primary-color); }

.um-panel-body { padding: var(--space-5) var(--space-6) 0; display: grid; gap: var(--space-5); }
.um-panel-body .um-field { margin: 0; }
.um-2col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

.um-modal--panel label,
.um-modal--panel .um-fieldlabel {
  display: block; font-family: var(--font-mono); font-size: var(--text-2xs);
  letter-spacing: .18em; text-transform: uppercase; color: var(--text-secondary);
  margin-bottom: var(--space-1h); font-weight: 400;
}
.um-modal--panel .um-fieldlabel .um-sub {
  letter-spacing: .1em; color: var(--text-tertiary); text-transform: none;
}
.um-modal--panel input[type="text"],
.um-modal--panel input[type="password"],
.um-modal--panel select {
  width: 100%; background: var(--void-2);
  border: 1px solid var(--border-strong); color: var(--text-color);
  font-family: var(--font-mono); font-size: var(--text-base);
  padding: var(--space-2h) var(--space-3); border-radius: 0; box-shadow: none;
}
.um-modal--panel input:focus, .um-modal--panel select:focus {
  outline: 2px solid var(--primary-color); outline-offset: -1px; border-color: transparent;
}
.um-modal--panel .um-hint {
  font-family: var(--font-mono); font-size: var(--text-2xs);
  color: var(--text-tertiary); margin-top: var(--space-1h);
}

/* Password rules met. FIVE segments for the five client-checkable rules in
   routes/auth.py:_validate_password — length >= 10, upper, lower, digit,
   special — not a strength score, which the validator never computes. The
   sixth check (common-password list) is server-side only, so a full row is
   "every rule I can test passes", never "this will be accepted". */
.um-meter { display: flex; align-items: center; gap: var(--space-2h); margin-top: var(--space-1h); }
.um-meter-bars { display: flex; gap: var(--space-0); flex: none; }
.um-meter-bars i { width: 22px; height: 3px; background: var(--border-strong); }
.um-meter-bars i.on { background: var(--primary-color); }

/* A clickable row that is really a checkbox. The native input stays and is
   only restyled — the canvas uses a <span> with a tick, which is neither
   focusable nor announced, and the module readers query
   `input[type=checkbox]:checked`. */
.um-tickrow {
  display: flex; align-items: center; gap: var(--space-2h);
  background: var(--void-2); border: 1px solid var(--border-strong);
  padding: var(--space-2h) var(--space-3); cursor: pointer; user-select: none;
  font-size: var(--text-sm); color: var(--text-color);
}
.um-tickrow:hover { border-color: var(--primary-color); }
.um-modal--panel input[type="checkbox"],
.np-panel input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 15px; height: 15px; flex: none; margin: 0; border-radius: 0;
  border: 1px solid var(--border-strong); background: transparent;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.um-modal--panel input[type="checkbox"]:checked,
.np-panel input[type="checkbox"]:checked {
  background: var(--primary-color); border-color: var(--primary-color);
}
.um-modal--panel input[type="checkbox"]:checked::after,
.np-panel input[type="checkbox"]:checked::after {
  content: '\2713'; color: var(--lt-ink);
  font-family: var(--font-mono); font-size: var(--text-2xs); font-weight: 700; line-height: 1;
}
.um-modal--panel input[type="checkbox"]:focus-visible,
.np-panel input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--primary-color); outline-offset: 2px;
}

.um-modhead { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--space-1h); }
.um-modcount { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--text-tertiary); margin-inline-start: var(--space-2h); }
.um-minibtns { display: flex; gap: var(--space-1h); }
.um-minibtn {
  font-family: var(--font-mono); font-size: var(--text-3xs); letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-secondary); background: none;
  border: 1px solid var(--border-strong); padding: var(--space-1) var(--space-2); cursor: pointer;
}
.um-minibtn:hover { color: var(--amber-text); border-color: var(--primary-color); }

/* The grid's 1px gaps show the rule colour through — the cells are the panel
   ground, the container is the rule. One border instead of thirty. */
.um-modal--panel .um-modules-grid {
  border: 1px solid var(--border-hairline); background: var(--border-hairline);
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px; padding: 0;
}
.um-modal--panel .um-module-check {
  background: var(--surface); display: flex; align-items: center; gap: var(--space-2h);
  padding: var(--space-2) var(--space-3); cursor: pointer; user-select: none;
  font-size: var(--text-sm); color: var(--text-tertiary); margin: 0; border: 0;
}
.um-modal--panel .um-module-check:hover { background: var(--hover-bg); }
.um-modal--panel .um-module-check:has(input:checked) { color: var(--text-color); }
/* The module's name over the pages it opens. The row grew a second line, so it
   aligns to the top rather than centring on a box that is now shorter than the
   text beside it. */
.um-modal--panel .um-module-check { align-items: flex-start; }
.um-mod-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.um-mod-sur {
  font-family: var(--font-mono); font-size: var(--text-3xs);
  color: var(--text-tertiary); line-height: var(--leading-normal);
}
.um-modal--panel .um-module-check:has(input:checked) .um-mod-sur { color: var(--text-secondary); }

/* Two-factor state, and the destructive verb beside it. */
.um-2fa-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  background: var(--void-2); border: 1px solid var(--border-strong);
  padding: var(--space-2h) var(--space-3);
}
.um-2fa-state { display: flex; align-items: center; gap: var(--space-2); font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-color); }
.um-dot { width: 7px; height: 7px; flex: none; background: var(--text-tertiary); }
.um-dot--on { background: var(--success-color); }
.um-dangerbtn {
  font-family: var(--font-mono); font-size: var(--text-3xs); letter-spacing: .12em;
  text-transform: uppercase; color: var(--sev-critical-text); background: none;
  border: 1px solid var(--sev-critical-text); padding: var(--space-1) var(--space-2h);
  cursor: pointer; flex: none;
}
.um-dangerbtn:hover { background: var(--sev-critical-bg); }

.um-panel-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-4) var(--space-6); margin-top: var(--space-5);
  border-top: 1px solid var(--border-hairline); background: var(--void-2);
}
.um-footmeta { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--text-tertiary); }
.um-panel-foot .um-actions { display: flex; gap: var(--space-2h); }
.um-panel-foot button {
  font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: .1em;
  text-transform: uppercase; cursor: pointer; border-radius: 0;
}
.um-btn-ghost {
  color: var(--text-color); background: none; border: 1px solid var(--border-strong);
  padding: var(--space-2) var(--space-4);
}
.um-btn-ghost:hover { border-color: var(--text-secondary); }
.um-btn-go {
  background: var(--primary-color); color: var(--lt-ink); border: 1px solid var(--primary-color);
  padding: var(--space-2) var(--space-5); font-weight: 600;
}
.um-btn-go:hover { background: var(--amber-lit); border-color: var(--amber-lit); }
.um-btn-go:disabled { opacity: .55; cursor: progress; }

/* ── Notification preferences (Admin · Settings) ──────────────────────────
   REDESIGN/latest, the file's third artboard. The same panel language as the
   user dialogs — amber top rule, mono eyebrow, Newsreader title — but it is a
   SECTION, not a modal, so it borrows the head/foot parts and brings its own
   container rather than wearing `.um-modal--panel` (that one is 600px and sits
   inside an overlay). Tokens only, for the reason the block above states. */
.np-panel {
  width: 420px; max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-top: 2px solid var(--primary-color);
}
.np-lede {
  font-size: var(--text-sm); color: var(--text-secondary);
  margin-top: var(--space-1h); line-height: var(--leading-normal);
}
.np-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); margin: 0;
  padding: var(--space-3h) var(--space-6);
  border-bottom: 1px solid var(--border-hairline);
  cursor: pointer; user-select: none;
}
.np-row:last-of-type { border-bottom: 0; }
.np-row:hover { background: var(--hover-bg); }
.np-row-main { display: flex; align-items: flex-start; gap: var(--space-3); }
.np-name { font-size: var(--text-base); font-weight: 600; color: var(--text-tertiary); }
.np-desc {
  font-family: var(--font-mono); font-size: var(--text-2xs);
  color: var(--text-tertiary); margin-top: var(--space-0);
}
/* The row's own state, in words. A tick alone reads as "selected"; these are
   switches, and OFF is as much a setting as ON. */
.np-state {
  font-family: var(--font-mono); font-size: var(--text-3xs); letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-tertiary); flex: none;
}
.np-row:has(input:checked) .np-name { color: var(--text-color); }
.np-row:has(input:checked) .np-state { color: var(--amber-text); }
.np-foot {
  padding: var(--space-3h) var(--space-6);
  border-top: 1px solid var(--border-hairline);
  font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--text-tertiary);
}

@media (max-width: 640px) {
  .um-2col, .um-modal--panel .um-modules-grid { grid-template-columns: 1fr; }
  .um-panel-foot { flex-wrap: wrap; }
}

/* ── Notification center (bell dropdown) ──
 * The panel markup lives inline in app.py's base_navbar so styles
 * are mostly inline too. These classes cover the three "chromey"
 * bits that benefit from being shared: empty state, grouped list
 * headers, and the unread-pulse on the red badge dot.
 */
.notif-badge-pulse {
  /* Ping ring under the static red dot — purely decorative, gives a
   * small signal that unread items arrived without being loud. */
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
  animation: notif-pulse 2.4s ease-in-out infinite;
}
@keyframes notif-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  70%  { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.notif-empty,
.notif-error {
  padding: var(--space-5) var(--space-4);
  text-align: center;
}
.notif-empty-icon {
  font-size: 28px;
  opacity: 0.3;
  margin-bottom: var(--space-2);
}
.notif-empty-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: var(--space-1);
}
.notif-empty-sub {
  font-size: var(--text-xs);
  color: var(--text-disabled);
  line-height: var(--leading-normal);
  max-width: 260px;
  margin: 0 auto;
}
.notif-retry {
  margin-top: var(--space-3);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1px solid var(--input-border);
  background: var(--card-bg);
  color: var(--primary-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.notif-retry:hover {
  border-color: var(--primary-color);
  background: var(--button-bg);
}

.notif-group-header {
  padding: var(--space-2) var(--space-3) var(--space-1);
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-disabled);
  opacity: 0.8;
  /* Sticky inside the scrolling panel so the "Today" / "Earlier"
   * label stays pinned while the user scrolls through a long list. */
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 1;
}
.notif-group-header:first-child { padding-top: var(--space-1); }

.notif-item {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-2h);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--text-secondary);
  margin-bottom: 2px;
  transition: background var(--transition-fast);
}
.notif-item:hover { background: var(--button-bg); }
.notif-item-new { background: rgba(217, 119, 6, 0.04); }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-item-meta {
  font-size: var(--text-xs);
  color: var(--text-disabled);
  margin-top: 2px;
}
.notif-item-meta i { width: 12px; }

/* Shimmer placeholder for the bell dropdown's first paint — simpler
 * than a full skeleton card since the panel is only ~45px per row.
 * Reuses the global shimmer keyframe.
 */
.notif-placeholder {
  padding: var(--space-2) var(--space-2h);
  margin: var(--space-1) var(--space-1);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  position: relative;
  overflow: hidden;
  min-height: 42px;
}
.notif-placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--overlay-faint) 35%,
    var(--overlay-soft) 50%,
    var(--overlay-faint) 65%,
    transparent 100%);
  animation: shimmer 1.6s ease-in-out infinite;
}
.notif-ph-line {
  height: 8px;
  background: var(--button-bg);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.notif-ph-line.wide { width: 85%; }
.notif-ph-line.narrow { width: 45%; }
.um-actions { display: flex; gap: var(--space-1h); }
.um-btn {
  padding: var(--space-1) var(--space-2); font-size: var(--text-xs);
  border-radius: var(--radius-sm); border: 1px solid var(--input-border);
  background: transparent; color: var(--text-color); cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}
.um-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.um-btn.danger:hover { border-color: var(--sev-critical-text); color: var(--sev-critical-text); }

/* ==========================================================================
   POPOVER + ANCHOR MENUS (.cyn-pop) — 2026 platform P1
   --------------------------------------------------------------------------
   The native replacement for a JS-positioned, z-index-stacked menu. Today we
   position menus/tooltips by reading getBoundingClientRect in 10 files and
   stack them on a hand-maintained z-index ladder that already climbs to 1100
   (sidebar 1060, toggle 1065, overlay 1050) — a documented source of past
   layering bugs.

   [popover] renders in the browser's TOP LAYER, which is above every z-index
   by definition, so an element using this needs no z-index at all and cannot
   be trapped by an ancestor's stacking context or `overflow: hidden`. Light-
   dismiss (click-outside), Esc, and focus return are handled by the engine.
   `position-area` then anchors it declaratively, flipping at viewport edges
   without measuring anything.

   USAGE (no JS, and therefore no CSP inline-handler concern):
     <button class="cyn-pop-anchor" popovertarget="rowMenu">Actions</button>
     <div id="rowMenu" popover class="cyn-pop">…<button class="cyn-pop-item">…
   Give the anchor a unique name when several coexist on a page:
     style="anchor-name:--rowMenu"  +  .cyn-pop { position-anchor:--rowMenu }

   LAYERED SUPPORT — each step degrades to the one before, never to broken:
     no popover at all  → element stays inline (author keeps the JS path)
     popover, no anchor → centred//inset-positioned menu, still top-layer
     both               → anchored + auto-flipped
   ========================================================================== */
.cyn-pop {
  inset: auto;
  margin: 0;
  padding: var(--space-1);
  min-width: 190px;
  background: var(--surface-3, var(--card-bg));
  color: var(--text-color);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
}
.cyn-pop::backdrop { background: transparent; }
.cyn-pop-item {
  display: block; width: 100%; text-align: start;
  font-family: inherit; font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: var(--space-1h) var(--space-2h);
  border: 0; border-radius: var(--radius-sm);
  background: none; cursor: pointer;
}
.cyn-pop-item:hover, .cyn-pop-item:focus-visible {
  background: var(--hover-bg); color: var(--text-color);
}
.cyn-pop-item.danger:hover { color: var(--sev-critical-text); }
.cyn-pop-sep { height: 1px; margin: var(--space-1) 0; background: var(--border-hairline); }

@supports (anchor-name: --x) {
  .cyn-pop-anchor { anchor-name: --cyn-pop; }
  .cyn-pop {
    position-anchor: --cyn-pop;
    position-area: block-end span-inline-start;
    margin-block-start: var(--space-1);
    /* if the menu would overflow the viewport, try the mirrored placements */
    position-try-fallbacks: block-start span-inline-start,
                            block-end span-inline-end,
                            block-start span-inline-end;
  }
}

/* Entry/exit transition. `overlay`+`display` need `allow-discrete` to animate
   at all in the top layer, and @starting-style supplies the pre-open frame —
   without it the menu would pop in with no transition. Motion honours the
   platform preference (§10.7 motion contract). */
@media (prefers-reduced-motion: no-preference) {
  .cyn-pop {
    opacity: 0;
    translate: 0 calc(-1 * var(--space-1));
    transition: opacity var(--transition-fast), translate var(--transition-fast),
                overlay var(--transition-fast) allow-discrete,
                display var(--transition-fast) allow-discrete;
  }
  .cyn-pop:popover-open { opacity: 1; translate: 0 0; }
  @starting-style {
    .cyn-pop:popover-open { opacity: 0; translate: 0 calc(-1 * var(--space-1)); }
  }
}

/* ==========================================================================
   .cyn-reveal — animate a disclosure to its REAL height (2026 platform P1)
   --------------------------------------------------------------------------
   Replaces the max-height guess on <details>-style disclosures. Pair with the
   `interpolate-size: allow-keywords` enabled at :root near the top of this
   file; together they let block-size transition to `auto`, so content is never
   clipped and no JS measures scrollHeight.

     <details class="cyn-reveal"><summary>Why this fired</summary> … </details>

   Gated twice over: engines without ::details-content or interpolate-size get
   an instant open (today's behaviour minus the animation), never a clipped or
   collapsed panel.
   ========================================================================== */
@supports (interpolate-size: allow-keywords) and (selector(::details-content)) {
  @media (prefers-reduced-motion: no-preference) {
    .cyn-reveal::details-content {
      block-size: 0;
      overflow: hidden;
      transition: block-size var(--transition-normal),
                  content-visibility var(--transition-normal) allow-discrete;
    }
    .cyn-reveal[open]::details-content { block-size: auto; }
  }
}

/* .cyn-sweep — a live-status ring that reads as "this is updating". Possible
   only because --cyn-sweep is a REGISTERED <angle> (see the @property block at
   the top); an unregistered angle is an unanimatable string. Used for
   genuinely-live surfaces only — per the Loom rule, motion means events. */
.cyn-sweep { position: relative; }
.cyn-sweep::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--cyn-sweep), transparent 0 62%,
                             var(--primary-color) 78%, transparent 88%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: cyn-sweep-spin 4.5s linear infinite;
  pointer-events: none;
}
@keyframes cyn-sweep-spin { to { --cyn-sweep: 360deg; } }
@media (prefers-reduced-motion: reduce) {
  .cyn-sweep::before { animation: none; opacity: 0.35; }
}

/* --- Dropdown Menus --- */
.dropdown-menu {
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  padding: var(--space-1) 0;
}
.dropdown-item {
  color: var(--text-color);
  font-size: var(--text-base);
  padding: var(--space-2) var(--space-4);
  transition: background var(--transition-fast);
}
.dropdown-item:hover, .dropdown-item:focus {
  background: var(--button-bg);
  color: var(--text-color);
}
.dropdown-item.active, .dropdown-item:active {
  background: rgba(217, 119, 6, 0.12);
  color: var(--primary-color);
  /* Left-edge rail — 3px primary bar against the dropdown edge so the
   * active item reads "you are here" at a glance rather than just
   * being a slightly bluer background. Positioning is relative to
   * the item (not the menu) so nested dropdowns would get their own
   * rail if we ever added those. padding-left shift keeps the text
   * from sliding 3px to the right when the rail appears. */
  position: relative;
  padding-left: calc(var(--space-3) + 3px);
}
.dropdown-item.active::before, .dropdown-item:active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--primary-color);
  border-radius: 0 2px 2px 0;
}

/* --- Active nav section indicator (horizontal top-nav) ---
 * When the current URL maps to a dropdown item, shared.js marks the
 * parent dropdown trigger with .active. A bottom-rail primary line
 * under the TEXT only (not the icon) makes the active SECTION visible
 * without opening the dropdown — the navbar equivalent of "you are
 * here" for the current area of the app.
 *
 * The rail anchors on .nav-link-text (the span wrapping the section
 * label in app.py's navbar generation). Using the span instead of the
 * whole .nav-link means the underline tracks only the label width,
 * not the icon + label — cleaner visual alignment. */
/* Was var(--nav-link-active), a token declared ONLY inside
   `body.focus-mode #main-navbar`. So in dark and light this declaration was
   already invalid at computed-value time and dropped silently — the active
   link never actually got its own colour except in focus mode. The app-wide
   undefined-token ratchet passed it because the token WAS defined somewhere,
   which is the rule-10 blind spot in scope form. --text-primary is the
   prominent ink in whichever theme is active, which is what this wanted. */
#main-navbar .nav-link.active { color: var(--text-primary); }
#main-navbar .nav-link.active .nav-link-text {
  position: relative;
}
#main-navbar .nav-link.active .nav-link-text::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--primary-color);
  border-radius: 1px;
  /* Subtle entrance: new-page navigation pops the rail in via a
   * scale-x transform from 0 to 1 rather than just appearing. */
  transform-origin: center;
  animation: navRailIn 220ms var(--ease-out-expo);
}
@keyframes navRailIn {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  #main-navbar .nav-link.active .nav-link-text::after { animation: none; }
}
.dropdown-divider {
  border-color: var(--input-border);
  opacity: 0.5;
}

/* --- Tooltip Override --- */
.tooltip-inner {
  background: var(--panel-bg);
  border: 1px solid var(--input-border);
  color: var(--text-color);
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-dropdown);
  max-width: 280px;
}
.tooltip .tooltip-arrow::before {
  border-top-color: var(--panel-bg);
}

/* --- Progress Bars --- */
/* Square, like every bar inside a square component (BRAND.md §4b; the
   last three full-radius tracks, squared 2026-10-12). */
.progress {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0;
  height: 6px;
  overflow: hidden;
}
.progress-bar {
  background: var(--primary-color);
  border-radius: 0;
  transition: width var(--dur-data) ease;
}

/* --- Scrollable content helper --- */
.scroll-y {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--button-bg) transparent;
}

/* --- Utility: text opacity helpers --- */
.text-muted-strong { color: var(--text-color); opacity: 0.7; }
.text-muted { color: var(--text-color); opacity: 0.5; }
.text-muted-weak { color: var(--text-color); opacity: 0.50; }  /* WCAG AA: raised from 0.35 */

/* --- Utility: mono text --- */
.font-mono { font-family: var(--font-mono); }

/* --- Utility: tabular nums --- */
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Sidebar Filter Layout
   Enterprise SaaS pattern: fixed left filter pane + scrollable content area
   ========================================================================== */
.layout-with-sidebar {
  display: flex;
  gap: 0;
  min-height: calc(100vh - var(--nav-height));
}

/* --- Filter Sidebar --- */
.filter-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--card-bg);
  border-right: 1px solid var(--input-border);
  padding: 0;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  bottom: var(--footer-h); /* above a fixed footer, if any (:root) */
  overflow-y: auto;
  overflow-x: hidden;
  z-index: var(--z-sidebar);
  transition: width var(--dur-panel) ease, min-width var(--dur-panel) ease, left var(--dur-panel) ease, box-shadow var(--dur-panel) ease;
  display: flex;
  flex-direction: column;
}
/* scrollbar handled globally + sidebar overrides near line 478 */

.filter-sidebar-header {
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--input-border);
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 2;
}
.filter-sidebar-header h6 {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-color);
  opacity: 0.5;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.filter-sidebar-header .filter-count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--primary-color);
  opacity: 1;
  font-weight: 600;
}

/* --- Filter Sidebar Body (scrollable area between header and footer) --- */
.filter-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  min-height: 0;
}
.filter-sidebar-body .filter-group {
  padding: var(--space-3h) var(--space-5);
  border-bottom: 1px solid var(--glass-border);
}
.filter-sidebar-body .filter-group label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.5;
  margin-bottom: 4px;
}

/* --- Filter Groups --- */
.filter-group {
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
}
.filter-group-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-color);
  opacity: 0.55;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-group-label i {
  font-size: var(--text-xs);
  color: var(--primary-color);
  opacity: 0.6;
}
.filter-group input[type="text"],
.filter-group input[type="search"] {
  width: 100%;
  padding: 8px 12px;
  font-size: var(--text-sm);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-color);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
body.light-mode .filter-group input[type="text"],
body.light-mode .filter-group input[type="search"] {
  background: rgba(0,0,0,0.02);
}
.filter-group input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(217, 119, 6,0.1);
  outline: none;
}
.filter-group select {
  width: 100%;
  padding: 8px 12px;
  font-size: var(--text-sm);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-color);
  cursor: pointer;
  transition: border-color var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238b95a5' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 9px;
  padding-right: 30px;
}
body.light-mode .filter-group select {
  background-color: rgba(0,0,0,0.02);
}
.filter-group select:focus {
  border-color: var(--primary-color);
  outline: none;
  /* Matches .filter-group input:focus a few lines above — adds a blue
   * glow ring so keyboard users see the focused select at a glance. */
  box-shadow: 0 0 0 2px rgba(217, 119, 6,0.1);
}
.filter-group select option {
  background: var(--card-bg);
  color: var(--text-color);
}

/* --- Clear / Reset Button --- */
.filter-sidebar-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--input-border);
  position: sticky;
  bottom: 0;
  background: var(--card-bg);
}
.btn-clear-filters {
  width: 100%;
  padding: 8px 12px;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: none;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-color);
  cursor: pointer;
  transition: var(--transition-fast); transition-property: var(--paint-props);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-clear-filters:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: rgba(217, 119, 6,0.06);
}

/* --- Active Filter Indicator --- */
.filter-group select.has-value,
.filter-group input.has-value {
  border-color: rgba(217, 119, 6,0.2);
  background-color: rgba(217, 119, 6,0.04);
}

/* --- Sidebar Toggle Button (mobile) --- */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: var(--z-overlay);
  width: 44px;
  height: 44px;
  /* SQUARE and flat, like every other control (2026-10-11): it was the only
     round, glowing, hover-scaling button in a system that draws neither
     radii, shadows nor lifts — the primary button's fill and press instead. */
  border-radius: 0;
  background: var(--primary-color);
  border: 1px solid var(--primary-color);
  color: var(--text-on-accent);
  font-size: var(--text-lg);
  cursor: pointer;
  box-shadow: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}
.sidebar-toggle:hover {
  background: var(--amber-press); border-color: var(--amber-press); color: var(--amber-press-ink);
}

/* --- Main Content (beside sidebar) --- */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 20px 24px;
  margin-left: 260px;
  transition: margin-left var(--dur-panel) ease;
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR: Shadcn-inspired collapsible (centralized)
   CSS variables control width. Transition handles animation.
   Toggle button sits at the bottom of the sidebar.
   Keyboard shortcut: Ctrl+B
   ═══════════════════════════════════════════════════════════════ */
.sidebar-collapse-btn { display: none; }
.sidebar-rail-toggle { display: none; }
.sidebar-show-btn { display: none; }

/* Sidebar uses CSS variable for width — enables smooth transition */
.filter-sidebar {
  --sb-width: 260px;
  width: var(--sb-width);
  min-width: var(--sb-width);
  transition: width var(--dur-hover) ease, min-width var(--dur-hover) ease;
}
.main-content {
  transition: margin-left var(--dur-hover) ease;
}

/* ── Toggle button: bottom of sidebar ── */
.sb-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 0;
  background: none;
  border: none;
  border-top: 1px solid var(--input-border);
  color: var(--text-color);
  opacity: 0.4;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--dur-fast), background var(--dur-fast);
  letter-spacing: 0.3px;
}
.sb-toggle:hover {
  opacity: 0.9;
  background: rgba(217, 119, 6,0.05);
}
.sb-toggle i {
  font-size: var(--text-xs);
  transition: transform var(--dur-hover) ease;
}

/* ── Collapsed state ── */
html.sidebar-collapsed .filter-sidebar,
body.sidebar-collapsed .filter-sidebar {
  --sb-width: 0px;
  overflow: hidden !important;
  border-right: none !important;
}
html.sidebar-collapsed .main-content,
body.sidebar-collapsed .main-content {
  margin-left: 0 !important;
}
/* Show a small expand tab when collapsed */
html.sidebar-collapsed .sb-expand-tab,
body.sidebar-collapsed .sb-expand-tab {
  display: flex;
}
.sb-expand-tab {
  display: none;
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: var(--z-expand-tab);
  width: 20px;
  height: 60px;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  color: var(--text-color);
  opacity: 0.5;
  font-size: var(--text-xs);
  transition: opacity var(--dur-fast), width var(--dur-fast), background var(--dur-fast);
  box-shadow: 2px 0 8px rgba(0,0,0,0.1);
}
.sb-expand-tab:hover {
  opacity: 1;
  width: 24px;
  background: var(--primary-color);
  color: var(--text-on-accent);
  border-color: var(--primary-color);
}

/* Light mode expand tab */
body.light-mode .sb-expand-tab {
  background: #fff;
  border-color: rgba(0,0,0,0.08);
  color: #64748b;
  box-shadow: 2px 0 8px rgba(0,0,0,0.06);
}
body.light-mode .sb-expand-tab:hover {
  background: var(--primary-color);
  color: var(--text-on-accent);  /* dark ink on amber = 6.36:1 (P0-9 fixed) */
}

/* --- Responsive Sidebar (bulletproof rewrite, 2026-04-18) ---
   Prior approaches that tried to hide the sidebar via `left: -100vw` kept
   regressing. The failure mode that led to this rewrite: on some mobile
   browsers the filter-sidebar was visually occupying the left half of the
   viewport as an IN-FLOW panel, making the main content half-visible and
   leaving filters un-tappable. Chasing the exact cascade cause turned up
   nothing wrong in theory — any of:
     - an ancestor growing a `transform` / `contain` / `will-change` that
       traps `position: fixed` into that ancestor's box instead of the
       viewport (extremely common regression cause)
     - a high-specificity per-template rule winning over `position: fixed`
     - a Bootstrap utility class or a stray inline style
     - a browser/OS combination with known position:fixed bugs inside a
       scrolling body (our `body { overflow-y: auto }` pattern)
   ...could produce the same symptom, and we'd spend another week playing
   cascade whack-a-mole.

   This version sidesteps all of that: on mobile, the default state is
   `display: none`. An element that isn't rendered can't intercept clicks,
   can't occupy space, can't be trapped by an ancestor, can't be hit by a
   specificity race. When the user taps the toggle, `.open` flips it to
   `display: flex` and positions it as a full-viewport overlay.

   Trade-off vs the old approach: we lose the slide-in animation. After 6+
   regression commits on this area, reliability >> animation. */
@media (max-width: 992px) {
  /* Default state — hidden. Four redundant selectors so any cascade
     accident (e.g. a per-template rule, a high-specificity parent
     selector, an ancestor trapping `position: fixed` via `transform`)
     cannot accidentally defeat the hide. */
  .filter-sidebar,
  aside.filter-sidebar,
  body .filter-sidebar,
  .layout-with-sidebar > .filter-sidebar {
    display: none !important;
  }
  .filter-sidebar.open,
  aside.filter-sidebar.open,
  body .filter-sidebar.open,
  .layout-with-sidebar > .filter-sidebar.open {
    display: flex !important;
    flex-direction: column !important;
    position: fixed !important;
    top: var(--nav-height) !important;   /* below fixed navbar (56px here: the ≤991px flip) */
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    margin: 0 !important;
    z-index: 1060 !important;      /* above overlay (1050), below floating toggle (1065) */
    box-shadow: none;
  }
  .sidebar-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 1065;                 /* above sidebar so it remains tappable when open */
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay-backdrop);
    z-index: 1050;                 /* between sidebar (1060) and navbar (1030) */
  }
  .sidebar-overlay.open { display: block; }
  .main-content {
    padding: 16px !important;
    margin-left: 0 !important;     /* kill the desktop 260px side offset */
    width: 100% !important;
    max-width: 100vw !important;
  }
  .sb-toggle { display: none !important; }
  .sb-expand-tab { display: none !important; }
  /* Nothing to do for sidebar-collapsed on mobile — sidebar is display:none
     either way. Keeping the selector for documentation. */
}

/* ═══════════════════════════════════════════════════════════════════════
 * Motion microinteractions (UI polish Point 5)
 * ═══════════════════════════════════════════════════════════════════════
 * Adds the "this feels alive" layer on top of the existing animation
 * primitives. Four things:
 *   1. Universal hover lift on common card classes (subtle Y-translate +
 *      shadow intensify)
 *   2. .stagger-in — stagger children's fade-up entrance on first render
 *   3. .fade-up — single-element fade + rise utility
 *   4. prefers-reduced-motion guard — strips motion for users who set it
 *
 * All of this is additive; nothing that animated before stops animating.
 * Opt-out is a single media query at the bottom of this block.
 */

/* ── Universal card hover lift ──
 * Applies to the canonical card/panel classes so every page picks it up
 * for free. Pages that already had per-class :hover rules with the same
 * lift (e.g. .stat-card line 1029, .victim-card in ransomware) keep their
 * rules — this block adds it to the ones that didn't have it. Selectors
 * are scoped to direct element matches (no deep descendants) so we don't
 * accidentally lift nested cards inside modals/tooltips. */
.card-panel,
.module-card,
.glass-card,
.article-card,
.iu-signal,
.entity-item,
.interactive-card {
  transition: transform var(--transition-hover),
              box-shadow var(--transition-hover),
              border-color var(--transition-hover);
  will-change: transform;
}
.card-panel:hover,
.module-card:hover,
.glass-card:hover,
.article-card:hover,
.iu-signal:hover,
.entity-item:hover,
.interactive-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

/* ── Staggered entrance for card grids ──
 * Apply .stagger-in to a grid/flex container and every child fades + rises
 * into place with a cascading delay. Covers the first 20 children via
 * :nth-child — simpler than per-element --idx inline styles and handles
 * the typical "3 rows of 4-6 cards" layout without touching render code.
 *
 *   <div class="stats-hero-row stagger-in">
 *     <div class="stat-hero-card">…</div>   ← delay 40ms
 *     <div class="stat-hero-card">…</div>   ← delay 80ms
 *   </div>
 *
 * Base duration is 0.4s with the ease-out-quart curve for a natural decel.
 * `both` fill-mode keeps the opacity:0 state until the animation fires,
 * so there's no flash-of-unstyled-content on slow connections.
 */
@keyframes cyFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stagger-in > * {
  animation: cyFadeUp 0.4s var(--ease-out-quart) both;
}
.stagger-in > *:nth-child(1)  { animation-delay: 40ms; }
.stagger-in > *:nth-child(2)  { animation-delay: 80ms; }
.stagger-in > *:nth-child(3)  { animation-delay: 120ms; }
.stagger-in > *:nth-child(4)  { animation-delay: 160ms; }
.stagger-in > *:nth-child(5)  { animation-delay: 200ms; }
.stagger-in > *:nth-child(6)  { animation-delay: 240ms; }
.stagger-in > *:nth-child(7)  { animation-delay: 280ms; }
.stagger-in > *:nth-child(8)  { animation-delay: 320ms; }
.stagger-in > *:nth-child(9)  { animation-delay: 360ms; }
.stagger-in > *:nth-child(10) { animation-delay: 400ms; }
.stagger-in > *:nth-child(11) { animation-delay: 440ms; }
.stagger-in > *:nth-child(12) { animation-delay: 480ms; }
.stagger-in > *:nth-child(13) { animation-delay: 520ms; }
.stagger-in > *:nth-child(14) { animation-delay: 560ms; }
.stagger-in > *:nth-child(15) { animation-delay: 600ms; }
.stagger-in > *:nth-child(16) { animation-delay: 640ms; }
.stagger-in > *:nth-child(17) { animation-delay: 680ms; }
.stagger-in > *:nth-child(18) { animation-delay: 720ms; }
.stagger-in > *:nth-child(19) { animation-delay: 760ms; }
.stagger-in > *:nth-child(20) { animation-delay: 800ms; }
/* Past child 20, collapse into a single "late arrivals" group so tables
 * with hundreds of rows don't show a 10-second staircase. */
.stagger-in > *:nth-child(n+21) { animation-delay: 840ms; }

/* ── Fade-up utility ──
 * For single-element entrances (hero cards, modal headers, one-off banners).
 * Stagger children prefer .stagger-in above; this is for individual items. */
.fade-up {
  animation: cyFadeUp 0.4s var(--ease-out-quart) both;
}
.fade-up-slow { animation: cyFadeUp 0.6s var(--ease-out-expo) both; }

/* Decorative attention-pulses, hoisted here (were duplicated verbatim in
 * intelligence_unified / intelligence_trends / predictive_intelligence). The
 * consuming classes stay in those templates; this single definition + the
 * reduced-motion guard below are shared so the guard can never drift. */
@keyframes cardPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); } 50% { box-shadow: 0 0 12px 2px rgba(239,68,68,0.15); } }
@keyframes silentPulse { 0%,100% { border-color: rgba(245,158,11,0.2); } 50% { border-color: rgba(245,158,11,0.6); } }

/* ── Reduced-motion guard ──
 * Honors the user's OS-level "prefer reduced motion" setting. We kill the
 * decorative transitions + stagger entrances, but keep opacity fades (those
 * aren't vestibular triggers) so empty-state reveals etc. still feel soft
 * rather than hard-snap. The spinner keyframe stays too — it's a loading
 * indicator, not decoration. */
@media (prefers-reduced-motion: reduce) {
  .stagger-in > *,
  .fade-up,
  .fade-up-slow,
  .it-stat.pulse, .iu-stat.pulse,
  .iu-stat.silent, .pi-stat.silent {
    animation: none;
  }
  .card-panel:hover,
  .module-card:hover,
  .glass-card:hover,
  .article-card:hover,
  .iu-signal:hover,
  .entity-item:hover,
  .interactive-card:hover {
    transform: none;
  }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  /* Loading indicators must keep moving (slower) — the universal rule above
   * would freeze .cyn-spin into a static broken ring, which reads as a hang
   * rather than "working" (UI_POLISH_AUDIT P0-6). Rotation of a small glyph
   * is not a vestibular trigger. */
  /* The page-local spinners on /techniques, /bulk_ioc and /graph froze into
     the same broken ring — P0-6 fixed .cyn-spin and left them out. */
  .cyn-spin,
  .de-loading i,
  .spinner-inline,
  .ag-spinner {
    animation-duration: 1.8s !important;
    animation-iteration-count: infinite !important;
  }
}

/* ── Pivot menu ──────────────────────────────────────────────────
 * Floating menu that appears when the user clicks a pivotable
 * entity (IOC / domain / email / hash / CVE). Rendered into
 * document.body by Cyntel.pivotMenu() and positioned at the click
 * point, flipping edges if it would overflow the viewport.
 *
 * z-index sits between the page content (1050) and modals (9000)
 * so an action that opens a confirm dialog layers correctly on top.
 */
.pivot-menu {
  position: fixed;
  min-width: 240px;
  max-width: 320px;
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  z-index: 1100;
  font-size: var(--text-sm);
  overflow: hidden;
  animation: pivot-menu-in 140ms var(--ease-out-expo);
}
@keyframes pivot-menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.pivot-menu-head {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--space-2) var(--space-2h);
  border-bottom: 1px solid var(--input-border);
  background: var(--input-bg);
}
.pivot-menu-type {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary-color);
  opacity: 0.85;
}
.pivot-menu-value {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-color);
  word-break: break-all;
  line-height: var(--leading-snug);
}

.pivot-menu-list { padding: var(--space-1); }

.pivot-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2h);
  padding: var(--space-1h) var(--space-2h);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-color);
  transition: background var(--transition-fast);
  user-select: none;
}
.pivot-menu-item:hover,
.pivot-menu-item.active {
  background: rgba(217, 119, 6, 0.12);
  color: var(--primary-color);
}
.pivot-menu-item i {
  width: 16px;
  text-align: center;
  font-size: var(--text-sm);
  opacity: 0.75;
}
.pivot-menu-item:hover i,
.pivot-menu-item.active i { opacity: 1; }

/* Triggers: any element with data-pivot-value gets a subtle visual
 * hint that it's interactive beyond normal text — dashed underline
 * on hover, arrow icon on focus. Keeps the resting state clean so
 * a list dense with IOCs doesn't look busy. */
[data-pivot-value] {
  cursor: pointer;
  position: relative;
}
[data-pivot-value]:hover { text-decoration: underline dashed rgba(217, 119, 6, 0.5) 1px; text-underline-offset: 2px; }
[data-pivot-value]:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Explicit trigger button — use when the entity text itself needs
 * to stay non-interactive (e.g. already a link) but we want a
 * sidecar pivot affordance. */
.pivot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  margin-left: 4px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-disabled);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  transition: color var(--transition-fast), background var(--transition-fast);
  vertical-align: middle;
}
.pivot-btn:hover {
  color: var(--primary-color);
  background: rgba(217, 119, 6, 0.1);
}
.pivot-btn:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 1px;
}
@media (prefers-reduced-motion: reduce) {
  .pivot-menu { animation: none; }
}

/* ── Row-pulse: landing-from-pivot highlight ─────────────────────
 * Applied briefly by Cyntel.pulseRow() after applyFocusFromUrl()
 * scrolls a row into view. Gives the analyst a visual anchor for
 * "this is the row you navigated here to see" — especially useful
 * on long lists where the scroll-into-view alone can feel ambiguous.
 *
 * Animation uses box-shadow + background-color in rgba (not token
 * names) because CSS @keyframes can't interpolate var() values.
 * The two-phase timing (fast up, slow fade) matches the feel of
 * iOS/macOS selection pulses — seen long enough to register,
 * faded fast enough not to annoy on repeat visits.
 */
.row-pulse {
  animation: row-pulse-kf 2200ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes row-pulse-kf {
  0%   { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); background-color: transparent; }
  10%  { box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.85); background-color: rgba(217, 119, 6, 0.15); }
  40%  { box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.55); background-color: rgba(217, 119, 6, 0.08); }
  100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); background-color: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .row-pulse { animation: none; outline: 2px solid var(--primary-color); outline-offset: -2px; }
}

/* ==========================================================================
   BRAND v2 — New component layer
   --------------------------------------------------------------------------
   Ported from `New Design/components_v2.css` (2026-04-23 brand refresh).
   These classes are ADDITIVE — they do not change any existing component
   class (.btn-primary, .stat-card, .metric-card, etc.). Templates can
   opt into the new patterns at their own pace.

   Includes:
     - .display-{sm,md,lg,xl} + .display-italic  (Newsreader serif display)
     - .btn--{primary,secondary,ghost,danger}    (BEM form, copper primary)
     - .sev-badge + .sev-badge.quiet variants
     - .risk-score / .risk-score__num / __of      (display-composition)
     - .sparkbar                                  (inline micro-chart)
     - .micro-label / .micro-label--brand         (mono uppercase rubric)
     - .live-indicator + live-pulse keyframe      (with pulse dot)
     - .dot + severity variants                   (status dot)
     - .cyn-icon size modifiers                   (SVG sprite scaling)
     - .kbd                                       (keyboard chips)
     - Surface tier utilities: .surface-1, .surface-2, .surface-3
   ========================================================================== */

/* ─── Display serif ─────────────────────────────────────────────────── */
.display,
.display-sm,
.display-md,
.display-lg,
.display-xl {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-variation-settings: "opsz" 60;
  color: var(--text-primary);
}
.display-sm { font-size: var(--text-display-sm); }
.display-md { font-size: var(--text-display-md); }
.display-lg { font-size: var(--text-display-lg); }
.display-xl { font-size: var(--text-display-xl); }
.display-italic {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-variation-settings: "opsz" 24;
}

/* ─── Surface tier utilities ────────────────────────────────────────── */
.surface-1 { background: var(--surface-1); }
.surface-2 { background: var(--surface-2); }
.surface-3 { background: var(--surface-3); }

/* ─── BEM Buttons (new form — coexists with existing .btn-primary) ─── */
.btn--primary,
.btn--secondary,
.btn--ghost,
.btn--danger {
  --btn-h: 32px;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1h);
  height: var(--btn-h);
  padding: 0 var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-hover), border-color var(--transition-hover),
              color var(--transition-hover), box-shadow var(--transition-hover);
}
.btn--primary:focus-visible,
.btn--secondary:focus-visible,
.btn--ghost:focus-visible,
.btn--danger:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn--primary .cyn-icon,
.btn--secondary .cyn-icon,
.btn--ghost .cyn-icon,
.btn--danger .cyn-icon { width: 14px; height: 14px; }
/* DEPRECATED (IMP-E): the .btn--* BEM button family duplicates the canonical,
   widely-used .btn-primary / .btn-secondary / .btn-ghost / .btn-danger system
   (defined far above). Kept only for back-compat with markup that already uses
   it; NEW code + templates should use .btn-primary etc. Do not add new .btn--*. */
.btn--primary {
  background: var(--brand);
  color: var(--text-on-accent);
}
.btn--primary:hover { background: var(--brand-hover); box-shadow: var(--shadow-glow-brand); }
.btn--primary:active { background: var(--brand-active); box-shadow: none; }
.btn--secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn--secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn--ghost:hover { background: var(--surface-3); color: var(--text-primary); }
.btn--danger {
  background: var(--danger-color);
  color: #fff;
}
.btn--danger:hover { background: var(--danger-hover); }
.btn--sm { --btn-h: 26px; padding: 0 var(--space-2h); font-size: var(--text-sm); }
.btn--lg { --btn-h: 40px; padding: 0 18px; font-size: var(--text-md); }
.btn--icon { padding: 0; width: var(--btn-h); }

/* ─── Severity badge — the ONE canonical base (v2 form, loud + quiet) ───
 * `.sev-badge` used to be defined twice: a v1 base earlier in the file plus
 * this v2 base. The v2 won every overlapping property on cascade order (and the
 * v1's gap/padding were the same value, just raw px), so the effective badge was
 * always this block PLUS the v1's one unique property, white-space:nowrap. The
 * v1 base is now deleted and nowrap folded in here — value-identical, one
 * definition. Both colour-variant naming schemes stay as aliases:
 * `.sev-badge.critical` (6 templates) and `.sev-badge.sev-critical` (5), both
 * have live consumers. (UI_POLISH_AUDIT Wave 3.) */
.sev-badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-0) var(--space-2);
  border-radius: var(--radius-sm);
  line-height: 1.4;
  white-space: nowrap;
}
.sev-badge.sev-critical { background: var(--sev-critical-bg); color: var(--sev-critical-text); }
.sev-badge.sev-high     { background: var(--sev-high-bg);     color: var(--sev-high-text); }
.sev-badge.sev-medium   { background: var(--sev-medium-bg);   color: var(--sev-medium-text); }
.sev-badge.sev-low      { background: var(--sev-low-bg);      color: var(--sev-low-text); }
.sev-badge.sev-info     { background: var(--sev-info-bg);     color: var(--sev-info-text); }
/* Quiet variant: outline-only, for resolved / acknowledged states */
.sev-badge.quiet { background: transparent; border: 1px solid currentColor; }
.sev-badge.quiet.sev-critical { color: var(--sev-critical-text); border-color: var(--sev-critical-border); }
.sev-badge.quiet.sev-high     { color: var(--sev-high-text);     border-color: var(--sev-high-border); }
.sev-badge.quiet.sev-medium   { color: var(--sev-medium-text);   border-color: var(--sev-medium-border); }
.sev-badge.quiet.sev-low      { color: var(--sev-low-text);      border-color: var(--sev-low-border); }
.sev-badge.quiet.sev-info     { color: var(--sev-info-text);     border-color: var(--sev-info-border); }

/* ─── Risk score display composition ─────────────────────────────── */
.risk-score {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  line-height: 0.9;
}
.risk-score__num {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" 72;
  font-size: var(--text-display-md);
  letter-spacing: -0.04em;
  color: var(--text-primary);
}
.risk-score__of {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: var(--text-section);
  color: var(--text-secondary);
  font-variation-settings: "opsz" 24;
}
.risk-score--critical .risk-score__num { color: var(--sev-critical-text); }
.risk-score--high     .risk-score__num { color: var(--sev-high-text); }
.risk-score--medium   .risk-score__num { color: var(--sev-medium-text); }
.risk-score--low      .risk-score__num { color: var(--sev-low-text); }

/* ─── Sparkbar (inline micro bar chart) ──────────────────────────── */
.sparkbar {
  display: inline-flex;
  align-items: flex-end;
  gap: var(--space-0);
  height: 20px;
}
.sparkbar span {
  width: 3px;
  background: var(--brand);
  border-radius: 1px;
  opacity: 0.75;
}

/* ─── Micro-label (mono-typed rubric tag) ────────────────────────── */
.micro-label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
}
.micro-label--brand { color: var(--brand); }
.micro-label--brand::before { content: '— '; }

/* ─── Timestamp / mono-data utilities (v2 spec §3.6) ───────────────
 * JetBrains Mono applied to timestamps, code identifiers, and short
 * numeric data cells. `.timestamp` specifically targets date/time
 * strings (e.g., "2026-04-24 14:32:17") so columns of timestamps
 * line up vertically and glyph shapes don't drift between entries.
 * `.data-mono` is the generic alias for any inline data reference
 * (commit SHAs, ticket IDs, correlation IDs). Both dim slightly so
 * they read as metadata, not CTA text. */
.timestamp,
.data-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}
/* When timestamp is colored by the parent (e.g. "just now" in success
 * green, "3 days overdue" in warning amber), drop the muted default. */
.timestamp.timestamp-strong,
.data-mono.data-mono-strong {
  color: var(--text-color);
  opacity: 1;
}

/* ─── Data-list links (v2 spec §10.7) ──────────────────────────────
 * Utility classes for source/author/reference links rendered inside
 * feed rows, tables, or any data-list context. The v2 spec explicitly
 * bans copper on these — metadata at rest (text-secondary), soft-blue
 * on hover (link-color). Apply to <a> tags or any interactive span
 * that attributes a content origin (e.g., "Dark Reading",
 * "BleepingComputer", vendor names, "View on MITRE ATT&CK").
 *
 * Prefer these utility classes over inline `style="color:var(--...)"`
 * so a future palette tweak lands in one place. */
.source-link,
.meta-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.source-link:hover,
.source-link:focus-visible,
.meta-link:hover,
.meta-link:focus-visible {
  color: var(--link-color);
  text-decoration: underline;
}
/* Visited state stays muted to keep row scan-friendly — we care
 * about "did I click this?" less than "where is this from?". */
.source-link:visited,
.meta-link:visited { color: var(--text-secondary); }

/* ─── Live indicator (pulse dot + label) ─────────────────────────── */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1h);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--success-color);
}
.live-indicator::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success-color);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  animation: live-pulse 1.8s infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .live-indicator::before { animation: none; }
}

/* ─── Status dot (severity-tinted) ────────────────────────────────── */
.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-disabled);
  vertical-align: middle;
  margin-right: var(--space-1h);
}
.dot.critical { background: var(--sev-critical); box-shadow: 0 0 0 3px var(--sev-critical-bg); }
.dot.high     { background: var(--sev-high);     box-shadow: 0 0 0 3px var(--sev-high-bg); }
.dot.medium   { background: var(--sev-medium);   box-shadow: 0 0 0 3px var(--sev-medium-bg); }
.dot.low      { background: var(--sev-low);      box-shadow: 0 0 0 3px var(--sev-low-bg); }
.dot.success  { background: var(--success-color); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }

/* ─── cyn-icon sizing (SVG sprite entries inherit color) ─────────── */
/* The sprite was originally thin-stroked outlines (1.5-1.6px); as of
 * §10.40 the sprite was swapped to Phosphor Fill (solid shapes),
 * matching the visual density of FontAwesome glyphs without the
 * "disappearing in light mode" problem strokes at 1.6px had. The
 * rebuild script (scripts/rebuild_cyn_icons.py) pulls fresh Phosphor
 * Fill SVGs and re-wraps them under our original 48 symbol IDs so
 * the 627 template call sites didn't need edits.
 *
 * Sizing bumped ~15% in §10.41 to compensate for Phosphor's internal
 * viewBox padding. Phosphor ships glyphs in a 256-unit viewBox where
 * the actual shape occupies ~192-200 units (75-78% fill), vs our old
 * outlined icons which used a 24-unit viewBox with ~83% fill. At
 * `width: 1em` the new sprite therefore rendered visibly smaller
 * than the old one by ~10%. Bumping base to 1.15em + proportional
 * pixel modifiers restores parity with the old perceived size AND
 * matches FontAwesome's glyph size at the same font context.
 *
 * Icons now render via `fill: currentColor` — the outer svg inherits
 * `color:` from its parent like before, just fill instead of stroke. */
.cyn-icon {
  width: 1.15em;
  height: 1.15em;
  display: inline-block;
  vertical-align: -0.2em;
  flex-shrink: 0;
  fill: currentColor;
  stroke: none;
}
.cyn-icon--xs  { width: 14px; height: 14px; }
.cyn-icon--sm  { width: 18px; height: 18px; }
.cyn-icon--md  { width: 22px; height: 22px; }
.cyn-icon--lg  { width: 28px; height: 28px; }
.cyn-icon--xl  { width: 36px; height: 36px; }
.cyn-icon--2xl { width: 46px; height: 46px; }

/* ─── Keyboard chip (kbd) ──────────────────────────────────────── */
.kbd, kbd {
  display: inline-block;
  padding: 1px var(--space-1h);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--text-secondary);
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  line-height: 1.4;
}

/* ─── §W1.5 Why-UAE chip ───────────────────────────────────────────
 * Renders on phishing / code-leak / defacement finding cards (and the
 * §W2-3 unified surfaces later) to explain WHY a finding matters to
 * the UAE customer base. The chip always carries a UAE flag-style
 * marker, the entity name, and (for non-TLD matches) the sector
 * category, so an analyst can prioritise at a glance.
 *
 * Confidence variants (mirrors classify_uae_relevance return shape):
 *   high   — exact domain match or brand_field hit (solid copper)
 *   medium — keyword match in free text (outlined copper)
 *   low    — .ae TLD signal only (muted, dotted border)
 */
.why-uae-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 0;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.2px;
  line-height: 1.3;
  white-space: nowrap;
  vertical-align: middle;
  cursor: help;
  border: 1px solid transparent;
  font-family: var(--font-sans);
}
.why-uae-chip.why-uae-sm {
  padding: 1px 6px;
  font-size: var(--text-2xs);
}
.why-uae-flag {
  font-size: var(--text-3xs);
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 4px;
  border-radius: 2px;
  background: var(--brand-500, #D97706);
  color: #1B1208;
  line-height: 1.4;
}
.why-uae-entity { font-weight: 600; }
.why-uae-category {
  opacity: 0.75;
  text-transform: lowercase;
  font-style: italic;
  margin-left: 2px;
}
/* High confidence — solid copper background */
.why-uae-high {
  background: rgba(217, 119, 6, 0.16);
  color: var(--brand-500, #D97706);
  border-color: rgba(217, 119, 6, 0.32);
}
/* Medium confidence — outlined */
.why-uae-medium {
  background: rgba(217, 119, 6, 0.08);
  color: var(--brand-500, #D97706);
  border-color: rgba(217, 119, 6, 0.24);
}
/* Low confidence — muted, dotted border */
.why-uae-low {
  background: var(--input-bg);
  color: var(--text-secondary);
  border: 1px dashed var(--border-default);
}
.why-uae-low .why-uae-flag {
  background: var(--text-secondary);
  color: var(--bg-color);
  opacity: 0.7;
}
body.light-mode .why-uae-high {
  background: rgba(217, 119, 6, 0.18);
}

/* ══════════════════════════════════════════════════════════════════
   Cyntel information-design pattern library (P1–P9)
   Paired with Cyntel.viz.* / Cyntel.fmt.* in cyntel-helpers.js.
   See INFO_DESIGN_AUDIT.md. Token-only; theme-aware via var().
   ══════════════════════════════════════════════════════════════════ */

/* P5 — sparkline */
.cyn-spark { display: block; overflow: visible; }

/* P1 — gauge dial */
.cyn-gauge { display: block; overflow: visible; }
.cyn-gauge-value { font-family: var(--font-display, var(--font-sans)); font-weight: 700; font-size: 1.6rem; }
.cyn-gauge-label { font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: 0.08em; }
.cyn-radar { display: block; overflow: visible; width: 100%; height: auto; }
.cyn-radar-lbl { font-size: var(--text-sm); font-weight: 600; }
.cyn-radar-sub { font-size: var(--text-xs); }

/* trend badge (shared by stat tile + posture hero) */
.cyn-trend { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.cyn-trend-up { color: var(--success-color); }
.cyn-trend-down { color: var(--danger-color); }
.cyn-trend-flat { color: var(--text-secondary); }
.cyn-trend-lbl { color: var(--text-secondary); font-weight: 500; }

/* generic status dot */
.cyn-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* P2 — canonical stat tile */
.cyn-stat { position: relative; overflow: hidden; background: var(--card-bg); border: 1px solid var(--input-border); border-left: 3px solid var(--cyn-accent, var(--primary-color)); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.cyn-stat-spark { position: absolute; right: 0; bottom: 0; left: 0; opacity: 0.45; pointer-events: none; }
.cyn-stat-spark .cyn-spark { width: 100%; height: 26px; }
.cyn-stat-head { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--space-1h); }
.cyn-stat-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cyn-stat-value { position: relative; z-index: 1; font-family: var(--font-display, var(--font-sans)); font-size: 1.5rem /* drawn size, Newsreader */; font-weight: 700; line-height: 1.1; color: var(--text-color); font-variant-numeric: tabular-nums; }
.cyn-stat-trend { position: relative; z-index: 1; }

/* P1 — posture hero (gauge + level + delta + lede narrative) */
.cyn-hero-posture { display: flex; align-items: center; gap: var(--space-5); flex-wrap: wrap; background: var(--card-bg); border: 1px solid var(--input-border); border-radius: var(--radius-md); padding: var(--space-5); }
.cyn-hero-gauge { flex-shrink: 0; }
.cyn-hero-body { flex: 1; min-width: 0; }
.cyn-hero-top { display: flex; align-items: center; gap: var(--space-2h); flex-wrap: wrap; margin-bottom: var(--space-2); }
.cyn-hero-title { font-size: var(--text-lg); font-weight: 700; color: var(--text-color); }
.cyn-hero-finding { margin: 0 0 var(--space-2); font-size: var(--text-base, var(--text-sm)); color: var(--text-color); opacity: 0.9; line-height: var(--leading-normal); }
.cyn-hero-sub { display: flex; gap: var(--space-4); flex-wrap: wrap; }

/* severity badge (cyn-scoped, loud) */
.cyn-sev-badge { display: inline-flex; align-items: center; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: var(--space-0) var(--space-2); border-radius: var(--radius-sm); line-height: var(--leading-normal); }
.cyn-sev-badge.sev-critical { background: var(--sev-critical-bg); color: var(--sev-critical-text); }
.cyn-sev-badge.sev-high { background: var(--sev-high-bg); color: var(--sev-high-text); }
.cyn-sev-badge.sev-medium { background: var(--sev-medium-bg); color: var(--sev-medium-text); }
.cyn-sev-badge.sev-low { background: var(--sev-low-bg); color: var(--sev-low-text); }
.cyn-sev-badge.sev-info { background: var(--sev-info-bg); color: var(--sev-info-text); }

/* P3 — ranked horizontal bars */
.cyn-rank { display: flex; flex-direction: column; gap: var(--space-1h); }
.cyn-rank-row { display: grid; grid-template-columns: minmax(80px, 30%) 1fr auto; align-items: center; gap: var(--space-2h); }
.cyn-rank-label { font-size: var(--text-sm); color: var(--text-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
a.cyn-rank-label:hover { color: var(--link-color); text-decoration: underline; }
.cyn-rank-track { height: 9px; background: var(--input-bg); border-radius: 0; overflow: hidden; }  /* square (BRAND.md §4b); the fill inherits it */
.cyn-rank-fill { display: block; height: 100%; min-width: 2px; border-radius: inherit; }
.cyn-rank-value { font-size: var(--text-sm); font-weight: 600; color: var(--text-color); font-variant-numeric: tabular-nums; text-align: right; }

/* P4 (.cyn-sevbar*) removed 2026-10-12 with Cyntel.viz.severityBar, its only user. */

/* P6 — funnel / cascade */
.cyn-funnel { display: flex; flex-direction: column; gap: var(--space-2); }
.cyn-funnel-row { display: flex; align-items: center; gap: var(--space-3); }
.cyn-funnel-bar { display: flex; align-items: center; justify-content: flex-end; min-width: 44px; height: 28px; padding: 0 var(--space-2); border-radius: var(--radius-sm); }
.cyn-funnel-value { font-size: var(--text-sm); font-weight: 700; color: var(--text-on-accent, #fff); font-variant-numeric: tabular-nums; }
.cyn-funnel-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cyn-funnel-label { font-size: var(--text-sm); color: var(--text-color); }
.cyn-funnel-note { font-size: var(--text-xs); color: var(--text-secondary); }
.cyn-funnel-drop { font-size: var(--text-xs); color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* P7 — finding / insight card */
.cyn-finding { display: block; background: var(--card-bg); border: 1px solid var(--input-border); border-left: 3px solid var(--sev-info); border-radius: var(--radius-md); padding: var(--space-2h) var(--space-3); text-decoration: none; transition: border-color var(--transition-fast), background var(--transition-fast); }
a.cyn-finding:hover { background: var(--hover-bg); }
.cyn-finding.sev-critical { border-left-color: var(--sev-critical); }
.cyn-finding.sev-high { border-left-color: var(--sev-high); }
.cyn-finding.sev-medium { border-left-color: var(--sev-medium); }
.cyn-finding.sev-low { border-left-color: var(--sev-low); }
.cyn-finding.sev-info { border-left-color: var(--sev-info); }
.cyn-finding-title { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); font-size: var(--text-sm); font-weight: 600; color: var(--text-color); }
.cyn-finding-metric { flex-shrink: 0; font-size: var(--text-sm); font-weight: 700; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.cyn-finding-detail { margin-top: var(--space-0); font-size: var(--text-xs); color: var(--text-color); opacity: 0.8; line-height: 1.45; }
.cyn-finding-meta { margin-top: var(--space-1); font-size: var(--text-xs); color: var(--text-secondary); }

/* P8 — empty + skeleton states */
.cyn-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); padding: var(--space-7) var(--space-4); text-align: center; color: var(--text-secondary); }
.cyn-empty-sm { padding: var(--space-3); }
.cyn-empty-icon { font-size: var(--text-2xl); opacity: 0.5; }
.cyn-empty-title { font-size: var(--text-sm); font-weight: 600; color: var(--text-color); }
.cyn-empty-detail { max-width: 360px; font-size: var(--text-xs); color: var(--text-secondary); }
.cyn-skeleton { display: flex; flex-direction: column; gap: var(--space-2); }
/* Shimmer via the canonical overlay technique (the shared `shimmer` keyframe) —
   the same moving-band mechanism as .skeleton / .notif-placeholder. Was a
   separate background-position sweep on its own keyframe; unified to ONE shimmer
   keyframe + technique app-wide (UI_POLISH Wave 3). */
.cyn-skeleton-row { height: 14px; border-radius: var(--radius-sm); background: var(--input-bg); position: relative; overflow: hidden; }
.cyn-skeleton-row::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0%, var(--overlay-faint) 35%, var(--overlay-soft) 50%, var(--overlay-faint) 65%, transparent 100%); animation: shimmer 1.6s ease-in-out infinite; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .cyn-skeleton-row::after { animation: none; } }


/* ============================================================================
   Command Center v2 (§10.144) — tokens for the redesigned / index page
   (templates/index.html, gated by config.COMMAND_CENTER_V2). One appended,
   commented block per the handoff. --cc-* map onto the dossier design system
   so the page is theme-safe (dark/light/focus) and redraws on cyntel:themechange.
   "More amber" per the approved brief: hbar fills + section labels + timeline
   lead carry accent colour instead of Rev C's strict grayscale budget.
   ============================================================================ */
:root, html.chrome-light #main-navbar {
  --cc-canvas:    var(--bg-color);
  --cc-line:      var(--input-border);
  --cc-line-2:    var(--border-strong);
  --cc-amber:     var(--brand);
  --cc-amber-lit: var(--brand-hover);
  --cc-phosphor:  var(--phosphor);
  --cc-display:   var(--font-display);
  --cc-mono:      var(--font-mono);
  --cc-sans:      var(--font-sans);
  /* data inks — neutral value ramp (dark theme) */
  --cc-ink-2: #8A867E;
  --cc-ink-3: #7A776F;
  --cc-ink-4: #6E6B64;
  --cc-ink-5: #55524C;
  /* ATT&CK heat ramp (warm paper-white, theme-flipped below) */
  --cc-heat-1: rgba(237,234,226,.13);
  --cc-heat-2: rgba(237,234,226,.34);
  --cc-heat-3: rgba(237,234,226,.80);
  /* Faintest surface separation — a lift on dark, a wash on light. The raw
     rgba(255,255,255,.012) this replaces was inlined in index.html, where on
     a light canvas it is white-on-white and the panel edge vanishes. (P0-12) */
  --cc-lift: rgba(255,255,255,.012);
  /* NB: --cc-hover used to live here (§10.194 minted it to fix index.html's raw
     rgba(127,127,127,.05) fallback behind a token that was never defined). It is
     RETIRED: it was the same wash as --hover-bg, and index.html now uses that
     directly. Keeping it as `--cc-hover: var(--hover-bg)` would have looked
     tidy and been broken — an alias declared HERE (on :root) bakes --hover-bg's
     :root value, so it could not see a body-only theme override. One token,
     no alias. (Focus mode, the original motivation, was retired 2026-07-26.) */
}
html.light-mode, body.light-mode, html.chrome-light body #main-navbar {
  /* Warm data inks — were Tailwind cool greys (#4B5563/#6B7280/#9CA3AF/
     #C3C8CF), the last cool ramp left in light mode after the 2026-07-26
     dossier migration. */
  --cc-ink-2: #57534E;
  --cc-ink-3: #6E675E;
  --cc-ink-4: #9A9287;
  --cc-ink-5: #C7BFB1;
  --cc-heat-1: rgba(26,18,6,.10);
  --cc-heat-2: rgba(26,18,6,.32);
  --cc-heat-3: rgba(26,18,6,.72);
  --cc-lift: rgba(26,18,6,.022);
}

/* ============================================================================
   Ultrawide content centering
   ----------------------------------------------------------------------------
   base.html wraps {% block content %} in <div class="app-content">. On very
   wide monitors (≥1600px) page content is capped to the Command Center's own
   1560px measure and centered, instead of sprawling edge-to-edge and forcing
   the eye to travel across dead horizontal space. Laptops (<1600px) are
   untouched — the cap never engages.

   Pages that own their own full-height / viewport-fixed layout (the admin
   console, the attack graph canvas, both chat surfaces) must NOT be centered —
   a centered content box would detach their fixed rail or break a height:100%
   chain. Those opt out via display:contents, which removes the wrapper's box
   from layout entirely (at every width, so it can never interfere), leaving
   those pages exactly as they render today. :has() keeps this to CSS with zero
   per-template edits; it is baseline-supported.

   ⚠ A FILTER RAIL IS NOT A REASON TO OPT OUT — it was, and stopped being one.
   This list used to hold a blanket `.app-content:has(.layout-with-sidebar)`,
   written when EVERY filter page pinned its rail with `position: fixed`, which
   ignores a centered wrapper and would have stranded the rail at the far left.
   The v2 inventory archetype reclaims the rail to `position: static` inside a
   `grid-template-columns: var(--rail) 1fr` (see the RAIL RECLAIM block in
   page-archetypes.css), so on every migrated page the rail is IN FLOW and
   centers with the rest of the page like any other child. The blanket rule
   outlived its reason and was holding ~20 migrated pages full-bleed beside
   filter-less pages that centered, which is the inconsistency an owner sees on
   a wide monitor: same app, two page widths. Narrowed to the rails that are
   still fixed — `:not(.pa-rail-layout)`, i.e. cases / detection_lab /
   attack_surface — and those are handled below rather than exempted.
   ========================================================================== */
body.aia-body .app-content,               /* AI analyst chat (own full-height shell) */
.app-content:has(.layout-with-sidebar:not(.pa-rail-layout)),  /* the 3 pages still on the pre-redesign FIXED rail */
.app-content:has(.admin-wrapper),         /* admin console (fixed 240px rail) */
/* ⚠ `.ag-body` (attack graph) WAS HERE, exempted as "full canvas", and that
   stopped being true at turn 19a. The page now opens on the MATRIX — a
   reading band, a table and a closing pair, the same document shape as every
   other v2 page — and the canvas is one of three lenses behind a tab, clamped
   to `clamp(420px, 62vh, 760px)`. A document has no claim on 2560px, and the
   page was the only one in the app not centring on a wide monitor: same app,
   two page widths, which is exactly the inconsistency the note below this list
   describes for the filter rails.
   It keeps a full-height flex shell, so its own stylesheet declares what
   `.app-content` has to BE for that shell to work — see attack_graph.html.
   The cap and the centring come from here like everywhere else. */
.app-content:has(.ksf-body),              /* knowledge starfield (full-bleed WebGL) */
.app-content:has(.chat-wrapper),          /* legacy chat page */
.app-content:has(.np) {                   /* login + 2FA spotlight — full-viewport, must not be capped/centered */
  display: contents;
}
@media (min-width: 1600px) {
  .app-content {
    max-width: var(--page-measure);
    margin-inline: auto;
  }

  /* The three pre-redesign pages cannot centre by wrapping: a fixed rail is
     positioned against the VIEWPORT, so it ignores whatever box its ancestor
     draws, and shifting it with a `calc((100vw - measure)/2)` gutter lands ~5px
     off — 100vw counts the scrollbar and `margin-inline: auto` does not, so the
     two page families would centre on measurably different axes.

     So do to them at ≥1600px what the archetype does permanently: take the rail
     OUT of fixed positioning and let it centre in flow with everything else.
     Sticky holds it against the chrome exactly as fixed did (it is flush under
     the navbar, so it sticks immediately and never scrolls away), and the
     content column drops the 260px margin it only ever carried to clear a rail
     that was out of flow. No viewport arithmetic, so no scrollbar discrepancy.

     Below 1600px nothing here applies and the fixed rail is untouched, which
     includes the whole ≤992px overlay mechanism. Retire this block when the
     last of the three migrates.

     The height clears --footer-h (:root) — a fixed footer's height, 0 since
     the footer scrolls with the page (2026-10-12); the rail's own `bottom`
     reads the same token. */
  .app-content:has(.layout-with-sidebar:not(.pa-rail-layout)) {
    display: block;
    max-width: var(--page-measure);
    margin-inline: auto;
  }
  /* ⚠ `top: 0`, NOT `top: var(--nav-height)` — the offset the fixed rail used
     and the one sticky needs are different numbers. html is overflow:hidden
     here and BODY is the scroll container, so the scrollport sticky measures
     from is body's padding box, which already starts below the navbar (body
     carries padding-top: var(--nav-height) for exactly that). Repeating the
     nav height sticks the rail 80px too low and pushes its last 80px — the
     Clear-filters control — below the footer, on a rail that cannot scroll to
     reveal it. Measured at 2560×1400: top:0 sticks at y=80 with the bottom
     landing on 1362, which is the footer's top edge exactly. */
  .app-content:has(.layout-with-sidebar:not(.pa-rail-layout)) .filter-sidebar {
    position: sticky;
    inset: 0 auto auto auto;
    height: calc(100vh - var(--nav-height) - var(--footer-h));
  }
  .app-content:has(.layout-with-sidebar:not(.pa-rail-layout)) .main-content {
    margin-inline: 0;
  }
}

/* Command palette (Ctrl+K) item hover + keyboard-selected state. L1 CSP
   (§10.208): these were inline onmouseenter/onmouseleave + a `sel` inline
   background in shared.js; moved to CSS so no inline handlers remain. The
   builder sets aria-selected per item and re-renders on nav. */
.cmd-item:hover { background: var(--hover-bg); }
.cmd-item[aria-selected="true"]:not(:hover) { background: color-mix(in srgb, var(--text-color) 10%, transparent); }

/* ══════════════════════════════════════════════════════════════════════════
   Preview-pane "analyst reasoning" pattern (.pv-*)  — REUSABLE
   ---------------------------------------------------------------------------
   Introduced for the Threat-Feed drawer's Analyst-reasoning panel (why-it-
   matters + org-relevance score dial + affected chips + clickable entity
   pivots + recommended-actions checklist + auto-alert cue). Token-only so it
   theme-flips (dark / light / focus) with zero per-theme overrides, and is
   safe to drop into ANY .preview-* slide-over to keep the app's preview panes
   cohesive. Rendered by dashboard.html buildAnalystReasoning(). Full contract:
   PREVIEW_PANE_PATTERN.md.
   ══════════════════════════════════════════════════════════════════════════ */
.pv-slot:empty { display: none; }
.pv-callout, .pv-relscore {
  /* Copper accents (dark, Field Dossier): --pv-accent = highlights
     (title/score/chips/cues), --pv-accent-dim = section eyebrows. NOT the
     yellow --sev-medium-text severity token — that was the mismatch vs the
     approved preview. One light-mode override below keeps it legible on white. */
  --pv-accent: var(--brand-400);
  --pv-accent-dim: var(--brand-500);
}
html.light-mode .pv-callout, body.light-mode .pv-callout,
html.light-mode .pv-relscore, body.light-mode .pv-relscore {
  --pv-accent: var(--brand-700);
  --pv-accent-dim: var(--brand-700);
}
.pv-callout {
  border: 1px solid color-mix(in srgb, var(--primary-color) 30%, transparent);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--brand-tint), transparent 72%);
  padding: var(--space-4);
  margin: var(--space-3) 0 var(--space-2);
}
.pv-callout-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.pv-callout-title {
  font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--pv-accent);
  display: inline-flex; align-items: center; gap: var(--space-1);
}
.pv-rerun, .pv-run-btn {
  background: transparent; border: 1px solid var(--input-border);
  color: var(--text-secondary); border-radius: var(--radius-md); cursor: pointer;
}
.pv-rerun { margin-inline-start: auto; padding: var(--space-1) var(--space-2); font-size: var(--text-xs); }
.pv-rerun:hover, .pv-run-btn:hover { color: var(--pv-accent); border-color: var(--pv-accent); }
.pv-run-btn { padding: var(--space-1h) var(--space-3); font-size: var(--text-sm); font-family: var(--font-mono); }
.pv-callout-empty .pv-empty-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.pv-muted { color: var(--text-disabled); font-size: var(--text-sm); }

.pv-score-row { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-4); }
.pv-ring {
  position: relative; width: 64px; height: 64px; flex: 0 0 auto; border-radius: 50%;
  background: conic-gradient(var(--primary-color) calc(var(--pv-score, 0) * 1%), var(--surface-3) 0);
}
.pv-ring::before { content: ""; position: absolute; inset: var(--space-1h); border-radius: 50%; background: var(--surface-1); }
.pv-ring b {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: var(--text-xl); font-weight: 700; color: var(--pv-accent);
}
.pv-score-lbl { display: flex; flex-direction: column; gap: var(--space-1); }
.pv-score-lbl .pv-k {
  font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--text-disabled);
}
.pv-score-lbl .pv-v { font-size: var(--text-md); font-weight: 600; color: var(--text-color); }
.pv-advised {
  font-family: var(--font-mono); font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--sev-critical-text); background: var(--sev-critical-bg);
  padding: var(--space-0) var(--space-2); border-radius: var(--radius-sm);
}

.pv-block { margin-bottom: var(--space-4); }
.pv-block:last-child { margin-bottom: 0; }
.pv-block-label {
  font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--pv-accent-dim); margin-bottom: var(--space-2);
}
.pv-block-label .pv-hint { color: var(--text-disabled); letter-spacing: 0; }
.pv-reasoning { font-size: var(--text-sm); line-height: var(--leading-relaxed); color: var(--text-secondary); }

.pv-chips { display: flex; flex-wrap: wrap; gap: var(--space-1h); }
.pv-chip {
  font-family: var(--font-mono); font-size: var(--text-xs); border-radius: var(--radius-sm);
  padding: var(--space-0) var(--space-2); border: 1px solid var(--input-border); color: var(--text-secondary);
}
.pv-chip.vendor { color: var(--pv-accent); border-color: color-mix(in srgb, var(--primary-color) 30%, transparent); background: var(--brand-tint); }
.pv-chip.geo { color: var(--cyan-color); }

.pv-pivots { display: flex; flex-direction: column; gap: var(--space-1h); }
.pv-pivot {
  display: flex; align-items: center; gap: var(--space-2h); text-decoration: none;
  border: 1px solid var(--input-border); border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3); background: var(--bg-deeper);
  color: var(--text-secondary); font-size: var(--text-sm); transition: var(--transition-fast);
  transition-property: var(--paint-props);
}
.pv-pivot:hover { border-color: var(--pv-accent); background: var(--brand-tint); }
.pv-pivot b { color: var(--text-color); font-family: var(--font-mono); font-size: var(--text-sm); }
.pv-pivot-ic {
  width: 26px; height: 26px; border-radius: var(--radius-sm); flex: 0 0 auto;
  display: grid; place-items: center; font-family: var(--font-mono); font-size: var(--text-2xs); font-weight: 700;
}
.pv-pivot-ic.tech { background: var(--brand-tint); color: var(--cyan-color); }
.pv-pivot-ic.act  { background: var(--brand-tint); color: var(--pv-accent); }
.pv-pivot-ic.cve  { background: var(--sev-critical-bg); color: var(--sev-critical-text); }
.pv-pivot-k {
  font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-disabled);
}
.pv-pivot-go { margin-inline-start: auto; color: var(--text-disabled); }
.pv-kev { font-family: var(--font-mono); font-size: var(--text-2xs); font-weight: 700; letter-spacing: 0.06em;
  color: var(--sev-critical-text); background: var(--sev-critical-bg); border-radius: var(--radius-sm); padding: 0 var(--space-1); }

.pv-checklist { list-style: none; margin: 0; padding: 0; counter-reset: pv-a; display: flex; flex-direction: column; gap: var(--space-2); }
.pv-check {
  position: relative; counter-increment: pv-a;
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-8);
  border: 1px solid var(--input-border); border-radius: var(--radius-md); background: var(--bg-deeper);
  font-size: var(--text-sm); line-height: var(--leading-normal); color: var(--text-secondary);
}
.pv-check::before {
  content: counter(pv-a); position: absolute; inset-inline-start: var(--space-2); top: var(--space-2);
  width: 22px; height: 22px; border-radius: var(--radius-sm); display: grid; place-items: center;
  background: var(--brand-tint); color: var(--pv-accent);
  font-family: var(--font-mono); font-size: var(--text-2xs); font-weight: 700;
}
.pv-alert-cue {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--pv-accent);
  background: var(--brand-tint); padding: var(--space-1) var(--space-3); border-radius: var(--radius-sm); margin-top: var(--space-3);
}
.pv-src { margin-top: var(--space-3); font-family: var(--font-mono); font-size: var(--text-xs); }
.pv-src a { color: var(--link-color); text-decoration: none; }
.pv-src a:hover { text-decoration: underline; }

/* Collapsed feed-row relevance cue (title-cell mini badge). */
.pv-relscore { color: var(--pv-accent); border: 1px solid color-mix(in srgb, var(--primary-color) 30%, transparent); background: var(--brand-tint); }

/* ═══ Cross-document View Transitions (MPA page-to-page animation) ═════════
   Progressive enhancement: browsers without support hard-cut exactly as
   before. The persistent chrome — top navbar + footer — gets a stable
   view-transition-name so it stays put while only the content region
   cross-fades, instead of the whole page flashing on every navigation.
   Pure CSS: no client router, no JS, no CSP impact. Both the old and new
   page opt in because shared.css is on every page. Disabled under
   prefers-reduced-motion (instant nav). Audit Tier-B #1 (2026-07-19). */
@view-transition { navigation: auto; }
#main-navbar { view-transition-name: cyn-navbar; }
.app-footer  { view-transition-name: cyn-footer; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* ═══ Inclusive-display fallbacks (additive — apply only when opted in) ════
   Default rendering is unchanged. Two display prefs the app didn't honor:
   • prefers-reduced-transparency: swap glass/blur for solid surfaces so
     low-vision users get legible panels.
   • forced-colors (Windows High Contrast): background-only differentiation
     (glass, cards, severity fills) vanishes, so restore visible borders and
     let the system palette drive; severity meaning survives via its text
     label. Windows prod + UAE-gov procurement relevant. Audit Tier-B #5. */
@media (prefers-reduced-transparency: reduce) {
  .glass-card, .preview-pane, .modal-content, .modal-backdrop,
  .modal-backdrop-theme, .cmd-backdrop {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .glass-card, .preview-pane, .modal-content { background: var(--surface-2) !important; }
}
@media (forced-colors: active) {
  .glass-card, .card-panel, .stat-card, .preview-pane, .sev-badge {
    border: 1px solid CanvasText;   /* shape lost when it was background-only */
    backdrop-filter: none;
  }
  /* Custom focus rings (color-mix/--focus-ring) drop out in HCM — use the
     system Highlight so keyboard focus stays visible. */
  :focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
}

/* ═══ Typographic wrapping (additive; degrades to normal wrap) ═════════════
   balance headings (even line lengths, no orphaned last word) and pretty body
   (avoids orphans/rivers). Pure enhancement — unsupported browsers wrap as
   before, no size/layout change. Pairs with the fluid display tokens above to
   complete the fluid-type system. Audit Tier-B #4. */
h1, h2, h3, .page-header h1, .ph-title { text-wrap: balance; }
p, .pv-reasoning { text-wrap: pretty; }

/* ═══ Native-control theming (color-scheme) ════════════════════════════════
   Without this the browser renders scrollbars, <select> popups, date pickers,
   spin buttons and autofill in its DEFAULT light styling — light-on-dark and
   obviously foreign inside the dossier theme. One declaration per theme fixes
   the lot. (tabular-nums is already applied across the data surfaces.) */
:root, html.chrome-light #main-navbar { color-scheme: dark; }
html.light-mode, body.light-mode, html.chrome-light body #main-navbar { color-scheme: light; }

/* ═══ Inline form validation (:user-invalid) ═══════════════════════════════
   :user-invalid marks a field invalid only AFTER the user has interacted with
   it — unlike :invalid, which fires on load and shouts at an untouched form.
   Additive: no JS, no markup change, and it degrades to no styling. Deliberately
   NOT styling :user-valid — turning every filled field green is noise. */
input:user-invalid, select:user-invalid, textarea:user-invalid {
  border-color: var(--danger-color);
}
input:user-invalid:focus-visible, select:user-invalid:focus-visible,
textarea:user-invalid:focus-visible { outline-color: var(--danger-color); }
