/* ── Theme variables ── */
:root, [data-theme="dark"] {
  color-scheme: dark;   /* native dropdowns/scrollbars render dark + readable */
  /* Surfaces */
  --bg-body: #0c0e15;
  --bg-sidebar: #12141d;
  --bg-card: rgba(28,30,44,.72);
  --bg-card-solid: #1b1d2b;
  --bg-elevated: #20233380;
  --bg-input: #14161f;
  --bg-input-focus: #181b26;
  --bg-hover: rgba(255,255,255,.04);
  --bg-active: rgba(99,102,241,.12);
  --bg-table-head: rgba(255,255,255,.022);
  --bg-subtle: rgba(255,255,255,.025);

  /* Borders */
  --border: rgba(255,255,255,.07);
  --border-strong: rgba(255,255,255,.11);
  --border-hover: rgba(99,102,241,.4);

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #aab4c5;
  --text-muted: #6b7689;
  --text-faint: #4a5366;

  /* Accent */
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99,102,241,.13);
  --accent-grad: linear-gradient(135deg,#6366f1,#7c3aed);
  --accent-grad-hover: linear-gradient(135deg,#818cf8,#8b5cf6);

  /* Radii */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 11px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Sizing */
  --input-h: 46px;
  --input-pad-y: 12px;
  --input-pad-x: 15px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.2);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.22);
  --shadow-md: 0 6px 20px rgba(0,0,0,.28);
  --shadow-lg: 0 14px 40px rgba(0,0,0,.4);
  --shadow-xl: 0 28px 70px rgba(0,0,0,.5);
  --shadow-card: 0 4px 24px rgba(0,0,0,.25);
  --shadow-glow: 0 0 0 1px var(--border-hover), 0 8px 28px rgba(99,102,241,.12);
  --ring: 0 0 0 3px rgba(99,102,241,.22);

  --scrollbar-thumb: #2e3148;
  --blur: blur(14px);
}

[data-theme="light"] {
  color-scheme: light;
  --bg-body: #eef1f6;
  --bg-sidebar: #ffffff;
  --bg-card: rgba(255,255,255,.86);
  --bg-card-solid: #ffffff;
  --bg-elevated: #f8fafc;
  --bg-input: #f4f6fa;
  --bg-input-focus: #ffffff;
  --bg-hover: rgba(15,23,42,.035);
  --bg-active: rgba(99,102,241,.08);
  --bg-table-head: rgba(15,23,42,.025);
  --bg-subtle: rgba(15,23,42,.02);

  --border: rgba(15,23,42,.09);
  --border-strong: rgba(15,23,42,.14);
  --border-hover: rgba(99,102,241,.4);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #8693a8;
  --text-faint: #aeb8c8;

  --accent-soft: rgba(99,102,241,.1);

  --shadow-xs: 0 1px 2px rgba(15,23,42,.05);
  --shadow-sm: 0 2px 8px rgba(15,23,42,.06);
  --shadow-md: 0 6px 20px rgba(15,23,42,.08);
  --shadow-lg: 0 14px 40px rgba(15,23,42,.12);
  --shadow-xl: 0 28px 70px rgba(15,23,42,.16);
  --shadow-card: 0 4px 24px rgba(15,23,42,.06);
  --shadow-glow: 0 0 0 1px var(--border-hover), 0 8px 28px rgba(99,102,241,.1);
  --ring: 0 0 0 3px rgba(99,102,241,.16);

  --scrollbar-thumb: #cbd5e1;
  --blur: blur(16px);
}

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: padding-box; }

body {
  margin: 0;
  background: var(--bg-body);
  color: var(--text-secondary);
  font-family: Inter, system-ui, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .3s, color .3s;
}

/* Subtle ambient background glow on the app body */
[data-theme="dark"] body {
  background-image:
    radial-gradient(900px 500px at 18% -8%, rgba(99,102,241,.08), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(124,58,237,.06), transparent 55%);
  background-attachment: fixed;
}

::selection { background: rgba(99,102,241,.28); color: var(--text-primary); }
