:root {
  /* Base */
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-1: #1e293b;
  --surface-2: #334155;
  --surface-inset: #0b1220;
  --text: #f8fafc;
  --muted: #94a3b8;
  --text-muted: #94a3b8;

  /* Hairlines (borders) — softer than --surface-2 for cards, stronger on hover */
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.34);

  /* Brand */
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --accent-dim: rgba(56, 189, 248, 0.12);
  --accent-border: rgba(56, 189, 248, 0.45);

  /* Semantic */
  --success: #34d399;
  --success-dim: rgba(52, 211, 153, 0.12);
  --success-border: rgba(52, 211, 153, 0.45);
  --warn: #fbbf24;
  --warning: #fbbf24;
  --warn-dim: rgba(251, 191, 36, 0.12);
  --warn-border: rgba(251, 191, 36, 0.45);
  --danger: #f87171;
  --danger-dim: rgba(248, 113, 113, 0.12);
  --danger-border: rgba(248, 113, 113, 0.4);

  /* Charts (align with app.js WEEKLY_CHART_COLORS) */
  --chart-1: #60a5fa;
  --chart-2: #c4b5fd;
  --chart-3: #34d399;
  --chart-4: #fbbf24;

  /* Provider chips */
  --provider-cbs: #fdba74;
  --provider-cbs-border: #fb923c;

  /* Layout */
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(2, 6, 23, 0.35);
  --shadow-overlay: 0 12px 32px rgba(2, 6, 23, 0.5);
  --shell-max: 1400px;
  --header-h: 57px;
  --nav-h: 56px;

  /* Motion — instant-feel feedback only (hover/focus), never decorative */
  --speed: 120ms;

  /* Spacing scale (base 4px) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
}

* { box-sizing: border-box; }

html {
  /* Dark native scrollbars, checkboxes, and form controls on every browser */
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Kill the gray flash on tap (iOS/Android) — our own pressed states replace it */
a, button, [role="button"], label, summary {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Cross-browser type consistency: form elements do not inherit by default */
button, input, select, textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

::selection {
  background: rgba(56, 189, 248, 0.28);
  color: var(--text);
}

/* Slim, theme-matched scrollbars (Firefox + WebKit) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-2) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--surface-2);
  border-radius: 999px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
