/* =========================================================
   ASPECTO DE LA APP (estilo D "Todo en uno", maquetas de Picasso).
   Colores, letra y tamaños: todo se cambia aquí, en estas variables.
   ========================================================= */
:root {
  --fondo: #0d1015;
  --superficie: #181c23;
  --superficie-2: #222833;
  --borde: #2b313c;
  --texto: #f3f5f8;
  --texto-suave: #c8cfd8;      /* más claro: legible al sol (Carlos 2026-10-31) */
  --acento: #3b82f6;          /* botones principales, pestaña activa */
  --verde: #22c55e;           /* parada (burbuja verde con la flecha al último rumbo) */
  --azul: #3b82f6;            /* acento azul */
  --ambar: #f5a524;           /* batería baja, pernocta */
  --rojo: #ef4444;            /* alertas, saldo bajo */
  --gris: #8b939e;            /* sin señal */
  --morado: #a855f7;          /* en movimiento (burbuja morada con haz) */
  --rosa: #f472b6;            /* baliza comparada en el historial */
  --cian: #38bdf8;            /* parada habitual */
  --zona: #f5a524;
  --yo: #1a73e8;              /* tu ubicación: punto azul como Google Maps */

  --letra: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --t: 15px;
  --t-peq: 13px;
  --t-mini: 12px;
  --radio: 14px;
  --radio-peq: 10px;
  --esp: 14px;
  --alto-pestanas: 58px;
  --sombra: 0 6px 20px rgba(0, 0, 0, .45);
}

/* ---------- base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; width: 100%; height: 100%; background: var(--fondo); overflow: hidden; }
body { font-family: var(--letra); font-size: var(--t); color: var(--texto); -webkit-text-size-adjust: 100%; overscroll-behavior: none;
  touch-action: pan-x pan-y; /* sin zoom de la página: el zoom, solo en el mapa (motor.js) */ }
button, a, input, select, textarea, label { touch-action: manipulation; }
.oculto { display: none !important; }
.nota { color: var(--texto-suave); font-size: var(--t-peq); }
.error { color: var(--rojo); font-size: var(--t-peq); min-height: 1em; margin: 0; }
.alerta { color: var(--rojo) !important; }
.aviso-color { color: var(--ambar) !important; }
h1 { font-size: 30px; margin: 0 0 var(--esp); letter-spacing: -.5px; }
button { font-family: inherit; }
svg.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }

/* ---------- botones ---------- */
.boton {
  font: 600 var(--t) var(--letra); padding: 11px 16px; border-radius: var(--radio-peq);
  border: 0; background: var(--superficie-2); color: var(--texto); cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.boton.principal { background: var(--acento); color: #fff; }
.boton.peligro { background: rgba(239, 68, 68, .14); color: var(--rojo); border: 1px solid rgba(239, 68, 68, .55); }
.boton.peligro.armado { background: var(--rojo); color: #fff; }
.boton.ancho { width: 100%; }
.boton.peq { font-size: var(--t-peq); padding: 7px 11px; }
.boton.contorno { background: transparent; border: 1px solid var(--borde); }
.boton-redondo {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(24, 28, 35, .92);
  color: var(--texto); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--sombra);
}
.boton-texto { background: none; border: 0; color: var(--acento); font: 600 var(--t) var(--letra); cursor: pointer; padding: 8px 4px; }
.fila-botones { display: flex; gap: 10px; flex-wrap: wrap; }
.fila-botones > * { flex: 1; }
.chip {
  border: 0; border-radius: 999px; padding: 7px 13px; background: var(--superficie-2);
  color: var(--texto); font: 600 var(--t-peq) var(--letra); cursor: pointer; white-space: nowrap;
}
.chip.activo { background: var(--texto); color: var(--fondo); }
.segmentos { display: flex; background: var(--superficie-2); border-radius: var(--radio-peq); padding: 3px; gap: 3px; }
.segmentos button { flex: 1; border: 0; background: none; color: var(--texto-suave); font: 600 var(--t-peq) var(--letra); padding: 8px 6px; border-radius: 8px; cursor: pointer; }
.segmentos button.activo { background: var(--acento); color: #fff; }
.segmentos.claro button.activo { background: #2f3542; color: var(--texto); }

/* interruptor */
.interruptor { position: relative; width: 50px; height: 30px; flex: none; }
.interruptor input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.interruptor span { position: absolute; inset: 0; border-radius: 15px; background: #3a414d; transition: background .15s; }
.interruptor span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.interruptor input:checked + span { background: var(--verde); }
.interruptor input:checked + span::after { transform: translateX(20px); }

/* ---------- formularios ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-size: var(--t-peq); color: var(--texto-suave); }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--texto); padding: 11px 12px;
  border: 1px solid var(--borde); border-radius: var(--radio-peq); background: var(--superficie-2); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--acento); outline-offset: -1px; }
.titulito { font-size: var(--t-mini); font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--texto-suave); }

/* ---------- entrada ---------- */
.entrada { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.entrada-caja { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: var(--esp); }
.entrada-logo { width: 64px; height: 64px; border-radius: 16px; display: block; margin-bottom: 6px; }
.entrada-caja h1 { margin: 0; }
.separador { display: flex; align-items: center; gap: 10px; color: var(--texto-suave); font-size: var(--t-peq); }
.separador::before, .separador::after { content: ""; flex: 1; height: 1px; background: var(--borde); }

/* ---------- estructura ---------- */
.app { position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100dvh; height: var(--alto-app, 100dvh); display: flex; flex-direction: column; overflow: hidden; }
/* Anclada a la pantalla de inicio (modo app): sin barra de Safari, la app llena la pantalla entera; abajo solo se
   respeta la zona de la barra de inicio (safe-area, en las pestañas). --alto-app lo calcula motor.js. */
html.modo-app, html.modo-app body { height: var(--alto-app, 100vh); }
html.modo-app .app { height: var(--alto-app, 100vh); }
.contenido { flex: 1; position: relative; overflow: hidden; }
.vista { position: absolute; inset: 0; overflow-y: auto; display: none; -webkit-overflow-scrolling: touch; }
.vista.activa { display: block; }
.vista-pagina { padding: calc(env(safe-area-inset-top) + 18px) 16px 24px; max-width: 680px; margin: 0 auto; }
.pestanas {
  display: flex; height: calc(var(--alto-pestanas) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--superficie); border-top: 1px solid var(--borde);
}
.pestana {
  flex: 1; background: none; border: 0; color: var(--texto-suave); cursor: pointer; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: var(--t-mini);
}
.pestana.activa { color: var(--acento); }
.contador {
  position: absolute; top: 5px; left: calc(50% + 6px); min-width: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--rojo); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px;
}

/* ---------- mapa ---------- */
.mapa { position: absolute; inset: 0; background: #2b2d31; }
.maplibregl-map { background: #2b2d31; font-family: var(--letra); -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.mapa-cabecera {
  position: absolute; z-index: 600; top: calc(env(safe-area-inset-top) + 10px); left: 12px; right: 12px;
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; border-radius: var(--radio);
  background: rgba(24, 28, 35, .92); box-shadow: var(--sombra); backdrop-filter: blur(8px);
}
.mapa-cabecera strong { font-size: 19px; flex: 1; }
.en-directo { color: var(--verde); font-size: var(--t-peq); font-weight: 600; }
.en-directo.caida { color: var(--rojo); }
.mapa-botones { position: absolute; z-index: 600; right: 12px; top: calc(env(safe-area-inset-top) + 12px); display: flex; flex-direction: column; gap: 10px; }
.mapa-botones .apagado { color: var(--texto-suave); background: rgba(24, 28, 35, .75); }
/* "Sin conexión desde 14:32": indicador fijo y discreto (no es un aviso flotante); arriba a la izquierda, sin tapar
   los tres botones de la derecha; se quita solo al volver la conexión (Carlos 2026-10-31) */
.estado-conexion {
  position: absolute; z-index: 600; top: calc(env(safe-area-inset-top) + 14px); left: 12px; max-width: calc(100% - 90px);
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; pointer-events: none;
  background: rgba(24, 28, 35, .9); color: var(--ambar); font-size: var(--t-peq); font-weight: 700; box-shadow: var(--sombra);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums;
}
.estado-conexion::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ambar); flex: none; }
body.con-catastro:not(.en-historial):not(.siguiendo) .estado-conexion { top: calc(env(safe-area-inset-top) + 72px); }
body.en-historial .estado-conexion { display: none; }
.boton-capa { font: 700 10px var(--letra); flex-direction: column; gap: 1px; }
/* atribución de los mapas (obligatoria con Google): siempre a la vista, encima del panel */
.maplibregl-ctrl-bottom-left { z-index: 650; transition: bottom .2s ease-out; }
.maplibregl-ctrl-attrib { background: rgba(0, 0, 0, .5) !important; color: #ddd !important; font-size: 9.5px !important; margin: 0 0 2px 4px !important; padding: 1px 6px !important; border-radius: 6px; }
.maplibregl-ctrl-attrib a { color: #eee !important; }

/* marcas de baliza: el icono es el punto exacto; la etiqueta va al lado que quepa (lo decide app.js) */
/* el div de cada marca mide 0: su esquina es el punto exacto y el contenido se centra con su propio CSS */
.marca, .chincheta { width: 0; height: 0; background: none; border: 0; overflow: visible; }
/* Icono estilo 1 "Burbuja iPhone" (Picasso, Carlos 2026-10-31 v1.8): disco con borde blanco y sombra suave */
.pin { position: relative; width: 34px; height: 34px; transform: translate(-17px, -17px); }
.pin-c {
  position: absolute; inset: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--color-pin); border: 3px solid #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .5);
}
.pin-c svg { width: 22px; height: 22px; display: block; }
.pin-giro { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; }
/* en el mapa la flecha gira suave (1,5 s, lo mismo que tarda en deslizarse); en el historial va directa al mover la barra */
body:not(.en-historial) .pin-giro, body:not(.en-historial) .pin-haz { transition: transform 1.5s ease-in-out; }
/* Haz de luz hacia el rumbo (como la posición de Mapas del iPhone): cono de 50 px con degradado que se apaga */
.pin-haz { position: absolute; left: -33px; top: -33px; width: 100px; height: 100px; pointer-events: none; opacity: .95;
  background: radial-gradient(circle closest-side at 50% 50%, var(--color-pin) 30%, transparent 100%);
  clip-path: polygon(50% 50%, 31% 4%, 35.5% 2.2%, 40.3% 1%, 45.1% .25%, 50% 0, 54.9% .25%, 59.7% 1%, 64.5% 2.2%, 69% 4%);
}
.pin-bat { position: absolute; top: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--rojo); border: 1.8px solid #fff; box-sizing: border-box; z-index: 1; }
/* Etiqueta del estilo 1: cristal oscuro, nombre en negrita, coche y "(14:32 · hace 12 min)" */
.pin-t {
  position: absolute; left: calc(100% + 5px); top: 50%; transform: translateY(-50%); text-align: center;
  background: rgba(28, 28, 32, .8); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-radius: 10px; padding: 4px 9px 5px; line-height: 1.18; white-space: nowrap; box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.pin-t b { font-size: 13px; font-weight: 700; display: block; color: #fff; }
.pin-t small { font-size: 11.5px; color: #fff; display: block; }
.pin-t small.pin-hora { font-size: 10.5px; color: rgba(255, 255, 255, .78); font-variant-numeric: tabular-nums; }
.lado-izq .pin-t { left: auto; right: calc(100% + 5px); }
.lado-arr .pin-t { left: 50%; top: auto; bottom: calc(100% + 3px); transform: translateX(-50%); }
.lado-aba .pin-t { left: 50%; top: calc(100% + 5px); transform: translateX(-50%); }
.pin.sin-sitio .pin-t, .chin.sin-sitio span { display: none; }
body.sin-etiquetas:not(.en-historial) .pin-t { display: none; }
.pin.movimiento { --color-pin: var(--morado); }
.pin.parada-reciente, .pin.parada, .pin.reposo { --color-pin: var(--verde); }
.pin.sin-senal { --color-pin: var(--gris); }
.pin.no-activa .pin-c { background: rgba(93, 99, 110, .8); border: 2.4px dashed rgba(255, 255, 255, .95); box-shadow: none; }
.pin.no-activa .pin-c svg { opacity: .9; }
.pin.comparada, .pin.comparada-parada { --color-pin: var(--rosa); }
.yo-punto { transform: translate(-9px, -9px); width: 18px; height: 18px; border-radius: 50%; background: var(--yo); border: 3px solid #fff; box-shadow: 0 0 0 7px rgba(26, 115, 232, .22), 0 1px 4px rgba(0, 0, 0, .5); }

/* burbuja */
.maplibregl-popup { z-index: 1200; }
.maplibregl-popup-content { background: var(--superficie); color: var(--texto); border-radius: var(--radio); box-shadow: var(--sombra);
  padding: 14px 30px 12px 14px; font-size: var(--t-peq); line-height: 1.45; font-family: var(--letra); touch-action: pan-y; will-change: transform; }
.burbuja-baliza .maplibregl-popup-content { min-width: 230px; }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip, .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip, .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--superficie); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip, .maplibregl-popup-anchor-top-left .maplibregl-popup-tip, .maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--superficie); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--superficie); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--superficie); }
.maplibregl-popup-close-button { color: var(--texto-suave); width: 44px; height: 44px; font: 400 26px/42px var(--letra); top: 0; right: 0; border-radius: 0 var(--radio) 0 0; }
.maplibregl-popup-close-button:hover { background: none; color: var(--texto); }
.burbuja-titulo { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.burbuja-titulo b { font-size: 17px; }
.burbuja-datos { color: var(--texto-suave); }
.burbuja-grande { font-size: 25px; font-weight: 800; letter-spacing: -.4px; margin: 2px 0 4px; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--texto-suave); }
.burbuja-grande.movimiento { color: var(--morado); }
.burbuja-grande.parada, .burbuja-grande.parada-reciente { color: var(--verde); }
.burbuja-grande.reposo { color: var(--verde); }
.burbuja-hace { font-size: 12px; font-weight: 600; letter-spacing: 0; color: var(--texto-suave); margin-left: 6px; }
.burbuja-datos strong { color: var(--texto); }
.burbuja-botones { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 10px; }
.burbuja-botones .boton { font-size: 12px; padding: 8px 4px; }
a.boton { color: var(--texto); }
a.boton.principal { color: #fff; }

/* hojas que suben desde abajo */
.hoja {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 700; background: var(--superficie);
  border-radius: 20px 20px 0 0; box-shadow: 0 -8px 24px rgba(0, 0, 0, .4); display: flex; flex-direction: column;
}
.asa { width: 100%; background: none; border: 0; padding: 8px 0 2px; cursor: pointer; }
.asa::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: #3a414d; margin: 0 auto; }
.panel { height: 45%; max-height: 92%; }
.panel.animando { transition: height .22s ease-out; }
#panel-asa, .panel-cabecera { touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
#panel-asa { padding: 10px 0 6px; }
.panel-cabecera { display: flex; align-items: center; gap: 10px; padding: 6px 16px 10px; }
.panel-cabecera > div { flex: 1; min-width: 0; }
.panel-cabecera strong { font-size: 17px; display: block; }
.panel-cuerpo { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 10px; -webkit-overflow-scrolling: touch; }
.panel:not(.abierto) .panel-cuerpo { display: none; }
.tabla-cab, .panel-lista li { display: grid; grid-template-columns: 14px 1fr 64px 58px 38px; align-items: center; gap: 8px; }
.tabla-cab { font-size: 10.5px; font-weight: 700; letter-spacing: .5px; color: var(--texto-suave); padding: 0 0 6px; border-bottom: 1px solid var(--borde); }
.tabla-cab span:nth-child(n+3), .panel-lista li > :nth-child(n+3) { text-align: right; justify-self: end; }
.panel-lista { list-style: none; margin: 0; padding: 0; }
.panel-lista li { padding: 7px 0; border-bottom: 1px solid var(--borde); font-size: var(--t-peq); cursor: pointer; }
.panel-lista li.apagada { opacity: .5; }
.panel-lista b { display: block; font-size: 14px; }
.panel-lista small { color: var(--texto-suave); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.casilla-ver { width: 26px; height: 26px; accent-color: var(--acento); margin: 0; }
.panel-lista em.no-activa { font-style: normal; font-size: 10px; font-weight: 700; color: var(--texto-suave); background: var(--superficie-2); border-radius: 5px; padding: 1px 5px; margin-left: 4px; vertical-align: 2px; }
.casilla-ver.mano { accent-color: #6b7280; }
.casilla-ver:disabled { opacity: .3; }
.punto { width: 10px; height: 10px; border-radius: 50%; background: var(--gris); display: inline-block; flex: none; }
.punto.movimiento { background: var(--morado); } .punto.parada, .punto.parada-reciente { background: var(--verde); }
.punto.no-activa { background: #4b5563; }
.punto.bateria-baja { background: var(--rojo); } .punto.sin-senal { background: var(--gris); }
.punto.alerta { background: var(--rojo); } .punto.zona { background: var(--zona); } .punto.morado { background: var(--rosa); }

/* batería */
.bat { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: var(--t-peq); color: var(--verde); }
.bat i { width: 22px; height: 11px; border: 1.5px solid currentColor; border-radius: 3px; position: relative; display: inline-block; }
.bat i::after { content: ""; position: absolute; right: -4px; top: 3px; width: 2px; height: 4px; background: currentColor; border-radius: 0 1px 1px 0; }
.bat i b { position: absolute; left: 1px; top: 1px; bottom: 1px; background: currentColor; border-radius: 1px; }
.bat.baja, .bat.muy-baja { color: var(--rojo); } .bat.nada { color: var(--texto-suave); }

/* ---------- lista de balizas ---------- */
.seccion-titulo { display: flex; justify-content: space-between; margin: 18px 4px 8px; }
.tarjetas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tarjeta { background: var(--superficie); border-radius: var(--radio); padding: 13px 14px; }
.fila-baliza { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.fila-baliza .cuerpo { flex: 1; min-width: 0; }
.fila-baliza .cuerpo > b { font-size: 17px; }
.fila-baliza .cuerpo > b span { font-weight: 500; font-size: 15px; margin-left: 4px; }
.fila-baliza .linea { color: var(--texto-suave); font-size: var(--t-peq); margin: 2px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila-baliza .extra { display: flex; gap: 14px; align-items: center; font-size: var(--t-peq); font-weight: 600; }
.chevron { color: var(--texto-suave); font-size: 22px; }
.miniatura { width: 58px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; background: var(--superficie-2); display: block; }
.miniatura.vacia-foto { border: 1px dashed #3a414d; background: transparent; }
.vacia { text-align: center; color: var(--texto-suave); padding: 24px 0; list-style: none; }

/* ---------- ficha ---------- */
.ficha-barra {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 8px) 10px 8px; background: rgba(13, 16, 21, .94); border-bottom: 1px solid var(--borde);
}
.ficha { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 28px; max-width: 680px; margin: 0 auto; }
.ficha-cabeza { display: flex; align-items: flex-start; gap: 10px; }
.ficha-cabeza .punto { margin-top: 12px; width: 12px; height: 12px; }
.ficha-cabeza > div { flex: 1; min-width: 0; }
.ficha-cabeza strong { font-size: 28px; display: block; letter-spacing: -.5px; }
.ficha-coche { background: none; border: 0; padding: 0; font: 500 16px var(--letra); color: var(--texto); width: 100%; }
.ficha-coche:focus { outline: none; border-bottom: 1px solid var(--acento); }
.pastilla { border-radius: 999px; padding: 5px 11px; font-size: var(--t-peq); font-weight: 700; white-space: nowrap; }
.pastilla.movimiento { background: var(--morado); color: #fff; }
.pastilla.parada, .pastilla.parada-reciente { background: var(--verde); color: #04260f; }
.pastilla.no-activa { background: var(--superficie-2); color: var(--texto-suave); }
.pastilla.sin-senal { background: var(--gris); color: #111; }
.ficha-acciones { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.fotos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.foto { position: relative; border-radius: var(--radio-peq); overflow: hidden; background: var(--superficie-2); aspect-ratio: 4 / 3; }
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto em { position: absolute; left: 6px; bottom: 6px; background: rgba(0, 0, 0, .7); border-radius: 6px; padding: 1px 6px; font: 600 11px var(--letra); font-style: normal; }
.foto button { position: absolute; top: 5px; right: 5px; border: 0; border-radius: 6px; padding: 2px 7px; background: rgba(0, 0, 0, .7); color: #fff; font-size: 11px; cursor: pointer; }
.foto-nueva { border: 1.5px dashed #4a5260; border-radius: var(--radio-peq); aspect-ratio: 4 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--acento); font-size: var(--t-peq); font-weight: 600; cursor: pointer; gap: 2px; }
.foto-nueva b { font-size: 24px; line-height: 1; }
.caja { background: var(--superficie); border-radius: var(--radio); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.caja textarea { background: transparent; border: 0; padding: 0; font-size: 16px; resize: none; }
.caja .fila { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cifra { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.barra-bat { height: 6px; border-radius: 3px; background: #333a46; overflow: hidden; }
.barra-bat b { display: block; height: 100%; background: var(--verde); border-radius: 3px; }
.prevision { font-size: var(--t-peq); color: var(--texto-suave); line-height: 1.35; }
.chips-resp { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chips-resp button { border: 1px solid var(--borde); background: var(--superficie-2); color: var(--texto); border-radius: var(--radio-peq); padding: 10px 4px; font: 600 var(--t-peq) var(--letra); cursor: pointer; }
.chips-resp button.activo { border-color: var(--acento); background: rgba(59, 130, 246, .2); }
.fila-interruptor { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 16px; color: var(--texto); }

/* ---------- avisos ---------- */
.aviso-fila { display: flex; gap: 12px; align-items: flex-start; }
.aviso-fila .punto { margin-top: 6px; }
.aviso-fila .texto { flex: 1; min-width: 0; }
.aviso-fila .texto b { display: block; }
.aviso-fila .hora { font-size: var(--t-peq); color: var(--texto-suave); }
.aviso-flotante {
  position: fixed; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 10px); z-index: 3000;
  padding: 13px 15px; border-radius: var(--radio); background: #f3f5f8; color: #111; box-shadow: var(--sombra); font-weight: 600;
  pointer-events: none; /* no tapa: el toque pasa a lo de debajo (menú Capas, ✕ Catastro…) y el aviso se quita (app.js) */
}
/* con el Catastro o en el historial, el aviso baja para no tapar el buscador, ✕ Catastro ni la cabecera del historial */
body.con-catastro:not(.en-historial) .aviso-flotante { top: calc(env(safe-area-inset-top) + 74px); }
body.en-historial .aviso-flotante { top: calc(env(safe-area-inset-top) + 124px); }

/* ---------- cámaras ---------- */
.camara video { width: 100%; margin-top: 8px; border-radius: var(--radio-peq); background: #000; }
.datos { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 8px 0 12px; font-size: var(--t-peq); }
.datos dt { color: var(--texto-suave); }
.datos dd { margin: 0; }

/* ---------- hoja modal (menús, opciones) ---------- */
dialog.hoja-modal {
  border: 0; padding: 0; margin: auto 0 0; width: 100%; max-width: 100%; max-height: 85vh; background: transparent; color: var(--texto);
}
dialog.hoja-modal::backdrop { background: rgba(0, 0, 0, .55); }
.hoja-modal .marco { margin: 0 10px calc(env(safe-area-inset-bottom) + 10px); display: flex; flex-direction: column; gap: 10px; }
.hoja-modal .grupo { background: var(--superficie); border-radius: var(--radio); overflow: hidden; max-height: 70vh; overflow-y: auto; }
.hoja-modal .grupo-titulo { text-align: center; color: var(--texto-suave); font-size: var(--t-peq); padding: 12px; border-bottom: 1px solid var(--borde); }
.opcion { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--borde); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; color: var(--texto); text-align: left; font: inherit; cursor: pointer; }
.opcion:last-child { border-bottom: 0; }
.opcion .ico-caja { width: 34px; height: 34px; border-radius: 9px; background: var(--superficie-2); display: flex; align-items: center; justify-content: center; flex: none; color: var(--acento); }
.opcion .ico-caja svg { width: 18px; height: 18px; }
.opcion > span:nth-child(2) { flex: 1; min-width: 0; }
.opcion small { display: block; color: var(--texto-suave); font-size: var(--t-mini); margin-top: 2px; }
.cancelar { background: var(--superficie); color: var(--acento); border: 0; border-radius: var(--radio); padding: 15px; font: 700 16px var(--letra); cursor: pointer; }

/* ---------- historial ---------- */
body.en-historial .pestanas, body.en-historial .mapa-cabecera, body.en-historial .mapa-botones, body.en-historial #panel { display: none; }
.historial { position: fixed; inset: 0; z-index: 800; pointer-events: none; }
.historial > * { pointer-events: auto; }
.h-arriba { position: absolute; top: calc(env(safe-area-inset-top) + 10px); left: 12px; right: 12px; display: flex; gap: 10px; align-items: center; }
.h-titulo { flex: 1; min-width: 0; background: rgba(24, 28, 35, .92); border-radius: 22px; padding: 6px 16px; box-shadow: var(--sombra); line-height: 1.25; }
.h-titulo b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-titulo small { color: var(--texto-suave); font-size: var(--t-mini); }
.h-chips { position: absolute; top: calc(env(safe-area-inset-top) + 64px); right: 12px; display: flex; gap: 8px; align-items: center; }
.h-chips .chip { background: rgba(24, 28, 35, .92); box-shadow: var(--sombra); }
.h-hoja { padding: 0 14px calc(env(safe-area-inset-bottom) + 10px); }
.h-cabeza { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.h-fecha { font-size: 22px; font-weight: 800; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.h-escala { text-align: right; font-size: var(--t-peq); color: var(--texto-suave); line-height: 1.3; white-space: nowrap; padding-top: 5px; }
.h-info { font-size: var(--t-peq); color: var(--texto-suave); margin: 2px 0 6px; min-height: 1.3em; }
.h-info b { color: var(--verde); }
.h-info .morado { color: var(--rosa); }
.h-barra { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.h-barra canvas { display: block; width: 100%; }
.h-controles { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.h-controles .boton-redondo { box-shadow: none; background: var(--superficie-2); }
.h-play { width: 56px !important; height: 56px !important; background: var(--acento) !important; }
.h-vel { font: 700 13px var(--letra); color: var(--acento) !important; }
.h-pie { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.h-pie .hueco { flex: 1; }
.h-pista { font-size: var(--t-mini); color: var(--texto-suave); }
.chincheta { width: auto !important; height: auto !important; background: none; border: 0; }
.chin { position: relative; width: 28px; height: 28px; transform: translate(-14px, -14px); }
.chin i { position: absolute; inset: 0; width: 28px; height: 28px; border-radius: 8px; border: 2px solid #fff; display: flex; align-items: center; justify-content: center; background: #4b5563; color: #fff; font-style: normal; box-shadow: var(--sombra); }
.chin i svg { width: 15px; height: 15px; }
.chin.pernocta i { background: var(--ambar); color: #2b1a00; }
.chin.habitual i { background: var(--cian); color: #062433; }
.chin span { position: absolute; left: calc(100% + 5px); top: 50%; transform: translateY(-50%); background: rgba(15, 18, 23, .86); border-radius: 7px; padding: 2px 6px; font-size: 10.5px; line-height: 1.2; white-space: nowrap; color: #fff; }
.chin.lado-izq span { left: auto; right: calc(100% + 5px); }
.chin.lado-arr span { left: 50%; top: auto; bottom: calc(100% + 3px); transform: translateX(-50%); }
.chin.lado-aba span { left: 50%; top: calc(100% + 3px); transform: translateX(-50%); }
.chin span small { display: block; color: #cfd5dd; }
.flecha-baliza { width: auto !important; height: auto !important; background: none; border: 0; }

/* calendario */
.cal-cab { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 8px; }
.cal-cab strong { font-size: 20px; display: block; }
.cal-rejilla { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; row-gap: 4px; }
.cal-rejilla .ds { font-size: var(--t-mini); color: var(--texto-suave); padding: 4px 0; }
.cal-dia { position: relative; border: 0; background: none; color: var(--texto); font: 600 16px var(--letra); padding: 9px 0 13px; border-radius: 10px; cursor: pointer; }
.cal-dia.sin { color: #555d69; }
.cal-dia.sel { background: var(--acento); color: #fff; }
.cal-dia.rango { background: rgba(59, 130, 246, .25); }
.cal-dia .mov { position: absolute; left: 50%; bottom: 5px; width: 14px; height: 3px; border-radius: 2px; background: var(--verde); transform: translateX(-50%); }
.cal-dia.sel .mov { background: #fff; }
.cal-dia .casa { position: absolute; top: 4px; right: 4px; color: var(--ambar); }
.cal-dia .casa svg { width: 10px; height: 10px; }
.cal-leyenda { display: flex; gap: 14px; font-size: var(--t-mini); color: var(--texto-suave); margin: 8px 0; align-items: center; flex-wrap: wrap; }
.cal-leyenda .mov-l { display: inline-block; width: 14px; height: 3px; background: var(--verde); border-radius: 2px; vertical-align: middle; }

/* enlaces */
.enlace-url { word-break: break-all; font-size: var(--t-peq); background: var(--superficie-2); border-radius: var(--radio-peq); padding: 10px; user-select: all; }
.lista-elegir { list-style: none; margin: 0; padding: 0; }
.lista-elegir li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--borde); }
.lista-elegir li:last-child { border-bottom: 0; }
.lista-elegir input { width: 24px; height: 24px; accent-color: var(--acento); margin: 0; }
.lista-elegir label { flex-direction: row; align-items: center; gap: 12px; color: var(--texto); font-size: var(--t); flex: 1; cursor: pointer; }

/* página compartida */
.compartido-cab { position: absolute; z-index: 600; top: calc(env(safe-area-inset-top) + 10px); left: 12px; right: 12px; background: rgba(24, 28, 35, .92); border-radius: var(--radio); padding: 10px 14px; box-shadow: var(--sombra); display: flex; align-items: center; gap: 10px; }
.compartido-cab > div { flex: 1; }
.compartido-cab b { display: block; }
.caducado { position: absolute; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; background: var(--fondo); text-align: center; padding: 24px; }

/* ---------- maquetas FINAL ---------- */
.boton.google, .chip.google { background: rgba(34, 197, 94, .16); color: var(--verde) !important; border: 1px solid rgba(34, 197, 94, .5); }
.boton.google svg, .chip.google svg { width: 15px; height: 15px; }
.ficha-barra strong { font-size: 16px; }
.boton-compartir { width: 100%; margin-top: 6px; color: var(--acento) !important; background: rgba(59, 130, 246, .12); }
.aviso-tarjeta.manip { border: 1.5px solid rgba(239, 68, 68, .7); background: rgba(239, 68, 68, .08); }
.aviso-tarjeta.manip .texto b { color: #ff8a8a; }
.aviso-tarjeta .fila-botones { margin-top: 10px; }
.icono-aviso { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--superficie-2); }
.icono-aviso svg { width: 17px; height: 17px; }
.icono-aviso.mov { color: var(--morado); background: rgba(168, 85, 247, .16); }
.icono-aviso.par { color: var(--verde); background: rgba(34, 197, 94, .14); }
.icono-aviso.manip { color: var(--rojo); background: rgba(239, 68, 68, .16); }
.icono-aviso.bat { color: var(--ambar); background: rgba(245, 165, 36, .14); }
.icono-aviso.zona { color: var(--cian); background: rgba(56, 189, 248, .14); }
.icono-aviso.senal { color: var(--gris); }
.pastilla.verde { background: rgba(34, 197, 94, .18); color: var(--verde); }
.progreso { height: 4px; border-radius: 2px; background: #333a46; overflow: hidden; margin: 8px 0 4px; }
.progreso b { display: block; height: 100%; background: var(--verde); }
.enlace-corto { font-family: ui-monospace, Consolas, monospace; font-size: var(--t-mini); color: var(--acento); background: var(--superficie-2); border-radius: 8px; padding: 6px 9px; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.boton.cortar { color: var(--rojo); border: 1px solid rgba(239, 68, 68, .55); background: rgba(239, 68, 68, .1); }
.compartido-pie { position: absolute; z-index: 600; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 12px); }
.compartido-pie .tarjeta { margin-top: 8px; }
.compartido-vel { font-size: 26px; font-weight: 800; color: var(--morado); }
.distancia { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; background: #fff; color: #111; border-radius: 9px; font: 700 11px var(--letra); padding: 2px 7px; box-shadow: var(--sombra); }
label.fila-interruptor, label.opcion { flex-direction: row; align-items: center; font-size: 16px; color: var(--texto); }
label.opcion { font-size: var(--t); }
a.chip, a.boton { text-decoration: none; }
.ficha-acciones .boton { white-space: nowrap; font-size: 12.5px; padding: 9px 6px; }
.burbuja-botones .boton { white-space: nowrap; }

/* ---------- reposo y seguir ---------- */
:root { --reposo: var(--verde); } /* reposo = parada desde hace más tiempo (Carlos 2026-10-31): verde, sin luna ni índigo */

.punto.reposo { background: var(--verde); }
.pastilla.reposo { background: rgba(34, 197, 94, .18); color: var(--verde); }
.ficha-acciones { grid-template-columns: 1fr 1fr; }
body.siguiendo #panel { display: none; }
.seguir-barra {
  position: absolute; z-index: 650; top: calc(env(safe-area-inset-top) + 10px); left: 12px; right: 12px;
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radio);
  background: rgba(24, 28, 35, .95); box-shadow: var(--sombra); border: 1px solid rgba(59, 130, 246, .5);
}
.seguir-texto { flex: 1; min-width: 0; line-height: 1.3; }
.seguir-texto b { display: block; font-size: 16px; }
.seguir-texto small { display: block; color: var(--texto-suave); font-size: var(--t-peq); }
.seguir-distancia { display: block; font-size: 15px; margin-top: 2px; }
.seguir-distancia b { font-size: 18px; color: var(--acento); display: inline; }

/* Seguir: la hora de la última posición en grande, con su "hace…" */
.seguir-hora { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.seguir-hora b { font-size: 26px; font-weight: 800; letter-spacing: -.4px; color: var(--texto); display: inline; }
.seguir-hora span { font-size: 13px; color: var(--texto-suave); }
.seguir-hora.movimiento b { color: var(--morado); } .seguir-hora.parada b, .seguir-hora.parada-reciente b { color: var(--verde); }

/* =========================================================
   COMODIDAD (2026-10-31): configuración, modo noche, burbuja que se desliza,
   estela de Seguir, letra grande y Catastro.
   ========================================================= */
.boton-menu { width: 38px; height: 38px; box-shadow: none; background: var(--superficie-2); }

/* burbuja: pasar a la anterior / siguiente */
.burbuja-pasar { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--borde); color: var(--texto-suave); font-size: var(--t-mini); }
.burbuja-pasar button { border: 0; background: var(--superficie-2); color: var(--texto); width: 30px; height: 26px; border-radius: 8px; font-size: 18px; line-height: 1; cursor: pointer; }


/* ajustes */
#v-ajustes .caja .fila-interruptor small { font-size: var(--t-mini); font-weight: 400; margin-top: 2px; }
#v-ajustes .caja .fila-interruptor > span:first-child { flex: 1; }
#v-ajustes .caja .fila { font-size: var(--t-peq); }
#v-ajustes .segmentos button:disabled { opacity: .4; cursor: default; }
#v-ajustes .seccion-titulo { margin: 16px 2px 8px; }

/* letra grande */
body.letra-grande .vista-pagina, body.letra-grande .ficha, body.letra-grande .hoja-modal .marco { zoom: 1.15; }
body.letra-grande .pin-t b { font-size: 15px; }
body.letra-grande .pin-t small { font-size: 12.5px; }
body.letra-grande .pin-t small.pin-hora { font-size: 11.5px; }
body.letra-grande .maplibregl-popup-content { font-size: 15px; }
body.letra-grande .burbuja-titulo b { font-size: 20px; }
body.letra-grande .burbuja-grande { font-size: 29px; }
body.letra-grande .burbuja-botones .boton { font-size: 14px; }
body.letra-grande .panel-lista li { font-size: 14.5px; }
body.letra-grande .panel-lista b { font-size: 16.5px; }
body.letra-grande .bat { font-size: 14px; }
body.letra-grande .seguir-texto b { font-size: 18.5px; }
body.letra-grande .seguir-texto small, body.letra-grande .seguir-hora span { font-size: 15px; }
body.letra-grande .seguir-hora b { font-size: 30px; }
body.letra-grande .seguir-distancia { font-size: 17px; }
body.letra-grande .pestanas { font-size: 12.5px; }
body.letra-grande .h-info { font-size: 14.5px; }
body.letra-grande .h-fecha { font-size: 25px; }

.popup-parcela .rc { font-family: ui-monospace, Consolas, monospace; font-size: 14px; font-weight: 700; color: var(--texto); letter-spacing: .3px; }
.cat-buscador { flex: 1; display: flex; align-items: center; gap: 6px; background: var(--superficie); border-radius: 24px; padding: 0 6px 0 12px; height: 46px; box-shadow: var(--sombra); color: var(--texto-suave); }
.cat-buscador input { flex: 1; min-width: 0; border: 0; background: none; padding: 0; height: 100%; font-size: 16px; color: var(--texto); outline: none; }
.cat-buscador input::-webkit-search-cancel-button { display: none; }
.cat-buscador button { border: 0; background: var(--superficie-2); color: var(--texto); width: 30px; height: 30px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.cat-sugerencias { position: absolute; z-index: 710; left: 64px; right: 12px; top: calc(env(safe-area-inset-top) + 62px); margin: 0; padding: 4px 0; list-style: none; background: var(--superficie); border-radius: var(--radio); box-shadow: var(--sombra); max-height: 55vh; overflow-y: auto; }
.cat-sugerencias li.nota { padding: 12px 14px; }
.cat-sugerencias button { display: flex; gap: 10px; align-items: center; width: 100%; border: 0; background: none; color: var(--texto); text-align: left; padding: 10px 14px; font: inherit; cursor: pointer; border-bottom: 1px solid var(--borde); }
.cat-sugerencias li:last-child button { border-bottom: 0; }
.cat-sugerencias button svg { width: 18px; height: 18px; color: var(--texto-suave); flex: none; }
.cat-sugerencias b { display: block; font-size: 15px; font-weight: 600; }
.cat-sugerencias small { display: block; color: var(--texto-suave); font-size: var(--t-peq); }
.cat-lado { position: absolute; z-index: 700; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 96px); }
.cat-pie { position: absolute; z-index: 700; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 12px); display: flex; gap: 10px; align-items: center; background: rgba(24, 28, 35, .94); border-radius: var(--radio); padding: 10px 12px; box-shadow: var(--sombra); }
.cat-pie > div { flex: 1; min-width: 0; }
.cat-pie b { display: block; font-size: 14px; }
.cat-pie small { display: block; color: var(--texto-suave); font-size: var(--t-mini); }
.cat-chincheta { width: 34px; height: 34px; color: #fff; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .6)); }
.cat-chincheta svg { width: 34px; height: 34px; fill: #ea4335; stroke: #7a1d16; stroke-width: 1.2; }
.cat-etiqueta { background: rgba(15, 18, 23, .9); color: #fff; border: 0; border-radius: 8px; font-weight: 600; box-shadow: var(--sombra); }
.cat-etiqueta::before { display: none; }
.chin.coinc i { background: var(--rosa); color: #3b0a24; }
.icono-aviso.coinc { color: var(--rosa); background: rgba(244, 114, 182, .16); }
.texto-acta { padding: 12px 14px; max-height: 46vh; overflow-y: auto; font-family: "Times New Roman", Times, serif; font-size: 15px; line-height: 1.5; color: var(--texto); user-select: text; -webkit-user-select: text; }
.texto-acta p { margin: 0 0 10px; text-align: justify; }
.menu-copiar { display: flex; flex-direction: column; gap: 6px; min-width: 190px; }
.menu-copiar .nota { font-variant-numeric: tabular-nums; }

/* =========================================================
   LIMPIEZA Y ACCESIBILIDAD (2026-10-31): botones de dedo (44 px), contraste, botones abajo,
   palabras bajo los iconos, avisos agrupados, Deshacer, "actualizando".
   ========================================================= */
/* tamaño mínimo de dedo */
.boton, a.boton, .chip, .boton-texto, .segmentos button, .chips-resp button, .opcion, .cal-rejilla button { min-height: 44px; }
.boton-redondo { min-width: 44px; min-height: 44px; }
.burbuja-botones .boton { min-height: 44px; }
.burbuja-pasar button { width: 44px; height: 44px; }
.foto button { min-height: 44px; min-width: 44px; padding: 4px 10px; }
.cat-buscador { height: 52px; }
.cat-buscador button { width: 44px; height: 44px; }
.casilla-caja { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -9px -9px -9px 0; cursor: pointer; }
.tabla-cab, .panel-lista li { grid-template-columns: 14px 1fr 64px 58px 44px; }
.h-pie { flex-wrap: wrap; row-gap: 6px; }
.h-pie .hueco { display: none; }
.interruptor { width: 52px; height: 32px; }
.interruptor span::after { width: 26px; height: 26px; }
.fila-interruptor { min-height: 44px; }

/* iconos con su palabra debajo */
.con-palabra { flex-direction: column; gap: 1px; width: 52px; height: 52px; border-radius: 16px; font: 700 10.5px var(--letra); }
.con-palabra svg.ico { width: 20px; height: 20px; }
.con-palabra span { line-height: 1.1; }
.boton-menu.con-palabra { width: 56px; height: 52px; border-radius: 14px; }
.con-pie { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.con-pie small { font-size: 10.5px; color: var(--texto-suave); font-weight: 600; }
.h-controles { align-items: flex-start; }

/* botones del mapa ARRIBA a la derecha, siempre a la vista: Nombres, Capas y Centrar (Carlos 2026-10-31) */
.mapa-botones { top: calc(env(safe-area-inset-top) + 12px); bottom: auto; }
.mapa-botones.sin-sitio { display: none; }
#btn-capa.activo { background: var(--acento); color: #fff; }
.mapa-botones .apagado { color: var(--texto-suave); background: rgba(24, 28, 35, .75); }

/* Seguir: la barra, abajo */
.seguir-barra { top: auto; bottom: 12px; }

/* indicador discreto de "actualizando" */
.actualizando { position: absolute; z-index: 600; top: calc(env(safe-area-inset-top) + 10px); left: 50%; transform: translateX(-50%) translateY(-6px);
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(13, 16, 21, .72);
  color: #e8ecf1; font-size: 11.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.actualizando.activo { opacity: .9; transform: translateX(-50%); }
.actualizando i { width: 8px; height: 8px; border-radius: 50%; background: var(--verde); animation: latido 0.9s ease-in-out infinite; }
@keyframes latido { 50% { opacity: .25; transform: scale(.7); } }
body.en-historial .actualizando { display: none; }

/* avisos agrupados por baliza; deslizar a la izquierda = leído */
.aviso-grupo { margin-bottom: 12px; }
.aviso-grupo-cab { display: flex; align-items: center; gap: 8px; padding: 2px 4px 8px; font-size: 15px; }
.aviso-grupo-cab span:not(.punto) { color: var(--texto-suave); font-size: var(--t-peq); flex: 1; }
.aviso-grupo-cab em { font-style: normal; font-size: 12px; font-weight: 700; background: var(--superficie-2); border-radius: 999px; padding: 2px 8px; }
.aviso-tarjeta { touch-action: pan-y; }
.aviso-tarjeta.nuevo { border-left: 3px solid var(--acento); }
.aviso-tarjeta .texto b::first-letter { text-transform: uppercase; }

/* Deshacer: barra abajo unos segundos */
.deshacer { position: fixed; z-index: 3000; left: 12px; right: 12px; bottom: calc(var(--alto-pestanas) + env(safe-area-inset-bottom) + 12px);
  display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 16px; border-radius: var(--radio); background: #f3f5f8; color: #111;
  box-shadow: var(--sombra); font-weight: 600; overflow: hidden; }
.deshacer span { flex: 1; font-size: 14px; }
.deshacer button { border: 0; background: none; color: #1d4ed8; font: 800 15px var(--letra); min-height: 44px; padding: 0 14px; cursor: pointer; }
.deshacer i { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: #1d4ed8; transform-origin: left; }

/* =========================================================
   MOTOR MAPLIBRE (2026-10-31): menú de Capas y Catastro con buscador
   ========================================================= */
.capas-menu { position: absolute; z-index: 700; right: 76px; top: calc(env(safe-area-inset-top) + 12px); width: min(280px, calc(100% - 100px));
  background: rgba(24, 28, 35, .97); border-radius: var(--radio); box-shadow: var(--sombra); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.capas-fila { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.capa-op { display: flex; flex-direction: column; align-items: center; gap: 5px; border: 0; background: none; color: var(--texto); font: 600 12px var(--letra); cursor: pointer; padding: 0; min-height: 44px; }
.capa-muestra { width: 100%; aspect-ratio: 1; border-radius: 12px; border: 2px solid transparent; display: block; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.capa-op.activo { color: var(--acento); }
.capa-op.activo .capa-muestra { border-color: var(--acento); }
.capa-muestra.sat { background: radial-gradient(circle at 30% 35%, #6b7f4a 0 18%, transparent 19%), radial-gradient(circle at 70% 70%, #50633b 0 22%, transparent 23%),
  linear-gradient(32deg, transparent 46%, #d9cfb4 47% 51%, transparent 52%), linear-gradient(135deg, #3d4a33, #5c5a45 55%, #3a4630); }
.capa-muestra.calle { background: linear-gradient(90deg, transparent 44%, #fff 45% 55%, transparent 56%), linear-gradient(0deg, transparent 30%, #f6d36b 31% 39%, transparent 40%),
  linear-gradient(60deg, transparent 70%, #a8d5a2 71%), #e8e4dc; }
.capa-muestra.catastro { background: linear-gradient(90deg, transparent 31%, #fff 32% 35%, transparent 36% 64%, #fff 65% 68%, transparent 69%),
  linear-gradient(0deg, transparent 40%, #fff 41% 44%, transparent 45%), linear-gradient(28deg, transparent 72%, #fff 73% 75%, transparent 76%), #3b4a40; }
.capas-menu .boton { min-height: 40px; }

/* capa Catastro: buscador arriba (a la izquierda de los botones) */
.cat-barra { display: none; position: absolute; z-index: 690; left: 12px; right: 76px; top: calc(env(safe-area-inset-top) + 12px); }
body.con-catastro:not(.en-historial):not(.siguiendo) .cat-barra { display: block; }
.cat-barra .cat-sugerencias { position: absolute; left: 0; right: 0; top: 58px; }
.cat-fila { display: flex; gap: 8px; align-items: center; }
.cat-salir { flex: none; height: 52px; min-width: 52px; padding: 0 12px; border: 0; border-radius: 26px; background: var(--superficie);
  color: var(--texto); font: 700 13px var(--letra); box-shadow: var(--sombra); cursor: pointer; white-space: nowrap; touch-action: manipulation; }
#h-catastro.activo::before { content: "✕ "; }
body.con-catastro .actualizando { top: calc(env(safe-area-inset-top) + 72px); }
.cat-chincheta { position: absolute; transform: translate(-17px, -32px); width: 34px; height: 34px; }
.cat-chincheta .cat-etiqueta { position: absolute; left: 50%; bottom: calc(100% + 2px); transform: translateX(-50%); white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis;
  background: rgba(15, 18, 23, .9); color: #fff; border-radius: 8px; padding: 3px 8px; font: 600 12px var(--letra); box-shadow: var(--sombra); }

/* PDF del historial con la app anclada al inicio (v1.8): capa con ✕, nunca se queda atrapado */
.capa-pdf { position: fixed; inset: 0; z-index: 2000; background: var(--fondo); display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.capa-pdf-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px 8px 16px; border-bottom: 1px solid var(--borde); }
.capa-pdf-cab b { font-size: var(--t); }
.capa-pdf-x { min-width: 44px; min-height: 44px; border-radius: 22px; border: 0; background: var(--superficie-2); color: var(--texto); font-size: 20px; cursor: pointer; }
.capa-pdf-cuerpo { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: #2a2f38; overflow: auto; -webkit-overflow-scrolling: touch; }
.capa-pdf-cuerpo iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.capa-pdf-botones { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px 12px; }
.capa-pdf-botones .boton { flex: 1 1 auto; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.capa-pdf-botones [aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* =========================================================
   1.9 (Carlos 2026-10-31): navegación por las calles, vista de conductor y tu posición
   ========================================================= */
/* Las flechas y el haz de las balizas, al rumbo real aunque el mapa esté girado (--giro-mapa = -rumbo del mapa) */
#mapa .pin-giro, #mapa .pin-haz { rotate: var(--giro-mapa, 0deg); }
/* Tu posición: punto azul (con cono hacia donde vas al moverte); navegando, flecha azul tumbada en el mapa */
.yo-marca { width: 0; height: 0; overflow: visible; }
.yo-cono { position: absolute; left: -30px; top: -30px; width: 60px; height: 60px; pointer-events: none; display: none;
  background: radial-gradient(circle closest-side, rgba(26, 115, 232, .55) 20%, transparent 100%);
  clip-path: polygon(50% 50%, 25% 0, 75% 0); }
.yo-marca.con-rumbo .yo-cono { display: block; }
.yo-flecha { position: absolute; left: -21px; top: -21px; width: 42px; height: 42px; display: none; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45)); }
.yo-flecha path { fill: var(--yo); stroke: #fff; stroke-width: 3; stroke-linejoin: round; }
body.navegando .yo-marca .yo-flecha { display: block; }
body.navegando .yo-marca .yo-punto, body.navegando .yo-marca .yo-cono { display: none; }
/* Destino */
.nav-destino { position: relative; width: 0; height: 0; }
.nav-destino svg { position: absolute; left: -17px; top: -38px; width: 34px; height: 38px; color: #ea4335; fill: #ea4335; stroke: #fff; stroke-width: 1.2; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .5)); }
/* Mientras se navega a un sitio: sin panel ni buscador; abajo, una barra pequeña y discreta */
body.navegando #panel, body.navegando .cat-barra { display: none !important; }
.nav-barra { position: absolute; z-index: 650; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 12px);
  display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border-radius: var(--radio);
  background: rgba(24, 28, 35, .92); box-shadow: var(--sombra); border: 1px solid rgba(31, 107, 255, .55); }
.nav-datos { flex: 1; min-width: 0; line-height: 1.2; }
.nav-datos b { display: block; font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; color: #5b9bff; }
.nav-datos span { display: block; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nav-datos small { display: block; color: var(--texto-suave); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-barra .boton.peq { padding: 7px 9px; min-height: 40px; white-space: nowrap; }
.nav-terminar { background: var(--rojo); color: #fff; border: 0; font-weight: 700; }
@media (max-width: 400px) { .nav-waze { display: none; } }
.nav-centrar { position: absolute; z-index: 640; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 92px);
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; border: 0;
  background: #fff; color: #1a73e8; font: 700 14px var(--letra); box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
.nav-centrar .ico { width: 16px; height: 16px; }
body.siguiendo .nav-centrar { bottom: 200px; }
/* Brújula: solo en la navegación y en la vista de conductor de Seguir */
.mapa-botones .brujula { display: none; }
body.navegando .mapa-botones .brujula { display: flex; }
body.navegando.nav-arriba .mapa-botones .brujula { display: none; }
/* Seguir: botón de vista (conductor / desde arriba) junto a Salir */
.seguir-acciones { display: flex; flex-direction: column; gap: 6px; align-items: stretch; flex: none; }
.seguir-acciones .boton.peq { padding: 6px 8px; font-size: 12.5px; min-height: 38px; }
.seguir-barra { gap: 10px; padding: 10px 10px 10px 12px; }
.seguir-vista { display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; }
.seguir-vista .ico { width: 15px; height: 15px; }
.botones-sitio { display: flex; gap: 8px; margin-top: 8px; }
.botones-sitio .boton { flex: 1; white-space: nowrap; margin: 0; }
.botones-sitio .boton-ir { flex: 0 0 84px; }
.menu-copiar .boton-ir { margin-top: 4px; }

/* =========================================================
   2.0 (Carlos 2026-10-31): HISTORIAL. Barra de tiempo protagonista, panel desplegable (bajo, medio, alto)
   y opciones en filas: hora y barra · reproducción · día · acciones.
   ========================================================= */
.h-hoja { padding: 0 14px; overflow: hidden; max-height: calc(100% - env(safe-area-inset-top) - 76px); }
.h-hoja.animando { transition: height .22s ease-out; }
.h-agarre { touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
#h-asa { display: block; padding: 9px 0 5px; min-height: 0; cursor: grab; }
.h-cabeza { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.h-cuando { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.h-hora { font-size: 34px; font-weight: 800; letter-spacing: -.5px; line-height: 1; font-variant-numeric: tabular-nums; }
.h-fecha { font-size: 15px; font-weight: 700; color: var(--texto-suave); white-space: nowrap; letter-spacing: 0; }
.h-escala { font-size: var(--t-peq); color: var(--texto-suave); white-space: nowrap; padding: 0 0 3px; }
.h-info { font-size: 13.5px; color: var(--texto-suave); margin: 5px 0 4px; min-height: 1.35em; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-info.h-info-doble { white-space: normal; }
.h-info b { color: var(--morado); }
.h-barra { margin: 0 -14px; padding: 0 6px; background: rgba(0, 0, 0, .22); border-top: 1px solid var(--borde); border-bottom: 1px solid var(--borde); }
.h-claves { display: flex; flex-wrap: nowrap; justify-content: space-between; gap: 4px 6px; font-size: 11px; letter-spacing: -.1px; font-weight: 600; color: var(--texto-suave); padding: 7px 0 2px; }
.h-claves span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.h-claves i { display: inline-block; width: 12px; height: 10px; border-radius: 3px; font-style: normal; }
.h-claves .c-marcha { background: var(--morado); }
.h-claves .c-parada { background: var(--verde); }
.h-claves .c-sin { background: repeating-linear-gradient(135deg, #3a414d 0 2px, #1d222b 2px 5px); border: 1px solid #3a414d; }
.h-claves .c-pern { width: auto; height: auto; color: var(--ambar); font-size: 13px; line-height: 1; }
.h-claves .c-coinc { background: var(--rosa); height: 5px; }
body.h-comparando .h-claves .c-coinc, body.h-comparando .h-claves span:nth-child(5) { display: none; }
.h-controles { display: flex; align-items: flex-start; justify-content: space-between; margin-top: 8px; padding: 0 2px; }
.h-controles .boton-redondo, .h-acciones .boton-redondo { box-shadow: none; background: var(--superficie-2); width: 48px; height: 48px; }
.h-play { width: 60px !important; height: 60px !important; background: var(--acento) !important; color: #fff !important; }
.h-vel { font: 800 14px var(--letra); color: var(--acento) !important; }
#h-centrar.activo { color: var(--acento); }
#h-centrar:not(.activo) { background: var(--acento) !important; color: #fff; }
.h-mas-opciones { border-top: 1px solid var(--borde); margin-top: 10px; padding: 6px 0 calc(env(safe-area-inset-bottom) + 12px); }
.h-rotulo { font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--texto-suave); margin: 6px 2px 6px; }
.h-dias button { font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.h-dias .ico { width: 16px; height: 16px; }
.h-acciones { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.h-acciones .con-pie small { text-align: center; line-height: 1.15; }
.h-acciones a.boton-redondo { color: var(--texto); }
.h-acciones .activo { background: var(--acento) !important; color: #fff !important; }
.h-pista { font-size: var(--t-mini); color: var(--texto-suave); text-align: center; margin-top: 10px; }
#h-catastro.activo::before { content: none; }
body.letra-grande .h-hora { font-size: 38px; }
body.letra-grande .h-fecha { font-size: 16px; }#h-hoja > * { flex: none; }
#h-calendario { padding-bottom: calc(env(safe-area-inset-bottom) + 10px); }
.medida-safe { position: absolute; visibility: hidden; height: env(safe-area-inset-bottom); width: 0; }
