/* ============================================================
   School Dashboard — Design tokens
   Single source of truth for color, type, spacing, motion.
   Light is the default; dark follows the system setting and can
   be forced with <html data-theme="dark|light">.
   ============================================================ */
:root {
  /* ---- Type ---- */
  --font-ui: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "DM Serif Display", Georgia, "Times New Roman", serif;
  --font-mono: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --step--1: .8125rem;   /* 13px  labels, meta */
  --step-0:  .9375rem;   /* 15px  body */
  --step-1:  1.0625rem;  /* 17px  card titles */
  --step-2:  1.375rem;   /* 22px  headings */
  --step-3:  1.875rem;   /* 30px  stat numbers */
  --step-4:  2.5rem;     /* 40px  greeting */
  --lh-tight: 1.15;
  --lh: 1.5;

  /* ---- Spacing ---- */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;

  /* ---- Radii ---- */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;

  /* ---- Motion ---- */
  --dur: 160ms; --dur-fast: 100ms; --ease: cubic-bezier(.2, .6, .2, 1);

  /* ---- Status hues (stable across themes) ---- */
  --ok: #16a34a; --warn: #d97706; --bad: #dc2626; --info: #2563eb;

  /* ---- Layout ---- */
  --container: 1120px;
  --z-header: 50; --z-menu: 100; --z-toast: 200;

  /* ====== LIGHT THEME (default) ====== */
  --bg: #f5f7fb;
  --surface-1: #ffffff;
  --surface-2: #ffffff;
  --surface-3: #f1f4f9;
  --border: #e5e9f0;
  --border-strong: #cfd6e4;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #8591a6;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px rgba(15, 23, 42, .06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-weak: rgba(37, 99, 235, .10);
  --accent-contrast: #ffffff;
  --ok-bg: rgba(22, 163, 74, .12);
  --warn-bg: rgba(217, 119, 6, .14);
  --bad-bg: rgba(220, 38, 38, .11);
}

/* ====== DARK THEME ====== */
/* Applied when the system is dark (unless the user forced light),
   or when data-theme="dark" is set explicitly. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #030712;
    --surface-1: #0b1322;
    --surface-2: #111c30;
    --surface-3: #16233b;
    --border: rgba(148, 163, 184, .14);
    --border-strong: rgba(148, 163, 184, .28);
    --text: #f1f5f9;
    --text-2: #94a3b8;
    --text-3: #64748b;
    --shadow: 0 1px 0 rgba(255, 255, 255, .02), 0 8px 24px rgba(0, 0, 0, .45);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-weak: rgba(59, 130, 246, .16);
    --accent-contrast: #ffffff;
    --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444; --info: #3b82f6;
    --ok-bg: rgba(34, 197, 94, .15);
    --warn-bg: rgba(245, 158, 11, .16);
    --bad-bg: rgba(239, 68, 68, .16);
  }
}
:root[data-theme="dark"] {
  --bg: #030712;
  --surface-1: #0b1322;
  --surface-2: #111c30;
  --surface-3: #16233b;
  --border: rgba(148, 163, 184, .14);
  --border-strong: rgba(148, 163, 184, .28);
  --text: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --shadow: 0 1px 0 rgba(255, 255, 255, .02), 0 8px 24px rgba(0, 0, 0, .45);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-weak: rgba(59, 130, 246, .16);
  --accent-contrast: #ffffff;
  --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444; --info: #3b82f6;
  --ok-bg: rgba(34, 197, 94, .15);
  --warn-bg: rgba(245, 158, 11, .16);
  --bad-bg: rgba(239, 68, 68, .16);
}
