:root {
  --brand: #0f766e; --brand-2: #14b8a6; --brand-ink: #042f2e;
  --bg: #f4f6f5; --surface: #ffffff; --surface-2: #eef2f1; --line: #dde4e2;
  --ink: #0f1a19; --ink-2: #4a5a58; --ink-3: #7b8b89;
  --good: #059669; --good-bg: #e7f7ef; --mid: #b45309; --mid-bg: #fdf3e2; --bad: #dc2626; --bad-bg: #fdecec;
  --g95: #16a34a; --gasoleoA: #1f2937; --g98: #7c3aed; --gasoleoPremium: #475569; --glp: #ea580c;
  --r: 14px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 2px 8px rgba(16,24,40,.06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1416; --surface: #121e20; --surface-2: #182729; --line: #23383a;
    --ink: #e6efed; --ink-2: #a8b9b6; --ink-3: #7d918e; --brand-2: #2dd4bf;
    --good: #34d399; --good-bg: #0f2e24; --mid: #fbbf24; --mid-bg: #2e2510; --bad: #f87171; --bad-bg: #331616;
    --gasoleoA: #cbd5e1; --gasoleoPremium: #94a3b8;
    --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 130px; }
body { margin: 0; font: 16px/1.5 var(--font); background: var(--bg); color: var(--ink); font-variant-numeric: tabular-nums; }
a { color: var(--brand); text-decoration: none; }
@media (prefers-color-scheme: dark) { a { color: var(--brand-2); } }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); font-weight: 800; }
h2 { font-size: 1.3rem; } h3 { font-size: 1rem; }
svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 99; background: var(--surface); padding: 8px; }
.muted { color: var(--ink-3); } .small { font-size: .85rem; } .nowrap { white-space: nowrap; }
.demo-banner { background: #fef3c7; color: #78350f; text-align: center; font-size: .85rem; padding: 6px 12px; }

/* Cabecera */
.top { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 12px; height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--ink); font-size: 1.1rem; letter-spacing: -.02em; }
.logo:hover { text-decoration: none; } .logo svg { width: 32px; height: 32px; stroke: none; }
.top-search { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.top-search input { width: 100%; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); padding: 0 16px; font: inherit; font-size: .95rem; }
.btn-geo { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }
@media (max-width: 640px) { .logo span { display: none; } .btn-geo span { display: none; } .btn-geo { padding: 0 11px; } }

/* Sugerencias */
.sugg { position: absolute; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); z-index: 60; max-height: 60vh; overflow: auto; text-align: left; }
.sugg a { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 8px; color: var(--ink); }
.sugg a:hover, .sugg a.act { background: var(--surface-2); text-decoration: none; }
.sugg small { color: var(--ink-3); } .sugg b { color: var(--good); font-weight: 700; white-space: nowrap; }

/* Hero */
.hero { background: radial-gradient(1200px 400px at 80% -10%, #14b8a6 0%, transparent 60%), linear-gradient(135deg, #0f766e, #134e4a); color: #fff; padding: 56px 0 64px; }
.hero h1 { color: #fff; max-width: 760px; }
.hero .lead { color: #d1fae5; font-size: 1.1rem; max-width: 720px; }
.hero-in { text-align: center; } .hero-in h1, .hero-in .lead { margin-left: auto; margin-right: auto; }
.hero-sm { padding: 20px 0 28px; background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--line); }
.hero-sm h1 { color: var(--ink); } .hero-sm .lead { color: var(--ink-2); font-size: 1.02rem; }
.big-search { position: relative; max-width: 620px; margin: 24px auto 14px; display: flex; align-items: center; }
.big-search svg { position: absolute; left: 18px; color: var(--ink-3); width: 22px; height: 22px; }
.big-search input { width: 100%; height: 60px; border-radius: 16px; border: 0; padding: 0 20px 0 52px; font: inherit; font-size: 1.1rem; background: var(--surface); color: var(--ink); box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.hero-sm .big-search { margin-left: 0; } .hero-sm .big-search input { box-shadow: none; border: 1px solid var(--line); padding-left: 20px; }
.updated { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ink-3); margin: 4px 0 16px; }
.updated.light { color: #a7f3d0; display: flex; justify-content: center; margin-top: 18px; }
.live { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
@media (prefers-reduced-motion: reduce) { .live { animation: none; } }

/* Migas */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0 0 10px; font-size: .85rem; color: var(--ink-3); }
.crumbs li + li::before { content: "›"; margin-right: 4px; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn-sm { height: 36px; padding: 0 12px; font-size: .85rem; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-light { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.35); color: #fff; }
.btn[aria-pressed="true"], .btn-ghost[aria-expanded="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Tarjetas resumen */
.sec-h { margin-top: 28px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.pg-home .cards { margin-top: -0px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c, var(--brand)); }
.card-h { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .9rem; color: var(--ink-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--brand)); }
.card-p { display: flex; align-items: baseline; gap: 4px; margin: 4px 0 0; }
.card-p strong { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; color: var(--good); }
.card-p span { color: var(--ink-3); font-size: .9rem; }
.card-sub { font-size: .82rem; color: var(--ink-3); margin-bottom: 8px; }
.card-dl { display: flex; gap: 18px; margin: 0; font-size: .85rem; } .card-dl dt { color: var(--ink-3); } .card-dl dd { margin: 0; font-weight: 600; }
.card-save { margin-top: 10px; font-size: .82rem; background: var(--good-bg); color: var(--good); padding: 6px 10px; border-radius: 8px; }
.fuel-g95 { --c: var(--g95); } .fuel-gasoleoA { --c: var(--gasoleoA); } .fuel-g98 { --c: var(--g98); } .fuel-gasoleoPremium { --c: var(--gasoleoPremium); } .fuel-glp { --c: var(--glp); }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; margin-top: 20px; }
@media (max-width: 960px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.layout > *, .toolbar > *, .hero-sm .wrap > * { min-width: 0; }
.toolbar { grid-template-columns: minmax(0, 1fr); }
.col-side { display: grid; gap: 16px; }
.box, .side-box, .chart-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.box + .box { margin-top: 16px; }

/* Toolbar */
.toolbar { position: sticky; top: 60px; z-index: 30; background: var(--bg); padding: 10px 0; display: grid; gap: 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; user-select: none; }
.chip { position: relative; }
.chip input { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--brand)); }
.chip:has(input:checked), .chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip:has(input:focus-visible) { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sel select { height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .88rem; padding: 0 10px; }
.tog { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: .85rem; cursor: pointer; }
.tog input { accent-color: var(--brand); }
@media (max-width: 640px) { .tools .tog span { font-size: .8rem; } .tools { gap: 6px; } }
.map-wrap { margin: 4px 0 12px; } .map { height: 380px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); }
@media (max-width: 640px) { .map { height: 300px; } }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-3); }

/* Gasolinera */
.list { display: grid; gap: 10px; } .chunk { display: grid; gap: 10px; } .chunk:empty { display: none; }
.st { display: grid; grid-template-columns: 26px 44px minmax(0, 1fr) auto; grid-template-areas: "rank logo body price" "rank logo act act"; gap: 4px 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); transition: border-color .2s, box-shadow .2s; }
.st:target, .st.hl { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 30%, transparent); }
.st-rank { grid-area: rank; align-self: start; padding-top: 10px; font-weight: 800; color: var(--ink-3); font-size: .95rem; text-align: center; }
.st:first-child .st-rank { color: var(--good); }
.st-logo { grid-area: logo; align-self: start; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: .85rem; color: #fff; background: hsl(var(--h) 55% 42%); letter-spacing: .02em; }
.st-body { grid-area: body; min-width: 0; }
.st-name { margin: 0; font-size: 1.02rem; }
.st-addr { margin: 2px 0 0; color: var(--ink-2); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; }
.st-meta { margin: 4px 0 0; font-size: .8rem; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.st-meta .ok { color: var(--good); font-weight: 600; } .st-meta .ko { color: var(--bad); font-weight: 600; }
.st-dist:not(:empty) { font-weight: 600; color: var(--ink-2); }
.st-dist:not(:empty)::before { content: "📍 "; }
.pill { font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; } .pill.warn { background: var(--mid-bg); color: var(--mid); }
.st-fuels { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0 0; padding: 0; font-size: .8rem; color: var(--ink-2); }
.st-fuels span { color: var(--ink-3); margin-right: 3px; } .st-fuels li.on { display: none; }
.st-price { grid-area: price; text-align: right; padding: 6px 12px; border-radius: 12px; min-width: 104px; }
.st-price strong { display: block; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.st-price .unit { font-size: .75rem; color: var(--ink-3); }
.st-price small { display: block; font-size: .72rem; font-weight: 600; }
.st-price.t1 { background: var(--good-bg); } .st-price.t1 strong, .st-price.t1 small { color: var(--good); }
.st-price.t2 { background: var(--mid-bg); } .st-price.t2 strong, .st-price.t2 small { color: var(--mid); }
.st-price.t3 { background: var(--bad-bg); } .st-price.t3 strong, .st-price.t3 small { color: var(--bad); }
.st-act { grid-area: act; display: flex; gap: 8px; margin-top: 8px; }
@media (max-width: 560px) {
  .st { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "logo name price" "logo addr price" "meta meta meta" "fuels fuels fuels" "act act act"; padding: 12px; gap: 2px 10px; }
  .st-body { display: contents; } .st-name { grid-area: name; align-self: end; } .st-addr { grid-area: addr; align-self: start; }
  .st-meta { grid-area: meta; margin-top: 8px; } .st-fuels { grid-area: fuels; }
  .st-rank { display: none; } .st-logo { width: 40px; height: 40px; }
  .st-price { min-width: 0; padding: 4px 8px; } .st-price strong { font-size: 1.35rem; }
  .st-act .btn { flex: 1; }
}

/* Lateral */
.near { list-style: none; margin: 0; padding: 0; }
.near a { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink); align-items: baseline; }
.near a:hover { text-decoration: none; color: var(--brand); } .near small { color: var(--ink-3); } .near b { color: var(--good); }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 21px; fill: var(--ink-3); } .chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ln { fill: none; stroke-width: 2.5; } .ln-g95 { stroke: var(--g95); } .ln-gasoleoA { stroke: var(--gasoleoA); }
.pt-g95 { fill: var(--g95); } .pt-gasoleoA { fill: var(--gasoleoA); }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--ink-2); }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.lg-g95::before { background: var(--g95); } .lg-gasoleoA::before { background: var(--gasoleoA); }

/* Tablas */
.table-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); background: var(--surface-2); }
.tbl th[data-sortcol] { cursor: pointer; } .tbl th[data-sortcol]::after { content: " ↕"; opacity: .5; }
.tbl td.good { color: var(--good); font-weight: 700; } .tbl td.bad { color: var(--bad); }
.tbl tbody tr:hover { background: var(--surface-2); }
.filter { width: 100%; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); padding: 0 14px; font: inherit; margin-bottom: 10px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 10px; }
.rank { list-style: none; counter-reset: r; margin: 0; padding: 0; }
.rank li { counter-increment: r; display: grid; grid-template-columns: 22px 36px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rank li::before { content: counter(r); font-weight: 800; color: var(--ink-3); text-align: center; }
.rank .st-logo { width: 36px; height: 36px; font-size: .75rem; border-radius: 10px; }
.rank small { display: block; color: var(--ink-3); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank div { min-width: 0; } .rank strong { color: var(--good); font-size: 1.15rem; }
.muni-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.muni-grid a { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface-2); }
.muni-grid a:hover { text-decoration: none; border-color: var(--brand-2); }
.muni-grid small { color: var(--ink-3); } .muni-grid span { font-size: .85rem; color: var(--ink-2); } .muni-grid strong { color: var(--good); }

/* Info / FAQ */
.info { margin: 32px auto 40px; } .info h2 { margin-top: 28px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; margin-bottom: 8px; }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--ink-3); } .faq details[open] summary::after { content: "−"; }
.faq p { margin: 0 0 14px; color: var(--ink-2); }
.prov-list { list-style: none; padding: 0; columns: 4 160px; gap: 16px; } .prov-list li { padding: 3px 0; }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; } .how p { color: var(--ink-2); margin: 4px 0 0; }
.legal { max-width: 760px; }

/* Publicidad: altura reservada para evitar CLS */
.ad { margin: 18px 0; text-align: center; }
.ad-label { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 4px; }
/* Altura reservada = sin saltos de página (CLS) */
.ad-belowList { min-height: 300px; }
.ad-side1, .ad-side2 { margin: 0; min-height: 620px; }
.ad-preview.ad-side1 .ad-ph, .ad-preview.ad-side2 .ad-ph { width: 300px; height: 600px; margin: 0 auto; }
.ad-ph { display: grid; place-items: center; height: 100%; min-height: inherit; border: 2px dashed var(--line); border-radius: 12px; color: var(--ink-3); font-size: .85rem; background: repeating-linear-gradient(45deg, transparent 0 10px, var(--surface-2) 10px 20px); }
.ad-preview { display: flex; flex-direction: column; } .ad-preview .ad-ph { flex: 1; }

/* Leaflet: etiquetas de precio */
.pm { background: var(--surface); color: var(--ink); border: 2px solid var(--c); border-radius: 8px; font: 700 12px/1 var(--font); padding: 4px 6px; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.25); transform: translate(-50%, -100%); position: absolute; }
.pm.t1 { --c: var(--good); } .pm.t2 { --c: var(--mid); } .pm.t3 { --c: var(--bad); }
.pm::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -5px; border: 5px solid transparent; border-top-color: var(--c); border-bottom: 0; }
.pm.me { --c: #2563eb; background: #2563eb; color: #fff; }

/* Pie */
.foot { background: var(--surface); border-top: 1px solid var(--line); padding: 32px 0; margin-top: 40px; color: var(--ink-2); font-size: .9rem; }
.foot-in { display: grid; grid-template-columns: 1fr auto; gap: 24px; }
.foot nav { display: grid; gap: 8px; align-content: start; }
@media (max-width: 640px) { .foot-in { grid-template-columns: 1fr; } }

/* Móvil: tarjetas resumen en carrusel horizontal */
@media (max-width: 640px) {
  .cards { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 74%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 6px; }
  .cards::-webkit-scrollbar { display: none; }
  .card { scroll-snap-align: start; padding: 12px 14px; }
  .card-p strong { font-size: 1.7rem; }
  .hero-sm .lead { font-size: .95rem; }
}

/* Guías */
.top-link { font-weight: 600; color: var(--ink); font-size: .92rem; padding: 0 4px; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.guide-card { display: grid; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.guide-card:hover { text-decoration: none; border-color: var(--brand-2); }
.guide-card b { font-size: 1.02rem; line-height: 1.3; } .guide-card span { color: var(--ink-2); font-size: .9rem; }
.prose { font-size: 1.04rem; line-height: 1.7; } .prose h2 { margin-top: 1.6em; font-size: 1.25rem; }
.prose li { margin: .35em 0; } .prose p, .prose ul, .prose ol { max-width: 70ch; }
.box.prose { padding: 20px 24px; }
.side-guides { list-style: none; margin: 0; padding: 0; } .side-guides li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .92rem; line-height: 1.35; }
.big-search.mini { margin: 8px 0 0; } .big-search.mini input { height: 44px; font-size: 1rem; box-shadow: none; border: 1px solid var(--line); padding-left: 14px; }
@media (max-width: 640px) { .top-link { display: none; } .box.prose { padding: 16px; } }
