/* Layout: mapa a pantalla completa con panel lateral (en móvil, mapa arriba y panel abajo) */
:root {
  --bg: #eef1ee;
  --surface: #ffffff;
  --surface-2: #f4f6f4;
  --fg: #18201b;
  --muted: #5a675f;
  --line: #d5ddd7;
  --accent: #1f5c46;
  --accent-fg: #ffffff;
  --warn: #b8322b;
  --warn-bg: #fbe8e6;
  --ok: #2d6a3e;
  --ok-bg: #e3f1e6;
  --water: #1d64a8;
  --water-bg: #e2edf8;
  --amber: #8a6200;
  --amber-bg: #fbf0d0;
  --shadow: 0 6px 24px rgba(10, 20, 14, .18);
  --f-display: "Barlow Condensed", "Arial Narrow", "Segoe UI", system-ui, sans-serif;
  --f-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101412; --surface: #171d1a; --surface-2: #1d2420; --fg: #e6ece8; --muted: #9aa9a1; --line: #2a3430;
    --accent: #6cc49a; --accent-fg: #0d1a14; --warn: #ff7b72; --warn-bg: #3a1c1a; --ok: #7fd49b; --ok-bg: #16301f;
    --water: #7db8f0; --water-bg: #142a3e; --amber: #f2c96a; --amber-bg: #352a10; --shadow: 0 6px 24px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101412; --surface: #171d1a; --surface-2: #1d2420; --fg: #e6ece8; --muted: #9aa9a1; --line: #2a3430;
  --accent: #6cc49a; --accent-fg: #0d1a14; --warn: #ff7b72; --warn-bg: #3a1c1a; --ok: #7fd49b; --ok-bg: #16301f;
  --water: #7db8f0; --water-bg: #142a3e; --amber: #f2c96a; --amber-bg: #352a10; --shadow: 0 6px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 14px/1.5 var(--f-body); }
body.arrastrando, body.arrastrando * { cursor: grabbing !important; user-select: none; }
button, input { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { display: grid; grid-template-columns: 400px minmax(0, 1fr); height: 100%; }
.mapa-wrap { position: relative; min-width: 0; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--bg); }

.panel {
  min-width: 0; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line);
  padding-block: 20px 18px;
  padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: 18px;
  display: flex; flex-direction: column; gap: 22px;
}

.brand h1 { margin: 0; font: 700 32px/1 var(--f-display); letter-spacing: .01em; }
.brand p { margin: 6px 0 0; color: var(--muted); }

.sec { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sec-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.label { margin: 0; font: 600 12px/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.label.sub { margin-top: 6px; }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); }

/* Salida y llegada */
.punto { display: grid; grid-template-columns: 40px minmax(0, 1fr) 38px; gap: 8px; align-items: center; }
.muneco {
  width: 40px; height: 48px; padding: 2px 0 0; display: grid; place-items: center; cursor: grab; touch-action: none;
  background: var(--surface-2); border: 1px dashed var(--line); border-radius: 10px;
}
.muneco:hover { border-color: var(--muted); }
.muneco svg { width: 26px; height: 36px; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); }
.buscar { margin: 0; min-width: 0; }
.buscar input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--fg); text-overflow: ellipsis;
}
.buscar input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.icono {
  width: 38px; height: 40px; display: grid; place-items: center; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; color: var(--muted);
}
.icono:hover { color: var(--fg); border-color: var(--muted); }

.resultados {
  list-style: none; margin: -4px 0 0 48px; padding: 4px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); box-shadow: var(--shadow); display: grid; gap: 2px; max-height: 280px; overflow-y: auto;
}
.resultados button {
  width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; cursor: pointer;
  display: grid; gap: 1px;
}
.resultados button:hover, .resultados button:focus-visible { background: var(--surface-2); }
.resultados button span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resultados .vacio { padding: 8px 10px; color: var(--muted); font-size: 13px; }

.extras { display: grid; gap: 6px; }
.extras:empty { display: none; }
.extra { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; font-size: 13px; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* Tarjetas de ruta */
.rutas { display: grid; gap: 8px; }
.ruta-card {
  display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: start; width: 100%;
  padding: 10px 12px; text-align: left; cursor: pointer;
  background: transparent; border: 1px solid var(--line); border-radius: 10px;
}
.ruta-card:hover { border-color: var(--muted); }
.ruta-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ruta-card .tag {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  font: 700 19px/1 var(--f-display); background: var(--surface-2); color: var(--fg);
}
.ruta-card[aria-pressed="true"] .tag { background: var(--accent); color: var(--accent-fg); }
.rc-txt { display: grid; gap: 2px; min-width: 0; }
.rc-txt strong { font: 600 18px/1.1 var(--f-display); }
.rc-txt .desc { font-size: 12.5px; color: var(--muted); }
.rc-txt .meta { font-size: 13px; font-variant-numeric: tabular-nums; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.pill { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.water { color: var(--water); background: var(--water-bg); }
.pill.ambar { color: var(--amber); background: var(--amber-bg); }
.pill.neutra { color: var(--muted); background: var(--surface-2); }
.pill.negra { color: #ffffff; background: #111111; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.vacio { margin: 0; color: var(--muted); }
.alerta { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--fg); font-size: 13px; display: grid; gap: 6px; justify-items: start; }

/* Detalle */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stat { background: var(--surface); padding: 10px 10px 9px; min-width: 0; }
.stat b { display: block; font: 700 24px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.stat b small { font-size: 15px; font-weight: 600; margin-left: 1px; }
.stat span { display: block; margin-top: 4px; font-size: 11.5px; color: var(--muted); line-height: 1.25; }
.footnote { margin: 0; font-size: 12px; color: var(--muted); }
.bar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; gap: 2px; }
.bar i { display: block; height: 100%; min-width: 3px; }
.legend { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 7px; }
.legend li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.sw { width: 14px; height: 14px; border-radius: 3px; margin-top: 3px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); flex: none; }
.sw.negro { box-shadow: inset 0 0 0 2px #ffffff, 0 0 0 1px #111111; }
.sw.discontinua { background: repeating-linear-gradient(90deg, #111111 0 4px, #ffffff 4px 7px) !important; box-shadow: 0 0 0 1px #111111; }
.bar i.negro { box-shadow: inset 0 0 0 1px #ffffff; }
.legend .n { font-weight: 500; }
.legend .d, .checks .d { display: block; font-size: 12px; color: var(--muted); }
.legend .v { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.legend .v small { display: block; color: var(--muted); font-size: 12px; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checks button {
  width: 100%; display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; align-items: start; text-align: left;
  padding: 8px 10px; background: var(--surface-2); border: 0; border-radius: 8px; cursor: pointer;
}
.checks button:hover { outline: 1px solid var(--line); }
.checks .v { font-variant-numeric: tabular-nums; white-space: nowrap; }
.none { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--ok-bg); color: var(--ok); font-weight: 500; }

/* Preferencias */
.prefs { display: grid; gap: 12px; }
.pref { display: grid; gap: 6px; }
.pref.fija { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.pref-t { display: grid; }
.pref-n1 { font-weight: 600; }
.pref-n { font-size: 12px; color: var(--muted); }
.candado { font-size: 12px; font-weight: 600; color: var(--warn); background: var(--warn-bg); padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.seg { display: flex; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; }
.seg label { flex: 1; position: relative; min-width: 0; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: block; text-align: center; padding: 6px 4px; border-radius: 6px; font-size: 13px; font-weight: 500;
  color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seg input:checked + span { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.18); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg label:hover span { color: var(--fg); }

/* Acciones */
.acciones { flex-direction: row; flex-wrap: wrap; }
.btn {
  flex: 1 1 140px; font-weight: 600; padding: 11px 14px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg);
}
.btn:hover { filter: brightness(1.08); }
.btn.secundario { background: transparent; color: var(--accent); }
.btn.peligro { background: transparent; color: var(--warn); border-color: var(--line); flex: none; align-self: flex-start; }
.btn.peligro.armado { background: var(--warn-bg); border-color: var(--warn); }

.ayuda ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.ayuda b { color: var(--fg); font-weight: 600; }
.foot { margin-top: auto; font-size: 11.5px; color: var(--muted); }
.foot a { color: inherit; }

/* Capas sobre el mapa */
.carga { position: absolute; top: 0; left: 0; right: 0; height: 3px; z-index: 1000; overflow: hidden; background: color-mix(in srgb, var(--accent) 25%, transparent); }
.carga span { position: absolute; top: 0; bottom: 0; width: 35%; background: var(--accent); animation: carga 1.1s ease-in-out infinite; }
@keyframes carga { from { left: -35%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .carga span { animation: none; left: 0; width: 100%; opacity: .6; } }

.toast {
  position: absolute; left: 50%; bottom: max(24px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 1000;
  max-width: min(440px, calc(100% - 32px)); padding: 10px 14px; border-radius: 10px;
  background: var(--surface); color: var(--fg); box-shadow: var(--shadow); font-size: 13.5px; font-weight: 500; overflow-wrap: anywhere;
}
.menu {
  position: absolute; z-index: 1000; min-width: 210px; padding: 5px; border-radius: 10px;
  background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); display: grid; gap: 1px;
}
.menu button, .menu a {
  display: block; text-align: left; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; cursor: pointer;
  color: var(--fg); text-decoration: none; font-size: 13.5px;
}
.menu button:hover, .menu a:hover, .menu button:focus-visible { background: var(--surface-2); }
.menu a { color: var(--accent); font-weight: 600; }
.menu button + a { border-top: 1px solid var(--line); border-radius: 0; margin-top: 3px; padding-top: 10px; }
.enlaces { display: grid; gap: 3px; margin-top: 2px; }
.boton-google {
  display: block; padding: 6px 10px; border-radius: 6px; background: #ffffff; color: #1a1a1a !important;
  font: 600 12.5px/1.2 var(--f-body); text-decoration: none; box-shadow: 0 1px 5px rgba(0,0,0,.4); border: 2px solid rgba(0,0,0,.2);
}
.boton-google:hover { background: #f2f2f2; }

.dibujo {
  position: absolute; z-index: 1000; top: 12px; left: 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 120px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 12px;
  border-radius: 12px; background: var(--surface); color: var(--fg); box-shadow: var(--shadow); border: 2px solid #111111;
}
.dibujo-txt { display: grid; min-width: 0; }
.dibujo-txt strong { font: 700 17px/1.1 var(--f-display); }
.dibujo-txt span { font-size: 12.5px; color: var(--muted); }
.dibujo-btns { display: flex; gap: 6px; }
.mini.primario { background: #111111; color: #ffffff; border-color: #111111; }
.mini:disabled { opacity: .45; cursor: default; }
@media (max-width: 760px) { .dibujo { max-width: calc(100% - 24px); top: 8px; } .dibujo-ayuda { display: none; } }

/* Guardar y compartir */
.mini.primario-verde { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.mini.whatsapp { background: #25d366; color: #0b2b16; border-color: #1fae54; text-decoration: none; display: inline-flex; align-items: center; }
.compartir-caja, .guardar-form {
  flex-basis: 100%; display: grid; gap: 8px; padding: 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.cc-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.cc-cab strong { font-weight: 600; }
.compartir-caja input, .guardar-form input {
  width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--fg); font-size: 13px;
}
.guardar-form label { font-size: 13px; font-weight: 600; }
.guardar-form input { font-size: 14px; }
.cc-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-btns .mini { padding: 8px 12px; font-size: 13px; }
.mis-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mis-lista li {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 10px 12px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid transparent;
}
.mis-lista li.abierta { border-color: var(--accent); }
.mr-txt { display: grid; min-width: 0; }
.mr-txt strong { font: 600 17px/1.15 var(--f-display); overflow-wrap: anywhere; }
.mr-txt span { font-size: 12.5px; color: var(--muted); }
.mr-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.aviso-compartida {
  display: grid; gap: 4px; justify-items: start; padding: 10px 12px; border-radius: 9px;
  background: var(--water-bg); font-size: 13px;
}

/* Seguir la ruta */
.btn.seguir { flex-basis: 100%; background: #1d64a8; border-color: #1d64a8; color: #ffffff; }
.btn.seguir:disabled { opacity: .5; cursor: default; filter: none; }
.boton-seguir {
  position: absolute; z-index: 1000; right: max(12px, env(safe-area-inset-right, 0px)); bottom: max(28px, calc(env(safe-area-inset-bottom, 0px) + 16px));
  display: flex; align-items: center; gap: 7px; padding: 12px 16px; border-radius: 999px; border: 0; cursor: pointer;
  background: #1d64a8; color: #ffffff; font: 700 16px/1 var(--f-body); box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.boton-seguir:hover { filter: brightness(1.1); }
.hud {
  position: absolute; z-index: 1001; left: 50%; transform: translateX(-50%);
  bottom: max(24px, calc(env(safe-area-inset-bottom, 0px) + 12px)); width: min(520px, calc(100% - 24px));
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface); color: var(--fg); box-shadow: var(--shadow); border: 2px solid #1d64a8;
}
.hud-txt { display: grid; gap: 2px; min-width: 0; flex: 1; }
.hud-txt strong { font: 700 26px/1.05 var(--f-display); font-variant-numeric: tabular-nums; }
.hud-txt span { font-size: 14.5px; font-weight: 500; }
.hud-txt .hud-gps { font-size: 12px; font-weight: 400; color: var(--muted); }
.hud-btns { display: grid; gap: 6px; }
.hud-btns .mini { padding: 9px 12px; font-size: 14px; }
.hud-fuera {
  position: absolute; z-index: 1001; left: 50%; transform: translateX(-50%); top: max(12px, env(safe-area-inset-top, 0px));
  width: min(520px, calc(100% - 24px)); padding: 12px 14px; border-radius: 12px; text-align: center;
  background: #c0362c; color: #ffffff; font: 700 18px/1.2 var(--f-body); box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
/* Tu posición: punto azul, y con dirección conocida una flecha con haz, como en Google Maps */
.yo { background: none; border: 0; pointer-events: none; }
.yo-giro { position: absolute; inset: 0; display: none; transition: transform .15s linear; }
.yo.con-rumbo .yo-giro { display: block; }
.yo.con-rumbo .yo-punto { display: none; }
.yo-haz {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(43,139,230,.55) 0%, rgba(43,139,230,.25) 35%, rgba(43,139,230,0) 70%);
  clip-path: polygon(50% 50%, 22% 0, 78% 0);
}
.yo-flecha { position: absolute; left: 30px; top: 30px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.55)); }
.yo-punto {
  position: absolute; left: 37px; top: 37px; width: 22px; height: 22px; border-radius: 50%;
  background: #2b8be6; border: 3px solid #ffffff; box-shadow: 0 0 0 2px rgba(43,139,230,.35), 0 1px 4px rgba(0,0,0,.5);
}
@media (prefers-reduced-motion: reduce) { .yo-giro { transition: none; } }
body.siguiendo .boton-google { display: none; }

.fantasma { position: fixed; left: 0; top: 0; z-index: 3000; pointer-events: none; filter: drop-shadow(0 4px 6px rgba(0,0,0,.4)); }

/* Leaflet */
.leaflet-container { font-family: var(--f-body); }
.leaflet-container.colocando, .leaflet-container.colocando .leaflet-interactive { cursor: crosshair; }
.leaflet-interactive.linea-ruta { cursor: grab; }
.leaflet-container.colocando .leaflet-interactive.linea-ruta, .leaflet-container.colocando .leaflet-interactive.linea-manual { cursor: crosshair; }
.pin { background: none; border: 0; }
.pin svg { display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
.parada { background: none; border: 0; }
.parada span {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: #ffffff; color: #18201b; border: 3px solid #18201b; font: 700 12px/1 var(--f-body); box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--fg); }
.leaflet-popup-content { margin: 12px 14px; font: 13px/1.45 var(--f-body); }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.pop { display: grid; gap: 4px; }
.pop strong { font-size: 14px; }
.pop .h { display: flex; align-items: center; gap: 8px; }
.pop .h .sw { margin-top: 0; }
.pop .pm { color: var(--muted); }
.pop .pt { font: 11.5px/1.4 ui-monospace, Consolas, monospace; color: var(--muted); white-space: pre-line; }
.pop-acciones { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pop-acciones:empty { display: none; }
.mini {
  padding: 6px 9px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--fg);
}
.mini:hover { border-color: var(--muted); }
.mini.peligro { color: var(--warn); }
.pop a.sv { font-weight: 600; color: var(--accent); margin-top: 2px; }
/* Gasolineras */
.gas-pin { background: none; border: 0; }
.gas {
  position: absolute; left: 0; top: 0; transform: translate(-50%, calc(-100% - 6px));
  display: flex; align-items: center; gap: 3px; padding: 3px 5px; border-radius: 7px; white-space: nowrap; cursor: pointer;
  background: #ffffff; color: #b3261e; border: 1.5px solid #b3261e; font: 700 11.5px/1 var(--f-body);
  box-shadow: 0 1px 4px rgba(0,0,0,.4); font-variant-numeric: tabular-nums;
}
.gas::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: #b3261e; border-bottom: 0;
}
.gas span { color: #18201b; }
.gas.barata { background: #1f9d55; border-color: #146c3a; color: #ffffff; }
.gas.barata span { color: #ffffff; }
.gas.barata::after { border-top-color: #146c3a; }
.gas.autovia { opacity: .6; background: #e6e6e6; color: #666666; border-color: #888888; }
.gas.autovia::after { border-top-color: #888888; }
.gas-mini { display: grid; place-items: center; width: 16px; height: 16px; margin-top: 1px; color: #b3261e; flex: none; }
.precios { border-collapse: collapse; margin-top: 4px; font-variant-numeric: tabular-nums; }
.precios td { padding: 2px 0; }
.precios td + td { padding-left: 16px; text-align: right; font-weight: 600; }
.aviso-pop { padding: 6px 8px; border-radius: 6px; background: var(--warn-bg); color: var(--fg); font-weight: 500; }

.leaflet-tooltip.tip { font: 600 12px/1.2 var(--f-body); border: 0; border-radius: 6px; padding: 4px 7px; background: var(--surface); color: var(--fg); box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.leaflet-tooltip.tip::before { display: none; }

/* Piezas que solo existen en el móvil */
.asa, .resumen-movil, .cabecera-movil { display: none; }

/* Móvil: mapa a pantalla completa, tarjeta de salida/llegada arriba y hoja que se arrastra abajo */
@media (max-width: 760px) {
  html, body { overflow: hidden; overscroll-behavior: none; }
  .app { display: block; position: relative; height: 100%; }
  .mapa-wrap { position: absolute; inset: 0; }

  .cabecera-movil {
    display: block; position: absolute; z-index: 1050;
    top: max(8px, env(safe-area-inset-top, 0px));
    left: max(8px, env(safe-area-inset-left, 0px)); right: max(8px, env(safe-area-inset-right, 0px));
    padding: 8px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow);
  }
  .cabecera-movil .sec { gap: 6px; }
  .cabecera-movil .label, .cabecera-movil .hint { display: none; }
  .cabecera-movil .punto { grid-template-columns: 40px minmax(0, 1fr) 42px; gap: 6px; }
  .cabecera-movil .muneco { width: 40px; height: 44px; }
  .cabecera-movil .muneco svg { width: 22px; height: 31px; }
  .cabecera-movil .buscar input { height: 44px; font-size: 16px; }
  .cabecera-movil .icono { width: 42px; height: 44px; }
  .cabecera-movil .resultados { margin: 0; max-height: 45vh; }
  .cabecera-movil .extra { padding: 6px 8px; }

  .panel {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 1100;
    height: var(--alto-hoja, 190px); max-height: 100%;
    border: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -6px 24px rgba(0, 0, 0, .35);
    padding-block: 0 max(16px, env(safe-area-inset-bottom, 0px));
    padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px));
    gap: 18px; overscroll-behavior: contain;
    transition: height .25s ease;
  }
  .panel.sin-animar { transition: none; }
  body[data-hoja="bajo"] .panel { overflow: hidden; }
  .asa {
    display: flex; justify-content: center; align-items: center; position: sticky; top: 0; z-index: 3;
    height: 26px; margin: 0 -14px -18px; background: var(--surface); touch-action: none; cursor: grab;
  }
  .asa span { width: 42px; height: 5px; border-radius: 3px; background: var(--muted); opacity: .5; }

  .resumen-movil { display: grid; gap: 9px; touch-action: none; padding-top: 4px; }
  .rm-cab { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: center; }
  .rm-cab .tag {
    width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
    font: 700 20px/1 var(--f-display); background: var(--accent); color: var(--accent-fg);
  }
  .rm-txt { display: grid; min-width: 0; }
  .rm-txt strong { font: 700 21px/1.1 var(--f-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rm-txt span { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .resumen-movil .pills { margin-top: 0; }
  .rm-btns { display: flex; gap: 8px; }
  .rm-btns .btn { flex: 1 1 0; min-width: 0; padding: 13px 6px; font-size: 15px; }
  .rm-btns .btn.seguir { flex: 1.5 1 0; }
  .rm-vacio { display: grid; gap: 3px; padding: 2px 0 6px; }
  .rm-vacio strong { font: 700 21px/1.1 var(--f-display); }
  .rm-vacio span { color: var(--muted); font-size: 14px; }

  .brand, #seguir { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Controles del mapa: el zoom se hace con los dedos */
  .leaflet-control-zoom, .boton-google, .boton-seguir { display: none !important; }
  .leaflet-top { top: var(--alto-cabecera, 0px); }
  .leaflet-bottom { bottom: var(--alto-hoja, 0px); }
  .toast { bottom: calc(var(--alto-hoja, 0px) + 12px); }
  .dibujo { top: calc(var(--alto-cabecera, 0px) + 4px); }

  /* Tamaños cómodos para el dedo */
  .mini { padding: 9px 12px; font-size: 14px; }
  .seg span { padding: 10px 4px; font-size: 14px; }
  .btn { padding: 13px 14px; font-size: 15px; }
  .ruta-card { padding: 12px; }
  .checks button { padding: 10px 12px; }
  .leaflet-popup-content { font-size: 14px; }
  .menu button, .menu a { padding: 12px 12px; font-size: 15px; }

  /* Siguiendo la ruta: solo el mapa y el panel de navegación */
  body.siguiendo .panel, body.siguiendo .cabecera-movil { display: none; }
  body.siguiendo .leaflet-top { top: 0; }
  body.siguiendo .leaflet-bottom { bottom: 0; }
  body.siguiendo .toast { bottom: auto; top: calc(max(12px, env(safe-area-inset-top, 0px)) + 64px); }
  .hud-txt strong { font-size: 24px; }
}
