/* Portal Unegocios — FEN, Universidad de Chile. Azul marino institucional, Source Sans 3. */

@font-face {
    font-family: "Source Sans 3";
    src: url("../fonts/source-sans-3-latin-wght.woff2") format("woff2");
    font-weight: 200 900;
    font-display: swap;
}

:root {
    /* Paleta de Unegocios: índigo, azul eléctrico y coral. */
    --marino: #0d0b70; --marino-2: #1d1a9e; --marino-texto: #dcdcf5; --marino-tenue: #b4b3e3;
    --coral: #f03a4a; --coral-suave: #fde8ea;
    --fondo: #f4f5f9; --tarjeta: #fff; --texto: #1b1a33; --suave: #5d5f75;
    --borde: #e3e4ee; --borde-fila: #eeeff5; --borde-campo: #c9cbd9;
    --acento: #0034d9; --acento-hover: #0029ab; --acento-texto: #fff; --acento-suave: #e9eeff;
    --ok: #13734a; --ok-fondo: #e2f5ec;
    --alerta: #b4232f; --alerta-fondo: #fde8ea;
    --aviso: #9a5a00; --aviso-fondo: #fff3d6;
    --info: #0034d9; --info-fondo: #e9eeff;
    --neutro: #454761; --neutro-fondo: #eeeff5;
    --radio: 14px; --radio-chico: 9px;
    --sombra: 0 1px 2px rgba(13, 11, 112, .05), 0 2px 8px rgba(13, 11, 112, .05);
    --sombra-flotante: 0 14px 36px rgba(13, 11, 112, .18);
    --anillo: 0 0 0 3px rgba(0, 52, 217, .25);
    --transicion: 140ms ease;
    color-scheme: light only;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--fondo); color: var(--texto);
    font: 16px/1.5 "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--acento); text-underline-offset: 2px; }
a:hover { color: var(--acento-hover); }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; } }

h1, h2, h3 { line-height: 1.2; }
h1 { font-size: 28px; font-weight: 700; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 20px; font-weight: 700; margin: 32px 0 12px; }
h3 { font-size: 17px; font-weight: 700; margin: 2px 0 4px; }

/* --- Barra superior -------------------------------------------------------- */
.barra {
    display: flex; align-items: center; gap: 24px; padding: 12px 32px;
    background: var(--marino); color: var(--marino-texto); position: sticky; top: 0; z-index: 10;
}
.marca { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.marca:hover { color: #fff; }
.marca-sigla {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
    background: rgba(255, 255, 255, .14); font-weight: 700; font-size: 18px;
}
.marca-texto { font-weight: 600; line-height: 1.2; }
.marca-texto small { font-weight: 400; color: var(--marino-tenue); font-size: 13px; }
.barra nav { display: flex; gap: 4px; flex: 1; }
.barra nav a { padding: 6px 12px; border-radius: var(--radio-chico); color: var(--marino-texto); text-decoration: none; font-weight: 600; font-size: 15px; transition: background var(--transicion); }
.barra nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.barra nav a[aria-current="page"] { background: rgba(255, 255, 255, .16); color: #fff; }

.cuenta { position: relative; }
.cuenta summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; font-size: 15px; }
.cuenta summary::-webkit-details-marker { display: none; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #d8e3f5; color: var(--marino); font-size: 13px; font-weight: 700; }
.cuenta .menu {
    position: absolute; right: 0; top: calc(100% + 10px); min-width: 220px; display: grid; gap: 4px; padding: 8px;
    background: var(--tarjeta); color: var(--texto); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra-flotante);
}
.cuenta .menu > span { padding: 6px 10px; font-size: 13px; border-bottom: 1px solid var(--borde-fila); margin-bottom: 4px; }
.cuenta .menu a, .cuenta .menu .enlace { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radio-chico); text-decoration: none; color: var(--texto); font-size: 15px; }
.cuenta .menu a:hover, .cuenta .menu .enlace:hover { background: var(--neutro-fondo); }
.cuenta .menu form { margin: 0; }

/* --- Estructura ------------------------------------------------------------ */
.pagina { max-width: 1120px; margin: 0 auto; padding: 28px 32px 56px; }
.pagina.estrecha { max-width: 440px; padding-top: 8vh; }
.pagina > h1 + p.suave { margin-top: 0; }
.migas { font-size: 14px; color: var(--suave); margin: 0 0 8px; }
.migas a { color: var(--suave); text-decoration: none; }
.migas a:hover { color: var(--acento); text-decoration: underline; }

.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 20px 24px; margin-bottom: 16px; box-shadow: var(--sombra); }
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.rejilla .tarjeta { margin: 0; }
a.enlace-tarjeta { display: block; color: inherit; text-decoration: none; transition: border-color var(--transicion), box-shadow var(--transicion), transform var(--transicion); }
a.enlace-tarjeta:hover { border-color: var(--acento); box-shadow: var(--sombra-flotante); transform: translateY(-1px); color: inherit; }
.columna { display: grid; gap: 14px; }
.centro { text-align: center; }
.sin-margen { margin: 0; }
.vacio { color: var(--suave); padding: 24px; text-align: center; background: var(--tarjeta); border: 1px dashed var(--borde-campo); border-radius: var(--radio); }

/* --- Acceso ------------------------------------------------------------------ */
.acceso { padding: 32px; }
.acceso h1 { font-size: 24px; text-align: center; }
.acceso > .suave { text-align: center; margin-top: 0; }
.marca-acceso { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 20px; color: var(--texto); }
.marca-acceso .marca-sigla { width: 52px; height: 52px; font-size: 22px; background: var(--marino); color: #fff; }
.marca-acceso small { color: var(--suave); font-size: 14px; }

/* --- Formularios y botones ---------------------------------------------------- */
label { display: grid; gap: 6px; font-size: 15px; font-weight: 600; }
input, select, textarea {
    font: inherit; font-weight: 400; min-height: 40px; padding: 8px 12px; border: 1px solid var(--borde-campo); border-radius: var(--radio-chico);
    background: var(--tarjeta); color: var(--texto); transition: border-color var(--transicion), box-shadow var(--transicion);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--acento); box-shadow: var(--anillo); }
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 18px; height: 18px; accent-color: var(--acento); }
.boton {
    font: inherit; font-weight: 600; font-size: 15px; min-height: 40px; padding: 8px 16px; border-radius: var(--radio-chico);
    border: 1px solid var(--borde-campo); background: var(--tarjeta); color: var(--texto); cursor: pointer; text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background var(--transicion), border-color var(--transicion);
}
.boton:hover { background: var(--neutro-fondo); color: var(--texto); }
.boton.primario { background: var(--acento); border-color: var(--acento); color: var(--acento-texto); }
.boton.primario:hover { background: var(--acento-hover); border-color: var(--acento-hover); color: var(--acento-texto); }
.boton:disabled { opacity: .55; cursor: wait; }
.boton.chico { min-height: 32px; padding: 4px 12px; font-size: 14px; }
.enlace { background: none; border: 0; padding: 0; color: var(--acento); cursor: pointer; font: inherit; }
.barra-acciones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0; }
.barra-acciones form { margin: 0; }
.formulario { max-width: 680px; }
.formulario fieldset, .encuesta fieldset { border: 0; padding: 0; margin: 0; }
.formulario legend, .encuesta legend { font-weight: 700; margin-bottom: 10px; }
.opciones { display: grid; gap: 6px; max-height: 340px; overflow-y: auto; }
.opcion { display: flex; gap: 10px; align-items: center; font-weight: 400; padding: 10px 12px; border: 1px solid var(--borde); border-radius: var(--radio-chico); cursor: pointer; transition: border-color var(--transicion), background var(--transicion); }
.opcion:hover { border-color: var(--acento); }
.opcion:has(input:checked) { border-color: var(--acento); background: var(--acento-suave); }
.text-danger, .error { color: var(--alerta); font-size: 14px; }

/* --- Avisos y chips ----------------------------------------------------------- */
.aviso { padding: 12px 16px; border-radius: var(--radio-chico); background: var(--info-fondo); color: var(--texto); margin: 0 0 16px; border-left: 4px solid var(--info); }
.aviso.ok { background: var(--ok-fondo); border-color: var(--ok); }
.aviso.error { background: var(--alerta-fondo); border-color: var(--alerta); }
.aviso ul { margin: 6px 0 0; padding-left: 20px; }
.chip { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 99px; white-space: nowrap; background: var(--neutro-fondo); color: var(--neutro); }
.chip.ok { background: var(--ok-fondo); color: var(--ok); }
.chip.info { background: var(--info-fondo); color: var(--info); }
.chip.alerta { background: var(--alerta-fondo); color: var(--alerta); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 12px 0 0; }

/* --- Tablas ------------------------------------------------------------------ */
.tabla-caja { overflow-x: auto; }
.tarjeta.tabla-caja { padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 10px 16px; border-bottom: 1px solid var(--borde-fila); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--suave); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--fondo); border-bottom-color: var(--borde); }
tbody tr { transition: background var(--transicion); }
tbody tr:hover { background: color-mix(in srgb, var(--acento-suave) 45%, transparent); }
tr:last-child td { border-bottom: 0; }
.derecha, th.derecha { text-align: right; }

/* --- Indicadores, avance, utilidades ----------------------------------------- */
.indicadores { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin: 20px 0 8px; }
.indicadores .tarjeta { display: grid; gap: 2px; margin: 0; }
.indicadores span { font-size: 12px; color: var(--suave); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.indicadores strong { font-size: 30px; line-height: 1.15; font-weight: 700; }
.indicadores strong small { font-size: 15px; font-weight: 400; color: var(--suave); }
.chico-grande { font-size: 18px !important; }
.avance { height: 6px; background: var(--neutro-fondo); border-radius: 99px; overflow: hidden; margin: 12px 0 4px; }
.avance span { display: block; height: 100%; background: var(--acento); border-radius: 99px; }
.num { font-variant-numeric: tabular-nums; }
.suave { color: var(--suave); }
.chico { font-size: 14px; }
.rojo { color: var(--alerta); } .verde { color: var(--ok); }
.nota { font-size: 18px; }

/* --- Clases ------------------------------------------------------------------ */
.lista-clases { list-style: none; padding: 4px 24px; margin: 0 0 16px; }
.lista-clases li { display: flex; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--borde-fila); }
.lista-clases li:last-child { border-bottom: 0; }
.lista-clases .fecha { display: grid; text-align: center; min-width: 58px; padding: 6px 4px; border-radius: var(--radio-chico); background: var(--acento-suave); color: var(--acento); line-height: 1.15; }
.lista-clases .fecha small { text-transform: uppercase; font-size: 12px; font-weight: 600; }

/* --- Encuesta ----------------------------------------------------------------- */
.encuesta { display: grid; gap: 24px; }
.escala { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.escala label { display: block; position: relative; font-weight: 400; }
.escala input { position: absolute; opacity: 0; }
.escala span { display: block; text-align: center; padding: 10px 4px; border: 1px solid var(--borde-campo); border-radius: var(--radio-chico); font-size: 14px; cursor: pointer; height: 100%; transition: background var(--transicion); }
.escala span:hover { border-color: var(--acento); }
.escala input:checked + span { background: var(--acento); color: var(--acento-texto); border-color: var(--acento); }
.escala input:focus-visible + span { outline: 2px solid var(--acento); outline-offset: 2px; }

/* --- Planilla de notas -------------------------------------------------------- */
.planilla td { vertical-align: middle; }
.celda { width: 6em; min-height: 36px; text-align: right; padding: 6px 10px; }
.celda.rojo { color: var(--alerta); border-color: var(--alerta); font-weight: 700; }
tr.con-error td { background: var(--alerta-fondo); }
.guardado { color: var(--ok); font-size: 13px; margin-left: 6px; animation: desvanecer 2.5s forwards; }
@keyframes desvanecer { 70% { opacity: 1; } 100% { opacity: 0; } }
.htmx-request.celda { opacity: .6; }
dialog.ventana { border: 1px solid var(--borde); border-radius: var(--radio); background: var(--tarjeta); color: var(--texto); padding: 24px; width: min(480px, calc(100% - 32px)); box-shadow: var(--sombra-flotante); }
dialog.ventana::backdrop { background: rgba(15, 25, 45, .45); }

/* --- Asistencia --------------------------------------------------------------- */
.marcar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; background: var(--ok-fondo); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.marcar .estado-gps { flex-basis: 100%; margin: 0; }
.marcar .estado-gps:empty { display: none; }
.codigo-dia { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: var(--radio-chico); background: var(--acento-suave); color: var(--acento); font-weight: 600; }
.codigo-dia strong { font-size: 24px; letter-spacing: .18em; }
details.tarjeta summary { cursor: pointer; font-weight: 600; }
details.tarjeta[open] summary { margin-bottom: 12px; }
details.tarjeta .tabla-caja { margin: 0 -24px -20px; }

/* --- Dirección académica ------------------------------------------------------ */
.pestanas { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--borde); margin: 20px 0 16px; }
.pestanas a { padding: 10px 14px; text-decoration: none; color: var(--suave); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.pestanas a:hover { color: var(--texto); }
.pestanas a[aria-current] { color: var(--acento); border-color: var(--acento); }
.espera-urgente { color: var(--alerta); font-weight: 700; } .espera-alerta { color: #9a6700; font-weight: 700; }
.antecedentes dt { font-size: 13px; color: var(--suave); margin-top: 12px; font-weight: 600; }
.antecedentes dd { margin: 2px 0 0; white-space: pre-line; }
.decision { display: grid; gap: 12px; border-color: var(--acento); }
.decision .opciones { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); max-height: none; }

/* --- Móvil -------------------------------------------------------------------- */
@media (max-width: 760px) {
    .barra { padding: 10px 16px; gap: 12px; flex-wrap: wrap; }
    .marca-texto small, .cuenta .quien { display: none; }
    .barra nav { order: 3; flex-basis: 100%; overflow-x: auto; }
    .pagina { padding: 20px 16px 40px; }
    h1 { font-size: 24px; }
    .tarjeta { padding: 16px; }
    details.tarjeta .tabla-caja { margin: 0 -16px -16px; }
    th, td { padding: 8px 12px; }
    .indicadores strong { font-size: 26px; }
    .escala { grid-template-columns: 1fr; }
}

/* === Íconos y componentes visuales ============================================ */
.icono { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
h1 .icono, h2 .icono { color: var(--acento); }
h2:has(> .icono) { display: flex; align-items: center; gap: 10px; }

/* Barra: degradé índigo y marcador coral en la sección activa. */
.barra { background: linear-gradient(110deg, var(--marino) 0%, var(--marino-2) 100%); box-shadow: 0 2px 12px rgba(13, 11, 112, .25); }
.marca-sigla { background: var(--coral); color: #fff; box-shadow: 0 2px 6px rgba(240, 58, 74, .4); }
.barra nav a { display: inline-flex; align-items: center; gap: 8px; position: relative; }
.barra nav a .icono { opacity: .85; }
.barra nav a[aria-current="page"] { background: rgba(255, 255, 255, .14); }
.barra nav a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -13px; height: 3px; border-radius: 3px 3px 0 0; background: var(--coral); }
.avatar { background: linear-gradient(135deg, #fff, #dfe2ff); color: var(--marino); box-shadow: 0 0 0 2px rgba(255, 255, 255, .35); }
.cuenta .menu a, .cuenta .menu .enlace { display: flex; align-items: center; gap: 10px; }
.cuenta .menu .icono { color: var(--suave); }
.marca-acceso .marca-sigla { background: var(--coral); }

/* Botones con relieve. */
.boton { box-shadow: 0 1px 2px rgba(13, 11, 112, .06); }
.boton:hover { border-color: var(--acento); color: var(--acento); background: var(--acento-suave); }
.boton:active { transform: translateY(1px); }
.boton .icono { width: 1.1em; height: 1.1em; }
.boton.primario { background: linear-gradient(180deg, #1a4ef0, var(--acento)); border-color: var(--acento); box-shadow: 0 2px 6px rgba(0, 52, 217, .3), inset 0 1px 0 rgba(255, 255, 255, .15); }
.boton.primario:hover { background: var(--acento-hover); color: #fff; box-shadow: 0 4px 12px rgba(0, 52, 217, .35); }
.boton.destacado { background: linear-gradient(180deg, #ff4b5a, var(--coral)); border-color: var(--coral); color: #fff; box-shadow: 0 2px 8px rgba(240, 58, 74, .35); }
.boton.destacado:hover { background: #d92c3b; border-color: #d92c3b; color: #fff; }
/* Indicadores con medalla de color. */
.indicadores .tarjeta { position: relative; padding-right: 72px; }
.medalla { position: absolute; top: 18px; right: 18px; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--acento-suave); color: var(--acento); }
.medalla .icono { width: 22px; height: 22px; }
.medalla.verde { background: var(--ok-fondo); color: var(--ok); }
.medalla.coral { background: var(--coral-suave); color: var(--coral); }
.medalla.ambar { background: var(--aviso-fondo); color: var(--aviso); }

/* Chips con punto de estado. */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }

/* Tarjetas de programa con franja superior. */
a.enlace-tarjeta { border-top: 4px solid var(--acento); }
a.enlace-tarjeta h3 { display: flex; justify-content: space-between; gap: 8px; }
a.enlace-tarjeta h3 .icono { color: var(--suave); transition: transform var(--transicion), color var(--transicion); }
a.enlace-tarjeta:hover h3 .icono { color: var(--acento); transform: translateX(3px); }
.tarjeta-seccion { border-top: 4px solid var(--acento); }

/* Avisos con ícono. */
.aviso:has(> .icono) { display: flex; gap: 10px; align-items: flex-start; }
.aviso > .icono { margin-top: 2px; color: var(--info); }
.aviso.ok > .icono { color: var(--ok); } .aviso.error > .icono { color: var(--alerta); }
.aviso.ambar { background: var(--aviso-fondo); border-color: var(--aviso); }
.aviso.ambar > .icono { color: var(--aviso); }

/* Marcar asistencia: tarjeta destacada. */
.marcar { background: linear-gradient(120deg, var(--acento-suave), var(--tarjeta)); border: 1px solid var(--acento); border-left: 5px solid var(--coral); }
.marcar strong { display: inline-flex; align-items: center; gap: 8px; }

/* Datos con ícono (fecha, lugar, profesor). */
.dato { display: inline-flex; align-items: center; gap: 6px; }
.dato .icono { color: var(--suave); }
.migas { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.migas .icono { width: 14px; height: 14px; }
th { background: color-mix(in srgb, var(--acento-suave) 55%, var(--fondo)); }
.lista-clases .fecha { background: linear-gradient(160deg, var(--acento), var(--marino-2)); color: #fff; }
.pestanas a[aria-current] { color: var(--acento); border-color: var(--coral); }
.codigo-dia strong { color: var(--marino); }
.enlace-fila { color: var(--texto); text-decoration: none; }
.enlace-fila:hover { color: var(--acento); text-decoration: underline; }
