:root {
  --azul: #0b2a5b;
  --azul-2: #13408a;
  --acento: #2563eb;
  --fondo: #f1f5f9;
  --tarjeta: #ffffff;
  --texto: #0f172a;
  --suave: #64748b;
  --borde: #e2e8f0;
  --ok: #15803d;
  --ok-fondo: #dcfce7;
  --error: #b91c1c;
  --error-fondo: #fee2e2;
  --aviso: #a16207;
  --aviso-fondo: #fef9c3;
  --radio: 14px;
  --sombra: 0 1px 3px rgba(15, 23, 42, .08), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--texto);
  background: var(--fondo);
  line-height: 1.45;
}
a { color: var(--acento); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
.suave { color: var(--suave); }
.chico { font-size: .85rem; }
.centro { text-align: center; }
.oculto { display: none !important; }

/* ---------- botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  border: 0; border-radius: 10px; padding: .65em 1.2em;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--acento); color: #fff; transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-gris { background: #e2e8f0; color: var(--texto); }
.btn-verde { background: var(--ok); }
.btn-rojo { background: var(--error); }
.btn-chico { padding: .4em .8em; font-size: .85rem; }
.btn-grande { padding: .9em 1.6em; font-size: 1.2rem; border-radius: 12px; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3em; }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: .6em .75em; font: inherit; color: inherit;
  border: 1px solid #cbd5e1; border-radius: 10px; background: #fff;
}
input:focus, select:focus { outline: 3px solid #bfdbfe; border-color: var(--acento); }
input[type=color] { width: 56px; height: 40px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 2px; background: #fff; }
.campo { margin-bottom: 1rem; }
.fila-campos { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ---------- mensajes ---------- */
.mensajes { display: grid; gap: .5rem; margin-bottom: 1rem; }
.msg { padding: .75em 1em; border-radius: 10px; font-weight: 500; }
.msg-ok { background: var(--ok-fondo); color: var(--ok); }
.msg-error { background: var(--error-fondo); color: var(--error); }
.msg-aviso { background: var(--aviso-fondo); color: var(--aviso); }

/* ---------- panel (profesores) ---------- */
.barra {
  background: var(--azul); color: #fff;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 1.25rem;
}
.barra .marca { font-weight: 700; margin-right: auto; }
.barra .marca small { display: block; font-weight: 400; opacity: .75; font-size: .75rem; }
.barra nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.barra nav a {
  color: #dbeafe; text-decoration: none; padding: .4em .75em; border-radius: 8px; font-size: .92rem;
}
.barra nav a:hover, .barra nav a.activo { background: rgba(255,255,255,.14); color: #fff; }
.contenedor { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.tarjeta { background: var(--tarjeta); border-radius: var(--radio); box-shadow: var(--sombra); padding: 1.25rem; margin-bottom: 1.25rem; }
.tarjeta h2 { font-size: 1.1rem; }
.rejilla { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.rejilla > .tarjeta { margin-bottom: 0; }

.kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1.25rem; }
.kpi { background: var(--tarjeta); border-radius: var(--radio); box-shadow: var(--sombra); padding: 1rem 1.15rem; }
.kpi .valor { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .etiqueta { color: var(--suave); font-size: .85rem; }

.estado { display: inline-flex; align-items: center; gap: .45em; font-weight: 700; padding: .3em .8em; border-radius: 999px; font-size: .85rem; }
.estado::before { content: ""; width: .6em; height: .6em; border-radius: 50%; background: currentColor; }
.estado-abierta { background: var(--ok-fondo); color: var(--ok); }
.estado-abierta::before { animation: latido 1.4s infinite; }
.estado-cerrada { background: #e2e8f0; color: #475569; }
.estado-finalizada { background: var(--error-fondo); color: var(--error); }
@keyframes latido { 50% { opacity: .25; } }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .55em .6em; border-bottom: 1px solid var(--borde); vertical-align: middle; }
th { color: var(--suave); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla-scroll { overflow-x: auto; }
.miniatura { width: 48px; height: 48px; object-fit: cover; border-radius: 10px; display: block; }
.pastilla { display: inline-block; padding: .15em .6em; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.pastilla-ok { background: var(--ok-fondo); color: var(--ok); }
.pastilla-gris { background: #e2e8f0; color: #475569; }
.pastilla-aviso { background: var(--aviso-fondo); color: var(--aviso); }
.barra-progreso { height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; min-width: 80px; }
.barra-progreso > span { display: block; height: 100%; background: var(--acento); border-radius: 999px; transition: width .4s; }
.acciones { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.zona-peligro { border: 2px dashed #fecaca; }

/* ---------- pantallas de votación ---------- */
/* Fondo: verde de la cruz del escudo del colegio (#00903c) */
.votacion {
  --verde-colegio: #00903c;
  position: relative;
  min-height: 100vh; display: flex; flex-direction: column;
  background: radial-gradient(1200px 600px at 50% -10%, #14a650, var(--verde-colegio) 55%, #007231);
  color: #fff;
}
.votacion .caja-dni .btn { background: var(--verde-colegio); }
.votacion .input-dni:focus { outline-color: #bbf7d0; border-color: var(--verde-colegio); }
.logo-colegio {
  position: absolute; top: 1rem; right: 1.25rem; z-index: 5;
  height: clamp(64px, 9vw, 120px); width: auto; max-width: 30vw; object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.25));
}
@media (max-width: 640px) { .logo-colegio { height: 52px; top: .6rem; right: .6rem; } }
.votacion-cabecera { text-align: center; padding: 2rem 1rem 1rem; }
.votacion-cabecera .colegio { opacity: .8; font-size: 1rem; letter-spacing: .04em; text-transform: uppercase; }
.votacion-cabecera h1 { font-size: clamp(1.6rem, 3.5vw, 2.6rem); margin: .2em 0 0; }
.votacion-cuerpo { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 1rem; }
.votacion-pie { text-align: center; padding: 1rem; opacity: .7; font-size: .9rem; }

.caja-dni {
  background: #fff; color: var(--texto); border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
  width: min(520px, 100%); padding: 2.25rem 2rem; text-align: center; margin-top: 4vh;
}
.caja-dni h2 { font-size: 1.6rem; }
.input-dni {
  width: 100%; font-size: 2.4rem; text-align: center; letter-spacing: .25em; font-weight: 700;
  padding: .4em .3em; border: 2px solid #cbd5e1; border-radius: 14px; margin: 1rem 0 1.2rem;
  font-variant-numeric: tabular-nums;
}
.input-dni:focus { outline: 4px solid #bfdbfe; border-color: var(--acento); }
.caja-dni .btn { width: 100%; }

.saludo { text-align: center; margin-bottom: 1.25rem; }
.saludo .nombre { font-size: clamp(1.2rem, 2.5vw, 1.7rem); font-weight: 700; }
.saludo .aula { opacity: .85; }
.temporizador { display: inline-block; margin-top: .5rem; background: rgba(255,255,255,.15); padding: .25em .9em; border-radius: 999px; font-variant-numeric: tabular-nums; }
.temporizador.urgente { background: #dc2626; }

.cedula { width: min(1200px, 100%); }
.cedula-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.opcion {
  background: #fff; color: var(--texto); border: 4px solid transparent; border-radius: 18px; overflow: hidden;
  cursor: pointer; text-align: center; padding: 0; font: inherit;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); transition: transform .12s, border-color .12s;
  display: flex; flex-direction: column;
}
.opcion:hover, .opcion:focus-visible { transform: translateY(-4px); border-color: var(--color, var(--acento)); outline: none; }
.opcion .foto { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; object-position: center 25%; display: block; background: #e2e8f0; }
.opcion .foto-vacia { aspect-ratio: 4 / 3; display: grid; place-items: center; font-size: 4rem; font-weight: 800; color: #fff; background: var(--color, #64748b); }
.opcion .franja { height: 10px; background: var(--color, var(--acento)); }
.opcion .info { padding: 1rem; }
.opcion .nombre-lista { font-size: 1.25rem; font-weight: 800; }
.opcion .candidato { color: var(--suave); }
.opcion .lema { font-style: italic; font-size: .9rem; margin-top: .3rem; }
.opcion-blanco .foto-vacia { background: #f1f5f9; color: #94a3b8; border-bottom: 1px solid var(--borde); font-size: 1.4rem; font-weight: 700; }

.modal-fondo {
  position: fixed; inset: 0; background: rgba(2, 6, 23, .7); display: grid; place-items: center; padding: 1rem; z-index: 50;
}
.modal {
  background: #fff; color: var(--texto); border-radius: 20px; width: min(460px, 100%); padding: 2rem; text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
.modal img, .modal .foto-vacia { width: 160px; height: 160px; object-fit: cover; border-radius: 16px; margin: 0 auto 1rem; display: grid; place-items: center; }
.modal .foto-vacia { background: #f1f5f9; color: #94a3b8; font-weight: 700; }
.modal .pregunta { font-size: 1.05rem; color: var(--suave); }
.modal .eleccion { font-size: 1.6rem; font-weight: 800; margin: .2em 0 1.2rem; }
.modal .acciones { justify-content: center; }
.modal .btn-grande { min-width: 150px; }

.gracias { text-align: center; }
.gracias .check {
  width: 120px; height: 120px; border-radius: 50%; background: var(--ok); color: #fff; margin: 0 auto 1rem;
  display: grid; place-items: center; font-size: 4rem; animation: aparecer .35s ease-out;
}
.gracias h2 { font-size: 2rem; }
@keyframes aparecer { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- login ---------- */
.login-caja { width: min(400px, 100%); margin: 8vh auto; }

@media (max-width: 640px) {
  .contenedor { padding: 1rem .75rem 2rem; }
  .caja-dni { padding: 1.5rem 1.1rem; }
  .input-dni { font-size: 1.8rem; letter-spacing: .15em; }
}
