/* ============================================================================
   CORE DESIGN SYSTEM - Shared Across All MAX Apps
   ============================================================================

   THEMING ARCHITECTURE:
   Every MAX app includes this file. It provides design tokens (--color-*,
   --font-*, --spacing-*) that map to --vscode-* CSS variables.

   The --vscode-* variables are ALWAYS defined, from one of two sources:
   1. VS Code (Shell mode): injected as inline styles on <html> by the extension
   2. Standalone (Browser mode): defined by vscode-dark-theme.css (imported below)

   Since --vscode-* vars are always present, design tokens reference them
   WITHOUT inline fallbacks. This is intentional — do NOT add fallback values
   to --color-* definitions. If a --vscode-* var is missing, add it to
   vscode-dark-theme.css instead.

   Standalone is ALWAYS dark. There is no light mode for browser rendering.

   ICON POLICY — HARD RULE:
   ALL icons MUST be Lucide SVGs. NEVER use emoji, Font Awesome, Material Icons,
   or any other icon library. This applies everywhere: app UI, chat messages,
   GenUI components, coach/welcome views, onboarding, system prompts.
   Emoji are explicitly forbidden — they render inconsistently across platforms
   and break the design system's visual coherence.

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

/* Import standalone dark theme defaults (defines all --vscode-* variables).
   In VS Code, these are overridden by inline styles with higher specificity. */
@import url('vscode-dark-theme.css');

/* ============================================================================
   ROOT: CSS CUSTOM PROPERTIES (Theme-Adaptive)
   =========================================================================== */

:root {
    /* ────────────────────────────────────────────────────────────────────
       Background Colors — mapped from --vscode-* (always defined)
       ──────────────────────────────────────────────────────────────────── */
    --color-bg-primary: var(--vscode-editor-background);
    --color-bg-secondary: var(--vscode-sideBar-background);
    --color-bg-tertiary: var(--vscode-editorWidget-background);
    --color-bg-overlay: rgba(255, 255, 255, 0.02);
    /* The dimming layer behind a modal dialog (a scrim), on light and dark alike. Not --color-bg-overlay, which is a
       faint SURFACE tint (2% white). Added 2026-10-27 for the Team check-in dialog, which had a hand-mixed #000. */
    --color-scrim: rgba(0, 0, 0, 0.4);

    /* ────────────────────────────────────────────────────────────────────
       THE SURFACE LADDER — two rungs that had no token (2026-07-25).

       Six ordered zones carry the whole UI; four already had tokens
       (shell-bg-deep · bg-primary · bg-secondary · bg-elevated). These are
       the two that existed VISUALLY but had no name, which is why apps
       hand-rolled them as literals (#08192a, rgb(14,41,66), the #0a2540
       pane title bar). A zone without a token is a zone that drifts.

         --color-bg-sunken        pane TITLE BARS + inset wells (search
                                  fields, tracks). Recessed INTO the frame:
                                  darker than the canvas on dark themes,
                                  lighter on light.
         --color-bg-overlay-solid popovers / dropdowns / context menus. NOT
                                  --color-bg-overlay, which is a 2%-white
                                  ALPHA wash for hover tints — a menu painted
                                  with that inherits whatever it floats over
                                  and reads as inline.

       Defaults keep any theme that doesn't override them rendering as it
       did before: sunken falls back to the widget bg, overlay-solid to the
       elevated surface. themes.js sets both per theme.
       ──────────────────────────────────────────────────────────────────── */
    --color-bg-sunken: var(--vscode-editorWidget-background);
    --color-bg-overlay-solid: var(--color-bg-elevated, var(--color-bg-secondary));

    /* ────────────────────────────────────────────────────────────────────
       Item-cell lift (2026-06-24) — the shared "raised tile" surface that
       EVERY GenUI list row / calendar event / email row / table row / callout
       draws from. The prior item fill was --color-bg-overlay (2% white over
       the card) which is perceptually invisible on dark themes → cells read as
       bare hairlines with no lift. These tokens give a real lighter-than-card
       fill + a crisper border + a soft elevation shadow, theme-relative so
       they lift correctly in every theme (mix against the card surface, not a
       hardcoded navy). Hover keeps its delta because the hover fill mixes more
       white than the rest fill. See genui CLAUDE.md "item-cell lift".
       ──────────────────────────────────────────────────────────────────── */
    --color-item-bg:       color-mix(in srgb, var(--color-bg-secondary) 86%, var(--color-text-primary));
    --color-item-bg-hover: color-mix(in srgb, var(--color-bg-secondary) 79%, var(--color-text-primary));
    --color-item-border:        rgba(255, 255, 255, 0.12);
    --color-item-border-hover:  rgba(255, 255, 255, 0.20);
    /* Grounded, not floaty (2026-06-24): a light inset top highlight + a small,
       tight shadow keeps the tile a distinct-but-seated part of the card — the
       big 5–14px drop read as hovering off the surface. */
    --color-item-shadow:       0 1px 0 rgba(255, 255, 255, 0.07) inset, 0 1px 3px -1px rgba(0, 0, 0, 0.4);
    --color-item-shadow-hover: 0 1px 0 rgba(255, 255, 255, 0.10) inset, 0 2px 6px -2px rgba(0, 0, 0, 0.5);

    /* ────────────────────────────────────────────────────────────────────
       Shell Colors — app frame (header, nav rails, drawers, shell popovers).
       Default to the content bg tokens so themes without an explicit
       shell override render unchanged. Warm Light overrides all of these
       in themes.js to introduce the shell/content visual split.
       ──────────────────────────────────────────────────────────────────── */
    --color-shell-bg:          var(--color-bg-primary);
    --color-shell-bg-elevated: var(--color-bg-secondary);
    --color-shell-bg-deep:     var(--color-bg-tertiary);
    --color-shell-bg-overlay:  var(--color-bg-overlay);
    --color-shell-border:      var(--color-border-normal);
    --color-shell-divider:     var(--color-divider);
    --color-shell-text:        var(--color-text-primary);
    --color-shell-text-muted:  var(--color-text-secondary);
    --color-shell-accent:      var(--color-accent);

    /* ────────────────────────────────────────────────────────────────────
       Text Colors — mapped from --vscode-* (always defined)
       ──────────────────────────────────────────────────────────────────── */
    --color-text-primary: var(--vscode-foreground);
    --color-text-secondary: var(--vscode-descriptionForeground);
    --color-text-tertiary: var(--vscode-disabledForeground);
    --color-text-disabled: rgba(100, 100, 100, 0.60);
    --color-text-inverse: rgba(255, 255, 255, 0.95);

    /* E-signature request card ink (applet spec §6.1 — every pair MEASURED in
       the rendered state gallery). Secondary/meta text: the global navy #506878
       is 2.90:1. Measure on the REAL navy theme — themes.js sets
       --color-bg-secondary #1A212A, so a row tile is #353b42 and a HOVERED tile
       #42484f (My requests leaves the pointer on the row just opened). #8aa0b2
       and then #9db3c4 each passed somewhere lighter and failed there (4.26:1,
       axe 2026-09-24); #b0c2d0 is 5.05:1. The filled primary: white on brand
       orange #FB4100 is 3.58:1 (fails AA), so the button fill is #b83000 and
       brand orange stays an accent. Warm light overrides the ink in themes.js. */
    --applet-text-secondary: #b0c2d0;
    --applet-primary: #b83000;
    /* Ink ON the filled primary (and on a filled switch): white on #b83000 is
       6.07:1. And a document page's own white, behind its screenshot — paper,
       not a theme surface, so it stays white in every theme. */
    --applet-on-primary: #ffffff;
    --applet-paper: #ffffff;
    /* Status ink on the card's tinted pills/lines (navy), measured ≥4.5:1 on
       their 14% tint over the card well — the generic --color-error /
       --color-warning FAIL there (axe, 2026-09-24). Warm light: themes.js. */
    /* Also ≥4.5:1 on the hovered row tile #42484f, where the first set failed
       (#10b981 3.64, #f59e0b 4.30, #f87171 3.34, #01A9DB 3.39): ok 4.81 · warn 5.54 ·
       err 4.87 · info 4.60. */
    --applet-ok: #34d399;
    --applet-warn: #fbbf24;
    --applet-err: #fca5a5;
    --applet-info: #4cc4ef;

    /* ────────────────────────────────────────────────────────────────────
       Border & Divider — mapped from --vscode-* (always defined)
       ──────────────────────────────────────────────────────────────────── */
    --color-border-light: rgba(255, 255, 255, 0.08);
    --color-border-normal: var(--vscode-widget-border);
    --color-border-strong: rgba(255, 255, 255, 0.16);

    /* 🔴 THE BARE NAME MUST RESOLVE (2026-08-06). `var(--color-border)` — no
       suffix — was used at 181 sites across 32 files and was DEFINED NOWHERE.
       An undefined custom property makes the whole declaration invalid, so
       `border: 1px solid var(--color-border)` computes to border-style:none and
       the border renders as NOTHING. Silently: no console warning, no error,
       just a missing line. Measured live before this alias:

           --color-border        (EMPTY)
           --color-border-normal rgba(255,255,255,0.16)

       This has bitten before — src/workspace/view/tests/design-p1-border-icons.spec.cjs
       is a committed 2026-06-09 clm-verify P1 regression whose own comment reads
       "the old var(--color-border) resolved to transparent → invisible", fixed
       there by hand at one call site while 181 others kept failing.

       Aliasing to -normal is the fix rather than sweeping 181 sites, because a
       sweep leaves the trap armed for the next author who reaches for the
       obvious name. Both theme families define --color-border-normal
       explicitly (themes.js:252 navy, :400 warm-light), so this resolves on
       every theme. Gate: src/shared/__tests__/design-tokens-resolve.test.mjs. */
    --color-border: var(--color-border-normal);

    /* ── The rest of the undefined-token sweep (2026-08-06) ─────────────────
       The gate that caught --color-border found 19 more tokens referenced with
       no fallback and defined nowhere — every one of them silently drawing
       nothing. They are all obvious aliases of tokens that DO exist, so they
       are defined here rather than edited out of ~30 call sites: the author's
       intent was clear at each site, and the name they reached for should
       simply work. Verified against real usage before aliasing (e.g.
       --color-error-soft is used as a `background:` for a high-risk tone, so it
       maps to a tint, not to the solid error colour).

       ⚠️ These now RENDER where they previously drew nothing. That is the
       point, but it means a handful of surfaces gain a border or a fill they
       have visually lacked — if one looks wrong, the fix is that surface's CSS,
       not deleting the token again. */

    /* Soft status fills — used as `background:` under status text/rows. Tints,
       never the solid semantic, which stays the fill/border/dot colour. */
    --color-error-soft:   color-mix(in srgb, var(--color-error) 14%, transparent);
    --color-warning-soft: color-mix(in srgb, var(--color-warning) 14%, transparent);
    --color-success-soft: color-mix(in srgb, var(--color-success) 14%, transparent);
    --color-info-soft:    color-mix(in srgb, var(--color-info) 14%, transparent);

    /* Interaction surfaces — the row/hover/active ladder. */
    --color-bg-hover:  var(--color-bg-overlay);
    --color-bg-active: var(--color-bg-tertiary);

    /* Border spellings people reach for. All resolve into the real ladder. */
    --color-border-subtle:  var(--color-border-light);
    --color-border-medium:  var(--color-border-normal);
    --color-border-primary: var(--color-border-normal);
    --color-tab-border:     var(--color-border-normal);

    /* Text spellings. --color-text is the bare instinctive name for body ink. */
    --color-text:           var(--color-text-primary);
    --color-text-muted:     var(--color-text-secondary);
    --color-fg-secondary:   var(--color-text-secondary);
    --color-header-ink-app: var(--color-text-primary);
    --color-divider: rgba(255, 255, 255, 0.06);

    /* ────────────────────────────────────────────────────────────────────
       Accent Color — consistent across all apps
       ────────────────────────────────────────────────────────────────────
       🔴 THE ACCENT IS BRAND BLUE. It was periwinkle→purple (#667eea /
       #8b9eff / #764ba2) until 2026-07-27, which is why buttons, chips,
       focus rings and every accent gradient across the platform read violet
       while the logo, header wordmark and brand were blue.

       THIS BLOCK IS THE REAL OWNER — not the theme JSON. Three things have
       to be true at once for the purple to appear, and only this file was
       load-bearing:
         1. `navy` (the DEFAULT theme) sets NO accent key at all in the live
            THEMES object in themes.js, so it falls through to these values.
         2. `light` sets ONLY '--color-accent' (themes.js), so even on the
            light theme --color-accent-dark/-light/-bg fell through to HERE.
            Measured live before the fix: --color-accent #01A9DB (correct)
            but --color-accent-dark #764ba2 — so every accent GRADIENT on
            the light theme ran blue→purple.
         3. themes/navy.json + light.json carried accent values too, but
            applyTheme reads THEMES[id].vars, never the JSON — editing the JSON
            changed NOTHING at runtime. That copy was deleted (E-23922); the
            theme now has one source.

       Keep in step with --brand-blue below. --color-accent is the semantic
       "interactive accent" role; --brand-blue is the brand mark itself.
       They coincide today by design, but they answer different questions —
       don't collapse one into the other. */
    --color-accent: #01A9DB;
    --color-accent-light: #33bbee;
    --color-accent-dark: #0286ad;
    --color-accent-ink: var(--color-accent);
    --color-shell-accent-ink: var(--color-accent-ink);   /* the rail's accent as TEXT / glyph ink; --color-shell-accent stays the fill and indicator colour */
    /* Popover / context-menu surface + shadow. The default is the dark-theme lift (elevated mixed toward the text colour, strong shadow);
       a light theme overrides both in themes.js. */
    --color-menu-bg: color-mix(in srgb, var(--color-bg-elevated, var(--color-bg-secondary, #fff)) 78%, var(--color-text-primary, #1a1a1a) 22%);
    --color-menu-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    --color-menu-danger: #ffb8b2;   /* destructive row text on the dark-theme lifted menu (4.5:1 there); light themes set #ae3731 */
    --color-accent-bg: rgba(1, 169, 219, 0.08);
    --color-accent-bg-hover: rgba(1, 169, 219, 0.12);

    /* ────────────────────────────────────────────────────────────────────
       Brand Colors — only acceptable hardcoded colors
       ──────────────────────────────────────────────────────────────────── */
    --brand-orange: #FB4100;
    --brand-blue: #01A9DB;
    --brand-slack: #6b4fa0;      /* Slack marks in the Messages app — the one token for "this row is Slack" */
    /* E-37925 — the Messages blue of a SENT iMessage bubble (and the open conversation's row), the same in both
       themes, as Messages itself. The #0a84ff family, one step deeper so the white ink clears AA for 14px text
       (#0a84ff is 3.65:1 with white; this is 4.58:1). */
    --color-imessage-sent: #0a74e0;
    --color-on-imessage-sent: #ffffff;
    /* E-37949 (UX round 2) — a RECEIVED iMessage bubble has its OWN token, never a theme surface: round 2 read the
       light theme's tertiary surface (tan on warm-light) as "a theme surface rather than a bubble". Dark keeps the
       colour it had (the tertiary surface, as Messages' dark grey sits one step above the page); the light themes
       wear Messages grey, #e9e9eb, with near-black ink (the [data-theme="light"] block after this one). */
    --color-imessage-received: var(--color-bg-tertiary);
    --color-on-imessage-received: var(--color-text-primary);
    /* Ink for text/icons sitting ON a --brand-blue fill. The cyan is a LIGHT
       accent — white on it is ~2.4:1 (unreadable; user-reported 2026-06-12 on
       the console setup card); this deep navy is ~7.8:1 on both themes. Any
       solid brand-blue button/chip/tile pairs with THIS, never white. */
    --color-on-brand: #062633;
    /* The MIRROR of --color-on-brand: brand-blue used AS TEXT, on a normal
       surface. Same trap, opposite direction — the cyan is a light accent, so on
       a LIGHT surface it fails AA badly (#01A9DB on the warm-light body #ece9e3
       measures 2.25:1 against the 4.5:1 bar; found 2026-07-24 on the ▶ Ask MAX
       label, which a design directive requires to be blue).
       On DARK themes this is just --brand-blue (6.28:1 on navy — fine). The
       warm-light theme overrides it in themes.js to a darkened brand hue that
       still reads unmistakably blue but clears AA. Use this for brand-blue TEXT;
       keep --brand-blue itself for fills/borders/glyph accents, so darkening the
       ink never shifts a single background. */
    --brand-blue-ink: var(--brand-blue);
    /* The brand hue AS TEXT **on the app header band** (2026-07-26).
       Distinct from --brand-blue-ink (brand text on the PAGE surface) because
       the band and the page are different backgrounds with different contrast
       math — on navy the band is lighter than the page, on warm-light it is
       darker. The "MAX" wordmark in the Ask MAX pill is the consumer.
       🔴 A control that sits ON the band must read the BAND's ink tokens
       (-header-ink / -header-muted / this one). Using page tokens is why the
       lockup silently dropped to 4.17:1 when the navy band moved to #173C5E:
       the control never noticed its background had changed. Defaults to the
       page ink so a theme that doesn't override it renders as before. */
    --color-header-brand: var(--brand-blue-ink);
    /* MUTED ink on the PANE-HEADER band (2026-07-26). Sibling of
       --color-header-brand, and deliberately NOT --color-header-muted:
       on Warm Light that token dresses the TEAL console band and is white-ish
       (#e8f5fa), which lands at 1.21:1 on the cream pane band — the
       white-on-cream invisible-text bug, twice fixed already. Two bands, two
       ink pairs; only the names look interchangeable. */
    --color-header-quiet: var(--color-text-secondary);
    /* Same pattern for the SEMANTIC error red used AS TEXT (a "Delete"/"Discard"
       label, an inline error line). --color-error #ef4444 clears AA on the dark
       surfaces (4.5-5.2:1) but only reaches 3.11:1 on the warm-light body — and the
       hand-rolled #d9453d some apps used instead is 3.56:1, also failing. No SINGLE
       red clears 4.5:1 on both families: darkening helps light and hurts dark. So,
       exactly like --brand-blue-ink, this is theme-aware — default = --color-error
       (dark themes unchanged), warm-light overrides to a deeper red in themes.js.
       Use for error/danger TEXT; --color-error stays the fill/border/status-dot
       colour so changing the ink never restyles a badge background. */
    --color-error-ink: var(--color-error);

    /* SUCCESS + WARNING ink (2026-08-06). Fourth and fifth instances of the
       --brand-blue-ink pattern, added when the Factory eval-catalog chips were
       measured on warm-light: a chip that pairs `color: var(--color-success)`
       with `background: color-mix(--color-success 14%, transparent)` composites
       to a PASTEL fill on a light theme while the ink stays saturated —
       measured 1.99:1 for success and 1.72:1 for warning, against 5.29:1 and
       6.09:1 for the identical CSS on navy. The fill is theme-safe; the INK is
       what breaks, which is exactly the trap --brand-blue-ink already documents.

       Default = the semantic colour, so every dark theme is unchanged; the
       warm-light override in themes.js darkens them. Use for success/warning
       TEXT; --color-success / --color-warning stay the fill, border and
       status-dot colour, so changing the ink never restyles a badge. */
    --color-success-ink: var(--color-success);
    --color-warning-ink: var(--color-warning);

    /* BRAND-ORANGE ink (E-5608, 2026-08-30). SIXTH instance of the
       --brand-blue-ink pattern, and the same trap: --brand-orange is a fixed
       BRAND colour that deliberately does not theme-swap, which is right for a
       fill and wrong for small TEXT on a light band.

       MEASURED on the Inbox Channels section headers (10px/700 — NOT large
       text, so 4.5:1 applies): #FB4100 on the warm-light --color-bg-secondary
       (#E9E5DF) is 2.86:1. The identical CSS on navy is 4.52:1, which is why it
       looked fine to anyone testing the default dark theme.

       Default = --brand-orange, so every dark theme is byte-identical; the
       warm-light override in themes.js darkens it to #B02C00 (5.22:1 measured
       on the same band, and still unmistakably the brand orange). Use for
       orange TEXT; --brand-orange stays the fill, border and glyph colour, so
       changing the ink never restyles a badge. */
    --brand-orange-ink: var(--brand-orange);

    /* SECONDARY ink on the DEEP LIST-RAIL band (2026-08-02). Third instance of
       the same pattern as --brand-blue-ink / --color-error-ink / --color-header-quiet:
       a colour that is fine on the page fails as TEXT on one specific band.

       MEASURED live across every rail consumer (skill-list, reports; cust-list
       and workspace-list render no rows for this user):
         navy   ink rgb(107,163,192) on #000000 → 7.63:1  ✅
         light  ink #5a6270          on #d3cec8 → 3.93:1  ❌ (AA needs 4.5)

       The rail band `--color-shell-bg-deep` is the DARKEST rung on navy (#000)
       and a MID warm grey on light (#d3cec8), so the same secondary ink is
       high-contrast on one family and under-AA on the other — darkening helps
       light and would hurt nothing on navy only because navy overrides it away.

       ⛔ DO NOT fix this by darkening --color-text-secondary. That token has
       **3,348 references across 356 files**; changing it to rescue one band is a
       platform-wide typography change, and the page surfaces it serves
       (bg-primary 5.74:1, elevated 6.15:1) already pass. Two bands, two ink
       pairs — the same conclusion --color-header-quiet reached.

       Default = --color-text-secondary, so every dark theme is byte-identical;
       warm-light overrides it in themes.js to #4e5560 (4.81:1 on the rail, and
       better on every other surface it can land on). */
    --color-rail-ink: var(--color-text-secondary);

    /* Brand blue opacity variants — themed via themes.js overrides */
    --brand-blue-05: rgba(1, 169, 219, 0.05);
    --brand-blue-08: rgba(1, 169, 219, 0.08);
    --brand-blue-10: rgba(1, 169, 219, 0.10);
    --brand-blue-15: rgba(1, 169, 219, 0.15);
    --brand-blue-20: rgba(1, 169, 219, 0.20);
    --brand-blue-25: rgba(1, 169, 219, 0.25);
    --brand-blue-30: rgba(1, 169, 219, 0.30);
    --brand-blue-40: rgba(1, 169, 219, 0.40);
    --brand-blue-50: rgba(1, 169, 219, 0.50);
    --brand-blue-60: rgba(1, 169, 219, 0.60);
    --brand-blue-70: rgba(1, 169, 219, 0.70);

    /* ────────────────────────────────────────────────────────────────────
       Component Colors
       ──────────────────────────────────────────────────────────────────── */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;
    /* A person's initials circle: a soft tint with the initials in its ink (2026-11-01, user: "The colors of those
       initials are not great" — a hash-picked hue at 40%/46% turned two people the same dull green). Five tints,
       from the New Workspace design; which one a person gets is /shared/person-tint.js's answer, stable per user.
       Draw one with [data-person-tint="N"] (below) or var(--person-tint-N-bg / -fg). */
    --person-tint-0-fg: #9d5c1e;
    --person-tint-1-fg: #2771ad;
    --person-tint-2-fg: #28775c;
    --person-tint-3-fg: #5b6b7d;   /* slate, not pink (2026-11-02, Bill: "please avoid pink") */
    --person-tint-4-fg: #6b5fb5;
    --person-tint-0-bg: color-mix(in srgb, var(--person-tint-0-fg) 16%, var(--color-bg-elevated, #fff));
    --person-tint-1-bg: color-mix(in srgb, var(--person-tint-1-fg) 15%, var(--color-bg-elevated, #fff));
    --person-tint-2-bg: color-mix(in srgb, var(--person-tint-2-fg) 15%, var(--color-bg-elevated, #fff));
    --person-tint-3-bg: color-mix(in srgb, var(--person-tint-3-fg) 14%, var(--color-bg-elevated, #fff));
    --person-tint-4-bg: color-mix(in srgb, var(--person-tint-4-fg) 15%, var(--color-bg-elevated, #fff));
    /* ⛔ `--color-danger*` IS THE SECOND SPELLING OF THE ERROR FAMILY, AND IT WAS
       NEVER DEFINED (E-12013, 2026-09-18). 55 references across 26 files ask for
       it; nothing anywhere declared it. Every one of them therefore fell through
       to its own inline fallback, and those had drifted to ELEVEN different reds
       — #e5484d (25x, in two casings), #f85149 (5x), #c04040 (4x), #f87171,
       #e5646d, #e05252, #d9534f, #c0392b, #d9453d, #d33, #ef5350 — plus five
       sites falling back to a non-red TOKEN. A token that is only ever a
       fallback is not a token; it is eleven hardcoded colours wearing one name.

       ALIASED, NOT REDEFINED. These point at the error family rather than
       carrying their own hex, so there is still exactly ONE red decision in the
       system (Art. V) and a theme override reaches both spellings. Declaring a
       twelfth literal here would have been the bug with a nicer address.

       ⛔ THE BARE TOKEN ALIASES `--color-error-ink`, NOT `--color-error`, AND
       THAT IS THE WHOLE POINT. (Corrected 2026-09-21, clm-review on PR #1108 —
       the first version aliased it to `--color-error`.) Read the note at
       --color-error-ink above: `--color-error` #ef4444 reaches only 3.11:1 on
       the warm-light body, and `-ink` exists precisely so error TEXT gets the
       deeper warm-light red (#ae3731 in themes.js) while every dark theme stays
       byte-identical. `--color-danger` is overwhelmingly a TEXT token in this
       tree — .wsn-error, .msf-err, .b3-bd-error, .sa-status[data-mode=error] —
       so aliasing it to the fill colour would have shipped the exact
       "obvious fix" the -ink work already measured and rejected: it makes light
       WORSE (3.56:1 → 3.11:1 at the sites that hand-rolled #d9453d).

       The THREE FILL tokens below stay on `--color-error`, for the same reason
       in reverse: -bg/-10/-25 are backgrounds and borders, and -ink is for text
       only — changing the ink must never restyle a badge.

       WHY NOT SWEEP THE 55 CALL SITES onto the explicit tokens instead, which is
       the tidier end state: that choice is a per-site judgement and 55 of them
       is a separate, incrementally-verifiable job; conflating it with the
       one-line fix that ends the eleven-reds drift would bury the fix. The gate
       beside this file blocks NEW `--color-danger` references so that sweep can
       proceed at its own pace without the spelling spreading further. */
    --color-danger:     var(--color-error-ink);
    --color-danger-bg:  var(--color-error-soft);
    --color-danger-10:  color-mix(in srgb, var(--color-error) 10%, transparent);
    --color-danger-25:  color-mix(in srgb, var(--color-error) 25%, transparent);
    /* model/LLM-error family — the purple used by the error card's model_error
       severity. Tokenized (was a hardcoded #a855f7 in errors-misc.css) so it's
       one edit + theme-overridable, like the other component colors. */
    --color-model: #a855f7;
    /* TENANT / org-default provenance tier — the muted violet that marks a value
       inherited from the tenant's org default rather than authored by this user.
       Tokenized 2026-09-02 (/clm-review ux must-fix): it was a hardcoded #8b5cf6
       in src/workspace/shared/data-slots.css carrying the comment "no platform
       token", which is a request for this line, not a licence to hardcode. It is
       DELIBERATELY its own token rather than an alias of --color-model: that
       purple means "the model errored", and reusing it would make a benign
       provenance badge share a colour with a failure state.
       Sits alongside the other component colours so a theme can override it. */
    --color-tenant: #8b5cf6;

    /* ────────────────────────────────────────────────────────────────────
       Status surfaces — the design-system home for agent status/audit cards
       (error / recovered / diagnosis / info notices). Before this, every
       status card in errors-misc.css hand-rolled its own tinted background +
       border from hardcoded rgba(), so they looked like 4 unrelated boxes and
       ignored the theme. These semantic tokens are the ONE source: a status
       card sets `--status-accent` to a base color, and the surface/border/tint
       derive from it via color-mix — fully theme-aware, one place to retune.

       Usage:
         .my-card        { --status-accent: var(--color-warning);
                           background: var(--status-surface);
                           border: 1px solid var(--status-border);
                           border-left: 2.5px solid var(--status-accent); }
         .my-card .pill  { color: var(--status-accent);
                           background: var(--status-tint);
                           border: 1px solid var(--status-border-strong); }
       ──────────────────────────────────────────────────────────────────── */
    --status-accent: var(--color-text-tertiary);  /* neutral default; cards override */
    --status-surface: var(--color-bg-elevated);    /* calm base — NOT a full tint wash */
    --status-tint: color-mix(in srgb, var(--status-accent) 12%, transparent);
    --status-tint-soft: color-mix(in srgb, var(--status-accent) 8%, transparent);
    --status-border: color-mix(in srgb, var(--status-accent) 22%, var(--color-border-light));
    --status-border-strong: color-mix(in srgb, var(--status-accent) 34%, transparent);

    /* ────────────────────────────────────────────────────────────────────
       Input Colors — prefer --vscode-input-*, fall back to core tokens.
       Not every theme sets input-foreground/input-border, so cascade to
       --color-text-primary / --color-border-normal so text stays readable.
       ⛔ THE FIELD BACKGROUND HAS ONE OWNER: this line (E-48058). A field is
       the theme's own ELEVATED surface rung, in every theme, never a literal.
       It used to read --vscode-input-background first, and navy's shim carried
       #081e30, so every dark-theme field was a navy block on a grey panel
       (Bill, Nov 18). The --vscode-input-background shim now FOLLOWS this token
       (vscode-dark-theme.css); a theme whose elevated rung is its canvas
       (Customer Mode) names another of its own rungs by var() reference.
       Gate: src/console/__tests__/input-background-token-has-one-owner-no-literal.test.mjs
       ──────────────────────────────────────────────────────────────────── */
    --color-input-bg: var(--color-bg-elevated);
    --color-input-border: var(--vscode-input-border, var(--color-border-normal));
    --color-input-text: var(--vscode-input-foreground, var(--color-text-primary));

    /* ────────────────────────────────────────────────────────────────────
       Tint / Lift — theme-aware contrast shades.
       Tint mixes the ink color INTO the body surface (darkens on light
       themes, lightens on dark themes — always pushes toward text).
       Lift mixes the elevated/paper surface INTO the body (lightens on
       light themes, lightens on dark themes — always pushes toward white).
       Usage:   background: var(--tint);     background: var(--lift-soft);
       ──────────────────────────────────────────────────────────────────── */
    --tint-soft:    color-mix(in srgb, var(--color-text-primary)  5%, var(--color-bg-primary));
    --tint:         color-mix(in srgb, var(--color-text-primary)  8%, var(--color-bg-primary));
    --tint-strong:  color-mix(in srgb, var(--color-text-primary) 14%, var(--color-bg-primary));

    --lift-soft:    color-mix(in srgb, var(--color-bg-elevated)  40%, var(--color-bg-primary));
    --lift:         color-mix(in srgb, var(--color-bg-elevated)  65%, var(--color-bg-primary));
    --lift-strong:  color-mix(in srgb, var(--color-bg-elevated)  90%, var(--color-bg-primary));

    /* ────────────────────────────────────────────────────────────────────
       QUIET CHROME CONTROLS (2026-07-26, user directive)

       "I don't want any of these colored buttons. Any button that you think
        needs coloring, just put some very subtle shading on it… I want subtle
        things on that title and nothing that's crazy that jumps out."

       A control that lives in an APP HEADER / TOOLBAR is chrome, not a call to
       action. It must never be a saturated brand fill — a solid brand-blue
       "Compose", a purple "Catch me up" and a blue "Today" pill all shouting at
       once turn the header into a carnival and destroy the hierarchy the
       surface ladder just established.

       The vocabulary, in ascending loudness — pick the QUIETEST that works:
         --ctl-quiet         resting chrome button. A whisper of tint, no border.
         --ctl-quiet-hover   its hover. Still subtle.
         --ctl-quiet-active  SELECTED/ON state (the "Today" pill). Carries a
                             faint BRAND tint so the active item is findable,
                             but nowhere near a fill; pair with a normal-weight
                             brand-ink label, never white-on-brand.
         --ctl-quiet-border  the hairline that gives a resting control its edge.

       🔴 The ONE carve-out: a genuinely destructive confirm (delete/discard)
       may still take a saturated fill — that is a warning, not decoration.
       Everything else in chrome uses these.
       ──────────────────────────────────────────────────────────────────── */
    --ctl-quiet:        color-mix(in srgb, var(--color-text-primary) 6%, transparent);
    --ctl-quiet-hover:  color-mix(in srgb, var(--color-text-primary) 11%, transparent);
    --ctl-quiet-active: color-mix(in srgb, var(--brand-blue) 14%, transparent);
    --ctl-quiet-border: color-mix(in srgb, var(--color-text-primary) 14%, transparent);

    /* ────────────────────────────────────────────────────────────────────
       PANE HEADER — Control · MAX Agent · Preview (2026-07-26)

       These three bars are the workspace's internal pane headers. They are
       the SAME rung as an app header / workspace pane title bar: `sunken`.

       🔴 They must NOT be brand-tinted. Every consumer defaulted to
       `color-mix(brand-blue 6%, --color-bg-elevated)`, which on a light theme
       mixes into PURE WHITE and yields #f0fafd — a cool BLUE-white. Against
       the warm ladder that reads as a stray highlight, and the user reported
       it verbatim: "the header on the workspace became light blue… it's a
       mistake". (The rule predates the ladder; the ladder is what made the
       existing blue cast newly obvious against warm neighbours.)

       Defining the token HERE means the three bars stop resolving their own
       per-call-site brand-mix default — one owner, one value, warm in light,
       navy in dark. The border keeps a hint of brand so the bar still reads
       as a designed header rather than a flat block.
       ──────────────────────────────────────────────────────────────────── */
    /* Reads --color-header-bg FIRST so a theme paints the pane bar and the two
       app-header implementations in ONE edit (2026-07-26). --color-bg-sunken
       stays as the degrade path for a theme that sets neither. */
    --color-pane-header-bg: var(--color-header-bg, var(--color-bg-sunken));
    --color-pane-header-border-top: var(--color-border-normal);

    /* ────────────────────────────────────────────────────────────────────
       🔴 COLUMN HEADS ARE SHADED, NOT ACCENTED — a SECOND role, split out of
       --color-pane-header-bg (2026-07-26, user: "you changed the workspace
       column headers and subheaders blue, these need to be shaded and 100%
       consistent").

       TWO different jobs were sharing one token, and the split only became
       visible once the top header went BLUE:

         --color-pane-header-bg    the TOP header of an app or a workspace
                                   pane — `.mah-root`, `.framework-header`,
                                   `.nshell-panebar`. This one carries the
                                   theme's ACCENT (light blue on light).
         --color-col-head-bg       the heads INSIDE a workspace — Control ·
                                   MAX Agent · Preview — and their submenu
                                   row. These are interior structure, not the
                                   pane's identity, so they stay SHADED: a
                                   neutral rung one step off the canvas.

       Painting the interior heads with the accent turned the whole workspace
       blue (the user's screenshot). An accent names ONE thing; repeat it on
       every interior bar and it stops meaning anything.

       Default = --color-bg-secondary, the `raised` rung: #e9e5df on light
       (1.17:1 off the canvas), #173C5E on dark. Both are real ladder members,
       so this cannot drift off-ladder the way the old brand-mix did.
       ──────────────────────────────────────────────────────────────────── */
    --color-col-head-bg: var(--color-bg-secondary);

    /* 🔴 THE SUBMENU ROW IS DARKER THAN ITS HEAD (2026-07-26, user: "sub headers
       in workspace columns need to be different. make them 2 shades darker and
       consistent. preview is not the same as the others!!!").
       The row BELOW each column head — Control's Activity/Sources/Skills tabs,
       the Agent's session pills, Preview's file chips — is its own zone and
       must read as one, a measured step away from --color-col-head-bg:
         light  head #e0e5e9 → sub #eeebe6   (1.07:1 — sub is LIGHTER)
         dark   head #0E2A44 → sub #071A2B   (1.20:1 — sub is DARKER)
       ⚠️ THE DIRECTION DIFFERS BY THEME, and that is deliberate. Dark's ladder
       ascends, so its sub sits BELOW the head. Light's body is WHITE, so its
       strip steps LIGHTER as it descends toward that body — head → sub → white.
       Reversing either to "match" the other re-opens the bug each was fixing.
       Light's values are no longer plain ladder rungs: they are levels 3 and 4
       of the four-header contract (2026-07-30, option B3) and are asserted by
       surface-ladder.test.js "the four header levels are four different
       colours". Change them there, with the gate, not here.
       ⛔ THREE surfaces render this row and each had invented its own value —
       .ws-subpanel-selector, the injected .ws-session-tab-strip, and
       .mp-historybar (which derived `color-mix(#000 10%, bg-elevated)` and so
       mixed into WHITE on light: the "preview is not the same as the others"
       the user is pointing at). A new submenu surface MUST read this token.
       🔴 THE DEFAULT MUST BE THEME-NEUTRAL, NOT A LIGHT-THEME HEX.
       This file is the theme-agnostic base: every --color-* here resolves
       through a token, never a literal, so a theme that sets nothing still
       renders coherently (see the header note — "do NOT add fallback values").
       It briefly held `#d3cec8`, light's value, which would have handed a
       future third theme LIGHT's greige on a dark canvas.
       `--color-bg-sunken` is the correct neutral default: on light it is the
       warm rung just under the head; on dark it is the deep navy rung. It moves
       the right direction in BOTH because it is defined per theme. navy and
       light each still set --color-col-sub-bg explicitly (the exact two-shades
       relationship is a design choice, not something a generic rung guarantees)
       — this is the safety net beneath that, not a replacement for it. */
    --color-col-sub-bg: var(--color-bg-sunken);

    /* 🔴 THE COLUMN SEPARATOR IS OPAQUE, NOT AN ALPHA (2026-07-26, user: "on the
       light we need some different shading of the vertical column separators so
       it is visible across every section right now its the same color as our
       headers so you lose any separation which we need").
       The divider runs VERTICALLY through three different surfaces — the column
       head, the submenu row, and the canvas. It was --color-border-strong,
       `rgba(60,40,20,.22)`, and an ALPHA composites against whatever is behind
       it, so one line rendered as three different colours:
         over head   #d3cec8 → #b2a9a0  (L 40.4)  ← nearly the head itself
         over sub    #e9e5df → #c3bbb2  (L 50.4)
         over canvas #f8f7f4 → #cfc9c3  (L 59.0)
       Against the head it all but vanished — exactly where the boundary matters
       most. A line that changes colour per band is not a line.
       ONE opaque value instead, chosen to clear every surface it crosses:
       1.68:1 on the head, 2.10:1 on the submenu, 2.46:1 on the canvas — present
       throughout without hardening into a black rule.
       ⛔ Never point a cross-surface divider at an alpha border token.
       🔴 The DEFAULT is theme-neutral (it briefly held light's `#a89e93`, which
       a dark third theme would have inherited as a pale line on navy).
       `--color-bg-tertiary` is the right neutral fallback: it is OPAQUE (the
       whole point here), every theme defines it, and it sits far enough off the
       column surfaces to read as a line in either direction. navy and light
       each still set --color-col-separator explicitly, with a value tuned to
       the three specific surfaces it crosses — this default is the safety net
       beneath that, not a replacement for it. */
    --color-col-separator: var(--color-bg-tertiary);

    /* 🔴 THE LIT PLACEMENT CELL in the split picker (2026-07-26, user: "fix this
       washed out look. boxes are too dim or something").
       This diagram sits on the MENU panel (--color-header-bg), not on the pane
       canvas, so a surface token chosen for canvas contrast reads far too close
       here: --color-bg-overlay-solid measured 1.80:1 against the menu's own
       #1c2835. Its own token, tuned per theme against the MENU, lands ~2.5:1 —
       unmistakably the one filled shape without reclaiming the brand accent
       (which is what this picker was moved OFF earlier the same day).
       Each theme sets it explicitly; the default below is theme-neutral. */
    --color-placement-lit: var(--color-bg-overlay-solid);

    /* 🔴 THE ONE PANE-HEADER HEIGHT (2026-07-26, user: "make sure they are
       exactly the same height").
       Consumed by `.nshell-panebar` (console workspace pane title bar),
       `.mah-root` (MAX.appHeader) and `.framework-header` (legacy app header) —
       the three implementations of the bar that names a pane. They were 40 /
       46 / intrinsic, so a workspace pane beside an app pane stepped ~6px at
       the divider. 44 is the midpoint of the two fixed values, so neither
       surface shifts more than 4px.
       ⛔ A new pane/app title bar MUST read this token, not a literal — see
       __tests__/pane-header-one-owner.test.js. */
    --color-pane-header-surface: var(--color-pane-header-bg);
    --shell-mark-filter: none;
    --brand-separate-wordmark: none;
    --brand-logo-height: 1.3em;
    --brand-wordmark-size: 16px;
    --brand-header-offset: 16px;
    --rail-glyph-scale: 1;
    --rail-label-scale: 1;
    --rail-grid-columns: 1fr;
    --rail-primary-display: flex;
    --rail-primary-gap: 0px;
    --rail-primary-direction: row;
    --rail-primary-height: auto;
    --rail-primary-bg: transparent;
    --rail-primary-wide-span: auto;
    /* Checklist presentation; Customer Mode supplies the reference treatment. */
    --checklist-surface-image: none;
    --checklist-row-image: none;
    --checklist-row-radius: 0px;
    --checklist-row-min-height: 0px;
    --checklist-row-gap: 0px;
    --checklist-panel-radius: 0px;
    --checklist-panel-padding: 0px;
    --checklist-complete-ink: var(--color-success);
    --checklist-row-pad-x: 0px;
    --checklist-row-divider: var(--color-border-light);
    --task-band-margin: 0;
    --task-band-header-height: 34px;
    --task-band-body-padding: 2px 14px 8px;
    --task-band-body-bg: color-mix(in srgb, var(--color-text-primary) 2%, var(--color-bg-elevated));
    --task-band-divider: color-mix(in srgb, var(--color-text-primary) 8%, transparent);
    --task-band-row-padding: 4px 4px;
    --task-band-progress-ink: color-mix(in srgb, var(--brand-blue) 22%, transparent);

    --workspace-frame-inset: 0px;
    --wsc-height: 34px;
    --wsc-radius: 9px 9px 0 0;
    --wsc-lift: -1px;
    --wsc-border: transparent;
    --wsc-border-bottom: none;
    --wsc-shadow: none;
    --wsc-notch-h: 3px;
    --shell-backdrop: linear-gradient(to bottom, var(--color-tab-bar-bg) 28px, var(--color-tab-bar-bg-bottom) 120px);
    --app-frame-margin: 0;
    --app-frame-radius: 0;
    --app-frame-shadow: none;
    --list-row-h: 22px;
    --list-row-radius: 0;
    --list-row-tool-rest: 1;
    --turn-actions-rest: 1;
    --composer-radius: 14px;
    --composer-shadow: 0 6px 20px rgba(0,0,0,.24);
    --workspace-surface-pad: 0;
    --workspace-group-radius: 0;
    --workspace-group-shadow: none;
    --rail-max-display: flex;
    --workspace-strip-h: 34px;
    --workspace-strip-pad: 0 4px 0 6px;
    --workspace-tab-size: 1em;
    --workspace-chat-bg: var(--workspace-pane-bg);
    --workspace-group-bg: var(--color-bg-secondary);
    --caps-case: uppercase;
    --emphasis-weight: 600;
    --flag-bar-w: 3px;
    --workspace-chat-group-bg: var(--workspace-group-bg);
    --composer-wrap: nowrap;
    --composer-field-order: 0;
    --composer-field-basis: 0%;
    --composer-field-min-h: 20px;
    --composer-send-push: -4px;
    --workspace-pane-bg: var(--color-bg-primary);
    --workspace-frame-radius: 0px;
    --workspace-content-padding: 16px 20px 24px;
    --workspace-card-radius: 6px;
    --workspace-section-tracking: 0.04em;
    --workspace-card-padding: 12px 14px;
    --workspace-card-gap: 12px;
    --workspace-card-min-width: 240px;
    --workspace-card-align: stretch;
    --workspace-section-title-size: 11px;
    --workspace-section-title-weight: 600;
    --workspace-section-title-case: uppercase;
    --workspace-chrome-weight: 600;
    --workspace-accordion-bg: color-mix(in srgb, var(--color-text-primary) 5%, var(--color-bg-elevated));
    --workspace-accordion-edge: var(--brand-blue);
    --workspace-accordion-rule: var(--color-border-strong);
    --workspace-accordion-divider: color-mix(in srgb, var(--color-text-primary) 35%, transparent);
    --workspace-header-direction: row;
    --workspace-header-align: center;
    --workspace-header-justify: flex-start;
    --chrome-line-color: color-mix(in srgb, var(--ns-accent, var(--brand-blue)) 55%, transparent);
    --workspace-header-height: var(--fs-col-head-h, 36px);
    --workspace-header-padding: 0 12px;
    --workspace-header-bg: var(--fs-col-head-bg, var(--color-bg-elevated));
    --workspace-title-size: 13px;
    --workspace-tab-padding: 4px 10px;
    --workspace-tab-radius: 4px;
    --color-column-active-line: var(--color-header-accent, var(--brand-blue));
    --workspace-tabs-margin: 0 0 0 24px;
    --chrome-line-width: 2px;
    --chrome-active-cap: 2px;
    --pane-header-h: 44px;
    --pane-title-size: 15px;
    --pane-title-weight: 600;
    --pane-header-padding: 14px;
    --nav-row-padding: 5px 5px;
    --nav-row-radius: 4px;
    --settings-nav-padding: 3px 16px;
    --settings-group-bg: color-mix(in srgb, var(--color-text-primary) 14%, var(--color-bg-secondary));
    --settings-group-transform: uppercase;
    --settings-section-size: 16px;
    --settings-card-gap: 0px;
    --settings-nav-active: color-mix(in srgb, var(--brand-blue) 8%, transparent);


    /* ────────────────────────────────────────────────────────────────────
       Scrollbar — mapped from --vscode-* (always defined)
       ──────────────────────────────────────────────────────────────────── */
    --color-scrollbar: var(--vscode-scrollbarSlider-background);
    --color-scrollbar-hover: var(--vscode-scrollbarSlider-hoverBackground);

    /* ────────────────────────────────────────────────────────────────────
       Elevated / Selection / Bright — used across apps for hover states,
       active selections, and high-contrast text
       ──────────────────────────────────────────────────────────────────── */
    --color-bg-elevated: var(--vscode-list-hoverBackground, var(--color-bg-overlay, rgba(255,255,255,0.04)));
    --color-bg-selection: var(--vscode-list-activeSelectionBackground);
    /* Bright text — highest-contrast text on the current surface. Per-theme
       overrides set this to a theme-appropriate value (pure black for light
       themes, pure white for dark). The fallback uses --color-text-primary
       so a theme that forgets to set --color-text-bright degrades safely
       (never ends up near-invisible on a light bg). */
    --color-text-bright: var(--color-text-primary);
    --button-bg: var(--vscode-button-background, #1470a0);
    --icon-color: var(--vscode-icon-foreground, #5090b0);

    /* ────────────────────────────────────────────────────────────────────
       Typography — mapped from --vscode-* (always defined)
       ──────────────────────────────────────────────────────────────────── */
    --font-family: var(--vscode-font-family);
    /* Explicit, user-friendly mono stack (2026-06-07, user: "pick a more
       user-friendly code font like Menlo"). Was var(--vscode-editor-font-family)
       — a legacy VS Code overhang that resolved to whatever the editor used.
       Menlo/SF Mono first (macOS-native, soft, readable), then cross-platform
       fallbacks. Matches the chat --font-mono stack in chat-skins.css. */
    --font-family-mono: 'Menlo', 'SF Mono', 'Monaco', 'JetBrains Mono', 'Consolas', ui-monospace, monospace;

    --font-size-xs: 9px;
    --font-size-sm: 10px;
    --font-size-base: 11px;
    --font-size-md: 12px;
    --font-size-lg: 14px;
    --font-size-xl: 16px;

    /* Chat area font size — configurable via Settings > Appearance.
       Intentionally NOT given a default here: leaving --chat-font-size
       unset lets each chat-skin's per-skin body/user fallback hold the
       default look, while a user pick (set on documentElement by
       setChatFontSize) overrides every consumer. A literal default here
       would clamp the skin sizes to 13px and break the picker. */
    --font-size-2xl: 20px;

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;

    /* ────────────────────────────────────────────────────────────────────
       Spacing Scale
       ──────────────────────────────────────────────────────────────────── */
    --spacing-xs: 2px;
    --spacing-sm: 4px;
    --spacing-md: 8px;
    --spacing-lg: 12px;
    --spacing-xl: 16px;
    --spacing-2xl: 24px;
    --spacing-3xl: 32px;

    /* ────────────────────────────────────────────────────────────────────
       Border Radius
       ──────────────────────────────────────────────────────────────────── */
    --radius-none: 0;
    /* --radius-xs was referenced at 18 sites in 4 files (new-item-modal.css,
       factory list/dashboard/views-secondary.css) and defined NOWHERE, so every
       one of those `border-radius: var(--radius-xs)` declarations was invalid
       and computed to 0 — square corners on chips and pills that were authored
       round. Found 2026-10-13 (E-26056) by widening design-tokens-resolve
       beyond --color-*. 1px is the step below sm the call sites plainly meant;
       they rendered 0 until now, so this is the first time they get any. */
    --radius-xs: 1px;
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 6px;
    --radius-xl: 8px;

    /* ────────────────────────────────────────────────────────────────────
       Shadows - Subtle
       ──────────────────────────────────────────────────────────────────── */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.12);
    /* Modal-grade elevation for FLOATING surfaces (dialogs, floating panels,
       overlays) that must read as lifted off the app, not a flat card. sm/md/lg
       are content-card subtle (≤8px); a floating window needs a deep layered
       drop. Shared so the new-chat (Ask MAX) dialog, new-item-modal, and any
       future floating panel stop each hand-rolling their own rgba shadow and
       drifting apart. The warm-dark rgba reads on the light themes; dark themes
       layer their own rim-light + brand glow on top (see new-chat-dialog.css).
       (2026-06-19, clm-design reuse pass.) */
    --shadow-modal: 0 24px 64px -16px rgba(20, 15, 10, 0.45), 0 2px 8px rgba(20, 15, 10, 0.18);

    /* ────────────────────────────────────────────────────────────────────
       Transitions
       ──────────────────────────────────────────────────────────────────── */
    --transition-fast: 0.1s ease;
    --transition-base: 0.15s ease;
    --transition-slow: 0.2s ease;

    /* ────────────────────────────────────────────────────────────────────
       Z-Index Scale
       ──────────────────────────────────────────────────────────────────── */
    --z-base: 1;
    --z-dropdown: 50;
    --z-fixed: 100;
    --z-modal: 200;
    /* FLOATING-WINDOW tier — for panels that float ABOVE every body-level
       popover (the slash command palette is fixed at z 600, context menus,
       session-tools menus). The Ask MAX dialog lives here so its slash palette
       doesn't render behind it ("slash does nothing"). `-above` is the dialog's
       OWN palette/menu override, one notch over the window so they clear it.
       Named so a future floating surface adopts the tier instead of inventing
       another 10000+ magic number. (2026-06-19, clm-design reuse pass.) */
    --z-floating-window: 10060;
    --z-floating-dock: 10061;
    --z-floating-above: 10070;
}

/* E-37949 — the light themes' received iMessage bubble: Messages grey and its ink (every light theme sets
   data-theme="light" on <html>, themes.js applyTheme; none of them names this token, so nothing outranks it). */
:root[data-theme="light"] {
    --color-imessage-received: #e9e9eb;
    --color-on-imessage-received: #1c1c1e;
}

/* A person's initials circle in their tint (the --person-tint-N tokens above; N from /shared/person-tint.js). */
[data-person-tint="0"] { background-color: var(--person-tint-0-bg); color: var(--person-tint-0-fg); }
[data-person-tint="1"] { background-color: var(--person-tint-1-bg); color: var(--person-tint-1-fg); }
[data-person-tint="2"] { background-color: var(--person-tint-2-bg); color: var(--person-tint-2-fg); }
[data-person-tint="3"] { background-color: var(--person-tint-3-bg); color: var(--person-tint-3-fg); }
[data-person-tint="4"] { background-color: var(--person-tint-4-bg); color: var(--person-tint-4-fg); }

/* ============================================================================
   GLOBAL STYLES
   =========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ⛔ `[hidden]` IS THE ONE OWNER OF "IS THIS ELEMENT VISIBLE" (E-5422, 2026-08-17).
   ────────────────────────────────────────────────────────────────────────────
   `[hidden]{display:none}` exists ONLY in the user-agent stylesheet, and EVERY
   author rule beats the UA origin regardless of specificity. So `button{display:
   inline-flex}` below — and `.foo{display:flex}` in any app stylesheet — silently
   won, and `el.hidden = true` set the attribute while changing NOTHING on screen.

   That is the repo's worst failure shape: the code says hide, the DOM assertion
   agrees, and the pixels disagree. It shipped a red **Stop** button into a
   committed screenshot of a FINISHED test run, and reviewers had already flagged
   evidence on that basis.

   🔴 Art. V — this had NO owner, so 137 rules across ~40 stylesheets re-answered
   it locally (`.tests-run-detail[hidden]{display:none}`, `.radar-pane[hidden]…`),
   several with comments calling the hand-patch "repo law". It was not law; it was
   a missing global. Every one of those 137 sets `display:none` — verified, none
   ever SHOWS a `[hidden]` element — so this rule subsumes them all.

   WHY `!important` and not a bare `[hidden]{display:none}`: a bare rule is
   specificity (0,1,0) and would still LOSE to `.some-class{display:flex}` (0,1,0,
   later in source order) — which is precisely why the 137 patches were needed in
   the first place. `!important` is the only form that actually retires the class.
   Same idiom Bootstrap 5 ships. No `hidden="until-found"` usage exists here, and
   nothing reveals an element via inline `style.display` while leaving `hidden` set.

   🔴 ONE CARVE-OUT, AND IT IS REAL: a SHADOW ROOT does not inherit this. The
   `<max-preview>` component attaches a shadow root and uses `adoptedStyleSheets`,
   so `max-preview/styles.css` still needs its own `[hidden]` rules — those are a
   legitimate second owner (a different document tree), not the duplication this
   fix removes. Any future component that attaches a shadow root owes itself the
   same rule. Do not read "app-wide" below as covering shadow DOM.

   Gate: `src/audit/rules/hidden-attribute-owner.js` asserts THIS RULE EXISTS and
   is not weakened (deleted / `!important` dropped / `display` changed). It does
   NOT flag the 137 surviving local patches — they are harmless no-ops now, and a
   137-finding wall is noise that teaches people to ignore the audit. Deleting
   them is tracked separately. Do not delete the rule below because it "looks
   redundant" next to them: they are redundant BECAUSE of it. */
[hidden] {
    display: none !important;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================================
   TYPOGRAPHY
   =========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
}

h1 { font-size: var(--font-size-2xl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }
h4 { font-size: var(--font-size-md); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

p {
    margin: 0;
    color: var(--color-text-secondary);
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-accent-light);
    text-decoration: underline;
}

code,
pre {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
}

code {
    /* NO background box (2026-06-07, user: "I don't like the highlighting").
       The old hardcoded rgba(255,255,255,0.04) was tuned for the dark navy theme;
       over a LIGHT theme it rendered as a muddy gray chip — exactly the cluttered
       look reported on a dense token list. Drop the box entirely: the mono face
       (Menlo) + brand-blue tint carry the "this is a token/identifier" signal
       without any chip. Cleaner on every theme; reads like inline prose. */
    background: transparent;
    padding: 0;
    border-radius: 0;
    color: var(--brand-blue, #0286ad);
    font-size: 0.9em;
}

/* ============================================================================
   BUTTONS
   =========================================================================== */

/* ⚠️ The `display: inline-flex` below is why `[hidden]` needs `!important` — see the
   `[hidden]` owner above. Do NOT add a `button[hidden]` rule here: E-5381 did, E-5422's
   app-wide owner subsumed it, and the merge deleted it (one owner, not two). */

button {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    border: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    /* ⛔ NO justify-content DEFAULT (E-5609, 2026-08-27).
       This rule used to set `justify-content: center`. On a shrink-to-fit
       button that is INERT — there is no free space to distribute. It bites only
       when the button is WIDER than its content, and then it centres the
       icon+label pair inside the row, so rows with different-width icons start
       at different x positions and a vertical list stops lining up (measured:
       32px stagger in the inbox +Compose menu).
       Every <button> is a flex container BY INHERITANCE from this very rule, so
       a row did not have to declare display:flex to be hit — which is why the
       class was far wider than the one menu it was reported in.
       Centring is now OPT-IN: a stretched button that wants it says so. */
    white-space: nowrap;
}

/* Primary button
   🔴 INK ON AN ACCENT FILL IS --color-on-brand, NEVER white (2026-07-27).
   The accent is a LIGHT cyan, so white-on-accent measures 2.73:1 — under
   even the 3.0 AA-large bar, and WORSE than the 3.66:1 of the purple it
   replaced. --color-on-brand (#062633) on the same fill is 5.78:1.
   Caught by a contrast sweep of the accent change, not by eye: the button
   still "looked fine", just soft. Same rule as --brand-blue fills
   elsewhere; see the --color-on-brand note above.
   Hover uses -dark (#0286ad, 4.19:1 with white) but keeps the same ink so
   the label does not shift colour mid-interaction. */
.btn-primary {
    background: var(--color-accent);
    color: var(--color-on-brand);
    padding: var(--spacing-md) var(--spacing-lg);
    border: 1px solid transparent;
}

.btn-primary:hover {
    background: color-mix(in srgb, var(--color-accent) 85%, #fff);
    color: var(--color-on-brand);
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Secondary button */
.btn-secondary {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    padding: var(--spacing-md) var(--spacing-lg);
    border: 1px solid var(--color-border-normal);
}

.btn-secondary:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-border-strong);
}

/* Ghost button — THE QUIET, BORDERLESS BUTTON, one definition for every app (E-61752).
   Bill, 6:22am ET Dec 1: "remove the borders and make more quiet. make sure
   borderless quiet buttons are registered to our design system globally".
   Transparent at rest (the 1px transparent border keeps its box the same size
   as a bordered button, so swapping variants never shifts a row), an overlay
   on hover. A toolbar button that should be quiet wears THIS class; the app's
   own class sizes and places it (E-30848) and never redraws a border or fill.
   No second ghost/quiet class: its segmented sibling is `.seg` in segmented.css.
   Documented in docs/DESIGN-SYSTEM.md "Buttons". */
.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    padding: var(--spacing-md) var(--spacing-lg);
    border: 1px solid transparent;
}

.btn-ghost:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-overlay);
}

/* Icon button (tight) */
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid transparent;
}

.btn-icon:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-secondary);
}

.btn-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.5;
}

/* Disabled state */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================================================
   MENU ITEMS ARE LEFT-JUSTIFIED — the one rule for every menu (E-60550)
   Bill, 9:18pm ET Nov 28: "everythig here needs to be left justified all menues
   are left justified put that into our design system."
   This rule owns how a menu item's content is justified. A menu row is often a
   control borrowed from elsewhere (the left bar's ⋮ menu adopts the composer's
   Skills/Voice/Attach/Clear buttons, whose own classes say justify-content:center),
   and text-align:left does nothing on a flex row, so the item centred. The grouped
   row selector out-ranks any single-class control rule; for the rest this is the
   default, and a menu's own item rule never sets justify-content/text-align to
   center or right: src/shared/__tests__/design-system-every-menu-item-left-justified.test.js
   and src/console/__tests__/every-menu-item-left-justified-across-src.test.js fail on
   it. Not an item: a sub-element that boxes one glyph (…-menu-item-icon), or an
   icon tile in a strip of tiles inside a menu (.nshell-lytpop-tile), which centres
   its icon in its own box.
   ============================================================================ */
[role="menuitem"],
[role="menuitemcheckbox"],
[role="menuitemradio"],
.wlm-ctx-item,
.sab-dev-row[data-menu-grouped] .sab-menu-group > [data-menu-group] {
    justify-content: flex-start;
    text-align: left;
}

/* ============================================================================
   INPUTS & FORMS
   =========================================================================== */

input,
textarea,
select {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    padding: var(--spacing-md) var(--spacing-lg);
    border: 1px solid var(--color-input-border);
    border-radius: var(--radius-md);
    background: var(--color-input-bg);
    color: var(--color-input-text);
    transition: all var(--transition-base);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-accent);
    background: var(--color-bg-primary);
    box-shadow: 0 0 0 2px var(--color-accent-bg);
}

input:disabled,
textarea:disabled,
select:disabled {
    background: var(--color-bg-tertiary);
    color: var(--color-text-disabled);
    cursor: not-allowed;
}

/* ============================================================================
   CONTAINERS & CARDS
   =========================================================================== */

.container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-xl);
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-bg-secondary);
    flex-shrink: 0;
}

.content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--spacing-xl);
}

.footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-lg);
    padding: var(--spacing-xl);
    border-top: 1px solid var(--color-border-light);
    background: var(--color-bg-secondary);
    flex-shrink: 0;
}

.card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--color-border-normal);
    box-shadow: var(--shadow-md);
}

/* ============================================================================
   LAYOUT UTILITIES
   =========================================================================== */

.flex {
    display: flex;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.flex-row {
    display: flex;
    flex-direction: row;
}

.gap-xs { gap: var(--spacing-xs); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }
.gap-xl { gap: var(--spacing-xl); }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }

.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

.p-xs { padding: var(--spacing-xs); }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.p-xl { padding: var(--spacing-xl); }

.m-xs { margin: var(--spacing-xs); }
.m-sm { margin: var(--spacing-sm); }
.m-md { margin: var(--spacing-md); }
.m-lg { margin: var(--spacing-lg); }
.m-xl { margin: var(--spacing-xl); }

/* ============================================================================
   SCROLLBAR STYLING
   =========================================================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-scrollbar);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-scrollbar-hover);
}

/* ============================================================================
   UTILITY CLASSES
   =========================================================================== */

.hidden {
    display: none !important;
}

.invisible {
    visibility: hidden;
}

.opacity-50 {
    opacity: 0.5;
}

.opacity-75 {
    opacity: 0.75;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }

.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

/* ============================================================================
   COLOR UTILITIES
   =========================================================================== */

.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-accent { color: var(--color-accent); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }

.bg-primary { background: var(--color-bg-primary); }
.bg-secondary { background: var(--color-bg-secondary); }
.bg-tertiary { background: var(--color-bg-tertiary); }
.bg-accent { background: var(--color-accent-bg); }

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
