* { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, sans-serif; }

body { background: #f0f4f8; min-height: 100vh; }

.pantalla { display: none; min-height: 100vh; flex-direction: column; }
.pantalla.activa { display: flex; }

/* LOGIN */
#pantalla-login {
  justify-content: center;
  align-items: center;
  padding: 2rem;
  background: linear-gradient(135deg, #2E5FAC, #4472C4);
}

.logo-wrap { text-align: center; color: white; margin-bottom: 2rem; }
.logo {
  width: 70px; height: 70px; background: white;
  border-radius: 16px; display: flex; align-items: center;
  justify-content: center; font-size: 2rem; font-weight: 700;
  color: #2E5FAC; margin: 0 auto 1rem;
}
.logo-wrap h1 { font-size: 1.4rem; margin-bottom: 0.25rem; }
.logo-wrap p { font-size: 0.9rem; opacity: 0.85; }

.form-card {
  background: white; border-radius: 16px;
  padding: 1.5rem; width: 100%; max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.85rem; color: #555; margin-bottom: 0.4rem; font-weight: 500; }
.field input {
  width: 100%; padding: 0.75rem 1rem;
  border: 1.5px solid #ddd; border-radius: 8px;
  font-size: 1rem; outline: none; transition: border-color 0.2s;
}
.field input:focus { border-color: #2E5FAC; }

.btn-primary {
  width: 100%; padding: 0.85rem;
  background: #2E5FAC; color: white;
  border: none; border-radius: 8px;
  font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: background 0.2s;
}
.btn-primary:hover { background: #1d4a8f; }
.btn-primary:disabled { background: #aaa; cursor: not-allowed; }

.mensaje-error {
  margin-top: 0.75rem; padding: 0.75rem;
  background: #fef2f2; color: #c0392b;
  border-radius: 8px; font-size: 0.875rem; text-align: center;
}
.oculto { display: none !important; }

/* TOPBAR */
.topbar {
  background: #2E5FAC; color: white;
  padding: 0.75rem 1rem;
  display: flex; align-items: center; gap: 0.75rem;
  position: sticky; top: 0; z-index: 10;
}
.topbar-info { flex: 1; }
.topbar-info span { display: block; font-weight: 600; font-size: 0.95rem; }
.topbar-info small { font-size: 0.75rem; opacity: 0.8; }
.btn-icon {
  background: rgba(255,255,255,0.2); border: none;
  color: white; width: 36px; height: 36px;
  border-radius: 8px; font-size: 1.1rem; cursor: pointer;
}

/* EVENTOS */
.contenido { padding: 1rem; }
.contenido h2 { font-size: 1.1rem; color: #333; margin-bottom: 1rem; }
.lista-cards { display: flex; flex-direction: column; gap: 0.75rem; }

.evento-card {
  background: white; border-radius: 12px;
  padding: 1rem; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: pointer; transition: transform 0.15s;
  border-left: 4px solid #2E5FAC;
}
.evento-card:active { transform: scale(0.98); }
.evento-card h3 { font-size: 1rem; color: #222; margin-bottom: 0.25rem; }
.evento-card p { font-size: 0.8rem; color: #666; }
.evento-card .badge-sesion {
  display: inline-block; margin-top: 0.5rem;
  background: #e8f0fe; color: #2E5FAC;
  font-size: 0.75rem; padding: 0.2rem 0.6rem;
  border-radius: 20px; font-weight: 500;
}

.cargando { text-align: center; color: #888; padding: 2rem; }

/* ESCÁNER */
.scanner-wrap { position: relative; width: 100%; background: #000; }
#video-camara { width: 100%; max-height: 55vh; object-fit: cover; display: block; }

.scanner-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1rem;
}

.scanner-frame {
  width: 220px; height: 220px;
  border: 3px solid #fff;
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.4);
}

.scanner-hint { color: white; font-size: 0.85rem; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }

/* RESULTADO */
.resultado {
  padding: 1rem; text-align: center;
  border-radius: 12px; margin: 0.75rem;
  transition: all 0.3s;
}
.resultado.ok { background: #e8f5e9; border: 2px solid #4caf50; }
.resultado.error { background: #fef2f2; border: 2px solid #ef5350; }
.resultado.warn { background: #fff8e1; border: 2px solid #ffb300; }

#resultado-icono { font-size: 2rem; margin-bottom: 0.25rem; }
#resultado-nombre { font-size: 1rem; font-weight: 600; color: #222; }
#resultado-detalle { font-size: 0.8rem; color: #555; margin-top: 0.25rem; }

/* STATS */
.stats-bar {
  display: flex; background: white;
  border-top: 1px solid #eee;
}
.stat {
  flex: 1; text-align: center;
  padding: 0.75rem; border-right: 1px solid #eee;
}
.stat:last-child { border-right: none; }
.stat span { display: block; font-size: 1.5rem; font-weight: 700; color: #2E5FAC; }
.stat label { font-size: 0.7rem; color: #888; text-transform: uppercase; }

/* RECIENTES */
.lista-recientes { padding: 0.5rem; overflow-y: auto; max-height: 200px; }
.item-reciente {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem; border-radius: 8px;
  margin-bottom: 0.25rem; background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.item-reciente .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #e8f0fe; color: #2E5FAC;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 600; flex-shrink: 0;
}
.item-reciente .info { flex: 1; }
.item-reciente .info strong { display: block; font-size: 0.85rem; color: #222; }
.item-reciente .info small { font-size: 0.7rem; color: #888; }
.item-reciente .status { font-size: 0.75rem; }

/* CONEXIÓN */
.badge-online { font-size: 0.7rem; color: #4caf50; }
.badge-offline { font-size: 0.7rem; color: #ffb300; }
