/* Flota: los mismos colores y la misma letra que la app de la casa (cámaras). Solo modo oscuro, como la casa. */

:root {
  color-scheme: dark;
  --fondo: #0c0e11;
  --superficie: #15181d;
  --superficie-2: #1c2026;
  --superficie-3: #262b33;
  --borde: rgba(255, 255, 255, 0.07);
  --borde-2: rgba(255, 255, 255, 0.12);
  --texto: #eef0f3;
  --texto-2: #9aa3ad;
  --texto-3: #7d858f;
  --verde: #32d74b;
  --ambar: #ffb340;
  --rojo: #ff5a4e;
  --azul: #5e9eff;
  --celeste: #64d2ff;
  --acento: #1f6feb;          /* fondo de los botones principales (texto blanco encima) */
  --acento-texto: #5e9eff;    /* texto e íconos de acento sobre fondo oscuro */
  --vidrio: rgba(255, 255, 255, 0.1);
  --panel: rgba(21, 24, 29, 0.94);
  --panel-solido: #15181d;
  --radio: 14px;
  --radio-grande: 20px;
  --sombra: 0 12px 32px rgba(0, 0, 0, 0.45);
  --ancho-panel: 400px;
  --alto-hoja: 55vh;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--fondo);
  color: var(--texto);
}
body {
  font-size: 15px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--acento-texto); }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 2px solid var(--acento-texto); outline-offset: 2px; }

/* ---------------------------------------------------------------- íconos */

.icono { display: inline-flex; flex: none; width: 20px; height: 20px; }
.icono svg { width: 100%; height: 100%; }
.icono.chico { width: 15px; height: 15px; color: var(--texto-3); }
.icono.grande { width: 44px; height: 44px; }
.icono.flecha { width: 16px; height: 16px; color: var(--texto-3); }

/* ---------------------------------------------------------------- mapa */

#mapa { position: fixed; inset: 0; background: #1a1d22; }
.maplibregl-map { font: 12px/1.4 -apple-system, BlinkMacSystemFont, system-ui, sans-serif; }
.maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { transition: bottom 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }

/* Vehículo en el mapa: círculo del color del estado, con el dibujo adentro y el nombre abajo. */
.marcador {
  --c: var(--azul);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.marcador[data-estado="movimiento"] { --c: var(--verde); }
.marcador[data-estado="sin-senal"] { --c: var(--ambar); }
.marcador[data-estado="alarma"] { --c: var(--rojo); }
.marcador[data-estado="sin-datos"], .marcador[data-estado="sin-equipo"] { --c: #8e959e; }
.marcador.seleccionado { z-index: 3; }
.marcador.reproduciendo { z-index: 4; cursor: default; }

.marcador-burbuja {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 2.5px solid #fff;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s;
}
.marcador-burbuja svg { width: 25px; height: 25px; }
.marcador.seleccionado .marcador-burbuja { transform: scale(1.18); box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.28), 0 4px 14px rgba(0, 0, 0, 0.5); }
.marcador.prueba .marcador-burbuja { border-style: dashed; opacity: 0.8; }

/* Onda para los que andan; más rápida y roja si hay alarma. */
.marcador[data-estado="movimiento"]:not(.reproduciendo) .marcador-burbuja::after,
.marcador[data-estado="alarma"] .marcador-burbuja::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 2px solid var(--c);
  border-radius: 50%;
  animation: onda 2.2s ease-out infinite;
  pointer-events: none;
}
.marcador[data-estado="alarma"] .marcador-burbuja::after { animation-duration: 1.1s; }
@keyframes onda {
  from { transform: scale(1); opacity: 0.85; }
  to { transform: scale(1.9); opacity: 0; }
}

/* Flechita del rumbo: gira alrededor del círculo. */
.marcador-rumbo { position: absolute; inset: -9px; pointer-events: none; }
.marcador-rumbo::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top: 0;
  border-bottom: 9px solid var(--c);
  filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, 0.7));
}

.marcador-nombre {
  position: absolute;
  top: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(12, 14, 17, 0.84);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.marcador-nombre b { color: var(--verde); font-variant-numeric: tabular-nums; }

.centro-zona {
  width: 24px;
  height: 24px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--azul);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  cursor: grab;
}
.centro-zona:active { cursor: grabbing; }

.extremo {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.extremo.inicio { background: #1f9d3a; }
.extremo.fin { background: #d93a30; }

.yo {
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #0a84ff;
  box-shadow: 0 0 0 7px rgba(10, 132, 255, 0.25), 0 1px 4px rgba(0, 0, 0, 0.4);
}

body.sin-conexion .marcador { filter: grayscale(0.85); opacity: 0.75; }

/* Botones flotantes del mapa. */
#controles-mapa {
  position: fixed;
  z-index: 5;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.grupo-controles {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--borde-2);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--sombra);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.control {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--texto);
}
.control:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.grupo-controles > * + * { border-top: 1px solid var(--borde); }
.grupo-controles > :first-child { border-radius: 11px 11px 0 0; }
.grupo-controles > :last-child, .grupo-controles > :last-child .control { border-radius: 0 0 11px 11px; }
.con-menu { position: relative; }
.menu-estilos {
  position: absolute;
  top: 0;
  right: calc(100% + 8px);
  display: flex;
  flex-direction: column;
  min-width: 128px;
  padding: 4px;
  border: 1px solid var(--borde-2);
  border-radius: 12px;
  background: var(--superficie-2);
  box-shadow: var(--sombra);
}
.menu-estilos button {
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  font-size: 15px;
}
.menu-estilos button:hover { background: rgba(255, 255, 255, 0.05); }
.menu-estilos button[aria-pressed="true"] { background: var(--vidrio); font-weight: 600; }

/* ---------------------------------------------------------------- panel */

#panel {
  position: fixed;
  z-index: 10;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--borde);
  background: var(--panel);
  box-shadow: var(--sombra);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  backdrop-filter: blur(24px) saturate(1.3);
}

#asa { flex: none; touch-action: none; }
.agarradera { display: none; }

.cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
}
.cabecera h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }

.resumen {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 72%;
  padding: 6px 12px;
  border: 1px solid var(--borde);
  border-radius: 999px;
  background: var(--superficie);
  font-size: 13.5px;
  font-weight: 500;
}
.resumen #resumen { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.punto {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--texto-3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}
.punto[data-nivel="ok"] { background: var(--verde); }
.punto[data-nivel="alerta"] { background: var(--ambar); }
.punto[data-nivel="error"] { background: var(--rojo); }

#pestanas { display: flex; flex: none; }
.pestana {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 7px 2px 6px;
  border: 0;
  background: none;
  color: var(--texto-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.pestana .icono { width: 24px; height: 24px; }
.pestana span:last-child { overflow: hidden; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; }
.pestana[aria-current="true"] { color: var(--acento-texto); }

#avisos { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 0 16px 10px; }
#avisos:empty { display: none; }

#contenido {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 16px 24px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

/* Compu: columna a la izquierda, con las pestañas arriba. */
@media (min-width: 900px) {
  #panel {
    top: 12px;
    bottom: 12px;
    left: 12px;
    width: var(--ancho-panel);
    border-radius: var(--radio-grande);
  }
  #pestanas { gap: 4px; margin: 0 0 12px; padding: 0 12px 12px; border-bottom: 1px solid var(--borde); }
  .pestana { border-radius: 10px; }
  .pestana:hover { background: rgba(255, 255, 255, 0.05); color: var(--texto-2); }
  .pestana[aria-current="true"] { background: var(--vidrio); color: var(--texto); }
  .pestana[aria-current="true"] .icono { color: var(--acento-texto); }
}

/* Celular: hoja que se arrastra desde abajo, con las pestañas al pie. */
@media (max-width: 899px) {
  #panel {
    right: 0;
    bottom: 0;
    left: 0;
    height: 55vh;
    height: 55dvh;
    border-width: 1px 0 0;
    border-radius: var(--radio-grande) var(--radio-grande) 0 0;
    transition: height 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  #panel[data-altura="baja"] { height: 30vh; height: 30dvh; }
  #panel[data-altura="alta"] { height: calc(100vh - 40px); height: calc(100dvh - 40px); }
  #panel.arrastrando { transition: none; }
  #asa { cursor: grab; user-select: none; -webkit-user-select: none; }
  .agarradera {
    display: block;
    width: 100%;
    height: 18px;
    padding: 0;
    border: 0;
    background: none;
  }
  .agarradera::before {
    content: "";
    display: block;
    width: 38px;
    height: 5px;
    margin: 8px auto 0;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.28);
  }
  .cabecera { padding: 2px 16px 10px; }
  .cabecera h1 { font-size: 22px; }
  .resumen { padding: 5px 11px; font-size: 13px; }
  #pestanas {
    order: 9;
    padding: 2px 4px calc(env(safe-area-inset-bottom) + 2px);
    border-top: 1px solid var(--borde);
    background: rgba(12, 14, 17, 0.55);
  }
  #contenido { padding-bottom: 16px; }
  #controles-mapa { top: calc(env(safe-area-inset-top) + 10px); right: 10px; }
  .grupo-controles.zoom { display: none; }                 /* en el celular se acerca con los dedos */
  .maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: var(--alto-hoja); }
  body[data-hoja="alta"] .maplibregl-ctrl-bottom-right { visibility: hidden; }
  body.con-reproductor .maplibregl-ctrl-bottom-right { bottom: calc(var(--alto-hoja) + 84px); }
}

/* ---------------------------------------------------------------- textos y piezas sueltas */

.subtitulo {
  margin: 22px 2px 8px;
  color: var(--texto-2);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.texto-ayuda { color: var(--texto-2); font-size: 14.5px; line-height: 1.45; }
.subtexto { margin-top: 2px; color: var(--texto-2); font-size: 14px; }
.nota { color: var(--texto-3); font-size: 13px; line-height: 1.45; }
.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0; }
.cargando { padding: 28px 12px; color: var(--texto-3); text-align: center; }

.vacio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 12px;
  color: var(--texto-3);
  font-size: 14.5px;
  text-align: center;
}
.vacio p { color: var(--texto-2); font-size: 15.5px; font-weight: 600; }
.vacio small { max-width: 280px; font-size: 13.5px; line-height: 1.4; }
.vacio .icono.grande { margin-bottom: 4px; color: var(--texto-3); opacity: 0.7; }
.vacio.error { color: var(--rojo); }

.etiqueta {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--vidrio);
  color: var(--texto-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.etiqueta.verde { background: rgba(50, 215, 75, 0.15); color: #7ee695; }
.etiqueta.ambar { background: rgba(255, 179, 64, 0.15); color: #ffd28a; }
.etiqueta.apagada { opacity: 0.65; }
.etiqueta-suave {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--vidrio);
  color: var(--texto-2);
  font-size: 12px;
  font-weight: 600;
}

.aviso-sistema {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
}
.aviso-sistema .icono { margin-top: 0; }
.aviso-sistema[data-nivel="alerta"] { border-color: rgba(255, 179, 64, 0.3); background: rgba(255, 179, 64, 0.11); color: #ffd99e; }
.aviso-sistema[data-nivel="error"] { border-color: rgba(255, 90, 78, 0.35); background: rgba(255, 90, 78, 0.12); color: #ffb8b2; }
.aviso-sistema[data-nivel="info"] { border-color: rgba(94, 158, 255, 0.28); background: rgba(94, 158, 255, 0.1); color: #c4dafe; }
#contenido .aviso-sistema { margin: 4px 0 10px; }

.advertencia {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 179, 64, 0.3);
  border-radius: 12px;
  background: rgba(255, 179, 64, 0.1);
  color: #ffd99e;
  font-size: 14px;
  line-height: 1.45;
}
.advertencia .icono { color: var(--ambar); }

/* ---------------------------------------------------------------- botones */

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--borde-2);
  border-radius: 12px;
  background: var(--superficie-2);
  color: var(--texto);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
}
.boton:hover { background: var(--superficie-3); }
.boton:active { transform: scale(0.98); }
.boton:disabled { opacity: 0.5; transform: none; }
.boton .icono { width: 18px; height: 18px; }
.boton.primario { border-color: transparent; background: var(--acento); color: #fff; }
.boton.primario:hover { background: #2a7af5; }
.boton.peligro, .boton.primario.peligro { border-color: transparent; background: #d93a30; color: #fff; }
.boton.peligro:hover { background: #e6463b; }
.boton.peligro-suave { border-color: rgba(255, 90, 78, 0.3); background: rgba(255, 90, 78, 0.1); color: #ff8a80; }
.boton.peligro-suave:hover { background: rgba(255, 90, 78, 0.18); }
.boton.chico { min-height: 34px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
.boton.chico .icono { width: 16px; height: 16px; }
.boton.ancho { width: 100%; }

.botones { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.botones > .boton { flex: 1 1 0; }
.botones.entre { justify-content: space-between; }
.botones-chicos { display: flex; flex-wrap: wrap; gap: 6px; }

.boton-icono {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--borde-2);
  border-radius: 50%;
  background: var(--superficie-2);
}
.boton-icono:hover { background: var(--superficie-3); }
.boton-icono:disabled { opacity: 0.35; }

.boton-volver {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: -8px;
  padding: 8px 10px 8px 2px;
  border: 0;
  background: none;
  color: var(--acento-texto);
  font-size: 16px;
  font-weight: 500;
}
.boton-volver .icono { width: 22px; height: 22px; }

.boton-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--borde-2);
  border-radius: 999px;
  background: var(--superficie-2);
  font-size: 14px;
  font-weight: 600;
}
.boton-chip .icono { width: 16px; height: 16px; }
.boton-chip[aria-pressed="true"] { border-color: transparent; background: var(--acento); color: #fff; }

.enlace-boton {
  align-self: flex-start;
  padding: 10px 2px;
  border: 0;
  background: none;
  color: var(--acento-texto);
  font-size: 15px;
  font-weight: 500;
}

.chips {
  display: flex;
  gap: 8px;
  margin: 2px -16px 10px;
  padding: 2px 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px 0 8px;
  border: 1px solid var(--borde-2);
  border-radius: 999px;
  background: var(--superficie);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.chip:hover { background: var(--superficie-2); }
.chip[aria-selected="true"] { border-color: transparent; background: var(--texto); color: var(--fondo); }
.chip-dibujo { display: grid; place-items: center; width: 24px; height: 24px; }
.chip-dibujo svg { width: 24px; height: 24px; }

/* ---------------------------------------------------------------- formularios */

.formulario { display: flex; flex-direction: column; gap: 16px; }

.etiqueta-campo {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--texto-2);
  font-size: 13px;
  font-weight: 600;
}
.etiqueta-campo > small { color: var(--texto-3); font-size: 12.5px; font-weight: 400; line-height: 1.4; }
.etiqueta-campo > small[data-ok="true"] { color: #7ee695; }
.etiqueta-campo > .casilla { font-weight: 400; }

.campo {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--borde-2);
  border-radius: 11px;
  background: var(--fondo);
  color: var(--texto);
  font-size: 16px;                       /* 16 px: el iPhone no hace zoom al tocar el campo */
  font-weight: 400;
}
.campo::placeholder { color: var(--texto-3); }
.campo:focus { border-color: transparent; outline: 2px solid var(--acento-texto); outline-offset: 0; }
.campo.chico { width: auto; min-height: 36px; padding: 6px 10px; border-radius: 9px; }
select.campo {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa3ad' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 18px;
}
input[type="time"].campo { min-width: 104px; }
select.campo.chico { padding-right: 30px; background-position: right 8px center; background-size: 16px; }

.fila-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fila-campos > :first-child { grid-column: 1 / -1; }
.fila-entre { display: flex; align-items: baseline; justify-content: space-between; }
.fila-entre b { color: var(--texto); font-size: 15px; }

.casilla {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--texto);
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
}
.casilla input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--acento); }
.casilla span { display: flex; flex-direction: column; gap: 2px; }
.casilla small { color: var(--texto-3); font-size: 13px; line-height: 1.4; }

.segmentado {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--borde);
  border-radius: 12px;
  background: var(--fondo);
}
.segmentado button {
  flex: 1 0 auto;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--texto-2);
  font-size: 14px;
  font-weight: 500;
}
.segmentado button:hover { color: var(--texto); }
.segmentado button[aria-checked="true"] {
  background: var(--superficie-3);
  color: var(--texto);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.18); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -9px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.18); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--acento-texto); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; }

/* Interruptor como el del iPhone. */
.interruptor {
  position: relative;
  flex: none;
  width: 51px;
  height: 31px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.36);
  transition: background 0.2s;
}
.interruptor span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.interruptor[aria-checked="true"] { background: var(--verde); }
.interruptor[aria-checked="true"] span { transform: translateX(20px); }
.interruptor:disabled { opacity: 0.6; }

/* ---------------------------------------------------------------- tarjetas de vehículo */

.grupo-tarjetas { display: flex; flex-direction: column; gap: 8px; }
.vista-vivo > .grupo-tarjetas:first-of-type { margin-top: 4px; }

.tarjeta {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  background: var(--superficie);
  text-align: left;
  transition: background 0.15s, transform 0.1s;
}
.tarjeta:hover { background: var(--superficie-2); }
.tarjeta:active { transform: scale(0.99); }
.tarjeta[data-estado="alarma"] { border-color: rgba(255, 90, 78, 0.45); background: linear-gradient(rgba(255, 90, 78, 0.1), rgba(255, 90, 78, 0.05)), var(--superficie); }
.tarjeta-texto { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.tarjeta-titulo { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 16px; }
.tarjeta-titulo b { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.tarjeta-estado { color: var(--texto-2); font-size: 14px; }
.tarjeta[data-estado="movimiento"] .tarjeta-estado { color: #7ee695; }
.tarjeta[data-estado="alarma"] .tarjeta-estado { color: #ff8a80; font-weight: 600; }
.tarjeta[data-estado="sin-senal"] .tarjeta-estado { color: #ffd28a; }
.tarjeta-lugar { overflow: hidden; color: var(--texto-3); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.velocidad { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; }
.velocidad b { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.velocidad small { margin-top: 2px; color: var(--texto-3); font-size: 11px; font-weight: 600; }
.accion-tarjeta {
  flex: none;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(94, 158, 255, 0.14);
  color: var(--acento-texto);
  font-size: 13px;
  font-weight: 700;
}

.avatar {
  --c: var(--azul);
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--c) 17%, transparent);
  color: var(--c);
}
.avatar svg { width: 30px; height: 30px; }
.avatar[data-estado="movimiento"] { --c: var(--verde); }
.avatar[data-estado="sin-senal"] { --c: var(--ambar); }
.avatar[data-estado="alarma"] { --c: var(--rojo); }
.avatar[data-estado="sin-datos"], .avatar[data-estado="sin-equipo"] { --c: #8e959e; }
.avatar.grande { width: 58px; height: 58px; }
.avatar.grande svg { width: 40px; height: 40px; }
.avatar.chico { width: 32px; height: 32px; }
.avatar.chico svg { width: 23px; height: 23px; }

details.plegable { margin-top: 20px; }
details.plegable > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  color: var(--texto-2);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}
details.plegable[open] > summary { margin-bottom: 8px; }
summary::-webkit-details-marker { display: none; }
details > summary::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin: -3px 4px 0 auto;
  border-right: 2px solid var(--texto-3);
  border-bottom: 2px solid var(--texto-3);
  transform: rotate(45deg);
  transition: transform 0.2s;
}
details[open] > summary::after { margin-top: 3px; transform: rotate(-135deg); }
details.plegable > summary::after { margin-left: 0; }

/* ---------------------------------------------------------------- ficha del vehículo */

.detalle-barra { display: flex; align-items: center; justify-content: space-between; min-height: 40px; margin: 0 0 8px; }
.detalle-cabecera { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.detalle-cabecera h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }

.cifra-grande {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin-bottom: 12px;
  padding: 16px 18px;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  background: var(--superficie);
}
.cifra-grande b { font-size: 54px; font-weight: 700; letter-spacing: -0.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.cifra-grande span { color: var(--texto-2); font-size: 18px; font-weight: 600; }
.cifra-grande small { flex-basis: 100%; margin-top: 4px; color: var(--texto-2); font-size: 15px; }
.cifra-grande.texto b { font-size: 28px; letter-spacing: -0.015em; }

.datos {
  margin: 0 0 14px;
  overflow: hidden;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  background: var(--superficie);
}
.dato { display: grid; grid-template-columns: 22px 1fr; align-items: start; column-gap: 12px; padding: 11px 14px; }
.dato + .dato { border-top: 1px solid var(--borde); }
.dato .icono { grid-row: span 2; margin-top: 1px; color: var(--texto-3); }
.dato dt { color: var(--texto-3); font-size: 12.5px; }
.dato dd { margin: 1px 0 0; font-size: 15px; }

.acciones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.acciones:has(> :nth-child(4)) { grid-template-columns: repeat(2, 1fr); }
.accion {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 78px;
  padding: 12px 8px;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  background: var(--superficie);
  color: var(--texto);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s;
}
.accion:hover { background: var(--superficie-2); }
.accion .icono { width: 24px; height: 24px; color: var(--acento-texto); }
.accion.peligro .icono { color: var(--rojo); }
.accion:disabled, .accion[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

/* ---------------------------------------------------------------- recorridos */

.navegador-fecha { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.fecha-actual {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 5px 10px;
  border: 1px solid var(--borde);
  border-radius: 12px;
  background: var(--superficie);
  cursor: pointer;
}
.fecha-actual span { font-size: 16px; font-weight: 600; }
.fecha-actual small { color: var(--texto-3); font-size: 12.5px; }
.fecha-actual small:empty { display: none; }
.selector-fecha {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}
.selector-fecha::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }

.resumen-dia { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
.cifra {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--borde);
  border-radius: 12px;
  background: var(--superficie);
}
.cifra small { color: var(--texto-3); font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.cifra b { overflow: hidden; font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.cifra b span { color: var(--texto-2); font-size: 13px; font-weight: 600; }

.leyenda { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 2px 2px 4px; color: var(--texto-2); font-size: 12.5px; }
.leyenda-titulo { color: var(--texto-3); font-weight: 700; }
.leyenda-item { display: inline-flex; align-items: center; gap: 5px; }
.leyenda-item i { display: inline-block; width: 16px; height: 4px; border-radius: 2px; }
.leyenda-item i.hueco { background: repeating-linear-gradient(90deg, var(--texto-2) 0 3px, transparent 3px 6px); }

.linea-tiempo { position: relative; margin: 10px 0 0; padding: 0; list-style: none; }
.linea-tiempo::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 15px;
  width: 2px;
  border-radius: 1px;
  background: var(--borde-2);
}
.linea-tiempo > li > button {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 8px 8px 8px 0;
  border: 0;
  border-radius: 12px;
  background: none;
  text-align: left;
  transition: background 0.3s;
}
.linea-tiempo > li > button:hover { background: rgba(255, 255, 255, 0.04); }
.linea-tiempo > li.resaltado > button { background: rgba(255, 179, 64, 0.16); }
.linea-tiempo > li.vacio { padding-left: 40px; text-align: left; }
.marca { position: relative; z-index: 1; display: grid; flex: none; place-items: center; width: 32px; padding-top: 3px; }
.item-viaje .marca::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--verde);
  box-shadow: 0 0 0 4px var(--panel-solido);
}
.item-parada .marca .icono {
  width: 22px;
  height: 22px;
  padding: 5px;
  border-radius: 50%;
  background: var(--ambar);
  color: #2a1a00;
  box-shadow: 0 0 0 4px var(--panel-solido);
}
.item-evento .marca::before {
  content: "";
  width: 9px;
  height: 9px;
  margin-top: 3px;
  border-radius: 50%;
  background: var(--texto-2);
  box-shadow: 0 0 0 4px var(--panel-solido);
}
.item-evento[data-tipo="alarm"] .marca::before { background: var(--rojo); }
.item-evento[data-tipo="deviceOverspeed"] .marca::before { background: var(--ambar); }
.item-evento[data-tipo="geofenceEnter"] .marca::before, .item-evento[data-tipo="geofenceExit"] .marca::before { background: var(--azul); }
.linea-tiempo .item-texto { display: flex; flex-direction: column; gap: 3px; min-width: 0; color: var(--texto-2); font-size: 14px; }
.linea-tiempo .item-texto b { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--texto); font-size: 15px; font-weight: 600; }
.item-evento .item-texto { padding-top: 1px; font-size: 13.5px; }
.item-evento .item-texto b { display: inline; font-size: 13.5px; }
.de-a { display: flex; flex-wrap: wrap; gap: 2px 6px; color: var(--texto-3); font-size: 13px; }
.flechita { color: var(--texto-3); }
.lugar { color: var(--texto-3); font-size: 13px; }

/* Día, semana o mes. Mientras llega lo nuevo, lo anterior queda a media luz (sin saltos). */
.modos-recorrido { margin: 0 0 10px; }
.cuerpo-recorrido { transition: opacity 0.2s; }
.cuerpo-recorrido.recargando { opacity: 0.45; pointer-events: none; }

/* Las paradas cortas de un viaje (de 5 a 30 minutos), debajo del viaje. */
.paradas-cortas { margin: -4px 0 6px; padding: 0 0 0 42px; list-style: none; }
.paradas-cortas > li > button {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  padding: 5px 8px 5px 0;
  border: 0;
  border-radius: 10px;
  background: none;
  text-align: left;
  transition: background 0.3s;
}
.paradas-cortas > li > button:hover { background: rgba(255, 255, 255, 0.04); }
.paradas-cortas > li.resaltado > button { background: rgba(255, 179, 64, 0.16); }
.punto-corta { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--ambar); }
.linea-tiempo .paradas-cortas .item-texto { font-size: 13px; }
.linea-tiempo .paradas-cortas .item-texto b { font-size: 14px; }

/* Semana y mes: los totales, los km de cada día y la lista de días. */
.cuenta-periodo { margin: -2px 2px 12px; color: var(--texto-2); font-size: 13.5px; }
.grafico-dias {
  --alto-pista: 120px;
  margin: 0 0 12px;
  padding: 12px 12px 4px;
  border: 1px solid var(--borde);
  border-radius: 12px;
  background: var(--superficie);
}
.grafico-dias figcaption { margin-bottom: 12px; color: var(--texto-2); font-size: 13px; font-weight: 600; }
.grafico-area { position: relative; margin-left: 34px; }
.grafico-lineas { position: absolute; top: 0; right: 0; left: 0; height: var(--alto-pista); pointer-events: none; }
.grafico-linea { position: absolute; right: 0; left: 0; height: 1px; background: var(--superficie-3); }
.grafico-linea span {
  position: absolute;
  right: calc(100% + 6px);
  bottom: -6px;
  color: var(--texto-3);
  font-size: 11px;
  line-height: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.grafico-columnas { position: relative; display: grid; }
.grafico-columna {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
}
.grafico-pista { display: flex; align-items: flex-end; justify-content: center; height: var(--alto-pista); }
.grafico-barra {
  position: relative;
  width: min(24px, 70%);
  border-radius: 4px 4px 0 0;          /* redonda en la punta, recta sobre la base */
  background: #4a8ff5;                 /* el azul de la app, un paso más oscuro: validado sobre --superficie */
  transition: background 0.15s;
}
button.grafico-columna:hover { background: rgba(255, 255, 255, 0.03); }
button.grafico-columna:hover .grafico-barra, button.grafico-columna:focus-visible .grafico-barra { background: #6aa5ff; }
.grafico-valor {
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  color: var(--texto);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}
.grafico-x {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 24px;
  padding: 5px 0 4px;
  color: var(--texto-3);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}
.grafico-x b { color: var(--texto-2); font-weight: 600; }
.grafico-columna.futuro .grafico-x { opacity: 0.45; }
.grafico-globo {
  position: absolute;
  top: -8px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 10px;
  border: 1px solid var(--borde-2);
  border-radius: 10px;
  background: var(--superficie-3);
  box-shadow: var(--sombra);
  font-size: 12px;
  white-space: nowrap;
  transform: translateY(-100%);
  pointer-events: none;
}
.grafico-globo b { color: var(--texto); font-size: 14px; }
.grafico-globo span { color: var(--texto-2); }

.lista-dias { margin: 0; padding: 0; list-style: none; }
.lista-dias > li + li { border-top: 1px solid var(--borde); }
.lista-dias button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 6px;
  border: 0;
  border-radius: 10px;
  background: none;
  text-align: left;
}
.lista-dias button:hover { background: rgba(255, 255, 255, 0.04); }
.dia-texto { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.dia-texto b { font-size: 15px; font-weight: 600; }
.dia-texto small { color: var(--texto-3); font-size: 13px; }
.lista-dias button[data-quieto] .dia-texto b { color: var(--texto-2); font-weight: 500; }
.dia-km { flex: none; color: var(--texto-3); font-variant-numeric: tabular-nums; }
.dia-km b { color: var(--texto); font-size: 16px; font-weight: 700; }
.dia-km b span { color: var(--texto-2); font-size: 12.5px; font-weight: 600; }
.nota-dias { margin: 8px 6px 0; color: var(--texto-3); font-size: 13px; }

/* Vehículos: quién entró (por el portero), su Cuenta y Salir. */
.cuenta-flota { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--borde); }
.cuenta-flota .texto-ayuda { margin-bottom: 10px; overflow-wrap: anywhere; }
.cuenta-botones { display: flex; flex-wrap: wrap; gap: 8px; }
.caja-tema { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--borde-2); border-radius: 11px; background: var(--fondo); }
.caja-tema b { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* Barra de reproducción: flota sobre el mapa. */
#reproductor {
  position: fixed;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--borde-2);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--sombra);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
@media (min-width: 900px) {
  #reproductor { right: 84px; bottom: 44px; left: calc(var(--ancho-panel) + 36px); max-width: 680px; margin: 0 auto; }
}
@media (max-width: 899px) {
  #reproductor { right: 10px; bottom: calc(var(--alto-hoja) + 10px); left: 10px; transition: bottom 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }
  body[data-hoja="alta"] #reproductor { visibility: hidden; }
}
.boton-play {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--acento);
  color: #fff;
}
.boton-play .icono { width: 20px; height: 20px; }
.repro-centro { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.repro-textos { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.repro-hora { font-size: 15px; font-variant-numeric: tabular-nums; }
.repro-vel { color: var(--texto-2); font-size: 13px; }
.boton-mult {
  flex: none;
  min-width: 56px;
  height: 34px;
  border: 1px solid var(--borde-2);
  border-radius: 999px;
  background: var(--superficie-2);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- alertas */

.seccion + .seccion { margin-top: 8px; }
.seccion > .subtitulo:first-child { margin-top: 10px; }

.fila-pausa {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  background: var(--superficie);
}
.fila-pausa > .icono { color: var(--texto-2); }
.fila-pausa > span:not(.icono) { display: flex; flex: 1; flex-direction: column; min-width: 110px; }
.fila-pausa small { color: var(--texto-2); font-size: 13px; }

details.tarjeta-reglas {
  margin-bottom: 8px;
  overflow: hidden;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  background: var(--superficie);
}
details.tarjeta-reglas > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  font-size: 16px;
  cursor: pointer;
  list-style: none;
}
details.tarjeta-reglas > summary b { font-weight: 600; }
.fila-regla { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--borde); }
.fila-regla > .icono { align-self: flex-start; margin-top: 2px; color: var(--texto-2); }
.regla-texto { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.regla-texto b { font-size: 15px; font-weight: 600; }
.regla-texto small { color: var(--texto-3); font-size: 13px; line-height: 1.35; }
.regla-texto > select, .regla-texto > .horario { align-self: flex-start; margin-top: 8px; }
.horario { display: flex; align-items: center; gap: 8px; color: var(--texto-2); font-size: 14px; }
.pausar-uno { flex-wrap: wrap; }

.grupo-historial .dia { margin: 16px 2px 6px; color: var(--texto-2); font-size: 14px; font-weight: 600; }
.item-alerta {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--borde);
  border-radius: 0;
  background: var(--superficie);
  text-align: left;
}
.item-alerta + .item-alerta { border-top: 0; }
.item-alerta:first-of-type { border-radius: var(--radio) var(--radio) 0 0; }
.item-alerta:last-of-type { border-radius: 0 0 var(--radio) var(--radio); }
.item-alerta:only-of-type { border-radius: var(--radio); }
.item-alerta:not(:disabled):hover { background: var(--superficie-2); }
.item-alerta:disabled { cursor: default; }
.item-alerta > .icono { margin-top: 1px; color: var(--texto-2); }
.item-alerta[data-prioridad="5"] > .icono { color: var(--rojo); }
.item-alerta[data-prioridad="4"] > .icono { color: var(--ambar); }
.item-alerta .item-texto { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; }
.item-alerta .item-texto b { font-size: 15px; font-weight: 600; }
.item-alerta .item-texto span { color: var(--texto-2); }
.item-alerta .item-texto small { color: var(--texto-3); font-size: 12.5px; }
.item-alerta[data-enviado="false"] .item-texto small { color: #ffd28a; }
.item-alerta time { flex: none; color: var(--texto-3); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- zonas y vehículos */

.encabezado-seccion { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 16px; }
.encabezado-seccion .boton { align-self: flex-start; }

.lista-zonas { display: flex; flex-direction: column; gap: 8px; }
.fila-zona {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  background: var(--superficie);
  text-align: left;
}
.fila-zona:hover { background: var(--superficie-2); }
.color-zona { flex: none; width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.07); }
.item-texto { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.fila-zona .item-texto b { overflow: hidden; font-size: 16px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.fila-zona .item-texto small { color: var(--texto-3); font-size: 13px; }
.avisos-zona { display: flex; flex: none; gap: 4px; }

.edicion-zona h2, .formulario > h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.edicion-zona .detalle-barra { margin-bottom: -8px; }
.atajos { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.atajos small { width: 100%; color: var(--texto-3); font-size: 13px; }
.atajos .chip { height: 34px; }

.caja-equipo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  background: var(--superficie);
}
.caja-equipo > .icono { color: var(--texto-2); }
.caja-equipo > div { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.caja-equipo small { overflow: hidden; color: var(--texto-3); font-size: 13px; text-overflow: ellipsis; }
.caja-equipo.pendiente { border-color: rgba(255, 179, 64, 0.35); background: rgba(255, 179, 64, 0.08); }
.caja-equipo.pendiente > .icono { color: var(--ambar); }
.caja-equipo .boton { flex: none; }

/* Asistente para instalar un equipo. */
.asistente { display: flex; flex-direction: column; gap: 4px; }
.pasos { display: flex; margin: 0 0 18px; padding: 0; list-style: none; }
.pasos li {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--texto-3);
  font-size: 12px;
  font-weight: 600;
}
.pasos li span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--superficie-3);
  color: var(--texto-2);
  font-size: 13px;
  font-weight: 700;
}
.pasos li + li::before {
  content: "";
  position: absolute;
  top: 13px;
  right: 50%;
  left: -50%;
  height: 2px;
  background: var(--borde-2);
}
.pasos li[data-estado="actual"] { color: var(--texto); }
.pasos li[data-estado="actual"] span { background: var(--acento); color: #fff; }
.pasos li[data-estado="hecho"] span { background: rgba(50, 215, 75, 0.18); color: var(--verde); }
.pasos li[data-estado="hecho"]::before, .pasos li[data-estado="actual"]::before { background: rgba(50, 215, 75, 0.45); }
.paso { display: flex; flex-direction: column; gap: 14px; min-height: 140px; }
.asistente .botones { margin-top: 18px; }

.lista-modelos { display: flex; flex-direction: column; gap: 8px; }
.modelo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--borde-2);
  border-radius: var(--radio);
  background: var(--fondo);
  text-align: left;
}
.modelo:hover { background: var(--superficie-2); }
.modelo[aria-pressed="true"] { border-color: var(--acento-texto); background: rgba(94, 158, 255, 0.09); box-shadow: inset 0 0 0 1px var(--acento-texto); }
.modelo-titulo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 15.5px; }
.modelo small { color: var(--texto-2); font-size: 13px; }
.notas { margin: 6px 0 0; padding-left: 18px; color: var(--texto-2); font-size: 13.5px; line-height: 1.45; }
.notas li + li { margin-top: 3px; }

.instrucciones { margin: 0; padding-left: 20px; color: var(--texto-2); line-height: 1.6; }
.instrucciones b { color: var(--texto); }

.lista-sms { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: sms; }
.sms {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 14px 12px 48px;
  border: 1px solid var(--borde-2);
  border-radius: var(--radio);
  background: var(--fondo);
  counter-increment: sms;
}
.sms::before {
  content: counter(sms);
  position: absolute;
  top: 11px;
  left: 13px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--superficie-3);
  color: var(--texto-2);
  font-size: 13px;
  font-weight: 700;
}
.sms-titulo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sms-texto {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--superficie-2);
  color: var(--texto);
  font-family: var(--mono);
  font-size: 14px;
  white-space: pre-wrap;              /* los de Teltonika empiezan con dos espacios: tienen que verse */
  word-break: break-all;
  -webkit-user-select: all;
  user-select: all;
}
.sms > small { color: var(--texto-3); font-size: 13px; line-height: 1.4; }

/* Compartir y motor. */
.texto-modal { color: var(--texto-2); font-size: 15px; line-height: 1.45; }
.resultado-compartir {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(50, 215, 75, 0.25);
  border-radius: var(--radio);
  background: rgba(50, 215, 75, 0.07);
}
.resultado-compartir .botones { margin-top: 0; }
.enlace { color: var(--texto); font-family: var(--mono); font-size: 13.5px; word-break: break-all; -webkit-user-select: all; user-select: all; }
.lista-compartidos:empty { display: none; }
.lista-compartidos .subtitulo { margin-top: 4px; }
.fila-compartido { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--borde); }
.fila-compartido > div { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.fila-compartido small { color: var(--texto-3); font-size: 13px; }

.opciones-corte { display: flex; flex-direction: column; gap: 8px; }
.opcion {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--borde-2);
  border-radius: var(--radio);
  background: var(--fondo);
  cursor: pointer;
}
.opcion:has(input:checked) { border-color: var(--acento-texto); background: rgba(94, 158, 255, 0.08); }
.opcion input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--acento); }
.opcion span { display: flex; flex-direction: column; gap: 2px; }
.opcion small { color: var(--texto-3); font-size: 13px; line-height: 1.4; }
.opcion[data-deshabilitada="true"] { opacity: 0.55; cursor: not-allowed; }
.separador { width: 100%; margin: 4px 0; border: 0; border-top: 1px solid var(--borde-2); }

/* ---------------------------------------------------------------- ventanas, avisos flotantes y sesión */

#modal-capa {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  animation: aparecer 0.18s ease-out;
}
.modal {
  display: flex;
  flex-direction: column;
  width: min(460px, 100%);
  max-height: min(88vh, 780px);
  max-height: min(88dvh, 780px);
  overflow: hidden;
  border: 1px solid var(--borde-2);
  border-radius: var(--radio-grande);
  background: var(--superficie);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  animation: subir 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal[data-ancho="grande"] { width: min(600px, 100%); }
.modal-cabecera { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 14px 10px 20px; }
.modal-cabecera h2 { font-size: 18px; font-weight: 700; line-height: 1.25; }
.modal-cabecera .boton-icono { width: 32px; height: 32px; border: 0; background: var(--vidrio); }
.modal-cabecera .boton-icono .icono { width: 16px; height: 16px; }
.modal-cuerpo { padding: 6px 20px 22px; overflow-y: auto; overscroll-behavior: contain; }
.modal-cuerpo .formulario { gap: 14px; }
@media (max-width: 899px) {
  #modal-capa { align-items: flex-end; padding: 0; }
  .modal, .modal[data-ancho="grande"] {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-width: 1px 0 0;
    border-radius: var(--radio-grande) var(--radio-grande) 0 0;
    animation-name: subir-hoja;
  }
  .modal-cuerpo { padding-bottom: calc(env(safe-area-inset-bottom) + 22px); }
}
@keyframes aparecer { from { opacity: 0; } }
@keyframes subir { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
@keyframes subir-hoja { from { transform: translateY(100%); } }

#tostadas {
  position: fixed;
  z-index: 60;
  top: calc(env(safe-area-inset-top) + 12px);
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(440px, calc(100% - 24px));
  transform: translateX(-50%);
  pointer-events: none;
}
.tostada {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border: 1px solid var(--borde-2);
  border-radius: 14px;
  background: rgba(38, 43, 51, 0.97);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 15px;
  line-height: 1.35;
  pointer-events: auto;
  animation: bajar 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: opacity 0.3s, transform 0.3s;
}
.tostada > .icono { color: var(--verde); }
.tostada[data-nivel="error"] { border-color: rgba(255, 90, 78, 0.4); }
.tostada[data-nivel="error"] > .icono { color: var(--rojo); }
.tostada.saliendo { opacity: 0; transform: translateY(-8px); }
@keyframes bajar { from { opacity: 0; transform: translateY(-12px); } }

#sesion {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 14, 17, 0.88);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.sesion-caja { display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(340px, 100%); text-align: center; }
.sesion-icono { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 4px; border-radius: 50%; background: var(--superficie-2); color: var(--texto-2); }
.sesion-icono svg { width: 30px; height: 30px; }
.sesion-caja h1, .sesion-caja h2 { font-size: 22px; font-weight: 700; line-height: 1.2; }
.sesion-caja p { margin-bottom: 8px; color: var(--texto-2); }

.sin-js { position: fixed; inset: auto 16px 16px; z-index: 80; padding: 14px; border-radius: 12px; background: var(--superficie); text-align: center; }

/* ---------------------------------------------------------------- página de ubicación compartida */

.pagina-compartida #mapa { inset: 0; }
.tarjeta-compartida {
  position: fixed;
  z-index: 10;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 440px;
  margin: 0 auto;
  padding: 16px;
  border: 1px solid var(--borde-2);
  border-radius: var(--radio-grande);
  background: var(--panel);
  box-shadow: var(--sombra);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}
.compartida-cabecera { display: flex; align-items: center; gap: 12px; }
.compartida-cabecera > div { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.compartida-cabecera h1 { overflow: hidden; font-size: 20px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.compartida-estado { color: var(--texto-2); font-size: 14.5px; }
.compartida-estado[data-estado="movimiento"] { color: #7ee695; }
.compartida-estado[data-estado="alarma"] { color: #ff8a80; }
.compartida-estado[data-estado="sin-senal"] { color: #ffd28a; }
.compartida-datos { display: flex; flex-direction: column; gap: 6px; color: var(--texto-2); font-size: 14px; }
.compartida-datos > div { display: flex; align-items: flex-start; gap: 8px; }
.compartida-datos .icono { width: 17px; height: 17px; margin-top: 1px; color: var(--texto-3); }
.compartida-pie { color: var(--texto-3); font-size: 12px; text-align: center; }
.compartida-vencida { align-items: center; padding: 22px 18px; text-align: center; }
.compartida-vencida h1 { font-size: 20px; }
.compartida-vencida p { color: var(--texto-2); }
.compartida-vencida .icono.grande { color: var(--texto-3); }

body.pagina-vencida { display: grid; place-items: center; min-height: 100%; padding: 24px; overflow: auto; }
.pagina-vencida .sesion-caja { gap: 12px; }
.formulario-entrar { width: 100%; margin-top: 8px; gap: 14px; text-align: left; }
.formulario-entrar .error-entrar { margin: 0; color: var(--rojo); font-size: 14px; line-height: 1.4; }

@media (min-width: 900px) {
  .tarjeta-compartida { right: auto; bottom: 20px; left: 20px; width: 400px; margin: 0; }
}
/* Sin hoja que se arrastra: los créditos del mapa van arriba a la izquierda, lejos de la tarjeta. */
.pagina-compartida .maplibregl-ctrl-bottom-right {
  top: calc(env(safe-area-inset-top) + 6px);
  right: auto;
  bottom: auto;
  left: 0;
}

/* ---------------------------------------------------------------- menos movimiento */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
  .marcador-burbuja::after { display: none; }
}
