/* ============================================================
   VIEWIDER PRODUCT RESEARCH — Design Tokens
   Editorial-admin. Cool neutrals. Single deep-blue accent.
   ============================================================ */

:root {
  /* ----- Surface (cool whites) ----- */
  --surface-0:    oklch(98.5% 0.003 250);   /* page */
  --surface-1:    oklch(100% 0 0);          /* card */
  --surface-2:    oklch(96.5% 0.005 250);   /* sunken / hover */
  --surface-3:    oklch(93%   0.007 250);   /* rail */
  --surface-ink:  oklch(18%   0.012 255);   /* inverted bars */

  /* ----- Foreground ----- */
  --fg-1:  oklch(18%  0.012 255);   /* primary text */
  --fg-2:  oklch(38%  0.010 255);   /* body / secondary */
  --fg-3:  oklch(58%  0.008 255);   /* tertiary / meta */
  --fg-4:  oklch(72%  0.006 255);   /* placeholder / axis */
  --fg-on-ink: oklch(96% 0.003 250);

  /* ----- Accent (deep operational blue) ----- */
  --accent:        oklch(52%  0.17 255);
  --accent-hover:  oklch(46%  0.18 255);
  --accent-soft:   oklch(94%  0.035 255);
  --accent-ink:    oklch(32%  0.14 255);

  /* ----- Status (matched chroma/lightness for harmony) ----- */
  --ok-fg:     oklch(46%  0.13 155);
  --ok-soft:   oklch(94%  0.04 155);
  --warn-fg:   oklch(52%  0.13 70);
  --warn-soft: oklch(95%  0.05 75);
  --bad-fg:    oklch(50%  0.17 25);
  --bad-soft:  oklch(95%  0.04 25);
  --info-fg:   var(--accent);
  --info-soft: var(--accent-soft);

  /* ----- Borders ----- */
  --line-1: oklch(91% 0.006 250);   /* hairline */
  --line-2: oklch(86% 0.008 250);   /* defined */
  --line-3: oklch(75% 0.010 250);   /* strong */

  /* ----- Type ----- */
  --f-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --f-display: 'Inter', ui-sans-serif, sans-serif;

  /* Type scale — editorial, tighter than SaaS default */
  --t-display:  46px / 1.05 var(--f-display);
  --t-h1:       32px / 1.15 var(--f-display);
  --t-h2:       22px / 1.25 var(--f-display);
  --t-h3:       16px / 1.35 var(--f-sans);
  --t-body:     14px / 1.55 var(--f-sans);
  --t-sm:       13px / 1.45 var(--f-sans);
  --t-xs:       12px / 1.4  var(--f-sans);
  --t-eyebrow:  11px / 1.3  var(--f-sans);       /* uppercase, tracked */
  --t-mono:     13px / 1.4  var(--f-mono);
  --t-mono-sm:  12px / 1.4  var(--f-mono);

  /* ----- Spacing (4px grid) ----- */
  --s-0: 0;
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  /* ----- Radii ----- */
  --r-0: 0;
  --r-1: 2px;
  --r-2: 4px;
  --r-3: 6px;
  --r-3a: 8px;  /* added 2026-05-28 per Phase B token reconciliation §10.1 — fills gap between --r-3 (6px) and --r-4 (10px) */
  --r-4: 10px;
  --r-pill: 999px;

  /* ----- Font weights (named, for utility usage) ----- */
  /* added 2026-05-28 per Phase B token reconciliation §10.1 */
  --w-normal: 400;
  --w-medium: 500;
  --w-bold: 700;

  /* ----- Elevation (subtle — editorial, not glossy) ----- */
  --e-1: 0 1px 0 oklch(85% 0.01 250 / 0.4);
  --e-2: 0 1px 2px oklch(20% 0.01 250 / 0.06), 0 0 0 1px var(--line-1);
  --e-3: 0 8px 24px oklch(20% 0.01 250 / 0.08), 0 0 0 1px var(--line-2);
  --e-pop: 0 16px 48px oklch(15% 0.01 250 / 0.16);

  /* ----- Motion ----- */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --d-fast: 120ms;
  --d-med:  200ms;
  --d-slow: 320ms;

  /* ----- Grid ----- */
  --col-max: 1440px;
  --col-wide: 1600px;
  --rail: 256px;
  --row-h: 44px;
}

/* Dark mode */
[data-theme="dark"] {
  --surface-0: oklch(16% 0.008 255);
  --surface-1: oklch(20% 0.010 255);
  --surface-2: oklch(24% 0.012 255);
  --surface-3: oklch(28% 0.014 255);
  --surface-ink: oklch(10% 0.008 255);
  --fg-1: oklch(96% 0.003 250);
  --fg-2: oklch(78% 0.006 250);
  --fg-3: oklch(62% 0.008 250);
  --fg-4: oklch(48% 0.008 250);
  --fg-on-ink: oklch(96% 0.003 250);
  --line-1: oklch(28% 0.010 255);
  --line-2: oklch(36% 0.012 255);
  --line-3: oklch(48% 0.015 255);
  --accent: oklch(68% 0.16 255);
  --accent-hover: oklch(74% 0.15 255);
  --accent-soft: oklch(28% 0.08 255);
  --e-2: 0 1px 2px oklch(0% 0 0 / 0.4), 0 0 0 1px var(--line-1);
  --e-3: 0 8px 24px oklch(0% 0 0 / 0.4), 0 0 0 1px var(--line-2);
}

/* Density */
[data-density="compact"] {
  --row-h: 36px;
  --s-4: 12px;
  --s-5: 18px;
}
[data-density="comfy"] {
  --row-h: 52px;
  --s-5: 28px;
  --s-6: 36px;
}

/* ----- Base ----- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: var(--t-body);
  color: var(--fg-1);
  background: var(--surface-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01", "ss03";
}

/* Numerals tabular by default inside tables & metrics */
.tabular, table, .metric, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--f-mono); }
.eyebrow {
  font: var(--t-eyebrow);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-3);
  font-weight: 500;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

/* Scrollbars — slim, editorial */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid var(--surface-0); }
*::-webkit-scrollbar-thumb:hover { background: var(--line-3); }

/* Selection */
::selection { background: var(--accent-soft); color: var(--accent-ink); }
