/* SkyRoute — système de design (thème clair par défaut, thème sombre via [data-theme="dark"]) */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e3e8ef;
  --border-strong: #cfd7e2;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #e8efff;
  --accent-text: #ffffff;
  --success: #15803d;
  --success-soft: #e7f6ec;
  --progress: #b45309;
  --progress-soft: #fdf2e0;
  --danger: #b91c1c;
  --danger-soft: #fdecec;
  --neutral-soft: #eef1f5;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 236px;
  --map-bg: #e9eef3;
  --chart-1: #2563eb;
  --chart-2: #0ea5e9;
  --chart-grid: #e8edf3;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #121a2b;
  --surface-2: #162036;
  --surface-3: #1c2740;
  --border: #22304a;
  --border-strong: #2f3f5e;
  --text: #e6ebf4;
  --text-2: #c3cddd;
  --muted: #8d9ab3;
  --accent: #5b8def;
  --accent-hover: #7aa3f5;
  --accent-soft: #1b2a4a;
  --accent-text: #0b1120;
  --success: #4ade80;
  --success-soft: #12301f;
  --progress: #fbbf24;
  --progress-soft: #33280f;
  --danger: #f87171;
  --danger-soft: #3a1618;
  --neutral-soft: #1e293b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  --map-bg: #111a2c;
  --chart-1: #5b8def;
  --chart-2: #38bdf8;
  --chart-grid: #22304a;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--text); }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Mise en page ─────────────────────────────── */
.app { display: flex; min-height: 100%; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 16px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; text-decoration: none;
}
.nav a:hover { background: var(--surface-3); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a svg { flex: none; }
.sidebar-foot { margin-top: auto; padding: 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
}
.topbar .spacer { flex: 1; }
.topbar-brand { display: none; }
.topbar-brand .brand { padding: 0; }
.content { padding: 8px 28px 48px; max-width: 1320px; width: 100%; }

@keyframes page-sweep-in { from { clip-path: inset(0 0 100% 0); opacity: 0; } to { clip-path: inset(0 0 0% 0); opacity: 1; } }
.page-transition { animation: page-sweep-in 900ms cubic-bezier(.19,1,.22,1); }
@media (prefers-reduced-motion: reduce) { .page-transition { animation: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 20px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; }
.mobile-nav { display: none; }

/* ── Cartes & grilles ─────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card-head + .card-body { padding-top: 12px; }
.card-body { padding: 16px 20px 20px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.mt { margin-top: 16px; }

.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--muted); font-size: 12.5px; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s ease; }

/* ── Badges de statut ─────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; font-family: var(--mono);
}
.badge-NOT_STARTED { background: var(--neutral-soft); color: var(--muted); }
.badge-IN_PROGRESS { background: var(--progress-soft); color: var(--progress); }
.badge-FINISHED { background: var(--success-soft); color: var(--success); }
.badge-ABORTED { background: var(--danger-soft); color: var(--danger); }
.badge-IN_PROGRESS .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 500; }
.pill-ok { background: var(--success-soft); color: var(--success); }
.pill-warn { background: var(--progress-soft); color: var(--progress); }
.pill-bad { background: var(--danger-soft); color: var(--danger); }

/* ── Boutons & formulaires ────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.icon-btn { width: 36px; padding: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.input, .select, textarea.input {
  height: 36px; padding: 0 11px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); width: 100%; min-width: 0;
}
textarea.input { height: auto; padding: 8px 11px; }
.input:focus, .select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--border-strong); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.alert { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.alert-ok { background: var(--success-soft); color: var(--success); }
.alert-info { background: var(--accent-soft); color: var(--accent); }
.segmented { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 550; color: var(--text-2); }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.theme-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 170px)); gap: 12px; }
.theme-card { border: 2px solid var(--border); border-radius: var(--radius); padding: 10px; cursor: pointer; background: var(--surface); display: flex; flex-direction: column; gap: 8px; text-align: left; }
.theme-card.on { border-color: var(--accent); }
.theme-preview { height: 64px; border-radius: 8px; display: grid; grid-template-columns: 26% 1fr; gap: 5px; padding: 6px; }
.theme-preview i { border-radius: 4px; }

/* ── Listes de vols ───────────────────────────── */
.flight-list { display: flex; flex-direction: column; }
.flight-row {
  display: grid; grid-template-columns: minmax(170px, 1.3fr) minmax(150px, 1fr) minmax(90px, .6fr) minmax(90px, .55fr) 150px;
  align-items: center; gap: 16px; padding: 13px 20px; border-top: 1px solid var(--border); color: inherit; text-decoration: none;
}
.flight-row:first-child { border-top: 0; }
.flight-row:hover { background: var(--surface-2); text-decoration: none; }
.route { font-family: var(--mono); font-weight: 700; font-size: 15px; letter-spacing: .01em; display: flex; align-items: center; gap: 6px; }
.route .arrow { color: var(--muted); font-weight: 400; }
.cities { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-cell { min-width: 0; }
.fr-cell strong { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-status { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.list-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click:hover td { background: var(--surface-2); cursor: pointer; }

.empty { padding: 36px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty svg { color: var(--border-strong); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px 18px; }
.kv div span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.kv div strong { font-weight: 650; font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .count { margin-left: 6px; font-size: 11.5px; background: var(--surface-3); color: var(--text-2); border-radius: 99px; padding: 1px 7px; }

/* ── Carte ────────────────────────────────────── */
.map { position: relative; overflow: hidden; background: var(--map-bg); border-radius: var(--radius); touch-action: none; user-select: none; cursor: grab; }
.map.dragging { cursor: grabbing; }
.map-tiles { position: absolute; inset: 0; }
.map-tiles img { position: absolute; width: 256px; height: 256px; max-width: none; pointer-events: none; }
/* Calque "fantôme" : capture visuelle des tuiles au moment du zoom, grossie/rétrécie en douceur
   (transform + fondu, piloté en JS) pendant que les nouvelles tuiles se chargent en dessous —
   évite le saut brusque d'un niveau de zoom à l'autre (molette, double-clic, pincement, boutons). */
.map-tiles-ghost { position: absolute; inset: 0; display: none; pointer-events: none; will-change: transform, opacity; }
/* Thème sombre sans fournisseur dédié : tuiles claires inversées */
.map-tiles-dark img { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.6); }
.map svg.map-overlay { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.map-controls { position: absolute; left: 10px; top: 10px; display: flex; flex-direction: column; gap: 4px; z-index: 2; }
.map-controls button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 18px; line-height: 1; box-shadow: var(--shadow); color: var(--text); }
.map-attrib { position: absolute; right: 6px; bottom: 4px; font-size: 10.5px; color: var(--muted); background: color-mix(in srgb, var(--surface) 80%, transparent); padding: 1px 6px; border-radius: 4px; z-index: 2; }
.map-attrib a { color: inherit; }
.map-label { font: 600 11px var(--mono); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; fill: var(--text); pointer-events: none; }
.map-marker { cursor: pointer; }
.map-tooltip { position: absolute; z-index: 3; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; font-size: 12px; box-shadow: var(--shadow-lg); pointer-events: none; white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); }
.map-legend { position: absolute; left: 10px; bottom: 10px; z-index: 2; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; box-shadow: var(--shadow); }
.map-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }

.live-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.live-grid div span { display: block; font-size: 12px; color: var(--muted); }
.live-grid div strong { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.progress-route { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-weight: 700; }
.progress-route .meter { flex: 1; }

/* ── Graphiques ───────────────────────────────── */
.chart { width: 100%; display: block; }
.chart text { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.ring-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ring { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.ring svg text { font-weight: 700; font-size: 17px; fill: var(--text); }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 4px 10px; align-items: center; }
.hbar .track { grid-column: 1 / -1; height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-bottom: 8px; }
.hbar .track span { display: block; height: 100%; background: var(--chart-1); border-radius: 99px; }

/* ── Notifications & toasts ───────────────────── */
.bell { position: relative; }
.bell .dot { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.popover { position: absolute; right: 0; top: calc(100% + 8px); width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 50; }
.notif { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); }
.notif.unread { background: var(--accent-soft); }
.notif .n-title { font-weight: 650; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { width: min(360px, calc(100vw - 36px)); background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 12px 14px; animation: slide .25s ease; }
.toast.flight_finish { border-left-color: var(--success); }
.toast.flight_abort, .toast.tracker_error, .toast.error { border-left-color: var(--danger); }
.toast.flight_start { border-left-color: var(--progress); }
.toast .t-title { font-weight: 700; }
@keyframes slide { from { transform: translateY(10px); opacity: 0 } }

.modal-back { position: fixed; inset: 0; background: rgba(8, 12, 22, .45); display: grid; place-items: center; z-index: 80; padding: 16px; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; }

/* ── Authentification ─────────────────────────── */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-card { width: min(410px, 100%); padding: 28px; }
.auth-card .brand { padding: 0 0 20px; }
.auth-foot { margin-top: 16px; text-align: center; color: var(--muted); font-size: 13px; }

.code-box { font-family: var(--mono); font-size: 28px; font-weight: 700; letter-spacing: .12em; padding: 12px 18px; border-radius: 10px; background: var(--surface-3); display: inline-block; }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0 } }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .flight-row { grid-template-columns: minmax(150px, 1.2fr) minmax(130px, 1fr) minmax(80px, .6fr) 130px; }
  .flight-row .fr-aircraft { display: none; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: 72px; }
  .topbar { padding: 10px 16px; }
  .topbar-brand { display: block; }
  .content { padding: 4px 16px 32px; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface);
    border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); padding: 4px 6px; border-radius: 8px; text-decoration: none; min-width: 52px; }
  .mobile-nav a.active { color: var(--accent); }
  .flight-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 12px 16px; }
  .flight-row .fr-airline, .flight-row .fr-meta { grid-column: 1; }
  .flight-row .fr-status { grid-column: 2; grid-row: 1 / span 2; }
  .flight-row .fr-meta { display: none; }
  .live-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters:not(.open) { display: none; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 21px; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 21px; }
  .ring-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .card-head { padding: 14px 16px 0; }
  .card-body { padding: 12px 16px 16px; }
  .theme-choice { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
