/* ── CMAI Design Tokens ── */
:root {
  --bg: #0a0b0f;
  --bg2: #0f1117;
  --bg3: #151720;
  --bg4: #1c1f2e;
  --bg5: #242840;
  --surface: #1a1d2b;
  --surface2: #222638;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --border3: rgba(255,255,255,0.18);
  --border-control: #6d728b;
  --text: #e8eaf0;
  --text2: #aaadbf;
  --text3: #898fac;
  --green: #34d399;
  --green-bg: rgba(52,211,153,0.1);
  --green-border: rgba(52,211,153,0.25);
  --amber: #fbbf24;
  --amber-bg: rgba(251,191,36,0.1);
  --amber-border: rgba(251,191,36,0.25);
  --blue: #60a5fa;
  --blue-bg: rgba(96,165,250,0.1);
  --blue-border: rgba(96,165,250,0.25);
  --red: #f87171;
  --red-bg: rgba(248,113,113,0.1);
  --red-border: rgba(248,113,113,0.25);
  --purple: #a78bfa;
  --purple-bg: rgba(167,139,250,0.1);
  --purple-border: rgba(167,139,250,0.25);
  --cyan: #22d3ee;
  --cyan-bg: rgba(34,211,238,0.1);
  --cyan-border: rgba(34,211,238,0.25);
  --blue-light: #93c5fd;
  --on-accent: #0a0b0f;
  --btn-primary-hover: #93c5fd;
  --btn-success-hover: #6ee7b7;
  --chip-bg: rgba(255,255,255,0.05);
  --overlay: rgba(0,0,0,0.55);
  --shadow: rgba(0,0,0,0.4);
  --font: 'DM Sans', sans-serif;
  --mono: 'IBM Plex Mono', monospace;
  --serif: 'Instrument Serif', serif;
  /* TTC brand (assets/brand): help button badge and its ring of dots */
  --brand-orange: #F46322;
  --brand-orange-mid: #CC5526;
  --brand-brown: #67322E;
  --brand-navy: #030F37;
  --brand-badge-ring: #A9BCCA;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --sidebar-width: 220px;
  --topbar-height: 52px;
  color-scheme: dark;
}

/* ── Light theme (Settings → Appearance; set on <html data-theme="light">) ── */
:root[data-theme="light"] {
  --brand-badge-ring: transparent;
  --bg: #f5f6fa;
  --bg2: #ffffff;
  --bg3: #eef0f5;
  --bg4: #e4e7ef;
  --bg5: #d8dce8;
  --surface: #ffffff;
  --surface2: #f0f2f7;
  --border: rgba(15,23,42,0.08);
  --border2: rgba(15,23,42,0.14);
  --border3: rgba(15,23,42,0.22);
  --border-control: #848892;
  --text: #161a26;
  --text2: #4b5268;
  --text3: #5e647b;
  --green: #047552;
  --green-bg: rgba(5,150,105,0.1);
  --green-border: rgba(5,150,105,0.3);
  --amber: #a74d08;
  --amber-bg: rgba(217,119,6,0.1);
  --amber-border: rgba(217,119,6,0.3);
  --blue: #195bea;
  --blue-bg: rgba(37,99,235,0.08);
  --blue-border: rgba(37,99,235,0.28);
  --red: #c72020;
  --red-bg: rgba(220,38,38,0.08);
  --red-border: rgba(220,38,38,0.28);
  --purple: #7c3aed;
  --purple-bg: rgba(124,58,237,0.08);
  --purple-border: rgba(124,58,237,0.28);
  --cyan: #06718b;
  --cyan-bg: rgba(8,145,178,0.08);
  --cyan-border: rgba(8,145,178,0.28);
  --blue-light: #1d4ed8;
  --on-accent: #ffffff;
  --btn-primary-hover: #1d4ed8;
  --btn-success-hover: #055e40;
  --chip-bg: rgba(15,23,42,0.04);
  --overlay: rgba(15,23,42,0.35);
  --shadow: rgba(15,23,42,0.15);
  color-scheme: light;
}

/* ── Sand theme (Settings → Appearance; <html data-theme="sand">) ──
   Warm, low-glare paper: darker than Light, no pure white, no cold blue-grey. Accents darkened so every text /
   badge pair meets WCAG (text ≥ 7:1, text2 and text3 ≥ 4.5:1, accents ≥ 4.5:1 on every surface and on their own tint).
   --border-control (inputs, selects, outlined buttons) is the only border meant to meet 3:1; cards and dividers stay soft. */
:root[data-theme="sand"] {
  --brand-badge-ring: transparent;
  --bg: #e6dfd3;
  --bg2: #efe9df;
  --bg3: #e2dace;
  --bg4: #d8cfc0;
  --bg5: #cdc2b1;
  --surface: #f2ede4;
  --surface2: #e9e2d6;
  --border: rgba(70,50,25,0.10);
  --border2: rgba(70,50,25,0.17);
  --border3: rgba(70,50,25,0.26);
  --border-control: #8b7a5f;
  --text: #2e2820;
  --text2: #574d40;
  --text3: #5e5548;
  --green: #246443;
  --green-bg: rgba(37,104,69,0.09);
  --green-border: rgba(37,104,69,0.30);
  --amber: #814c0a;
  --amber-bg: rgba(135,80,10,0.09);
  --amber-border: rgba(135,80,10,0.30);
  --blue: #2a589f;
  --blue-bg: rgba(42,88,159,0.08);
  --blue-border: rgba(42,88,159,0.28);
  --red: #a2362a;
  --red-bg: rgba(162,54,42,0.08);
  --red-border: rgba(162,54,42,0.28);
  --purple: #634aa3;
  --purple-bg: rgba(99,74,163,0.08);
  --purple-border: rgba(99,74,163,0.28);
  --cyan: #16666f;
  --cyan-bg: rgba(22,102,111,0.08);
  --cyan-border: rgba(22,102,111,0.28);
  --blue-light: #234b88;
  --on-accent: #fbf8f2;
  --btn-primary-hover: #234b88;
  --btn-success-hover: #1d5638;
  --chip-bg: rgba(70,50,25,0.05);
  --overlay: rgba(40,28,12,0.35);
  --shadow: rgba(60,40,15,0.14);
  color-scheme: light;
}

/* ── Downtown theme (Settings → Appearance; <html data-theme="downtown">) ──
   Light workspace, deep navy navigation shell (layout.css re-scopes the tokens on .sidebar), restrained blue actions.
   Proposed brand-inspired palette (data/Theme/downtown-tokens.json), not an official Downtown Travel spec.
   Changed from the proposal for contrast: --border-control #73859D (was #8193AA: under 3:1 on the canvas and subtle
   surfaces); --text3 = --text2 so muted text stays ≥ 4.5:1 on --bg5. --bg5, --purple and --cyan are not in the proposal. */
:root[data-theme="downtown"] {
  --brand-badge-ring: transparent;
  --bg: #f3f6fa;
  --bg2: #ffffff;
  --bg3: #eaf0f7;
  --bg4: #e3ebf5;
  --bg5: #d6e1ee;
  --surface: #ffffff;
  --surface2: #eaf0f7;
  --border: rgba(23,43,70,0.09);
  --border2: #c9d5e3;
  --border3: rgba(23,43,70,0.42);
  --border-control: #73859d;
  --text: #172b46;
  --text2: #52647a;
  --text3: #52647a;
  --green: #176440;
  --green-bg: #e8f5ed;
  --green-border: rgba(23,100,64,0.30);
  --amber: #805000;
  --amber-bg: #fff4d6;
  --amber-border: rgba(128,80,0,0.30);
  --blue: #174a8b;
  --blue-bg: #e8f0fc;
  --blue-border: rgba(23,74,139,0.30);
  --red: #aa2835;
  --red-bg: #fdedf0;
  --red-border: rgba(170,40,53,0.30);
  --purple: #6d3fd0;
  --purple-bg: rgba(109,63,208,0.08);
  --purple-border: rgba(109,63,208,0.28);
  --cyan: #06718b;
  --cyan-bg: rgba(6,113,139,0.08);
  --cyan-border: rgba(6,113,139,0.28);
  --blue-light: #103b72;
  --on-accent: #ffffff;
  --btn-primary-hover: #103b72;
  --btn-success-hover: #105030;
  --chip-bg: rgba(23,43,70,0.04);
  --overlay: rgba(16,46,82,0.40);
  --shadow: rgba(16,46,82,0.16);
  color-scheme: light;
}
