/* Gestor · Academia Efecto Educativo. Tokens tomados de src/styles/tokens.css */
@font-face {
  font-family: "Montserrat";
  src: url("fonts/Montserrat-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --azul: #1A60AB; --azul-oscuro: #003366; --azul-50: #EAF1F9; --azul-100: #C8DBED;
  --amarillo: #FBBC43; --amarillo-50: #FFF8E6;
  --n0: #fff; --n50: #F7F8FA; --n100: #EEF0F4; --n200: #E1E5EC; --n300: #C9D0DA;
  --n500: #6B7689; --n600: #4A5468; --n800: #1F2738;
  --ok: #2E8B57; --ok-bg: #E6F4EC; --alerta: #B45F00; --alerta-bg: #FFF6E0; --mal: #C0392B; --mal-bg: #FBEAE8;
  --radio: 10px; --sombra: 0 1px 2px rgba(15, 20, 34, .06), 0 4px 16px rgba(15, 20, 34, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Montserrat", "Segoe UI", system-ui, sans-serif; background: var(--n50); color: var(--n800); font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--azul); }
[hidden] { display: none !important; }
.cargando { padding: 40px; text-align: center; color: var(--n500); }

/* ── estructura ── */
.barra { background: var(--azul-oscuro); color: #fff; display: flex; align-items: center; gap: 24px; padding: 0 28px; height: 60px; position: sticky; top: 0; z-index: 10; }
.barra .marca { font-weight: 800; font-size: 16px; white-space: nowrap; }
.barra .marca small { display: block; font-weight: 500; font-size: 11px; opacity: .7; letter-spacing: .04em; text-transform: uppercase; }
.pestanas { display: flex; gap: 4px; height: 100%; }
.pestanas button { background: none; border: 0; color: rgba(255,255,255,.75); padding: 0 16px; cursor: pointer; font-weight: 600; border-bottom: 3px solid transparent; }
.pestanas button[aria-current="page"] { color: #fff; border-bottom-color: var(--amarillo); }
.pestanas button:hover { color: #fff; }
.barra .usuario { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.barra .usuario button { background: rgba(255,255,255,.12); border: 0; color: #fff; border-radius: 8px; padding: 7px 12px; cursor: pointer; }
.barra .usuario button:hover { background: rgba(255,255,255,.22); }

main { max-width: 1280px; margin: 0 auto; padding: 28px; }
.encabezado { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.encabezado h1 { margin: 0; font-size: 22px; color: var(--azul-oscuro); }
.encabezado p { margin: 4px 0 0; color: var(--n500); }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; }

.tarjeta { background: var(--n0); border: 1px solid var(--n200); border-radius: var(--radio); box-shadow: var(--sombra); }
.tarjeta.relleno { padding: 22px 24px; }
.centrado { max-width: 460px; margin: 60px auto; }
.centrado h1 { font-size: 20px; color: var(--azul-oscuro); margin: 0 0 6px; }
.centrado > p { color: var(--n500); margin: 0 0 18px; }

/* ── controles ── */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 8px; padding: 8px 14px; font-weight: 600; cursor: pointer; background: var(--azul); color: #fff; white-space: nowrap; }
.btn:hover { background: #154E8B; }
.btn.sec { background: var(--n0); color: var(--azul); border-color: var(--n300); }
.btn.sec:hover { background: var(--azul-50); }
.btn.peligro { background: var(--mal); }
.btn.peligro:hover { background: #a33024; }
.btn.chico { padding: 5px 10px; font-size: 13px; }
.btn.texto { background: none; color: var(--azul); padding: 5px 8px; }
.btn.texto:hover { background: var(--azul-50); }
.btn:disabled { opacity: .5; cursor: default; }

.campo { display: block; margin-bottom: 14px; }
.campo > span { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.campo small { display: block; color: var(--n500); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--n300); border-radius: 8px; background: var(--n0);
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--azul-100); outline-offset: 1px; border-color: var(--azul); }
.fila { display: flex; gap: 12px; }
.fila > * { flex: 1; }
.con-boton { display: flex; gap: 8px; }
.con-boton input { flex: 1; font-family: ui-monospace, Consolas, monospace; }
.casillas { display: grid; gap: 6px; max-height: 220px; overflow: auto; padding: 10px; border: 1px solid var(--n200); border-radius: 8px; background: var(--n50); }
.casillas label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.filtros { display: flex; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--n200); flex-wrap: wrap; align-items: center; }
.filtros input[type=search] { max-width: 280px; }
.filtros select { width: auto; min-width: 170px; }
.filtros .total { margin-left: auto; color: var(--n500); font-size: 13px; }

/* ── tablas ── */
.tabla-env { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--n500); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--n200); background: var(--n50); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--n100); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfe; }
td .sub { display: block; color: var(--n500); font-size: 12px; }
td.num { text-align: right; white-space: nowrap; }
td.acc { text-align: right; white-space: nowrap; }
.vacio { padding: 40px; text-align: center; color: var(--n500); }
.seleccion { display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: var(--azul-50); border-bottom: 1px solid var(--azul-100); flex-wrap: wrap; }
.seleccion select { width: auto; min-width: 220px; }

.chip { display: inline-block; background: var(--azul-50); color: var(--azul-oscuro); border-radius: 999px; padding: 2px 9px; font-size: 12px; margin: 2px 4px 2px 0; white-space: nowrap; }
.etiqueta { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.etiqueta.ok { background: var(--ok-bg); color: var(--ok); }
.etiqueta.alerta { background: var(--alerta-bg); color: var(--alerta); }
.etiqueta.mal { background: var(--mal-bg); color: var(--mal); }
.etiqueta.neutra { background: var(--n100); color: var(--n600); }
.etiqueta.admin { background: var(--amarillo-50); color: #996D00; }

.progreso { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.progreso .barra-p { flex: 1; height: 8px; background: var(--n100); border-radius: 99px; overflow: hidden; }
.progreso .barra-p i { display: block; height: 100%; background: var(--azul); border-radius: 99px; }
.progreso .barra-p i.lleno { background: var(--ok); }
.progreso span { font-size: 12px; color: var(--n600); white-space: nowrap; }

.contadores { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.contador { padding: 16px 18px; }
.contador b { display: block; font-size: 26px; color: var(--azul-oscuro); }
.contador span { color: var(--n500); font-size: 13px; }

/* ── mensajes ── */
.msg { padding: 10px 12px; border-radius: 8px; margin: 12px 0; white-space: pre-wrap; }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.mal { background: var(--mal-bg); color: var(--mal); }
.msg.info { background: var(--azul-50); color: var(--azul-oscuro); }
#avisos { position: fixed; bottom: 20px; right: 20px; display: grid; gap: 8px; z-index: 100; }
.aviso { background: var(--n800); color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: var(--sombra); max-width: 380px; animation: entra .2s ease-out; }
.aviso.mal { background: var(--mal); }
@keyframes entra { from { transform: translateY(8px); opacity: 0; } }

ul.check { list-style: none; padding: 0; margin: 0 0 8px; }
ul.check li { padding: 5px 0; border-bottom: 1px solid var(--n100); }
ul.check li::before { content: "● "; color: var(--n300); }
ul.check li.ok::before { color: var(--ok); }
ul.check li.mal::before { color: var(--mal); }

/* ── diálogos ── */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(15,20,34,.25); }
dialog.ancho { width: min(900px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(15, 20, 34, .45); }
dialog .cab { padding: 18px 22px; border-bottom: 1px solid var(--n200); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
dialog .cab h2 { margin: 0; font-size: 17px; color: var(--azul-oscuro); }
dialog .cab button { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--n500); }
dialog .cuerpo { padding: 20px 22px; max-height: calc(100vh - 220px); overflow: auto; }
dialog .pie { padding: 14px 22px; border-top: 1px solid var(--n200); display: flex; justify-content: flex-end; gap: 8px; background: var(--n50); }
.credencial { background: var(--n50); border: 1px dashed var(--n300); border-radius: 8px; padding: 12px 14px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; white-space: pre-wrap; }

/* detalle de avance */
.detalle h3 { font-size: 14px; color: var(--azul-oscuro); margin: 22px 0 8px; text-transform: uppercase; letter-spacing: .04em; }
.detalle h3:first-child { margin-top: 0; }
.datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 20px; }
.datos div span { display: block; font-size: 12px; color: var(--n500); }
.datos div b { font-weight: 600; }
.respuesta-abierta { background: var(--n50); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; margin: 6px 0 12px; }
.correcta { color: var(--ok); font-weight: 700; }
.incorrecta { color: var(--mal); font-weight: 700; }

@media (max-width: 760px) {
  .barra { flex-wrap: wrap; height: auto; padding: 10px 14px 0; gap: 6px 10px; }
  .barra .marca { flex: 1; }
  .barra .marca small, .barra .usuario span { display: none; }
  .pestanas { order: 3; width: 100%; height: 42px; overflow-x: auto; }
  .barra .usuario { margin-left: 0; }
  .filtros input[type=search], .filtros select { max-width: none; width: 100%; }
  main { padding: 16px; }
  .fila { flex-direction: column; gap: 0; }
}

@media print {
  body { background: #fff; }
  .barra, main, #avisos, dialog .cab button, dialog .pie { display: none !important; }
  dialog { position: static; box-shadow: none; width: 100%; max-height: none; }
  dialog .cuerpo { max-height: none; overflow: visible; }
}
