/* ═══ Mi vehículo — identificación del conductor (Fase 3 · 2026-10-22) ═══
   Estilo de tarjetas Basilisco: vidrio + anillo de luz del color del estado, profundidad con luz y sombra (no líneas).
   Positivo = azul eléctrico. Colores SIEMPRE por variable (tokens.css). Inputs ≥ 16 px (iPhone no hace zoom).
   Movimiento: solo transform/opacity. Rollback: quitar el <link> de index.html. */
:root {
  --veh-anillo: rgba(0, 212, 255, 0.45);
  --veh-anillo-suave: rgba(0, 212, 255, 0.16);
  --veh-vidrio: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015));
  --veh-sombra: 0 14px 34px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --veh-warn-suave: rgba(255, 204, 0, 0.14);
  --veh-alerta-suave: rgba(255, 51, 85, 0.14);
  --veh-azul-hondo: #0099cc;
}

.veh-screen { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 18px; }
.veh-cargando, .veh-vacio { color: var(--text-dim); font-size: 14px; text-align: center; padding: 18px 10px; }
.veh-ico { display: inline-flex; width: 18px; height: 18px; flex-shrink: 0; }
.veh-ico svg { width: 100%; height: 100%; }

.veh-card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  background: var(--veh-vidrio), var(--bg-card);
  box-shadow: var(--veh-sombra), 0 0 0 1px var(--veh-anillo-suave);
  display: flex; flex-direction: column; gap: 8px;
}
.veh-kicker {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 10.5px; font-weight: 700; letter-spacing: 2px;
  color: var(--blue-electric);
}
.veh-punto { width: 8px; height: 8px; border-radius: 50%; background: var(--blue-electric); box-shadow: 0 0 10px var(--veh-anillo); }
.veh-placa {
  font-family: var(--font-display); font-size: 28px; font-weight: 800; letter-spacing: 2px; color: var(--text-primary);
  text-shadow: 0 0 22px var(--veh-anillo-suave); line-height: 1.15; word-break: break-word;
}
.veh-nombre { font-size: 14px; color: var(--text-dim); margin-top: -4px; }
.veh-meta { font-size: 14px; color: var(--text-dim); line-height: 1.35; }

/* En uso: anillo azul con brillo */
.veh-uso { box-shadow: var(--veh-sombra), 0 0 0 1px var(--veh-anillo), 0 0 26px var(--veh-anillo-suave); }
.veh-uso-pend { box-shadow: var(--veh-sombra), 0 0 0 1px var(--yellow-warn), 0 0 22px var(--veh-warn-suave); }
.veh-uso-pend .veh-kicker { color: var(--yellow-warn); }

.veh-sellos { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.veh-sello {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 100px;
  font-size: 12px; font-weight: 600; color: var(--text-dim); background: rgba(255, 255, 255, 0.05);
}
.veh-sello .veh-ico { width: 13px; height: 13px; }
.veh-sello.ok { color: var(--blue-electric); background: var(--veh-anillo-suave); }
.veh-sello.warn { color: var(--yellow-warn); background: var(--veh-warn-suave); }

/* Aviso del encendido: más luz, es lo primero que hay que responder */
.veh-aviso { box-shadow: var(--veh-sombra), 0 0 0 1.5px var(--blue-electric), 0 0 34px var(--veh-anillo-suave); }
.veh-aviso-tit { font-family: var(--font-display); font-size: 19px; font-weight: 800; letter-spacing: 0.6px; color: var(--text-primary); }
.veh-fila-btns { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; margin-top: 6px; }

/* Botones */
.veh-cta, .veh-btn {
  height: 54px; border-radius: 14px; border: none; cursor: pointer;
  font-family: var(--font-display); font-size: 14px; font-weight: 700; letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform 0.12s ease, opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.veh-cta:active, .veh-btn:active, .veh-item:active, .veh-home:active { transform: scale(0.98); }
.veh-cta:disabled, .veh-btn:disabled, .veh-item:disabled { opacity: 0.55; }
.veh-cta .veh-ico, .veh-btn .veh-ico { width: 20px; height: 20px; }
.veh-cta {
  background: linear-gradient(135deg, var(--blue-electric), var(--veh-azul-hondo)); color: var(--bg-primary);
  box-shadow: 0 10px 26px rgba(0, 212, 255, 0.35);
}
.veh-cta-qr { height: 62px; font-size: 15px; }
.veh-cta-entregar {
  background: var(--veh-alerta-suave); color: var(--red-alert); box-shadow: 0 0 0 1.5px rgba(255, 51, 85, 0.5); margin-top: 4px;
}
.veh-btn { background: rgba(255, 255, 255, 0.06); color: var(--text-primary); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); }
.veh-link {
  background: none; border: none; color: var(--blue-electric); font-size: 14px; font-weight: 600;
  padding: 8px 4px; cursor: pointer; align-self: center; font-family: inherit;
}

/* Tomar */
.veh-tomar { display: flex; flex-direction: column; gap: 10px; }
.veh-sec {
  font-family: var(--font-display); font-size: 10.5px; letter-spacing: 1.8px; font-weight: 700;
  color: var(--text-dim); margin-top: 6px;
}
.veh-sec-fila { display: flex; align-items: center; justify-content: space-between; }
.veh-sec-fila .veh-link { font-family: var(--font-body); letter-spacing: 0; padding: 0; font-size: 13px; }
.veh-ayuda { font-size: 13px; color: var(--text-dim); text-align: center; margin-top: -2px; }
.veh-nota {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-md);
  background: var(--veh-warn-suave); color: var(--yellow-warn); font-size: 13px;
}

.veh-lista { display: flex; flex-direction: column; gap: 8px; }
.veh-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: none; text-align: left;
  border-radius: var(--radius-md); cursor: pointer; color: var(--text-primary); font-family: inherit;
  background: var(--veh-vidrio), var(--bg-card); box-shadow: var(--veh-sombra);
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.veh-item-ico {
  width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--text-dim); background: rgba(255, 255, 255, 0.05);
}
.veh-item-ico svg { width: 22px; height: 22px; }
.veh-item-ico.on { color: var(--blue-electric); background: var(--veh-anillo-suave); box-shadow: 0 0 14px var(--veh-anillo-suave); }
.veh-item-cuerpo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.veh-item-placa { font-family: var(--font-display); font-size: 16px; font-weight: 700; letter-spacing: 1px; }
.veh-item-sub { font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.veh-item-accion {
  font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--blue-electric);
  padding: 7px 10px; border-radius: 10px; background: var(--veh-anillo-suave);
}
.veh-item.en-uso .veh-item-accion { color: var(--yellow-warn); background: var(--veh-warn-suave); }
.veh-item.mio { box-shadow: var(--veh-sombra), 0 0 0 1px var(--veh-anillo); }

.veh-patente { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.veh-input {
  height: 54px; border-radius: 14px; border: none; padding: 0 16px;
  font-family: var(--font-display); font-size: 18px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--text-primary); background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35);
}
.veh-input:focus { outline: none; box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35), 0 0 0 1.5px var(--blue-electric); }
.veh-btn-pat { padding: 0 22px; }

/* Página pública del QR (sin sesión, sin barra inferior) */
.veh-publica {
  min-height: 100vh; padding: calc(var(--safe-top) + 32px) 18px 32px; background: var(--bg-primary);
  display: flex; flex-direction: column; justify-content: center;
}

/* Tarjeta del inicio */
.veh-home {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border: none; text-align: left;
  border-radius: var(--radius-lg); cursor: pointer; color: var(--text-primary); font-family: inherit;
  background: var(--veh-vidrio), var(--bg-card); box-shadow: var(--veh-sombra), 0 0 0 1px var(--veh-anillo-suave);
  transition: transform 0.12s ease, opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.veh-home-ico {
  width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--text-dim); background: rgba(255, 255, 255, 0.05);
}
.veh-home-ico svg { width: 24px; height: 24px; }
.veh-home-cuerpo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.veh-home-kicker { font-family: var(--font-display); font-size: 10px; letter-spacing: 1.8px; font-weight: 700; color: var(--text-dim); }
.veh-home-tit { font-family: var(--font-display); font-size: 16px; font-weight: 800; letter-spacing: 0.8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.veh-home-sub { font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.veh-home-flecha { font-size: 24px; color: var(--text-dim); }
.veh-home.en-uso { box-shadow: var(--veh-sombra), 0 0 0 1px var(--veh-anillo), 0 0 22px var(--veh-anillo-suave); }
.veh-home.en-uso .veh-home-ico, .veh-home.aviso .veh-home-ico { color: var(--blue-electric); background: var(--veh-anillo-suave); }
.veh-home.en-uso .veh-home-kicker, .veh-home.aviso .veh-home-kicker { color: var(--blue-electric); }
.veh-home.aviso { box-shadow: var(--veh-sombra), 0 0 0 1.5px var(--blue-electric), 0 0 30px var(--veh-anillo-suave); }

/* ═══ 2026-11-04 (Fase 5B): el adhesivo manda + instalar adhesivos ═══ */
/* Aviso de SU RUTA: va primero y con más luz (que no se confunda con "¿Va manejando…?") */
.veh-aviso-ruta { box-shadow: var(--veh-sombra), 0 0 0 2px var(--blue-electric), 0 0 40px var(--veh-anillo); }
/* 2026-11-05 (F4): "¿Era usted?" de la oficina — un viaje que ya pasó: anillo ámbar, sin el brillo de "ahora" */
.veh-aviso-oficina { box-shadow: var(--veh-sombra), 0 0 0 1.5px var(--orange-warn, #ff9f43), 0 0 22px rgba(255, 159, 67, 0.16); }
/* AQUÍ CERCA: un vehículo con adhesivo se toma con la foto, no con un toque */
.veh-item.con-qr .veh-item-ico { color: var(--blue-electric); background: var(--veh-anillo-suave); }
.veh-item.con-qr .veh-item-accion { white-space: nowrap; }
/* INSTALAR ADHESIVOS (solo instaladores) */
.veh-btn-instalar { color: var(--blue-electric); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 0 1px var(--veh-anillo-suave); }
.veh-item-info { cursor: default; }
.veh-item-info:active { transform: none; }
.veh-item.falta .veh-item-accion { color: var(--yellow-warn); background: var(--veh-warn-suave); }
.veh-resumen { text-align: center; }
/* Código impreso del adhesivo y 3 últimos caracteres de la patente */
.veh-input-cod { letter-spacing: 2px; }
.veh-input-pat3 { text-align: center; letter-spacing: 8px; font-size: 22px; }

/* ═══ 2026-11-07: QUE LAS LETRAS QUEPAN (Hernán: "no caben las letras… se ven desordenadas") ═══
   En AQUÍ CERCA el rótulo de la acción no se achicaba (FOTO AL ADHESIVO, sin salto de línea) y a la patente le quedaban
   ~50 px: la patente (una sola palabra) se salía y se montaba sobre el rótulo. Ahora el rótulo es corto (ESCANEAR) y
   nunca se aplasta, la patente se corta con "…" y el detalle usa hasta 2 líneas; los botones IR/TOMAR ya no quedan fuera. Los botones crecen si el texto
   necesita 2 líneas (antes: alto fijo de 54 px). Títulos grandes con tamaño según el ancho del teléfono.
   Rollback: borrar este bloque. Prueba: codigo cloude/tools/test/test-driver-escaner.mjs (anchos 320-412). */
.veh-item-accion { flex-shrink: 0; white-space: nowrap; }
/* INSTALAR: el rótulo lista los códigos de los adhesivos (pueden ser 2): ahí sí baja de línea, uno debajo del otro */
.veh-item-info .veh-item-accion { white-space: normal; max-width: 44%; text-align: center; overflow-wrap: break-word; }
.veh-item-placa { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* width 0 (con flex: 1 ocupa igual todo el espacio): una patente larga sin cortes ya no le «exige» ancho a la pantalla —
   en INSTALAR ADHESIVOS eso ensanchaba TODO a 384 px y en teléfonos de menos de ~416 px se cortaba a la derecha. */
.veh-item-cuerpo { width: 0; }
.veh-item-sub {
  white-space: normal; line-height: 1.3;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
}
.veh-cta, .veh-btn { height: auto; min-height: 54px; padding: 8px 14px; line-height: 1.2; text-align: center; }
.veh-cta-qr { min-height: 62px; }
.veh-placa { font-size: clamp(21px, 7vw, 28px); word-break: normal; overflow-wrap: break-word; text-wrap: balance; }
.veh-aviso-tit { overflow-wrap: break-word; text-wrap: balance; line-height: 1.25; }
.veh-home-tit {
  white-space: normal; line-height: 1.25;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
}
.veh-sec { line-height: 1.45; }
/* El campo (XXXX-XXXX / AB1234 / ···) medía su ancho "natural" (~300 px con esta fuente) y empujaba el botón IR / TOMAR /
   BUSCAR fuera de la pantalla (empezaba en x=323 en cualquier teléfono). minmax(0, 1fr) + min-width 0 = el campo se achica. */
.veh-patente { grid-template-columns: minmax(0, 1fr) auto; }
.veh-input { min-width: 0; width: 100%; }
@media (max-width: 374px) {
  .veh-cta, .veh-btn { font-size: 13px; letter-spacing: 0.6px; gap: 8px; }
  .veh-fila-btns { gap: 8px; }
  .veh-item { gap: 10px; padding: 12px; }
  .veh-item-accion { padding: 7px 8px; letter-spacing: 0.6px; }
}

/* ═══ 2026-11-07: ESCÁNER EN VIVO del código QR (escaner.js) ═══
   Pantalla completa: la cámara de fondo, un marco al centro (lo de afuera se oscurece con la sombra del marco), una
   línea de barrido (solo transform) y abajo LINTERNA / ESCRIBIR CÓDIGO / CANCELAR. Sin permiso o sin cámara: panel con
   REINTENTAR y la foto de respaldo. Rollback: borrar este bloque (y escaner.js). */
html.esc-abierto, html.esc-abierto body { overflow: hidden; }
.esc-capa {
  --esc-lado: min(72vw, 300px, 44vh);
  position: fixed; inset: 0; z-index: 10000; overflow: hidden; background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-primary); font-family: var(--font-body);
}
.esc-capa [hidden] { display: none !important; }
.esc-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.esc-arriba {
  position: absolute; top: 0; left: 0; right: 0; z-index: 1; text-align: center;
  padding: calc(var(--safe-top) + 26px) 22px 22px;
  background: linear-gradient(180deg, rgba(5, 8, 16, 0.78), rgba(5, 8, 16, 0));
}
.esc-tit { font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: 1.6px; }
.esc-ayuda { margin-top: 6px; font-size: 16px; font-weight: 500; line-height: 1.3; color: rgba(231, 234, 243, 0.86); }
.esc-marco {
  position: relative; width: var(--esc-lado); height: var(--esc-lado); border-radius: 24px; overflow: hidden;
  box-shadow: 0 0 0 100vmax rgba(5, 8, 16, 0.6);
}
.esc-esq { position: absolute; width: 40px; height: 40px; border: 0 solid var(--blue-electric); filter: drop-shadow(0 0 6px rgba(0, 212, 255, 0.55)); }
.esc-esq.a { top: 0; left: 0; border-top-width: 4px; border-left-width: 4px; border-top-left-radius: 24px; }
.esc-esq.b { top: 0; right: 0; border-top-width: 4px; border-right-width: 4px; border-top-right-radius: 24px; }
.esc-esq.c { bottom: 0; left: 0; border-bottom-width: 4px; border-left-width: 4px; border-bottom-left-radius: 24px; }
.esc-esq.d { bottom: 0; right: 0; border-bottom-width: 4px; border-right-width: 4px; border-bottom-right-radius: 24px; }
.esc-linea {
  position: absolute; left: 7%; right: 7%; top: 0; height: 100%;
  background: linear-gradient(180deg, rgba(0, 212, 255, 0) 0, rgba(0, 212, 255, 0.95) 2px, rgba(0, 212, 255, 0.2) 4px, rgba(0, 212, 255, 0) 24px);
  animation: esc-barrido 2.4s ease-in-out infinite alternate;
}
@keyframes esc-barrido { from { transform: translateY(3%); } to { transform: translateY(88%); } }
.esc-estado {
  position: relative; z-index: 1; margin-top: 22px; max-width: calc(100vw - 40px); padding: 8px 16px; border-radius: 100px;
  font-size: 16px; font-weight: 600; line-height: 1.3; text-align: center; background: rgba(5, 8, 16, 0.6);
}
.esc-estado.mal { color: var(--yellow-warn); }
.esc-abajo {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  padding: 22px 14px calc(var(--safe-bottom) + 20px);
  background: linear-gradient(0deg, rgba(5, 8, 16, 0.82), rgba(5, 8, 16, 0));
}
.esc-btn {
  min-height: 50px; padding: 0 16px; border: none; border-radius: 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display); font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--text-primary);
  background: rgba(17, 24, 39, 0.85); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 22px rgba(0, 0, 0, 0.45);
  -webkit-tap-highlight-color: transparent; transition: transform 0.12s ease, opacity 0.12s ease;
}
.esc-btn:active { transform: scale(0.97); }
.esc-btn.on { color: var(--bg-primary); background: var(--yellow-warn); }
.esc-ico { display: inline-flex; width: 18px; height: 18px; flex-shrink: 0; }
.esc-ico svg { width: 100%; height: 100%; }
/* Sin cámara: panel en vez del video */
.esc-capa.con-panel { background: var(--bg-primary); }
.esc-capa.con-panel .esc-video { display: none; }
.esc-panel {
  position: relative; z-index: 2; width: min(calc(100vw - 32px), 380px); padding: 20px 18px 18px;
  border-radius: var(--radius-lg); background: var(--veh-vidrio), var(--bg-card);
  box-shadow: var(--veh-sombra), 0 0 0 1px var(--veh-anillo-suave);
  display: flex; flex-direction: column; gap: 10px;
}
.esc-panel-tit { font-family: var(--font-display); font-size: 19px; font-weight: 800; letter-spacing: 0.6px; line-height: 1.25; }
