/* 01-tokens.css — Design tokens (v2).
   TradePad · every colour, radius, shadow, type size and motion curve the
   stylesheets use comes from here.

   Base colour tokens stay plain hex on purpose: js/analytics/charts.js and
   js/services/xlsx-export.js read them with getComputedStyle and paint them
   into SVG and Excel, and the time-of-day theme (js/core/theme-engine.js)
   writes them inline on <html>. Everything derived from them — the -dim
   tints, focus ring, glass, hover washes — is computed below with
   color-mix(), so a runtime theme only ever sets the base set and the rest
   follows on its own. */

:root{
  /* ── Surfaces (dark is the default scheme) ── */
  --bg:#07090D;
  --surf:#0E1117;
  --surf2:#141821;
  --surf3:#1B202B;
  --line:#1E2430;
  --line2:#2A3140;
  --ink:#E8EBF1;
  --dim:#A1AABA;
  --mute:#7A8596;

  /* ── Brand + semantic ──
     --acc is the accent as text/icon/border colour and must stay readable on
     --surf. --acc-fill is the accent as a background (primary buttons, active
     marks); --acc-ink is the text that sits on it. In dark they coincide; the
     light scheme keeps the vivid brand lime as a fill but darkens the text
     accent so it still passes contrast on white. */
  --acc:#C8FF3D;
  --acc-fill:#C8FF3D;
  --acc-ink:#0A0D12;
  --up:#34D399;
  --dn:#FF5C7C;
  --warn:#FFB547;
  --info:#6CB4FF;
  --live:#FF4D6D;

  /* ── Ambient light behind the page (time-of-day theme drifts these) ── */
  --amb-1:rgba(200,255,61,.06);
  --amb-2:rgba(96,165,250,.06);

  /* ── Derived — never set these from JS ── */
  --acc-dim:color-mix(in srgb,var(--acc) 12%,transparent);
  --acc-soft:color-mix(in srgb,var(--acc) 20%,transparent);
  --up-dim:color-mix(in srgb,var(--up) 12%,transparent);
  --dn-dim:color-mix(in srgb,var(--dn) 12%,transparent);
  --warn-dim:color-mix(in srgb,var(--warn) 13%,transparent);
  --info-dim:color-mix(in srgb,var(--info) 13%,transparent);
  --live-dim:color-mix(in srgb,var(--live) 16%,transparent);
  --hover:color-mix(in srgb,var(--ink) 5%,transparent);
  --press:color-mix(in srgb,var(--ink) 9%,transparent);
  --glass:color-mix(in srgb,var(--surf) 72%,transparent);
  --ring:0 0 0 3px color-mix(in srgb,var(--acc) 34%,transparent);

  /* ── Elevation ── */
  --sh-1:0 1px 2px rgba(0,0,0,.35);
  --sh-2:0 12px 32px -14px rgba(0,0,0,.6);
  --sh-3:0 30px 80px -28px rgba(0,0,0,.75);
  --hl:inset 0 1px 0 rgba(255,255,255,.045);

  /* ── Shape ── */
  --r-xs:8px;
  --r-sm:10px;
  --r-md:12px;
  --r-lg:16px;
  --r-xl:22px;
  --r-pill:999px;
  --fr:var(--r-md);           /* field radius — also used by inline styles in js/ */
  --fh:44px;                  /* field / button height — a 44px touch target */

  /* ── Type ── */
  --sans:'Vazirmatn',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  --mono:'JetBrains Mono','Vazirmatn',ui-monospace,SFMono-Regular,monospace;
  --fs-2xs:11px;
  --fs-xs:12px;
  --fs-sm:13px;
  --fs-md:14px;
  --fs-lg:16px;
  --fs-xl:20px;
  --fs-2xl:26px;

  /* ── Motion ── */
  --ease:cubic-bezier(.2,.8,.2,1);
  --ease-out:cubic-bezier(.16,1,.3,1);
  --spring:cubic-bezier(.34,1.4,.64,1);
  --t1:.12s;
  --t2:.2s;
  --t3:.34s;

  /* ── Layout ── */
  --rail:252px;
  --rail-c:76px;
  --top:64px;
  --maxw:1440px;
  --sat:env(safe-area-inset-top);
  --sab:env(safe-area-inset-bottom);

  color-scheme:dark;
}

html[data-theme="light"]{
  --bg:#F4F5F7;
  --surf:#FFFFFF;
  --surf2:#F8F9FB;
  --surf3:#EEF0F4;
  --line:#E4E7EC;
  --line2:#D3D8E0;
  --ink:#10141A;
  --dim:#4F5866;
  --mute:#636B78;

  --acc:#4B7B00;
  --acc-fill:#C8FF3D;
  --acc-ink:#0A0D12;
  --up:#067A55;
  --dn:#D12C47;
  --warn:#9A5C00;
  --info:#1A5DC8;
  --live:#C9253F;

  --amb-1:rgba(200,255,61,.20);
  --amb-2:rgba(96,165,250,.14);

  --hover:color-mix(in srgb,var(--ink) 4%,transparent);
  --press:color-mix(in srgb,var(--ink) 7%,transparent);
  --glass:color-mix(in srgb,var(--surf) 76%,transparent);
  --ring:0 0 0 3px color-mix(in srgb,var(--acc) 26%,transparent);

  --sh-1:0 1px 2px rgba(16,24,40,.06);
  --sh-2:0 12px 32px -16px rgba(16,24,40,.18);
  --sh-3:0 30px 80px -30px rgba(16,24,40,.30);
  --hl:inset 0 1px 0 rgba(255,255,255,.9);

  color-scheme:light;
}

/* ── Categorical chart slots (dashboard: one colour per instrument) ──────────
   Colour follows the instrument, never its rank: slots are handed out by the
   account's all-time trade count, so a range change or a filter never repaints
   a symbol. Five slots + "other" (a sixth series folds into --cat-other).
   Validated (dataviz palette validator, adjacent pairs): dark on #0E1117 —
   all checks pass, worst CVD ΔE 8.4, normal-vision 19.3, all ≥3:1; light on
   #FFFFFF — all checks pass, three slots under 3:1, so every mark carries a
   visible symbol label (the relief rule). */
:root{--cat1:#3987e5;--cat2:#d95926;--cat3:#199e70;--cat4:#c98500;--cat5:#d55181;--cat-other:var(--mute)}
html[data-theme="light"]{--cat1:#2a78d6;--cat2:#eb6834;--cat3:#1baf7a;--cat4:#eda100;--cat5:#e87ba4}
