:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --border: #e7e5e4;
  --text: #1c1917;
  --muted: #78716c;
  --accent: #ea580c;
  --accent-soft: #fff7ed;
  --good: #16a34a;
  --good-soft: #dcfce7;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --neutral: #d97706;
  --neutral-soft: #fef3c7;
  /* tintes pastel muy suaves para tarjetas */
  --t-mint: #f0fdf4;
  --t-mint-b: #bbf7d0;
  --t-sky: #f0f9ff;
  --t-sky-b: #bae6fd;
  --t-peach: #fff7ed;
  --t-peach-b: #fed7aa;
  --t-rose: #fff1f2;
  --t-rose-b: #fecdd3;
  --t-lilac: #f5f3ff;
  --t-lilac-b: #ddd6fe;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04);
  --font: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0c0a09;
    --surface: #1c1917;
    --surface-2: #292524;
    --border: #3a3633;
    --text: #f5f5f4;
    --muted: #a8a29e;
    --accent: #fb923c;
    --accent-soft: #2a1a0e;
    --good: #4ade80;
    --good-soft: #12301d;
    --bad: #f87171;
    --bad-soft: #3b1515;
    --neutral: #fbbf24;
    --neutral-soft: #33270c;
    --t-mint: #13201a;
    --t-mint-b: #1f3a2b;
    --t-sky: #121c24;
    --t-sky-b: #1e3242;
    --t-peach: #22180f;
    --t-peach-b: #3d2a17;
    --t-rose: #241418;
    --t-rose-b: #42222a;
    --t-lilac: #1a1724;
    --t-lilac-b: #2e2742;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0c0a09;
  --surface: #1c1917;
  --surface-2: #292524;
  --border: #3a3633;
  --text: #f5f5f4;
  --muted: #a8a29e;
  --accent: #fb923c;
  --accent-soft: #2a1a0e;
  --good: #4ade80;
  --good-soft: #12301d;
  --bad: #f87171;
  --bad-soft: #3b1515;
  --neutral: #fbbf24;
  --neutral-soft: #33270c;
  --t-mint: #13201a;
  --t-mint-b: #1f3a2b;
  --t-sky: #121c24;
  --t-sky-b: #1e3242;
  --t-peach: #22180f;
  --t-peach-b: #3d2a17;
  --t-rose: #241418;
  --t-rose-b: #42222a;
  --t-lilac: #1a1724;
  --t-lilac-b: #2e2742;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

main { max-width: 1120px; margin: 0 auto; padding: 0 16px 48px; }

h1, h2 { letter-spacing: -0.02em; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* --- Top bar ---------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  max-width: 1120px; margin: 0 auto; padding: 18px 16px;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; text-decoration: none; }
.logo-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent-soft); border: 1px solid var(--border); font-size: 17px;
}
.topbar nav { display: flex; gap: 18px; font-size: 14px; margin-left: auto; }
.topbar nav a { text-decoration: none; color: var(--muted); }
.topbar nav a:hover { color: var(--text); }

/* --- Hero ------------------------------------------------------------- */
.hero { text-align: center; padding: 56px 0 36px; }
.hero h1 { font-size: clamp(28px, 5.4vw, 52px); line-height: 1.1; margin: 0 0 16px; font-weight: 800; }
.lead { color: var(--muted); font-size: 16px; margin: 0 auto 28px; max-width: 620px; }

.search-row { display: flex; gap: 12px; justify-content: center; max-width: 640px; margin: 0 auto; }
.search { position: relative; flex: 1; }
.search svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2;
}
.search input {
  width: 100%; height: 50px; padding: 0 16px 0 42px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; outline: none;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-results {
  position: absolute; z-index: 1000; left: 0; right: 0; top: 56px; margin: 0; padding: 6px; list-style: none; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgb(0 0 0 / 0.12);
}
.search-results a {
  display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 8px; text-decoration: none;
}
.search-results a:hover, .search-results a.active { background: var(--surface-2); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 50px; padding: 0 20px; white-space: nowrap;
  background: var(--text); color: var(--bg); border: 0; border-radius: 12px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:hover { opacity: 0.88; }

/* --- Sections & cards --------------------------------------------------- */
section { margin-top: 36px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head h2 { font-size: 16px; font-weight: 500; margin: 0; color: var(--muted); }
.more { font-size: 13px; color: var(--muted); text-decoration: none; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}

.grid-2, .grid-3, .grid-4, .grid-cards { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 14px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.stat { padding: 22px 24px; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 800; margin: 10px 0 4px; letter-spacing: -0.02em; }
.stat-sub { font-size: 12.5px; color: var(--muted); }

.region { display: block; padding: 18px 20px; text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
.region:hover { border-color: var(--accent); transform: translateY(-1px); }
.region-name { font-weight: 700; margin-bottom: 10px; }
.region-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.region-price { font-size: 22px; font-weight: 800; }
.region-meta { display: flex; justify-content: space-between; margin-top: 12px; font-size: 10.5px; letter-spacing: 0.06em; color: var(--muted); }

.badge { display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: 11.5px; font-weight: 700; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.neutral { background: var(--neutral-soft); color: var(--neutral); }

.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; flex-wrap: wrap; }
.tab { padding: 6px 12px; border-radius: 8px; font-size: 13px; text-decoration: none; color: var(--muted); }
.tab.active { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: var(--shadow); }

/* --- Tables ------------------------------------------------------------- */
.table-card { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; white-space: nowrap; }
.table .rank { width: 36px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.table a { text-decoration: none; font-weight: 700; }
.table a:hover { color: var(--accent); }

/* --- Pages -------------------------------------------------------------- */
.crumbs { font-size: 13px; color: var(--muted); margin: 20px 0 8px; }
.crumbs a { color: var(--muted); }
.page-title { font-size: clamp(22px, 3.6vw, 32px); font-weight: 800; margin: 6px 0 16px; }

.savings { padding: 16px 20px; margin-bottom: 14px; background: var(--accent-soft); border-color: transparent; }
.savings strong { color: var(--accent); }

.map-card { padding: 8px; margin-bottom: 14px; }
.map { height: 420px; border-radius: 10px; z-index: 0; }
.legend { display: flex; align-items: center; gap: 8px; padding: 10px 8px 4px; font-size: 12px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-left: 8px; }
.dot.good { background: var(--good); }
.dot.neutral { background: var(--neutral); }
.dot.bad { background: var(--bad); }

.station-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 24px; margin-bottom: 14px; flex-wrap: wrap; }
.station-head .page-title { margin: 0 0 4px; }
.station-head p { margin: 2px 0; }

.chart-card { padding: 20px 20px 12px; }
.chart-head { display: flex; align-items: baseline; gap: 10px; }
.chart { width: 100%; height: auto; display: block; margin-top: 8px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.chart .area { fill: var(--accent); opacity: 0.12; }
.chart .grid { stroke: var(--border); stroke-dasharray: 4 4; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .pt { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-empty { padding: 32px 0; text-align: center; font-size: 13px; }

.filters { display: flex; gap: 16px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 14px; }
.filters label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.filters select { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }

.near-controls { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 22px 24px; margin-bottom: 14px; }
.near-controls p { margin: 0; }
.radius { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.chip { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.footer { max-width: 1120px; margin: 0 auto; padding: 24px 16px 40px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }
.footer p { margin: 4px 0; }

.leaflet-popup-content { font-family: var(--font); font-size: 13px; }

/* --- Color suave ------------------------------------------------------- */
.t-mint { background: var(--t-mint); border-color: var(--t-mint-b); }
.t-sky { background: var(--t-sky); border-color: var(--t-sky-b); }
.t-peach { background: var(--t-peach); border-color: var(--t-peach-b); }
.t-rose { background: var(--t-rose); border-color: var(--t-rose-b); }
.t-lilac { background: var(--t-lilac); border-color: var(--t-lilac-b); }

.logo-mark { background: linear-gradient(135deg, var(--t-peach-b), var(--t-rose-b)); border-color: transparent; }
.pill {
  display: inline-block; margin-bottom: 18px; padding: 5px 12px; border-radius: 999px; font-size: 12.5px;
  background: var(--t-mint); border: 1px solid var(--t-mint-b); color: var(--good);
}
.hl { color: var(--accent); }

/* --- Tema --------------------------------------------------------------- */
.topbar nav { align-items: center; }
.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 9px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icon-btn .i-sun { display: none; }
:root[data-theme='dark'] .icon-btn .i-sun { display: block; }
:root[data-theme='dark'] .icon-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .icon-btn .i-sun { display: block; }
  :root:not([data-theme='light']) .icon-btn .i-moon { display: none; }
}
:root[data-theme='dark'] .leaflet-tile { filter: brightness(0.75) contrast(1.1) saturate(0.8); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .leaflet-tile { filter: brightness(0.75) contrast(1.1) saturate(0.8); }
}

/* --- Columna lateral ---------------------------------------------------- */
.with-aside { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.main-col > section:first-child { margin-top: 0; }
.with-aside > .main-col > .map-card:first-child { margin-top: 0; }
.aside { position: sticky; top: 16px; }
.aside-card { overflow: hidden; }
.aside-head { padding: 16px 16px 10px; border-bottom: 1px solid var(--border); background: var(--t-lilac); }
.aside-head h2 { margin: 0 0 2px; font-size: 15px; }
.aside-head p { margin: 0; }
.table.compact td { padding: 9px 14px; }
.table tr.selected td { background: var(--accent-soft); }

/* --- Filtros ------------------------------------------------------------ */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.brand-filter label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.brand-filter select {
  font: inherit; font-size: 13px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px; max-width: 240px;
}

/* --- Votos -------------------------------------------------------------- */
.vote-cell { width: 64px; text-align: right; }
.vote {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); transition: all 0.15s;
}
.vote svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.vote:hover { color: var(--good); border-color: var(--t-mint-b); }
.vote.on { color: var(--good); background: var(--t-mint); border-color: var(--t-mint-b); }
.vote.on svg { fill: currentColor; }
.vote:disabled { opacity: 0.6; }
.station-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.vote-big { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.vote-big .vote { padding: 9px 16px; font-size: 15px; }
.vote-big .vote svg { width: 19px; height: 19px; }

.empty { padding: 22px; text-align: center; font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Preguntas frecuentes ---------------------------------------------- */
.faq { padding: 6px 22px; }
.faq-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: 0; }
.faq-item h3 { margin: 0 0 4px; font-size: 14px; }
.faq-item p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.6; }

/* --- Textos legales ----------------------------------------------------- */
.prose { max-width: 820px; padding: 28px 32px; line-height: 1.7; }
.prose h2 { font-size: 18px; margin: 28px 0 8px; }
.prose h3 { font-size: 15px; margin: 20px 0 6px; }
.prose p, .prose li { font-size: 14px; }
.prose ul { padding-left: 20px; }
.prose a { color: var(--accent); }
.prose code { font-family: var(--font); font-size: 12.5px; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
.prose .table-card { border: 1px solid var(--border); border-radius: 10px; margin: 8px 0; }
.prose .table td { font-size: 13px; vertical-align: top; }
.footer-links a { color: var(--muted); }
@media (max-width: 640px) { .prose { padding: 20px 18px; } }

/* --- Hora de actualización ---------------------------------------------- */
.updated { display: flex; align-items: center; gap: 7px; margin: -6px 0 14px; font-size: 12px; color: var(--muted); }
.section-head .updated { margin: 0; }
.station-head .updated { margin: 6px 0 0; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); flex-shrink: 0; }

.updated.stale { color: var(--neutral); }
.updated.stale .live-dot { background: var(--neutral); box-shadow: 0 0 0 3px var(--neutral-soft); }

/* --- Cambios de precio y estadísticas ------------------------------------ */
.delta { display: inline-block; margin-right: 6px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.delta.down { color: var(--good); }
.delta.up { color: var(--bad); }
.teaser { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 20px; text-decoration: none; font-size: 14px; }
.teaser:hover { border-color: var(--accent); }
.table tr.gap td { text-align: center; color: var(--muted); padding: 4px; letter-spacing: 0.2em; }
.card.pad { padding: 18px 20px; }
.card.pad p { margin: 12px 0 0; }
.grid-2 > section { margin-top: 28px; }
.stat-sub a { color: inherit; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 84px 1fr 72px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-label { color: var(--muted); }
.bar-val { text-align: right; font-weight: 700; }
.bar-track { position: relative; height: 12px; background: linear-gradient(to right, transparent calc(50% - 0.5px), var(--border) calc(50% - 0.5px), var(--border) calc(50% + 0.5px), transparent calc(50% + 0.5px)); }
.bar { position: absolute; top: 1px; bottom: 1px; border-radius: 3px; }
.bar.neg { right: 50%; background: var(--good); opacity: 0.55; }
.bar.pos { left: 50%; background: var(--bad); opacity: 0.55; }
.bar-row.best .bar, .bar-row.worst .bar { opacity: 1; }
.bar-row.best .bar-label, .bar-row.best .bar-val { color: var(--good); font-weight: 700; }
.bar-row.worst .bar-label, .bar-row.worst .bar-val { color: var(--bad); }

/* --- Horario ------------------------------------------------------------ */
.tag {
  display: inline-block; padding: 1px 6px; border-radius: 5px; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.02em; vertical-align: 1px; background: var(--surface-2); color: var(--muted);
}
.tag.open { background: var(--good-soft); color: var(--good); }
.tag.closed { background: var(--bad-soft); color: var(--bad); }
.tag.t24 { background: var(--t-sky); color: #0369a1; border: 1px solid var(--t-sky-b); }
:root[data-theme='dark'] .tag.t24 { color: #7dd3fc; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .tag.t24 { color: #7dd3fc; } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
a.chip { text-decoration: none; }
.toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* --- Tendencia ---------------------------------------------------------- */
.trend { display: flex; gap: 16px; align-items: flex-start; padding: 18px 22px; margin: 14px 0; }
.trend-icon { font-size: 26px; line-height: 1; }
.trend-q { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.trend-title { font-weight: 700; }
.trend-title .muted { font-weight: 400; font-size: 13px; }
.trend-advice { margin: 4px 0 6px; }
.trend-baja { background: var(--t-mint); border-color: var(--t-mint-b); --spark: var(--good); }
.trend-sube { background: var(--t-rose); border-color: var(--t-rose-b); --spark: var(--bad); }
.trend-estable { background: var(--t-sky); border-color: var(--t-sky-b); --spark: var(--muted); }
.trend-body { flex: 1; min-width: 0; }
.spark { margin: 0; width: 220px; flex-shrink: 0; align-self: center; }
.spark svg { display: block; width: 100%; height: auto; }
.spark-line { fill: none; stroke: var(--spark); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: var(--spark); opacity: 0.12; }
.spark-pt { fill: var(--spark); stroke: var(--surface); stroke-width: 2; }
.spark figcaption { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; color: var(--muted); margin-top: 2px; }

/* --- Compartir ---------------------------------------------------------- */
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); height: 42px; padding: 0 14px; font-weight: 500; }
.btn.ghost:hover { border-color: var(--accent); opacity: 1; }
.share svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }

/* --- Calculadora -------------------------------------------------------- */
.calc { width: 100%; padding: 12px 14px; border-radius: 10px; background: var(--t-peach); border: 1px solid var(--t-peach-b); }
.calc summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.calc summary .muted { font-weight: 400; margin-left: 6px; }
.calc-fields { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.calc-fields label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.calc-fields input {
  width: 76px; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px;
}
.verdict { padding: 16px 20px; margin: 14px 0; background: var(--t-mint); border-color: var(--t-mint-b); }

/* --- Ruta --------------------------------------------------------------- */
.route-form { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 22px 24px; margin-bottom: 14px; }
.route-form p { margin: 0; }
.route-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.route-search input { padding-left: 46px; }
.route-dot {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%); z-index: 1;
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--good); color: var(--surface); font-size: 12px; font-weight: 800;
}
.route-dot.b { background: var(--bad); }

@media (max-width: 960px) {
  .with-aside { grid-template-columns: minmax(0, 1fr); }
  .aside { position: static; }
}
@media (max-width: 640px) {
  .route-inputs { grid-template-columns: 1fr; }
  .trend { padding: 14px 16px; flex-wrap: wrap; }
  .spark { width: 100%; }
}

@media (max-width: 640px) {
  /* Logo y tema arriba; los enlaces en una fila de pastillas que se desliza en horizontal */
  .topbar { flex-wrap: wrap; gap: 12px; padding: 14px 16px 6px; }
  .topbar .icon-btn { margin-left: auto; }
  .topbar nav {
    order: 3; width: 100%; margin: 0 -16px; padding: 0 16px 4px; box-sizing: content-box;
    gap: 6px; overflow-x: auto; scrollbar-width: none;
  }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a {
    flex: none; padding: 6px 12px; font-size: 13px; white-space: nowrap;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  }
  .search-row { flex-direction: column; }
  .btn { justify-content: center; }
  .hero { padding: 32px 0 20px; }
  .map { height: 320px; }
  .grid-4, .grid-3 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 16px; }
  .stat-value { font-size: 21px; }
  .table th, .table td { padding: 10px 10px; }
}
