/* ── MedScheduler CSS Modularization - Phase 1 ─────────────────────
   Base: Reset, CSS variables, typography, and light/dark theme
   ────────────────────────────────────────────────────────────────── */

/* ── Reset & Box Model ───────────────────────────────────────────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── CSS Variables: Light Theme (Default) ─────────────────────────── */
:root {
  --bg: #f0f4f8;
  --surface: #fff;
  --border: #e2e8f0;
  --text: #1a202c;
  --muted: #718096;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  --header-h: 86px;
  --sidebar-w: 240px;
  --hl: #eff6ff;
  --hl-border: #bfdbfe;
  --danger-soft: #fee2e2;
  --success-soft: #dcfce7;
  --thead: #f8fafc;
  --auth-g1: #1e3a5f;
  --auth-g2: #2563eb;
  --toast-bg: #1a202c;
  --toast-fg: #fff;

  /* ── Design tokens (Phase 3 M3.1) — theme-independent ──────────────
     Spacing scale (4px base), radius scale, and type scale. Additive:
     surfaces migrate onto these tokens; px values match existing usage
     so introducing them is visually neutral. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  --fs-xs: 0.72rem;
  --fs-sm: 0.8rem;
  --fs-base: 0.875rem;
  --fs-md: 0.95rem;
  --fs-lg: 1.1rem;
  --fs-xl: 1.35rem;
  --lh-tight: 1.25;
  --lh-normal: 1.5;

  /* Elevation + subtle separation (Phase 3 M3.2) */
  --border-subtle: rgba(15,23,42,.08);
  --border-hairline: rgba(15,23,42,.07);
  --shadow-xs: 0 1px 2px rgba(15,23,42,.05);
  --shadow-sm: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,.10);
}

/* ── CSS Variables: Dark Theme ──────────────────────────────────────
   Note: Day-cell colors (shift codes) remain light in dark mode
   (data colors, not theme). Only UI surfaces change. */
html[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --hl: #1e3a5f;
  --hl-border: #3b82f6;
  --danger-soft: rgba(248, 113, 113, 0.22);
  --success-soft: rgba(74, 222, 128, 0.20);
  --thead: #243044;
  --auth-g1: #0b1220;
  --auth-g2: #1e3a8a;
  --toast-bg: #e2e8f0;
  --toast-fg: #0f172a;
  /* Phase 3 M3.2 dark elevation */
  --border-subtle: rgba(255,255,255,.09);
  --border-hairline: rgba(255,255,255,.08);
  --shadow-xs: 0 1px 2px rgba(0,0,0,.30);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.35);
  --shadow-md: 0 6px 18px rgba(0,0,0,.45);
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #0f172a;
  color: var(--text);
  border-color: var(--border);
}

/* ── Typography ──────────────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Touch Scrolling ─────────────────────────────────────────────── */
.grid-wrap,
.doc-list,
.summary-wrap {
  -webkit-overflow-scrolling: touch;
}
