/* Kadran design tokens (app copy of design/tokens/kadran.css; keep in sync, then run build-inject.mjs).
   Dark = :root, :root.theme-dark, [data-theme=dark]. Light = [data-theme=light] or no theme-dark class (library iframe). */
/* Kadran design tokens v1.0 (2026-10-17) — primary direction, chosen by Senih.
   Source of truth for every screen. Semantic names only; components never use raw hex.
   Contrast: every text/background pair below passes WCAG AA (4.5:1) — see design/README.md. */
:root,
:root.theme-dark,
[data-theme="dark"] {
  color-scheme: dark;
  /* surfaces: device body → plate → raised key → recessed well */
  --bg: #1C1D1F;          /* device body, page background */
  --surface: #26282B;     /* plates: header, side panels, cards */
  --raised: #2F3236;      /* key tops, hovered rows, menus */
  --well: #151618;        /* recessed: chart pane, inputs, LCD, switch track */
  --line: #3A3D41;        /* 1px borders and separators */
  --line-strong: #4A4E53; /* focused borders, table header rule */
  /* text */
  --text: #ECEAE5;
  --text-2: #A29F97;      /* secondary text, labels, axis text */
  --text-3: #6F6C66;      /* disabled, placeholder (not for reading text) */
  /* signal: one yellow, means "active / attention" */
  --accent: #F2B01E;      /* fills: active key, active segment, alert badge, LED */
  --accent-ink: #1C1D1F;  /* text/icons on --accent */
  --accent-text: #F2B01E; /* accent as text on surfaces */
  /* market direction */
  --up: #5CC08F;
  --down: #F5806A;
  --flat: var(--text-2);
  --danger: var(--down);  /* destructive actions and errors reuse down */
  /* tactile shading (derived, no new hues) */
  --hi: rgba(255,255,255,.07);
  --shade: rgba(0,0,0,.45);
  --well-shade: rgba(0,0,0,.55);
  --key-top: #34373B; --key-bot: #2A2C30;
  --led-off: #3A3D41;
  --grille: #0F1012;
  /* tooltip: inverted surface; secondary text and direction colours are the other theme's values (contrast on the inverted fill) */
  --tip-bg: var(--text); --tip-text: var(--bg); --tip-text-2: #636059; --tip-up: #24704F; --tip-down: #B23C25;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  /* chart */
  --chart-bg: var(--well);
  --chart-grid: rgba(236,234,229,.07);
  --chart-axis-text: var(--text-2);
  --chart-crosshair: rgba(236,234,229,.45);
  --chart-volume-up: rgba(92,192,143,.35);
  --chart-volume-down: rgba(245,128,106,.35);
  --chart-ma-1: var(--accent);
  --chart-ma-2: #C9C6BF;
  --chart-band: rgba(242,176,30,.10);
  /* data series (yields, strategy compare, options legs): ≥5:1 on --chart-bg; order = priority */
  --series-1: #F2B01E; --series-2: #ECEAE5; --series-3: #7AA7C7; --series-4: #C39AD0;
  --series-5: #D9A57A; --series-6: #A9B665; --series-7: #6FB7B0; --series-8: #8D8A84;
  /* Watchlist flags: each name keeps its hue (red is red), muted to sit with the palette. */
  --flag-red: #E06A5A; --flag-orange: #E8994A; --flag-green: #6DBE7F; --flag-blue: #6E9FD8;
  --flag-purple: #A88BD6; --flag-cyan: #5DBDC9; --flag-pink: #D984B0;
  /* heatmap diverging −3…+3 (tile fill). Tile text: --heat-ink-3 on ±3, --heat-ink-2 on ±2, --text on ±1 and 0 (all ≥4.5:1) */
  --heat-m3: #F5806A; --heat-m2: #C86B58; --heat-m1: #6E4A42; --heat-0: #3A3D41;
  --heat-p1: #3F5E4E; --heat-p2: #4F9C76; --heat-p3: #5CC08F; --heat-ink-3: #151618; --heat-ink-2: #151618;
  /* sequential map ramp 0…5 + no data */
  --seq-0: #2F3236; --seq-1: #4A4433; --seq-2: #6B5A2E; --seq-3: #977724; --seq-4: #C6951F; --seq-5: #F2B01E; --seq-na: #26282B;
}
/* Light: ?theme / theme.js set data-theme="light". The chart library's iframe sets only the theme-dark class for dark,
   so a root with neither the class nor data-theme="dark" is light. */
[data-theme="light"],
:root:not(.theme-dark):not([data-theme="dark"]) {
  color-scheme: light;
  --bg: #E8E6E1;
  --surface: #F4F3EF;
  --raised: #FBFAF7;
  --well: #FBFAF7;
  --line: #D2CFC8;
  --line-strong: #BDB9B0;
  --text: #1F1F1E;
  --text-2: #636059;
  --text-3: #9C988F;
  --accent: #F2A900;
  --accent-ink: #1F1F1E;
  --accent-text: #7A5500; /* yellow fails as small text on light; use this */
  --up: #24704F;
  --down: #B23C25;
  --flat: var(--text-2);
  --danger: var(--down);
  --hi: rgba(255,255,255,.95);
  --shade: rgba(60,50,30,.16);
  --well-shade: rgba(60,50,30,.18);
  --key-top: #FBFAF7; --key-bot: #ECEAE4;
  --led-off: #CFCCC4;
  --grille: #BDBAB2;
  --tip-bg: var(--text); --tip-text: var(--bg); --tip-text-2: #A29F97; --tip-up: #5CC08F; --tip-down: #F5806A;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px #1F1F1E;
  --chart-bg: var(--well);
  --chart-grid: rgba(31,31,30,.075);
  --chart-axis-text: var(--text-2);
  --chart-crosshair: rgba(31,31,30,.45);
  --chart-volume-up: rgba(36,112,79,.30);
  --chart-volume-down: rgba(178,60,37,.30);
  --chart-ma-1: #A87400; /* 3:1+ on the light well */
  --chart-ma-2: #3A3936;
  --chart-band: rgba(242,169,0,.12);
  --series-1: #A87400; --series-2: #1F1F1E; --series-3: #2F6A92; --series-4: #7A4C8C;
  --series-5: #9A5B2C; --series-6: #5E6B1F; --series-7: #1F6F69; --series-8: #6E6B65;
  --flag-red: #B53A2A; --flag-orange: #B5651B; --flag-green: #2E7D46; --flag-blue: #2F62A8;
  --flag-purple: #6E4AA8; --flag-cyan: #1F7F8C; --flag-pink: #A8457A;
  --heat-m3: #B23C25; --heat-m2: #D4806D; --heat-m1: #EBC2B7; --heat-0: #E8E6E1;
  --heat-p1: #B9D3C5; --heat-p2: #6FA48A; --heat-p3: #24704F; --heat-ink-3: #FBFAF7; --heat-ink-2: #1F1F1E;
  --seq-0: #F4F3EF; --seq-1: #F6E7BF; --seq-2: #F4D78C; --seq-3: #F2C24F; --seq-4: #D99A00; --seq-5: #9A6B00; --seq-na: #DEDBD4;
}
/* mode-independent scales */
:root {
  --font-ui: "Hanken Grotesk", system-ui, sans-serif;
  --font-num: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  /* type scale (px): label 10.5 caps / 12 / 13 base / 14 / 16 / 20 / 28 LCD */
  --fs-label: 10.5px; --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-lcd: 28px;
  --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600;
  --tracking-label: .09em;
  /* spacing: 6px grid with a 3px half step */
  --s-1: 3px; --s-2: 6px; --s-3: 9px; --s-4: 12px; --s-5: 18px; --s-6: 24px; --s-7: 36px; --s-8: 48px;
  /* sizes */
  --row-h: 30px; --row-h-dense: 26px; --ctl-h: 34px; --ctl-h-sm: 28px; --key: 34px; --key-sm: 30px;
  /* radius */
  --r-xs: 3px; --r: 6px; --r-pill: 999px; --r-key: 50%;
  /* motion: mechanical, no bounce */
  --ease: cubic-bezier(.22,1,.36,1);
  --t-press: 80ms; --t-fast: 120ms; --t-base: 180ms; --t-panel: 240ms;
}
@media (prefers-reduced-motion: reduce) { :root { --t-press: 0ms; --t-fast: 0ms; --t-base: 0ms; --t-panel: 0ms; } }
