/* ============================================================
   GT CRM Design System — reference token layer (DS-1A foundation)
   ADR 0020 §2 (SSR-native, three-layer tokens: reference -> semantic ->
   component). This file is the REFERENCE layer only: raw, un-opinionated
   color/scale literals, each named once. `style.css`'s `:root` and theme
   blocks (the SEMANTIC layer) consume these via var(--gt-ref-*) instead of
   embedding hex directly — the same computed colors as before this stage
   for every already-shipped theme; only the location of the literal moved.

   Scope of this stage (DS-1A, bounded — NOT the full DS-1 exit): only the
   FOUNDATION token blocks (`:root`, `.theme-light`, the new
   `.theme-dark-desktop`) are covered. The ~250 raw hex values scattered
   across individual component rules elsewhere in style.css, and the
   mechanic-scoped `--mi-*` set (`.theme-dark` / `.mech-app`), are
   explicitly OUT OF SCOPE this stage — see ADR 0020 §6 DS-1 binary exit
   ("0 raw hex outside the reference layer in style.css") for the full,
   not-yet-met target. `.theme-dark` (mechanic) keeps its own raw hex,
   untouched, per its documented theme scope.

   `.theme-dark-desktop` ("Studio+Command", ADR 0020 §5 D2) is NEW content
   — nothing currently renders it in production. Its exact values are
   traced from the owner-accepted system reference
   (docs/design-system/system-reference/gt-crm-system-reference.html,
   SHA-256 c135c101cfa7eec4dc165dafd86b2c2b54198f400f2e149171518e28a7f1c644)
   where directly present; the handful of derived states the reference
   didn't enumerate explicitly (an accent hover tone, a translucent focus
   ring, a third text-emphasis tier) are computed from those SAME accepted
   anchors via color-mix()/rgba() — never a freshly invented hex — and are
   flagged below for owner visual refinement at DS-1 acceptance. This
   stage does not claim screenshot/visual acceptance of ANY theme.
   ============================================================ */

:root {
  /* ---- Brand palette (unchanged values, now named/referenced) -------- */
  --gt-ref-black:        #111111;
  --gt-ref-graphite:     #1f1f21;
  --gt-ref-brand-red:    #d71920;   /* GT brand accent only (logo / header accent line) — never a UI action color */
  --gt-ref-neutral-100:  #f4f4f5;
  --gt-ref-neutral-200:  #e5e7eb;
  --gt-ref-neutral-400:  #6b7280;

  /* ---- Workspace neutrals (root defaults) ----------------------------- */
  --gt-ref-workspace-bg:            #f4f6f8;
  --gt-ref-workspace-surface:       #ffffff;
  --gt-ref-workspace-surface-muted: #f8f9fa;
  --gt-ref-workspace-text:          #111827;

  /* ---- Blue lineage (action accent, root defaults) -------------------- */
  --gt-ref-blue-600: #2563EB;
  --gt-ref-blue-800: #1E40AF;
  --gt-ref-blue-50:  #EFF6FF;
  --gt-ref-blue-eff:  #eff6ff;   /* --gt-info-bg — same value, distinct historical name */

  /* ---- Status palette (root defaults) ---------------------------------- */
  --gt-ref-green-600:  #16a34a;
  --gt-ref-green-bg:   #ecfdf3;
  --gt-ref-orange-600: #d97706;
  --gt-ref-orange-bg:  #fff7ed;
  --gt-ref-red-600:    #dc2626;
  --gt-ref-red-bg:     #fef2f2;
  --gt-ref-neutral-bg: #f3f4f6;
  --gt-ref-slate-600:  #64748B;   /* --gt-text-soft (root) */
  --gt-ref-slate-100:  #EEF2F7;   /* --gt-surface-2 (root) */

  /* ---- "Porcelain" light desktop (ADR 0020 §5 D2) ---------------------
     Formalizes the existing, already-shipped R2D grounded premium-light
     theme verbatim — same values the owner has already reviewed in
     production; only now named/referenced instead of embedded. */
  --gt-ref-porcelain-bg:            #DFE3E9;
  --gt-ref-porcelain-surface:       #FBFCFD;
  --gt-ref-porcelain-surface-2:     #E8ECF1;
  --gt-ref-porcelain-surface-muted: #F1F3F7;
  --gt-ref-porcelain-text:          #17202B;
  --gt-ref-porcelain-text-muted:    #566273;
  /* PATH08-INSPECTION-PROGRESS-COHERENCE-01 (2026-09-03): was #7A8494, which
     failed WCAG AA everywhere it was used in the light theme -- 2.93:1 for a
     toolbar label on the page ground (#DFE3E9), 3.40:1 inside a metric tile,
     3.68:1 for the inspection number and the VIN on a board row. Measured in a
     browser on the delivered pages, not estimated. #5A6575 is the lightest
     slate that clears 4.5:1 against the DARKEST light surface the token lands
     on, which is the page ground itself; it clears 5.3:1 on the tile and
     5.6:1 on a row. LIGHT-THEME ONLY: `.theme-dark-desktop` binds
     `--gt-text-soft` to its own studio value and never reaches this one. */
  --gt-ref-porcelain-text-soft:     #5A6575;
  /* PATH08-RECEPTION-OWNER-IMPLEMENTATION-FIDELITY-01 (2026-09-23): the light desk's accent is the teal the Owner
     accepted on 2026-09-20 (report …-04-STATES-CONTRAST-ACCEPTED §3: links #1B6775, 5.03:1 on the #DFE3E9 page
     ground); it was the #1B5E8C blue. Hover and the selected tint follow it. */
  --gt-ref-porcelain-accent:        #1B6775;
  --gt-ref-porcelain-accent-hover:  #14525D;
  --gt-ref-porcelain-accent-soft:   #DAECEE;
  --gt-ref-porcelain-success:       #2C6B3F;
  --gt-ref-porcelain-success-bg:    #DBECDD;
  --gt-ref-porcelain-warning:       #8A5410;
  --gt-ref-porcelain-warning-bg:    #F4E7CE;
  --gt-ref-porcelain-danger:        #A83428;
  --gt-ref-porcelain-danger-bg:     #F5E0DB;
  --gt-ref-porcelain-border:        #CBD2DC;
  /* PATH08-RECEPTION-OWNER-IMPLEMENTATION-FIDELITY-01: the edge of a field or an outlined button in the light
     theme (accepted 2026-09-20, same report §3: #CBD2DC measured 1.2–1.5:1; #768089 is ≥ 3.12:1 on every light
     background). Card and row outlines keep the quiet --gt-ref-porcelain-border. */
  --gt-ref-porcelain-field-border:  #768089;
  /* The desk's main button, both themes (accepted 2026-09-19, portion 2: «оставляем как было» — the blue-teal
     #1F6F7E, not the bright #2563EB; white on it 5.78:1). */
  --gt-ref-desk-main:               #1F6F7E;
  --gt-ref-desk-main-hover:         #185A66;

  /* ---- "Studio+Command" dark desktop (ADR 0020 §5 D2) — NEW this stage.
     Traced from the accepted system reference's dark (default) state.
     Architecturally distinct from the mechanic mobile theme (`.theme-dark`
     / `--mi-*`), which stays exactly as documented and is untouched here. */
  --gt-ref-studio-bg:            #11171c;
  --gt-ref-studio-surface:       #172028;
  --gt-ref-studio-surface-2:     #1d2831;
  --gt-ref-studio-surface-muted: #24323d;
  --gt-ref-studio-text:          #f4f7fa;
  --gt-ref-studio-text-muted:    #aebac4;
  --gt-ref-studio-accent:        #72b7ee;
  --gt-ref-studio-accent-soft:   #1d3b52;
  --gt-ref-studio-accent-soft-fg:#d8efff;
  --gt-ref-studio-success:       #7bd1a5;
  --gt-ref-studio-success-bg:    #183b2d;
  --gt-ref-studio-warning:       #e8b45f;
  --gt-ref-studio-warning-bg:    #3b2e17;
  --gt-ref-studio-danger:        #ff7b72;
  --gt-ref-studio-danger-bg:     #412321;
  /* #129 fix (2026-07-15): the accepted-reference value (#465561) measured
     only 1.71-2.35:1 against the 4 Studio+Command surfaces it sits on as a
     UI-component/non-text boundary (--gt-bg/--gt-surface/--gt-surface-2/
     --gt-surface-muted) — below WCAG 2.2 SC 1.4.11's 3:1 minimum, worst
     case (--gt-surface-muted) only 1.71:1. Lightened along the same hue
     (cool slate blue-gray, 26% mixed toward white) to the smallest value
     that clears 3:1 against ALL FOUR surfaces with a small safety margin
     (3.30-4.54:1) rather than sitting exactly on the 3.0 edge. This is the
     ONLY reference value changed by this stage. */
  --gt-ref-studio-border:        #76818a;

  /* ---- DS-1B — shared component-state literals (2026-07-15) ------------
     Raw values extracted byte-for-byte from the pre-DS-1B component
     selectors (.btn-secondary/-success/-danger, .badge*, .notice/.alert-
     success/.callout/.ok/.warning) — the CURRENT, already-shipped Porcelain/
     theme-neutral appearance, now named instead of embedded. Dark
     ("Studio+Command") equivalents for these states reuse the ALREADY
     accepted --gt-ref-studio-success/-warning/-danger/-accent/-accent-soft
     anchors above (see style.css .theme-dark-desktop) — no new dark color
     is fabricated by this stage. */
  --gt-ref-state-info-fg:           #1e3a8a;
  --gt-ref-state-info-border:       #bfdbfe;
  --gt-ref-state-success-fg:        #166534;
  --gt-ref-state-success-border:    #bbf7d0;
  --gt-ref-state-danger-fg:         #9f1239;
  --gt-ref-state-danger-border:     #fecdd3;
  --gt-ref-state-warning-fg:        #92400e;
  --gt-ref-state-warning-border:    #fed7aa;
  --gt-ref-btn-secondary-bg:        #e8eaed;
  --gt-ref-btn-secondary-bg-hover:  #d9dce0;
  --gt-ref-btn-success-bg-hover:    #138d3f;
  --gt-ref-btn-danger-bg:           #dc2626;
  --gt-ref-btn-danger-bg-hover:     #b91c1c;
  --gt-ref-badge-neutral-bg:        #eef0f2;
  --gt-ref-btn-solid-fg:            #ffffff;

  /* ---- DS-1C — desktop header/nav shell literals (2026-07-15) ----------
     Raw values extracted byte-for-byte from the pre-DS-1C `.header`/
     `.brand-label`/`.nav a` rules. The shell is DELIBERATELY always-dark
     slate regardless of the Porcelain/Studio+Command toggle (see style.css
     .header's own pre-existing comment: "the always-dark .header shell, so
     no --gt-* theme token drives its own colors") — these are named, not
     re-derived per theme; style.css's :root consumes them once, with no
     .theme-light/.theme-dark-desktop override, matching that existing,
     deliberate design. */
  --gt-ref-shell-bg:            #1e293b;
  --gt-ref-shell-text:          #e2e8f0;
  --gt-ref-shell-border:        #0f172a;
  --gt-ref-shell-label-fg:      #94a3b8;
  --gt-ref-shell-label-border:  #334155;
  --gt-ref-shell-nav-fg:        #cbd5e1;
  --gt-ref-shell-nav-fg-hover:  #ffffff;

  /* ---- DS-1D — shared table chrome literals (2026-07-15) ---------------
     Raw values extracted byte-for-byte from the pre-DS-1D `th`/`td`/
     `tr:hover td` rules — the CURRENT, already-shipped Porcelain
     appearance, now named instead of embedded (`table` itself already
     used var(--gt-surface), no raw color there). `--gt-ref-table-row-
     border`'s value is intentionally NOT duplicated here — it is byte-
     identical to the already-existing --gt-ref-neutral-bg above, reused
     directly rather than declaring a redundant second reference token
     with the same value. Studio+Command equivalents (style.css
     .theme-dark-desktop) reuse the ALREADY accepted --gt-ref-studio-
     surface-2/-text-muted/-border anchors — no new dark color is
     fabricated by this stage. */
  --gt-ref-table-header-bg:     #f8fafc;
  --gt-ref-table-header-fg:     #4b5563;

  /* ---- DS-1F — deferred item 132 resolver literal (2026-07-15) ---------
     `.btn.primary:focus-visible`/`.btn-primary:focus-visible` carried its
     OWN raw box-shadow rgba(37,99,235,.3) — numerically close to but NOT
     identical to --gt-focus's rgba(37,99,235,0.25) (different alpha:
     .3 vs .25) — so it cannot reuse that existing token without silently
     changing Porcelain's exact rendered value. Named here as its own
     reference token instead (demonstrably missing, per this stage's own
     scope). Everything else DS-1F touches reuses ALREADY-existing
     semantic tokens (--gt-primary/--gt-primary-hover/--gt-focus/
     --gt-accent/--gt-accent-hover/--gt-focus-ring) — no other new
     reference token is needed. */
  --gt-ref-btn-primary-focus-ring: rgba(37, 99, 235, .3);

  /* ---- Deferred item 133 resolver literal (2026-07-15) ------------------
     `.filters a:hover`'s border-color (#c4c8cd) was traced against every
     existing reference token first (--gt-ref-porcelain-border #CBD2DC,
     --gt-ref-neutral-200 #e5e7eb, --gt-ref-neutral-bg #f3f4f6,
     --gt-ref-neutral-400 #6b7280) — none match, confirming this value is
     genuinely missing, not a duplicate. Byte-copy of the pre-existing raw
     value (Porcelain-preserving). */
  --gt-ref-filter-hover-border: #c4c8cd;

  /* ---- .toast / .splus-status-badge tokenization (2026-07-15) ----------
     Traced first: `.toast`'s background (#1e293b) and color (#ffffff)
     EXACTLY match the already-existing --gt-ref-shell-bg (DS-1C) and
     --gt-ref-btn-solid-fg (DS-1B) — reused directly, no new reference
     token needed for the toast. `.splus-status-badge`'s base bg (#f3f4f6)
     matches --gt-ref-neutral-bg; `.ok`'s bg/fg (#ecfdf3/#166534) match
     --gt-ref-green-bg/--gt-ref-state-success-fg; `.warn`'s bg (#fff7ed)
     matches --gt-ref-orange-bg; `.blocked`'s bg/fg (#fef2f2/#b91c1c) match
     --gt-ref-red-bg/--gt-ref-btn-danger-bg-hover — all reused directly.
     Only TWO values had no match anywhere: the base badge's text
     (#374151) and `.warn`'s text (#9a3412) — named here, genuinely
     missing, byte-copies of the pre-existing raw values. */
  --gt-ref-splus-badge-neutral-fg: #374151;
  --gt-ref-splus-badge-warn-fg:    #9a3412;

  /* ---- T18-11E receptionist inspection-results tokenization (2026-07-15) ----
     Traced first: 9 of the ~23 distinct raw values in this family matched
     already-existing tokens exactly and are reused directly (not
     duplicated here): --gt-ref-neutral-bg, --gt-ref-splus-badge-neutral-fg,
     --gt-ref-btn-danger-bg-hover, --gt-ref-neutral-400, --gt-ref-blue-800,
     --gt-ref-blue-600, --gt-ref-green-600, --gt-ref-red-600,
     --gt-ref-blue-eff. The 14 below had no match anywhere — genuinely
     missing, byte-copies of the pre-existing raw values. Studio+Command
     equivalents (style.css .theme-dark-desktop) reuse the ALREADY accepted
     --gt-ref-studio-success/-danger/-accent/-accent-soft/-text-muted/-border
     anchors for every state that has one; only "not applicable" (purple)
     has no existing Studio anchor anywhere in the system — its dark
     value is DERIVED via color-mix() from this same new
     --gt-ref-result-na-fg anchor (color-mix toward white for text/border,
     toward black for the tinted background), the same technique already
     used for --gt-accent-hover/--gt-filter-hover-border, not fabricated. */
  --gt-ref-result-ok-badge-bg:            #dcfce7;
  --gt-ref-result-ok-fg:                  #15803d;
  --gt-ref-result-issue-badge-bg:         #fee2e2;
  --gt-ref-result-skipped-badge-bg:       #dbeafe;
  --gt-ref-result-na-badge-bg:            #f3e8ff;
  --gt-ref-result-na-fg:                  #7e22ce;
  --gt-ref-result-item-issue-bg:          #fff5f5;
  --gt-ref-result-item-not-checked-border: #9ca3af;
  --gt-ref-result-item-skipped-border:    #93c5fd;
  --gt-ref-result-item-na-border:         #a855f7;
  --gt-ref-result-item-na-bg:             #faf5ff;
  --gt-ref-photo-thumb-border:            #cccccc;
  --gt-ref-result-all-clear-bg:           #ecfdf5;
  --gt-ref-result-all-clear-fg:           #065f46;

  /* ---- DS-1 package 1: reception list/detail/results tokenization
     (2026-07-17) ----
     Traced first: none of the 12 raw values below matched any existing
     reference token exactly (checked against the full --gt-ref-* scale
     above, including the visually-similar --gt-ref-result-item-issue-bg
     #fff5f5 and --gt-ref-badge-neutral-bg #eef0f2 — both close but NOT
     byte-identical to this family's own #FCF3F1/#f1f5f9, so kept
     distinct rather than force-merged, preserving Porcelain exactly).
     All 12 are genuine byte-copies of the pre-existing raw values.
     Studio+Command equivalents (style.css .theme-dark-desktop) reuse
     ALREADY-accepted anchors only — no new dark color fabricated:
     --gt-ref-studio-text-muted for every "inactive/administrative"
     status accent+chip (draft/cancelled/annulled/paused — these are
     non-actionable states, collapsed to ONE consistent muted Studio
     treatment rather than 3 fabricated new hues), --gt-ref-studio-
     surface-2 for their chip backgrounds (same pairing already used by
     DS-1B's neutral badge and the .splus-status-badge neutral state),
     and --gt-ref-studio-danger-bg for the results-widget issue-item
     background (same anchor already verified for the reception-results
     issue card in T18-11E — this is the SAME semantic "issue" state,
     just a distinct historical Porcelain hex on a different screen).
     --gt-ref-accent-solid-fg/--gt-ref-danger-solid-fg/--gt-ref-cta-
     gradient-top(-hover) are kept DELIBERATELY theme-neutral (no
     .theme-dark-desktop override), same rationale as DS-1F's
     --gt-solid-accent-bg/--gt-btn-danger-bg: they sit on solid fills
     this stage also pins theme-neutral (see style.css), so switching
     either half alone would reintroduce the exact ~2:1 contrast failure
     DS-1F already fixed once for .btn-primary/.quick-btn. */
  --gt-ref-cta-gradient-top:        #2C7AAE;
  --gt-ref-cta-gradient-top-hover:  #266F9F;
  --gt-ref-accent-solid-fg:         #F5FAFD;
  --gt-ref-danger-solid-fg:         #FFF6F5;
  --gt-ref-status-draft-chip-bg:    #f1f5f9;
  --gt-ref-status-draft-chip-fg:    #475569;
  --gt-ref-status-draft-accent:     #94a3b8;
  --gt-ref-status-cancelled-accent: #A9B2BF;
  --gt-ref-status-annulled-accent:  #8B7FC0;
  --gt-ref-status-admin-chip-bg:    #EDE9F7;
  /* PATH08-INSPECTION-PROGRESS-COHERENCE-01: was #6E5FB0 -- 4.48:1 on its own
     chip background, which is under AA by two hundredths and was under it on
     every «на паузе» badge, «Аннулирован» chip and «Н/П» tag in the light
     theme. #6A5BAA is the same hue two steps darker: 4.77:1. Light-theme only,
     for the same reason as the token above. */
  --gt-ref-status-admin-chip-fg:    #6A5BAA;
  --gt-ref-results-widget-issue-bg: #FCF3F1;

  /* ---- DS-1 package 2: shared desktop status/notice/intake/primary-
     action primitives (2026-07-17) ----
     Traced first: of the raw values in this package's inventory, MOST
     already byte-match existing reference tokens and reuse the
     existing SEMANTIC wrappers directly (no new token at all) —
     --gt-result-neutral-bg/-fg, --gt-result-issue-badge-bg/-fg,
     --gt-result-item-not-checked-border, --gt-result-ok-badge-bg,
     --gt-state-success-fg, --gt-state-warning-fg, --gt-result-skip-fg,
     --gt-btn-solid-fg — see style.css's own stage comment for the
     per-selector trace. Only 3 raw values had no match anywhere and are
     genuinely new (byte-copies of the pre-existing raw values):
     .insp-status-in_progress's background (#fef3c7 — its own text
     color #92400e already matched --gt-ref-state-warning-fg exactly),
     .seed-ok's border (#86efac — its bg/text already matched existing
     tokens), and .btn-primary:hover's background (#1d4ed8 — a distinct
     historical shade, not the same as --gt-accent-hover's Porcelain
     value). Studio+Command equivalents (style.css .theme-dark-desktop)
     reuse ALREADY-accepted anchors only: --gt-ref-studio-warning-bg for
     the new warning background (matching --gt-state-warning-fg's own
     existing --gt-ref-studio-warning Studio mapping), --gt-ref-studio-
     success for the new seed-ok border (same anchor already used for
     --gt-state-success-border/--gt-result-item-ok-border) — no new dark
     color fabricated for either. .btn-primary:hover's background stays
     DELIBERATELY theme-neutral (no .theme-dark-desktop override) — see
     style.css's own stage comment for why. */
  --gt-ref-state-warning-bg:        #fef3c7;
  --gt-ref-seed-ok-border:          #166534;
  --gt-ref-btn-primary-hover-bg:    #1d4ed8;

  /* ---- Deferred item 144 correction: 2 Porcelain contrast defects
     (2026-07-17) ----
     Owner-approved correction, disclosed (not fixed) at DS-1 package 2's
     own commit: `.wo-issue-none`'s foreground and `.seed-ok`'s border
     both cleared their Studio pairing but measured below WCAG against
     their OWN Porcelain background (2.31:1 text, needs 4.5:1; 1.28:1
     non-text border, needs 3:1) — because both had been wired to tokens
     whose Porcelain value was chosen for a DIFFERENT consumer's contrast
     need (a shared border token designed for a different, non-text use;
     an unrelated pale decorative literal), not derived for THEIR own
     background. Corrected here, Studio side UNCHANGED:
     --gt-ref-seed-ok-border's value corrected in place above (#86efac ->
     #166534, byte-identical to the ALREADY-accepted --gt-ref-state-
     success-fg — .seed-ok's own text color — reused, not fabricated) —
     its Studio mapping (style.css .theme-dark-desktop, --gt-ref-studio-
     success) is untouched, so Studio's computed value does not change.
     --gt-ref-wo-issue-none-fg is a NEW, dedicated reference token (kept
     separate from --gt-ref-result-item-not-checked-border, which is
     ALSO used by the unrelated `.results-item-not_checked` border-left —
     correcting the shared token would have changed that OTHER selector
     too, forbidden) — value byte-matches the ALREADY-accepted
     --gt-ref-table-header-fg (#4b5563), reused, not fabricated; its
     Studio mapping (style.css) reuses the SAME --gt-ref-studio-text-muted
     anchor `.wo-issue-none` already had, so Studio's computed value is
     UNCHANGED. */
  --gt-ref-wo-issue-none-fg: #4b5563;
}

