/* ============================================================ Tokens */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --ink: #1b1f24;
  --ink-2: #4a525c;
  --muted: #6b7480;
  --line: #e1e4e8;
  --accent: #2f6fbf;
  --accent-ink: #ffffff;
  --accent-soft: #e6effa;
  --ok: #1f7a4a;   --ok-soft: #e3f3ea;
  --warn: #9a6200; --warn-soft: #fbf0dc;
  --bad: #b3261e;  --bad-soft: #fbe6e4;
  --ava: #1d4e8f;  --ava-soft: #dde8f7;
  --b0: #dbe7f7; --b1: #b6cff0; --b2: #86b0e5; --b3: #5690d6; --b4: #2f6fbf; --b5: #1d4e8f;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111418; --surface: #1a1e24; --surface-2: #232830;
    --ink: #e8eaed; --ink-2: #bfc5cc; --muted: #8d96a0; --line: #2e343c;
    --accent: #6ea4e6; --accent-ink: #0d1520; --accent-soft: #1d2a3a;
    --ok: #5cc28a; --ok-soft: #173024; --warn: #e0a84a; --warn-soft: #33270f; --bad: #f0857c; --bad-soft: #3a1a18;
    --ava: #8cb8f0; --ava-soft: #1c2b40;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111418; --surface: #1a1e24; --surface-2: #232830;
  --ink: #e8eaed; --ink-2: #bfc5cc; --muted: #8d96a0; --line: #2e343c;
  --accent: #6ea4e6; --accent-ink: #0d1520; --accent-soft: #1d2a3a;
  --ok: #5cc28a; --ok-soft: #173024; --warn: #e0a84a; --warn-soft: #33270f; --bad: #f0857c; --bad-soft: #3a1a18;
  --ava: #8cb8f0; --ava-soft: #1c2b40;
  --shadow: none;
  color-scheme: dark;
}

/* ============================================================ Base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body.modal-abierto { overflow: hidden; }
a { color: var(--accent); }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
h1 { font-size: 1.7rem; margin: 0 0 .25rem; line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h2 small, h3 small, legend small { font-weight: 400; color: var(--muted); font-size: .8em; }
h3 { font-size: 1rem; margin: 1.1rem 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.d-block { display: block; }
.lead { color: var(--ink-2); font-size: 1.05rem; margin: 0 0 1.25rem; }
.ok-txt { color: var(--ok); } .warn-txt { color: var(--warn); } .bad-txt { color: var(--bad); }

.top {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem;
  padding: .7rem max(16px, calc((100% - 1160px) / 2)); background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.marca { font-weight: 700; text-decoration: none; color: var(--ink); font-size: 1.1rem; }
.top nav { display: flex; gap: .25rem; flex-wrap: wrap; align-items: center; }
.top nav a { text-decoration: none; color: var(--ink-2); padding: .4rem .75rem; border-radius: 8px; font-size: .95rem; }
.top nav a.on, .top nav a:hover { background: var(--accent-soft); color: var(--accent); }
.tema-btn { background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 8px; width: 2.2rem; height: 2.2rem; cursor: pointer; font-size: 1rem; }
main { max-width: 1160px; margin: 0 auto; padding: 1.5rem 16px 3rem; }
.pie { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem 16px 2rem; }
.migas { font-size: .85rem; color: var(--muted); margin-bottom: .75rem; }
.migas a { color: var(--muted); }
.titulo-fila { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.titulo-fila p { margin: .2rem 0 0; }
.anio { font-weight: 400; font-size: .7em; }
.origen { margin: .25rem 0 1rem; }

/* ============================================================ Componentes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.cards { gap: 1rem; margin-bottom: 1rem; }
.cards .card { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.grid2.compacto { gap: .75rem; }
.vacio { text-align: center; padding: 2.5rem 1rem; }
.aviso { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: .92rem; }
.aviso.ok { background: var(--ok-soft); color: var(--ok); }
.aviso.bad { background: var(--bad-soft); color: var(--bad); }
.aviso.warn { background: var(--warn-soft); color: var(--warn); margin: .75rem 0 0; }
.ejemplo { background: var(--surface-2); border-radius: 10px; padding: .8rem 1rem; font-size: .92rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1.5rem; min-width: 0; }
legend { font-weight: 700; font-size: 1.05rem; margin-bottom: .75rem; padding: 0; }
label { display: block; font-size: .9rem; color: var(--ink-2); }
input[type=text], input:not([type]), input[type=search], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .7rem; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; }
.acciones, .acciones-top { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.form-linea { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-top: .75rem; }
.form-linea .crece { flex: 1 1 220px; }
label.check, label.radio { display: flex; gap: .5rem; align-items: flex-start; color: var(--ink); cursor: pointer; padding: .3rem 0; }
label.check input, label.radio input { margin-top: .25rem; flex-shrink: 0; }
label.check small { display: block; color: var(--muted); }
.check.fijo { opacity: .8; cursor: default; }
.deshabilitado { opacity: .5; }
details > summary { cursor: pointer; }
.summary-h2 { font-weight: 700; font-size: 1.05rem; list-style: none; }
.summary-h2::-webkit-details-marker { display: none; }
.filtro-anio select { width: auto; margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primario { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primario:hover { filter: brightness(1.08); }
.btn.peligro { color: var(--bad); border-color: var(--bad); }
.btn.ghost { background: transparent; }
.btn-sm { padding: .32rem .65rem; font-size: .85rem; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
.link.peligro { color: var(--bad); }
.icono { background: var(--surface); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; min-width: 2.3rem; height: 2.3rem; padding: 0 .4rem; font: inherit; font-weight: 700; cursor: pointer; }
.icono:hover { background: var(--surface-2); }
.icono.grande { font-size: 1.15rem; }
.icono.activo, .btn.activo { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .5rem; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); text-transform: uppercase; letter-spacing: .02em; vertical-align: middle; }
.tag.nee { background: var(--ava-soft); color: var(--ava); }
.t-literal { background: var(--accent-soft); color: var(--accent); }
.t-inferencial { background: var(--warn-soft); color: var(--warn); }
.t-critica { background: var(--ok-soft); color: var(--ok); }
.pill { display: inline-block; font-size: .8rem; font-weight: 700; padding: .15rem .6rem; border-radius: 99px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

/* Niveles de desempeño: Inicial / En desarrollo / Adecuado / Avanzado */
.nv { display: inline-block; font-size: .8rem; font-weight: 700; padding: .12rem .55rem; border-radius: 99px; white-space: nowrap; font-style: normal; }
.nv.ini, .nvb.ini { background: var(--bad-soft); color: var(--bad); }
.nv.des, .nvb.des { background: var(--warn-soft); color: var(--warn); }
.nv.ade, .nvb.ade { background: var(--ok-soft); color: var(--ok); }
.nv.ava, .nvb.ava { background: var(--ava-soft); color: var(--ava); }
.leyenda i.nvb { width: 12px; height: 12px; border-radius: 3px; }

/* Rampa secuencial de categorías de velocidad */
.b0 { background: var(--b0); color: #1b2a3d; } .b1 { background: var(--b1); color: #1b2a3d; } .b2 { background: var(--b2); color: #10213a; }
.b3 { background: var(--b3); color: #fff; } .b4 { background: var(--b4); color: #fff; } .b5 { background: var(--b5); color: #fff; }

/* ============================================================ Cursos */
.cursos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.curso-card {
  display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.curso-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.curso-nombre { font-weight: 700; font-size: 1.15rem; }
.curso-datos { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; font-size: .85rem; color: var(--ink-2); margin-top: .2rem; }
.progreso { height: 5px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: .35rem; }
.progreso i { display: block; height: 100%; background: var(--accent); }

.tabla-herr { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: .75rem 1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabla-herr input { max-width: 280px; margin: 0; }
.tabla .acc { white-space: nowrap; text-align: right; }
.tabla .acc > * { vertical-align: middle; }
.acc-h { text-align: right; }
.menu { display: inline-block; position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; width: 280px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .9rem; box-shadow: 0 8px 24px rgba(0,0,0,.15); text-align: left; white-space: normal; }
.form-mini { display: grid; gap: .5rem; margin-bottom: .75rem; }
.zona-peligro { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--line); }

/* ============================================================ Tablas y KPIs */
.tabla-wrap { overflow-x: auto; padding: 0; }
.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabla th, .tabla td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla th { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
.tabla .n, .tabla-mini .n, .tabla-ind .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla tbody tr:hover { background: var(--surface-2); }
.tabla .acc form { display: inline; margin-left: .5rem; }
.tabla tr.fuerte td { font-weight: 700; }
.cat-chip { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.cat-chip i, .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot { margin-right: .3rem; vertical-align: -1px; }
.pad { padding: 1rem 1.25rem 0; }
.tabla-mini { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tabla-mini td, .tabla-mini th { padding: .4rem .25rem; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.tabla-mini tr.total td { font-weight: 700; }
.tabla-mini tr.sub td:first-child { padding-left: 1rem; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.kpi span { display: block; font-size: .8rem; color: var(--muted); }
.kpi b { display: block; font-size: 1.6rem; line-height: 1.25; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: .8rem; }
.delta { font-size: .8rem; font-weight: 600; color: var(--muted); }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
.leyenda { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: .5rem 0; font-size: .82rem; color: var(--ink-2); }
.leyenda span { display: inline-flex; align-items: center; gap: .35rem; }
.leyenda i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.leyenda i.serie { background: var(--accent); height: 3px; width: 18px; }
.leyenda i.meta-l { border-top: 2px dashed var(--muted); height: 0; width: 18px; border-radius: 0; }
.comp { display: grid; grid-template-columns: 8.5rem 1fr 2.5rem; gap: .75rem; align-items: center; margin-bottom: .5rem; font-size: .9rem; }
.comp b { text-align: right; font-variant-numeric: tabular-nums; }
.track { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.track div { height: 100%; background: var(--accent); border-radius: 99px; }
.pasos { display: inline-flex; gap: 2px; vertical-align: middle; }
.pasos i { width: 18px; height: 8px; background: var(--surface-2); border-radius: 3px; border: 1px solid var(--line); }
.pasos i.on { background: var(--accent); border-color: var(--accent); }
.recs { padding-left: 1.2rem; margin: 0 0 .5rem; }
.recs li { margin-bottom: .35rem; }

/* Medidor de velocidad */
.medidor { position: relative; margin: 2.1rem 0 1.6rem; }
.medidor.multiple { margin-top: .75rem; }
.barras { display: flex; gap: 2px; height: 36px; border-radius: 6px; overflow: hidden; }
.medidor.multiple .barras { height: 56px; }
.banda { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.medidor.multiple .banda { align-items: flex-end; padding-bottom: 2px; }
.banda span { font-size: .72rem; font-weight: 600; white-space: nowrap; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; }
.marcador { position: absolute; top: -8px; height: 52px; width: 3px; margin-left: -1.5px; background: var(--ink); border-radius: 2px; }
.marcador b { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); font-size: .8rem; padding: .05rem .45rem; border-radius: 4px; margin-bottom: 3px; white-space: nowrap; }
.punto-alumno { position: absolute; width: 11px; height: 11px; margin-left: -5.5px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink); cursor: pointer; }
.punto-alumno:hover, .punto-alumno:focus { transform: scale(1.35); outline: none; }
.ejes { position: relative; height: 1rem; margin-top: 4px; }
.ejes span { position: absolute; transform: translateX(-50%); font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tooltip { position: absolute; z-index: 50; transform: translate(-50%, -100%); background: var(--ink); color: var(--surface); font-size: .8rem; padding: .25rem .55rem; border-radius: 6px; pointer-events: none; white-space: nowrap; }

/* Distribución por niveles */
.apilada { display: flex; gap: 2px; height: 24px; border-radius: 6px; overflow: hidden; min-width: 160px; }
.apilada .nvb { display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; min-width: 20px; }
.barra-col { width: 40%; }
.grupos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; }
.grupo-apoyo { border: 1px solid var(--line); border-radius: 10px; padding: .9rem; border-top: 4px solid; }
.grupo-apoyo.ini { border-top-color: var(--bad); } .grupo-apoyo.des { border-top-color: var(--warn); }
.grupo-apoyo.ade { border-top-color: var(--ok); } .grupo-apoyo.ava { border-top-color: var(--ava); }
.grupo-apoyo h3 { margin: 0 0 .25rem; display: flex; justify-content: space-between; align-items: center; }
.grupo-apoyo ul { margin: .5rem 0 0; padding-left: 1.1rem; font-size: .88rem; }

/* Gráfico de progreso */
.grafico { width: 100%; height: auto; margin-top: .5rem; overflow: visible; }
.grafico .grid { stroke: var(--line); stroke-width: 1; }
.grafico .eje { fill: var(--muted); font-size: 11px; }
.grafico .meta { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 5 4; }
.grafico .serie { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.grafico circle { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.grafico .valor { fill: var(--ink); font-size: 12px; font-weight: 700; }
.grafico .hit { fill: transparent; }
.grafico .punto:hover .hit { fill: var(--accent-soft); opacity: .6; }

/* ============================================================ Modal de evaluación */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(10, 14, 20, .6); display: flex; align-items: center; justify-content: center; padding: 1.5vh 1.5vw; }
.modal:fullscreen { padding: 0; background: var(--bg); }
.modal-caja { width: 100%; height: 100%; max-width: 1600px; background: var(--surface); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal:fullscreen .modal-caja { max-width: none; border-radius: 0; }
.m-head { display: flex; align-items: center; gap: 1rem; padding: .7rem 1.1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.m-quien small { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.m-quien h2 { margin: 0; font-size: 1.2rem; }
.m-pasos { display: flex; gap: .25rem; list-style: none; margin: 0 auto; padding: 0; counter-reset: paso; }
.m-pasos li { counter-increment: paso; font-size: .82rem; color: var(--muted); padding: .3rem .7rem; border-radius: 99px; }
.m-pasos li::before { content: counter(paso) " · "; }
.m-pasos li.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.m-pasos li.hecho { color: var(--ok); }
.m-head-acc { display: flex; gap: .4rem; }
.m-paso { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.m-cuerpo { flex: 1; overflow-y: auto; padding: 1.1rem 1.4rem; }
.m-pie { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .75rem 1.1rem; border-top: 1px solid var(--line); flex-wrap: wrap; background: var(--surface); }
.config-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.75rem; }
.config-grid h3:first-child { margin-top: 0; }
.lista-textos { display: grid; gap: .5rem; }
.texto-op, .op { display: flex; gap: .75rem; align-items: flex-start; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; margin-top: .5rem; }
.lista-textos .texto-op { margin-top: 0; }
.texto-op:has(input:checked), .op:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.texto-op input, .op input { margin-top: .3rem; }
.texto-op strong, .op strong { display: block; color: var(--ink); }
.texto-op small, .op small { display: block; color: var(--muted); font-size: .8rem; }
.texto-op small.ok-txt { color: var(--ok); } .texto-op small.warn-txt { color: var(--warn); }
.forma { font-style: normal; font-weight: 500; font-size: .75rem; color: var(--muted); margin-left: .3rem; }
#otros-textos { margin: .6rem 0; }
#otros-textos > summary { color: var(--accent); font-size: .9rem; }
.checks, .radios { display: grid; gap: .1rem; }
.nee-box { margin-top: 1rem; padding: .75rem .9rem; border-radius: 10px; background: var(--ava-soft); }
.nee-box p { margin: .25rem 0 0; }

/* Barra de herramientas de la lectura */
.barra { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.1rem; padding: .6rem 1.1rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.barra .grupo { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.barra .vista { margin-left: auto; }
.reloj { font: 700 1.9rem/1 ui-monospace, "Cascadia Mono", Consolas, monospace; font-variant-numeric: tabular-nums; min-width: 7ch; }
.reloj.alerta { color: var(--bad); }
.modo-tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); padding: .15rem .5rem; border-radius: 99px; }
.contador { font-size: .85rem; color: var(--muted); }
.contador b { font-size: 1.1rem; color: var(--ink); }
.contador.err b { color: var(--bad); }
.segmentado { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmentado label { display: block; cursor: pointer; }
.segmentado input { position: absolute; opacity: 0; pointer-events: none; }
.segmentado span { display: block; padding: .3rem .55rem; font-size: .78rem; color: var(--ink-2); border-left: 1px solid var(--line); }
.segmentado label:first-child span { border-left: 0; }
.segmentado input:checked + span { background: var(--bad-soft); color: var(--bad); font-weight: 700; }
.segmentado input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.tam { min-width: 2.2ch; text-align: center; font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--muted); }
#s-fuente { width: auto; margin: 0; padding: .4rem .5rem; font-size: .85rem; }
.temas { display: inline-flex; gap: 3px; }
.tema-sw { width: 2rem; height: 2rem; border-radius: 6px; border: 2px solid transparent; font: 700 .75rem system-ui, sans-serif; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(128,128,128,.4); }
.tema-sw.on { border-color: var(--accent); }
.sw-claro { background: #ffffff; color: #1a1a1a; } .sw-crema { background: #f7f0dc; color: #2b2418; }
.sw-oscuro { background: #15171c; color: #ececec; } .sw-contraste { background: #000; color: #ffea00; }
.sw-azul { background: #e3eefa; color: #0f2440; } .sw-verde { background: #e6f2e1; color: #173018; }
.seg-manual { display: inline-flex; gap: 3px; }

/* Área de lectura */
.lectura {
  --tam: 38px; --fuente: 'Andika', sans-serif;
  --l-bg: #ffffff; --l-fg: #1a1a1a; --l-err: #ffd6d0; --l-err-line: #c62828; --l-auto: #fff0b3; --l-act: #ffe066; --l-act-fg: #1a1a1a; --l-leida: #7b7b7b; --l-sup: #c62828;
  position: relative; flex: 1; overflow-y: auto; background: var(--l-bg); color: var(--l-fg); transition: background .2s, color .2s;
}
.lectura.tema-crema { --l-bg: #f7f0dc; --l-fg: #2b2418; --l-err: #f3c9bd; --l-auto: #efdf9f; --l-act: #f0cd5a; --l-act-fg: #2b2418; --l-leida: #83775f; }
.lectura.tema-oscuro { --l-bg: #15171c; --l-fg: #ececec; --l-err: #6d2320; --l-err-line: #ff8a80; --l-auto: #5a4a12; --l-act: #3a67b0; --l-act-fg: #ffffff; --l-leida: #8b8f96; --l-sup: #ff8a80; }
.lectura.tema-contraste { --l-bg: #000000; --l-fg: #ffea00; --l-err: #b00020; --l-err-line: #ffffff; --l-auto: #6b5800; --l-act: #ffffff; --l-act-fg: #000000; --l-leida: #9e9200; --l-sup: #ffffff; }
.lectura.tema-azul { --l-bg: #e3eefa; --l-fg: #0f2440; --l-err: #f6cdd1; --l-auto: #faeaaf; --l-act: #ffdf70; --l-act-fg: #0f2440; --l-leida: #5d6f86; }
.lectura.tema-verde { --l-bg: #e6f2e1; --l-fg: #173018; --l-err: #f3cdc6; --l-auto: #f2e5aa; --l-act: #ffdf70; --l-act-fg: #173018; --l-leida: #5f735c; }
.lectura-texto {
  max-width: 34em; margin: 0 auto; padding: 1.2em 1.4em 40vh; font-family: var(--fuente); font-size: var(--tam); line-height: 1.75;
  word-spacing: .06em;
}
.lectura.espaciado .lectura-texto { letter-spacing: .06em; word-spacing: .35em; line-height: 2.1; }
.lectura-texto p { margin: 0 0 .8em; }
.lectura.oculto .lectura-texto { filter: blur(14px); user-select: none; }
.overlay-inicio { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; padding: 1rem; text-align: center; color: var(--l-fg); font-size: 1rem; }
.btn-grande { font: 700 1.6rem system-ui, sans-serif; padding: 1rem 2.5rem; border-radius: 14px; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.lectura .w { cursor: pointer; border-radius: .15em; padding: 0 .04em; position: relative; transition: background .12s, color .12s; }
.lectura .w:hover { box-shadow: 0 0 0 2px var(--l-act); }
.w.err { background: var(--l-err, #fde0dd); text-decoration: line-through; text-decoration-color: var(--l-err-line, #b3261e); text-decoration-thickness: 2px; }
.lectura .w.err[data-tipo]::after { content: attr(data-tipo); position: absolute; top: -.55em; right: -.1em; font: 700 .32em system-ui, sans-serif; color: var(--l-sup); text-transform: uppercase; }
.w.auto { background: var(--l-auto, #fff1c2); text-decoration: underline wavy #9a6200; }
.w.leida { color: var(--l-leida); }
.w.actual { background: var(--l-act); color: var(--l-act-fg); box-shadow: 0 0 0 .08em var(--l-act); }
.w.sug { text-decoration: underline dotted; text-decoration-color: #b3261e; }
.w.no-leida { opacity: .35; }
.w.ultima { outline: 3px solid var(--accent); outline-offset: 2px; }
.m-estado { padding: .5rem 1.1rem; font-size: .88rem; color: var(--ink-2); background: var(--surface-2); border-top: 1px solid var(--line); min-height: 2.2rem; }
.m-estado .w { padding: 0 .2rem; border-radius: 3px; }
.revision { display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; font-size: .9rem; }
.revision .radio { padding: 0; }

/* Resúmenes */
.resumen-vivo { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; margin-bottom: 1.25rem; }
.resumen-vivo.compacto { flex: 1; margin: 0; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.resumen-vivo div { background: var(--surface-2); padding: .55rem .75rem; border-radius: 10px; }
.resumen-vivo b { display: block; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.resumen-vivo span { font-size: .75rem; color: var(--muted); }

/* Registro */
.registro { max-width: 1100px; margin: 0 auto; width: 100%; }
.opciones { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .5rem; }
.opciones .op { margin: 0; }
.rubrica { margin-bottom: 1rem; }
.rubrica > strong { display: block; margin-bottom: .4rem; }
.niveles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.nivel { display: block; cursor: pointer; position: relative; }
.nivel input { position: absolute; opacity: 0; }
.nivel span { display: block; height: 100%; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 10px; }
.nivel b { display: block; font-size: 1.05rem; color: var(--ink); }
.nivel small { color: var(--muted); font-size: .8rem; line-height: 1.35; display: block; }
.nivel input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.nivel input:focus-visible + span { outline: 2px solid var(--accent); }
.pregunta { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.pregunta strong { display: block; margin: .25rem 0 .15rem; color: var(--ink); }
.pregunta small { color: var(--muted); }
.sino { display: flex; gap: .75rem; flex-shrink: 0; }
.sino label { display: flex; gap: .3rem; align-items: center; color: var(--ink); white-space: nowrap; cursor: pointer; }

/* Resultado final */
.final-cabecera { display: flex; gap: 1.25rem; align-items: center; padding: 1.1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1rem; }
.final-cabecera.nv-ini { background: var(--bad-soft); } .final-cabecera.nv-des { background: var(--warn-soft); }
.final-cabecera.nv-ade { background: var(--ok-soft); } .final-cabecera.nv-ava { background: var(--ava-soft); }
.final-cabecera h3 { margin: 0; font-size: 1.6rem; }
.final-cabecera p { margin: .2rem 0 0; }
.final-cabecera small { color: var(--muted); }
.indice { flex-shrink: 0; text-align: center; min-width: 90px; }
.indice b { font-size: 2.8rem; line-height: 1; display: block; font-variant-numeric: tabular-nums; }
.indice span { color: var(--muted); font-size: .85rem; }
.indicadores { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.ind { border: 1px solid var(--line); border-radius: 10px; padding: .75rem .9rem; display: flex; flex-direction: column; gap: .2rem; align-items: flex-start; }
.ind span { font-size: .8rem; color: var(--muted); }
.ind b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }

/* ============================================================ Informe carta */
.barra-informe { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1rem; }
.hoja {
  --ink: #1b1f24; --ink-2: #3f4750; --muted: #666f7a; --line: #d9dde2; --surface: #fff; --surface-2: #f2f4f7;
  --accent: #2f6fbf; --accent-soft: #e6effa; --ok: #1f7a4a; --ok-soft: #e3f3ea; --warn: #8a5800; --warn-soft: #fbf0dc;
  --bad: #b3261e; --bad-soft: #fbe6e4; --ava: #1d4e8f; --ava-soft: #dde8f7;
  color-scheme: light;
  width: 8.5in; max-width: 100%; min-height: 11in; margin: 0 auto; background: #fff; color: var(--ink);
  padding: .6in .65in; box-shadow: 0 2px 16px rgba(0,0,0,.15); font-size: 10.5pt; line-height: 1.45;
}
.hoja-cab { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--ink); padding-bottom: .5rem; }
.hoja-cab p { margin: 0; }
.hoja-cab .inst { font-weight: 700; font-size: 11.5pt; }
.hoja-cab .derecha { text-align: right; }
.hoja-titulo { font-size: 17pt; margin: .9rem 0 .1rem; text-align: center; }
.hoja-sub { text-align: center; color: var(--muted); margin: 0 0 .9rem; }
.ficha-tabla { width: 100%; border-collapse: collapse; margin-bottom: .9rem; font-size: 9.5pt; }
.ficha-tabla th, .ficha-tabla td { border: 1px solid var(--line); padding: .3rem .45rem; text-align: left; vertical-align: top; }
.ficha-tabla th { background: var(--surface-2); width: 15%; font-weight: 600; }
.hoja-sec { margin-bottom: .9rem; break-inside: avoid; }
.hoja h2 { font-size: 11.5pt; margin: 0 0 .45rem; border-bottom: 1px solid var(--line); padding-bottom: .2rem; }
.hoja h3 { font-size: 10pt; margin: .7rem 0 .2rem; }
.resultado-global { display: flex; align-items: center; gap: 1rem; border-radius: 10px; padding: .7rem 1rem; }
.resultado-global.ini { background: var(--bad-soft); } .resultado-global.des { background: var(--warn-soft); }
.resultado-global.ade { background: var(--ok-soft); } .resultado-global.ava { background: var(--ava-soft); }
.resultado-global h2 { border: 0; font-size: 15pt; margin: 0; padding: 0; }
.resultado-global p { margin: 0; font-size: 9.5pt; color: var(--ink-2); }
.resultado-global small { color: var(--muted); }
.resultado-global .indice b { font-size: 26pt; }
.tabla-ind { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
.tabla-ind th, .tabla-ind td { border-bottom: 1px solid var(--line); padding: .32rem .4rem; text-align: left; vertical-align: middle; }
.tabla-ind th { background: var(--surface-2); font-size: 8.5pt; text-transform: uppercase; letter-spacing: .02em; }
.tabla-ind tr.actual td { font-weight: 700; }
.hoja .medidor { margin: 1.9rem 0 1rem; }
.hoja .barras { height: 26px; }
.hoja .marcador { height: 40px; }
.hoja-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.4rem; }
.hoja .tabla-mini { font-size: 9pt; }
.texto-registro { font-family: 'Andika', sans-serif; font-size: 11pt; line-height: 1.85; }
.texto-registro p { margin: 0 0 .5rem; }
.texto-registro sup { font: 700 6.5pt system-ui, sans-serif; color: var(--bad); margin-left: 1px; text-transform: uppercase; }
.leyenda-marcas .w { padding: 0 .25rem; border-radius: 3px; }
.firmas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 2.2rem; text-align: center; font-size: 9pt; color: var(--muted); }
.firmas span { display: block; border-top: 1px solid var(--ink); margin-bottom: .25rem; height: 0; }

/* ============================================================ Responsive */
@media (max-width: 900px) {
  .config-grid { grid-template-columns: minmax(0, 1fr); }
  .barra .vista { margin-left: 0; }
  .m-pasos { display: none; }
}
@media (max-width: 760px) {
  .grid2, .hoja-2col { grid-template-columns: minmax(0, 1fr); }
  .niveles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pregunta { flex-direction: column; align-items: flex-start; }
  .comp { grid-template-columns: 7rem 1fr 2rem; }
  .banda span { display: none; }
  .modal { padding: 0; }
  .modal-caja { border-radius: 0; }
  .segmentado span { padding: .3rem .4rem; font-size: .72rem; }
  .hoja { padding: 1rem; min-height: 0; }
  .tabla .acc { white-space: normal; }
  .menu-pop { width: 240px; }
}

/* ============================================================ Impresión (carta) */
@page { size: letter; margin: 12mm; }
@media print {
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    --bg: #fff; --surface: #fff; --surface-2: #f2f4f7; --ink: #1b1f24; --ink-2: #3f4750; --muted: #666f7a; --line: #d9dde2;
    --accent: #2f6fbf; --accent-ink: #fff; --accent-soft: #e6effa; --ok: #1f7a4a; --ok-soft: #e3f3ea; --warn: #8a5800; --warn-soft: #fbf0dc;
    --bad: #b3261e; --bad-soft: #fbe6e4; --ava: #1d4e8f; --ava-soft: #dde8f7; color-scheme: light;
  }
  .top, .pie, .no-print, .barra-informe, .migas, .acciones-top { display: none !important; }
  body, .pagina-informe { background: #fff; }
  main { padding: 0; max-width: none; }
  .hoja { box-shadow: none; padding: 0; width: auto; min-height: 0; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
