:root {
  --confirmado: #00b050;
  --probable: #d4b106;
  --no-asiste: #e53935;
  --pendiente: #9e9e9e;
  --azul: #2f5496;
  --fondo: #f5f6f8;
  --tarjeta: #ffffff;
  --texto: #202124;
  --texto-suave: #5f6368;
  --borde: #e0e0e0;
}

* { box-sizing: border-box; }

.oculto { display: none !important; }

.pantalla-login {
  position: fixed;
  inset: 0;
  background: var(--azul);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.login-caja {
  background: white;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 360px;
}
.login-caja h1 { margin: 0 0 4px; font-size: 1.2rem; color: var(--azul); }
.login-caja p { color: var(--texto-suave); margin: 0 0 16px; font-size: 0.9rem; }
.login-error {
  color: var(--no-asiste);
  font-size: 0.85rem;
  margin: -4px 0 10px;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--fondo);
  color: var(--texto);
}

.topbar {
  background: var(--azul);
  color: white;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { margin: 0 0 8px; font-size: 1.1rem; }

.tabs { display: flex; gap: 8px; }
.tab-btn {
  flex: 1;
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
}
.tab-btn.activo { background: white; color: var(--azul); font-weight: bold; }

.panel { display: none; padding: 12px; max-width: 900px; margin: 0 auto; }
.panel.activo { display: block; }

.mensaje-vacio { text-align: center; color: var(--texto-suave); padding: 24px; }

.contadores {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.contador {
  flex: 1;
  min-width: 90px;
  background: var(--tarjeta);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.contador .num { font-size: 1.3rem; font-weight: bold; display: block; }
.contador .etiqueta { font-size: 0.72rem; color: var(--texto-suave); }

.buscador input {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid var(--borde);
  border-radius: 10px;
  margin-bottom: 8px;
}

.filtros {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 8px;
}
.filtro-btn {
  flex: none;
  border: 1px solid var(--borde);
  background: white;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
}
.filtro-btn.activo { background: var(--azul); color: white; border-color: var(--azul); }

.lista-invitados { display: flex; flex-direction: column; gap: 8px; }

.tarjeta {
  background: var(--tarjeta);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  display: flex;
  overflow: hidden;
}
.tarjeta .barra { width: 6px; flex: none; }
.tarjeta .contenido { padding: 10px 12px; flex: 1; min-width: 0; }

.tarjeta .nombre { font-size: 1.05rem; font-weight: bold; cursor: pointer; }
.tarjeta .cargo { font-size: 0.85rem; color: var(--texto-suave); margin: 2px 0 6px; }

.etiquetas-fila { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.pill {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 12px;
  color: white;
  font-weight: bold;
}

.estatus-actual {
  display: inline-block;
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: bold;
  border: none;
}
.estatus-CONFIRMADO { background: var(--confirmado); color: white; }
.estatus-PROBABLE { background: var(--probable); color: white; }
.estatus-NO_ASISTE { background: var(--no-asiste); color: white; }
.estatus-PENDIENTE { background: #eee; color: var(--texto-suave); }

.selector-estatus {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.selector-estatus button {
  flex: 1;
  min-width: 70px;
  border: none;
  padding: 8px;
  border-radius: 8px;
  color: white;
  font-size: 0.8rem;
  cursor: pointer;
}

.fila-inferior {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  gap: 8px;
}

.btn-llego {
  background: var(--confirmado);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 0.9rem;
  cursor: pointer;
  flex: none;
}

.llegada-info {
  font-size: 0.85rem;
  color: var(--texto-suave);
  display: flex;
  align-items: center;
  gap: 8px;
}
.llegada-info .check { color: var(--confirmado); font-weight: bold; }
.btn-deshacer {
  background: none;
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  cursor: pointer;
}

.fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--azul);
  color: white;
  font-size: 1.8rem;
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  cursor: pointer;
  z-index: 20;
}

.modal-fondo {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}
.modal-fondo.oculto { display: none; }
.modal {
  background: white;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
  padding: 18px;
}
@media (min-width: 640px) {
  .modal-fondo { align-items: center; }
  .modal { border-radius: 16px; }
}

.modal h2 { margin-top: 0; }
.modal label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.85rem;
  color: var(--texto-suave);
}
.modal input, .modal select, .modal textarea {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  border: 1px solid var(--borde);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--texto);
  font-family: inherit;
}

.modal-botones { display: flex; gap: 8px; margin-top: 12px; }
.btn { flex: 1; padding: 12px; border-radius: 8px; border: none; font-size: 0.95rem; cursor: pointer; font-weight: bold; }
.btn.primario { background: var(--azul); color: white; }
.btn.secundario { background: #eee; color: var(--texto); }

@media (min-width: 700px) {
  .lista-invitados { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* ---------- Orden ---------- */

.orden-ayuda { color: var(--texto-suave); font-size: 0.85rem; margin-bottom: 10px; }

.orden-lista { display: flex; flex-direction: column; gap: 6px; }

.orden-item { background: var(--tarjeta); border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,0.08); overflow: hidden; }

.orden-fila-principal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  gap: 10px;
}
.orden-nombre { font-weight: bold; }

.orden-flechas { display: flex; gap: 6px; flex: none; }
.orden-flechas button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--borde);
  background: white;
  font-size: 1rem;
  cursor: pointer;
}
.orden-flechas button:disabled { opacity: 0.3; cursor: default; }

.orden-invitados { border-top: 1px solid var(--borde); padding: 4px 14px; }
.orden-invitado-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  gap: 10px;
  font-size: 0.9rem;
}
.orden-invitado-fila:last-child { border-bottom: none; }

/* ---------- Reportes ---------- */

.reporte-bloque {
  background: var(--tarjeta);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  padding: 16px;
  margin-bottom: 12px;
}
.reporte-bloque h2 { margin: 0 0 4px; font-size: 1.05rem; }
.reporte-ayuda { color: var(--texto-suave); font-size: 0.85rem; margin: 0 0 12px; }
.reporte-bloque label {
  display: block;
  font-size: 0.85rem;
  color: var(--texto-suave);
  margin-bottom: 12px;
}
.reporte-bloque input[type="time"] {
  display: block;
  margin-top: 4px;
  padding: 8px;
  border: 1px solid var(--borde);
  border-radius: 8px;
  font-size: 0.95rem;
}
.reporte-botones { display: flex; gap: 8px; }
.reporte-botones .btn { flex: 1; }
.reporte-ayuda code { background: #eee; padding: 1px 5px; border-radius: 4px; }

/* ---------- eliminar / restaurar / historial ---------- */

.btn.peligro { background: var(--no-asiste); color: white; }
.btn.exito { background: var(--confirmado); color: white; }

.modal-accion-peligro { margin-bottom: 12px; }
.modal-accion-peligro .btn { width: 100%; }

.modal-historial {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--borde);
}
.modal-historial h3 { margin: 0 0 8px; font-size: 0.95rem; }
.historial-fila {
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.82rem;
}
.historial-fila:last-child { border-bottom: none; }
.historial-fecha { color: var(--texto-suave); }
.historial-usuario { font-weight: bold; }
.historial-detalle { color: var(--texto); margin-top: 2px; white-space: pre-wrap; }

.tarjeta.eliminado { opacity: 0.7; }
.tarjeta.eliminado .barra { background: var(--texto-suave) !important; }
.btn-restaurar {
  background: var(--confirmado);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 0.9rem;
  cursor: pointer;
}

/* ---------- Sillas ---------- */

.sillas-activar-caja {
  background: var(--azul);
  color: white;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin-bottom: 12px;
}
.sillas-activar-caja .btn {
  width: 100%;
  background: white;
  color: var(--azul);
  font-size: 1.1rem;
  padding: 14px;
}
.sillas-activar-ayuda { margin: 10px 0 0; font-size: 0.85rem; opacity: 0.9; }

.sillas-contador {
  background: var(--tarjeta);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  text-align: center;
  padding: 14px;
  margin-bottom: 12px;
}
.sillas-contador .num { font-size: 2.6rem; font-weight: bold; display: block; line-height: 1; color: var(--azul); }
.sillas-contador .etiqueta { font-size: 0.95rem; color: var(--texto-suave); }

.sillas-cola { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

.silla-tarjeta {
  background: var(--tarjeta);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  padding: 14px 16px;
}
.silla-tarjeta.silla-nueva { animation: parpadeo 1s ease-in-out 4; }
@keyframes parpadeo {
  0%, 100% { box-shadow: 0 1px 3px rgba(0,0,0,0.12); background: var(--tarjeta); }
  50% { box-shadow: 0 0 0 4px var(--probable); background: #fff8e1; }
}

.silla-nombre { font-size: 1.3rem; font-weight: bold; line-height: 1.2; }
.silla-etiquetas { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.silla-minutos { font-size: 0.95rem; color: var(--texto-suave); margin-bottom: 10px; }
.silla-minutos.silla-espera-larga { color: var(--no-asiste); font-weight: bold; }

.silla-en-camino-aviso {
  background: #fff3cd;
  color: #7a5c00;
  font-weight: bold;
  font-size: 0.95rem;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.silla-botones { display: flex; gap: 8px; }
.silla-botones button {
  flex: 1;
  padding: 14px 10px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
}
.btn-voy-yo { background: var(--probable); color: white; }
.btn-colocada { background: var(--confirmado); color: white; }

.sillas-colocadas-bloque { margin-top: 8px; }
.sillas-colocadas-toggle {
  width: 100%;
  background: #eee;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: bold;
  color: var(--texto);
  cursor: pointer;
  text-align: left;
}
.sillas-colocadas { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.silla-colocada-fila {
  background: var(--tarjeta);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.silla-colocada-info { font-size: 0.9rem; }
.silla-colocada-info .nombre { font-weight: bold; display: block; }
.silla-colocada-info .detalle { color: var(--texto-suave); font-size: 0.8rem; }
.btn-regresar-pendiente {
  background: none;
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  flex: none;
}

@media (min-width: 700px) {
  .sillas-cola { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
