/* CDMS design tokens — the single source for colour, type, spacing and radius.
   Dark navy is the default; <html data-theme="light"> switches to the light palette.
   Every component reads these variables, so a new page picks up the design automatically. */
:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #0a1120;
  --surface: #0f1829;
  --surface-2: #142034;
  --surface-3: #1a2840;
  --surface-hover: #182540;
  --border: #1f2d47;
  --border-strong: #2a3b5c;
  --overlay: rgba(3, 8, 18, .66);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .28);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .32);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, .45);

  /* Text */
  --text: #e7edf7;
  --text-2: #a7b4ca;
  --text-3: #73839f;
  --text-inverse: #ffffff;

  /* Accent (blue) */
  --accent: #3b82f6;
  --accent-hover: #5592f7;
  --accent-press: #2a6fe0;
  --accent-soft: rgba(59, 130, 246, .14);
  --accent-text: #8fb8ff;
  --focus-ring: 0 0 0 3px rgba(59, 130, 246, .38);

  /* Semantic */
  --success: #22c55e;  --success-soft: rgba(34, 197, 94, .13);  --success-text: #6ee7a0;
  --warning: #f59e0b;  --warning-soft: rgba(245, 158, 11, .14); --warning-text: #fcc864;
  --danger: #ef4444;   --danger-soft: rgba(239, 68, 68, .14);   --danger-text: #fca5a5;
  --info: #38bdf8;     --info-soft: rgba(56, 189, 248, .13);    --info-text: #8fd8fb;
  --purple: #8b5cf6;   --purple-soft: rgba(139, 92, 246, .16);  --purple-text: #c4b1fd;
  --neutral-soft: rgba(148, 163, 184, .14); --neutral-text: #aeb9cb;

  /* Shell (sidebar stays navy in both themes) */
  --nav-bg: #08101e;
  --nav-border: #17233a;
  --nav-text: #b3c0d6;
  --nav-text-muted: #61728f;
  --nav-hover: rgba(255, 255, 255, .05);
  --nav-active: rgba(59, 130, 246, .16);
  --nav-active-text: #ffffff;
  --brand-gold: #d4a152;

  /* Charts */
  --chart-1: #3b82f6; --chart-2: #22c55e; --chart-3: #ef4444; --chart-grid: #1f2d47;

  /* Typography */
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --fs-page: 22px;      /* Page title */
  --fs-section: 16px;   /* Section title */
  --fs-card: 14.5px;    /* Card / panel title */
  --fs-body: 14px;      /* Main content */
  --fs-table: 13.5px;
  --fs-label: 13px;     /* Field label */
  --fs-secondary: 13px; /* Secondary text */
  --fs-helper: 12px;    /* Helper text, meta */
  --fs-micro: 11px;     /* Overlines, counters */
  --lh: 1.6;

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

  /* Radius */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-pill: 999px;

  /* Controls */
  --control-h: 38px;
  --control-h-sm: 30px;
  --control-h-lg: 44px;

  /* Layout */
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --content-max: 1520px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --surface-hover: #f2f6fc;
  --border: #e2e8f0;
  --border-strong: #cdd6e3;
  --overlay: rgba(15, 23, 42, .42);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .09);
  --shadow-lg: 0 20px 48px rgba(15, 23, 42, .16);

  --text: #0f1b2d;
  --text-2: #475569;
  --text-3: #7a879b;

  --accent: #2563eb;
  --accent-hover: #1d55d6;
  --accent-press: #1a49b8;
  --accent-soft: rgba(37, 99, 235, .09);
  --accent-text: #1d4ed8;
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, .25);

  --success: #16a34a;  --success-soft: #e8f7ee; --success-text: #15803d;
  --warning: #d97706;  --warning-soft: #fdf3e1; --warning-text: #a35b04;
  --danger: #dc2626;   --danger-soft: #fdecec;  --danger-text: #b91c1c;
  --info: #0284c7;     --info-soft: #e5f4fb;    --info-text: #0369a1;
  --purple: #7c3aed;   --purple-soft: #f1ebfe;  --purple-text: #6d28d9;
  --neutral-soft: #eef1f5; --neutral-text: #556274;

  --chart-grid: #e5eaf1;
}
