/* ══════════════════════════════════════════════════════════════════════════
   SODA design tokens — the ONE source of colour, type, spacing, radius and
   shadow for the app (and, synced, the landing site).

   Dark is the default (:root). Light is :root[data-theme="light"], set on
   <html> by the tiny head script on every page before first paint.

   Names are --ds-* so they never collide with the legacy names in
   variables.css / theme.css. Step 2 of the migration points those legacy
   names at these tokens; Step 5 removes the legacy names.

   Rules (Alex, 2026-10-01):
   - Monotone UI, ONE accent (links + focus only). Primary buttons are
     monotone (text-coloured fill), never the accent.
   - Green/red ONLY for profit/loss numbers and text (--ds-pnl-*). Red is
     otherwise used only for errors (--ds-danger). Running-bot status dots
     stay green (--ds-status-on). Amber = --ds-warn (paused / warning).
   - Inter for everything; numbers use tabular figures (plain zero). Code
     (Pine, JSON, keys) uses the system monospace.
   - Minimum text 12px; minimum tap target 44px.
   ══════════════════════════════════════════════════════════════════════════ */

:root {                                   /* DARK (default) */
  color-scheme: dark;
  --ds-bg:            #0A0A0B;
  --ds-sidebar:       #0D0D0F;
  --ds-surface:       #131315;
  --ds-hover:         #1C1C20;
  --ds-border:        #232327;
  --ds-border-strong: #3A3A40;   /* form controls / focusable edges need >=3:1 */
  --ds-text:          #EDEDEF;
  --ds-muted:         #A1A1A8;
  --ds-label:         #8C8C93;
  --ds-accent:        #7C9CFF;   /* links + focus ONLY */
  --ds-accent-soft:   rgba(124, 156, 255, .14);
  --ds-on-primary:    #0A0A0B;   /* text on a monotone (text-coloured) primary button */
  --ds-pnl-up:        #3DD68C;
  --ds-pnl-down:      #FF6B6B;
  --ds-danger:        #FF6B6B;
  --ds-danger-soft:   rgba(255, 107, 107, .12);
  --ds-warn:          #E0A43B;
  --ds-warn-soft:     rgba(224, 164, 59, .14);
  --ds-status-on:     #3DD68C;   /* running-bot dot */
  --ds-status-off:    #6E6E76;   /* stopped-bot dot */
  --ds-overlay:       rgba(0, 0, 0, .62);
  --ds-shadow-sm:     none;
  --ds-shadow-md:     0 8px 24px rgba(0, 0, 0, .45);
  --ds-shadow-lg:     0 16px 48px rgba(0, 0, 0, .55);
  --ds-focus-ring:    0 0 0 2px var(--ds-bg), 0 0 0 4px var(--ds-accent);
}

:root[data-theme="light"] {
  color-scheme: light;
  --ds-bg:            #FAFAF9;
  --ds-sidebar:       #F4F4F2;
  --ds-surface:       #FFFFFF;
  --ds-hover:         #F0F0EE;
  --ds-border:        #E4E4E1;
  --ds-border-strong: #C9C9C4;
  --ds-text:          #111113;
  --ds-muted:         #5C5C63;
  --ds-label:         #6B6B72;
  --ds-accent:        #3550C8;
  --ds-accent-soft:   rgba(53, 80, 200, .10);
  --ds-on-primary:    #FFFFFF;
  --ds-pnl-up:        #0F7A45;
  --ds-pnl-down:      #C2352B;
  --ds-danger:        #C2352B;
  --ds-danger-soft:   rgba(194, 53, 43, .08);
  --ds-warn:          #9A600A;   /* 5.2:1 under white text */
  --ds-warn-soft:     rgba(154, 96, 10, .10);
  --ds-status-on:     #1F9D5C;
  --ds-status-off:    #A1A1A8;
  --ds-overlay:       rgba(17, 17, 19, .38);
  --ds-shadow-sm:     0 1px 2px rgba(0, 0, 0, .05);
  --ds-shadow-md:     0 8px 24px rgba(0, 0, 0, .08);
  --ds-shadow-lg:     0 16px 48px rgba(0, 0, 0, .12);
}

:root {
  /* Type */
  --ds-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* Numbers, prices, P&L and small uppercase labels: Inter with tabular figures
     (plain zero). Geist Mono removed 2026-10-12 (Alex: no slashed zero). */
  --ds-font-num:  var(--ds-font-sans);
  /* Code only (Pine scripts, JSON, API keys, IDs): the system monospace. */
  --ds-font-mono: ui-monospace, Menlo, Consolas, 'Liberation Mono', monospace;
  --ds-fs-12: 12px;   /* labels, meta (the minimum) */
  --ds-fs-13: 13px;   /* small text, table cells */
  --ds-fs-14: 14px;   /* body */
  --ds-fs-16: 16px;   /* section titles, lead */
  --ds-fs-20: 20px;
  --ds-fs-24: 24px;
  --ds-fs-32: 32px;   /* hero numbers */
  --ds-label-tracking: .06em;

  /* Spacing (4px grid) */
  --ds-sp-1: 4px;  --ds-sp-2: 8px;  --ds-sp-3: 12px; --ds-sp-4: 16px;  --ds-sp-5: 20px;
  --ds-sp-6: 24px; --ds-sp-8: 32px; --ds-sp-10: 40px; --ds-sp-12: 48px; --ds-sp-16: 64px;

  /* Radius */
  --ds-r-sm: 6px;     /* inputs, chips */
  --ds-r-md: 10px;    /* cards, buttons */
  --ds-r-lg: 14px;    /* modals, sheets */
  --ds-r-pill: 999px;

  /* Sizing */
  --ds-tap: 44px;     /* minimum tap target */
}

/* Tabular figures everywhere (columns of numbers line up). Only tabular-nums:
   no font-feature-settings, so no slashed zero (the reason the old global
   "font-variant-numeric: normal !important" reset existed, 2026-03-08). */
html { font-variant-numeric: tabular-nums; }

/* Numbers, prices, P&L and small uppercase labels: Inter, tabular figures. */
.ds-num { font-family: var(--ds-font-num); font-variant-numeric: tabular-nums; }
.ds-label-caps {
  font-family: var(--ds-font-num); font-size: var(--ds-fs-12); font-weight: 500;
  text-transform: uppercase; letter-spacing: var(--ds-label-tracking); color: var(--ds-label);
}
.ds-pnl-up   { color: var(--ds-pnl-up); }
.ds-pnl-down { color: var(--ds-pnl-down); }
