/* ──────────────────────────────────────────────────────────────────────────
   BSP Studio Manager — design tokens (the contract every screen builds on)
   Dark is the default; light is opt-in via <html data-theme="light">.
   Never hardcode a color/space/radius in a screen: use a token. If a token is
   missing, add it here (and to docs/DESIGN_SYSTEM.md).
   ────────────────────────────────────────────────────────────────────────── */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;

  /* Surfaces (back → front) */
  --bg: #0b0d11;
  --surface-1: #12151b;       /* cards, sidebar */
  --surface-2: #181c24;       /* hover, raised, inputs */
  --surface-3: #212633;       /* pressed, selected rows */
  --overlay: rgba(4, 6, 10, 0.72);

  /* Lines */
  --border: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(255, 255, 255, 0.15);

  /* Text */
  --text: #eceff4;
  --text-muted: #9aa3b5;
  --text-subtle: #7c8599;     /* placeholders, captions (≥4.5:1 on surface-1) */
  --text-on-accent: #ffffff;

  /* Accent (restrained blue) */
  --accent: #346fd8;          /* white text on it = 4.76:1 (AA) */
  --accent-hover: #2d62c4;
  --accent-text: #8db4f7;     /* accent used as text on dark surfaces */
  --accent-soft: rgba(52, 111, 216, 0.18);
  --accent-ring: rgba(94, 148, 240, 0.55);

  /* Semantic */
  --success: #3ccf86;
  --warning: #eba743;
  --danger: #f2706a;
  --info: var(--accent-text);

  /* Pipeline / status hues (badges derive soft backgrounds from these) */
  --st-inquiry: #e3b341;
  --st-booked: #6ea4f5;
  --st-prep: #b08df0;
  --st-shot: #55c1ec;
  --st-editing: #f0904e;
  --st-delivered: #3ccf86;
  --st-archived: #8a93a6;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  --scrollbar: rgba(255, 255, 255, 0.16);
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f3f5f8;
  --surface-1: #ffffff;
  --surface-2: #f6f7fa;
  --surface-3: #eceff4;
  --overlay: rgba(15, 23, 42, 0.5);

  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.22);

  --text: #0f172a;
  --text-muted: #4b576b;
  --text-subtle: #667085;
  --text-on-accent: #ffffff;

  --accent: #2563eb;
  --accent-hover: #1d4fd0;
  --accent-text: #1d4fd0;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --accent-ring: rgba(37, 99, 235, 0.4);

  --success: #0c7a47;
  --warning: #96560a;
  --danger: #bf3029;
  --info: var(--accent-text);

  --st-inquiry: #946c00;
  --st-booked: #1d4fd0;
  --st-prep: #6b3fc4;
  --st-shot: #0b6e94;
  --st-editing: #b25312;
  --st-delivered: #0c7a47;
  --st-archived: #596273;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.22);
  --scrollbar: rgba(15, 23, 42, 0.22);
}

/* Theme-independent tokens */
:root {
  --font-ui: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-brand: 'Bebas Neue', 'DM Sans', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 26px;
  --fs-3xl: 32px;
  --lh-tight: 1.25;
  --lh-base: 1.55;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

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

  --dur-fast: 120ms;
  --dur: 200ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  --sidebar-w: 248px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 60px;
  --control-h: 36px;
  --control-h-sm: 30px;

  --z-sticky: 50;
  --z-drawer: 100;
  --z-menu: 300;
  --z-modal: 1000;
  --z-toast: 9999;

  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);

  /* ── Legacy aliases ────────────────────────────────────────────────────
     Older screens/inline styles still reference these names. They now resolve
     to the new tokens (so they follow the theme). Don't use them in new code. */
  --dark: var(--surface-1);
  --surface: var(--surface-1);
  --surface2: var(--surface-2);
  --white: var(--text);
  --muted: var(--text-muted);
  --accent-bright: var(--accent);
  --accent-glow: var(--accent-soft);
  --border-accent: var(--accent-ring);
  --warning-strong: var(--warning);
  --radius: var(--r-md);
  --radius-lg: var(--r-lg);
}
