:root {
  color-scheme: dark;
  --fondo: #0b1220;
  --panel: #141c2f;
  --linea: #2a3854;
  --texto: #e7eefc;
  --muted: #93a0bd;
  --acento: #3b82f6;
  --ok: #16a34a;
  --aviso: #d97706;
  --peligro: #dc2626;
  --radio: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 500px at 10% -10%, #1e3a8a 0%, transparent 50%), var(--fondo);
  color: var(--texto);
  font-family: "Segoe UI", system-ui, sans-serif;
}

a { color: #93c5fd; }

button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, p { margin-top: 0; }

.acceso, .pagina { width: min(1240px, calc(100% - 2rem)); margin: 0 auto; padding: 1.5rem 0 3rem; }

.marca { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.5rem; }
.marca svg { width: 48px; height: 48px; flex: none; }
.marca h1 { margin: 0 0 0.25rem; font-size: 1.8rem; }
.marca p, .ayuda, .etiqueta { color: var(--muted); }

.tarjeta, .estadistica, .tarea {
  background: color-mix(in srgb, var(--panel) 92%, white 0%);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  padding: 1rem;
}

.pestanas { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pestana, .boton, .boton-texto {
  border-radius: 999px;
  border: 1px solid var(--linea);
  background: transparent;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  text-decoration: none;
}
.pestana[aria-selected="true"], .boton {
  background: var(--acento);
  border-color: var(--acento);
  color: white;
}
.boton-texto:hover, .pestana:hover { border-color: #60a5fa; }
.boton-peligro { background: var(--peligro); border-color: var(--peligro); color: white; }

.campo, .check { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.8rem; }
.campo .ayuda { font-size: 0.85rem; }
.clave-caja { position: relative; display: block; }
.clave-caja input { padding-right: 2.7rem; }
.ojo {
  position: absolute; right: 0.25rem; top: 50%; transform: translateY(-50%);
  width: 2.2rem; height: 2.2rem; display: grid; place-items: center;
  background: transparent; border: 0; color: var(--muted); cursor: pointer; padding: 0;
}
.ojo svg { width: 1.25rem; height: 1.25rem; display: block; }
.ojo .ojo-cerrado, .ojo[aria-pressed="true"] .ojo-abierto { display: none; }
.ojo[aria-pressed="true"] .ojo-cerrado { display: block; }
.enlace-texto {
  display: block; margin: 0.9rem auto 0; background: none; border: 0;
  color: #93c5fd; cursor: pointer; text-decoration: underline; font: inherit;
}
.pestanas[hidden] { display: none; }
.campo input, .campo select, .campo textarea, #filtro-alumno, .form-linea input {
  width: 100%;
  background: #0b1220;
  border: 1px solid var(--linea);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
}
textarea { resize: vertical; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.dos-paneles { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 1rem; align-items: start; }

.aviso { padding: 0.7rem 0.9rem; border-radius: 10px; margin-bottom: 1rem; }
.aviso-error { background: #451a1a; color: #fecaca; }
.aviso-ok { background: #052e16; color: #bbf7d0; }
.aviso a { color: inherit; font-weight: 700; }

.rejilla-modulos, .fila-pastillas, .fila-botones, .fila-url, .editor-barra, .form-linea {
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
}
.fila-url, .editor-barra { justify-content: space-between; }
.modulos { border: 1px solid var(--linea); border-radius: 10px; margin-bottom: 0.8rem; }
.check-modulo {
  display: flex; gap: 0.4rem; align-items: center;
  border: 1px solid var(--linea); border-radius: 999px; padding: 0.35rem 0.7rem;
}

.tiempo-sesion {
  font-variant-numeric: tabular-nums; font-weight: 700; min-width: 3.4rem; text-align: center;
  padding: 0.35rem 0.7rem; border-radius: 999px; border: 1px solid var(--linea);
}
.tiempo-sesion.tiempo-bajo { color: #fecaca; background: #451a1a; border-color: #7f1d1d; }
body.escritorio .tiempo-sesion { color: #1d1e20; background: #f4f2fb; border-color: #d4d4d8; }
html.tema-oscuro body.escritorio .tiempo-sesion { color: #e7eefc; background: transparent; border-color: #334155; }
body.escritorio .tiempo-sesion.tiempo-bajo,
html.tema-oscuro body.escritorio .tiempo-sesion.tiempo-bajo { color: #fecaca; background: #451a1a; border-color: #7f1d1d; }
.barra {
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  padding: 1rem 1.2rem; border-bottom: 1px solid var(--linea);
  position: sticky; top: 0; background: rgba(11, 18, 32, 0.92); backdrop-filter: blur(10px);
}
.volver { display: block; color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.pastilla {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px;
  color: white; font-size: 0.78rem; font-weight: 700;
}

.cuota { height: 8px; background: #0b1220; border-radius: 99px; overflow: hidden; border: 1px solid var(--linea); }
.cuota span { display: block; height: 100%; background: var(--acento); width: 0; }
.cuota-caja { margin: 0.8rem 0; }

.migas { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.migas button { background: none; border: 0; color: #93c5fd; cursor: pointer; padding: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--linea); vertical-align: top; }
.tabla-contenedor { overflow-x: auto; }
.nombre-archivo { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; text-align: left; }
.carpeta { color: #fde68a; }

.estadisticas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; margin-bottom: 1rem; }
.estadistica strong { display: block; font-size: 1.8rem; }
.lista-tareas { display: grid; gap: 0.8rem; margin-top: 1rem; }
.tarea header, .alumno-cabecera { display: flex; justify-content: space-between; gap: 0.8rem; align-items: flex-start; }
.nota { font-size: 1.4rem; font-weight: 700; }
.cerrada { opacity: 0.65; }
.progreso { color: var(--muted); font-size: 0.9rem; }

#dialogo-borrar { width: min(440px, calc(100% - 2rem)); }
#dialogo-borrar p { margin: 0 0 0.8rem; }
dialog {
  width: min(920px, calc(100% - 2rem));
  background: var(--panel); color: var(--texto);
  border: 1px solid var(--linea); border-radius: var(--radio); padding: 1rem;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
#editor { width: min(1000px, calc(100% - 1rem)); height: min(80vh, 720px); }
#editor form { display: flex; flex-direction: column; height: 100%; gap: 0.6rem; }
#editor textarea {
  flex: 1; width: 100%; min-height: 50vh;
  background: #0b1220; border: 1px solid var(--linea); border-radius: 10px;
  font-family: Consolas, monospace; padding: 0.8rem;
}
.alumno { border-bottom: 1px solid var(--linea); padding: 0.8rem 0; }
.matricula { margin-top: 0.7rem; }
.matricula .boton { margin-top: 0.55rem; }
.modulo-fila {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.55rem 0; border-bottom: 1px solid var(--linea);
}
.modulo-fila .nombre-modulo { flex: 1; min-width: 8rem; }
.modulo-fila .check { flex-direction: row; align-items: center; margin: 0; }
.alumno details { margin-top: 0.5rem; }
.correccion { display: grid; grid-template-columns: 1.1fr 0.5fr 1.4fr auto; gap: 0.6rem; align-items: start; padding: 0.8rem 0; border-bottom: 1px solid var(--linea); }
.correccion textarea, .correccion input { width: 100%; background: #0b1220; border: 1px solid var(--linea); border-radius: 10px; padding: 0.5rem; }

@media (max-width: 800px) {
  .dos, .dos-paneles, .estadisticas, .correccion { grid-template-columns: 1fr; }
  .barra { align-items: flex-start; flex-direction: column; }
  .gestor { grid-template-columns: 1fr; }
  .gestor-arbol { max-height: 180px; border-right: 0; border-bottom: 1px solid #e7e7e9; }
  .gestor-buscar { margin-left: 0; width: 100%; }
}

.gestor {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 560px;
  background: #fff;
  color: #1d1e20;
  color-scheme: light;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e4e4e7;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}
.gestor a { color: #673de6; }
.gestor-arbol {
  background: #f7f7f8;
  border-right: 1px solid #e7e7e9;
  padding: 0.7rem 0.35rem;
  overflow: auto;
}
.arbol-raiz, .nodo-nombre, .flecha {
  background: none;
  border: 0;
  color: #1d1e20;
  cursor: pointer;
  padding: 0;
}
.arbol-raiz, .nodo-nombre {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  min-width: 0;
  border-radius: 6px;
  padding: 0.28rem 0.45rem;
  text-align: left;
}
.arbol-raiz span, .nodo-nombre span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nodo { display: flex; align-items: center; min-height: 30px; }
.flecha { width: 18px; flex: none; color: #6b7280; }
.nodo-nombre.activa, .arbol-raiz.activa { background: #efe8ff; color: #5025d1; font-weight: 650; }
.nodo-nombre:hover, .arbol-raiz:hover { background: #eeeef1; }
.gestor-principal { display: flex; flex-direction: column; min-width: 0; }
.gestor-ruta, .gestor-barra {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #eee;
}
.gestor .migas { margin: 0; flex: 1; align-items: center; }
.gestor .migas button { color: #673de6; background: none; border: 0; cursor: pointer; padding: 0; font-weight: 650; }
.gestor .migas span { color: #9ca3af; }
.enlace-sitio { font-size: 0.88rem; font-weight: 650; text-decoration: none; }
.boton-hm[hidden] { display: none; }
.boton-hm {
  display: inline-flex;
  align-items: center;
  background: #673de6;
  color: #fff;
  border: 1px solid #673de6;
  border-radius: 8px;
  padding: 0.48rem 0.8rem;
  cursor: pointer;
  font-weight: 650;
}
.boton-hm-sec { background: #fff; color: #1d1e20; border-color: #d4d4d8; font-weight: 550; }
.boton-hm-sec:hover { border-color: #673de6; color: #673de6; }
.gestor-buscar {
  margin-left: auto;
  border: 1px solid #d4d4d8;
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  background: #fff;
  color: #1d1e20;
  min-width: 160px;
}
.gestor-cuota { padding: 0.55rem 1rem 0.2rem; }
.gestor .cuota { background: #eee; border-color: #e5e5e5; }
.gestor .cuota span { background: #673de6; }
.gestor-cuota p { margin: 0.35rem 0 0.2rem; color: #6b7280; font-size: 0.85rem; }
.zona-lista { position: relative; flex: 1; overflow: auto; min-height: 280px; }
.zona-lista.soltando { outline: 2px dashed #673de6; outline-offset: -10px; background: #f6f2ff; }
.gestor th {
  color: #6b7280;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: 1px solid #eee;
}
.gestor td { border-bottom: 1px solid #f2f2f4; vertical-align: middle; }
.gestor tr:hover td { background: #fafafa; }
.col-marca { width: 36px; }
.celda-nombre { display: flex; align-items: center; gap: 0.5rem; background: none; border: 0; color: inherit; cursor: pointer; padding: 0; text-align: left; }
.icono { width: 20px; height: 20px; flex: none; }
.acciones { display: flex; justify-content: flex-end; gap: 0.1rem; }
.accion {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  border-radius: 6px;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
}
.accion svg { width: 16px; height: 16px; }
.accion:hover { background: #efe8ff; color: #673de6; }
.accion-peligro:hover { background: #fee2e2; color: #dc2626; }
.vacio { text-align: center; color: #6b7280; padding: 3rem 1rem; }
.gestor-pie { margin: 0; padding: 0.55rem 1rem; color: #6b7280; font-size: 0.82rem; border-top: 1px solid #eee; }
#dialogo-nombre { width: min(420px, calc(100% - 2rem)); color-scheme: light; background: #fff; color: #1d1e20; }
#dialogo-nombre input { background: #fff; color: #1d1e20; border: 1px solid #d4d4d8; }

body.escritorio {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  background: #eef0f5;
  color: #1d1e20;
  color-scheme: light;
}
body.escritorio [hidden] { display: none !important; }
.menu-lateral {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.2rem 0.85rem;
  background: rgba(11, 18, 32, 0.96);
  border-right: 1px solid var(--linea);
  position: sticky;
  top: 0;
  height: 100vh;
}
.menu-marca strong { display: block; margin-top: 0.25rem; font-size: 1.05rem; }
.menu-nav { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 1.2rem; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--texto);
  border: 0;
  border-radius: 10px;
  padding: 0.75rem 0.8rem;
  cursor: pointer;
}
.menu-item svg { width: 18px; height: 18px; flex: none; }
.menu-item:hover { background: #1c2740; }
.menu-item[aria-selected="true"],
.menu-item[aria-selected="true"]:hover { background: #673de6; color: white; }
.menu-pie { margin-top: auto; display: flex; flex-direction: column; gap: 0.4rem; }
.menu-pie .boton { width: 100%; }
.escritorio-cuerpo {
  min-width: 0;
  min-height: 100vh;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}
.vista-web {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
}
.vista-web-barra { display: flex; justify-content: space-between; gap: 0.8rem; align-items: center; flex-wrap: wrap; }
.vista-web h1 { margin: 0; font-size: 1.3rem; }
#url-pagina { margin: 0.25rem 0 0; color: var(--muted); word-break: break-all; }
#marco-pagina {
  flex: 1;
  width: 100%;
  min-height: 480px;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  background: #fff;
}
body.escritorio .gestor {
  flex: 1;
  height: calc(100vh - 2rem);
  min-height: 560px;
  border-color: #e6e7ee;
  box-shadow: 0 10px 28px rgba(24, 24, 40, 0.06);
}
body.escritorio #panel-tareas { overflow: auto; max-height: calc(100vh - 2rem); }
body.escritorio a { color: #673de6; }
body.escritorio .volver { color: #6b7280; }
body.escritorio .menu-lateral {
  background: #fff;
  color: #1d1e20;
  border-right: 1px solid #e6e7ee;
}
body.escritorio .menu-item { color: #3f3f46; }
body.escritorio .menu-item:hover { background: #f4f2fb; color: #1d1e20; }
body.escritorio .menu-item[aria-selected="true"],
body.escritorio .menu-item[aria-selected="true"]:hover { background: #673de6; color: #fff; }
body.escritorio .boton-texto {
  color: #3f3f46;
  background: #fff;
  border-color: #d4d4d8;
}
body.escritorio .boton-texto:hover { border-color: #673de6; color: #673de6; }
body.escritorio .boton:not(.boton-texto) {
  background: #673de6;
  border-color: #673de6;
  color: #fff;
}
body.escritorio .vista-web h1,
body.escritorio .tarea,
body.escritorio .tarea h3 { color: #1d1e20; }
body.escritorio .ayuda,
body.escritorio #url-pagina { color: #6b7280; }
body.escritorio .tarea {
  background: #fff;
  border-color: #e6e7ee;
  box-shadow: 0 8px 24px rgba(24, 24, 40, 0.05);
}
body.escritorio #marco-pagina {
  border-color: #e6e7ee;
  box-shadow: 0 10px 28px rgba(24, 24, 40, 0.06);
}
body.escritorio #dialogo-clave {
  color-scheme: light;
  background: #fff;
  color: #1d1e20;
  border-color: #e6e7ee;
}
body.escritorio #dialogo-clave input {
  background: #fff;
  color: #1d1e20;
  border: 1px solid #d4d4d8;
}
body.escritorio #dialogo-clave .ojo { color: #6b7280; }
#cambiar-tema { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; }
#cambiar-tema svg { width: 16px; height: 16px; flex: none; }
#cambiar-tema .icono-sol { display: none; }
html.tema-oscuro #cambiar-tema .icono-luna { display: none; }
html.tema-oscuro #cambiar-tema .icono-sol { display: block; }

html.tema-oscuro body.escritorio {
  background: radial-gradient(1200px 500px at 10% -10%, #1e3a8a 0%, transparent 50%), #0b1220;
  color: #e7eefc;
  color-scheme: dark;
}
html.tema-oscuro body.escritorio .menu-lateral {
  background: rgba(11, 18, 32, 0.96);
  color: #e7eefc;
  border-right-color: #2a3854;
}
html.tema-oscuro body.escritorio .volver,
html.tema-oscuro body.escritorio .ayuda,
html.tema-oscuro body.escritorio #url-pagina { color: #93a0bd; }
html.tema-oscuro body.escritorio .menu-item { color: #e7eefc; }
html.tema-oscuro body.escritorio .menu-item:hover { background: #1c2740; color: #e7eefc; }
html.tema-oscuro body.escritorio .boton-texto {
  color: #e7eefc;
  background: transparent;
  border-color: #2a3854;
}
html.tema-oscuro body.escritorio .boton-texto:hover { border-color: #a78bfa; color: #fff; }
html.tema-oscuro body.escritorio .vista-web h1,
html.tema-oscuro body.escritorio .tarea,
html.tema-oscuro body.escritorio .tarea h3 { color: #e7eefc; }
html.tema-oscuro body.escritorio .tarea {
  background: #141c2f;
  border-color: #2a3854;
  box-shadow: none;
}
html.tema-oscuro body.escritorio a { color: #c4b5fd; }
html.tema-oscuro body.escritorio #marco-pagina {
  border-color: #2a3854;
  box-shadow: none;
}
html.tema-oscuro body.escritorio .gestor {
  background: #141c2f;
  color: #e7eefc;
  color-scheme: dark;
  border-color: #2a3854;
  box-shadow: none;
}
html.tema-oscuro .gestor-arbol { background: #101826; border-color: #2a3854; }
html.tema-oscuro .arbol-raiz,
html.tema-oscuro .nodo-nombre { color: #e7eefc; }
html.tema-oscuro .flecha { color: #93a0bd; }
html.tema-oscuro .nodo-nombre.activa,
html.tema-oscuro .arbol-raiz.activa { background: #2a2150; color: #ddd6fe; }
html.tema-oscuro .nodo-nombre:hover,
html.tema-oscuro .arbol-raiz:hover { background: #1c2740; }
html.tema-oscuro .gestor-ruta,
html.tema-oscuro .gestor-barra,
html.tema-oscuro .gestor th,
html.tema-oscuro .gestor td,
html.tema-oscuro .gestor-pie { border-color: #2a3854; }
html.tema-oscuro .gestor .migas span,
html.tema-oscuro .gestor th,
html.tema-oscuro .gestor-cuota p,
html.tema-oscuro .gestor-pie,
html.tema-oscuro .vacio,
html.tema-oscuro .accion { color: #93a0bd; }
html.tema-oscuro .gestor tr:hover td { background: #1c2740; }
html.tema-oscuro .boton-hm-sec {
  background: #1c2740;
  color: #e7eefc;
  border-color: #2a3854;
}
html.tema-oscuro .boton-hm-sec:hover { border-color: #a78bfa; color: #ddd6fe; }
html.tema-oscuro .gestor-buscar,
html.tema-oscuro .gestor .cuota { background: #0b1220; color: #e7eefc; border-color: #2a3854; }
html.tema-oscuro .zona-lista.soltando { background: #1c1740; }
html.tema-oscuro .accion:hover { background: #2a2150; color: #ddd6fe; }
html.tema-oscuro #dialogo-nombre,
html.tema-oscuro body.escritorio #dialogo-clave {
  color-scheme: dark;
  background: #141c2f;
  color: #e7eefc;
  border-color: #2a3854;
}
html.tema-oscuro #dialogo-nombre input,
html.tema-oscuro body.escritorio #dialogo-clave input {
  background: #0b1220;
  color: #e7eefc;
  border-color: #2a3854;
}
html.tema-oscuro body.escritorio #dialogo-clave .ojo,
html.tema-oscuro body.escritorio #dialogo-clave .ayuda { color: #93a0bd; }

@media (max-width: 800px) {
  body.escritorio { grid-template-columns: 1fr; }
  .menu-lateral { position: static; height: auto; }
  .menu-nav { flex-direction: row; overflow: auto; }
  .menu-item { white-space: nowrap; }
  .menu-pie { flex-direction: row; flex-wrap: wrap; }
  body.escritorio .gestor, #marco-pagina { height: auto; min-height: 70vh; }
}
