:root {
  --bg: #f5f7fa; --card: #ffffff; --text: #1f2937; --muted: #6b7280;
  --accent: #1a73e8; --accent-dark: #1557b0; --success: #059669;
  --border: #e5e7eb; --shadow: 0 4px 12px rgba(0,0,0,0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
header {
  background: var(--accent); color: white; padding: 1rem 1.25rem; text-align: center;
  position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
header h1 { font-size: 1.4rem; font-weight: 600; }
header p { font-size: 0.85rem; opacity: 0.9; margin-top: 0.25rem; }
.container { max-width: 640px; margin: 0 auto; padding: 1rem; }
.banner {
  background: #fff7ed; color: #9a3412; border: 1px solid #fdba74; border-radius: 10px;
  padding: 0.6rem 0.8rem; font-size: 0.85rem; margin-bottom: 1rem;
}
.filters { background: var(--card); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
#fuelPanel > summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; gap: 0.15rem; }
#fuelPanel > summary::-webkit-details-marker { display: none; }
#fuelPanel > summary .sum-title { font-size: 1rem; font-weight: 600; }
#fuelPanel > summary .sum-title::after { content: " ▾"; color: var(--muted); }
#fuelPanel[open] > summary .sum-title::after { content: " ▴"; }
#fuelPanel > summary .sum-sel { font-size: 0.85rem; color: var(--muted); }
#fuelPanel[open] > summary { margin-bottom: 0.75rem; }
.fuel-group { margin-bottom: 0.6rem; }
.fuel-group summary { font-size: 0.85rem; color: var(--muted); cursor: pointer; margin-bottom: 0.4rem; }
.group-title { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 0.35rem; }
.fuel-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.fuel-item {
  display: flex; align-items: center; gap: 0.4rem; background: #f0f4f8;
  padding: 0.45rem 0.75rem; border-radius: 999px; font-size: 0.9rem; cursor: pointer; user-select: none;
}
.fuel-item input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.controls { display: flex; gap: 0.75rem; margin-top: 0.75rem; flex-wrap: wrap; }
.control { flex: 1; min-width: 9rem; display: flex; flex-direction: column; font-size: 0.8rem; color: var(--muted); gap: 0.25rem; }
.control select {
  font-size: 0.95rem; padding: 0.5rem; border-radius: 8px; border: 1px solid var(--border);
  background: #f9fafb; color: var(--text);
}
.status { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.status.error { color: #dc2626; }
.status.info { padding: 0.75rem 1rem; font-size: 0.9rem; }
.cards { display: flex; flex-direction: column; gap: 1rem; }
.card { background: var(--card); border-radius: 14px; padding: 1rem 1.1rem; box-shadow: var(--shadow); border: 1px solid var(--border); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.5rem; }
.brand { font-weight: 700; font-size: 1.1rem; overflow-wrap: anywhere; }
.distance { color: var(--accent); font-weight: 600; font-size: 0.95rem; white-space: nowrap; }
.address { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.75rem; overflow-wrap: anywhere; }
.prices { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.price-badge { background: #ecfdf5; color: var(--success); padding: 0.35rem 0.6rem; border-radius: 8px; font-size: 0.85rem; font-weight: 600; }
.price-badge.cheapest { background: #d1fae5; border: 1px solid #059669; }
.price-badge.missing { background: #f3f4f6; color: var(--muted); font-weight: 500; }
.tag { display: inline-block; background: #fef3c7; color: #92400e; border-radius: 6px; padding: 0.1rem 0.45rem; font-size: 0.75rem; margin-bottom: 0.5rem; }
.meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.75rem; }
.actions { display: flex; gap: 0.5rem; }
.btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.7rem 0.5rem; border-radius: 10px; font-size: 0.9rem; font-weight: 600;
  text-decoration: none; border: none; cursor: pointer; text-align: center;
}
.btn-google { background: #4285f4; color: white; }
.btn-apple { background: #000; color: white; }
.btn:active { opacity: 0.85; transform: scale(0.98); }
.refresh, .more {
  width: 100%; margin-top: 0.5rem; padding: 0.8rem; background: var(--accent); color: white;
  border: none; border-radius: 10px; font-size: 1rem; font-weight: 600; cursor: pointer;
}
.more { background: white; color: var(--accent); border: 1px solid var(--accent); margin-top: 1rem; }
.refresh:disabled { opacity: 0.6; }
.updated { text-align: center; font-size: 0.8rem; color: var(--muted); margin: 0.5rem 0 1rem; }
.foot { margin: 1.5rem 0 1rem; font-size: 0.75rem; color: var(--muted); text-align: center; }
.foot p + p { margin-top: 0.4rem; }
@media (min-width: 480px) { .container { padding: 1.25rem; } }

.place-search { background: var(--card); border-radius: 12px; padding: 0.75rem 1rem; margin-top: 0.75rem; box-shadow: var(--shadow); }
.place-search > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.place-search[open] > summary { margin-bottom: 0.6rem; }
.place-search input {
  width: 100%; font-size: 1rem; padding: 0.6rem 0.7rem; border-radius: 8px; border: 1px solid var(--border);
  background: #f9fafb; color: var(--text); margin-top: 0.25rem;
}
.sugg-list { display: flex; flex-direction: column; margin-top: 0.4rem; }
.sugg {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 0.05rem;
  background: none; border: none; border-bottom: 1px solid var(--border); padding: 0.55rem 0.25rem; cursor: pointer; color: var(--text); font: inherit;
}
.sugg:hover, .sugg:focus { background: #f0f4f8; outline: none; }
.sugg-label { font-weight: 600; }
.sugg-sub { font-size: 0.8rem; color: var(--muted); }
.sugg-empty { font-size: 0.85rem; color: var(--muted); padding: 0.4rem 0.25rem; }
.help { background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.help-title { font-size: 1.05rem; color: #b91c1c; margin-bottom: 0.35rem; }
.help-intro { font-size: 0.9rem; margin-bottom: 0.6rem; }
.help-device { font-size: 0.95rem; margin-bottom: 0.35rem; }
.help-steps { padding-left: 1.25rem; font-size: 0.9rem; display: flex; flex-direction: column; gap: 0.3rem; }
.help-others { margin-top: 0.8rem; }
.help-sub { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.3rem; }
.help-dev { background: white; border-radius: 8px; padding: 0.45rem 0.7rem; margin-bottom: 0.4rem; border: 1px solid var(--border); }
.help-dev summary { cursor: pointer; font-size: 0.9rem; font-weight: 600; }
.help-dev[open] summary { margin-bottom: 0.4rem; }
.help-actions .refresh { margin-top: 0.8rem; }
.help-actions .more { margin-top: 0.5rem; }
.source { font-size: 0.85rem; border-radius: 10px; padding: 0.55rem 0.8rem; margin-top: 0.75rem; }
.source.gps { color: var(--muted); text-align: center; padding: 0.2rem; }
.source.manual { background: #eff6ff; border: 1px solid #93c5fd; color: #1e3a8a; }
.linkbtn { background: none; border: none; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 0; }

.help-actions-top { margin-bottom: 0.8rem; }
.help-actions-top .refresh { margin-top: 0.4rem; }

/* ---------- Búsqueda rápida ---------- */
.quick { background: var(--card); border-radius: 14px; padding: 1rem; box-shadow: var(--shadow); margin-bottom: 0.5rem; }
.qgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.qbtn {
  min-height: 4.2rem; font: inherit; font-size: 1.15rem; font-weight: 700; border-radius: 14px; cursor: pointer;
  border: 2px solid var(--border); background: #f0f4f8; color: var(--text); padding: 0.5rem; touch-action: manipulation;
}
.qbtn.on { background: var(--accent); border-color: var(--accent-dark); color: white; box-shadow: 0 0 0 3px rgba(26,115,232,0.25); }
.qbtn.on::before { content: "✓ "; }
.qbtn:focus-visible, .qgo:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.qgo {
  width: 100%; margin-top: 0.8rem; min-height: 4rem; font: inherit; font-size: 1.25rem; font-weight: 800;
  border: none; border-radius: 14px; background: var(--success); color: white; cursor: pointer; touch-action: manipulation;
}
.qgo:disabled { background: #cbd5e1; color: #475569; cursor: not-allowed; }
.qhint { text-align: center; font-size: 0.9rem; color: var(--muted); margin-top: 0.45rem; }
.adv-toggle { display: block; width: 100%; background: none; border: none; color: var(--accent); font: inherit; font-weight: 600;
  text-decoration: underline; padding: 0.6rem; cursor: pointer; margin-bottom: 0.5rem; }
.ev-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; justify-content: center; }
.chip { font: inherit; font-size: 0.95rem; padding: 0.55rem 0.9rem; border-radius: 999px; border: 2px solid var(--border); background: #f0f4f8; color: var(--text); cursor: pointer; }
.chip.on { background: #ecfdf5; border-color: var(--success); color: #065f46; font-weight: 700; }
.ev-note { background: #f0fdf4; border: 1px solid #86efac; color: #14532d; border-radius: 10px; padding: 0.55rem 0.8rem; font-size: 0.85rem; margin: 0.5rem 0; }
.ev-note-attr { font-size: 0.75rem; color: #166534; margin-top: 0.2rem; }
.qcard { background: var(--card); border-radius: 16px; padding: 1rem 1.1rem; box-shadow: var(--shadow); border: 1px solid var(--border); }
.qcard.best { border: 2px solid var(--success); }
.qtop { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.qprice { font-size: 2.2rem; font-weight: 800; color: var(--success); line-height: 1.1; }
.qcard.ev .qprice { color: var(--accent-dark); }
.qunit { font-size: 1rem; font-weight: 600; color: var(--muted); margin-left: 0.15rem; }
.qdist { font-size: 1.4rem; font-weight: 700; color: var(--accent); white-space: nowrap; }
.qbadge { display: inline-block; background: #d1fae5; color: #065f46; border-radius: 6px; padding: 0.1rem 0.5rem; font-size: 0.8rem; font-weight: 700; margin-top: 0.2rem; }
.qname { font-size: 1.1rem; font-weight: 700; margin-top: 0.3rem; overflow-wrap: anywhere; }
.qop { font-size: 0.85rem; color: var(--muted); }
.qaddr { font-size: 0.9rem; color: var(--muted); overflow-wrap: anywhere; }
.qsec { font-size: 0.95rem; margin-top: 0.3rem; color: var(--text); }
.conns { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; }
.conn { background: #eff6ff; color: #1e3a8a; border-radius: 8px; padding: 0.25rem 0.55rem; font-size: 0.85rem; font-weight: 600; }
.qcard .meta { margin: 0.4rem 0 0; }
/* Con resultados en modo rápido: panel compacto y resultados visibles sin desplazar */
.container { display: flex; flex-direction: column; }
.foot { order: 20; }
body.qres #advToggle, body.qres #placeSearch { order: 10; }
body.qres .quick { padding: 0.7rem; }
body.qres .qbtn { min-height: 3.1rem; font-size: 1rem; }
body.qres .qgo { min-height: 3.1rem; font-size: 1.1rem; margin-top: 0.6rem; }
body.qres .qhint { display: none; }
body.qres .ev-filters { margin-top: 0.5rem; }
body.qres .source.gps { display: none; }
body.qres .status.info { padding: 0.3rem 0.5rem; font-size: 0.85rem; }
body.qres .updated { margin: 0.3rem 0 0.2rem; font-size: 0.75rem; }
body.qres .chip { font-size: 0.85rem; padding: 0.4rem 0.7rem; }
body.qres .ev-note { padding: 0.4rem 0.7rem; font-size: 0.8rem; margin: 0.2rem 0 0.6rem; }

/* Botones de navegación: siempre los dos, mismo tamaño, uno al lado del otro */
.navbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.75rem; }
.navbtn { display: flex; align-items: center; justify-content: center; min-height: 3.4rem; padding: 0.4rem; border-radius: 14px;
  font-size: 1.1rem; font-weight: 800; text-decoration: none; text-align: center; line-height: 1.15; }
.navbtn.btn-apple { background: #000; color: #fff; }
.navbtn.btn-google { background: #1a73e8; color: #fff; }
.navbtn:active { opacity: 0.85; transform: scale(0.98); }
.navbtn:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
