/* ══════════════════════════════════════════════════════════════════════════════
   ShiftHR Design Tokens — Layer 1 (canonical)
   ──────────────────────────────────────────────────────────────────────────────
   Pass A rewrite (2026-06-09). Visual system: "Olive & Honey Gold".
     • GREEN  = the Culture side of the Performance/Culture Wall   (--color-culture-*)
     • GOLD   = the Recognition / Rewards side of the Wall          (--color-recognition-*)
   The palette ENCODES the thesis. One token language spans light + dark.

   RULES HONOURED:
     • Variable NAMES are stable — only values change (+ additive new tokens, clearly
       sectioned below). Consumers and CssTokenIntegrityTests keep passing.
     • Light = earthly / desaturated olive-greens + honey gold. Natural, ephemeral
       in look, SOLID in function.
     • Dark  = same hues pushed toward neon but LUMINANCE-CAPPED. Large surfaces stay
       in the dark-neutral band; saturated accent reserved for small focal elements.
       Never "flash-banged at 2am". WCAG AA met without maxing saturation.
     • The Wall panels use dedicated deep-gradient tokens with white ink so text
       clears AA in BOTH themes (--wall-*).
     • Sidebar FOLLOWS the theme (no longer always-dark) — --sidebar-* track [data-theme].
     • Type = Hanken Grotesk, self-hosted; weight tokens clamped 200–650.
   ══════════════════════════════════════════════════════════════════════════════ */

:root {

    color-scheme: light;

    /* Self-hosted (CSP font-src 'self'). See /wwwroot/fonts/ + fonts.css @font-face.
       Hanken Grotesk variable (200–650 axis) for body/UI; IBM Plex Mono for metrics. */
    --font-family:           "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono:             "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    /* ── Brand Colors ──────────────────────────────────────────────────────────
       --color-brand IS the Culture green; --color-accent IS the Recognition gold.
       Semantic aliases (--color-culture-* / --color-recognition-*) added below. */
    --color-brand:           #5E6B3A;   /* olive — primary actions                    */
    --color-brand-dark:      #49532C;   /* hover / pressed                            */
    --color-brand-light:     #E9EAD8;   /* tint surface, badges, focus wash           */
    --color-brand-rgb:       94, 107, 58;   /* a COMMA triplet, like every -rgb token: consume it in the rgba() comma form; the slash-alpha form over it is invalid CSS and drops the whole declaration (CssTokenIntegrityTests) */
    --color-accent:          #C9A24B;   /* honey gold — Recognition accent            */
    --color-on-brand:        #FFFFFF;

    /* ── The Wall — semantic thesis tokens (Pass A, additive) ──────────────────── */
    --color-culture:         #5E6B3A;   /* olive green = Culture (Development side)   */
    --color-culture-dark:    #49532C;
    --color-culture-light:   #E9EAD8;
    --color-culture-rgb:     94, 107, 58;
    --color-recognition:     #C9A24B;   /* honey gold = Recognition & Rewards side    */
    /* The gold INK (#1045): text on the light surfaces and the gold tint clears 4.5:1 (4.9 on the
       tint, 5.4 on the sunken rail). #A8842F read 3.0 to 3.4 and moved to the hover surface below. */
    --color-recognition-dark:#7D6224;
    --color-recognition-hover:#A8842F;  /* the gold button's hover SURFACE, its dark ink 4.55:1 */
    --color-recognition-light:#F6ECCF;
    --color-recognition-rgb: 201, 162, 75;

    /* Wall panel gradients — deep, white ink clears AA in both themes. */
    --wall-culture-from:     #4C5C2A;
    --wall-culture-to:       #3A481E;
    --wall-recognition-from: #927016;
    --wall-recognition-to:   #6E5410;
    --wall-perf-from:        #4A4E42;
    --wall-perf-to:          #34372D;
    --wall-role-edge:        #34372D;   /* the role side's edge on a bar or a node (C12): the graphite, a light graphite in dark */
    --wall-ink:              #FFFFFF;

    /* ── Neutral Scale ─────────────────────────────────────────────────────────
       Warm, faintly-green stone greys (chroma kept < .02). Not cool zinc. */
    --color-neutral-50:      #F6F7F3;
    --color-neutral-100:     #EDEFE8;
    --color-neutral-200:     #DEE1D6;
    --color-neutral-300:     #C7CBBC;
    --color-neutral-400:     #9AA08C;   /* borders and icons, never text: 2.4 to 2.7:1 on the light surfaces */
    --color-neutral-500:     #64695B;   /* the muted TEXT ink (#1045; was #6E7464, 4.0 to 4.5): 4.6:1 on the olive tint and above */
    --color-neutral-600:     #565B4D;
    --color-neutral-700:     #3F4338;
    --color-neutral-800:     #2A2D25;
    --color-neutral-900:     #181A14;

    /* ── Semantic: Error ───────────────────────────────────────────────────────
       Earthy terracotta-red, kept clearly distinct from brand. */
    --color-error:           #BF4632;
    --color-error-light:     #F7E7E2;
    --color-error-border:    #E6C2B9;
    --color-error-text:      #7C2A1B;

    /* ── Semantic: Warning ─────────────────────────────────────────────────────
       Ochre/amber — sits in the warm family but reads as alert, not brand gold. */
    --color-warning:         #C18A2B;
    --color-warning-light:   #F7EDD4;
    --color-warning-border:  #E8D29A;
    --color-warning-text:    #6E4A12;

    /* ── Semantic: Success ─────────────────────────────────────────────────────
       Livelier leaf-green vs the desaturated olive brand. */
    --color-success:         #3E8E5A;
    --color-success-light:   #DEEEE2;
    --color-success-border:  #A9D3B6;
    --color-success-text:    #246B3E;

    /* ── Semantic: Info ─────────────────────────────────────────────────────────
       Calm earthy slate-blue. */
    --color-info-light:      #DEE8EF;
    --color-info-border:     #B6CEDE;
    --color-info-text:       #235072;

    /* ── Semantic: Purple (roles, departments, Commitments) ────────────────────
       Retuned to a muted heather/plum so it lives in the earthy family. */
    --color-purple:          #6E5773;
    --color-purple-light:    #EAE3EE;
    --color-purple-dark:     #4E3D55;
    --color-purple-muted:    #E3DBE8;

    /* ── Semantic: Pink (cascade values, contractor) ───────────────────────────
       Dusty rose. */
    --color-pink-light:      #F2E2DC;
    --color-pink-text:       #834A3C;

    /* ── Semantic: Amber (invitations, individual commitments) ─────────────────
       Warm gold/ochre — harmonises with the Recognition family. */
    --color-amber:           #C18A2B;
    --color-amber-light:     #F6EAD2;
    --color-amber-alt:       #F3E8C9;
    --color-amber-text:      #6E4A12;
    --color-amber-accent:    #A8741E;

    /* ── Surface Colors ────────────────────────────────────────────────────────
       Warm whites — subtly toned, never clinical. */
    --color-surface:         #FCFDFA;
    --color-surface-raised:  #FFFFFF;
    --color-surface-sunken:  var(--color-neutral-50);
    --color-surface-overlay: rgba(24, 26, 20, 0.45);
    --color-surface-frosted: rgba(252, 253, 250, 0.82);

    /* ── Border Colors ─────────────────────────────────────────────────────────── */
    --color-border:          var(--color-neutral-200);
    --color-border-light:    var(--color-neutral-100);
    --color-border-brand:    #CDD3BC;
    --color-border-control:  #868C78;   /* a control's edge (BR-Q1 (a)): 3.2 to 3.5:1 on the light surfaces (WCAG 1.4.11) */

    /* ── Dev Banner & Dev Tools ───────────────────────────────────────────────── */
    --color-dev-bg:          #F6EAD2;
    --color-dev-border:      #E8D29A;
    --color-dev-text:        #6E4A12;
    --color-dev-accent:      #C18A2B;

    /* ── Spacing Scale ─────────────────────────────────────────────────────────── */
    --space-1:               4px;
    --space-2:               8px;
    --space-3:               12px;
    --space-4:               16px;
    --space-5:               20px;
    --space-6:               24px;
    --space-7:               28px;
    --space-8:               32px;
    --space-10:              40px;
    --space-12:              48px;
    --space-16:              64px;
    --space-20:              80px;
    --space-24:              96px;   /* additive — marketing section rhythm */
    --space-32:             128px;   /* additive */

    /* ── Typography Scale ──────────────────────────────────────────────────────── */
    --text-2xs:              .6875rem;
    --text-xs:               .75rem;
    --text-sm:               .8125rem;
    --text-base:             .875rem;
    --text-md:               .9375rem;
    --text-lg:               1rem;
    --text-xl:               1.1875rem;
    --text-2xl:              1.4375rem;
    --text-3xl:              1.75rem;
    --text-4xl:              2.1875rem;
    --text-5xl:              2.875rem;   /* additive — marketing display */
    --text-6xl:              3.75rem;    /* additive — hero display      */

    --leading-tight:         1.12;       /* additive — display lines */
    --leading-snug:          1.3;
    --leading-normal:        1.55;
    --tracking-tight:        -.02em;     /* additive */
    --tracking-normal:       0;
    --tracking-wide:         .04em;

    /* ── Font Weights ──────────────────────────────────────────────────────────
       CLAMPED to Hanken Grotesk's healthy band 200–650. Names stable; --font-bold
       and --font-extra are pulled in from 700/800 to the 650 ceiling. */
    --font-thin:             200;   /* additive — display / hero only */
    --font-light:            300;   /* additive — light editorial display */
    --font-normal:           400;
    --font-medium:           500;
    --font-semibold:         600;
    --font-bold:             650;   /* was 700 — clamped */
    --font-extra:            650;   /* was 800 — clamped to ceiling */

    /* ── Border Radius ───────────────────────────────────────────────────────────
       Medium-soft "every corner in harmony" scale. */
    --radius-sm:             6px;
    --radius-md:             10px;
    --radius-lg:             16px;
    --radius-xl:             24px;    /* additive — large marketing cards / hero */
    --radius-pill:           999px;
    --radius-full:           50%;

    /* ── Shadows ───────────────────────────────────────────────────────────────
       Soft, warm-tinted, low-alpha (Jobs-era calm). */
    --shadow-sm:             0 1px 2px rgb(24 26 20 / .05), 0 1px 3px rgb(24 26 20 / .05);
    --shadow-md:             0 4px 16px rgb(24 26 20 / .08);
    --shadow-lg:             0 12px 40px rgb(24 26 20 / .12);
    --shadow-xl:             0 28px 70px rgb(24 26 20 / .16);   /* additive */
    --shadow-focus:          0 0 0 3px rgba(var(--color-brand-rgb), .28);  /* additive; the -rgb tokens are COMMA triplets, so the alpha rides the legacy comma form */

    /* ── Layout ──────────────────────────────────────────────────────────────── */
    --sidebar-width:         240px;
    --header-height:         60px;
    --content-max-width:     1200px;
    --content-padding:       var(--space-8);

    /* ── Density (Pass A, additive) ──────────────────────────────────────────────
       Spacious marketing, standard app, compact Admin. Surfaces multiply by this. */
    --density-scale:         1;        /* :root = standard (app)            */
    --row-height:            40px;
    --control-height:        38px;
    /* The size scale (RULED by the owner at 03:35 on 8 November 2026; Lane KF, #1217): the S and L
       control heights beside the field's M (--control-height); each density register below
       re-declares the three. */
    --control-s:             28px;
    --control-l:             44px;

    /* ── Transitions ───────────────────────────────────────────────────────────── */
    --transition-fast:       .15s ease;
    --transition-normal:     .2s ease;
    --transition-slow:       .3s ease;

    /* ── Motion System (Pass A foundation, additive) ────────────────────────────
       Shared durations/easings so every surface moves the same way. CSS-only. */
    --duration-fast:         150ms;
    --duration-normal:       240ms;
    --duration-slow:         420ms;
    --duration-ambient:      24s;      /* drifting background mesh */
    --ease-standard:         cubic-bezier(.32, .72, 0, 1);
    --ease-out:              cubic-bezier(.16, 1, .3, 1);
    --ease-in-out:           cubic-bezier(.65, 0, .35, 1);

    /* ── Marketing-surface locals (Pass A, additive) ────────────────────────────
       Defaults for the public/marketing page's local tweakables: density multiplier,
       ambient-mesh play-state, and hero/section headline weight. public.css re-declares
       these on `body` for the marketing context; they live here too so every var()
       resolves against tokens.css (CssTokenIntegrityTests scans tokens.css for the
       definition, not the consuming file). */
    --mkt-density:           1.15;
    --mesh-state:            running;
    --hero-w:                var(--font-light);
    --head-w:                var(--font-light);

    /* ── Cascade coverage-grid geometry (#660, additive) ─────────────────────────
       Component layout constants for the Cascade matrix (workspace.css). They
       carry NO theme value, so they live in plain :root; they sit here (not inline
       in workspace.css) only so every var(--csc-*) reference resolves against
       tokens.css — CssTokenIntegrityTests scans tokens.css for the definition, not
       the consuming file. workspace.css re-declares them on the grid wrapper at
       narrow widths (responsive). */
    --csc-rowhead-w:         232px;
    --csc-col-w:             100px;
    --csc-tile:              30px;
    --csc-bandh:             34px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   Component ALIAS tokens — declared on BOTH :root and every [data-theme] shell.
   Custom properties substitute their var() chains at computed-value time ON THE
   DECLARING ELEMENT; an alias declared only at :root flattens to the LIGHT base
   values at <html> scope, and dark shells inherit the already-flattened result
   (the #656/#657/#658 "light surface in dark mode" family — the same mechanism
   as the body-scope colour gotcha in gotchas_ui_features.md §CSS & Theming).
   Re-declaring the aliases on [data-theme] makes each shell re-substitute them
   against ITS register. Add new component aliases HERE, never in :root alone —
   CssTokenIntegrityTests fails the build on a :root-only theme-derived alias.
   ══════════════════════════════════════════════════════════════════════════════ */
:root,
[data-theme] {
    /* ── Badge: Role ───────────────────────────────────────────────────────────── */
    --badge-role-admin-bg:   var(--color-purple-light);
    --badge-role-admin-text: var(--color-purple);
    --badge-role-mgr-bg:     var(--color-info-light);
    --badge-role-mgr-text:   #235072;
    --badge-role-emp-bg:     var(--color-neutral-100);
    --badge-role-emp-text:   var(--color-neutral-700);

    /* ── Badge: Status ───────────────────────────────────────────────────────────── */
    --badge-active-bg:       var(--color-success-light);
    --badge-active-text:     var(--color-success-text);
    --badge-invited-bg:      var(--color-amber-alt);
    --badge-invited-text:    var(--color-amber-text);
    --badge-deactivated-bg:  var(--color-error-light);
    --badge-deactivated-text: var(--color-error-text);

    /* ── Progress Bar ──────────────────────────────────────────────────────────── */
    --progress-green:        var(--color-success);
    --progress-yellow:       var(--color-warning);
    --progress-red:          var(--color-error);

    /* ── Sidebar — FOLLOWS THEME ─────────────────────────────────────────────────
       Light rail in light mode, dark rail in dark mode (see [data-theme="dark"]).
       The always-dark constraint is retired. */
    --sidebar-bg:            #F1F3EC;
    --sidebar-text:          var(--color-neutral-800);
    --sidebar-text-muted:    var(--color-neutral-500);
    /* The section labels (#1045): no legible grey sits lighter than the muted ink on the light
       rail (the floor is within 0.5:1 of it), so they share it and differ by type alone. */
    --sidebar-text-subtle:   var(--color-neutral-500);
    --sidebar-hover-bg:      rgba(var(--color-brand-rgb), .09);
    --sidebar-active-bg:     rgba(var(--color-brand-rgb), .14);
    --sidebar-active-text:   var(--color-brand-dark);   /* 6.1:1 on the active wash; the brand read 4.3 (#1045) */
    --sidebar-border:        var(--color-neutral-200);

    --sidebar-mode-btn-bg:        transparent;
    --sidebar-mode-btn-text:      var(--sidebar-text-muted);
    --sidebar-mode-btn-hover-bg:  var(--sidebar-hover-bg);
    --sidebar-mode-btn-hover-text:var(--sidebar-text);

    /* ── The row hover (RULED by the owner at 03:35 on 8 November 2026; Lane KF, #1217) ─────
       One hover for every row that opens or picks something, and one press: the menu's own
       tints (the sidebar's hover and current-page washes), on ItemRow and its family
       (SearchChecklist's results, the menu items, ChoiceGroup's list, Disclosure, DataGrid's
       rows). Declared here, never in :root alone: they chain onto the dark-overridden triplet. */
    --row-hover-bg:          rgba(var(--color-brand-rgb), .09);
    --row-press-bg:          rgba(var(--color-brand-rgb), .14);

    /* ══════════════════════════════════════════════════════════════════════════
       ▓▓▓ PASS B — UI KIT (additive only) ▓▓▓
       ──────────────────────────────────────────────────────────────────────────
       Every token below is NEW (additive) and DEFINED here so CssTokenIntegrityTests
       stays green. Names are stable from here on. Wherever possible each value is a
       var() composition of an existing Pass A token, so it AUTO-THEMES (light/dark/
       system) with no duplication in the override blocks below. Only the handful that
       need a literal per-theme value are re-declared in [data-theme="dark"] + system.
       ══════════════════════════════════════════════════════════════════════════ */

    /* ── Recognition ink + focus (gold variant) ──────────────────────────────── */
    --color-on-recognition:   #2A2108;   /* dark ink on a gold surface, both themes */
    --shadow-focus-gold:      0 0 0 3px rgba(var(--color-recognition-rgb), .30);

    /* ── Control surfaces (forms/inputs/select/textarea) ─────────────────────── */
    --control-bg:             var(--color-surface-raised);
    --control-border:         var(--color-border-control);
    --control-border-hover:   var(--color-neutral-500);
    --control-placeholder:    var(--color-neutral-500);   /* placeholder text is text: neutral-400 read 2.7:1 (#1045) */
    --control-disabled-bg:    var(--color-neutral-100);
    /* neutral-500, not 400 (#883): 400-on-100 sat near 2.9:1 in dark and the old
       button opacity dim pushed it illegible; 500 keeps the dimmed read at a
       legible contrast in BOTH registers (aliases re-substitute per theme). */
    --control-disabled-text:  var(--color-neutral-500);
    --control-disabled-border:var(--color-border-light);
    --control-radius:         var(--radius-md);

    /* ── Tabs ────────────────────────────────────────────────────────────────── */
    --tab-text:               var(--color-neutral-500);
    --tab-text-active:        var(--color-neutral-900);
    --tab-indicator:          var(--color-brand);
    --tab-hover-bg:           var(--color-surface-sunken);

    /* ── Spinner ─────────────────────────────────────────────────────────────── */
    --spinner-track:          var(--color-border);
    --spinner-head:           var(--color-brand);

    /* ── Skeleton / loading ──────────────────────────────────────────────────── */
    --skeleton-base:          var(--color-neutral-100);
    --skeleton-sheen:         var(--color-neutral-200);

    /* ── Help "?" affordance + popover ───────────────────────────────────────── */
    --help-dot-bg:            var(--color-neutral-100);
    --help-dot-text:          var(--color-neutral-500);
    --help-dot-hover-bg:      var(--color-brand-light);
    --help-dot-hover-text:    var(--color-brand);
    --popover-bg:             var(--color-surface-raised);
    --popover-border:         var(--color-border);
    --popover-shadow:         var(--shadow-lg);

    /* ── Wizard (persistent global wizard + per-role seam) ───────────────────── */
    --wizard-line:            var(--color-border);
    --wizard-line-done:       var(--color-brand);
    --wizard-todo:            var(--color-neutral-300);
    --wizard-todo-text:       var(--color-neutral-500);
    --wizard-done:            var(--color-brand);
    --wizard-active:          var(--color-brand);
    --wizard-active-ring:     var(--color-brand-light);
    --wizard-panel-bg:        var(--color-surface-raised);
    /* per-role highlight seam: a config can raise/lower a step's emphasis without
       new tokens — it sets --wizard-emphasis on the step element. Default = none. */
    --wizard-emphasis:        transparent;

    /* ── AI assistant panel (anti-Clippy chrome — ships OFF) ──────────────────── */
    --ai-panel-width:         360px;
    --ai-panel-bg:            var(--color-surface-raised);
    --ai-panel-rail:          var(--color-border);
    --ai-panel-header-bg:     var(--color-surface-sunken);
    --ai-accent:              var(--color-brand);
    --ai-bubble-bg:           var(--color-brand-light);
    --ai-muted:               var(--color-neutral-500);

    /* ── Graceful degradation (killed / unavailable feature) ─────────────────── */
    --unavailable-bg:         var(--color-surface-sunken);
    --unavailable-border:     var(--color-border);
    --unavailable-text:       var(--color-neutral-500);

    /* ── ReverseFilter (tag → evidence-row primitive) ────────────────────────── */
    --tag-bg:                 var(--color-brand-light);
    --tag-text:               var(--color-brand-dark);
    --tag-remove:             var(--color-neutral-500);
    --evidence-rail:          var(--color-border-brand);

    /* ── Motion System additions ─────────────────────────────────────────────── */
    --reveal-shift:           20px;       /* scroll-reveal translate distance     */
    --ease-spring:            cubic-bezier(.34, 1.56, .64, 1);
    --ease-emphasis:          cubic-bezier(.2, .8, .2, 1);

    /* ── Density register (additive; standard is the :root default) ──────────── */
    --density-gap:            var(--space-6);   /* gutter between cards/rows       */
    --density-pad:            var(--space-6);   /* inner padding of dense surfaces */
    --field-gap:              var(--space-4);   /* form-field vertical rhythm      */

    /* ── Cascade coverage grid — the Wall, encoded in the matrix (#660, additive)
       Source KIND carries colour (anti-conflation): strategic Goals = neutral
       graphite, cultural Values = Culture-green, in SEPARATE bands so they never
       blur. Structure (Groups) stays neutral. Gold is deliberately ABSENT —
       Recognition is not on this surface, so it stays reserved (brand §1). Each
       value composes a locked base token, so it auto-themes light/dark/system with
       no per-theme duplication, and CssTokenIntegrityTests stays green. Declared in
       the ":root, [data-theme]" rule (not :root alone) because several bases
       (culture, neutrals, surface, border, warning-text) are dark-overridden — an
       alias chaining onto them flattens to the LIGHT value at :root-only scope. */
    --cascade-goal-fill:     var(--color-neutral-200);
    --cascade-goal-mark:     var(--color-neutral-600);
    --cascade-goal-accent:   var(--color-neutral-400);   /* strategic Goals = neutral graphite */
    --cascade-value-fill:    var(--color-culture-light);
    --cascade-value-mark:    var(--color-culture);
    --cascade-value-accent:  var(--color-culture);        /* cultural Values = Culture green   */
    --cascade-cell-empty:    var(--color-surface);
    --cascade-grid-line:     var(--color-border);
    --cascade-flag:          var(--color-warning-text);   /* "inherits nothing" marker          */

}

/* ── Density registers (Pass B additive) ─────────────────────────────────────────
   Set [data-density] on a shell root. Standard = app (default), compact = Admin,
   spacious = marketing (also keeps the --mkt-density multiplier from Pass A). */
[data-density="standard"] {
    --row-height:      40px;
    --control-height:  38px;
    --control-s:       28px;
    --control-l:       44px;
    --content-padding: var(--space-8);
    --density-gap:     var(--space-6);
    --density-pad:     var(--space-6);
    --field-gap:       var(--space-4);
}
[data-density="compact"] {
    --row-height:      32px;
    --control-height:  32px;
    --control-s:       24px;
    --control-l:       38px;
    --content-padding: var(--space-5);
    --density-gap:     var(--space-4);
    --density-pad:     var(--space-4);
    --field-gap:       var(--space-3);
}
[data-density="spacious"] {
    --row-height:      44px;
    --control-height:  42px;
    --control-s:       32px;
    --control-l:       48px;
    --content-padding: var(--space-12);
    --density-gap:     var(--space-8);
    --density-pad:     var(--space-8);
    --field-gap:       var(--space-5);
}

/* ══════════════════════════════════════════════════════════════════════════════
   Dark Theme Overrides — same hues, luminance-capped
   ══════════════════════════════════════════════════════════════════════════════ */

[data-theme="dark"] {
    color-scheme: dark;

    /* Brand: brighter olive, luminance-capped; dark text on the bright button
       (modal/greptile pattern) keeps it off max-saturation neon. */
    --color-brand:           #8FA350;
    --color-brand-dark:      #879A4C;   /* the olive INK on the tint (#1045; was #7C8D43, 4.1): 4.9:1 */
    --color-brand-light:     #232818;   /* deep olive tint surface */
    --color-brand-rgb:       143, 163, 80;
    --color-accent:          #E0BC5E;   /* honey gold, controlled — small focal use   */
    --color-on-brand:        #0E1310;   /* dark text on the bright button             */

    --color-culture:         #8FA350;
    --color-culture-dark:    #879A4C;
    --color-culture-light:   #232818;
    --color-culture-rgb:     143, 163, 80;
    --color-recognition:     #E0BC5E;
    --color-recognition-dark:#C49F45;
    --color-recognition-hover:#C49F45;
    --color-recognition-light:#2C2614;
    --color-recognition-rgb: 224, 188, 94;

    --wall-culture-from:     #56692E;
    --wall-culture-to:       #3E4D1E;
    --wall-recognition-from: #8C6E15;   /* white ink 4.8:1 (#1045; #957517 read 4.3) */
    --wall-recognition-to:   #6E5611;
    --wall-perf-from:        #2B332A;
    --wall-perf-to:          #1A201A;
    --wall-role-edge:        #C7D0C5;   /* --wall-perf-to reads about 1.1:1 on the raised surface in dark */
    --wall-ink:              #FFFFFF;

    /* Neutral scale inverted: --neutral-900 ≈ near-white text, --neutral-50 ≈ near-black
       background. Warm green-black, not pure black. */
    --color-neutral-50:      #0E1310;
    --color-neutral-100:     #181F1A;
    --color-neutral-200:     #28312A;
    --color-neutral-300:     #3A453C;
    --color-neutral-400:     #5C6859;
    --color-neutral-500:     #8B978A;
    --color-neutral-600:     #AAB5A8;
    --color-neutral-700:     #C7D0C5;
    --color-neutral-800:     #DFE6DD;
    --color-neutral-900:     #F1F5EF;

    /* Surfaces — dark-neutral band, warm green-black. */
    --color-surface:         #0E1310;
    --color-surface-raised:  #161D18;
    --color-surface-sunken:  #090C0A;
    --color-surface-overlay: rgba(0, 0, 0, 0.66);
    --color-surface-frosted: rgba(14, 19, 16, 0.82);

    /* Borders */
    --color-border:          var(--color-neutral-200);
    --color-border-light:    var(--color-neutral-100);
    --color-border-brand:    #3C4A28;
    --color-border-control:  #66725F;   /* a control's edge: 3.4 to 4.2:1 on the dark surfaces */

    /* Semantic backgrounds: muted dark tints; hue + text kept so meaning survives. */
    --color-error:           #D4624C;
    --color-error-light:     #3A1C16;
    --color-error-border:    #6E2A1C;
    --color-error-text:      #F0A593;

    --color-warning:         #D6A24A;
    --color-warning-light:   #332710;
    --color-warning-border:  #6E4A12;
    --color-warning-text:    #E6C277;

    --color-success:         #4FA873;
    --color-success-light:   #16301F;
    --color-success-border:  #246B3E;
    --color-success-text:    #8FD3A6;

    --color-info-light:      #14283A;
    --color-info-border:     #1F4664;
    --color-info-text:       #A8CDE6;

    --color-purple:          #B79BC6;
    --color-purple-light:    #2A2230;
    --color-purple-dark:     #C9B4D4;
    --color-purple-muted:    #241E29;

    --color-pink-light:      #3A2420;
    --color-pink-text:       #E6B3A6;

    --color-amber:           #D6A24A;
    --color-amber-light:     #332710;
    --color-amber-alt:       #2E2610;
    --color-amber-text:      #E6C277;
    --color-amber-accent:    #D6A24A;

    /* Dev banner */
    --color-dev-bg:          #332710;
    --color-dev-border:      #6E4A12;
    --color-dev-text:        #E6C277;
    --color-dev-accent:      #D6A24A;

    /* Shadows: deeper, higher-alpha against dark surfaces. */
    --shadow-sm:             0 1px 3px rgb(0 0 0 / .45);
    --shadow-md:             0 4px 16px rgb(0 0 0 / .55);
    --shadow-lg:             0 12px 40px rgb(0 0 0 / .65);
    --shadow-xl:             0 28px 70px rgb(0 0 0 / .72);
    --shadow-focus:          0 0 0 3px rgba(var(--color-brand-rgb), .42);

    /* Badge text pairs re-picked for the dark tints. */
    --badge-role-mgr-text:   #A8CDE6;
    --badge-active-text:     #8FD3A6;

    /* Sidebar follows theme → dark rail in dark mode. */
    --sidebar-bg:            #0B0F0C;
    --sidebar-text:          var(--color-neutral-800);
    --sidebar-text-muted:    var(--color-neutral-500);
    --sidebar-text-subtle:   #768275;   /* 4.8:1 on the dark rail, under the muted 6.3 (#1045; neutral-400 read 3.3) */
    --sidebar-hover-bg:      rgba(var(--color-brand-rgb), .14);
    --sidebar-active-bg:     rgba(var(--color-brand-rgb), .20);
    --sidebar-active-text:   var(--color-brand);
    --sidebar-border:        var(--color-neutral-200);
    --row-hover-bg:          rgba(var(--color-brand-rgb), .14);
    --row-press-bg:          rgba(var(--color-brand-rgb), .20);

    /* Placeholder ink re-pick (#889 follow-up): dark neutral-400 flips DARKER
       (it serves as the border-hover tone), so the :root alias chain lands
       placeholder text near-invisible on dark controls. One step lighter here. */
    --control-placeholder:   var(--color-neutral-500);
}

/* System preference: defer to OS dark-mode setting (mirrors [data-theme="dark"]). */
@media (prefers-color-scheme: dark) {
    [data-theme="system"] {
        color-scheme: dark;

        --color-brand:           #8FA350;
        --color-brand-dark:      #879A4C;
        --color-brand-light:     #232818;
        --color-brand-rgb:       143, 163, 80;
        --color-accent:          #E0BC5E;
        --color-on-brand:        #0E1310;

        --color-culture:         #8FA350;
        --color-culture-dark:    #879A4C;
        --color-culture-light:   #232818;
        --color-culture-rgb:     143, 163, 80;
        --color-recognition:     #E0BC5E;
        --color-recognition-dark:#C49F45;
        --color-recognition-hover:#C49F45;
        --color-recognition-light:#2C2614;
        --color-recognition-rgb: 224, 188, 94;

        --wall-culture-from:     #56692E;
        --wall-culture-to:       #3E4D1E;
        --wall-recognition-from: #8C6E15;
        --wall-recognition-to:   #6E5611;
        --wall-perf-from:        #2B332A;
        --wall-perf-to:          #1A201A;
        --wall-role-edge:        #C7D0C5;
        --wall-ink:              #FFFFFF;

        --color-neutral-50:      #0E1310;
        --color-neutral-100:     #181F1A;
        --color-neutral-200:     #28312A;
        --color-neutral-300:     #3A453C;
        --color-neutral-400:     #5C6859;
        --color-neutral-500:     #8B978A;
        --color-neutral-600:     #AAB5A8;
        --color-neutral-700:     #C7D0C5;
        --color-neutral-800:     #DFE6DD;
        --color-neutral-900:     #F1F5EF;

        --color-surface:         #0E1310;
        --color-surface-raised:  #161D18;
        --color-surface-sunken:  #090C0A;
        --color-surface-overlay: rgba(0, 0, 0, 0.66);
        --color-surface-frosted: rgba(14, 19, 16, 0.82);

        --color-border:          var(--color-neutral-200);
        --color-border-light:    var(--color-neutral-100);
        --color-border-brand:    #3C4A28;
        --color-border-control:  #66725F;

        --color-error:           #D4624C;
        --color-error-light:     #3A1C16;
        --color-error-border:    #6E2A1C;
        --color-error-text:      #F0A593;

        --color-warning:         #D6A24A;
        --color-warning-light:   #332710;
        --color-warning-border:  #6E4A12;
        --color-warning-text:    #E6C277;

        --color-success:         #4FA873;
        --color-success-light:   #16301F;
        --color-success-border:  #246B3E;
        --color-success-text:    #8FD3A6;

        --color-info-light:      #14283A;
        --color-info-border:     #1F4664;
        --color-info-text:       #A8CDE6;

        --color-purple:          #B79BC6;
        --color-purple-light:    #2A2230;
        --color-purple-dark:     #C9B4D4;
        --color-purple-muted:    #241E29;

        --color-pink-light:      #3A2420;
        --color-pink-text:       #E6B3A6;

        --color-amber:           #D6A24A;
        --color-amber-light:     #332710;
        --color-amber-alt:       #2E2610;
        --color-amber-text:      #E6C277;
        --color-amber-accent:    #D6A24A;

        --color-dev-bg:          #332710;
        --color-dev-border:      #6E4A12;
        --color-dev-text:        #E6C277;
        --color-dev-accent:      #D6A24A;

        --shadow-sm:             0 1px 3px rgb(0 0 0 / .45);
        --shadow-md:             0 4px 16px rgb(0 0 0 / .55);
        --shadow-lg:             0 12px 40px rgb(0 0 0 / .65);
        --shadow-xl:             0 28px 70px rgb(0 0 0 / .72);
        --shadow-focus:          0 0 0 3px rgba(var(--color-brand-rgb), .42);

        --badge-role-mgr-text:   #A8CDE6;
        --badge-active-text:     #8FD3A6;

        --sidebar-bg:            #0B0F0C;
        --sidebar-text:          var(--color-neutral-800);
        --sidebar-text-muted:    var(--color-neutral-500);
        --sidebar-text-subtle:   #768275;
        --sidebar-hover-bg:      rgba(var(--color-brand-rgb), .14);
        --sidebar-active-bg:     rgba(var(--color-brand-rgb), .20);
        --sidebar-active-text:   var(--color-brand);
        --sidebar-border:        var(--color-neutral-200);
        --row-hover-bg:          rgba(var(--color-brand-rgb), .14);
        --row-press-bg:          rgba(var(--color-brand-rgb), .20);

        --control-placeholder:   var(--color-neutral-500);
    }
}

/* ══════════════════════════════════════════════════════════════════════════════
   Native form-control color-scheme propagation in dark mode.
   ══════════════════════════════════════════════════════════════════════════════ */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] button,
[data-theme="dark"] dialog {
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    [data-theme="system"] input,
    [data-theme="system"] select,
    [data-theme="system"] textarea,
    [data-theme="system"] button,
    [data-theme="system"] dialog {
        color-scheme: dark;
    }
}

/* ── Spacing Utility Classes ───────────────────────────────────────────────────── */
.mt-1  { margin-top: var(--space-1); }
.mt-2  { margin-top: var(--space-2); }
.mt-3  { margin-top: var(--space-3); }
.mt-4  { margin-top: var(--space-4); }
.mt-5  { margin-top: var(--space-5); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mt-10 { margin-top: var(--space-10); }
.mb-1  { margin-bottom: var(--space-1); }
.mb-2  { margin-bottom: var(--space-2); }
.mb-3  { margin-bottom: var(--space-3); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }
