/* HERMES · modo oscuro compartido. Se activa con <html data-theme="dark"> (ver modo-oscuro.js). */
.hm-tema-btn { position: fixed; left: 14px; bottom: 14px; z-index: 900; width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(148,163,184,.45); background: #fff; color: #0F172A; font-size: 1.25rem; line-height: 1; cursor: pointer; box-shadow: 0 8px 22px -8px rgba(15,23,42,.45); display: grid; place-items: center; transition: transform .15s; -webkit-tap-highlight-color: transparent; }
.hm-tema-btn:hover { transform: scale(1.08); }
html[data-theme="dark"] .hm-tema-btn { background: #1E293B; border-color: #334155; box-shadow: 0 8px 22px -8px rgba(0,0,0,.8); }
@media print { .hm-tema-btn { display: none; } }

html[data-theme="dark"] {
    color-scheme: dark;
    /* tokens compartidos (dashboard / admin_aula) */
    --fondo: #0B1220; --texto: #E2E8F0; --texto-2: #94A3B8; --borde: #26334D;
    --azul: #F1F5F9; --azul-2: #CBD5E1;
    --naranja: #F97316; --naranja-osc: #FB923C; --naranja-claro: #2A1A10;
    --verde: #22C55E; --verde-claro: #12301F;
    --ambar: #FBBF24; --ambar-claro: #2E2410;
    --rojo: #F87171; --rojo-claro: #3B181B;
    /* tokens de tema.php / examen.php */
    --gris-fondo: #0B1220; --azul-marino: #F1F5F9; --texto-principal: #E2E8F0; --texto-secundario: #94A3B8;
    /* tokens de admin_examen.php */
    --navy: #F1F5F9; --navy2: #CBD5E1; --bg: #0B1220; --line: #26334D; --mut: #94A3B8; --or: #F97316; --or2: #FB923C;
}
html[data-theme="dark"] body { background: #0B1220; color: #E2E8F0; }
html[data-theme="dark"] ::placeholder { color: #64748B; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #334155; }

/* ===== Superficies (tarjetas, paneles) ===== */
html[data-theme="dark"] .card, html[data-theme="dark"] .kpi, html[data-theme="dark"] .stat,
html[data-theme="dark"] .continuar, html[data-theme="dark"] details.modulo, html[data-theme="dark"] details.mod,
html[data-theme="dark"] .content-card, html[data-theme="dark"] .tema-card, html[data-theme="dark"] .punto,
html[data-theme="dark"] .toast, html[data-theme="dark"] .nav-temas a { background: #111B2E; border-color: #26334D; box-shadow: 0 10px 28px -18px rgba(0,0,0,.8); }
html[data-theme="dark"] .content-card { border-top-color: #F97316; }
html[data-theme="dark"] .continuar.fin { background: linear-gradient(90deg, #12301F, #111B2E 60%); }
html[data-theme="dark"] .sub, html[data-theme="dark"] .mat-item, html[data-theme="dark"] .status-bloqueado .tema-card,
html[data-theme="dark"] .mat-lista a, html[data-theme="dark"] .opcion-label, html[data-theme="dark"] .segmentado,
html[data-theme="dark"] details.ayuda, html[data-theme="dark"] .pdf-preview { background: #16223A; border-color: #26334D; }
html[data-theme="dark"] .mod-cuerpo, html[data-theme="dark"] .mod-body { border-top-color: #26334D; }
html[data-theme="dark"] .status-actual .tema-card { background: linear-gradient(90deg, #2A1A10, #111B2E 70%); border-color: #9A3412; }
html[data-theme="dark"] .sub.editando-ahora, html[data-theme="dark"] .editando { background: #2A1A10; border-color: #9A3412; }
html[data-theme="dark"] details.mod.foco { border-color: #9A3412; }
html[data-theme="dark"] details.modulo summary:hover, html[data-theme="dark"] details.mod > summary:hover,
html[data-theme="dark"] tr:hover td, html[data-theme="dark"] tbody tr:hover td { background: #16223A; }
html[data-theme="dark"] .opcion-label:hover, html[data-theme="dark"] .mat-lista a:hover { background: #1D2B47; }
html[data-theme="dark"] .mat-lista a { color: #E2E8F0; }
html[data-theme="dark"] .mat-lista a:hover { border-color: #F97316; }
html[data-theme="dark"] .segmentado button.activa { background: #111B2E; color: #F97316; box-shadow: none; }
html[data-theme="dark"] .mini-barra, html[data-theme="dark"] .barra { background: #26334D; }
html[data-theme="dark"] .lista::before { background: #26334D; }
html[data-theme="dark"] .punto { color: #64748B; border-color: #334155; }
html[data-theme="dark"] .status-completado .punto { background: #16A34A; border-color: #16A34A; color: #fff; }
html[data-theme="dark"] .status-actual .punto { background: #EA580C; border-color: #EA580C; color: #fff; }
html[data-theme="dark"] .mod-desc, html[data-theme="dark"] .tema-info p { color: #94A3B8; }
html[data-theme="dark"] .status-bloqueado .tema-info h4 { color: #94A3B8; }
html[data-theme="dark"] .status-bloqueado .btn-tema { background: #1D2B47; color: #64748B; }
html[data-theme="dark"] .status-completado .btn-tema { background: #12301F; color: #86EFAC; }
html[data-theme="dark"] .status-completado .btn-tema:hover { background: #17402A; }
html[data-theme="dark"] .enlace-desc { background: #2A1A10; border-color: #9A3412; color: #FDBA74; }
html[data-theme="dark"] .enlace-desc:hover { background: #3A2314; }
html[data-theme="dark"] .vacio { border-color: #26334D; }
html[data-theme="dark"] .pie { color: #64748B; }

/* ===== Elementos "azul marino" que usaban el token como FONDO ===== */
html[data-theme="dark"] .mod-num, html[data-theme="dark"] .btn-oscuro, html[data-theme="dark"] .badge-orden,
html[data-theme="dark"] .pregunta-num, html[data-theme="dark"] .btn-volver-dash,
html[data-theme="dark"] .sub-ord[style] { background: #334155 !important; color: #fff !important; }
html[data-theme="dark"] .btn-oscuro:hover { background: #475569 !important; }
html[data-theme="dark"] .modulo-completo .mod-num { background: #16A34A !important; }
html[data-theme="dark"] input[type=file]::file-selector-button { background: #334155; color: #fff; }
html[data-theme="dark"] .hero { background: radial-gradient(600px 320px at 100% 0%, rgba(234,88,12,.40), transparent 60%), linear-gradient(135deg, #0B1220, #0F172A 50%, #1B2742); border: 1px solid #1E293B; }
html[data-theme="dark"] header:not(.topbar) { background: #0F172A; border-bottom: 1px solid #1E293B; }
html[data-theme="dark"] .topbar { background: rgba(8,13,25,.96); border-bottom-color: #1E293B; }
html[data-theme="dark"] .sub-ord { background: #26334D; color: #E2E8F0; }
html[data-theme="dark"] .tab .n { background: #26334D; color: #94A3B8; }
html[data-theme="dark"] .tab.activa .n { background: #2A1A10; color: #F97316; }
html[data-theme="dark"] .tabs { border-bottom-color: #26334D; }

/* ===== Formularios ===== */
html[data-theme="dark"] input[type=text], html[data-theme="dark"] input[type=password], html[data-theme="dark"] input[type=number],
html[data-theme="dark"] input[type=email], html[data-theme="dark"] input[type=url], html[data-theme="dark"] select,
html[data-theme="dark"] textarea, html[data-theme="dark"] input:not([type]) { background: #0B1220; border-color: #334155; color: #E2E8F0; }
html[data-theme="dark"] input[type=file] { background: #0B1220; border-color: #334155; color: #CBD5E1; }
html[data-theme="dark"] input:focus, html[data-theme="dark"] select:focus, html[data-theme="dark"] textarea:focus { border-color: #F97316; box-shadow: 0 0 0 4px rgba(249,115,22,.2); }
html[data-theme="dark"] label { color: #CBD5E1; }
html[data-theme="dark"] .barra-acordeon button, html[data-theme="dark"] .selector-curso select { background: #16223A; border-color: #334155; color: #CBD5E1; }
html[data-theme="dark"] .barra-acordeon button:hover { border-color: #F97316; color: #F97316; }
html[data-theme="dark"] .hint { color: #94A3B8; }
html[data-theme="dark"] .hint.ok { color: #86EFAC; }
html[data-theme="dark"] .opcion-label { color: #E2E8F0; }
html[data-theme="dark"] .fila-modo label { background: #16223A; border-color: #26334D; color: #E2E8F0; }
html[data-theme="dark"] .fila-modo label:has(input:checked) { background: #2A1A10; border-color: #F97316; }

/* ===== Botones ===== */
html[data-theme="dark"] .btn-sec { background: transparent; color: #E2E8F0; border-color: #64748B; }
html[data-theme="dark"] .btn-sec:hover { background: #334155; color: #fff; border-color: #94A3B8; }
html[data-theme="dark"] .btn-linea { background: #16223A; border-color: #334155; color: #E2E8F0; }
html[data-theme="dark"] .btn-linea:hover { border-color: #F97316; color: #F97316; }
html[data-theme="dark"] .btn-peligro, html[data-theme="dark"] .btn-danger { background: #3B181B; border-color: #7F1D1D; color: #FCA5A5; }
html[data-theme="dark"] .btn-peligro:hover, html[data-theme="dark"] .btn-danger:hover { background: #DC2626; color: #fff; border-color: #DC2626; }
html[data-theme="dark"] .btn-volver { border-color: rgba(255,255,255,.35); }

/* ===== Chips / insignias ===== */
html[data-theme="dark"] .chip.ok, html[data-theme="dark"] .badge-ok { background: #12301F; color: #86EFAC; }
html[data-theme="dark"] .chip.pend { background: #2E2410; color: #FCD34D; }
html[data-theme="dark"] .chip.info, html[data-theme="dark"] .badge-tipo, html[data-theme="dark"] .kpi.azul .ic { background: #1E2A5A; color: #A5B4FC; }
html[data-theme="dark"] .chip.gris { background: #1D2B47; color: #94A3B8; }
html[data-theme="dark"] .chip.rojo, html[data-theme="dark"] .badge-no { background: #3B181B; color: #FCA5A5; }
html[data-theme="dark"] .kpi.ambar .ic { background: #2E2410; color: #FBBF24; }
html[data-theme="dark"] .kpi.verde .ic { background: #12301F; color: #22C55E; }
html[data-theme="dark"] .stat i { background: #2A1A10; }
html[data-theme="dark"] .badge { background: #2A1A10; color: #FDBA74; border-color: #9A3412; }

/* ===== Tablas ===== */
html[data-theme="dark"] .tabla { border-color: #26334D; }
html[data-theme="dark"] th { background: #16223A; color: #94A3B8; border-bottom-color: #26334D; }
html[data-theme="dark"] td { border-bottom-color: #1D2B47; }
html[data-theme="dark"] .vista td { background: #111B2E; }
html[data-theme="dark"] .alumno-cel b { color: #F1F5F9; }

/* ===== Avisos / alertas ===== */
html[data-theme="dark"] .aviso { background: #2E2410; border-color: #6B4E10; color: #FCD34D; }
html[data-theme="dark"] .alert { background: #12301F; border-color: #166534; color: #86EFAC; }
html[data-theme="dark"] .alert-error { background: #3B181B; border-color: #7F1D1D; color: #FCA5A5; }
html[data-theme="dark"] .toast { color: #86EFAC; }
html[data-theme="dark"] .toast.error { border-color: #7F1D1D; color: #FCA5A5; }
html[data-theme="dark"] .preview-banner { background: #2E2410; color: #FCD34D; border-bottom-color: #6B4E10; }
html[data-theme="dark"] .mensaje-completado { background: #12301F; color: #86EFAC; border-color: #166534; }
html[data-theme="dark"] .vista { background: #1E1710; border-color: #9A3412; }
html[data-theme="dark"] .vista .ok, html[data-theme="dark"] .op-ok { color: #86EFAC; }
html[data-theme="dark"] .vista .mal { color: #FBBF24; }
html[data-theme="dark"] .vista ul.err { color: #FCA5A5; }
html[data-theme="dark"] .mat-box { border-top-color: #334155; }
html[data-theme="dark"] .mat-item a { color: #FDBA74; }

/* ===== Examen del alumno ===== */
html[data-theme="dark"] .pregunta-bloque, html[data-theme="dark"] .seccion, html[data-theme="dark"] .actions { border-color: #26334D; }
html[data-theme="dark"] .revision-item.ok { background: #12301F; border-color: #22C55E; }
html[data-theme="dark"] .revision-item.no { background: #3B181B; border-color: #EF4444; }
html[data-theme="dark"] .badge-resultado.aprobado { background: #12301F; color: #86EFAC; }
html[data-theme="dark"] .badge-resultado.reprobado { background: #3B181B; color: #FCA5A5; }
html[data-theme="dark"] .resultado-num.aprobado { color: #4ADE80; }
html[data-theme="dark"] .resultado-num.reprobado { color: #F87171; }
html[data-theme="dark"] .nav-temas a small { color: #64748B; }
html[data-theme="dark"] .pdf-preview-aviso { color: #94A3B8; }

/* ===== Cabeceras de texto que eran azul marino ===== */
html[data-theme="dark"] h1, html[data-theme="dark"] h2, html[data-theme="dark"] h3, html[data-theme="dark"] h4 { color: #F1F5F9; }
html[data-theme="dark"] .hero h1, html[data-theme="dark"] .examen-card h4 { color: #fff; }
html[data-theme="dark"] .tema-contenido { color: #CBD5E1; }
html[data-theme="dark"] .content-card h2 { color: #F1F5F9; }
html[data-theme="dark"] details.ayuda summary { color: #F1F5F9; }
html[data-theme="dark"] details.ayuda pre { background: #060B16; border: 1px solid #26334D; }

/* Imágenes y vídeos: un poco más suaves para no deslumbrar */
html[data-theme="dark"] img:not(.marca img):not(.brand img) { filter: none; }
html[data-theme="dark"] .video-wrap, html[data-theme="dark"] .video-preview iframe { box-shadow: 0 0 0 1px #26334D; }

/* ===== Perfil del alumno ===== */
html[data-theme="dark"] input[type=email], html[data-theme="dark"] input[type=tel] { background: #0B1220; border-color: #334155; color: #E2E8F0; }
html[data-theme="dark"] input[readonly] { background: #111B2E; color: #64748B; }
html[data-theme="dark"] .msg.ok { background: #12301F; border-color: #166534; color: #86EFAC; }
html[data-theme="dark"] .msg.err { background: #3B181B; border-color: #7F1D1D; color: #FCA5A5; }
html[data-theme="dark"] .elegida { background: #2A1A10; border-color: #9A3412; color: #FDBA74; }
html[data-theme="dark"] .btn-l { background: #3B181B; border-color: #7F1D1D; color: #FCA5A5; }
html[data-theme="dark"] .btn-l:hover { background: #DC2626; color: #fff; }
html[data-theme="dark"] .av-img { background: #26334D; }
html[data-theme="dark"] .card h2 { color: #F1F5F9; }
