:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-card-2: #273449;
  --texto: #f1f5f9;
  --texto-tenue: #94a3b8;
  --borde: #334155;
  --azul: #3b82f6;
  --verde: #22c55e;
  --naranja: #f59e0b;
  --morado: #a855f7;
  --rojo: #ef4444;
  --radio: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--texto);
  font-size: 16px;
  padding-bottom: 40px;
}

.btn {
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: var(--radio);
  border: none;
  cursor: pointer;
  min-height: 44px;
  transition: transform 0.05s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-grande { font-size: 1.1rem; padding: 16px 22px; min-height: 56px; }
.btn-primario { background: var(--azul); color: white; }
.btn-primario:hover { opacity: 0.9; }
.btn-secundario { background: var(--bg-card-2); color: var(--texto); border: 1px solid var(--borde); }
.btn-secundario:hover { background: #32405a; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Topbar --- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--borde);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-titulo { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar-titulo h1 { font-size: 1.3rem; margin: 0; }
.badge-registrador {
  background: var(--morado);
  color: white;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.topbar-acciones { display: flex; gap: 10px; flex-wrap: wrap; }

/* --- Dashboard --- */
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  padding: 16px 20px;
}
.tarjeta {
  background: var(--bg-card);
  border-radius: var(--radio);
  padding: 16px;
  text-align: center;
  border: 1px solid var(--borde);
}
.tarjeta-valor { font-size: 2rem; font-weight: 800; }
.tarjeta-label { font-size: 0.85rem; color: var(--texto-tenue); margin-top: 4px; }
.tarjeta-ok .tarjeta-valor { color: var(--verde); }
.tarjeta-pendiente .tarjeta-valor { color: var(--naranja); }
.tarjeta-walkin .tarjeta-valor { color: var(--morado); }
.tarjeta-porcentaje .tarjeta-valor { color: var(--azul); }

/* --- Controles --- */
.controles {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 20px 12px;
}
#buscador {
  flex: 1;
  min-width: 220px;
  font-size: 1.1rem;
  padding: 14px 16px;
  border-radius: var(--radio);
  border: 1px solid var(--borde);
  background: var(--bg-card);
  color: var(--texto);
}
#buscador:focus { outline: 2px solid var(--azul); }

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 8px;
  padding: 0 20px 16px;
  flex-wrap: wrap;
}
.tab {
  background: var(--bg-card);
  color: var(--texto-tenue);
  border: 1px solid var(--borde);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}
.tab.activa { background: var(--azul); color: white; border-color: var(--azul); }

/* --- Lista de invitados --- */
.lista-invitados {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 20px;
}
.cargando, .vacio {
  text-align: center;
  color: var(--texto-tenue);
  padding: 40px 0;
}

.fila-invitado {
  background: var(--bg-card);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.fila-invitado.llego { border-left: 5px solid var(--verde); }
.fila-invitado.pendiente { border-left: 5px solid var(--naranja); }
.fila-invitado.es-walkin { border-left-color: var(--morado); }

.info-invitado { display: flex; flex-direction: column; gap: 4px; min-width: 200px; }
.nombre-invitado { font-size: 1.15rem; font-weight: 700; }
.empresa-invitado { color: var(--texto-tenue); font-size: 0.9rem; }
.etiqueta-walkin {
  display: inline-block;
  background: var(--morado);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 2px;
  width: fit-content;
}
.detalle-llegada { font-size: 0.85rem; color: var(--verde); }

.acciones-invitado { display: flex; align-items: center; gap: 10px; }
.btn-marcar-llegada { background: var(--verde); color: #052e12; min-width: 150px; }
.btn-deshacer { background: none; color: var(--texto-tenue); border: none; text-decoration: underline; cursor: pointer; font-size: 0.85rem; }
.btn-eliminar { background: none; color: var(--rojo); border: none; cursor: pointer; font-size: 0.85rem; text-decoration: underline; }

/* --- Modales --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-overlay.oculto { display: none; }
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 24px;
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-box h2 { margin: 0 0 4px; }
.modal-sub { color: var(--texto-tenue); font-size: 0.9rem; margin: 0; }
.modal-box input[type="text"] {
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--borde);
  background: var(--bg);
  color: var(--texto);
}
.modal-box input[type="file"] { color: var(--texto-tenue); }
.opciones-registrador { display: flex; gap: 10px; flex-wrap: wrap; }
.opciones-registrador .btn { flex: 1; }
.modal-botones { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.import-resultado { font-size: 0.9rem; padding: 10px; border-radius: 8px; background: var(--bg-card-2); }
.import-resultado.oculto { display: none; }

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card-2);
  border: 1px solid var(--borde);
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 600;
  z-index: 200;
}
.toast.oculto { display: none; }

@media (max-width: 480px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .fila-invitado { flex-direction: column; align-items: stretch; }
  .acciones-invitado { justify-content: stretch; }
  .btn-marcar-llegada { width: 100%; }
}
