/* ============================================================
   Curso IA — Estilos base
   Paleta gris/azul, elegante y profesional.
   Modo claro/oscuro mediante el atributo data-tema en <html>.
   ============================================================ */

/* ---------- Variables de color (MODO CLARO) ---------- */
:root,
[data-tema="claro"] {
  --azul:            #2563eb;
  --azul-oscuro:     #1d4ed8;
  --azul-claro:      #dbeafe;
  --azul-num:        #2b41ff;
  --btn-solid:       #2b41ff;
  --unidad-bg:       #e5efff;

  --fondo:           #f3f4f6;
  --fondo-2:         #e5e7eb;
  --superficie:      #ffffff;
  --borde:           #d1d5db;

  --texto:           #1f2937;
  --texto-suave:     #6b7280;

  --error:           #dc2626;
  --ok:              #16a34a;

  --sombra:          0 10px 30px rgba(30, 41, 59, 0.12);
  --radio:           14px;
}

/* ---------- Variables de color (MODO OSCURO) ---------- */
[data-tema="oscuro"] {
  --azul:            #3b82f6;
  --azul-oscuro:     #2563eb;
  --azul-claro:      #1e3a5f;
  --azul-num:        #6f7dff;
  --btn-solid:       #4a5cff;
  --unidad-bg:       #1e293b;

  --fondo:           #0f172a;
  --fondo-2:         #1e293b;
  --superficie:      #1e293b;
  --borde:           #334155;

  --texto:           #e2e8f0;
  --texto-suave:     #94a3b8;

  --error:           #f87171;
  --ok:              #4ade80;

  --sombra:          0 10px 30px rgba(0, 0, 0, 0.45);
  --radio:           14px;
}

/* ---------- Reset ligero ---------- */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

/* El atributo "hidden" siempre oculta, aunque haya un display en CSS.
   (Evita que modales o conmutadores con display:grid/flex sigan visibles.) */
[hidden] { display: none !important; }

html { font-size: 16px; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.5;
  min-height: 100vh;
  transition: background-color .25s ease, color .25s ease;
}

/* ---------- Botón de tema (arriba a la derecha) ---------- */
.btn-tema {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--borde);
  background: var(--superficie);
  color: var(--texto);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--sombra);
  transition: transform .15s ease, background-color .25s ease, border-color .25s ease;
  z-index: 50;
}
.btn-tema:hover { transform: scale(1.06); }
.btn-tema:active { transform: scale(0.96); }

/* Icono sol/luna dibujado con CSS según el tema */
.icono-tema {
  width: 20px; height: 20px;
  display: block;
  position: relative;
}
/* Luna (modo claro -> invita a oscuro) */
[data-tema="claro"] .icono-tema {
  background: radial-gradient(circle at 65% 35%, transparent 0 9px, var(--azul) 9px 10px);
  border-radius: 50%;
  box-shadow: inset -4px 2px 0 0 var(--azul);
  background: none;
}
[data-tema="claro"] .icono-tema::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  box-shadow: inset -6px 3px 0 0 var(--azul);
}
/* Sol (modo oscuro -> invita a claro) */
[data-tema="oscuro"] .icono-tema::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--azul);
  box-shadow:
    0 -8px 0 -3px var(--azul), 0 8px 0 -3px var(--azul),
    -8px 0 0 -3px var(--azul), 8px 0 0 -3px var(--azul),
    -6px -6px 0 -4px var(--azul), 6px 6px 0 -4px var(--azul),
    -6px 6px 0 -4px var(--azul), 6px -6px 0 -4px var(--azul);
}

/* ============================================================
   PANTALLA DE LOGIN
   ============================================================ */
.pagina-login {
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--azul-claro), transparent 60%),
    var(--fondo);
}

.login-contenedor {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.login-tarjeta {
  width: 100%;
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 36px 32px;
}

.login-marca { text-align: center; margin-bottom: 26px; }

.login-logo {
  display: inline-block;
  width: 56px; height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--azul), var(--azul-oscuro));
  margin-bottom: 14px;
  position: relative;
}
.login-logo::after {
  content: "IA";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 1.1rem; letter-spacing: .5px;
}

.login-marca h1 { font-size: 1.5rem; font-weight: 700; }
.login-subtitulo { color: var(--texto-suave); font-size: .9rem; margin-top: 2px; }

.login-form { display: flex; flex-direction: column; gap: 16px; }

.campo { display: flex; flex-direction: column; gap: 6px; }
.campo label { font-size: .85rem; font-weight: 600; color: var(--texto-suave); }

.campo input {
  width: 100%;
  padding: 11px 13px;
  font-size: 1rem;
  color: var(--texto);
  background: var(--fondo);
  border: 1px solid var(--borde);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.campo input:focus {
  border-color: var(--azul);
  box-shadow: 0 0 0 3px var(--azul-claro);
}

.btn-principal {
  margin-top: 6px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--azul), var(--azul-oscuro));
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: filter .15s ease, transform .1s ease;
}
.btn-principal:hover { filter: brightness(1.06); }
.btn-principal:active { transform: translateY(1px); }
.btn-principal:disabled { opacity: .6; cursor: not-allowed; }

.mensaje-error {
  color: var(--error);
  font-size: .88rem;
  background: color-mix(in srgb, var(--error) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--error) 35%, transparent);
  padding: 9px 12px;
  border-radius: 9px;
}

.login-pie { color: var(--texto-suave); font-size: .78rem; text-align: center; }

/* ============================================================
   PANEL (alumno / profesor)
   ============================================================ */
.app { display: block; }

/* ----- Iconos genéricos (dibujados con CSS) ----- */
.ic { display: inline-block; width: 18px; height: 18px; vertical-align: middle; position: relative; }
.ic-perfil { border-radius: 50%; border: 2px solid currentColor; }
.ic-perfil::after {
  content: ""; position: absolute; left: 50%; top: 3px; width: 6px; height: 6px;
  transform: translateX(-50%); border-radius: 50%; background: currentColor;
}
.ic-perfil::before {
  content: ""; position: absolute; left: 50%; bottom: 2px; width: 11px; height: 6px;
  transform: translateX(-50%); border-radius: 6px 6px 0 0; background: currentColor;
}
.ic-salir {
  border: 2px solid currentColor; border-right: none; border-radius: 4px 0 0 4px;
  width: 12px; height: 16px;
}
.ic-salir::after {
  content: ""; position: absolute; right: -7px; top: 50%; transform: translateY(-50%);
  width: 8px; height: 8px; border-top: 2px solid currentColor; border-right: 2px solid currentColor;
  rotate: 45deg;
}
.ic-inicio { border: 2px solid currentColor; border-top: none; width: 14px; height: 11px; margin-top: 5px; }
.ic-inicio::before {
  content: ""; position: absolute; top: -7px; left: 50%; transform: translateX(-50%);
  border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 7px solid currentColor;
}
.ic-doc { border: 2px solid currentColor; width: 13px; height: 16px; border-radius: 2px; }
.ic-doc::after {
  content: ""; position: absolute; left: 3px; top: 4px; width: 7px; height: 2px;
  background: currentColor; box-shadow: 0 4px 0 currentColor;
}
.ic-ejer { border: 2px solid currentColor; width: 14px; height: 16px; border-radius: 2px; }
.ic-ejer::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.ic-test { border: 2px solid currentColor; width: 14px; height: 16px; border-radius: 2px; }
.ic-test::after { content: "?"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 700; }

/* ----- Barra superior ----- */
.topbar {
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  background: var(--superficie);
  border-bottom: 1px solid var(--borde);
  position: sticky; top: 0; z-index: 40;
}
.topbar-izq { display: flex; align-items: center; gap: 12px; }
.topbar-logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--azul), var(--azul-oscuro)); position: relative;
}
.topbar-logo::after {
  content: "IA"; position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: .8rem;
}
.topbar-titulo { font-weight: 700; font-size: 1.05rem; }
.badge {
  font-size: .72rem; font-weight: 600; color: #fff;
  background: var(--azul); padding: 3px 9px; border-radius: 999px;
}
.topbar-der { display: flex; align-items: center; gap: 10px; }

.icono-btn {
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--borde); background: var(--fondo); color: var(--texto);
  cursor: pointer; display: grid; place-items: center;
  transition: background-color .15s ease, transform .1s ease;
}
.icono-btn:hover { background: var(--fondo-2); }
.icono-btn:active { transform: scale(.95); }
/* el botón de tema en la barra usa el mismo icono sol/luna del login */
.topbar .icono-tema { width: 18px; height: 18px; }

.switch-vista { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--texto-suave); cursor: pointer; }
.switch-vista input { width: 16px; height: 16px; accent-color: var(--azul); cursor: pointer; }

/* ----- Disposición general ----- */
.layout { display: flex; min-height: calc(100vh - 60px); }

.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--superficie);
  border-right: 1px solid var(--borde);
  padding: 18px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: 10px;
  background: transparent; border: none; cursor: pointer;
  color: var(--texto-suave); font-size: .95rem; font-weight: 500; text-align: left;
  transition: background-color .15s ease, color .15s ease;
}
.nav-item:hover { background: var(--fondo-2); color: var(--texto); }
.nav-item.activo { background: var(--azul-claro); color: var(--azul); font-weight: 600; }

.contenido { flex: 1; padding: 28px 32px; }
.saludo { font-size: 1.05rem; color: var(--texto-suave); margin-bottom: 18px; }
.seccion-titulo { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.seccion-sub { color: var(--texto-suave); font-size: .9rem; margin-bottom: 22px; }

/* ----- Rejilla de unidades ----- */
.rejilla-unidades {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px;
}
.unidad {
  background: var(--unidad-bg); border: 1px solid var(--borde); border-radius: 12px;
  padding: 18px; display: flex; flex-direction: column; gap: 6px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.unidad:hover { transform: translateY(-2px); box-shadow: var(--sombra); }
/* Las tarjetas bloqueadas NO se atenúan enteras (eso apagaba el botón y el
   rótulo). Solo se atenúa el título para distinguir el estado. */
.unidad.bloqueada .unidad-titulo { color: var(--texto-suave); }
.unidad-num { font-size: .78rem; font-weight: 700; color: var(--azul-num); text-transform: uppercase; letter-spacing: .6px; }
.unidad-titulo { font-size: 1.05rem; font-weight: 600; }
.unidad-estado { font-size: .82rem; color: var(--texto-suave); margin-top: 2px; }
.btn-mini {
  margin-top: 10px; align-self: flex-start;
  padding: 6px 12px; font-size: .82rem; font-weight: 600;
  color: var(--azul); background: var(--azul-claro);
  border: 1px solid transparent; border-radius: 8px; cursor: pointer;
}
.btn-mini:hover { filter: brightness(.97); }
.btn-mini:disabled { opacity: .6; cursor: default; }

/* Botón de (des)bloquear de las tarjetas: azul vivo, glossy y con glow */
.unidad .btn-mini {
  color: #fff;
  font-weight: 700;
  letter-spacing: .2px;
  background: var(--btn-solid);
  transition: filter .12s ease;
}
.unidad .btn-mini:hover { filter: brightness(1.08); }
.unidad .btn-mini:active { filter: brightness(.95); }
.unidad .btn-mini:disabled { opacity: .7; }

/* ----- Modal de perfil ----- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; }
.modal-fondo { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); }
.modal-caja {
  position: relative; width: 100%; max-width: 480px; margin: 16px;
  background: var(--superficie); border: 1px solid var(--borde);
  border-radius: 14px; box-shadow: var(--sombra); padding: 24px;
  max-height: 90vh; overflow-y: auto;   /* contenido largo -> scroll dentro del modal */
}
/* El lector de temario/ejercicios necesita más ancho para leer cómodo */
#modal-lector .modal-caja { max-width: 1000px; }
.modal-cabecera { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-cabecera h3 { font-size: 1.2rem; font-weight: 700; }
.modal-cerrar {
  background: none; border: none; font-size: 1.6rem; line-height: 1;
  color: var(--texto-suave); cursor: pointer;
}
.form-perfil { display: flex; flex-direction: column; gap: 14px; }
.campo-fila { display: flex; gap: 12px; }
.campo-fila .campo { flex: 1; }
.form-perfil input:disabled { opacity: .6; }
.modal-acciones { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.btn-secundario {
  padding: 11px 16px; font-size: .95rem; font-weight: 600;
  color: var(--texto); background: var(--fondo-2);
  border: 1px solid var(--borde); border-radius: 10px; cursor: pointer;
}
.btn-secundario:hover { filter: brightness(.97); }
.perfil-mensaje { font-size: .86rem; padding: 8px 11px; border-radius: 8px; }
.perfil-mensaje.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.perfil-mensaje.error { color: var(--error); background: color-mix(in srgb, var(--error) 12%, transparent); }

.unidad.clicable { cursor: pointer; }

/* ============================================================
   DETALLE DE UNIDAD: pestañas, listas y editores (Fase 3)
   ============================================================ */
.btn-volver {
  background: none; border: none; color: var(--azul); cursor: pointer;
  font-size: .9rem; font-weight: 600; padding: 0; margin-bottom: 14px;
}
.btn-volver:hover { text-decoration: underline; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--borde); margin: 14px 0 20px; }
.tab {
  background: none; border: none; cursor: pointer; padding: 10px 16px;
  font-size: .95rem; font-weight: 600; color: var(--texto-suave);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--texto); }
.tab.activo { color: var(--azul); border-bottom-color: var(--azul); }

.tab-contenido { display: flex; flex-direction: column; gap: 10px; }
.vacio { color: var(--texto-suave); font-size: .92rem; padding: 8px 0; }

.item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--superficie); border: 1px solid var(--borde);
  border-radius: 10px; padding: 13px 16px;
}
.item-titulo { font-weight: 600; }
.item-meta { color: var(--texto-suave); font-weight: 400; font-size: .82rem; }
.item-acciones { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.btn-link {
  background: none; border: none; cursor: pointer; color: var(--azul);
  font-size: .88rem; font-weight: 600; padding: 5px 8px; border-radius: 7px;
}
.btn-link:hover { background: var(--azul-claro); }
.btn-link.peligro { color: var(--error); }
.btn-link.peligro:hover { background: color-mix(in srgb, var(--error) 14%, transparent); }

.btn-principal.pequeno { align-self: flex-start; padding: 9px 14px; font-size: .9rem; margin-bottom: 4px; }

/* ----- Editores ----- */
.modal-caja.grande { max-width: 880px; }
.label-flex { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.editor-area {
  width: 100%; min-height: 280px; resize: vertical;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .9rem;
  padding: 12px; border: 1px solid var(--borde); border-radius: 10px;
  background: var(--fondo); color: var(--texto); line-height: 1.5;
}
.editor-area.alta { min-height: 340px; }
.editor-area:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-claro); }
.preview-box {
  min-height: 280px; max-height: 420px; overflow: auto;
  border: 1px solid var(--borde); border-radius: 10px; padding: 14px 18px; background: var(--fondo);
}

.te-resumen { font-size: .9rem; padding: 11px 14px; border-radius: 9px; margin-top: 4px; }
.te-resumen.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.te-resumen.error { color: var(--error); background: color-mix(in srgb, var(--error) 12%, transparent); }
.te-resumen ul { margin: 6px 0 0 18px; }

.preg { margin: 12px 0; }
.preg ul { list-style: none; margin: 6px 0 0; padding: 0; }
.preg li { padding: 3px 0; color: var(--texto-suave); }
.preg li.correcta { color: var(--ok); font-weight: 600; }

/* ============================================================
   CONTENIDO RENDERIZADO DE MARKDOWN
   ============================================================ */
.md-content { line-height: 1.65; color: var(--texto); }
.md-content h1, .md-content h2, .md-content h3 { font-weight: 700; line-height: 1.25; margin: 1.1em 0 .5em; }
.md-content h1 { font-size: 1.6rem; border-bottom: 1px solid var(--borde); padding-bottom: .3em; }
.md-content h2 { font-size: 1.3rem; }
.md-content h3 { font-size: 1.1rem; }
.md-content p { margin: .6em 0; }
.md-content ul, .md-content ol { margin: .6em 0; padding-left: 1.5em; }
.md-content li { margin: .25em 0; }
.md-content a { color: var(--azul); }
.md-content code {
  font-family: ui-monospace, Consolas, monospace; font-size: .9em;
  background: var(--fondo-2); padding: .15em .4em; border-radius: 5px;
}
.md-content pre {
  background: var(--fondo-2); padding: 14px; border-radius: 10px; overflow: auto; margin: .8em 0;
}
.md-content pre code { background: none; padding: 0; }
.md-content blockquote {
  border-left: 4px solid var(--azul); margin: .8em 0; padding: .3em 0 .3em 1em;
  color: var(--texto-suave); background: var(--azul-claro); border-radius: 0 8px 8px 0;
}
.md-content table { border-collapse: collapse; margin: .8em 0; width: 100%; }
.md-content th, .md-content td { border: 1px solid var(--borde); padding: 8px 12px; text-align: left; }
.md-content th { background: var(--fondo-2); font-weight: 600; }
.md-content img { max-width: 100%; border-radius: 8px; }
.md-content hr { border: none; border-top: 1px solid var(--borde); margin: 1.2em 0; }

/* ============================================================
   EXAMEN (realización y resultado)
   ============================================================ */
.examen-cab { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.examen-timer {
  font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--azul-claro); color: var(--azul-num);
  padding: 8px 14px; border-radius: 10px; font-size: 1rem;
}
.examen-timer.urgente { background: color-mix(in srgb, var(--error) 18%, transparent); color: var(--error); }
.examen-resumen {
  margin: 14px 0 6px; padding: 14px 16px; border-radius: 12px;
  background: var(--superficie); border: 1px solid var(--borde); font-size: 1.05rem;
}
.examen-cuerpo { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.examen-preg {
  background: var(--superficie); border: 1px solid var(--borde);
  border-radius: 12px; padding: 16px 18px;
}
.examen-preg.res-ok { border-left: 4px solid var(--ok); }
.examen-preg.res-mal { border-left: 4px solid var(--error); }
.examen-enun { font-weight: 600; margin-bottom: 12px; }
.examen-op {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 11px;
  border: 1px solid var(--borde); border-radius: 9px; margin-top: 8px; cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease;
}
.examen-op:hover { background: var(--fondo-2); }
.examen-op input { margin-top: 3px; accent-color: var(--azul); }
.examen-op input:disabled { cursor: default; }
.examen-op-res { padding: 8px 11px; border-radius: 9px; margin-top: 8px; border: 1px solid var(--borde); }
.examen-op-res.correcta { background: color-mix(in srgb, var(--ok) 15%, transparent); border-color: var(--ok); color: var(--ok); font-weight: 600; }
.examen-op-res.elegida-mal { background: color-mix(in srgb, var(--error) 14%, transparent); border-color: var(--error); color: var(--error); }
.examen-acciones { margin-top: 22px; }
.examen-resumen.anulado { color: var(--error); border-color: var(--error); background: color-mix(in srgb, var(--error) 10%, transparent); }
.estado-anulado { color: var(--error); font-weight: 600; }

/* Prácticas */
.entrega-fila { border: 1px solid var(--borde); border-radius: 10px; padding: 13px 15px; margin-bottom: 12px; }
.entrega-revision { font-weight: 600; margin: 8px 0; }
.entrega-revision.ok { color: var(--ok); }
.entrega-revision.mal { color: var(--error); }
.entrega-correccion { background: var(--fondo-2); border-radius: 9px; padding: 10px 12px; margin: 8px 0; }
.rev-acciones { display: flex; align-items: center; gap: 14px; margin-top: 8px; flex-wrap: wrap; }

/* Protección de contenido (alumnos): no seleccionar, salvo en campos de formulario */
.protegido { -webkit-user-select: none; -moz-user-select: none; user-select: none; }
.protegido input, .protegido textarea { -webkit-user-select: text; -moz-user-select: text; user-select: text; }

/* Entregables por alumno */
.ent-unidad { border-top: 1px solid var(--borde); padding-top: 10px; margin-top: 14px; }
.ent-sub { font-weight: 600; color: var(--texto-suave); font-size: .82rem; text-transform: uppercase; letter-spacing: .4px; margin: 10px 0 6px; }
.ent-fallos { margin: -4px 0 8px 4px; }
.rev { margin: 6px 0 12px; }
.nota-total { font-size: .85rem; font-weight: 700; color: #fff; background: var(--btn-solid); padding: 2px 10px; border-radius: 999px; margin-left: 8px; }

/* Estadísticas */
.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin: 14px 0 8px; }
.stat-card { background: var(--superficie); border: 1px solid var(--borde); border-radius: 12px; padding: 18px; text-align: center; }
.stat-num { font-size: 1.8rem; font-weight: 700; color: var(--azul-num); }
.stat-lbl { color: var(--texto-suave); font-size: .85rem; margin-top: 4px; }

/* Tabla de resultados del profesor */
.tabla-res { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .92rem; }
.tabla-res th, .tabla-res td { border: 1px solid var(--borde); padding: 8px 11px; text-align: left; }
.tabla-res th { background: var(--fondo-2); font-weight: 600; }
.res-sub { margin: 18px 0 8px; font-size: 1rem; font-weight: 700; }
.res-ranking { margin: 0 0 0 18px; display: flex; flex-direction: column; gap: 6px; }

/* ----- Multicurso: conmutador, gestión, arrastrar-soltar ----- */
.curso-switch { display: flex; align-items: center; gap: 8px; margin-left: 14px; }
.curso-switch-label { font-size: .82rem; color: var(--texto-suave); }

select {
  font: inherit; font-size: .9rem; color: var(--texto);
  background: var(--fondo); border: 1px solid var(--borde); border-radius: 9px;
  padding: 8px 11px; cursor: pointer; outline: none;
}
select:focus { border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-claro); }

.seccion-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 18px; }

.unidad-acciones { display: flex; gap: 2px; margin-top: 12px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--borde); }
.unidad.arrastrando { opacity: .45; }
.unidad.drop-encima { outline: 2px dashed var(--btn-solid); outline-offset: 3px; }
.unidad[draggable="true"] { cursor: grab; }
.ayuda-arrastrar { color: var(--texto-suave); font-size: .82rem; margin-top: 16px; font-style: italic; }

.selector-lista { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.selector-item { width: 100%; }

.checks-cursos { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.check-curso { display: flex; align-items: center; gap: 9px; font-size: .92rem; cursor: pointer; }
.check-curso input { width: 16px; height: 16px; accent-color: var(--azul); }

/* ----- Responsivo ----- */
@media (max-width: 680px) {
  .sidebar { width: 64px; }
  .nav-item span:not(.ic) { display: none; }
  .nav-item { justify-content: center; }
  .switch-vista span { display: none; }
  .curso-switch-label { display: none; }
  .contenido { padding: 20px 16px; }
  .editor-grid { grid-template-columns: 1fr; }
}
