/* Componentes de Estudio sobre tokens.css (traducción del Claude Design a clases; sin estilos en línea). */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: normal;
}
p { line-height: 1.55; }
/* Interfaz = Claude Design (Space Grotesk, sus tamaños). Texto largo (lectura y tarjetas) = Atkinson Hyperlegible. */
h1, h2, h3 { font-weight: 600; line-height: 1.25; margin: 0; }
h1 { font-size: 32px; letter-spacing: -0.02em; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }
p { margin: 0; }
a { color: var(--accent-text); }
a:hover { color: var(--ink); }
code, pre, kbd { font-family: var(--font-num); font-size: .92em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
[hidden] { display: none !important; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--font-num); font-weight: var(--fw-regular); letter-spacing: 0; }
.muted { color: var(--muted); }
.sm { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.pila { display: flex; flex-direction: column; gap: var(--space-4); }
.pila-lg { display: flex; flex-direction: column; gap: 40px; }
.fila { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
/* Logo (hexágono con libro): cada pieza en claro y oscuro; se ve la del tema activo. */
:root:not([data-theme="dark"]) .solo-oscuro, [data-theme="dark"] .solo-claro { display: none; }
.marca-simbolo { display: block; flex-shrink: 0; object-fit: contain; }
.marca-h { display: flex; align-items: center; gap: 10px; min-width: 0; }
.marca-texto { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.marca-nombre { font-family: 'Figtree', var(--font-ui); font-weight: 800; font-size: 22px; line-height: 1; letter-spacing: -0.01em; color: #041326; }
.marca-punto { color: #0668F8; }
.marca-lema { font-family: 'Figtree', var(--font-ui); font-weight: 500; font-size: 10px; line-height: 1.2; letter-spacing: .1em;
  text-transform: uppercase; white-space: nowrap; color: #32343F; }
[data-theme="dark"] .marca-nombre { color: #FEFEFE; }
[data-theme="dark"] .marca-lema { color: #8A93A5; }
.logo-completo { width: 260px; max-width: 100%; height: auto; }

/* ---------- Texto de cabecera ---------- */
.ceja { font-size: var(--fs-eyebrow); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--muted); }
.ceja-acento { color: var(--accent-text); }
.ceja a { color: inherit; text-decoration: none; }
.ceja a:hover { color: var(--ink); }
.contexto { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.55; text-wrap: pretty; }
.cabecera { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cabecera-fila { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.cabecera-fila.centrada { align-items: center; gap: 16px 24px; }
.volver { font-size: 14px; color: var(--muted); text-decoration: none; }
.volver:hover { color: var(--ink); }
.fecha-cabecera { font-family: var(--font-num); font-size: 13px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.h1-grande { font-size: 40px; }
.h1-leccion { font-size: 28px; letter-spacing: -0.015em; }

/* ---------- Botones: uno principal por pantalla ---------- */
.btn, .btn-borde {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--hit-min); padding: 16px 30px; border-radius: 10px;
  font: inherit; font-size: 16px; font-weight: 600;
  text-decoration: none; white-space: nowrap; flex-shrink: 0; cursor: pointer;
}
.btn { border: 0; background: var(--accent); color: var(--accent-ink); }
.btn:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn-grande { padding: 18px 36px; font-size: 18px; }
.btn-lectura { font-size: 17px; }
.btn-borde { padding: 15px 22px; gap: 8px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 15px; font-weight: 400; }
.btn-borde:hover { border-color: var(--muted); color: var(--ink); }
.btn-enlace { border: 0; background: none; padding: 0; font: inherit; color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.btn-enlace:hover { color: var(--ink); }
.btn-sm { min-height: 36px; padding: 10px 16px; font-size: 14px; }
.btn-ancho { width: 100%; }
.btn[disabled], .btn-borde[disabled] { opacity: .5; cursor: not-allowed; filter: none; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px 32px; }
.card-lg { padding: 36px 40px; }
.card-hundida { background: var(--sunk); border-radius: 8px; padding: 22px 24px; }

/* ---------- Métricas (máx. 4 por pantalla) ---------- */
.metricas { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.metrica { border: 1px solid var(--line); border-radius: 10px; padding: 24px;
  display: flex; flex-direction: column; gap: 8px; color: var(--ink); text-decoration: none; }
a.metrica:hover { border-color: var(--muted); color: var(--ink); }
.metrica-etiqueta { font-size: 13px; color: var(--muted); }
.metrica-cifra { font-family: var(--font-num); font-size: 34px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.2; }
.metrica-pie { font-size: 13px; color: var(--muted); }

/* ---------- Barras de progreso ---------- */
progress.barra { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 4px; border: 0; border-radius: var(--radius-pill); background: var(--sunk); overflow: hidden; }
progress.barra::-webkit-progress-bar { background: var(--sunk); border-radius: var(--radius-pill); }
progress.barra::-webkit-progress-value { background: var(--accent); border-radius: var(--radius-pill); }
progress.barra::-moz-progress-bar { background: var(--accent); border-radius: var(--radius-pill); }
progress.barra-gruesa { height: 6px; }

/* ---------- Listas de filas (fechas, lecciones) ---------- */
.lista { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lista > li { display: grid; grid-template-columns: 80px minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: 18px 24px; }
.lista > li + li { border-top: 1px solid var(--line); }
.lista .fecha { font-family: var(--font-num); font-size: 13px; color: var(--muted); text-transform: uppercase; }
.lista .titulo { font-size: 15px; font-weight: 500; }
.lista .sub { display: block; margin-top: 3px; font-size: 13px; color: var(--muted); }
.lista .dias { justify-self: end; font-family: var(--font-num); font-size: 13px; white-space: nowrap; }

/* ---------- Segmentado y chips ---------- */
.segmentado { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--sunk); }
.segmentado > a, .segmentado > span, .segmentado > button { padding: 9px 14px; border: 0; border-radius: 8px; background: transparent;
  font: inherit; font-size: 14px; color: var(--muted); text-decoration: none; white-space: nowrap; cursor: pointer; }
.segmentado > a:hover, .segmentado > button:hover { color: var(--ink); }
.segmentado > .activo, .segmentado > [aria-current] { background: var(--surface); color: var(--ink); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.chip-activo { border-color: transparent; background: var(--accent-soft); color: var(--accent-text); font-weight: var(--fw-semibold); }
.chip-hecho { color: var(--ink); }
.etiqueta-num { font-family: var(--font-num); font-size: 13px; padding: 3px 8px; border-radius: 6px; background: var(--sunk); color: var(--ink); white-space: nowrap; }

/* ---------- Plegables (secundario, cerrado por defecto) ---------- */
details.plegable { border-top: var(--border); padding-top: var(--space-4); }
details.plegable > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: var(--space-2); font-weight: var(--fw-medium); color: var(--muted); }
details.plegable > summary::-webkit-details-marker { display: none; }
details.plegable > summary::before { content: "+"; font-family: var(--font-num); width: 1em; }
details.plegable[open] > summary::before { content: "−"; }
details.plegable[open] > summary { margin-bottom: var(--space-4); color: var(--ink); }

/* ---------- Formularios ---------- */
.campo { display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.campo input, .campo textarea, .campo select, .entrada {
  width: 100%; padding: 14px 16px; border: var(--border); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-body); font-weight: var(--fw-regular);
}
.campo textarea, textarea.entrada { resize: vertical; min-height: 7rem; line-height: var(--lh-body); }
/* Grupos de opciones con título ("Tipo", "Cuántas preguntas", "Modo"…): sin el borde del navegador; el título, como
   la etiqueta de un campo más. */
fieldset.mini-pregunta { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); }
fieldset.mini-pregunta > legend { padding: 0; margin-bottom: var(--space-2); font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--ink); }
.ayuda { font-size: var(--fs-xs); color: var(--muted); font-weight: var(--fw-regular); }

/* ---------- Avisos y estados ---------- */
.aviso { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) var(--space-5); border: var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-lg); background: var(--surface); }
.aviso-error { border-left-color: var(--danger); background: var(--danger-soft); }
.aviso-ok { border-left-color: var(--ok); }
.aviso strong { font-weight: var(--fw-semibold); }
.texto-ok { color: var(--ok); }
.texto-error { color: var(--danger); }

/* ---------- Login ---------- */
.acceso { min-height: 100dvh; display: grid; place-items: center; padding: 40px 24px; position: relative; }
.acceso-tema { position: absolute; top: 24px; right: 24px; }
.acceso-caja { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: var(--space-10); }
.marca-grande { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.acceso form { display: flex; flex-direction: column; gap: 18px; }
.acceso .btn { margin-top: 10px; }
.acceso-pie { text-align: center; font-size: var(--fs-sm); }
.acceso-pie a { color: var(--muted); }

@media (max-width: 820px) {
  .lista > li { grid-template-columns: 80px minmax(0, 1fr) auto; gap: 12px; padding: 18px 20px; }
}
pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }

/* ---------- Estructura: barra lateral (escritorio) + barra inferior (móvil) ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100dvh; }
.pagina { padding: 48px 64px 80px; max-width: 1180px; width: 100%; margin-inline: auto; display: flex; flex-direction: column; }

.lateral { position: sticky; top: 0; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 32px;
  padding: 28px 16px 20px; background: var(--surface); border-right: 1px solid var(--line); }
.lateral-marca { display: block; padding: 0 4px; text-decoration: none; }
.lateral-cabeza { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 8px; }
.lateral-arriba { display: flex; flex-direction: column; gap: 6px; }
.lateral-marca .marca-simbolo { width: 40px; height: 40px; }
/* Tres espacios: en la barra lateral, uno debajo de otro (en fila no caben los nombres) */
.lateral-espacio { display: grid; grid-template-columns: minmax(0, 1fr); }
.lateral-espacio { padding: 3px; gap: 2px; }
.lateral-espacio button { font-size: 13px; padding: 7px 10px; border-radius: 8px; text-align: left; }
.segmentado.lateral-espacio > button.espacio-cerrado { justify-content: flex-start; }
/* Espacio sin acceso: candado y texto apagado (al pulsarlo, Disponible con suscripción) */
.segmentado > button.espacio-cerrado { display: inline-flex; align-items: center; justify-content: center; gap: 4px; opacity: .7; }
.espacio-cerrado .icono { width: 12px; height: 12px; flex: none; }
/* Espacio "próximamente" (Idiomas): desactivado, borde discontinuo como "Nueva formación · Próximamente" */
.segmentado > button.espacio-proximamente { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px dashed var(--line); color: var(--muted); cursor: not-allowed; }
.espacio-proximamente small { font-size: 11px; }
.segmentado.lateral-espacio > button.espacio-proximamente { justify-content: flex-start; }
.lateral-nav { display: flex; flex-direction: column; gap: 2px; }
.lateral-nav a, .lateral-pie a, .lateral-mas summary { display: flex; align-items: center; padding: 8px 10px; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 400; }
.lateral-nav > a:first-child { padding: 9px 10px; margin-bottom: 22px; font-size: 15px; font-weight: 500; }
.lateral-nav a:hover, .lateral-pie a:hover, .lateral-mas summary:hover { background: var(--sunk); color: var(--ink); }
.lateral-nav a.activo, .lateral-pie a.activo { background: var(--accent-soft); color: var(--ink); }
/* Cursos del espacio en el menú (entre Inicio y lo de todo el espacio) */
.lateral-grupo { margin: 18px 0 4px; padding: 0 10px; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.lateral-nav a.lateral-curso { justify-content: space-between; gap: 8px; }
.lateral-curso small { font-size: 12px; font-weight: 400; color: var(--muted); }
.lateral-curso.bloqueado { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; color: var(--muted); cursor: default; }
.lateral-curso .icono, .movil-bloqueado .icono { width: 14px; height: 14px; }
.espacio-movil { display: none; }
/* "Ordenar por" de los cursos (menú lateral, hoja de Cursos del móvil e Inicio de Mentorías) */
.ordenar-cursos { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.ordenar-cursos select { min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; font-size: 13px; }
.ordenar-lateral { padding: 0 10px 6px; }
.ordenar-lateral select { flex: 1; }
.ordenar-pantalla select { flex: 1; font-size: 16px; min-height: 40px; }
.fila-cursos { flex-wrap: wrap; gap: 8px 16px; }
/* Áreas de los cursos (Mentorías): rótulo en el Inicio y, con "Ordenar por · Área", en el menú */
.grupo-area { margin: var(--space-4) 0 var(--space-2); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lateral-area { margin: 8px 0 2px; padding: 0 10px; font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--muted); }
.movil-area { margin: 8px 0 0; padding: 0 12px; font-size: 12px; font-weight: 600; color: var(--muted); }
.selector-tutor { align-items: flex-end; gap: var(--space-3); flex-wrap: wrap; }
.selector-tutor .campo { flex: 1; min-width: 220px; }
.grupo-curso { margin: var(--space-6) 0 0; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
/* Miga de pan de las pantallas de curso: "1º DAM › Programación › Lección 1" */
.miga { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.miga a { color: var(--muted); text-decoration: none; }
.miga a:hover { color: var(--ink); text-decoration: underline; }
.miga-sep { opacity: .55; }
.miga [aria-current] { color: var(--ink); font-weight: 600; }
.lateral-mas { margin-top: 22px; }
.lateral-mas summary { cursor: pointer; list-style: none; padding: 0 10px 8px; color: var(--muted); justify-content: space-between;
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.lateral-mas summary:hover { background: none; }
.lateral-mas summary::-webkit-details-marker { display: none; }
.lateral-mas summary::after { content: "+"; font-family: var(--font-num); }
.lateral-mas[open] summary::after { content: "−"; }
.lateral-mas a { font-size: 14px; padding: 7px 10px; }
.lateral-pie { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 16px; border-top: 1px solid var(--line); }
.lateral-pie .chip { align-self: flex-start; margin: 0 10px var(--space-2); }

.interruptor-tema { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; text-align: left; width: 100%; }
.interruptor-tema:hover { background: var(--sunk); }
.interruptor { position: relative; display: block; width: 28px; height: 16px; border-radius: 8px; background: var(--sunk); border: var(--border); }
.interruptor span { position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 5px; background: var(--accent); transition: left .15s; }
[data-theme="dark"] .interruptor span { left: 14px; }

.barra-movil { display: none; }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  /* 4 espacios: rejilla de 2 × 2 (en 4 columnas no se leen los nombres a 380 px) */
  .espacio-movil { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 10px 16px 0; }
  .espacio-movil button { padding: 9px 4px; font-size: 13px; }
  .lateral { display: none; }
  .pagina { padding: 28px 20px 88px; padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .barra-movil { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: var(--border); }
  .barra-movil > a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px;
    color: var(--muted); text-decoration: none; font-size: 11px; font-weight: var(--fw-medium); border-radius: var(--radius-md); }
  .barra-movil > a.activo { color: var(--accent-text); }
  .barra-movil > a.activo .icono { stroke-width: 2.2; }
}

/* "Cursos" y "Más" como pantallas propias (/cursos, /mas): una lista, sin nada encima de la página. */
.lista-nav { display: flex; flex-direction: column; gap: 2px; padding: var(--space-2); background: var(--surface); border: var(--border);
  border-radius: var(--radius-lg); }
.lista-nav > a { display: flex; align-items: center; gap: 10px; min-height: var(--hit-min); padding: 8px 12px; border-radius: var(--radius-md);
  color: var(--ink); text-decoration: none; }
.lista-nav > a:hover { background: var(--sunk); }
.lista-nav .interruptor-tema { min-height: var(--hit-min); padding: 8px 12px; }
.movil-bloqueado { display: flex; align-items: center; gap: 8px; min-height: var(--hit-min); padding: 8px 12px; color: var(--muted); }

/* ---------- Utilidades de pantalla ---------- */
.fila-entre { justify-content: space-between; flex-wrap: nowrap; }
.h3 { font-size: var(--fs-h3); }
.centrado { text-align: center; }
.acciones { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.titulo-bloque { display: block; font-weight: 600; font-size: 18px; }
.sub { display: block; }
.lista-simple { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: var(--space-2); }
.aviso-conexion { margin-bottom: var(--space-6); }

/* ---------- Inicio ---------- */
.inicio { gap: 56px; }
.inicio > .cabecera { gap: 10px; }
.seccion { display: flex; flex-direction: column; gap: 20px; }
.hoy-toca { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 28px 32px; }
.hoy-toca-texto { display: flex; flex-direction: column; gap: 14px; flex: 1 1 320px; min-width: 0; }
.hoy-toca h2 { font-size: 30px; letter-spacing: -0.015em; }
.hoy-toca-motivo { margin: 0; font-size: 16px; line-height: 1.55; color: var(--muted); max-width: 52ch; text-wrap: pretty; }
.hoy-toca-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 14px; color: var(--muted); }
.rejilla-modulos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.modulo-card { display: flex; flex-direction: column; gap: 18px; padding: 20px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; color: var(--ink); text-decoration: none; }
.modulo-card:hover { border-color: var(--muted); color: var(--ink); }
.modulo-card-cabecera { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.modulo-nombre { font-size: 15px; font-weight: 500; }
.modulo-dato { font-family: var(--font-num); font-size: 14px; color: var(--muted); white-space: nowrap; }
.barra-fina { display: block; height: 4px; border-radius: 2px; background: var(--sunk); overflow: hidden; }
.barra-fina > span { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.curso-bloqueado { color: var(--muted); }

/* ---------- Módulo ---------- */
.lista-lecciones > li, .lista-preguntas > li { grid-template-columns: 2rem minmax(0, 1fr) auto; }
.leccion-fila a { color: var(--ink); text-decoration: none; font-weight: var(--fw-medium); }
.leccion-fila a:hover { color: var(--accent-text); }
.leccion-fila.disponible { background: var(--accent-soft); }
.leccion-fila.disponible:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.leccion-fila.bloqueada, .leccion-fila.por_fecha { color: var(--muted); }
.lista-preguntas a { color: var(--ink); }

/* ---------- Lección (Design: Leccion Paso 1-3) ---------- */
.leccion-meta { margin: 0; font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
/* Pestañas de la lección: barra al ancho del contenido, justo encima; la activa subrayada, las bloqueadas con candado. */
.leccion-marco { width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.marco-lectura { max-width: var(--reading-width); }
.marco-tarjetas { max-width: 640px; }
.marco-repaso { max-width: 700px; }
.marco-tarea { max-width: 760px; }
.pestanas { display: flex; gap: 28px; box-shadow: inset 0 -1px 0 var(--line); font-size: var(--fs-body); }
.pestana { display: inline-flex; align-items: center; gap: 6px; padding: 12px 0 10px; white-space: nowrap;
  border-bottom: 2px solid transparent; color: var(--muted); text-decoration: none; }
a.pestana:hover { color: var(--ink); border-bottom-color: var(--line); }
.pestana.vista, a.pestana.vista:hover { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.pestana.bloqueada { cursor: not-allowed; opacity: .6; }
.pestana-hecha { color: var(--ok); font-weight: 600; }
.candado { display: block; flex-shrink: 0; }
.zona { width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.zona-tarjetas { max-width: 640px; }
.zona-repaso { max-width: 700px; }
.zona-tarea { max-width: 760px; gap: 28px; }
.zona-lectura { max-width: var(--reading-width); gap: 36px; }
.zona-form { display: flex; flex-direction: column; gap: 24px; }
.pie-zona { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.pie-zona .volver { font-size: 15px; }
.tarjeta-progreso { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.puntos { display: flex; flex-wrap: wrap; gap: 5px; }
.punto-t { display: block; width: 6px; height: 6px; border-radius: 3px; background: var(--line); }
.punto-t.hecho { background: var(--accent); }
.punto-t.actual { width: 20px; background: var(--accent); }
.tarjeta-cuenta { font-size: 13px; color: var(--muted); white-space: nowrap; }
.tarjeta { display: flex; flex-direction: column; gap: 20px; }
.texto-tarjeta { margin: 0; font-family: var(--font-text); font-size: 18px; line-height: 1.7; color: var(--ink); text-wrap: pretty; }
.texto-tarjeta strong { color: var(--accent-text); font-weight: 700; }
.pregunta-tarjeta { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 20px 0 0; border: 0; border-top: 1px solid var(--line); min-width: 0; }
.pregunta-tarjeta fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.pregunta-tarjeta > .btn-borde { align-self: flex-start; padding: 10px 18px; }
.pregunta-tarjeta legend, .pregunta-tarjeta-texto { float: left; width: 100%; padding: 0; margin: 0 0 14px; font-size: 15px; font-weight: 400; color: var(--muted); }
.pregunta-tarjeta-texto { float: none; margin: 0; }
.pregunta-tarjeta legend + * { clear: both; }
/* Tarjeta en fase "pregunta": la idea no está, así que la pregunta es el texto principal. */
.pregunta-sola { padding-top: 0; border-top: 0; }
.pregunta-sola legend { font-family: var(--font-text); font-size: 18px; line-height: 1.6; color: var(--ink); }
.opciones { display: flex; flex-direction: column; gap: 8px; }
.opciones-repaso { margin: 0; padding: 0; border: 0; min-width: 0; }
.repasos-hoy strong { color: var(--ink); }
.opcion { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); cursor: pointer; font-size: 16px; text-align: left; }
.opcion:hover { border-color: var(--muted); }
.opcion:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opcion input { accent-color: var(--accent); margin: 0; flex-shrink: 0; }
.opcion:has(.opcion-letra) { position: relative; }
.opcion:has(.opcion-letra) input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.opcion:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.opcion-letra { font-family: var(--font-num); font-size: 13px; opacity: 0.8; }
fieldset.pregunta-repaso { display: flex; flex-direction: column; gap: 18px; margin: 0; min-width: 0; }
.enunciado-repaso { margin: 0; font-size: 20px; font-weight: 500; line-height: 1.4; }
.entrada-repaso { min-height: 120px; background: var(--bg); line-height: 1.6; }
.nota-grande { display: flex; align-items: baseline; gap: 4px; font-size: 48px; font-weight: 500; letter-spacing: -0.03em; line-height: 1; color: var(--accent-text); white-space: nowrap; }
.nota-de { font-size: 16px; color: var(--muted); letter-spacing: 0; }
.correccion { display: flex; flex-direction: column; gap: 28px; }
.correccion-cabecera { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.correccion-nivel { font-size: 18px; font-weight: 500; }
.criterios { display: flex; flex-direction: column; }
.criterio { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 20px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); font-size: 15px; }
.criterio-nota { justify-self: end; font-size: 14px; white-space: nowrap; }
.criterio-barra { grid-column: 1 / -1; }
.criterio-comentario { grid-column: 1 / -1; margin: 0; font-size: 14px; color: var(--muted); line-height: 1.5; }
.pila-sm { display: flex; flex-direction: column; gap: 12px; }
.titulo-hundida { font-size: 15px; font-weight: 600; }
.card-hundida p { margin: 0; font-size: 15px; line-height: 1.55; }
.resultado { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.resultado li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 15px; }
.enunciado-tarea { display: flex; flex-direction: column; gap: 12px; }
/* Enunciado de tarea: markdown con la letra de lectura (como Leer), no un título. */
.enunciado { text-wrap: pretty; }
.enunciado > :last-child { margin-bottom: 0; }
.respuesta-tarea { display: flex; flex-direction: column; gap: 12px; }
.entrada-tarea { min-height: 190px; padding: 20px 22px; line-height: 1.6; }
.contador { font-size: 12px; color: var(--muted); }
.leccion-hecha { flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; }
textarea.codigo { font-family: var(--font-num); font-size: 14px; }

/* ---------- Lectura (Design: Lectura Tema) + legibilidad: Atkinson 18/16 px, interlineado 1,7 ---------- */
.lectura-barra { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.tiempo-lectura { font-family: var(--font-num); font-size: 13px; color: var(--muted); }
.lectura-texto { font-family: var(--font-text); font-size: 18px; line-height: 1.7; color: var(--ink); overflow-wrap: break-word; } /* URLs largas: se parten en vez de ensanchar la página */
.lectura-texto h1, .lectura-texto h2, .lectura-texto h3, .lectura-texto h4 { font-family: var(--font-ui); }
.lectura-texto h2 { font-size: 22px; letter-spacing: -0.01em; margin: 36px 0 12px; }
.lectura-texto h3 { font-size: 19px; margin: 28px 0 10px; }
.lectura-texto > :first-child { margin-top: 0; }
.lectura-texto p, .lectura-texto ul, .lectura-texto ol { margin: 0 0 16px; }
.lectura-texto strong { font-weight: 700; }
.lectura-texto li::marker { color: var(--accent); }
.lectura-texto pre { margin: 0 0 16px; padding: 18px 20px; border-radius: 8px; background: var(--sunk); font-size: 14px; line-height: 1.7; overflow-x: auto; }
.pie-lectura { padding-top: 12px; border-top: 1px solid var(--line); }
.pie-lectura .btn { margin-top: 24px; }
.md code { background: var(--sunk); padding: 1px 5px; border-radius: 4px; }

/* ---------- Tutor ---------- */
.tutor { max-width: 760px; }
.chat { display: flex; flex-direction: column; gap: var(--space-3); }
.msg { max-width: 88%; padding: 12px 16px; border-radius: var(--radius-lg); line-height: var(--lh-body); }
.msg.user { align-self: flex-end; background: var(--accent-soft); }
.msg.assistant { align-self: flex-start; background: var(--surface); border: var(--border); }

@media (max-width: 820px) {

  .texto-tarjeta, .lectura-texto, .texto-libreta, .pregunta-sola legend { font-size: 16px; }

  .nota-grande { font-size: 40px; }
  .acciones > .btn, .acciones > .btn-borde { flex: 1 1 100%; }
  /* Las pestañas en una fila; si no caben, la barra se desliza. */
  .pestanas { gap: 20px; overflow-x: auto; scrollbar-width: none; }
  .pestanas.desborda { -webkit-mask-image: linear-gradient(to right, #000 80%, transparent); mask-image: linear-gradient(to right, #000 80%, transparent); }
  .pie-lectura.accion-fija { padding-top: var(--space-2); }
  .pie-lectura.accion-fija .btn { margin-top: 0; width: 100%; }
}

/* Acción principal siempre a la vista en móvil (regla 0.7): se pega encima de la barra inferior. */
@media (max-width: 820px) {
  .accion-fija { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 5; padding: var(--space-2) 0; background: var(--bg); }
  /* El botón fijo nunca tapa el campo en el que escribes: al enfocar o desplazarse a un campo, se deja sitio abajo para
     la barra inferior y el botón (también con el teclado abierto; ver app.js). */
  html { scroll-padding-bottom: calc(160px + env(safe-area-inset-bottom)); scroll-padding-top: 72px; }  /* arriba: la barra fija */
  .card .accion-fija { background: var(--surface); }
  .acciones > .accion-fija { flex: 1 1 100%; }
}


@media (min-width: 821px) { .accion-fija .btn-ancho { width: auto; } }
.criterio .num { white-space: nowrap; }

/* ---------- Piscina ---------- */
.formulario-corto { max-width: 640px; }
.lista > li.lista-fila-simple { display: block; }
.lista > li.lista-grupo { background: var(--sunk); padding-top: var(--space-2); padding-bottom: var(--space-2); }
.lista details > summary { cursor: pointer; }

/* ---------- Herramientas ---------- */
.rejilla-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--space-3); }
.segmentado-radio { display: inline-grid; grid-auto-flow: column; }
.segmentado-radio label { position: relative; display: block; cursor: pointer; }
.segmentado-radio input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmentado-radio span { display: block; padding: 8px 18px; border-radius: var(--radius-md); color: var(--muted); font-weight: var(--fw-medium); }
.segmentado-radio input:checked + span { background: var(--surface); color: var(--ink); }
.segmentado-radio input:focus-visible + span { outline: 2px solid var(--accent); }
.lista-desnuda { list-style: none; margin: 0; padding: 0; }
.opcion-correcta { border-color: var(--ok); }
.opcion-fallada { border-color: var(--danger); background: var(--danger-soft); }
.metrica-texto { font-family: var(--font-ui); font-size: var(--fs-h3); font-weight: var(--fw-semibold); }
.metricas-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lista-sin-puntos { list-style: none; padding: 0; }
.enlace-card { color: var(--ink); text-decoration: none; }
.enlace-card:hover { border-color: var(--muted); color: var(--ink); }
details.plegable-card > summary { cursor: pointer; list-style: none; }
details.plegable-card > summary::-webkit-details-marker { display: none; }
details.plegable-card[open] > summary { margin-bottom: var(--space-4); }

.temporizador { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.temporizador .reloj { font-size: clamp(40px, 10vw, 64px); margin: 0; }
.temporizador .acciones { justify-content: center; }
.guia-destacada { border-left: 4px solid var(--accent); }
.texto-libreta { margin: 0; font-family: var(--font-text); font-size: 18px; line-height: 1.7; }
.reloj { font-size: clamp(56px, 14vw, 120px); line-height: 1; text-align: center; letter-spacing: -0.02em; margin: var(--space-4) 0; }
.enfoque:fullscreen { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: var(--space-8);
  border: 0; border-radius: 0; background: var(--bg); padding: var(--space-8); }
.enfoque:fullscreen .reloj { font-size: clamp(80px, 22vw, 220px); }
.enfoque:fullscreen .accion-fija { position: static; background: none; width: min(420px, 100%); }

.dias-racha { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-2); }
.dias-racha li { display: flex; flex-direction: column; gap: 6px; padding: var(--space-2); border: var(--border); border-radius: var(--radius-md); background: var(--surface); }
.dias-racha li.activo { border-color: var(--accent); }
.dias-racha li.hoy { background: var(--accent-soft); }

.dia-calendario h2 { margin: 0; }
.lista > li.cal-entrega { border-left: 3px solid var(--accent); }
.lista > li.cal-examen { border-left: 3px solid var(--danger); }
.lista > li.cal-bloque { border-left: 3px solid var(--muted); }
.lista > li.cal-hecho .titulo { text-decoration: line-through; color: var(--muted); }
.lista > li.cal-saltado .titulo { color: var(--muted); }
.leyenda { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-4); }
.leyenda li { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); }
/* Un punto por tipo (leyenda y rejilla del mes): entrega = acento; examen = aro de acento; tutoría = gris con borde;
   hito = gris; bloque de estudio = acento suave (con borde, para verse sobre el día seleccionado). */
.punto { width: 10px; height: 10px; border-radius: 50%; background: var(--line); display: inline-block; flex-shrink: 0; }
.punto.cal-entrega { background: var(--accent); }
.punto.cal-examen { background: transparent; box-shadow: inset 0 0 0 2px var(--accent); }
.punto.cal-tutoria { background: var(--sunk); box-shadow: inset 0 0 0 1px var(--muted); }
.punto.cal-hito { background: var(--muted); }
.punto.cal-bloque { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.texto-acento { color: var(--accent-text); }

/* ---------- Calendario: mes + día ---------- */
.cal { display: flex; flex-direction: column; gap: 12px; }
.cal-nav { display: flex; align-items: center; gap: 12px; }
.cal-titulo { margin: 0; min-width: 10ch; text-align: center; font-size: 20px; }
.cal-flecha { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--line);
  border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 22px; line-height: 1; }
.cal-flecha:hover { border-color: var(--muted); color: var(--ink); }
.cal-ir-hoy { margin-left: auto; }
.cal-por-confirmar { margin: 0; }
.cal-mes { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; background: var(--surface); }
.cal-semana { padding: 10px 12px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.cal-dia { min-width: 0; min-height: 104px; display: flex; flex-direction: column; gap: 6px; padding: 8px 10px;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.cal-dia:nth-child(7n) { border-right: 0; }
.cal-dia:hover { background: var(--sunk); color: var(--ink); }
.cal-dia.fuera { color: var(--muted); }
.cal-dia.fuera .cal-num, .cal-dia.fuera .cal-titulos { opacity: .55; }
.cal-dia.sel, .cal-dia.sel:hover { background: var(--accent-soft); }
.cal-num { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
  font-family: var(--font-num); font-size: 12px; }
.cal-dia.hoy .cal-num { color: var(--accent-text); font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-puntos { display: flex; flex-wrap: wrap; gap: 4px; }
.cal-puntos .punto { width: 8px; height: 8px; }
.cal-titulos { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-chip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 6px; border-radius: 5px;
  font-size: 11px; line-height: 1.3; }
.cal-chip.cal-entrega { background: var(--accent); color: var(--accent-ink); }
.cal-chip.cal-examen { box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent-text); }
.cal-chip.cal-tutoria { background: var(--sunk); box-shadow: inset 0 0 0 1px var(--line); }
.cal-chip.cal-hito { background: var(--sunk); color: var(--muted); }
.cal-chip.cal-bloque { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
/* Entregas: solo el módulo, hasta 2 líneas (el día crece en alto si hace falta). */
.cal-chip.cal-entrega { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
/* "+N": aspecto de enlace; el día entero enlaza a su detalle. */
.cal-mas { align-self: flex-start; font-size: 11px; font-weight: 600; line-height: 1.3; color: var(--accent-text);
  text-decoration: underline; text-underline-offset: 2px; }
.cal-dia:hover .cal-mas { color: var(--ink); }
.cal-mas-estrecho { display: none; }
.dia-calendario { scroll-margin-top: 16px; }
@media (max-width: 820px) {
  .cal-semana { padding: 8px 0; text-align: center; }
  .cal-dia { min-height: 80px; padding: 6px 5px; gap: 4px; }
  .cal-num { align-self: center; }
  .cal-puntos { justify-content: center; gap: 3px; }
  .cal-puntos .punto { width: 6px; height: 6px; }
  .cal-chip { padding: 2px 4px; font-size: 10.5px; }
  .cal-titulo { font-size: 18px; }
  .dia-calendario { scroll-margin-top: 72px; }
}
@media (max-width: 599px) {
  /* Estrecho (móvil): número, un punto por entrega, examen o hito, y "+N" con tutorías y bloques. */
  .cal-titulos, .punto-agrupable { display: none; }
  .cal-mas-estrecho { display: inline; align-self: center; font-size: 10px; }
  .cal-dia { min-height: 54px; padding: 6px 2px; align-items: center; }
  .cal-puntos { align-items: center; }
}

.interruptor-fila { display: flex; align-items: flex-start; gap: var(--space-3); cursor: pointer; }
.interruptor-fila input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.apunte-texto { min-height: 50dvh; font-family: var(--font-num); font-size: var(--fs-sm); line-height: 1.7; }

/* ---------- Oposiciones ---------- */
.casillas { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.casilla { display: flex; align-items: center; gap: var(--space-3); padding: 10px 12px; border: var(--border); border-radius: var(--radius-md); font-size: var(--fs-sm); }
.casilla::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); }
.casilla a { color: var(--ink); text-decoration: none; font-weight: var(--fw-medium); }
.casilla.completada::before { background: var(--ok); border-color: var(--ok); }
.casilla.disponible { background: var(--accent-soft); border-color: transparent; }
.casilla.disponible::before { border-color: var(--accent); }
.casilla.bloqueada, .casilla.por_fecha { color: var(--muted); }
.casilla-minitest::before { border-radius: 2px; }
.casilla-jefe { font-weight: var(--fw-semibold); }
.casilla-jefe::before { border-radius: 2px; transform: rotate(45deg); }

.segmentado-scroll { display: flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmentado-scroll > * { flex: none; }

.tabla-temario { background: var(--surface); border: var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.tabla-fila { display: grid; grid-template-columns: minmax(0, 1fr) 4rem 8rem 5rem; gap: var(--space-4); align-items: center; padding: var(--space-3) var(--space-6); color: var(--ink); text-decoration: none; }
.tabla-fila + .tabla-fila { border-top: var(--border); }
a.tabla-fila:hover { background: var(--sunk); }
.tabla-cabecera { font-size: var(--fs-sm); color: var(--muted); background: var(--sunk); }
.tabla-fila > :last-child { text-align: right; }

.lista > li.lista-dato { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--space-1) var(--space-4); }
.lista > li.lista-dato > :first-child { flex: 1 1 12rem; min-width: 0; }
.lista > li.lista-dato > :last-child { margin-left: auto; text-align: right; overflow-wrap: anywhere; }
.baremo { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 2px var(--space-4); font-size: var(--fs-sm); }
.baremo li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: var(--border); }

@media (max-width: 820px) {
  .tabla-fila { grid-template-columns: minmax(0, 1fr) auto; padding: var(--space-3) var(--space-4); }
  .tabla-fila > :nth-child(2), .tabla-cabecera > :nth-child(3) { display: none; }
  .tabla-fila > :nth-child(3) { grid-row: 2; grid-column: 1; }
  .tabla-fila > :last-child { grid-row: 1 / 3; grid-column: 2; }
  .tabla-cabecera { display: none; }
}
.chip-xs { padding: 1px 8px; font-size: var(--fs-xs); }
.casilla.sin_preguntas { border-style: dashed; color: var(--muted); }
.casilla.sin_preguntas a { color: var(--muted); font-weight: var(--fw-regular, 400); }
.pie-legal { margin-top: var(--space-6); padding-top: var(--space-4); border-top: var(--border); }
.aviso-legal { margin: 0; line-height: 1.5; }
.aviso-ley { display: grid; gap: var(--space-1); border-left: 3px solid var(--danger); }
.aviso-ley a { color: inherit; }
.chip-ley { border-color: var(--danger); color: var(--danger); }

/* ---------- Markdown del contenido: resaltado, cajas, tablas y esquemas (solo formato) ---------- */
/* Sin relleno lateral: el resaltado no deja hueco antes de la puntuación ("bit," y no "bit ,"). */
.md mark, .texto-tarjeta mark { background: var(--accent-soft); color: var(--ink); padding: 0; border-radius: 2px; }
.md h2, .md h3, .md h4 { margin: var(--space-8) 0 var(--space-3); }
.md h3 { font-size: var(--fs-body-lg); }
.md blockquote { margin: 0 0 var(--space-5); padding: var(--space-3) var(--space-4); border-left: 3px solid var(--line); background: var(--surface); border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.md blockquote > :last-child { margin-bottom: 0; }
.md .caja { border-left-width: 4px; }
.md .caja-titulo { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); font-weight: var(--fw-semibold); }
.md .caja-titulo::before { content: "i"; display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%;
  font-family: var(--font-num); font-size: 13px; font-weight: 700; color: var(--accent-ink); background: var(--muted); }
.md .caja-ejemplo { border-left-color: var(--ok); }
.md .caja-ejemplo .caja-titulo::before { content: "✎"; background: var(--ok); }
.md .caja-ojo { border-left-color: var(--danger); background: var(--danger-soft); }
.md .caja-ojo .caja-titulo::before { content: "!"; background: var(--danger); }
.md .caja-clave { border-left-color: var(--accent); background: var(--accent-soft); }
.md .caja-clave mark { background: color-mix(in srgb, var(--accent) 22%, var(--accent-soft)); }
.md .caja-clave .caja-titulo::before { content: "★"; background: var(--accent); }
.tabla-scroll { overflow-x: auto; margin: 0 0 var(--space-5); border: var(--border); border-radius: var(--radius-md); -webkit-overflow-scrolling: touch; }
.tabla-scroll table { border-collapse: collapse; width: 100%; min-width: 28rem; font-size: .94em; line-height: 1.5; }
.tabla-scroll th, .tabla-scroll td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: var(--border); }
.tabla-scroll th { background: var(--sunk); font-weight: 700; }
.tabla-sin-cabecera thead { display: none; } /* cabecera con todas las celdas vacías: ni franja ni borde */
.tabla-scroll tr:last-child td { border-bottom: 0; }
.tabla-scroll tbody tr:nth-child(even) td { background: var(--surface); }
.esquema { display: flex; flex-direction: column; gap: var(--space-2); margin: 0 0 var(--space-5); }
.esquema-fila { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.esquema-paso { padding: 4px 12px; border: var(--border); border-radius: var(--radius-pill); background: var(--surface); line-height: 1.4; }
.esquema-flecha { color: var(--accent-text); font-weight: 700; }
.md ul, .md ol { padding-left: 1.4em; }
.md li + li { margin-top: var(--space-1); }

/* ---------- Módulo (Design: Modulo.dc.html) ---------- */
.cifras-cabecera { display: flex; gap: 36px; }
.cifra-cabecera { display: flex; flex-direction: column; gap: 6px; }
.cifra-cabecera .num { font-size: 28px; }
.modulo-columnas { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 48px; align-items: start; }
.camino-seccion { gap: 24px; }
.camino-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.camino-paso { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 18px; }
.camino-marca { display: flex; flex-direction: column; align-items: center; }
.camino-num { width: 32px; height: 32px; flex-shrink: 0; border-radius: 16px; display: grid; place-items: center; font-size: 13px;
  background: transparent; color: var(--muted); border: 1px solid var(--line); }
.camino-linea { flex: 1; width: 2px; min-height: 16px; background: var(--line); }
.camino-paso.hecha .camino-num { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-soft); }
.camino-paso.hecha .camino-linea { background: var(--accent-soft); }
.camino-paso.ahora .camino-num { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.camino-paso.ultimo .camino-linea { background: transparent; }
.camino-texto { display: flex; flex-direction: column; gap: 4px; padding: 5px 0 24px; min-width: 0; }
.camino-titulo { font-size: 16px; font-weight: 400; color: var(--muted); text-decoration: none; }
a.camino-titulo:hover { color: var(--accent-text); }
.camino-paso.hecha .camino-titulo, .camino-paso.ahora .camino-titulo { color: var(--ink); }
.camino-paso.ahora .camino-titulo { font-weight: 600; }
.camino-meta { font-size: 13px; color: var(--muted); }
.camino-accion { padding-top: 12px; }
.tarea-lateral { display: flex; flex-direction: column; gap: 24px; padding: 32px; position: sticky; top: 48px; }
.h2-tarea { font-size: 24px; }
.contexto-15 { font-size: 15px; }
.segmentos { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.segmentos > span { height: 6px; border-radius: 3px; background: var(--line); }
.segmentos > span.hecho { background: var(--accent); }
.tarea-nota { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 4px; border-top: 1px solid var(--line); }
.tarea-nota > span:first-child { font-size: 15px; padding-top: 16px; }
.nota-tarea { font-size: 36px; color: var(--accent-text); }
@media (max-width: 820px) { .tarea-lateral { position: static; } }

/* ---------- Barra superior en móvil (Design: Sidebar.dc.html, versión móvil) ---------- */
.barra-superior { display: none; }
@media (max-width: 820px) {
  .barra-superior { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; padding: 0 16px 0 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
  /* Fija arriba: "Anotar" siempre a mano, también a media lectura (sin subir y perder el párrafo). */
  .barra-superior { position: sticky; top: 0; z-index: 20; }
  .barra-superior-marca { display: block; text-decoration: none; }
  .barra-superior-marca .marca-simbolo { width: 34px; height: 34px; }
  .barra-superior-marca .marca-nombre { font-size: 19px; }
}

/* ---------- Bloque de acción (Design: Mapa Dominio, "Qué falta para subir") ---------- */
.bloque-accion { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; padding: 24px 28px; }
.bloque-accion-texto { display: flex; flex-direction: column; gap: 6px; flex: 1 1 280px; min-width: 0; }
.bloque-accion-frase { font-size: 16px; line-height: 1.5; }
.nuevo-proximamente { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 8px;
  background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: not-allowed; align-self: flex-start; }

/* ---------- Tutor (Design: Tutor.dc.html) ---------- */
.zona-tutor { max-width: 720px; gap: 20px; flex: 1; }
.tutor-barra { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.tutor-contexto { font-size: 13px; padding: 6px 12px; border-radius: 999px; background: var(--sunk); }
.tutor-gasto { font-size: 12px; color: var(--muted); }
.chat { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.msg-fila { display: flex; justify-content: flex-start; }
.msg-fila.user { justify-content: flex-end; }
.msg { max-width: min(85%, 560px); display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); }
.msg.user { background: var(--accent-soft); border-color: var(--accent-soft); }
.msg-quien { font-size: 12px; font-weight: 600; color: var(--muted); }
.msg-texto { font-size: 15px; line-height: 1.55; white-space: pre-wrap; text-wrap: pretty; }
.tutor-caja { position: sticky; bottom: 16px; display: flex; flex-direction: column; gap: 10px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.tutor-caja-fila { display: flex; gap: 10px; align-items: flex-end; }
.tutor-caja textarea { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 15px; line-height: 1.5; resize: none; padding: 8px; }
.tutor-caja textarea:focus { outline: none; }
.tutor-caja:focus-within { border-color: var(--muted); }
.btn-enviar { padding: 12px 22px; }
.tutor-nota { font-size: 12px; color: var(--muted); padding: 0 8px; }
@media (max-width: 820px) { .tutor-caja { bottom: calc(80px + env(safe-area-inset-bottom)); } }

/* ---------- Ajustes (Design: Ajustes.dc.html) ---------- */
.zona-ajustes { display: flex; flex-direction: column; gap: 20px; max-width: 760px; }
.pila-ajustes { display: flex; flex-direction: column; gap: 20px; }
.ajuste { display: flex; flex-direction: column; gap: 18px; }
.ajuste-fila { flex-direction: row; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.ajuste-cabecera { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.ajuste-texto { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ajuste-sub { font-size: 15px; color: var(--muted); }
.temas { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tema-opcion { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 10px; font: inherit; text-align: left; cursor: pointer;
  background: transparent; color: var(--ink); border: 2px solid var(--line); }
.tema-opcion[aria-pressed="true"] { border-color: var(--accent); }
.muestras { display: flex; gap: 6px; }
.muestra { width: 28px; height: 28px; border-radius: 6px; }
.m-claro-1 { background: #F3ECE0; border: 1px solid #E0D4C1; }
.m-claro-2 { background: #FBF7F0; border: 1px solid #E0D4C1; }
.m-claro-3 { background: #B9532D; }
.m-oscuro-1 { background: #07090D; border: 1px solid #1F2735; }
.m-oscuro-2 { background: #0E121A; border: 1px solid #1F2735; }
.m-oscuro-3 { background: #3F72E6; }
.tema-nombre { display: flex; flex-direction: column; gap: 2px; font-size: 15px; font-weight: 600; }
.tema-sub { font-size: 13px; font-weight: 400; color: var(--muted); }
.paso-a-paso { display: flex; align-items: center; gap: 16px; }
.paso-boton { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 20px; cursor: pointer; }
.paso-boton:hover { border-color: var(--muted); }
.paso-valor { display: inline-flex; align-items: baseline; justify-content: center; min-width: 100px; }
.paso-valor input { width: 2.6em; border: 0; background: transparent; color: var(--ink); font-size: 30px; text-align: center; padding: 0; -moz-appearance: textfield; }
.paso-valor input::-webkit-outer-spin-button, .paso-valor input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.paso-unidad { font-size: 14px; color: var(--muted); }
.gasto-total { font-size: 32px; white-space: nowrap; }
.barra-6 { height: 6px; border-radius: 3px; }
.desglose { display: flex; flex-direction: column; }
.desglose-fila { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 15px; }
.desglose-fila .num { font-size: 14px; }
.ajuste-campo { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.ajuste-campo input, .ajuste-select { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; max-width: 240px; }
.ajuste-enlace { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.titulo-enlace { font-size: 16px; font-weight: 600; }

/* Calendario: estado de cada entrega */
.entrega-estado { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 10px; }
@media (max-width: 820px) {
  /* En móvil el estado de la entrega va en su propia fila, bajo el título, para no estrecharlo. */
  .lista > li:has(> .entrega-estado) { grid-template-columns: 80px minmax(0, 1fr); row-gap: 10px; }
  .entrega-estado { grid-column: 2; justify-content: flex-start; }
}
.btn-borde.btn-sm { padding: 8px 12px; font-size: 13px; }
.lista > li.cal-entregada .titulo { text-decoration: line-through; color: var(--muted); }

/* Rúbrica de una tarea (Abrir tarea) */
.rubrica-niveles { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 8px 0 0; }
.rubrica-niveles dt { color: var(--muted); }
.rubrica-niveles dd { margin: 0; }
.lista.rubrica > li + li { border-top: 1px solid var(--line); }
.lista.rubrica > li { padding: 16px 20px; }
.lista.rubrica p { margin: 0; }

/* Tarea: varias preguntas en la lección y nivel de cada criterio en la corrección */
.preguntas-tarea { display: flex; flex-wrap: wrap; gap: 8px; }
.preguntas-tarea .chip { text-decoration: none; }
.criterio-nivel { color: var(--muted); font-weight: 400; }

/* ---------- Notas de prueba: botón "Anotar", su cuadro y la pantalla ---------- */
.anotar { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; min-height: 40px; padding: 8px 14px 8px 11px; border: 0; border-radius: var(--radius-pill);
  background: var(--anotar); color: var(--anotar-ink); font: inherit; font-size: 14px; font-weight: 600; line-height: 1; cursor: pointer; }
.anotar:hover { filter: brightness(1.06); }
.anotar .icono { width: 18px; height: 18px; stroke-width: 2; }
/* Escritorio: al pie del menú, encima de Ajustes (la zona del logo queda limpia). */
.anotar-lateral { align-self: flex-start; margin: 0 0 var(--space-2) 4px; min-height: 36px; padding: 7px 14px 7px 10px; font-size: 13px; }
/* Móvil: solo la sirena, pegada al borde derecho y lejos del lema; la etiqueta sigue para lectores de pantalla. */
.anotar-barra { width: 40px; height: 40px; min-height: 0; padding: 0; justify-content: center; margin-right: -4px; }
.anotar-barra .anotar-texto { display: none; }
.anotar-barra .icono { width: 20px; height: 20px; }
.error-pagina .lateral-cabeza { align-self: stretch; }
.anotar-dialogo { width: min(560px, calc(100vw - 32px)); max-width: none; margin: 14vh auto auto; padding: 20px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); }
.anotar-dialogo::backdrop { background: var(--scrim); }
.anotar-form { display: flex; flex-direction: column; gap: var(--space-3); }
.anotar-cabecera { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.anotar-cabecera h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.anotar-cabecera h2 .icono { width: 20px; height: 20px; color: var(--anotar); }
.anotar-dialogo textarea { min-height: 8rem; resize: vertical; background: var(--bg); font-family: var(--font-text); line-height: 1.5; }
.anotar-pie { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.anotar-tipos span { padding: 8px 14px; }
.anotar-guardar { padding: 12px 26px; }
.anotar-aviso { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); padding: 10px 18px; border-radius: var(--radius-pill);
  background: var(--ink); color: var(--bg); font-size: 14px; line-height: 1.4; text-align: center; }
@media (max-width: 820px) {
  .anotar-dialogo { margin-top: 12px; }  /* arriba: el teclado no lo tapa */
  .anotar-guardar { flex: 1 0 100%; }
  .anotar-aviso { top: 72px; bottom: auto; }  /* bajo la barra: no tapa el botón fijo de abajo */
}
.np-informe-fila { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.np-informe-texto { max-height: 360px; overflow: auto; padding: 14px 16px; border-radius: var(--radius-md); background: var(--surface); font-family: var(--font-num); font-size: 13px; line-height: 1.55; }
.np-lista { display: flex; flex-direction: column; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.np-nota { display: flex; flex-direction: column; gap: 10px; padding: 20px 24px; }
.np-cabeza { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.np-texto { font-family: var(--font-text); font-size: 16px; line-height: 1.55; overflow-wrap: anywhere; }
.np-donde a { color: var(--muted); }
.np-nota .segmentado-radio span { padding: 8px 12px; white-space: nowrap; }
.np-resuelta .np-texto { color: var(--muted); }
.np-tipo { font-weight: var(--fw-semibold); }
.np-fallo { border-color: var(--danger); color: var(--danger); }
.np-mejora { border-color: var(--accent); color: var(--accent-text); }
.np-idea { border-color: var(--ok); color: var(--ok); }
.np-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.np-plegable > summary { cursor: pointer; list-style: none; font-size: 14px; color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.np-plegable > summary::-webkit-details-marker { display: none; }
.np-plegable[open] { flex-basis: 100%; }
.np-plegable[open] > summary { margin-bottom: 12px; }
.np-borrar > summary { color: var(--danger); }
.np-peligro { border-color: var(--danger); color: var(--danger); }
@media (max-width: 820px) { .np-nota { padding: 18px 18px; } }
