:root {
  color-scheme: dark;
  --page: #0a0e1a;
  --panel: #111827;
  --panel-raised: #151f32;
  --border: #1e2d4a;
  --text: #e2e8f0;
  --muted: #8892a4;
  --cyan: #00d4ff;
  --blue: #0066cc;
  --red: #ff3b3b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--cyan); }
a:hover { color: #8cecff; }

.map-header {
  min-height: 64px;
  padding: 8px clamp(16px, 4vw, 42px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #060b14;
  border-bottom: 1px solid var(--border);
}

.map-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.map-brand span { min-width: 0; }
.map-brand img { object-fit: contain; }
.map-brand strong { display: block; color: var(--cyan); font-size: 17px; letter-spacing: 1px; }
.map-brand small { display: block; max-width: min(320px, 60vw); color: var(--muted); font-size: 9px; letter-spacing: 1.1px; line-height: 1.35; }
.dashboard-link { margin-left: auto; white-space: nowrap; text-decoration: none; }

.map-main { width: min(1500px, 100%); margin: 0 auto; padding: 30px clamp(16px, 3vw, 36px) 36px; }
.map-intro { margin-bottom: 20px; }
.eyebrow { margin: 0 0 6px; color: var(--cyan); font-size: 11px; font-weight: 700; letter-spacing: 1.8px; }
.map-intro h1 { margin: 0 0 6px; font-size: clamp(24px, 3vw, 34px); line-height: 1.2; }
.map-intro > p:last-child { margin: 0; color: var(--muted); }

.map-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat-card, .map-card { border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.stat-card { min-height: 82px; padding: 14px 16px; }
.stat-label { display: block; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 1.1px; }
.stat-card strong { display: block; margin-top: 5px; font-size: 21px; font-variant-numeric: tabular-nums; }
.stat-updated strong { font-size: 14px; }
.map-status { min-height: 22px; margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.map-status.error { color: #ff8b8b; }
.map-status.stale { color: #ffd166; }

.map-content { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: stretch; gap: 14px; }
.map-card { min-width: 0; overflow: hidden; }
.map-card-heading { min-height: 68px; padding: 13px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.map-card-heading h2 { margin: 0; font-size: 14px; }
.map-card-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.map-live { flex-shrink: 0; color: var(--muted); font-size: 10px; white-space: nowrap; }
.map-live span { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--cyan); }

#world-map { width: 100%; height: min(64vh, 680px); min-height: 380px; background: #0c1525; }
.leaflet-container { background: #0c1525; color: var(--text); font: inherit; }
.leaflet-control-attribution { font-size: 10px !important; }
.leaflet-control-attribution a { color: #4aa9d0 !important; }
.leaflet-bar a, .leaflet-bar a:hover { background: #111827; color: var(--text); border-color: var(--border); }
.leaflet-tooltip { border: 1px solid var(--border); background: #111827; color: var(--text); box-shadow: none; }
.leaflet-tooltip-top:before { border-top-color: var(--border); }

.map-legend { min-height: 42px; padding: 9px 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 12px; height: 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 3px; }
.legend-swatch.none { background: #18243a; }
.legend-swatch.low { background: #125b83; }
.legend-swatch.medium { background: #168a9d; }
.legend-swatch.high { background: #d37822; }
.legend-swatch.highest { background: #db343e; }

.country-list { margin: 0; padding: 4px 16px 16px; list-style: none; }
.country-list li { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(30,45,74,.7); }
.country-list li:last-child { border-bottom: 0; }
.country-name { overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.country-count { flex-shrink: 0; color: var(--cyan); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; }
.country-empty { padding: 8px 0; color: var(--muted); }

.map-disclosure { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--muted); font-size: 11px; }
.map-disclosure p { margin: 0; }
.map-disclosure p + p { margin-top: 6px; }

.site-footer {
  margin-top: 28px;
  padding: 2rem 1.25rem;
  border-top: 1px solid var(--border);
  background: #111827;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  text-align: center;
}
.footer-brand { font-size: 1.15rem; font-weight: 800; }
.brand-med { color: #3b82f6; }
.brand-fda { color: #e2e8f0; }
.brand-watch { color: #14b8a6; }
.footer-desc { max-width: 580px; color: var(--muted); font-size: .82rem; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.25rem; }
.footer-links a { color: var(--muted); font-size: .8rem; }
.footer-links a:hover { color: var(--text); }
.footer-copy { color: var(--muted); font-size: .75rem; }
.footer-copy a { color: inherit; }

@media (max-width: 900px) {
  .map-content { grid-template-columns: minmax(0, 1fr); }
  .country-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
  #world-map { height: 58vh; }
}

@media (max-width: 560px) {
  .map-header { flex-wrap: wrap; }
  .map-brand small { font-size: 8px; letter-spacing: .7px; }
  .map-main { padding-top: 22px; }
  .map-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat-card { min-height: 72px; padding: 11px 12px; }
  .stat-label { font-size: 9px; }
  .stat-updated { grid-column: 1 / -1; }
  .map-card-heading { align-items: flex-start; }
  .map-live { max-width: 110px; white-space: normal; text-align: right; }
  #world-map { height: 56vh; min-height: 340px; }
  .country-list { grid-template-columns: minmax(0, 1fr); }
  .map-legend { gap: 8px; }
}
