/* Design tokens. Dark is the default; [data-theme="light"] redefines colours.
   The chart reads the colour tokens at runtime (chart.js → readTokens). */

:root {
  /* Surfaces */
  --bg: #0B0E13;
  --panel: #11161D;
  --panel-2: #161C25;
  --border: #1E2630;
  --border-strong: #2A3441;
  --hover: #1A212B;
  --selected: #17243A;

  /* Text */
  --text: #E6EAF0;
  --muted: #8A94A6;
  --faint: #5D6777;

  /* Accent and semantic */
  --accent: #4C8DFF;
  --accent-soft: rgba(76, 141, 255, 0.14);
  --on-accent: #0B0E13;
  --up: #22C55E;
  --down: #EF4444;
  --amber: #F5B544;
  --amber-soft: rgba(245, 181, 68, 0.14);

  /* Chart */
  --chart-bg: #0B0E13;
  --chart-grid: #151B23;
  --candle-up: #22C55E;
  --candle-down: #EF4444;
  --volume-alpha: 0.42;
  --sma: #F5B544;
  --rsi14: #4C8DFF;
  --rsi9: #C084FC;
  --atr: #2DD4BF;
  --rsi-band: rgba(76, 141, 255, 0.08);
  --rsi-level: #3A4554;
  --filtered: #8A94A6;
  --stop: #EF4444;
  --cross: #4C8DFF;
  --signal: #4C8DFF;

  /* Skeleton */
  --skeleton: #18202A;
  --skeleton-hi: #212B37;

  /* Type */
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-num: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-lg: 15px;
  --fs-xl: 18px;

  /* Spacing: 4 px grid */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;

  --radius: 6px;
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--border-strong);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  --t: 120ms ease;

  --scan-width: 392px;
  --fund-width: 460px;
  --news-width: 480px;
  --tap: 32px;

  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #F6F7F9;
  --panel: #FFFFFF;
  --panel-2: #F1F3F6;
  --border: #E2E6EC;
  --border-strong: #CDD3DC;
  --hover: #EEF1F5;
  --selected: #E3ECFF;

  --text: #121821;
  --muted: #566173;
  --faint: #7D8796;

  --accent: #2563EB;
  --accent-soft: rgba(37, 99, 235, 0.10);
  --on-accent: #FFFFFF;
  /* Darker semantic colours for text contrast on white (≥ 4.5:1) */
  --up: #15803D;
  --down: #B91C1C;
  /* Amber text darker than the SMA line (#B7791F is 3.4:1 on white) */
  --amber: #8A5A0B;
  --amber-soft: rgba(183, 121, 31, 0.12);

  --chart-bg: #FFFFFF;
  --chart-grid: #F0F2F5;
  --candle-up: #16A34A;
  --candle-down: #DC2626;
  --volume-alpha: 0.38;
  --sma: #B7791F;
  --rsi14: #2563EB;
  --rsi9: #9333EA;
  --atr: #0F766E;
  --rsi-band: rgba(37, 99, 235, 0.07);
  --rsi-level: #B8C0CC;
  --filtered: #7D8796;
  --stop: #DC2626;
  --cross: #2563EB;
  --signal: #2563EB;

  --skeleton: #E9ECF1;
  --skeleton-hi: #F3F5F8;

  --shadow-pop: 0 8px 24px rgba(16, 24, 40, 0.14), 0 0 0 1px var(--border-strong);

  color-scheme: light;
}
