:root {
  --azul: #2563eb;
  --azul-oscuro: #1e40af;
  --verde: #16a34a;
  --verde-oscuro: #15803d;
  --rojo: #dc2626;
  --gris-100: #f4f5f7;
  --gris-200: #e5e7eb;
  --gris-500: #6b7280;
  --texto: #1f2430;
  --radio: 14px;
  --sombra: 0 10px 30px rgba(15, 23, 42, 0.12);

  --marca-teal: #1e8a8f;
  --marca-lima: #c4d92c;
  --marca-verde: #7cbc4a;
  --marca-oscuro: #0c1815;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--texto);
  margin: 0;
  min-height: 100vh;
  background: #f8fafc;
  overflow-x: hidden;
}

/* ---------- Fondo de kiosco (inicio, ingreso, salida) ---------- */

body.kiosco {
  background: var(--marca-oscuro);
  position: relative;
}

.fondo-blobs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(65px);
  will-change: transform;
}

.blob-1 {
  width: 440px;
  height: 440px;
  top: -110px;
  left: -120px;
  background: var(--marca-teal);
  opacity: 0.5;
  animation: flotar-blob-1 13s ease-in-out infinite;
}

.blob-2 {
  width: 380px;
  height: 380px;
  bottom: -120px;
  right: -90px;
  background: var(--marca-lima);
  opacity: 0.45;
  animation: flotar-blob-2 17s ease-in-out infinite;
}

.blob-3 {
  width: 360px;
  height: 360px;
  top: 38%;
  right: 8%;
  background: var(--marca-verde);
  opacity: 0.5;
  animation: flotar-blob-3 15s ease-in-out infinite;
}

@keyframes flotar-blob-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(45px, 35px) scale(1.18); }
}

@keyframes flotar-blob-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-40px, -30px) scale(1.15); }
}

@keyframes flotar-blob-3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-30px, 45px) scale(1.2); }
}

@media (prefers-reduced-motion: reduce) {
  .blob {
    animation: none;
  }
}

.logo-marca {
  display: block;
  height: 34px;
  margin: 0 auto 18px;
}

.contenedor.panel-vidrio {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 0.5px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  color: #fff;
}

.panel-vidrio h1 {
  color: #fff;
}

.panel-vidrio p {
  color: rgba(255, 255, 255, 0.75);
}

.panel-vidrio label {
  color: rgba(255, 255, 255, 0.85);
}

.panel-vidrio .enlace-volver {
  color: rgba(255, 255, 255, 0.65);
}

.panel-vidrio .enlace-volver:hover {
  color: #fff;
}

.panel-vidrio .btn-ghost {
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.3);
}

.panel-vidrio .btn-ghost:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.1);
}

.panel-vidrio .btn-secundario {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

/* ---------- Landing ---------- */

.landing {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.landing .marca {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 40px;
}

.landing .marca .icono-marca {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--azul), #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--sombra);
}

.landing h1 {
  font-size: 28px;
  margin: 0;
  letter-spacing: -0.02em;
  color: #fff;
}

.landing p.subtitulo {
  color: rgba(255, 255, 255, 0.65);
  margin: 4px 0 0;
  font-size: 15px;
}

.botonera-landing {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  max-width: 360px;
}

.boton-landing {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 26px;
  border-radius: var(--radio);
  border: none;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  box-shadow: var(--sombra);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.boton-landing:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
}

.boton-landing:active {
  transform: translateY(0);
}

.boton-landing .icono {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.boton-landing.ingreso {
  background: linear-gradient(135deg, var(--azul), var(--azul-oscuro));
}

.boton-landing.salida {
  background: linear-gradient(135deg, var(--verde), var(--verde-oscuro));
}

.boton-landing .texto {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.boton-landing .texto small {
  font-weight: 400;
  font-size: 13px;
  opacity: 0.85;
}

/* ---------- Tarjetas / flujo ---------- */

.contenedor {
  max-width: 480px;
  margin: 40px auto;
  background: #fff;
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 32px;
  position: relative;
  transition: max-width 0.2s ease;
}

.contenedor.contenedor-pdf {
  max-width: 850px;
}

.visor-pdf {
  width: 100%;
  height: 78vh;
  min-height: 520px;
  border: 1px solid var(--gris-200);
  border-radius: 10px;
}

.contenedor-ancho {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 24px auto;
  background: #fff;
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 24px;
}

.enlace-volver {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gris-500);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 18px;
}

.enlace-volver:hover {
  color: var(--texto);
}

h1 {
  font-size: 22px;
  margin-top: 0;
  letter-spacing: -0.01em;
}

.pantalla {
  display: none;
}

.pantalla.activa {
  display: block;
  animation: aparecer 0.25s ease;
}

@keyframes aparecer {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin: 14px 0 4px;
}

input[type="text"],
input[type="date"],
input[type="password"],
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--gris-200);
  border-radius: 10px;
  font-size: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 700;
  margin-top: 18px;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primario {
  background: linear-gradient(135deg, var(--azul), var(--azul-oscuro));
  color: #fff;
  width: 100%;
}

.btn-secundario {
  background: var(--gris-200);
  color: var(--texto);
  margin-right: 8px;
}

.btn-peligro {
  background: linear-gradient(135deg, var(--rojo), #991b1b);
  color: #fff;
}

.btn-exito {
  background: linear-gradient(135deg, var(--verde), var(--verde-oscuro));
  color: #fff;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--gris-500);
  border: 1px solid var(--gris-200);
  margin-right: 8px;
}

.btn-ghost:hover {
  color: var(--texto);
  border-color: #c7cbd3;
  background: #f9fafb;
}

.btn-ghost-enlace {
  margin-top: 18px;
  padding: 13px 20px;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.zona-captura {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.btn-obturador {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--azul);
  margin-top: 0;
  padding: 0;
  position: relative;
  box-shadow: var(--sombra);
}

.btn-obturador::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--azul), var(--azul-oscuro));
}

.btn-obturador:active::after {
  inset: 10px;
}

.mensaje-error {
  background: #fee2e2;
  color: #991b1b;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-top: 12px;
}

.mensaje-exito {
  background: #dcfce7;
  color: #166534;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
}

.mensaje-exito h2,
.mensaje-exito p {
  color: #166534;
}

.mensaje-pendiente {
  background: #eef2ff;
  color: #3730a3;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid #c7d2fe;
}

.mensaje-pendiente h2,
.mensaje-pendiente p {
  color: #3730a3;
}

.mensaje-pendiente h2 {
  margin-top: 0;
}

.ficha-persona {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 16px 0;
}

.ficha-persona p {
  margin: 6px 0;
  color: #fff;
}

canvas#lienzo-firma {
  border: 1px dashed #a0a4ad;
  border-radius: 10px;
  width: 100%;
  touch-action: none;
  background: #fafafa;
}

video#video-selfie,
img#foto-selfie {
  width: 100%;
  border-radius: 10px;
  background: #000;
}

/* ---------- Tablas admin ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--gris-200);
  vertical-align: middle;
}

th {
  background: #f9fafb;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gris-500);
}

.miniatura {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--gris-200);
}

.btn-tabla {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--azul);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #dbeafe;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-tabla:hover {
  background: #dbeafe;
  border-color: #bfdbfe;
}

.btn-tabla svg {
  flex-shrink: 0;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.visible {
  display: flex;
}

.modal-pdf {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--sombra);
}

.modal-pdf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-pdf-header strong {
  font-size: 15px;
}

.modal-pdf iframe {
  width: 100%;
  flex: 1;
  min-height: 60vh;
  border: 1px solid var(--gris-200);
  border-radius: 8px;
}

.btn-cerrar-modal {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--gris-500);
  padding: 4px 8px;
  margin: 0;
}

.btn-cerrar-modal:hover {
  color: var(--texto);
}

@media (max-width: 600px) {
  .modal-overlay {
    padding: 10px;
  }

  .modal-pdf {
    max-height: 95vh;
    padding: 12px;
  }

  .modal-pdf iframe {
    min-height: 70vh;
  }
}

.modal-confirmar {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--sombra);
}

.modal-confirmar p {
  margin: 0 0 20px;
  font-size: 15px;
  color: var(--texto);
  line-height: 1.5;
}

.modal-confirmar-acciones {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-confirmar-acciones button {
  margin: 0;
}

.credito-autor {
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 40;
  background: rgba(12, 24, 21, 0.55);
  color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .credito-autor {
    bottom: 10px;
    right: 10px;
    font-size: 10px;
    padding: 4px 10px;
  }
}

.barra-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.barra-filtros label {
  margin: 0 0 4px;
}

nav.admin-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

nav.admin-nav .enlaces {
  display: flex;
  gap: 18px;
}

nav.admin-nav a {
  color: var(--azul);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.paginacion {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.paginacion a {
  padding: 6px 12px;
  border-radius: 8px;
  background: #f3f4f6;
  text-decoration: none;
  color: var(--texto);
  font-size: 14px;
}

.detalle-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.detalle-imagenes {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 20px 0;
}

.detalle-imagenes > div {
  flex: 1 1 240px;
  max-width: 320px;
}

.imagen-detalle {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--gris-200);
}

.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.chip.pendiente {
  background: #fef9c3;
  color: #854d0e;
}

.chip.autorizado {
  background: #dcfce7;
  color: #166534;
}

.chip.rechazado {
  background: #fee2e2;
  color: #991b1b;
}

.tarjeta-pendiente {
  display: flex;
  gap: 16px;
  border: 1px solid var(--gris-200);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  align-items: center;
}

.tarjeta-pendiente img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--gris-200);
}

.tarjeta-pendiente .info {
  flex: 1;
}

.tarjeta-pendiente .acciones {
  display: flex;
  gap: 8px;
}

.tarjeta-pendiente .acciones button {
  margin-top: 0;
}

.tabla-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -8px;
  padding: 0 8px;
}

.tabla-scroll table {
  min-width: 720px;
}

/* ---------- Botones de acción (barra sobre listados/filtros) ---------- */

.barra-acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 4px 0 20px;
}

.btn-accion {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn-accion:active {
  transform: scale(0.98);
}

.btn-accion svg {
  flex-shrink: 0;
}

.btn-accion-primario {
  background: linear-gradient(135deg, var(--azul), var(--azul-oscuro));
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.btn-accion-primario:hover {
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.32);
}

.btn-accion-secundario {
  background: #fff;
  color: var(--texto);
  border: 1px solid var(--gris-200);
}

.btn-accion-secundario:hover {
  border-color: #c7cbd3;
  background: #f9fafb;
}

/* ---------- Formularios admin (usuarios, personas) ---------- */

.form-admin {
  max-width: 640px;
}

.form-admin .fila {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}

.form-admin .fila > div {
  min-width: 0;
}

.form-admin .btn-primario {
  width: auto;
  margin-top: 0;
}

.acciones-form {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--gris-200);
}

.acciones-form .enlace-cancelar {
  color: var(--gris-500);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.acciones-form .enlace-cancelar:hover {
  color: var(--texto);
}

.campo-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  padding: 12px 14px;
  background: var(--gris-100, #f9fafb);
  border-radius: 10px;
}

.campo-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--azul);
}

.campo-checkbox label {
  margin: 0;
  font-weight: 600;
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .tarjeta-pendiente {
    flex-wrap: wrap;
  }

  .tarjeta-pendiente .info {
    flex-basis: 100%;
    order: 1;
  }

  .tarjeta-pendiente .acciones {
    order: 2;
    flex-wrap: wrap;
    width: 100%;
  }

  .tarjeta-pendiente .acciones a,
  .tarjeta-pendiente .acciones button {
    flex: 1 1 auto;
  }

  .barra-filtros > div {
    flex: 1 1 100%;
  }

  nav.admin-nav {
    gap: 10px;
  }

  nav.admin-nav .enlaces {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 15px;
  }

  .contenedor,
  .contenedor-ancho {
    margin: 16px auto;
    padding: 20px;
    border-radius: 12px;
  }

  .contenedor {
    max-width: calc(100% - 24px);
  }

  .contenedor.contenedor-pdf {
    max-width: calc(100% - 24px);
  }

  h1 {
    font-size: 19px;
  }

  .visor-pdf {
    height: 60vh;
    min-height: 360px;
  }

  .landing .marca {
    margin-bottom: 28px;
  }

  .boton-landing {
    padding: 18px 20px;
    font-size: 16px;
  }

  table {
    font-size: 13px;
  }

  th,
  td {
    padding: 8px;
  }

  .btn-obturador {
    width: 62px;
    height: 62px;
  }

  .form-admin .fila {
    grid-template-columns: 1fr;
  }

  .acciones-form {
    flex-wrap: wrap;
  }

  .btn-accion {
    flex: 1 1 auto;
    justify-content: center;
  }

  .blob-1,
  .blob-2,
  .blob-3 {
    filter: blur(45px);
  }

  .blob-1 {
    width: 280px;
    height: 280px;
  }

  .blob-2 {
    width: 240px;
    height: 240px;
  }

  .blob-3 {
    width: 220px;
    height: 220px;
  }
}

@media (max-width: 400px) {
  .contenedor,
  .contenedor-ancho {
    padding: 16px;
  }

  .btn-secundario,
  .btn-ghost {
    margin-right: 0;
    margin-bottom: 8px;
  }
}

/* ---------- Notificaciones admin ---------- */

.badge-pendientes {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--rojo);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
}

.toast-notificacion {
  position: fixed;
  bottom: 24px;
  right: 24px;
  left: auto;
  max-width: 320px;
  background: linear-gradient(135deg, var(--azul), var(--azul-oscuro));
  color: #fff;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.28);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.4;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 80;
}

.toast-notificacion.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 480px) {
  .toast-notificacion {
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: none;
  }
}
