/* ==========================================================================
   PHN — Control de Acceso Vehicular · caseta en CELULAR (diseno B)
   Una columna, de pie, una mano. Tarjetas blancas sobre gris claro, un solo
   acento verde. Primero 360-430 px; de 700 px para arriba (tableta) solo se
   centra y se ensancha. Fuente de estilo: ecosistema-distribuidoras/diseno.
   Objetivo: que a las 3 de la manana, o al sol, se entienda de un vistazo.
   ========================================================================== */

:root {
  color-scheme: light dark;

  /* Verde de marca: rellenos. Para TEXTO verde sobre blanco: --verde-texto */
  --verde:        #80BA26;   /* linea de diseno PHN 2026-10-28 */
  --verde-fuerte: #6FA31F;   /* hover / presionado */
  --verde-texto:  #4F7D11;
  --verde-sobre:  #FFFFFF;   /* texto sobre relleno verde: blanco, peso 700 y >= 16 px */
  --verde-tinte:  #EEF5DF;
  --verde-tinte-texto: #1F5A1C;  /* texto sobre el velo --verde-tinte */
  --verde-suave:  #F4F8EA;
  --foco:         #4F7D11;

  /* Neutros (tinta-3 >= 5.5:1 sobre blanco y 4.9:1 sobre --campo: legible al sol) */
  --blanco:  #FFFFFF;
  --fondo:   #F5F5F7;
  --fondo-2: #FBFBFD;        /* cabecera y barra inferior */
  --campo:   #F0F0F3;
  --tinta:   #1D1D1F;
  --tinta-2: #424245;
  --tinta-3: #5C5C62;
  --linea:   #E8E8ED;
  --linea-2: #C7C7CC;
  --oscuro:  #1D1D1F;       /* boton Salida */
  --oscuro-sobre: #FFFFFF;
  --inactivo: #E8E8ED;
  --inactivo-texto: #58585C;
  --toast-fondo: #1D1D1F;
  --toast-texto: #FFFFFF;
  --velo: rgba(29, 29, 31, .55);

  /* Estados */
  --ambar:       #FFF4D6;
  --ambar-texto: #6F5200;
  --azul:        #E5F1FF;
  --azul-texto:  #0058B8;
  --rojo:        #B3261E;
  --rojo-fondo:  #FFE5E3;

  --radio-xl: 24px;
  --radio:    16px;
  --radio-sm: 12px;

  --sombra:       0 1px 2px rgba(0, 0, 0, .04), 0 6px 18px rgba(0, 0, 0, .04);
  --sombra-barra: 0 -1px 0 var(--linea), 0 -10px 28px rgba(0, 0, 0, .06);

  --sp-1: 8px;
  --sp-2: 12px;
  --sp-3: 16px;
  --sp-4: 24px;

  --fuente: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, sans-serif;

  --tactil: 48px;            /* objetivo tactil minimo */
  --ancho-main: 720px;       /* tope del cuerpo; crece en escritorio (ver al final) */
  --alto-barra: 148px;       /* barra inferior: resumen + botones + holgura */
  --kb: 0px;                 /* lo pone app.js cuando sale el teclado (iOS) */
  --seguro-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --verde-texto:  #A3DB7E;
    --verde-tinte:  #1F3320;
    --verde-tinte-texto: #BDE9A0;
    --verde-suave:  #1B2C16;
    --foco:         #A3DB7E;
    --blanco:  #1C1D20;
    --fondo:   #0F1012;
    --fondo-2: #16171A;
    --campo:   #2A2B2F;
    --tinta:   #F2F2F5;
    --tinta-2: #D4D4D9;
    --tinta-3: #A9A9B0;
    --linea:   #2E2F34;
    --linea-2: #4A4B51;
    --oscuro:  #46474D;
    --inactivo: #2A2B2F;
    --inactivo-texto: #A0A0A7;
    --toast-fondo: #F2F2F5;
    --toast-texto: #1D1D1F;
    --velo: rgba(0, 0, 0, .7);
    --ambar:       #3A2F0A;
    --ambar-texto: #FFD66B;
    --azul:        #112A4A;
    --azul-texto:  #8DC0FF;
    --rojo:        #FF8F86;
    --rojo-fondo:  #4A1C19;
    --sombra:       0 0 0 1px rgba(255, 255, 255, .04);
    --sombra-barra: 0 -1px 0 var(--linea);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--fondo);
  color: var(--tinta);
  font-family: var(--fuente);
  font-size: 17px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button, input { font-family: inherit; font-size: inherit; color: inherit; }
button { touch-action: manipulation; }
button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--foco);
  outline-offset: 2px;
}
[hidden] { display: none !important; }

.icono {
  width: 22px; height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view { display: none; }
.view.is-active { display: block; }

/* ==========================================================================
   LOGIN
   ========================================================================== */

#view-login.is-active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
#view-login {
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(var(--sp-4), env(safe-area-inset-top)) var(--sp-3) calc(var(--sp-4) + var(--seguro-b));
  background: var(--fondo);
}

.login {
  width: 100%;
  max-width: 440px;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
}
.login__logo { width: 100%; max-width: 220px; height: auto; margin-top: var(--sp-1); }
.login__titulo {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.025em;
  text-align: center;
}
.login__sub {
  margin: -10px 0 var(--sp-1);
  color: var(--tinta-3);
  text-align: center;
}
.login__form { width: 100%; display: flex; flex-direction: column; gap: var(--sp-3); }
.login__clave-titulo {
  margin: 0;
  color: var(--tinta-2);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}
.login__nota {
  margin: 0;
  color: var(--tinta-3);
  font-size: 14px;
  text-align: center;
}

/* Llave de acceso */
.llave { width: 100%; display: flex; flex-direction: column; gap: var(--sp-2); }
.llave__ayuda {
  margin: 0;
  color: var(--tinta-3);
  font-size: 14px;
  text-align: center;
}
.btn.btn--llave { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 68px; font-size: 19px; font-weight: 700; }
.btn--llave .icono { width: 30px; height: 30px; }
.btn--llave:disabled { background: var(--inactivo); color: var(--inactivo-texto); opacity: 1; }
.divisor {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 2px 0;
  color: var(--tinta-3);
  font-size: 14px;
}
.divisor::before, .divisor::after { content: ""; flex: 1; height: 1px; background: var(--linea-2); }

/* ==========================================================================
   CAMPOS
   ========================================================================== */

.campo { display: block; text-align: left; margin: 0; }

.campo__label {
  display: block;
  margin-bottom: 6px;
  color: var(--tinta-3);
  font-size: 14px;
  font-weight: 600;
}

.campo__input {
  width: 100%;
  min-height: 58px;
  padding: 14px 16px;
  background: var(--blanco);
  border: 2px solid var(--linea-2);
  border-radius: var(--radio-sm);
  font-size: 20px;            /* >= 16 px: iOS no hace zoom al enfocar */
  transition: border-color .15s ease;
}
.campo__input:focus { outline: none; border-color: var(--verde); }

.campo__error {
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--rojo-fondo);
  color: var(--rojo);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
}

.campo__nota {
  margin-left: 4px;
  font-style: normal;
  font-weight: 500;
  color: var(--tinta-3);
}

/* ==========================================================================
   BOTONES
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radio-sm);
  padding: 0 var(--sp-4);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, opacity .15s ease, transform .05s ease;
}
.btn:active { transform: scale(.985); }
.btn:disabled { cursor: not-allowed; transform: none; }
.btn--ancho { width: 100%; }

.btn--primario {
  min-height: 60px;
  border-radius: var(--radio);
  background: var(--verde);
  color: var(--verde-sobre);
  font-size: 20px;
  font-weight: 700;
}
.btn--primario:hover:not(:disabled) { background: var(--verde-fuerte); }
.btn--primario:disabled { opacity: .55; }

.btn--secundario {
  min-height: var(--tactil);
  border-radius: var(--radio);
  background: var(--campo);
  color: var(--tinta);
  font-size: 16px;
}
.btn--peligro {
  min-height: 56px;
  border-radius: var(--radio);
  background: var(--rojo);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}
@media (prefers-color-scheme: dark) { .btn--peligro { color: #2A0B09; } }

.btn--texto {
  min-height: var(--tactil);
  padding: 0 var(--sp-3);
  border-radius: 999px;
  background: transparent;
  color: var(--azul-texto);
  font-size: 16px;
  font-weight: 600;
}
.btn--texto:hover { background: var(--azul); }
.foto__datos .btn--texto { color: var(--rojo); padding: 0 12px; min-height: 44px; }

/* Entrada / Salida: las dos acciones grandes */
.btn--grande {
  gap: 10px;
  min-height: 64px;
  border-radius: var(--radio);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.btn--grande .icono { width: 28px; height: 28px; stroke-width: 2.4; }
.btn--entrada { background: var(--verde); color: var(--verde-sobre); }
.btn--entrada:hover:not(:disabled) { background: var(--verde-fuerte); }
.btn--salida  { background: var(--oscuro); color: var(--oscuro-sobre); }
.btn--grande:disabled {
  background: var(--inactivo);
  color: var(--inactivo-texto);
  opacity: 1;
}

/* ==========================================================================
   BARRA SUPERIOR (fija) + ESTADO DE RED SIEMPRE VISIBLE
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--fondo-2);
  border-bottom: 1px solid var(--linea);
  padding: env(safe-area-inset-top) 0 0;
}
.topbar__fila {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px var(--sp-3) 6px;
}
.topbar__logo { height: 34px; width: auto; max-width: 96px; object-fit: contain; flex: none; }
.topbar__marca { flex: 1; min-width: 0; line-height: 1.2; }
.topbar__titulo { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__rol { font-size: 14px; color: var(--tinta-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__rol span { color: var(--tinta); font-weight: 600; }

.topbar__menu {
  width: var(--tactil); height: var(--tactil);
  flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--campo);
  color: var(--tinta);
  cursor: pointer;
}

.estado-red {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 4px var(--sp-3);
  border: 0;
  background: var(--verde-tinte);
  color: var(--verde-tinte-texto);
  font-size: 14px;
  font-weight: 700;
  cursor: default;
}
.estado-red::before {
  content: "";
  width: 10px; height: 10px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}
.estado-red.es-aviso { min-height: var(--tactil); background: var(--ambar); color: var(--ambar-texto); cursor: pointer; }
.estado-red.es-aviso:disabled { cursor: default; }
.estado-red.is-atorado { background: var(--rojo-fondo); color: var(--rojo); }

/* ==========================================================================
   CUERPO
   ========================================================================== */

.main {
  max-width: var(--ancho-main);
  margin: 0 auto;
  padding: var(--sp-3) var(--sp-3) calc(var(--alto-barra) + var(--seguro-b) + var(--sp-3));
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
/* Sin barra (pestana Invitados): no hace falta el hueco */
.main.sin-barra { padding-bottom: calc(var(--sp-4) + var(--seguro-b)); }

.panel { display: flex; flex-direction: column; gap: var(--sp-2); }

/* Pestanas segmentadas */
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--campo);
  border-radius: var(--radio);
}
.tab {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tactil);
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--tinta-2);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.tab.is-active { background: var(--blanco); color: var(--tinta); font-weight: 700; box-shadow: var(--sombra); }
.tab__n {
  min-width: 28px; height: 28px;
  padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--verde);
  color: var(--verde-sobre);
  font-size: 16px;
  font-weight: 800;
}

/* Tarjetas */
.bloque {
  padding: var(--sp-3);
  background: var(--blanco);
  border-radius: var(--radio-xl);
  box-shadow: var(--sombra);
}
.bloque__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.bloque__titulo {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--tinta);
}
.bloque__meta { color: var(--tinta-3); font-size: 15px; font-weight: 500; }
.bloque__meta.is-activo { color: var(--verde-texto); font-weight: 700; }

/* ==========================================================================
   PERSONAS: busqueda + lista grande (recientes primero)
   ========================================================================== */

.buscar {
  position: relative;
  margin-bottom: var(--sp-2);
}
.buscar .icono {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--tinta-3);
  pointer-events: none;
}
.buscar__input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px 0 46px;
  background: var(--campo);
  border: 2px solid transparent;
  border-radius: var(--radio);
  font-size: 17px;
}
.buscar__input::placeholder { color: var(--tinta-3); opacity: 1; }
.buscar__input:focus { outline: none; border-color: var(--verde); background: var(--blanco); }

.personas {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.personas__titulo {
  grid-column: 1 / -1;
  margin: 6px 0 -2px;
  color: var(--tinta-3);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.personas__titulo:first-child { margin-top: 0; }
.personas__mas {
  grid-column: 1 / -1;
  min-height: var(--tactil);
  border: 2px dashed var(--linea-2);
  border-radius: var(--radio);
  background: transparent;
  color: var(--azul-texto);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.personas__vacio { grid-column: 1 / -1; margin: 8px 0; color: var(--tinta-3); text-align: center; }

.persona {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 8px 14px;
  background: var(--campo);
  border: 2px solid transparent;
  border-radius: var(--radio);
  color: var(--tinta);
  font-size: 17px;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.persona:active { transform: scale(.99); }
.persona__inicial {
  width: 38px; height: 38px;
  flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--tinta-2);
  color: var(--blanco);
  font-size: 16px;
  font-weight: 700;
}
.persona__nombre { flex: 1; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.persona.is-selected { border-color: var(--verde); background: var(--verde-suave); }
.persona.is-selected .persona__nombre { font-weight: 700; }
.persona.is-selected .persona__inicial { background: var(--verde); color: var(--verde-sobre); }
@media (prefers-color-scheme: dark) {
  .persona__inicial { color: #111; }
  .persona.is-selected .persona__inicial { color: var(--verde-sobre); }
}

.persona__check {
  width: 26px; height: 26px;
  stroke-width: 2.8;
  color: var(--verde-texto);
  display: none;
}
.persona.is-selected .persona__check { display: block; }

/* ==========================================================================
   VEHICULO
   ========================================================================== */

.switch {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tactil);
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--tinta);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.switch__pista {
  order: 2;
  position: relative;
  width: 60px; height: 34px;
  flex: none;
  border-radius: 999px;
  background: var(--linea-2);
  transition: background .15s ease;
}
.switch__pista::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .15s ease;
}
.switch[aria-checked="true"] .switch__pista { background: var(--verde); }
.switch[aria-checked="true"] .switch__pista::after { transform: translateX(26px); }

.detalle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-3) var(--sp-2);
  align-items: start;
}
.detalle .conductor { grid-column: 1 / -1; }

.conductor__opciones { display: flex; flex-wrap: wrap; gap: var(--sp-1); }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: var(--tactil);
  padding: 0 18px;
  background: var(--campo);
  border: 2px solid transparent;
  border-radius: 999px;
  color: var(--tinta);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.chip.is-selected {
  border-color: var(--verde);
  background: var(--verde);
  color: var(--verde-sobre);
  font-weight: 700;
}
.chip--vacio { background: var(--campo); color: var(--tinta-2); cursor: default; }

/* Fotos de placa y gasolina: botones de camara grandes, dos por fila */
.foto { min-width: 0; }
.foto__boton {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 104px;
  padding: 8px;
  border: 2px dashed var(--linea-2);
  border-radius: var(--radio);
  background: var(--campo);
  color: var(--tinta-2);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}
.foto__boton .icono { width: 34px; height: 34px; stroke-width: 1.7; }
.foto__boton:disabled { opacity: .6; cursor: wait; }
.foto__boton.tiene-foto {
  min-height: var(--tactil);
  flex-direction: row;
  gap: 8px;
  border-style: solid;
  border-color: transparent;
  background: var(--verde-tinte);
  color: var(--verde-tinte-texto);
}
.foto__boton.tiene-foto .icono { width: 22px; height: 22px; }

.foto__preview {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.foto__img {
  width: 100%;
  height: 76px;
  object-fit: cover;
  border-radius: var(--radio-sm);
  background: var(--linea-2);
}
.foto__datos { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.foto__peso { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--tinta-2); }

.detalle__nota { grid-column: 1 / -1; margin: 0; font-size: 14px; color: var(--tinta-3); }

/* ==========================================================================
   BARRA INFERIOR FIJA: Entrada / Salida al alcance del pulgar
   ========================================================================== */

.barra {
  position: fixed;
  left: 0; right: 0;
  bottom: var(--kb);
  z-index: 40;
  padding: 8px var(--sp-3) calc(10px + var(--seguro-b));
  background: var(--fondo-2);
  box-shadow: var(--sombra-barra);
}
.barra__fila {
  max-width: var(--ancho-main);
  margin: 0 auto 6px;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.barra__resumen {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--tinta-2);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.barra__resumen.es-listo { color: var(--verde-texto); }
.acciones {
  max-width: var(--ancho-main);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ==========================================================================
   BITACORA DE HOY (colapsable) E INVITADOS
   ========================================================================== */

.hoy { padding: 0; }
.hoy__resumen {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 60px;
  padding: 0 var(--sp-3);
  list-style: none;
  cursor: pointer;
}
.hoy__resumen::-webkit-details-marker { display: none; }
.hoy__resumen .bloque__meta { flex: 1; text-align: right; }
.hoy__flecha { color: var(--tinta-3); transition: transform .15s ease; }
.hoy[open] .hoy__flecha { transform: rotate(180deg); }
.hoy__cuerpo { padding: 0 var(--sp-3) var(--sp-3); }
.hoy__cuerpo .btn--secundario { margin-top: var(--sp-2); }

.registros, .invitados {
  list-style: none;
  margin: 0;
  padding: 0;
}
.registros:empty, .invitados:empty { display: none; }

.registro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 10px 0;
  border-top: 1px solid var(--linea);
}
.registro:first-child { border-top: 0; }
/* Una linea mas marcada separa un movimiento de otro (un grupo = un auto) */
.registro.es-grupo-nuevo { border-top: 2px solid var(--linea-2); }

.registro__hora {
  width: 48px;
  color: var(--tinta-3);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.registro__nombre { flex: 1; min-width: 120px; font-size: 16px; font-weight: 600; }
.registro__tipo {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  text-transform: capitalize;
}
.registro__tipo--entrada { background: var(--verde-tinte); color: var(--verde-tinte-texto); }
.registro__tipo--salida  { background: var(--campo); color: var(--tinta-2); }
.registro__detalle { color: var(--tinta-3); font-size: 14px; }

.registro__foto {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--azul);
  color: var(--azul-texto);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.registro__foto .icono { width: 18px; height: 18px; stroke-width: 2; }

.nota { margin: 8px 0 0; color: var(--tinta-3); font-size: 14px; }
.nota:empty { display: none; }

/* Invitados: tarjeta con la accion a un toque */
.invitados { display: flex; flex-direction: column; gap: var(--sp-2); }
.invitado {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--campo);
  border-radius: var(--radio);
}
.invitado__datos { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.invitado__nombre { font-size: 18px; font-weight: 700; }
.invitado__detalle { color: var(--tinta-2); font-size: 15px; }
.invitado__estado { margin-top: 2px; color: var(--tinta-3); font-size: 15px; font-weight: 600; }
.invitado__estado.is-dentro { color: var(--verde-texto); font-weight: 700; }

.btn--invitado {
  width: 100%;
  min-height: 56px;
  border-radius: var(--radio);
  font-size: 19px;
  font-weight: 700;
}
.btn--invitado.btn--entrada { background: var(--verde); color: var(--verde-sobre); }
.btn--invitado.btn--salida  { background: var(--oscuro); color: var(--oscuro-sobre); }

/* ==========================================================================
   HOJAS INFERIORES (sesion y oferta de llave)
   ========================================================================== */

.hoja {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.hoja__fondo { position: absolute; inset: 0; background: var(--velo); }
.hoja__caja {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-3) calc(var(--sp-3) + var(--seguro-b));
  background: var(--blanco);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .25);
}
.hoja__icono { width: 44px; height: 44px; align-self: center; color: var(--verde-texto); stroke-width: 1.6; }
.hoja__rol { margin: 0; color: var(--tinta-3); font-size: 14px; font-weight: 600; text-align: center; }
.hoja__titulo { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; text-align: center; }
.hoja__texto { margin: 0; color: var(--tinta-2); text-align: center; }
.hoja__form { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-2); }

/* ==========================================================================
   VISOR DE FOTO
   ========================================================================== */

.visor {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-3);
  background: var(--velo);
}
.visor__caja {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--blanco);
  border-radius: var(--radio-xl);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}
.visor__titulo { margin: 0; font-size: 16px; font-weight: 600; text-align: left; }
.visor__marco {
  min-height: 240px;
  padding: var(--sp-2);
  border-radius: var(--radio);
  background: var(--fondo);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--tinta-2);
  text-align: center;
}
.visor__img { max-width: 100%; max-height: 56vh; border-radius: var(--radio-sm); }
.visor .btn--primario { min-height: 56px; font-size: 18px; }
.visor .nota { margin: 0; font-size: 15px; color: var(--tinta-2); }

/* ==========================================================================
   TOAST: pastilla sobre la barra inferior
   ========================================================================== */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--kb) + var(--alto-barra) + var(--seguro-b) + 12px);
  transform: translate(-50%, 24px);
  width: max-content;
  min-width: 220px;
  max-width: calc(100vw - 32px);
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--toast-fondo);
  color: var(--toast-texto);
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
  pointer-events: none;
  z-index: 70;
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.toast.is-error { background: var(--rojo); color: #fff; }
@media (prefers-color-scheme: dark) { .toast.is-error { color: #2A0B09; } }
body.sin-barra .toast { bottom: calc(var(--kb) + var(--seguro-b) + 24px); }

/* ==========================================================================
   TABLETA Y HORIZONTAL
   ========================================================================== */

@media (min-width: 700px) {
  .login { padding: var(--sp-4); background: var(--blanco); border-radius: 32px; box-shadow: var(--sombra); margin: auto; }
  .main { padding-top: var(--sp-4); }
  .detalle { grid-template-columns: 1fr 1fr; }
  .invitados { display: grid; grid-template-columns: 1fr 1fr; }
}

/* Escritorio y tableta grande: el cuerpo usa el ancho en vez de flotar como tira.
   El flujo del guardia no cambia (elegir persona, Entrada/Salida en la barra fija);
   solo se reparte el espacio. :has() es solo un extra: sin soporte queda una columna. */
@media (min-width: 1024px) {
  :root { --ancho-main: 1180px; }
  /* Mismo borde que el contenido: ancho del cuerpo menos su relleno lateral */
  .topbar__fila { max-width: calc(var(--ancho-main) - 2 * var(--sp-4)); margin: 0 auto; padding-left: 0; padding-right: 0; }
  .barra__fila, .acciones { max-width: calc(var(--ancho-main) - 2 * var(--sp-4)); }
  .topbar__logo { height: 40px; max-width: 120px; }
  .estado-red { min-height: 36px; }
  .main { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .panel:has(#bloque-vehiculo:not([hidden])) {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: var(--sp-3);
    align-items: start;
  }
  .barra { padding-left: var(--sp-4); padding-right: var(--sp-4); }
}
@media (min-width: 1500px) {
  :root { --ancho-main: 1280px; }
}

/* Celular acostado: poca altura. La barra se compacta y se esconde el resumen */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --alto-barra: 112px; }
  .barra { padding-top: 6px; padding-bottom: calc(6px + var(--seguro-b)); }
  .barra__fila { margin-bottom: 4px; }
  .barra__resumen { -webkit-line-clamp: 1; }
  .btn--grande { min-height: 52px; font-size: 20px; }
  .btn--grande .icono { width: 24px; height: 24px; }
  .topbar__logo { height: 28px; }
  .topbar__fila { padding-top: 4px; padding-bottom: 4px; }
  .estado-red { min-height: 30px; }
  .estado-red.es-aviso { min-height: 40px; }
  #view-login.is-active { align-items: flex-start; }
  .login { gap: var(--sp-2); max-width: 520px; }
  .login__logo { max-width: 130px; }
  .login__sub { display: none; }
  .hoja__caja { max-width: 560px; }
  .visor__marco { min-height: 160px; }
  .visor__img { max-height: 44vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
