/* ManejaTest — estilos base, pensados primero para el celular */
:root {
  --brand: #0f4c81; --brand-2: #1d6fb8; --ink: #14213d; --muted: #5b6b82; --bg: #f4f7fb; --card: #fff; --line: #dde5ef;
  --ok: #16a34a; --ok-bg: #e8f7ee; --warn: #d97706; --warn-bg: #fff6e6; --ko: #dc2626; --ko-bg: #fdecec; --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 4px 14px rgba(20, 33, 61, .06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.45; -webkit-text-size-adjust: 100%; }
a { color: var(--brand-2); }
h1, h2, h3, h4 { margin: .2em 0 .5em; line-height: 1.2; }
h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.loading { min-height: 40vh; display: grid; place-items: center; }
.loading::after { content: ''; width: 36px; height: 36px; border: 4px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Encabezado y navegación */
header.top { position: -webkit-sticky; position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); padding-left: calc(14px + env(safe-area-inset-left)); padding-right: calc(14px + env(safe-area-inset-right)); background: var(--brand); color: #fff; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: #fff; color: var(--brand); font-weight: 900; }
.tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.tools select.lang { padding: 6px; border-radius: 8px; border: 0; max-width: 130px; }
header .btn { background: rgba(255, 255, 255, .15); color: #fff; border-color: rgba(255, 255, 255, .3); }
nav.side { position: fixed; z-index: 15; bottom: 0; left: 0; right: 0; display: flex; overflow-x: auto; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav.side a { flex: 1 0 auto; min-width: 68px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; font-size: .72rem; color: var(--muted); text-decoration: none; }
nav.side a span:first-child { font-size: 1.25rem; }
nav.side a.on { color: var(--brand); font-weight: 700; }
main { padding: 14px; max-width: 1100px; margin: 0 auto; }
main.with-nav { padding-bottom: 90px; }
@media (min-width: 900px) {
  nav.side { top: 52px; bottom: 0; right: auto; width: 200px; flex-direction: column; border-top: 0; border-right: 1px solid var(--line); padding: 10px 0; }
  nav.side a { flex: none; flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 18px; font-size: .95rem; }
  nav.side a.on { background: #eef4fb; border-right: 3px solid var(--brand); }
  main.with-nav { margin-left: 200px; padding: 22px 28px 40px; }
}
.offline-bar { background: var(--warn); color: #fff; text-align: center; font-size: .85rem; padding: 4px; }

/* Tarjetas, botones y formularios */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.hero { background: linear-gradient(135deg, #fff, #eef4fb); }
.hero.pass { background: linear-gradient(135deg, #fff, var(--ok-bg)); } .hero.fail { background: linear-gradient(135deg, #fff, var(--ko-bg)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn:hover { border-color: var(--brand-2); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.danger { color: var(--ko); border-color: #f3c2c2; }
.btn.small { padding: 6px 10px; min-height: 34px; font-size: .88rem; }
.btn.big { font-size: 1.05rem; padding: 14px 20px; }
.btn.block { display: flex; width: 100%; flex-direction: column; margin: 8px 0; }
.btn.block small { font-weight: 400; opacity: .85; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--brand-2); cursor: pointer; font: inherit; padding: 4px; }
label { display: block; font-weight: 600; font-size: .92rem; margin: 8px 0; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid #9cc3ea; outline-offset: 1px; }
.invalid { border-color: var(--ko) !important; background: var(--ko-bg); }
label.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 500; }
label.check input { width: auto; margin-top: 3px; }
label.check.strong { font-weight: 700; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.grid2, .grid3 { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { grid-template-columns: repeat(3, 1fr); } }
.stack > * { margin: 6px 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.notice { background: var(--warn-bg); border-left: 4px solid var(--warn); padding: 8px 12px; border-radius: 8px; }
.ok { color: var(--ok); }
pre.legal { white-space: pre-wrap; font-family: inherit; font-size: .88rem; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 320px; overflow: auto; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: #eef2f7; color: var(--muted); }
.s-debil { background: var(--ko-bg); color: var(--ko); } .s-en_progreso { background: var(--warn-bg); color: var(--warn); } .s-dominado { background: var(--ok-bg); color: var(--ok); }
.st-realizada { background: var(--ok-bg); color: var(--ok); } .st-inasistencia, .st-cancelada_escuela { background: var(--ko-bg); color: var(--ko); } .st-aviso_alumno, .st-recuperar { background: var(--warn-bg); color: var(--warn); } .st-agendada { background: #e6f0fb; color: var(--brand); }
ul.plain { list-style: none; padding: 0; margin: 0; } ul.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); } ul.plain li:last-child { border-bottom: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; } .tbl th, .tbl td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; transition: .25s; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 100; max-width: 92vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.err { background: var(--ko); }
.modal-back { position: fixed; inset: 0; background: rgba(15, 25, 45, .45); display: grid; place-items: center; z-index: 50; padding: 14px; }
.modal { background: #fff; border-radius: var(--radius); padding: 18px; width: min(560px, 100%); max-height: 88vh; overflow: auto; }

/* Ingreso */
.auth { max-width: 560px; margin: 4vh auto; }
.brand-big { text-align: center; margin-bottom: 14px; } .brand-big .logo { width: 56px; height: 56px; font-size: 1.6rem; background: var(--brand); color: #fff; border-radius: 16px; }
.brand-big h1 { margin: 8px 0 2px; font-size: 1.8rem; color: var(--brand); }
.captcha .crow { display: flex; align-items: center; gap: 8px; } .captcha .cimg svg { display: block; border-radius: 8px; }
.links { display: flex; flex-direction: column; gap: 6px; text-align: center; margin-top: 10px; font-size: .92rem; }

/* Avance y niveles */
.bar { height: 10px; background: #e6edf5; border-radius: 99px; overflow: hidden; } .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--ok)); border-radius: 99px; }
.bar.big { height: 16px; margin: 8px 0; }
.stats { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .9rem; margin: 6px 0 12px; }
.next { display: flex; flex-direction: column; gap: 6px; }
.ready.yes { border: 2px solid var(--ok); }
.level { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; } .level.locked { opacity: .55; }
.lvl-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.topics { list-style: none; padding: 0; margin: 6px 0 0; }
.topic { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 10px; margin: 4px 0; background: #f8fafc; border-left: 5px solid #cbd5e1; }
.topic a { color: var(--ink); text-decoration: none; font-weight: 600; } .topic .score { color: var(--muted); font-variant-numeric: tabular-nums; }
.t-debil { border-left-color: var(--ko); } .t-en_progreso { border-left-color: var(--warn); } .t-dominado { border-left-color: var(--ok); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 10px 0; }
.kpis div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; } .kpis b { display: block; font-size: 1.35rem; color: var(--brand); } .kpis span { font-size: .8rem; color: var(--muted); }

/* Práctica */
.player { max-width: 760px; margin: 0 auto; }
.ptop { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.timer { font-weight: 800; font-variant-numeric: tabular-nums; }
.qnav { display: flex; gap: 5px; overflow-x: auto; padding: 4px 0 10px; }
.qn { flex: 0 0 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 700; cursor: pointer; }
.qn.cur { outline: 3px solid #9cc3ea; } .qn.ans { background: #e6f0fb; } .qn.ok { background: var(--ok); color: #fff; border-color: var(--ok); } .qn.ko { background: var(--ko); color: #fff; border-color: var(--ko); }
.qtext { font-size: 1.2rem; margin: 10px 0 14px; } .qimg { max-width: 100%; max-height: 260px; display: block; margin: 8px auto; border-radius: 10px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; gap: 12px; align-items: center; text-align: left; padding: 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font: inherit; cursor: pointer; min-height: 54px; color: var(--ink); }
.opt .ol { flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #eef2f7; font-weight: 800; }
.opt.chosen { border-color: var(--brand-2); background: #eef4fb; } .opt.right { border-color: var(--ok); background: var(--ok-bg); } .opt.wrong { border-color: var(--ko); background: var(--ko-bg); }
.expl { margin-top: 12px; padding: 12px; border-radius: 12px; } .expl.ok { background: var(--ok-bg); } .expl.ko { background: var(--ko-bg); }
.hint { margin-top: 10px; } .pbtns { display: flex; gap: 8px; justify-content: space-between; margin-top: 14px; flex-wrap: wrap; }
details.rev { border-bottom: 1px solid var(--line); padding: 8px 0; } details.rev.ok summary::before { content: '✅ '; } details.rev.ko summary::before { content: '❌ '; }
span.right { color: var(--ok); font-weight: 700; } span.wrong { color: var(--ko); text-decoration: line-through; }
.prose { font-size: 1.02rem; }
.signs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; } .signs figure { margin: 0; text-align: center; } .signs img { max-width: 100%; height: 110px; object-fit: contain; }

/* Clases y ficha */
li.cls { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.focus { background: #fffaf0; border: 1px solid #f5deb3; border-radius: 12px; padding: 10px 12px; }
.stages { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; } .stages li { padding: 6px 10px; border-radius: 10px; background: #eef2f7; font-size: .88rem; }
.stages li.st-superado { background: var(--ok-bg); } .stages li.st-debil { background: var(--ko-bg); } .stages li.st-en_progreso { background: var(--warn-bg); }
.stage-grid { display: grid; gap: 8px; } .stage { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.seg { display: flex; gap: 4px; } .seg label { margin: 0; } .seg input { display: none; }
.seg span { display: inline-block; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-weight: 600; font-size: .85rem; cursor: pointer; }
.seg input:checked + span { background: var(--brand); color: #fff; border-color: var(--brand); }
.stars { display: flex; gap: 4px; font-size: 2rem; } .stars input { display: none; } .stars span { color: #cbd5e1; cursor: pointer; } .stars label.on span { color: #f59e0b; }
.opt-edit { display: flex; align-items: center; gap: 8px; } .opt-edit input[type=radio] { width: auto; }
code { background: #eef2f7; padding: 2px 6px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.grid2 > .btn, .grid3 > .btn { align-self: end; margin: 8px 0; }

.school-sel { max-width: 220px; padding: 6px; border-radius: 8px; border: 0; margin-left: 8px; }
.empty { text-align: center; padding: 28px 16px; } .empty .row { justify-content: center; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tbl td.actions { white-space: nowrap; }
@media (max-width: 640px) { .school-sel { max-width: 130px; } }
.ctx-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #eef4fb; border: 1px solid #cfe0f3; border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; }
.ctx-bar span { margin-right: auto; } .center { text-align: center; }

/* Cuadros de mando */
.rings { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 12px 0; }
.ring { margin: 0; text-align: center; display: flex; flex-direction: column; align-items: center; }
.ring .trk { stroke: #e6ecf3; } .ring .val { transition: stroke-dashoffset .8s ease; }
.ring .num { font-size: 22px; font-weight: 700; fill: #12263f; }
.ring figcaption { display: flex; flex-direction: column; font-size: 14px; margin-top: 4px; } .ring figcaption span { color: #5b6b7f; font-size: 12px; }
.r-high .val { stroke: #1f9d55; } .r-mid .val { stroke: #e0a21b; } .r-low .val { stroke: #d64545; } .r-none .val { stroke: transparent; }
.mini { display: inline-block; vertical-align: middle; margin-right: 4px; } .mini .num { font-size: 10.5px; letter-spacing: -0.3px; } .mini figure { display: inline-block; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 8px 0; }
.kpis div { background: #f3f7fb; border-radius: 10px; padding: 10px; text-align: center; } .kpis b { display: block; font-size: 22px; } .kpis span { font-size: 12px; color: #5b6b7f; }
.sug ul { list-style: none; padding: 0; margin: 0; } .sug li { padding: 8px 10px; border-left: 4px solid #cfd8e3; margin-bottom: 6px; background: #f8fafc; border-radius: 6px; }
.sug li.p0 { border-color: #1f9d55; } .sug li.p1 { border-color: #d64545; } .sug li.p2 { border-color: #e0a21b; }
.dash-tbl td { vertical-align: middle; } .dash-tbl tr.risk td:first-child { border-left: 3px solid #d64545; }
@media (max-width: 640px) { .rings { grid-template-columns: repeat(2, 1fr); } .ring svg { width: 104px; height: 104px; } }

/* Multiplataforma: tablas anchas se desplazan dentro de la tarjeta en pantallas chicas; toque cómodo */
@media (max-width: 760px) { .tbl { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; } .tbl td.small, .dash-tbl td:last-child { white-space: normal; min-width: 220px; } }
html { -webkit-tap-highlight-color: transparent; } .btn, button, a, select { touch-action: manipulation; }
.modal { max-height: 90vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ver { font-size: .7rem; font-weight: 600; background: rgba(255,255,255,.18); border-radius: 6px; padding: 2px 6px; margin-left: 6px; align-self: center; white-space: nowrap; }

/* Resultado de un intento */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 12px; }
.choices .btn.big { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px; }
.choices .btn small { font-weight: 400; font-size: .8rem; opacity: .85; }
.celebrate { background: linear-gradient(135deg, #e8f7ee, #fff); border: 1px solid #bfe6cd; }
.rev .expl { background: #f6f9fc; border-radius: 8px; padding: 8px 10px; }
details.group > summary { cursor: pointer; font-weight: 600; margin: 10px 0; }

/* Sedes */
.branch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.branch-card { display: block; color: inherit; text-decoration: none; border: 1px solid var(--line); transition: box-shadow .15s; }
.branch-card:hover { box-shadow: 0 4px 14px rgba(15,76,129,.12); } .branch-card.inactive { opacity: .7; }
.mini-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; font-size: .8rem; color: var(--muted); } .mini-row > span { display: flex; align-items: center; }

/* Mostrar/ocultar contraseña */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 44px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; font-size: 18px; line-height: 1; padding: 6px; opacity: .6; }
.pw-eye.on { opacity: 1; }
