/* ============================================================
   emap app shell — implementación del diseño "emap Bizkaia"
   Vistas: mapa (1a/1c/2a), ruta (1b), búsqueda (2b),
   capas (2c), navegación activa (3a–3d).
   ============================================================ */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: var(--font-ui); cursor: pointer; color: inherit; }
button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 2px;
}

/* ---------- primitivas ---------- */

.mono-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--text-3);
  text-transform: uppercase;
}

.badge-line {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: #FFFFFF;
  border-radius: var(--r-badge);
  padding: 2px 6px;
  flex: none;
}
.badge-line.l1 { background: var(--metro-l1); }
.badge-line.l2 { background: var(--metro-l2); }

.rt-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--rt);
  animation: emapPulse 1.6s infinite;
}

.btn-icon {
  width: var(--tap-lg); height: var(--tap-lg);
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
}
.btn-icon svg { stroke: currentColor; }

.chip {
  height: var(--tap);
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  font-size: 13px; font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(10, 11, 13, 0.08);
}

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

.cta {
  min-height: 50px;
  border: none;
  border-radius: var(--r-card);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 16px; font-weight: 650; letter-spacing: -0.01em;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
}
.btn-exit {
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid var(--danger-border);
  border-radius: var(--r-card);
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: 14px; font-weight: 600;
}

/* ---------- layout raíz ---------- */

#app { display: flex; height: 100dvh; width: 100%; }

/* Sidebar — solo desktop (1c / 2a) */
#sidebar {
  width: 372px; flex: none; height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 30;
}
@media (min-width: 900px) { #sidebar { display: flex; } }

.brand-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.brand { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; color: var(--text); }
.brand em { font-style: normal; color: var(--accent-deep); }
.brand-sub { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.2em; color: var(--text-2); }

.lang-switch { margin-left: auto; display: flex; gap: 2px; font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
.lang-switch button { padding: 4px 7px; border-radius: 4px; border: none; background: none; color: var(--text-2); }
.lang-switch button[aria-pressed="true"] { background: var(--text); color: var(--surface); }

.sidebar-body {
  flex: 1; overflow-y: auto;
  padding: 16px 20px 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.sidebar-foot {
  margin-top: auto;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.15em;
  color: var(--text-faint); line-height: 1.9;
}

/* Campo de búsqueda */
.search-field {
  min-height: var(--tap-lg);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  font-size: 15px; color: var(--text-2);
  width: 100%; text-align: left;
}
.search-field.raised { box-shadow: var(--shadow-card); }
.search-field { min-width: 0; }
.search-field > span.label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-field .lang-switch { flex: none; }
.search-field.active {
  border: 2px solid var(--text);
  box-shadow: 0 0 0 3px var(--focus-ring);
  color: var(--text);
}
.caret { width: 2px; height: 20px; background: var(--text); animation: emapPulse 1.1s infinite; }

/* Lista de items (recientes / lugares / resultados) */
.list-item {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap);
  border-bottom: 1px solid var(--divider);
  font-size: 14px; color: var(--text);
  width: 100%; background: none; border-left: none; border-right: none; border-top: none;
  text-align: left; padding: 0;
}
.list-item:last-child { border-bottom: none; }
.list-item .meta { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--text-3); }
.list-item svg { flex: none; }

/* Accesos rápidos Casa/Trabajo/GPS */
.quick-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.quick {
  min-width: 0;
  min-height: var(--tap-lg);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 13px; font-weight: 500; color: var(--text);
}
.quick.primary { background: var(--accent); border-color: var(--text); color: var(--accent-ink); font-weight: 600; }
.quick.primary svg { stroke: var(--accent-ink); }

/* ---------- área de mapa ---------- */

#map-area { position: relative; flex: 1; height: 100%; overflow: hidden; }
#map { position: absolute; inset: 0; }
#map canvas { outline: none; }

.map-attr {
  position: absolute; left: 16px; bottom: 14px;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.12em;
  color: var(--text-3);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  padding: 3px 8px; border-radius: 3px;
  pointer-events: none;
  z-index: 5;
}

.gps-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--gps);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 6px rgba(14, 116, 144, 0.22);
  transform: translate(-50%, -50%);
  z-index: 4;
}

/* POI pins */
.poi {
  display: flex; align-items: center; gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px; padding: 4px 7px;
  box-shadow: 0 2px 8px rgba(10, 11, 13, 0.14);
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  color: var(--text); z-index: 4; cursor: pointer;
}
.poi.bike { border-color: var(--bike); color: var(--bike-deep); }
.poi.fuel { border-color: var(--bike); color: var(--bike-deep); }
.poi .tag {
  font-size: 8px; letter-spacing: 0.12em; color: var(--bike-deep);
  background: var(--bike-bg); border-radius: 3px; padding: 2px 4px;
}
.poi-parking {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--parking); color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  box-shadow: 0 2px 8px rgba(10, 11, 13, 0.18);
  z-index: 4; cursor: pointer; border: none;
}
.map-hit { position: absolute; transform: translate(-50%, -50%); width: 34px; height: 34px; background: none; border: none; z-index: 4; }

/* Barra superior móvil (1a) */
#mobile-top {
  position: absolute; left: 14px; right: 14px; top: max(14px, env(safe-area-inset-top));
  display: flex; flex-direction: column; gap: 10px;
  z-index: 10;
}
@media (min-width: 900px) { #mobile-top { display: none; } }
#mobile-top .row { display: flex; gap: 10px; align-items: center; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }

/* Controles del mapa */
#map-controls {
  position: absolute; right: 14px; bottom: 250px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 10;
}
@media (min-width: 900px) { #map-controls { right: 16px; bottom: 40px; } }
.zoom-stack { width: 44px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow-card); overflow: hidden; display: none; }
@media (min-width: 900px) { .zoom-stack { display: block; } }
.zoom-stack button { width: 44px; height: 44px; border: none; background: var(--surface); font-size: 20px; color: var(--text); display: block; }
.zoom-stack button:first-child { border-bottom: 1px solid var(--border-soft); }

/* Botón capas desktop (2a) */
#layers-btn-desktop {
  position: absolute; right: 16px; top: 16px;
  min-height: var(--tap);
  border: 1px solid var(--border); border-radius: var(--r-card);
  background: var(--surface); box-shadow: var(--shadow-card);
  display: none; align-items: center; gap: 8px; padding: 0 14px;
  font-size: 13px; font-weight: 500; color: var(--text);
  z-index: 10;
}
@media (min-width: 900px) { #layers-btn-desktop { display: flex; } }
#layers-btn-desktop .count {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  color: var(--accent-text);
  background: color-mix(in srgb, var(--accent) 25%, var(--surface));
  border-radius: 3px; padding: 2px 6px;
}

/* Popup de parada (1c / 2c) */
.stop-popup {
  position: absolute;
  width: 272px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: 0 12px 40px rgba(10, 11, 13, 0.3);
  z-index: 20;
}
.stop-popup .head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border-soft);
  font-size: 14px; font-weight: 600;
}
.stop-popup .close { margin-left: auto; background: none; border: none; color: var(--text-2); padding: 4px; display: flex; }
.stop-popup .body { padding: 6px 14px 10px; }
.arrival { display: flex; align-items: center; gap: 8px; min-height: 34px; font-size: 13px; }
.arrival .sq { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.arrival .eta { margin-left: auto; font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.arrival .eta.live { font-weight: 700; color: var(--rt-text); }
.stop-popup .tail {
  position: absolute; left: 50%; bottom: -7px;
  transform: translateX(-50%) rotate(45deg);
  width: 12px; height: 12px; background: var(--surface);
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
}

/* Panel de capas desktop (1c) */
#layers-panel {
  position: absolute; right: 16px; top: 16px; width: 248px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow-pop);
  padding: 6px 16px 14px; z-index: 21;
  display: flex; flex-direction: column;
  max-height: calc(100dvh - 32px);
}
#layers-panel [data-layer-list] { overflow-y: auto; overscroll-behavior: contain; margin: 0 -16px; padding: 0 16px; }
.layers-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); font-size: 14px; font-weight: 600; }
.layer-row { display: flex; align-items: center; gap: 9px; min-height: 32px; font-size: 13px; color: var(--text); width: 100%; background: none; border: none; padding: 0; text-align: left; }
.layer-row[aria-pressed="false"] { color: var(--text-2); }
.layer-row .swatch { margin-left: auto; display: flex; gap: 3px; align-items: center; }
.lr-line { width: 12px; height: 5px; border-radius: 2px; }
.lr-zbe { width: 12px; height: 8px; border-radius: 2px; background: color-mix(in srgb, var(--zbe) 35%, transparent); border: 1px dashed var(--zbe-stroke); }
.checkbox { width: 15px; height: 15px; border-radius: 4px; flex: none; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--border); background: transparent; }
[aria-pressed="true"] .checkbox { background: var(--text); border-color: var(--text); }
[aria-pressed="true"] .checkbox svg { display: block; stroke: var(--accent); }
[aria-pressed="false"] .checkbox svg { display: none; }
.layers-section { padding: 12px 0 4px; }
.layers-section + .layers-section { border-top: 1px solid var(--border-soft); margin-top: 8px; }

/* ---------- panel de ruta móvil (1a colapsado / 1b expandido) ---------- */

#route-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--shadow-sheet);
  z-index: 25;
  display: flex; flex-direction: column;
  max-height: 88dvh;
  transition: transform 0.25s ease;
}
@media (min-width: 900px) { #route-panel { display: none; } }
.grabber { display: flex; justify-content: center; padding: 8px 0 6px; flex: none; background: none; border: none; width: 100%; }
.grabber span { width: 40px; height: 4px; border-radius: 2px; background: var(--border); }

#route-collapsed { padding: 0 16px calc(20px + env(safe-area-inset-bottom)); }
.plan-cta {
  min-height: var(--tap-lg);
  border: 1px solid var(--border); border-radius: var(--r-card);
  background: var(--surface-2);
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  font-size: 15px; font-weight: 500; color: var(--text); width: 100%;
}
.plan-cta .ring { width: 10px; height: 10px; border-radius: 50%; border: 3px solid var(--text); flex: none; }

#route-expanded { display: none; flex-direction: column; flex: 1; overflow: hidden; }
#route-panel[data-snap="full"] { height: 88dvh; background: var(--surface-2); }
#route-panel[data-snap="full"] #route-collapsed { display: none; }
#route-panel[data-snap="full"] #route-expanded { display: flex; }
/* half: el resultado no tapa el mapa (P1 auditoría UX). El mapa queda visible
   arriba con fitBounds; se arrastra el grabber para pasar a full. */
#route-panel[data-snap="half"] { height: 52dvh; background: var(--surface-2); }
#route-panel[data-snap="half"] #route-collapsed { display: none; }
#route-panel[data-snap="half"] #route-expanded { display: flex; }
.route-scroll { flex: 1; overflow-y: auto; padding: 4px 16px 8px; display: flex; flex-direction: column; gap: 10px; }
.route-foot {
  flex: none; padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-soft); background: var(--surface-2);
}

/* Origen / destino */
.od { display: flex; gap: 10px; align-items: stretch; }
.od-rail { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 0; }
.od-rail .o { width: 9px; height: 9px; border-radius: 50%; border: 2.5px solid var(--text); }
.od-rail .bar { width: 2px; flex: 1; background: var(--border); }
.od-rail .d { width: 9px; height: 9px; background: var(--accent); border-radius: 2px; }
.od-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.od-field {
  min-height: var(--tap);
  border: 1px solid var(--border); border-radius: var(--r-card);
  background: var(--surface);
  display: flex; align-items: center; gap: 9px; padding: 0 12px;
  font-size: 15px; color: var(--text); width: 100%; text-align: left;
}
.od-field.focus { border-color: var(--accent-deep); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.od-swap { width: 44px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--text-2); }

/* Tabs de modo */
.mode-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mode-tab {
  min-height: 50px;
  border: 1px solid var(--border); border-radius: var(--r-card);
  background: var(--surface); color: var(--text-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.mode-tab .t { font-family: var(--font-mono); font-size: 10px; }
.mode-tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.mode-tab[aria-selected="true"] .t { font-weight: 700; }
.mode-tab[aria-selected="true"] svg { stroke: var(--accent-ink); }
[data-theme="light"] #sidebar .mode-tab[aria-selected="true"] { background: var(--text); color: var(--accent); border-color: var(--text); }
[data-theme="light"] #sidebar .mode-tab[aria-selected="true"] svg { stroke: var(--accent); }
.mode-co2 { font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.03em; color: var(--text-2); opacity: 0.75; }
.mode-co2.zero { color: var(--bike-deep); opacity: 1; }
.mode-tab[aria-selected="true"] .mode-co2 { color: inherit; opacity: 0.85; }
.step-impact { display: inline-block; margin-left: 8px; font-family: var(--font-mono); font-size: 10px; color: var(--text-2); vertical-align: baseline; }

/* Resultado recomendado */
.recommended { border: 1px solid var(--accent-deep); border-radius: var(--r-card); background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
[data-theme="light"] .recommended { background: #FBFDF4; border-width: 1.5px; }
.rec-badge {
  font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: 0.15em;
  color: var(--accent-ink); background: var(--accent);
  border-radius: 3px; padding: 3px 6px; flex: none;
}
.rec-head { display: flex; align-items: flex-start; gap: 8px; }
.share-btn {
  margin-left: auto; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); cursor: pointer;
}
.share-btn:hover { background: var(--surface-2); color: var(--text); }
.star-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  color: var(--text-3); font-size: 16px; cursor: pointer;
}
.star-btn:hover { background: var(--surface-2); color: var(--text); }
.star-btn.on { color: #EAB308; }

/* lente de perfil (B.7) */
.lens-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 40px; padding: 0 10px; margin-bottom: 10px;
  border: 1.5px dashed var(--border); border-radius: 10px;
  background: transparent; color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.lens-btn:hover { background: var(--surface-2); }
.lens-btn.on { border-style: solid; border-color: var(--bike-deep, #15803D); color: var(--bike-deep, #15803D); }
.lens-btn .meta { margin-left: auto; font-size: 9px; letter-spacing: .08em; }

/* avisos de servicio: colapsados a 2 líneas, tap para leer entero */
.step-alert.expandable { cursor: pointer; }
.step-alert.expandable .alert-text {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.step-alert.expandable.open .alert-text { display: inline; -webkit-line-clamp: unset; }
.step-alert .alert-more {
  display: block; margin-top: 2px;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: .08em;
  text-transform: uppercase; opacity: .75;
}
.step-alert.open .alert-more { display: none; }
#flash-chip {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%);
  padding: 9px 18px; border-radius: 999px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-pop);
  font-size: 13px; font-weight: 600; z-index: 40;
  animation: flash-in .18s ease-out;
}
@keyframes flash-in { from { opacity: 0; transform: translate(-50%, 6px); } }

/* score de confort (B.5) */
.extra-chip.cf-good { border-color: color-mix(in srgb, var(--bike-deep, #15803D) 55%, var(--border)); color: var(--bike-deep, #15803D); font-weight: 700; }
.extra-chip.cf-mid  { border-color: color-mix(in srgb, #B45309 55%, var(--border)); color: #B45309; font-weight: 700; }
.extra-chip.cf-bad  { border-color: color-mix(in srgb, #B91C1C 55%, var(--border)); color: #DC2626; font-weight: 700; }
.rec-head .why { font-size: 12px; color: var(--text-2); line-height: 1.4; }
.rec-stats { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rec-stats .big { font-size: 30px; font-weight: 650; letter-spacing: -0.03em; }
.rec-stats .m { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); white-space: nowrap; }
.rec-stats .m.lime { color: var(--accent-text); font-weight: 700; }
.zbe-warn {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid color-mix(in srgb, var(--zbe) 40%, transparent);
  background: color-mix(in srgb, var(--zbe) 8%, transparent);
  border-radius: 6px; padding: 8px 10px;
  font-size: 12px; color: var(--zbe); line-height: 1.4;
}
[data-theme="light"] .zbe-warn { color: var(--zbe-text); }

/* Pasos */
.steps { border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface); padding: 4px 14px; display: flex; flex-direction: column; }
.step { display: flex; align-items: center; gap: 12px; min-height: var(--tap); border-bottom: 1px solid var(--border-soft); font-size: 14px; }
.step .badge-line { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: none; }
.step .txt { min-width: 0; overflow-wrap: anywhere; line-height: 1.45; padding: 9px 0; }
.step.has-stops { align-items: flex-start; }
.step.has-stops .badge-line, .step.has-stops .dur { margin-top: 12px; }
.step:last-child { border-bottom: none; }
.step .txt { flex: 1; line-height: 1.45; }
.step .dur { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); }
.step .live { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--rt-text); }

/* Alternativas */
.alts { display: flex; flex-direction: column; gap: 6px; }
.alt { display: flex; align-items: center; gap: 10px; min-height: var(--tap); border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface); padding: 0 12px; font-size: 13px; width: 100%; text-align: left; }
.alt .m { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); }
.alt .zbe-tag {
  margin-left: auto; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em;
  color: var(--zbe-text); border: 1px solid color-mix(in srgb, var(--zbe) 40%, transparent);
  border-radius: 3px; padding: 2px 6px;
}
[data-theme="light"] .alt .zbe-tag { background: #FDF6E9; border-color: #E5C088; }

/* ---------- overlays ---------- */

.overlay { position: absolute; inset: 0; z-index: 40; display: none; }
.overlay.open { display: flex; }

/* Búsqueda (2b) */
#search-overlay { background: var(--surface); flex-direction: column; }
.search-head {
  flex: none;
  padding: max(14px, env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 10px;
}
.search-head input {
  flex: 1; min-height: var(--tap-lg);
  border: 2px solid var(--text); border-radius: var(--r-card);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background: var(--surface); color: var(--text);
  font-family: var(--font-ui); font-size: 16px;
  padding: 0 14px 0 40px;
}
.search-head input:focus { outline: none; }
.search-head .lens { position: absolute; margin-left: 14px; pointer-events: none; }
.search-head .cancel { min-height: var(--tap); border: none; background: none; font-size: 15px; font-weight: 500; color: var(--text); padding: 0 4px; }
.search-body { flex: 1; overflow-y: auto; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); }
.result-icon { width: 34px; height: 34px; border-radius: 6px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex: none; }
.result-emoji { font-size: 18px; line-height: 1; }
.result-icon.metro { background: #FFF0E5; }
[data-theme="dark"] .result-icon.metro { background: rgba(255, 101, 5, 0.14); }
.search-body .list-item { min-height: 56px; font-size: 15px; }
.search-body mark { background: none; color: inherit; font-weight: 650; }

/* Hoja de capas móvil (2c) */
#layers-sheet { background: rgba(10, 11, 13, 0.4); align-items: flex-end; }
.sheet {
  width: 100%;
  display: flex;
  flex-direction: column;
  max-height: 85dvh;   /* no exceder la pantalla: deja backdrop y grabber visibles */
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--shadow-sheet);
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom));
}
.grabber { flex: none; }
.sheet-head { display: flex; flex: none; align-items: center; gap: 8px; padding: 4px 0 10px; border-bottom: 1px solid var(--border-soft); font-size: 16px; font-weight: 600; }
.sheet-head .active-count { margin-left: auto; font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--accent-deep); }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; overflow-y: auto; min-height: 0; -webkit-overflow-scrolling: touch; padding-top: 4px; }

/* Elegir punto en el mapa */
body.picking #mobile-top, body.picking #map-controls, body.picking #route-panel, body.picking #sidebar { display: none !important; }
#pick-overlay { position: absolute; inset: 0; z-index: 60; pointer-events: none; display: none; }
#pick-overlay:not(.hidden) { display: block; }
.pick-pin-marker { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); font-size: 34px; z-index: 61; pointer-events: none; filter: drop-shadow(0 3px 3px rgba(10,11,13,0.35)); }
.pick-bar { position: absolute; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(420px, calc(100% - 32px)); pointer-events: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sheet); box-shadow: var(--shadow-pop); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.pick-hint { font-size: 14px; color: var(--text-2); text-align: center; }
.pick-actions { display: flex; align-items: center; justify-content: space-between; }
.pick-cancel { font-size: 15px; font-weight: 600; color: var(--text-2); background: none; border: none; cursor: pointer; padding: 6px; }
.pick-confirm { font-size: 15px; font-weight: 800; color: var(--accent-ink); background: var(--accent); border: none; border-radius: var(--r-banner); padding: 12px 28px; cursor: pointer; }

/* Tablón de líneas directas X→Y */
.direct-lines { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.direct-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
.direct-info { flex: 1; min-width: 0; }
.direct-head { font-size: 13px; color: var(--text-2); }
.direct-deps { font-size: 14px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; margin-top: 1px; }

/* Opciones de TP (líneas X→Y) */
.opts { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.opt-row { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: var(--r-card); background: var(--surface); cursor: pointer; }
.opt-row:hover { border-color: var(--border); }
.opt-row.sel { border-color: var(--accent-deep); background: var(--surface-2); }
.opt-top { display: flex; align-items: center; gap: 8px; }
.opt-badges { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-width: 0; }
.opt-direct { font-size: 10px; font-weight: 800; letter-spacing: 0.5px; color: var(--accent-ink); background: var(--accent); padding: 3px 6px; border-radius: 3px; }
.opt-dur { font-size: 14px; font-weight: 800; color: var(--text); flex: none; }
.opt-meta { font-size: 12px; color: var(--text-3); }
.sheet .layer-row { min-height: 44px; font-size: 14px; }
.sheet .checkbox { width: 16px; height: 16px; }
.sheet [aria-pressed="true"] .checkbox { background: var(--accent); border-color: var(--accent); }
.sheet [aria-pressed="true"] .checkbox svg { stroke: var(--accent-ink); }

/* ---------- navegación activa (3a–3d) ---------- */

/* #nav-mode lleva data-theme propio: re-declarar color aquí para que
   var(--text) se resuelva con SUS tokens (el color heredado llega computado). */
#nav-mode { background: var(--bg); color: var(--text); }
#nav-mode.open { display: block; }
.nav-scene { position: absolute; inset: 0; }
.nav-scene svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.nav-view { display: none; position: absolute; inset: 0; }
#nav-mode[data-mode="transit"] .nav-view.transit,
#nav-mode[data-mode="car"] .nav-view.car,
#nav-mode[data-mode="bike"] .nav-view.bike,
#nav-mode[data-mode="walk"] .nav-view.walk { display: block; }

.nav-banner {
  position: absolute; left: 14px; right: 14px; top: max(14px, env(safe-area-inset-top));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-banner);
  box-shadow: var(--shadow-pop);
  padding: 14px;
  z-index: 10;
}
.nav-banner .row { display: flex; align-items: center; gap: 12px; }
.nav-banner .dist { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.nav-banner .what { font-size: 14px; color: var(--text-2); margin-top: 1px; }

.nav-card {
  position: absolute; left: 14px; right: 14px; bottom: 128px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-banner);
  box-shadow: var(--shadow-pop);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  z-index: 10;
}
.nav-card .ic { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: none; }
.nav-card .t1 { font-size: 15px; font-weight: 600; }
.nav-card .t2 { font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.4; }

.nav-bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 16px calc(20px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 14px;
  z-index: 10;
}
.nav-bottom .eta-big { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
[data-theme="dark"] .nav-bottom .eta-big { color: var(--accent); }
.nav-bottom .sep { width: 1px; height: 34px; background: var(--border-soft); }
.nav-bottom .sub { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.12em; color: var(--text-3); }
.nav-bottom .mid { font-size: 16px; font-weight: 600; }
.nav-bottom .btn-exit { margin-left: auto; }

/* Toggle (aviso de bajada) */
.toggle { width: 52px; height: 30px; border-radius: 15px; background: var(--border); position: relative; flex: none; border: none; transition: background 0.15s; }
.toggle[aria-checked="true"] { background: var(--accent); }
.toggle .knob { position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-ink); transition: left 0.15s; }
.toggle[aria-checked="true"] .knob { left: 25px; }

/* Progreso de paradas (3a) */
.stop-progress { display: flex; align-items: center; margin-top: 12px; }
.stop-progress .seg { flex: 1; height: 4px; background: var(--border-soft); }
.stop-progress .seg.done { background: var(--metro-l1); border-radius: 2px; }
.stop-progress .node { width: 10px; height: 10px; border-radius: 50%; background: var(--border-soft); flex: none; }
.stop-progress .node.done { background: var(--metro-l1); }
.stop-progress .node.dest { width: 12px; height: 12px; border: 3px solid var(--text); background: var(--surface); }
.stop-labels { display: flex; justify-content: space-between; margin-top: 6px; font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.1em; color: var(--text-3); }
.stop-labels .dest { color: var(--text); font-weight: 700; }

/* Carriles (3b) */
.lanes { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.lane { width: 30px; height: 36px; border: 1px solid var(--border); border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.lane.on { background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1.5px solid var(--accent); }
.zbe-pill { margin-left: auto; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em; color: var(--zbe); border: 1px solid color-mix(in srgb, var(--zbe) 40%, transparent); border-radius: 3px; padding: 3px 7px; }

/* Velocidad (3b) */
.speed-cluster { position: absolute; left: 14px; bottom: 128px; display: flex; align-items: center; gap: 10px; z-index: 10; }
.speed-now { width: 58px; height: 58px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.speed-now .v { font-size: 20px; font-weight: 700; line-height: 1; }
.speed-now .u { font-family: var(--font-mono); font-size: 7px; letter-spacing: 0.1em; color: var(--text-3); }
.speed-limit { width: 46px; height: 46px; border-radius: 50%; background: #FFFFFF; border: 5px solid #D0021B; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; color: #16181D; }

/* Posición del vehículo/persona en el mapa nav */
.nav-pos { position: absolute; border-radius: 50%; transform: translate(-50%, -50%); z-index: 5; }

/* ---------- utilidades ---------- */
.hidden { display: none !important; }
[data-lang="es"] .eu-only { display: none !important; }
[data-lang="eu"] .es-only { display: none !important; }

@media (max-width: 899px) {
  .desktop-only { display: none !important; }
}
@media (min-width: 900px) {
  .mobile-only { display: none !important; }
}

/* ---------- MapLibre: integración con el sistema de diseño ---------- */

.maplibregl-popup-content {
  font-family: var(--font-ui);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: 0 12px 40px rgba(10, 11, 13, 0.3);
  padding: 0;
  min-width: 240px;
}
.maplibregl-popup-content .head {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;                     /* badges + nombre largo: envolver */
  padding: 12px 36px 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14px; font-weight: 600;
  overflow-wrap: anywhere;
  min-width: 0;
}
.maplibregl-popup-content .head .badge-line { flex: none; }
.maplibregl-popup-content .body { padding: 6px 14px 10px; }
.maplibregl-popup-close-button {
  right: 6px; top: 8px; font-size: 18px;
  color: var(--text-2); background: none;
}
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--surface); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--surface); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface); }

.maplibregl-ctrl-attrib {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.06em;
  background: color-mix(in srgb, var(--surface) 80%, transparent) !important;
  color: var(--text-3);
}
.maplibregl-ctrl-attrib a { color: var(--text-3); }

/* Etiqueta ZBE sobre el mapa (marker HTML, evita depender de glyphs) */
.zbe-map-label {
  font-family: var(--font-mono);
  color: var(--zbe-text);
  text-align: center;
  letter-spacing: 0.2em;
  pointer-events: none;
  text-shadow: 0 1px 3px color-mix(in srgb, var(--bg) 70%, transparent);
}
.zbe-map-label strong { display: block; font-size: 15px; font-weight: 700; }
.zbe-map-label span { display: block; font-size: 8px; }

/* Los .poi/.gps-dot son markers MapLibre: la librería fija position/transform
   inline — NUNCA sobreescribir position aquí (los markers "derivan"). */
.poi { border: 1px solid var(--border); }
.poi.bike, .poi.fuel { border-color: var(--bike); }

/* Endpoints de ruta (diseño 1c) */
.route-end.origin {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 4px solid var(--route-line);
}
.route-end.dest {
  width: 15px; height: 15px; border-radius: 4px;
  background: var(--accent); border: 3px solid var(--route-line);
}

/* ---------- turn-by-turn live ---------- */

#nav-mode.live { background: transparent; pointer-events: none; }
#nav-mode.live .nav-view:not(.live) { display: none !important; }
#nav-mode.live .nav-view.live { display: block; pointer-events: none; }
#nav-mode.live .nav-banner,
#nav-mode.live .nav-bottom { pointer-events: auto; }
@media (min-width: 900px) {
  #nav-mode.live { left: 372px; }  /* solo sobre el mapa en desktop */
}
body.nav-active #mobile-top,
body.nav-active #map-controls,
body.nav-active #route-panel,
body.nav-active #layers-btn-desktop,
body.nav-active #layers-panel { display: none !important; }

.nav-live-icon { color: var(--accent-deep); display: flex; flex: none; width: 40px; justify-content: center; }
[data-theme="dark"] .nav-live-icon { color: var(--accent); }
.nav-view.live .what { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-view.live [data-nav="line"] { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sim-btn { margin-left: auto; width: 46px; height: 46px; box-shadow: none; }
.nav-sim-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.nav-marker {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent);
  border: 4px solid #FFFFFF;
  box-shadow: 0 0 0 7px rgba(198, 255, 61, 0.25), 0 2px 10px rgba(0,0,0,0.35);
}
[data-theme="dark"] .nav-marker { border-color: #101318; }

/* ---------- parada intermedia (via) ---------- */
.via-slot { display: flex; align-items: center; min-height: 24px; padding-left: 6px; }
.via-add {
  border: 1px dashed var(--border); border-radius: 6px; background: none;
  color: var(--text-3); font-size: 12px; padding: 3px 10px;
}
.via-slot.has-via {
  gap: 6px; font-size: 13px; color: var(--text-2);
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); padding: 4px 6px 4px 10px;
}
.via-remove {
  border: none; background: none; color: var(--text-3);
  font-size: 15px; padding: 0 4px; flex: none;
}

/* cierre del panel de capas + toast de zoom */
.layers-head { position: relative; }
.panel-close {
  margin-left: auto;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-2);
}
.panel-close:hover { color: var(--text); background: var(--surface); }
.map-toast {
  position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-pop);
  padding: 10px 16px; font-size: 13px; font-weight: 500;
  z-index: 30; pointer-events: none;
  animation: emapPulse 3.2s;
}

/* popup: filas etiqueta/valor (gasolineras, EV, parking) */
.pp-row {
  display: flex; align-items: baseline; gap: 10px;
  min-height: 30px; font-size: 13px;
}
.pp-row .k { color: var(--text-2); flex: 1; }
.pp-row .v { font-family: var(--font-mono); font-weight: 700; }
.pp-row .v.best { color: var(--bike-deep); }
/* Combustibles: precio protagonista, un punto más grande */
.pp-row.pp-fuel { min-height: 32px; }
.pp-row.pp-fuel .v { font-size: 15px; letter-spacing: -0.01em; }
/* Fila del combustible filtrado: resaltada para que salte a la vista */
.pp-row.filtered {
  background: var(--surface-2);
  border-radius: 7px;
  margin: 1px -8px; padding: 3px 8px;
  box-shadow: inset 2px 0 0 var(--accent-deep);
}
.pp-row.filtered .k { color: var(--text); font-weight: 700; }
.pp-row.filtered .v { color: var(--text); }
/* Meta (Horario…): separada de los precios y sin pinta de precio */
.pp-row.pp-meta {
  margin-top: 4px; padding-top: 8px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
}
.pp-row.pp-meta .v { font-family: var(--font-ui); font-weight: 500; color: var(--text-2); }
.pp-badge {
  font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.12em;
  color: var(--bike-deep); background: var(--bike-bg);
  border-radius: 3px; padding: 2px 5px;
}
.pp-note { font-size: 11px; color: var(--text-3); padding-top: 6px; }

/* elección Origen/Destino para "Mi ubicación" */
.gps-choice {
  min-height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text);
  font-size: 12px; font-weight: 600; flex: none;
}
.gps-choice.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* coche 3D en navegación (solo modo coche) */
.nav-car-marker { pointer-events: none; filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4)); }
#nav-mode[data-mode="car"] .nav-view.live .nav-car { display: block; }
.live-speed { display: none; }
#nav-mode[data-mode="car"] .nav-view.live .live-speed { display: flex; }
.speed-cluster.live-speed { z-index: 10; }

/* jerarquía: los popups SIEMPRE por encima de los markers */
.maplibregl-popup { z-index: 40; }
.maplibregl-marker { z-index: 5; }

/* estaciones de calidad del aire */
.air-marker {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid #FFFFFF;
  box-shadow: 0 2px 8px rgba(10, 11, 13, 0.3);
  cursor: pointer; padding: 0;
}
[data-theme="dark"] .air-marker { border-color: #101318; }

/* doble velocímetro: actual + prevista del tramo */


/* paradas intermedias expandibles en los pasos TP */
.step-stops-toggle {
  display: block; margin: 8px 0 2px;
  min-height: 28px;
  background: none; border: none; padding: 0;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em;
  color: var(--accent-text); cursor: pointer;
}
.step-stops { margin: 4px 0 8px; border-left: 2px solid var(--border); padding-left: 12px; }
.step-stop { font-size: 12.5px; color: var(--text-2); min-height: 26px; display: flex; align-items: center; }

/* chip de línea activa (visor de paradas) */
#line-chip {
  position: absolute; left: 50%; top: max(14px, env(safe-area-inset-top));
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--shadow-pop);
  padding: 8px 8px 8px 14px; font-size: 13px;
  z-index: 26;
}
@media (max-width: 899px) { #line-chip { top: calc(env(safe-area-inset-top) + 118px); } }

/* señal de límite de velocidad (R-301: aro rojo, fondo blanco) */
.speed-limit-sign {
  width: 54px; height: 54px; border-radius: 50%;
  background: #FFFFFF;
  border: 7px solid #C1121C;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 800; font-size: 17px;
  color: #0A0B0D;
  box-shadow: 0 3px 10px rgba(10, 11, 13, 0.35);
}
.speed-limit-sign.over { animation: limit-pulse 0.9s ease-in-out infinite; }
@keyframes limit-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(193, 18, 28, 0.25); }
}

/* con ruta activa, el buscador cede el protagonismo al origen/destino */
body.planning [data-action="open-search"].search-field { display: none; }

/* CTA iniciar ruta: negro/lima en claro, lima/negro en oscuro */
.cta-start { background: var(--text); color: var(--accent); }
[data-theme="dark"] .cta-start,
[data-theme="dark"] .cta[data-action="start-nav"] {
  background: var(--accent); color: #0A0B0D;
}
[data-theme="dark"] .cta[data-action="start-nav"] svg { color: #0A0B0D; }

/* preferencias de ruta */
.pref-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.pref-chip { height: 34px; font-size: 12px; box-shadow: none; }
.pref-chip.on {
  background: var(--text); color: var(--accent);
  border-color: var(--text);
}
[data-theme="dark"] .pref-chip.on { background: var(--accent); color: #0A0B0D; border-color: var(--accent); }

/* confirmación de preferencia aplicada en la tarjeta de ruta */
.pref-tag {
  color: var(--accent-text);
  border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 6px;
}

/* perfil de desnivel en la tarjeta de ruta */
.elev-spark { width: 100%; height: 34px; color: var(--text-2); margin-top: 8px; display: block; }
.elev-minmax {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 9px; color: var(--text-3);
}

/* extras hiperlocales de la ruta */
.route-extras { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.extra-chip {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.06em;
  color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border-soft); border-radius: 4px;
  padding: 3px 7px;
}
.map-report {
  display: flex; align-items: center; gap: 8px;
  min-height: 38px; width: 100%;
  margin-top: 10px; padding: 0 10px;
  border: 1px dashed var(--border); border-radius: var(--r-card);
  background: none; color: var(--text-3); font-size: 12px;
}
.map-report:hover { color: var(--text-2); }

/* incidencias de tráfico */
.inc-marker {
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--surface);
  border: 2px solid; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(10, 11, 13, 0.25); cursor: pointer; padding: 0;
}

/* avisos de servicio en pasos TP */
.step-alert {
  margin-top: 5px; padding: 5px 8px;
  font-size: 11.5px; line-height: 1.4;
  color: #92600A; background: rgba(245, 158, 11, 0.09);
  border: 1px solid rgba(245, 158, 11, 0.35); border-radius: 5px;
}
[data-theme="dark"] .step-alert { color: #FBBF24; }
.step-alert.a11y { font-weight: 600; }

.extra-chip.warn { color: #92600A; border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.08); }
[data-theme="dark"] .extra-chip.warn { color: #FBBF24; }

/* píldora buscar-en-esta-zona */
#zone-pill {
  position: absolute; left: 50%; top: max(14px, env(safe-area-inset-top));
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  min-height: 38px; padding: 0 16px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow-pop);
  font-size: 13px; font-weight: 600;
  z-index: 25;
}
#zone-pill:hover { background: var(--surface-2); }
@media (max-width: 899px) { #zone-pill { top: calc(env(safe-area-inset-top) + 118px); } }

/* selector de hora del planificador */
.when-row { position: relative; }
.when-chip { height: 34px; font-size: 12px; box-shadow: none; gap: 6px; }
.when-chip.scheduled { background: var(--text); color: var(--accent); border-color: var(--text); }
[data-theme="dark"] .when-chip.scheduled { background: var(--accent); color: #0A0B0D; border-color: var(--accent); }
.when-pop {
  position: absolute; top: 40px; left: 0; z-index: 30;
  display: flex; flex-direction: column; gap: 8px;
  min-width: 230px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow-pop);
}
.when-opt { display: flex; align-items: center; gap: 8px; font-size: 13px; min-height: 28px; cursor: pointer; }
.when-opt input { accent-color: var(--accent-text); }
.when-input {
  min-height: 38px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--text);
  font-family: var(--font-mono); font-size: 12px;
}
.when-input:disabled { opacity: 0.45; }
.primary-chip { background: var(--text); color: var(--accent); border-color: var(--text); justify-content: center; }
[data-theme="dark"] .primary-chip { background: var(--accent); color: #0A0B0D; border-color: var(--accent); }

/* control de vista del mapa (2D/3D + tipo de mapa) */
.mode-3d-label { font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
.btn-icon.active-3d { background: var(--text); color: var(--accent); }
[data-theme="dark"] .btn-icon.active-3d { background: var(--accent); color: #0A0B0D; }
.compass-btn[hidden] { display: none; }
.compass-btn svg { transition: transform 0.15s linear; transform-origin: 50% 50%; }

/* filtro contextual de combustible (capa Gasolineras) */
#fuel-filter {
  /* debajo de la píldora "Buscar en esta zona" (#zone-pill, top 14px) para no solaparse */
  position: absolute; top: 62px; left: 50%; transform: translateX(-50%);
  z-index: 11;
  display: flex; align-items: center; gap: 4px;
  padding: 4px 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow-pop);
  max-width: calc(100% - 28px);
}
#fuel-filter[hidden] { display: none; }
/* en móvil #zone-pill baja a safe+118px; la barra queda justo debajo */
@media (max-width: 899px) { #fuel-filter { top: calc(env(safe-area-inset-top) + 166px); } }
.ff-icon { font-size: 14px; padding-left: 4px; }
.ff-chip {
  min-height: 30px; padding: 0 12px;
  border: none; border-radius: calc(var(--r-card) - 2px); background: none;
  font-size: 13px; font-weight: 600; color: var(--text-2);
  white-space: nowrap;
}
.ff-chip[aria-pressed="true"] { background: var(--text); color: var(--accent); }
[data-theme="dark"] .ff-chip[aria-pressed="true"] { background: var(--accent); color: #0A0B0D; }
.basemap-wrap { position: relative; }
.basemap-pop {
  position: absolute; right: 46px; top: 0; z-index: 30;
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px; min-width: 120px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow-pop);
}
.basemap-opt {
  min-height: 34px; padding: 0 10px; text-align: left;
  border: 1px solid transparent; border-radius: 6px;
  background: none; font-size: 13px;
}
.basemap-opt:hover { background: var(--surface-2); }
.basemap-opt.on { border-color: var(--accent-text); font-weight: 600; }
