/* ============ MotoDash · HUD ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  /* Tema DÍA: máxima legibilidad a pleno sol, estética tech clara */
  --bg: #e9edf5;
  --bg-grid: rgba(10, 22, 48, .05);
  --bg-card: #ffffff;
  --text: #0a1020;
  --text-dim: #46536b;
  --text-zero: #aab3c4;
  --accent: #0847f7;
  --accent-2: #ff6a00;
  --waze: #00b7e8;
  --waze-text: #00222e;
  --spotify: #17b34f;
  --spotify-text: #04220f;
  --sos: #e6132a;
  --border: #c7d1e2;
  --glow-accent: 0 2px 10px rgba(8, 71, 247, .18);
  --glow-soft: 0 4px 16px rgba(10, 16, 32, .12);
  --tabbar-bg: rgba(255, 255, 255, .92);
  --input-bg: #ffffff;
  --gauge-track: #d3dbe8;
  --g1: #0847f7;
  --g2: #ff6a00;
  --font-display: "Orbitron", system-ui, sans-serif;
  --font-body: "Rajdhani", system-ui, sans-serif;
  /* Volumen: bisel (brillo arriba + sombra marcada abajo) y elevación sobre el fondo */
  --bevel: inset 1.5px 1.5px 1px rgba(255, 255, 255, .65), inset -2px -8px 14px rgba(10, 16, 32, .32);
  --lift: 0 10px 20px rgba(10, 16, 32, .3), 0 2px 5px rgba(10, 16, 32, .28);
}

body.night {
  /* Tema NOCHE: cockpit oscuro, neón cian + naranja, sin deslumbrar */
  --bg: #04060b;
  --bg-grid: rgba(0, 229, 255, .045);
  --bg-card: #0b111c;
  --text: #d9ecff;
  --text-dim: #64788f;
  --text-zero: #3d4c63;
  --accent: #00e5ff;
  --accent-2: #ff7a1a;
  --waze: #0692b8;
  --waze-text: #dff6ff;
  --spotify: #109a44;
  --spotify-text: #dcffe9;
  --sos: #c40f22;
  --border: #1d2939;
  --glow-accent: 0 0 18px rgba(0, 229, 255, .28);
  --glow-soft: 0 0 14px rgba(0, 0, 0, .6);
  --tabbar-bg: rgba(5, 8, 14, .94);
  --input-bg: #0b111c;
  --gauge-track: #182231;
  --g1: #00e5ff;
  --g2: #ff7a1a;
  --bevel: inset 1.5px 1.5px 1px rgba(255, 255, 255, .3), inset -2px -8px 16px rgba(0, 0, 0, .65);
  --lift: 0 10px 22px rgba(0, 0, 0, .65), 0 2px 5px rgba(0, 0, 0, .5);
}

html { height: 100%; }
body {
  font-family: var(--font-body);
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(0, 190, 255, .07), transparent 55%),
    radial-gradient(110% 55% at 100% 100%, rgba(255, 122, 26, .07), transparent 55%),
    repeating-linear-gradient(0deg, var(--bg-grid) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, var(--bg-grid) 0 1px, transparent 1px 44px),
    var(--bg);
  color: var(--text);
  min-height: 100%;
  padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px));
  transition: background .4s, color .4s;
  user-select: none;
}
body.copilot-transition { transition: background .4s, color .4s, opacity .22s ease; }
/* Líneas de escaneo sutiles en modo noche, estilo visor HUD */
body.night::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 5;
  background: repeating-linear-gradient(0deg, rgba(0, 229, 255, .03) 0px, rgba(0, 229, 255, .03) 1px, transparent 2px, transparent 3px);
  mix-blend-mode: overlay;
  opacity: .6;
}

/* ============ Cabecera HUD ============ */
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: max(6px, env(safe-area-inset-top)) 14px 6px;
  gap: 10px;
}
.clock {
  font-family: var(--font-display);
  font-size: 46px; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  text-shadow: 0 0 12px rgba(0, 190, 255, .35);
}
body:not(.night) .clock { text-shadow: none; }
.daynight { font-size: 14px; font-weight: 600; color: var(--text-dim); margin-top: 3px; letter-spacing: .4px; }
.daynight-sub { margin-top: 1px; }
.top-left { display: flex; flex-direction: column; align-items: flex-start; }
.top-left #gpsChip { margin-top: 6px; }

/* Velocímetro de arco */
.speedo { position: relative; width: 222px; flex: none; margin-left: -10px; transition: filter .4s; }
.speedo[data-band="idle"] .gauge-progress { animation: idlebreathe 2.6s ease-in-out infinite; }
@keyframes idlebreathe { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.speedo[data-band="low"] { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent) 30%, transparent)); }
.speedo[data-band="mid"] { filter: drop-shadow(0 0 11px color-mix(in srgb, var(--accent) 55%, transparent)); }
.speedo[data-band="high"] { filter: drop-shadow(0 0 18px color-mix(in srgb, var(--sos) 70%, transparent)); }
.gauge { display: block; width: 100%; overflow: visible; }
.gauge-track { fill: none; stroke: var(--gauge-track); stroke-width: 10; stroke-linecap: round; }
.gauge-ticks { fill: none; stroke: var(--text-dim); stroke-width: 5; stroke-dasharray: 2 20.6; opacity: .55; }
.gauge-progress {
  fill: none;
  stroke: url(#gaugeGrad);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 326.6;
  stroke-dashoffset: 326.6;
  transition: stroke-dashoffset .6s cubic-bezier(.2, .8, .2, 1);
  filter: drop-shadow(0 0 6px rgba(0, 200, 255, .55));
}
body:not(.night) .gauge-progress { filter: drop-shadow(0 1px 3px rgba(8, 71, 247, .35)); }
.g-stop-1 { stop-color: var(--g1); }
.g-stop-2 { stop-color: var(--g2); }
.gauge-val {
  position: absolute; inset: auto 0 4px 0;
  text-align: center;
  pointer-events: none;
}
.speed-num {
  font-family: var(--font-display);
  font-size: 60px; font-weight: 900; line-height: 1;
  font-variant-numeric: tabular-nums;
  display: block;
  text-shadow: 0 0 14px rgba(0, 200, 255, .4);
}
body:not(.night) .speed-num { text-shadow: none; }
.speed-unit {
  font-family: var(--font-display);
  font-size: 10px; font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
}

.top-right { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; min-width: 0; flex-shrink: 1; }
.top-right-row { display: flex; flex-direction: row; gap: 6px; align-items: center; }
.status-chip {
  font-size: 12px; font-weight: 700;
  letter-spacing: .6px;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 4px 8px;
  white-space: nowrap;
  box-shadow: var(--glow-accent), var(--bevel);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: transform .08s;
}
button.status-chip:active { transform: scale(.94); }
.status-chip.off { opacity: .75; color: var(--text-dim); border-color: var(--border); box-shadow: none; }
.status-chip.offline { color: #ffb020; border-color: #ffb020; box-shadow: var(--bevel); }
#btChip, #voiceCmdBtn, #copilotBtn { font-family: inherit; cursor: pointer; }
#btChip, #voiceCmdBtn, #copilotBtn, #wakeChip { min-width: clamp(76px, 24vw, 108px); text-align: center; font-size: 11.5px; }
.status-chip.listening { color: var(--accent); border-color: var(--accent); animation: gpspulse 1s infinite; }
.status-chip.searching { animation: gpspulse 1.4s infinite; }
@keyframes gpspulse { 50% { opacity: .35; } }
.chip-install {
  font-family: var(--font-body);
  border-color: var(--accent-2);
  color: var(--accent-2);
  cursor: pointer;
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent-2) 40%, transparent);
}

/* ============ Aviso de radar fijo (base abierta OSM, independiente de Waze) ============ */
.radar-banner {
  margin: 0 14px 8px;
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--sos);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: .5px;
  text-align: center;
  font-size: 16px;
  box-shadow: 0 0 22px color-mix(in srgb, var(--sos) 60%, transparent), var(--bevel), var(--lift);
  animation: radarpulse 1s infinite;
}
@keyframes radarpulse { 50% { opacity: .45; } }

.speedlimit-banner {
  margin: 0 14px 8px;
  padding: 8px 14px;
  border-radius: 8px;
  background: #cc1418;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: .5px;
  text-align: center;
  font-size: 15px;
  box-shadow: 0 0 18px rgba(204, 20, 24, .5), var(--bevel), var(--lift);
}

/* Señal de límite de velocidad estilo europeo (círculo rojo) */
.speed-limit-sign {
  position: absolute;
  top: -4px; right: -4px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid #cc1418;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.speed-limit-sign span {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 15px;
  color: #111;
}
.speed-limit-sign.over { border-color: #ff3b3b; animation: gpspulse .8s infinite; }
.speed-limit-sign[hidden] { display: none; }

.town-label {
  text-align: center;
  font-family: var(--font-display);
  font-size: 14px; font-weight: 800;
  letter-spacing: .5px;
  color: var(--text);
  padding: 0 14px 6px;
  max-width: 560px;
  margin: 0 auto;
  text-shadow: 0 0 8px rgba(0, 0, 0, .5),
               -1.5px -1.5px 1px rgba(255, 255, 255, .35),
               1.5px 1.5px 1.5px rgba(0, 0, 0, .6);
}
body:not(.night) .town-label {
  text-shadow: 0 1px 0 rgba(255, 255, 255, .6),
               0 2px 3px rgba(10, 16, 32, .25);
}
.town-province { color: var(--text-dim); font-weight: 600; font-size: 0.72em; }

/* Aviso de mantenimiento pendiente visible en la pantalla principal, sin cambiar de pestaña */
.maint-widget {
  display: block;
  width: calc(100% - 28px);
  max-width: 560px;
  margin: 0 auto 8px;
  padding: 8px 14px;
  border: none; border-radius: 8px;
  background: color-mix(in srgb, var(--accent-2) 16%, var(--bg-card));
  border-left: 4px solid var(--accent-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px; font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.maint-widget.due { border-left-color: var(--sos); background: color-mix(in srgb, var(--sos) 16%, var(--bg-card)); }
.maint-widget[hidden] { display: none; }

/* Texto aclaratorio/secundario: mismo tamaño, peso y color gris claro en toda la app */
.hint, .route-stats, .fuel-avg, .map-attr, .app-version, .daynight-sub, .empty-msg {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-zero);
  letter-spacing: .2px;
}
.app-version { margin: 0 0 8px; color: var(--text); }

/* ============ Telemetría ============ */
.telemetry {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 4px 14px 10px;
  max-width: 560px;
  margin: 0 auto;
}
.telemetry .tele-tile { padding: 10px 6px 8px; }
.telemetry .tele-val { font-size: 26px; }
.telemetry .tele-label { font-size: 12px; }
.tele-tile {
  background: color-mix(in srgb, var(--bg-card) 88%, transparent);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 6px;
  padding: 7px 4px 5px;
  text-align: center;
  box-shadow: var(--glow-soft);
}
.tele-val {
  display: block;
  font-family: var(--font-display);
  font-size: 19px; font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tele-label {
  display: block;
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 2px;
}
/* Valores en cero: gris claro para que no compitan visualmente con datos reales */
.zero-val { color: var(--text-zero) !important; }
.tele-tile.rain {
  border-top-color: var(--accent-2);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent-2) 45%, transparent);
}
#teleWx { cursor: pointer; }
.tele-tile.rain .tele-val { color: var(--accent-2); }

/* ============ Paneles ============ */
main { padding: 6px 14px 0; max-width: 560px; margin: 0 auto; }
.panel { display: none; animation: fadein .35s cubic-bezier(.2, .8, .2, 1); }
.panel.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

/* Cada panel hereda el color de su pestaña */
#panel-nav { --p: var(--waze); }
#panel-music { --p: var(--spotify); }
#panel-calls { --p: var(--sos); }
#panel-routes { --p: var(--accent-2); }
.panel.active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--p) 7%, transparent), transparent 340px);
  border-radius: 12px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 800;
  margin: 8px 0 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  display: flex; align-items: center; gap: 10px;
  color: var(--p);
}
.panel-title::after {
  content: "";
  flex: 1; height: 2px;
  background: linear-gradient(90deg, var(--p), transparent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--p) 40%, transparent);
}
.t-icon svg {
  width: 18px; height: 18px; display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--p) 55%, transparent));
}
.sub-title {
  font-size: 16px; font-weight: 700;
  color: var(--p, var(--text-dim));
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 22px 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.sub-title::before { content: "//"; color: var(--p, var(--accent-2)); font-weight: 800; opacity: .7; }
.sub-title .btn-edit { margin-left: 8px; }
.sub-title .btn-edit:first-of-type { margin-left: auto; }
.sub-actions {
  display: flex;
  gap: 8px;
  margin: -4px 0 10px;
}
.sub-actions .btn-edit {
  flex: 1;
  margin-left: 0;
  text-align: center;
  padding: 6px 4px;
  white-space: nowrap;
}
.btn-edit {
  min-height: 32px;
  font-family: var(--font-body);
  font-size: 15px; font-weight: 700;
  letter-spacing: 1px;
  color: var(--p, var(--accent));
  background: none;
  border: 1px solid var(--p, var(--accent));
  border-radius: 4px;
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: var(--glow-accent), var(--bevel), var(--lift);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  text-transform: none;
}
/* Modo texto grande (accesibilidad) */
body.big-text { zoom: 1.18; }

/* Viñeta sutil en modo noche, reduce distracción visual en los bordes */
body.night::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(120% 100% at 50% 45%, transparent 55%, rgba(0, 0, 0, .35) 100%);
}

/* Aviso visual breve al superar el límite de velocidad */
body.over-limit-flash::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 60;
  background: rgba(163, 8, 26, .28);
  animation: overlimitflash .3s ease-out;
}
@keyframes overlimitflash { 0% { opacity: 1; } 100% { opacity: 0; } }

/* Estela luminosa en el velocímetro al acelerar fuerte */
.speedo.accel-glow #gaugeProgress {
  filter: drop-shadow(0 0 10px var(--accent)) drop-shadow(0 0 20px var(--accent));
  animation: accelglow .7s ease-out;
}
@keyframes accelglow { 0% { filter: drop-shadow(0 0 2px var(--accent)); } 30% { filter: drop-shadow(0 0 14px var(--accent)) drop-shadow(0 0 26px var(--accent)); } 100% { filter: drop-shadow(0 0 2px var(--accent)); } }

/* Arranque tipo HUD: barrido de líneas al abrir la app */
#bootHud {
  position: fixed; inset: 0;
  z-index: 80;
  pointer-events: none;
  background: var(--bg);
  animation: bootfade .5s ease-out .35s forwards;
}
#bootHud::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 12px var(--accent);
  animation: bootsweep .5s ease-in-out;
}
@keyframes bootsweep { 0% { top: 0; opacity: 1; } 100% { top: 100%; opacity: .4; } }
@keyframes bootfade { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  #bootHud { display: none; }
  .speedo.accel-glow #gaugeProgress { animation: none; }
  body.over-limit-flash::before { animation: none; opacity: 0; }
}

/* ============ Alertas comunitarias: mapa estilo Waze ============ */
.panel-map { padding: 0 !important; }
.panel-map.active { display: block !important; }
.alerts-map-wrap {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  overflow: hidden;
  background: #e8ebe0;
}
#alertsMap { height: 100%; width: 100%; background: #e8ebe0; }
/* Mapa vectorial (OpenFreeMap "liberty") con edificios 3D extruidos, estilo Google Maps/Waze */
#alertsMap .maplibregl-ctrl-attrib { background: rgba(255, 255, 255, .8); color: #333; font-size: 9px; }
#alertsMap .maplibregl-ctrl-group { background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
#alertsMap .maplibregl-ctrl-group button { background: #fff; }
.alert-marker { font-size: 26px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45)); cursor: pointer; }
.alert-me-marker {
  font-size: 22px; line-height: 1;
  background: #c81e2c; border-radius: 50%;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px #c9ccd1, 0 2px 5px rgba(0, 0, 0, .4);
}
.alert-me-connecting { animation: connectPulse .9s ease-out; }
@keyframes connectPulse {
  0% { box-shadow: 0 0 0 2px #c9ccd1, 0 2px 5px rgba(0, 0, 0, .4), 0 0 0 0 rgba(200, 30, 44, .7); }
  100% { box-shadow: 0 0 0 2px #c9ccd1, 0 2px 5px rgba(0, 0, 0, .4), 0 0 0 26px rgba(200, 30, 44, 0); }
}
.maplibregl-popup-content { background: #fff; color: #222; border-radius: 12px; font-family: var(--font-body); font-size: 13px; font-weight: 600; }
.hazard-popup-confirm {
  margin-top: 8px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 6px;
  background: var(--accent-2);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.hazard-popup-confirm:disabled { opacity: .6; cursor: default; }

/* Mapa atenuado en modo Noche, a juego con el resto de la app */
body.night #alertsMap { filter: brightness(.55) saturate(.75) contrast(1.05); }
.maplibregl-popup-tip { border-top-color: #fff; border-bottom-color: #fff; }

/* Botón de recentrar, estilo Waze (círculo blanco flotante) */
.alerts-recenter {
  position: absolute; right: 14px; bottom: 104px;
  width: 58px; height: 58px;
  border-radius: 50%;
  border: none;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .35);
  cursor: pointer;
  z-index: 20;
}
.alerts-recenter svg { width: 34px; height: 34px; flex: none; }
.alerts-recenter:active { transform: scale(.92); }

.alerts-heat-toggle, .alerts-mute-toggle {
  position: absolute; right: 14px;
  width: 58px; height: 58px;
  border-radius: 50%;
  border: none;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .35);
  cursor: pointer;
  z-index: 20;
}
.alerts-heat-toggle svg, .alerts-mute-toggle svg { width: 32px; height: 32px; flex: none; }
.alerts-heat-toggle { bottom: 174px; }
.alerts-mute-toggle { bottom: 244px; }
.alerts-heat-toggle.active, .alerts-mute-toggle.active { background: var(--accent-2); }
.alerts-heat-toggle:active, .alerts-mute-toggle:active { transform: scale(.92); }

.alert-me-arrow { display: block; }
.alert-me-arrow svg { display: block; fill: #fff; }

/* Dock de botones de aviso flotantes, estilo Waze (círculos de color en la base del mapa) */
.alerts-report-dock {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; gap: 14px;
  padding: 14px 10px calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(0deg, rgba(0, 0, 0, .35), transparent);
  z-index: 20;
}
.alert-fab {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .45), inset 0 1.5px 1px rgba(255, 255, 255, .5);
  cursor: pointer;
  transition: transform .1s;
  flex: none;
}
.alert-fab svg { width: 30px; height: 30px; flex: none; }
.alert-fab:active { transform: scale(.9); }
.alert-fab-police { background: linear-gradient(160deg, #3b82f6, #1d4ed8); }
.alert-fab-object { background: linear-gradient(160deg, #f59e0b, #b45309); }
.alert-fab-accident { background: linear-gradient(160deg, #ef4444, #b91c1c); }
.alert-fab-traffic { background: linear-gradient(160deg, #eab308, #a16207); }
.alert-fab-radar { background: linear-gradient(160deg, #8b5cf6, #6d28d9); }

/* Banner persistente al acercarse a una alerta reportada por otro usuario */
.hazard-banner {
  margin: 0 14px 8px;
  padding: 9px 14px;
  border-radius: 8px;
  background: #b45309;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: .5px;
  text-align: center;
  font-size: 16px;
  box-shadow: 0 0 22px rgba(180, 83, 9, .55), var(--bevel), var(--lift);
  animation: radarpulse 1s infinite;
}

/* Banner de guiado turno a turno (navegación propia de MotoDash) */
.nav-banner {
  margin: 0 14px 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #000;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  color: #fff;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 0 22px rgba(0, 0, 0, .55), var(--bevel), var(--lift);
}
.nav-banner-icon { font-size: 28px; font-weight: 900; line-height: 1; flex: none; }
.nav-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nav-banner-instr { font-family: var(--font-display); font-weight: 800; font-size: 18px; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-banner-dist { font-size: 13px; font-weight: 700; opacity: .85; }
#navBannerStop { flex: none; width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(0,0,0,.2); color: inherit; font-size: 15px; font-weight: 900; cursor: pointer; }

/* Los marcadores recién reportados (menos de 5 min) laten para llamar la atención, como en Waze */
.alert-marker.alert-fresh { animation: alertpulse 1.1s ease-in-out infinite; }
@keyframes alertpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }

/* Etiquetas de ruta y filtro por etiqueta */
.tag-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.tag-filters[hidden] { display: none; }
.route-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.tag-chip {
  font-family: var(--font-body);
  font-size: 13px; font-weight: 700;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
}
.tag-chip.active {
  color: var(--p, var(--accent));
  border-color: var(--p, var(--accent));
  background: color-mix(in srgb, var(--p, var(--accent)) 15%, transparent);
}
.mic-icon {
  width: 22px; height: 22px;
  vertical-align: -6px;
  margin-right: 6px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tire-icon {
  width: 16px; height: 16px;
  vertical-align: -3px;
  margin-right: 4px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ============ Botones gigantes con esquinas HUD ============ */
.btn-mega {
  position: relative;
  width: 100%;
  min-height: 84px;
  border: none;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  font-family: var(--font-display);
  font-size: 23px; font-weight: 900; letter-spacing: 2px;
  cursor: pointer;
  transition: transform .08s;
  overflow: hidden;
}
.btn-mega::before { /* barrido de luz */
  content: "";
  position: absolute; top: 0; bottom: 0; left: -70%;
  width: 45%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .28), transparent);
  animation: sheen 4.5s infinite;
}
@keyframes sheen { 0%, 55% { left: -70%; } 85%, 100% { left: 130%; } }
.btn-mega:active { transform: scale(.97); }
.mega-icon { width: 40px; height: 40px; display: block; }
.mega-icon svg {
  width: 100%; height: 100%; display: block;
  fill: none;
  color: #d8d8dc;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 12px rgba(0, 0, 0, .95))
          drop-shadow(-4.5px -4.5px 2.5px rgba(0, 0, 0, 1))
          drop-shadow(3px 3px 0 color-mix(in srgb, var(--p, currentColor) 50%, #d8d8dc 50%));
}
.mega-icon .ic-stop { display: none; }
#recIcon.stopped .ic-rec { display: none; }
#recIcon.stopped .ic-stop { display: block; }
.mega-text {
  color: #d8d8dc;
  text-shadow: 0 0 12px rgba(0, 0, 0, .95),
               -4.5px -4.5px 2.5px rgba(0, 0, 0, 1),
               3px 3px 0 color-mix(in srgb, var(--p, currentColor) 50%, #d8d8dc 50%);
}
.btn-waze {
  background: linear-gradient(160deg, var(--waze), color-mix(in srgb, var(--waze) 55%, #003a4d));
  color: var(--waze-text);
  box-shadow: 0 0 22px color-mix(in srgb, var(--waze) 45%, transparent), var(--bevel), var(--lift);
}
.btn-spotify {
  background: linear-gradient(160deg, var(--spotify), color-mix(in srgb, var(--spotify) 55%, #01230e));
  color: var(--spotify-text);
  box-shadow: 0 0 22px color-mix(in srgb, var(--spotify) 45%, transparent), var(--bevel), var(--lift);
}
.btn-sos {
  background: linear-gradient(160deg, var(--sos), color-mix(in srgb, var(--sos) 60%, #2a0006));
  color: #fff;
  box-shadow: 0 0 22px color-mix(in srgb, var(--sos) 50%, transparent), var(--bevel), var(--lift);
  animation: sospulse 2.4s infinite;
}
@keyframes sospulse {
  0%, 100% { box-shadow: 0 0 14px color-mix(in srgb, var(--sos) 40%, transparent), var(--bevel), var(--lift); }
  50% { box-shadow: 0 0 30px color-mix(in srgb, var(--sos) 70%, transparent), var(--bevel), var(--lift); }
}

/* Soportes de esquina HUD sobre los botones gigantes */
.hud-corners {
  position: absolute; inset: 6px;
  pointer-events: none;
  filter: drop-shadow(0 0 8px rgba(0, 0, 0, .8))
          drop-shadow(-3px -3px 1.5px rgba(0, 0, 0, 1))
          drop-shadow(2px 2px 0 color-mix(in srgb, var(--p, var(--accent-2)) 50%, #d8d8dc 50%));
}
.hud-corners::before, .hud-corners::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid #d8d8dc;
}
.hud-corners::before { top: 0; left: 0; border-right: none; border-bottom: none; }
.hud-corners::after { bottom: 0; right: 0; border-left: none; border-top: none; }

/* ============ Rutas ============ */
.btn-rec {
  background: linear-gradient(160deg, var(--accent-2), color-mix(in srgb, var(--accent-2) 60%, #401500));
  color: #fff;
  box-shadow: 0 0 22px color-mix(in srgb, var(--accent-2) 45%, transparent), var(--bevel), var(--lift);
}
.btn-rec.recording {
  background: linear-gradient(160deg, var(--sos), color-mix(in srgb, var(--sos) 60%, #2a0006));
  color: #fff;
  animation: sospulse 1.6s infinite;
}
.rec-live {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.rec-live[hidden] { display: none; }
.route-list { margin-top: 4px; display: flex; flex-direction: column; gap: 8px; }
.route-list[hidden] { display: none; }
.route-row { display: flex; align-items: stretch; gap: 6px; }
.route-main {
  flex: 1;
  min-width: 0;
  min-height: 70px;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-2);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: var(--glow-soft), var(--bevel), var(--lift);
  text-align: left;
  font-family: var(--font-body);
}
.route-main:active { transform: scale(.98); }
.route-name { font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-meta { font-size: 14px; font-weight: 600; color: var(--text-dim); letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wear-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
  margin-top: 2px;
}
.wear-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .3s;
}
.wear-bar.warn span { background: var(--accent-2); }
.wear-bar.due span { background: var(--sos); }
.route-btn {
  width: 54px; flex: none;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 21px;
  cursor: pointer;
  box-shadow: var(--glow-soft), var(--bevel), var(--lift);
}
.route-btn.confirm { background: var(--sos); border-color: var(--sos); color: #fff; font-size: 12px; font-weight: 800; font-family: var(--font-body); }
#routeMap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #e8ebe0;
}
.route-map-pin {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}
.route-map-pin-start { background: #19c95c; }
.route-map-pin-end { background: var(--sos); }
.map-attr { text-align: right; margin: 2px 0 8px; }

/* Gráfica de velocidad de la ruta */
#speedChart {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 85%, var(--bg-card));
  margin-bottom: 8px;
}
#speedLine {
  fill: none;
  stroke: url(#chartGrad);
  stroke-width: 2.5;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 3px rgba(0, 200, 255, .5));
}
#speedChartMax {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  fill: var(--text-dim);
}

/* Previsión por horas */
#wxHours { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; max-height: 55vh; overflow-y: auto; }
.wx-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  padding: 8px 12px;
  font-size: 17px; font-weight: 600;
}
.wx-row .wx-h { font-family: var(--font-display); font-size: 14px; font-weight: 700; width: 52px; color: var(--text-dim); }
.wx-row .wx-t { width: 48px; font-weight: 700; }
.wx-row .wx-p { margin-left: auto; color: var(--text-dim); }
.wx-row.wet { border-left: 3px solid var(--accent-2); }
.wx-row.wet .wx-p { color: var(--accent-2); font-weight: 700; }
.wx-row.skeleton span {
  display: block;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--border) 25%, color-mix(in srgb, var(--border) 50%, var(--bg-card)) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeletonshine 1.3s infinite;
}
.wx-row.skeleton span:nth-child(1) { width: 40px; }
.wx-row.skeleton span:nth-child(2) { width: 20px; }
.wx-row.skeleton span:nth-child(3) { width: 34px; }
.wx-row.skeleton span:nth-child(4) { width: 44px; margin-left: auto; }
@keyframes skeletonshine { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Gasolineras */
#fuelStList { max-height: 48vh; overflow-y: auto; margin-bottom: 12px; }
.fst-price { font-family: var(--font-display); font-size: 19px; font-weight: 800; color: var(--accent); white-space: nowrap; }
.fst-cheapest .fst-price { color: #19c95c; }

/* Pantalla de emergencia (detección de caída) */
#crashOverlay {
  position: fixed; inset: 0;
  z-index: 100;
  background: #7a0512;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
  padding: 24px;
  text-align: center;
  animation: crashflash 1s infinite;
}
#crashOverlay[hidden] { display: none; }
@keyframes crashflash { 50% { background: #a3081a; } }
#crashTitle { font-family: var(--font-display); font-size: 34px; font-weight: 900; color: #fff; letter-spacing: 2px; }
#crashCount { font-family: var(--font-display); font-size: 84px; font-weight: 900; color: #fff; line-height: 1; }
#crashOk, #crashCall, #crashMsg, .crash-ice-btn {
  width: 100%;
  min-height: 96px;
  border: none; border-radius: 12px;
  font-family: var(--font-display);
  font-size: 24px; font-weight: 900;
  cursor: pointer;
  box-shadow: inset 0 1.5px 1px rgba(255, 255, 255, .4), inset 0 -6px 12px rgba(0, 0, 0, .35), 0 8px 18px rgba(0, 0, 0, .4);
}
#crashOk { background: #fff; color: #7a0512; }
#crashCall { background: #16081a; color: #fff; margin-bottom: 14px; }
#crashMsg, .crash-ice-btn { background: #0d3b1d; color: #fff; }
.crash-ice-btn { font-size: 19px; margin-bottom: 10px; }
#crashActions { width: 100%; }
#crashActions[hidden] { display: none; }
#crashMsg[hidden] { display: none; }
.route-stats { line-height: 1.6; margin-bottom: 14px; }

/* ============ Temporada, mantenimiento y repostajes ============ */
.season {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 4px;
}
.maint-list, .fuel-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.route-main.warn { border-left-color: var(--accent-2); }
.route-main.due { border-left-color: var(--sos); }
.route-main.due .route-meta { color: var(--sos); font-weight: 700; }
.route-main.warn .route-meta { color: var(--accent-2); font-weight: 700; }
.route-main.active-bike { border-left-color: var(--accent); }
.route-main.active-bike .route-name { color: var(--accent); }
.maint-list .route-meta { padding-left: 26px; }
.fuel-avg { margin: 2px 0 8px; }
.fuel-avg strong { color: var(--accent); font-family: var(--font-display); font-size: 17px; }
#fuelRange.low { color: #ff4d4d; font-weight: 800; }
.data-row { display: flex; gap: 10px; margin-top: 4px; }
.data-row .btn-secondary { flex: 1; }
.panel .tele-tile { border-top-color: var(--p, var(--accent)); }

/* Comparativa mensual (Temporada) */
.season-chart {
  display: flex; align-items: flex-end; gap: 6px;
  height: 100px;
  margin-top: 10px;
  padding: 8px 6px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-card) 88%, transparent);
  box-shadow: var(--bevel);
}
.season-chart[hidden] { display: none; }
.sc-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; height: 100%; }
.sc-bar {
  width: 100%; max-width: 28px;
  background: linear-gradient(180deg, var(--p, var(--accent)), color-mix(in srgb, var(--p, var(--accent)) 55%, transparent));
  border-radius: 4px 4px 0 0;
  box-shadow: 0 0 6px color-mix(in srgb, var(--p, var(--accent)) 40%, transparent);
}
.sc-val { font-family: var(--font-display); font-size: 10px; font-weight: 800; color: var(--text-dim); }
.sc-lbl { font-size: 9px; font-weight: 700; letter-spacing: .5px; color: var(--text-dim); text-transform: uppercase; }

/* Viaje en directo */
.btn-secondary.live-active {
  border-color: var(--sos);
  color: var(--sos);
  animation: sospulse 2s infinite;
}

/* Selector de idioma: bandera bajo el chip de GPS, con menú desplegable */
.lang-wrap { position: relative; }
.lang-chip {
  cursor: pointer;
  padding: 3px 10px;
  font-size: 16px;
  line-height: 1;
}
.lang-chip svg { width: 20px; height: 14px; display: block; border-radius: 2px; }
.lang-menu[hidden] { display: none; }
.lang-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  display: flex; gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 6px;
  box-shadow: var(--glow-soft), var(--bevel), var(--lift);
  z-index: 20;
}
.lang-flag {
  width: 30px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  cursor: pointer;
  opacity: .55;
}
.lang-flag svg { width: 20px; height: 14px; display: block; border-radius: 2px; }
.lang-flag.active { opacity: 1; border-color: var(--accent); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 45%, transparent); }

/* ============ Voz y búsqueda ============ */
.voice-row { margin-top: 12px; }
.btn-voice {
  width: 100%;
  min-height: 70px;
  font-family: var(--font-body);
  font-size: 22px; font-weight: 700;
  letter-spacing: 1px;
  border-radius: 8px;
  border: 2px dashed var(--p, var(--accent));
  background: color-mix(in srgb, var(--bg-card) 82%, transparent);
  color: var(--p, var(--accent));
  cursor: pointer;
  box-shadow: 0 0 14px color-mix(in srgb, var(--p, var(--accent)) 25%, transparent), var(--bevel), var(--lift);
}
.btn-voice.listening {
  border-style: solid;
  background: var(--p, var(--accent));
  color: var(--bg);
  animation: pulse 1s infinite;
}
@keyframes pulse { 50% { opacity: .55; } }

.search-row { display: flex; gap: 10px; margin-top: 12px; }
.search-row input {
  flex: 1;
  min-width: 0;
  min-height: 70px;
  font-family: var(--font-body);
  font-size: 21px; font-weight: 600;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--p, var(--accent));
  background: var(--input-bg);
  color: var(--text);
  outline: none;
}
.search-row input:focus { border-color: var(--p, var(--accent)); box-shadow: 0 0 12px color-mix(in srgb, var(--p, var(--accent)) 30%, transparent); }
.search-row input::placeholder { color: var(--text-dim); opacity: .8; }
.btn-go {
  min-width: 86px; min-height: 70px;
  font-family: var(--font-display);
  font-size: 19px; font-weight: 800;
  letter-spacing: 1px;
  border: none; border-radius: 8px;
  background: linear-gradient(160deg, var(--p, var(--accent-2)), color-mix(in srgb, var(--p, var(--accent-2)) 55%, #001018));
  color: #d8d8dc;
  cursor: pointer;
  box-shadow: 0 0 16px color-mix(in srgb, var(--p, var(--accent-2)) 45%, transparent), var(--bevel), var(--lift);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  text-shadow: 0 0 12px rgba(0, 0, 0, .95),
               -4.5px -4.5px 2.5px rgba(0, 0, 0, 1),
               3px 3px 0 color-mix(in srgb, var(--p, var(--accent-2)) 50%, #d8d8dc 50%);
}

/* ============ Favoritos ============ */
.fav-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.calls-actions.fav-grid .fav-btn {
  border-top-color: var(--sos);
  background: linear-gradient(180deg, color-mix(in srgb, var(--sos) 7%, var(--bg-card)), var(--bg-card));
}
.calls-actions.fav-grid .fav-btn .fav-emoji svg { color: var(--sos); }
.calls-actions.fav-grid .fav-btn.live-active {
  border-top-color: var(--sos);
  background: linear-gradient(180deg, color-mix(in srgb, var(--sos) 22%, var(--bg-card)), var(--bg-card));
  box-shadow: 0 0 14px color-mix(in srgb, var(--sos) 40%, transparent), var(--bevel), var(--lift);
}
.fav-btn {
  min-height: 70px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--p, var(--accent));
  border-radius: 8px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--p, var(--accent)) 7%, var(--bg-card)), var(--bg-card));
  color: var(--text);
  font-family: var(--font-body);
  font-size: 20px; font-weight: 700;
  letter-spacing: .5px;
  cursor: pointer;
  box-shadow: var(--glow-soft), var(--bevel), var(--lift);
  padding: 6px 10px;
  display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 8px;
  position: relative;
  overflow-wrap: anywhere;
}
.fav-btn:active { transform: scale(.96); }
.fav-btn .fav-emoji { font-size: 22px; }
.fav-btn .fav-emoji svg {
  width: 22px; height: 22px; display: block;
  fill: none;
  color: var(--p, var(--accent));
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fav-del {
  position: absolute; top: -8px; right: -8px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--sos); color: #fff;
  font-size: 16px; font-weight: 900;
  cursor: pointer;
  display: none;
  box-shadow: 0 0 10px color-mix(in srgb, var(--sos) 60%, transparent);
}
.editing .fav-del { display: block; }

/* ============ Contactos ============ */
.calls-actions { margin-top: 12px; }
.btn-secondary {
  width: 100%;
  min-height: 70px;
  font-family: var(--font-body);
  font-size: 21px; font-weight: 700;
  letter-spacing: 1px;
  border-radius: 8px;
  border: 1px solid var(--p, var(--accent));
  background: color-mix(in srgb, var(--bg-card) 82%, transparent);
  color: var(--p, var(--accent));
  cursor: pointer;
  box-shadow: 0 0 14px color-mix(in srgb, var(--p, var(--accent)) 25%, transparent), var(--bevel), var(--lift);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transition: transform .08s;
}
.btn-secondary:active { transform: scale(.97); }
.contact-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.contact-row { display: flex; align-items: center; gap: 6px; }
.contact-call {
  flex: 1;
  min-width: 0;
  min-height: 70px;
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--p, var(--accent));
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  padding: 8px 16px;
  cursor: pointer;
  box-shadow: var(--glow-soft), var(--bevel), var(--lift);
  text-align: left;
  font-family: var(--font-body);
}
.contact-call:active { transform: scale(.98); }
.contact-avatar {
  width: 46px; height: 46px; flex: none;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--p, var(--accent)), color-mix(in srgb, var(--p, var(--accent)) 50%, #001a26));
  color: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 19px; font-weight: 800;
  box-shadow: var(--glow-accent);
}
body.night .contact-avatar { color: #03131c; }
.contact-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.contact-name { display: block; font-size: 21px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-tel { display: block; font-size: 15px; font-weight: 600; color: var(--text-dim); letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-star, .contact-del, .contact-ice {
  width: 50px; height: 70px; flex: none;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--glow-soft), var(--bevel), var(--lift);
}
.contact-star.fav { border-color: var(--accent-2); box-shadow: 0 0 12px color-mix(in srgb, var(--accent-2) 40%, transparent), var(--bevel), var(--lift); }
.contact-ice { opacity: .45; }
.contact-ice.ice { border-color: var(--sos); box-shadow: 0 0 12px color-mix(in srgb, var(--sos) 45%, transparent), var(--bevel), var(--lift); opacity: 1; }
.empty-msg { text-align: center; padding: 30px 10px; line-height: 1.6; }

.hint { margin-top: 18px; line-height: 1.5; }

/* ============ Tabbar ============ */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--tabbar-bg);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}
.tab {
  position: relative;
  flex: 1;
  min-height: 70px;
  border: none;
  background: none;
  color: var(--text-dim);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  cursor: pointer;
  font-family: var(--font-display);
}
.tab::before {
  content: "";
  position: absolute; top: -1px; left: 18%; right: 18%;
  height: 3px;
  background: transparent;
  transition: background .25s, box-shadow .25s;
}
.tab-icon { font-size: 28px; transition: transform .3s cubic-bezier(.34, 1.56, .64, 1); }
.tab.active .tab-icon { transform: translateY(-2px) scale(1.12); }
.tab-icon svg {
  width: 1em; height: 1em; display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab-label { font-size: 10.5px; font-weight: 800; letter-spacing: 1.2px; }

/* Cada pestaña, del color de su botón */
.tab[data-panel="panel-nav"] { --tab-c: var(--waze); }
.tab[data-panel="panel-music"] { --tab-c: var(--spotify); }
.tab[data-panel="panel-calls"] { --tab-c: var(--sos); }
.tab[data-panel="panel-routes"] { --tab-c: var(--accent-2); }
.tab { color: var(--tab-c); opacity: .45; }
.tab.active { color: var(--tab-c); opacity: 1; }
.tab.active::before {
  background: var(--tab-c);
  box-shadow: 0 0 16px var(--tab-c), 0 0 30px color-mix(in srgb, var(--tab-c) 55%, transparent);
}
.tab.active .tab-icon {
  filter: drop-shadow(0 0 8px var(--tab-c)) drop-shadow(0 0 18px color-mix(in srgb, var(--tab-c) 60%, transparent));
}

/* ============ Modal ============ */
dialog {
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text);
  padding: 22px;
  width: min(92vw, 420px);
  margin: auto;
  box-shadow: var(--glow-accent);
  font-family: var(--font-body);
}
dialog::backdrop { background: rgba(2, 4, 8, .7); backdrop-filter: blur(3px); }
dialog h3 {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 800;
  letter-spacing: 2px; text-transform: uppercase;
  margin-bottom: 16px;
}
dialog label { display: block; font-size: 16px; font-weight: 700; color: var(--text-dim); letter-spacing: 1px; margin-bottom: 12px; }
dialog input {
  width: 100%;
  min-height: 70px;
  margin-top: 6px;
  font-family: var(--font-body);
  font-size: 20px; font-weight: 600;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
}
dialog input:focus { border-color: var(--accent); box-shadow: var(--glow-accent); }
dialog select {
  width: 100%;
  min-height: 70px;
  margin-top: 6px;
  font-family: var(--font-body);
  font-size: 20px; font-weight: 600;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
}
dialog select:focus { border-color: var(--accent); box-shadow: var(--glow-accent); }
.dialog-btns { display: flex; gap: 10px; margin-top: 8px; }
.dialog-btns button {
  flex: 1;
  min-height: 70px;
  font-family: var(--font-body);
  font-size: 19px; font-weight: 700;
  letter-spacing: 1px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  box-shadow: var(--bevel), var(--lift);
}
.btn-cancel { background: var(--border); color: var(--text); }
.btn-ok {
  background: linear-gradient(160deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #001a26));
  color: var(--bg-card);
  box-shadow: var(--glow-accent), var(--bevel), var(--lift);
}
body.night .btn-ok { color: #03131c; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 112px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  font-size: 17px; font-weight: 700;
  padding: 12px 22px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 50;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 560px) {
  .fav-grid { grid-template-columns: 1fr 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-mega::before, .btn-sos { animation: none; }
}

/* ============ Pantallas bajas: modo compacto (nada queda cortado) ============ */
@media (max-height: 860px) {
  body { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
  .clock { font-size: 38px; }
  .daynight { font-size: 12px; }
  .speedo { width: 142px; }
  .speed-num { font-size: 39px; }
  .status-chip { font-size: 11px; padding: 3px 8px; }
  .telemetry { padding-bottom: 6px; }
  .tele-val { font-size: 16px; }
  .tele-label { font-size: 9px; letter-spacing: 1.2px; }
  .panel-title { margin: 4px 0 10px; font-size: 15px; }
  .btn-mega { min-height: 76px; font-size: 20px; }
  .mega-icon { font-size: 32px; }
  .voice-row, .search-row { margin-top: 10px; }
  .btn-voice { min-height: 64px; font-size: 19px; }
  .search-row input { min-height: 64px; font-size: 19px; }
  .btn-go { min-height: 64px; min-width: 76px; }
  .sub-title { margin: 14px 0 8px; font-size: 14px; }
  .fav-btn { min-height: 64px; font-size: 18px; }
  .fav-btn .fav-emoji { font-size: 22px; }
  .btn-secondary { min-height: 64px; font-size: 19px; }
  .dialog-btns button, dialog input, dialog select { min-height: 64px; }
  .contact-call { min-height: 64px; }
  .contact-star, .contact-del, .contact-ice { height: 64px; width: 44px; }
  .route-main { min-height: 64px; padding: 6px 14px; }
  .hint { margin-top: 12px; }
  .btn-edit { min-height: 30px; }
  .tab { min-height: 64px; }
  .tab-icon { font-size: 26px; }
}

@media (max-height: 660px) {
  body { padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px)); }
  .hint { display: none; }
  .clock { font-size: 32px; }
  .speedo { width: 122px; }
  .speed-num { font-size: 33px; }
  .btn-mega { min-height: 70px; }
  .btn-voice { min-height: 60px; }
  .search-row input { min-height: 60px; }
  .btn-go { min-height: 60px; }
  .btn-secondary { min-height: 60px; }
  .dialog-btns button, dialog input, dialog select { min-height: 60px; }
  .fav-btn { min-height: 60px; }
  .btn-edit { min-height: 28px; }
  .contact-call { min-height: 60px; }
  .route-main { min-height: 60px; padding: 5px 14px; }
  .tab { min-height: 60px; }
  .tab-icon { font-size: 24px; }
  .tab-label { font-size: 10px; }
}

/* ============ Móviles estrechos: la cabecera no cabe con el velocímetro grande + chips fijos ============ */
@media (max-width: 400px) {
  .topbar { gap: 4px; padding-left: 8px; padding-right: 8px; }
  .clock { font-size: 34px; }
  .speedo { width: 162px; }
  .speed-num { font-size: 44px; }
  #btChip, #voiceCmdBtn, #copilotBtn, #wakeChip { min-width: 0; width: 100%; font-size: 10.5px; padding: 4px 6px; }
  .top-right { max-width: 30vw; }
}
@media (max-width: 340px) {
  .clock { font-size: 28px; }
  .speedo { width: 134px; }
  .speed-num { font-size: 36px; }
}

/* ============ Horizontal (móvil apaisado en el soporte): dos columnas ============ */
@media (orientation: landscape) and (max-height: 560px) {
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding-top: 6px; padding-bottom: 2px; }
  .clock { font-size: 32px; }
  .speedo { width: 122px; }
  .top-right { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; gap: 5px; max-width: 42%; }
  .telemetry, main { max-width: 900px; }
  .telemetry { padding-bottom: 6px; }
  .panel.active { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; align-items: start; }
  .panel-title, .sub-title, .fav-grid, .contact-list, .route-list, .hint,
  .season, .maint-list, .fuel-list, .fuel-avg, .data-row { grid-column: 1 / -1; }
  .route-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
  .btn-mega { grid-column: 1; grid-row: 2 / 4; height: 100%; min-height: 126px; }
  .voice-row, .calls-actions { margin: 0 0 10px; }
  .search-row { margin: 0; }
  .fav-grid { grid-template-columns: repeat(4, 1fr); }
  .contact-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
  .tab { min-height: 56px; flex-direction: row; gap: 8px; }
  .tab-icon { font-size: 22px; }
}

/* ============ Modo copiloto: solo hora + velocidad, para el que va detrás ============ */
body.copilot-mode { padding-bottom: 0; }
body.copilot-mode .tabbar,
body.copilot-mode main,
body.copilot-mode .telemetry,
body.copilot-mode .town-label,
body.copilot-mode .top-right,
body.copilot-mode .daynight,
body.copilot-mode .daynight-sub,
body.copilot-mode #gpsChip {
  display: none !important;
}
body.copilot-mode .topbar {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  gap: 6vh;
}
body.copilot-mode .top-left { align-items: center; }
body.copilot-mode .clock { font-size: 18vw; line-height: 1; }
body.copilot-mode .speedo { width: 62vw; max-width: 380px; }
body.copilot-mode .speed-num { font-size: 20vw; }
body.copilot-mode .speed-unit { font-size: 4vw; }
body.copilot-mode .radar-banner,
body.copilot-mode .speedlimit-banner {
  position: fixed; left: 0; right: 0; bottom: 16px; margin: 0 14px;
}
