/* ======================================================================
   ValueSight Design Tokens — v1.0 (May 2026)
   Source of truth: docs/design/valuesight-design.md
   Sections referenced: §3 (color), §5 (spacing), §6 (radius),
                        §7.2 (shadows), §9.1 (duration), §9.2 (easing).

   IMPORTANT: All new UI work MUST use these tokens. Do not hardcode
   color, spacing, radius, shadow, or motion values.
   ====================================================================== */

:root {
  /* ── §3.1 Surfaces ────────────────────────────────────────────── */
  --surface-base: #FCF8F9;        /* Page background, warm white */
  --surface-panel: #FFFFFF;       /* Elevated cards, modals, rails */
  --surface-dim: #F2ECEE;         /* Subtle elevation for dim surfaces (list headers, filter chips, status pill backgrounds, cell-mode emphasis) */
  --surface-raised: #F8F4F5;      /* Hover state on rows, subtle elevation */
  --surface-inverse: #1B222E;     /* Top bar, dark headers, high-contrast surfaces */
  --surface-overlay: rgba(27, 34, 46, 0.4);  /* Modal scrim */

  /* ── §3.2 Brand and intelligence ─────────────────────────────── */
  --brand-primary: #2D5A4C;       /* Mineral green — brand mark, active, primary action */
  --brand-primary-hover: #244A3F;
  --brand-primary-tint: #E8F0ED;  /* Brand at ~10% — subtle backgrounds */
  --brand-primary-fade: rgba(45, 90, 76, 0.08);  /* selection backgrounds */

  --anchor: #1B222E;              /* Deep navy: primary text, top bar, anchoring */
  --anchor-hover: #0F1620;
  --anchor-raised: #232B38;       /* §3 (foundational-updates-may-2026): anchor +6% lightness for sidebar hover/active rows, bulk action bar dividers, ⌘K dividers */

  --vega: #2D5A4C;                /* Vega uses brand color, distinguished by mark + stripe */
  --vega-stripe: #2D5A4C;         /* 2px left accent on Vega-authored cards */

  /* ── §3.3 Semantic (financial) ───────────────────────────────── */
  /* Brand mineral green NEVER represents "things going up" — use --positive. */
  --positive: #3B7A5C;
  --positive-tint: #EAF3EE;
  --negative: #B8273B;
  --negative-tint: #FBEAED;
  --warning: #C28A1C;
  --warning-tint: #FAF1DE;
  --info: #1B222E;

  /* ── §3.4 Text ───────────────────────────────────────────────── */
  --text-primary: #1B222E;
  --text-secondary: #4A5568;
  --text-tertiary: #6B7380;
  --text-disabled: rgba(27, 34, 46, 0.30);
  --text-on-brand: #FFFFFF;
  --text-on-anchor: #FFFFFF;
  --text-accent: #2D5A4C;

  /* ── §3.5 Borders ────────────────────────────────────────────── */
  --border-subtle: #F2ECEE;
  --border-default: #E5E1E2;
  --border-strong: #C5C6CC;
  --border-brand: #2D5A4C;
  --border-focus: #2D5A4C;

  /* ── §3.6 Tier indicators (provenance) ───────────────────────── */
  --tier-validated: #3B7A5C;      /* Customer-validated value */
  --tier-corpus: var(--text-tertiary); /* From benchmark corpus — true gray, distinct from --brand-primary. See ADR 0014. */
  --tier-inferred: #C28A1C;       /* Vega-inferred */
  --tier-override: #6B7380;       /* User override */

  /* ── §5 Spacing (8px base, 4px sub-grid) ─────────────────────── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* ── §6 Border radius (no element exceeds 8px) ───────────────── */
  --radius-sm: 4px;     /* Inputs, buttons, chips, pills, table cells */
  --radius-md: 6px;     /* Cards, panels, popovers */
  --radius-lg: 8px;     /* Modals, app shell containers */

  /* ── §7.2 Shadows (popovers / dropdowns / modals only) ──────── */
  /* No box-shadow on cards, rows, buttons, inputs, or any in-flow element. */
  --shadow-popover: 0 4px 12px rgba(27, 34, 46, 0.08);
  --shadow-modal:   0 16px 48px rgba(27, 34, 46, 0.12);
  --shadow-rail:    0 0 24px rgba(27, 34, 46, 0.04);

  /* ── §9.1 Motion durations ───────────────────────────────────── */
  --duration-instant:    80ms;
  --duration-fast:      160ms;
  --duration-base:      220ms;
  --duration-slow:      320ms;
  --duration-deliberate: 480ms;

  /* ── §9.2 Motion easings (no spring, no overshoot) ──────────── */
  --ease-standard: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:       cubic-bezier(0.7, 0, 0.84, 0);
  --ease-linear:   linear;
}

/* ── §3.7 Dark mode resolution ────────────────────────────────── */
[data-theme="dark"] {
  --surface-base:   #0F1620;
  --surface-panel:  #1B222E;
  --surface-dim:    #161D27;
  --surface-raised: #232B38;
  --surface-inverse: #FCF8F9;
  --surface-overlay: rgba(0, 0, 0, 0.55);

  --text-primary:   rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.65);
  --text-tertiary:  rgba(255, 255, 255, 0.45);
  --text-disabled:  rgba(255, 255, 255, 0.30);

  --border-subtle:  rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.10);
  --border-strong:  rgba(255, 255, 255, 0.16);

  /* Brand and semantic colors remain unchanged — green/red/gold work in both modes. */

  /* Tints darken slightly in dark mode for contrast. */
  --brand-primary-tint: rgba(45, 90, 76, 0.18);
  --brand-primary-fade: rgba(45, 90, 76, 0.14);
  --positive-tint:      rgba(59, 122, 92, 0.16);
  --negative-tint:      rgba(184, 39, 59, 0.16);
  --warning-tint:       rgba(194, 138, 28, 0.16);

  /* Shadows are heavier in dark mode for visibility. */
  --shadow-popover: 0 4px 12px rgba(0, 0, 0, 0.40);
  --shadow-modal:   0 16px 48px rgba(0, 0, 0, 0.55);
  --shadow-rail:    0 0 24px rgba(0, 0, 0, 0.35);
}
