/* Gestión Académica IHS
   Tinta azul marino para la navegación, verde pizarra como acento,
   serif institucional en títulos y sans del sistema para el trabajo diario. */

:root {
  --tinta: #1f2a44;
  --tinta-2: #2b3858;
  --tinta-texto: #c9d1e3;
  --fondo: #f3f5f8;
  --superficie: #ffffff;
  --texto: #1d2433;
  --texto-2: #5a6478;
  --linea: #dde1e8;
  --linea-suave: #eceff4;
  --acento: #2e6b5e;
  --acento-oscuro: #22524a;
  --acento-tinte: #e6f0ed;
  --ocre: #8a6510;
  --ocre-tinte: #fbf3df;
  --rojo: #b42318;
  --rojo-tinte: #fdecea;
  --radio: 6px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --foco: 0 0 0 3px rgba(46, 107, 94, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 15px/1.5 var(--sans);
}
a { color: var(--acento); }
a:hover { color: var(--acento-oscuro); }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font: 600 1.75rem/1.2 var(--serif); letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
:focus-visible { outline: none; box-shadow: var(--foco); border-radius: 3px; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--superficie); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.muted { color: var(--texto-2); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.text-warn { color: var(--ocre); font-weight: 600; }
.center { text-align: center; }
.inline { display: inline; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { background: var(--tinta); color: var(--tinta-texto); padding: 24px 0 32px; }
.brand { padding: 0 24px 22px; border-bottom: 1px solid var(--tinta-2); margin-bottom: 16px; }
.brand-name { color: #fff; font: 600 15px/1.3 var(--serif); margin: 0 0 16px; }
.brand-year { margin: 0; display: flex; flex-direction: column; }
.brand-year-label { font-size: 12px; color: var(--tinta-texto); }
.brand-year-num { font: 400 3rem/1 var(--serif); color: #fff; letter-spacing: -0.02em; font-variant-numeric: oldstyle-nums; }
.nav-group { margin: 18px 24px 6px; font-size: 12px; color: #8e9ab5; }
.nav { list-style: none; margin: 0; padding: 0 12px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--radio);
  color: var(--tinta-texto); text-decoration: none;
}
.nav a:hover { background: var(--tinta-2); color: #fff; }
.nav a[aria-current="page"] { background: #fff; color: var(--tinta); font-weight: 600; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 10px 32px; background: var(--superficie); border-bottom: 1px solid var(--linea);
}
.topbar-user { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.who { display: flex; flex-direction: column; text-align: right; margin-right: 8px; line-height: 1.25; }
.who-name { font-weight: 600; }
.who-role { font-size: 13px; color: var(--texto-2); }
.menu-toggle { display: none; margin-right: auto; background: none; border: 0; padding: 6px; color: var(--texto); cursor: pointer; }
main { padding: 28px 32px 48px; max-width: 1240px; width: 100%; }
main:focus { outline: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .lead { margin: 0; max-width: 68ch; }
.lead { color: var(--texto-2); }
.crumb { margin: 0 0 4px; font-size: 14px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Paneles y rejillas ---------- */
.panel { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: 20px 22px; margin-bottom: 20px; }
.panel.narrow { max-width: 640px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.panel.empty { text-align: left; color: var(--texto-2); }
.panel.empty h2 { color: var(--texto); }
.panel.callout { border-color: var(--acento); background: var(--acento-tinte); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2 > .panel { margin-bottom: 0; }
.grid-2 + * { margin-top: 20px; }
.grid-form { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.grid-form > .panel, .side > .panel { margin-bottom: 0; }
.side { display: flex; flex-direction: column; gap: 20px; }

.figures { display: grid; gap: 14px; margin: 0; }
.figures div { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--linea-suave); padding-bottom: 10px; }
.figures dt { color: var(--texto-2); }
.figures dd { margin: 0; font: 600 1.6rem/1 var(--serif); }

.kv { margin: 0 0 16px; display: grid; gap: 8px; }
.kv div { display: grid; grid-template-columns: 130px 1fr; gap: 8px; }
.kv dt { color: var(--texto-2); }
.kv dd { margin: 0; }
.stack { display: grid; gap: 8px; }

.todo { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.todo li { display: flex; gap: 10px; align-items: flex-start; color: var(--ocre); }
.todo a { color: var(--texto); }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--linea-suave); }
.activity li:last-child { border-bottom: 0; }
.activity time { color: var(--texto-2); font-variant-numeric: tabular-nums; font-size: 14px; }

.mini-log { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.mini-log li { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--linea-suave); font-variant-numeric: tabular-nums; }
.mini-log li.fail span:nth-child(2) { color: var(--rojo); }

/* ---------- Tablas ---------- */
.table-wrap { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); overflow-x: auto; margin-bottom: 20px; }
.panel .table-wrap { border: 0; margin: 0 -22px -20px; border-radius: 0; border-top: 1px solid var(--linea); }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--linea-suave); }
.table thead th { font-size: 13px; font-weight: 600; color: var(--texto-2); background: #f8f9fb; border-bottom: 1px solid var(--linea); position: sticky; top: 0; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfc; }
.table.compact th, .table.compact td { padding: 7px 10px; }
.panel > .table.compact { margin: 0 -10px; width: calc(100% + 20px); }
.group-row th { background: var(--fondo); font: 600 14px var(--serif); color: var(--tinta); padding-top: 14px; }
.row-off td { color: var(--texto-2); }
.row-error td { background: var(--rojo-tinte); }
.table.log td { font-size: 14px; }
.changes div { margin-bottom: 2px; }
.changes .k { color: var(--texto-2); }
.changes del { color: var(--rojo); text-decoration: line-through; }
.changes ins { color: var(--acento-oscuro); text-decoration: none; }
.table input[type="date"], .table input[type="number"], .table select { padding: 5px 8px; font-size: 14px; }
.table input.num { width: 80px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.badge-activo, .badge-abierto { background: var(--acento-tinte); color: var(--acento-oscuro); }
.badge-planificacion, .badge-pendiente { background: var(--ocre-tinte); color: var(--ocre); }
.badge-cerrado { background: #eceef2; color: var(--texto-2); }
.badge-alerta { background: var(--rojo-tinte); color: var(--rojo); }

/* ---------- Formularios ---------- */
.form { display: grid; gap: 14px; }
.form h2 { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--linea-suave); }
.form h2:first-of-type { border-top: 0; padding-top: 0; }
.field { display: grid; gap: 5px; margin: 0; min-width: 0; border: 0; padding: 0; align-content: start; }
fieldset.field legend { font-weight: 600; margin-bottom: 4px; padding: 0; }
label { font-weight: 600; font-size: 14px; }
.opt { font-weight: 400; color: var(--texto-2); }
.help, .hint { font-size: 13px; color: var(--texto-2); margin: 0; }
.hint { margin-top: 14px; }
input[type="text"], input[type="password"], input[type="email"], input[type="search"], input[type="number"], input[type="date"], input:not([type]), select {
  width: 100%; padding: 9px 11px;
  font: inherit; color: var(--texto);
  background: #fff; border: 1px solid #c7cdd8; border-radius: var(--radio);
}
input:focus, select:focus { border-color: var(--acento); box-shadow: var(--foco); outline: none; }
.field-error { color: var(--rojo); font-size: 13px; margin: 0; }
.row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.choice { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.choice input { margin-top: 4px; accent-color: var(--acento); }
.role-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice.role { border: 1px solid var(--linea); border-radius: var(--radio); padding: 10px 12px; }
.choice.role:has(input:checked) { border-color: var(--acento); background: var(--acento-tinte); }
.choice.role span { display: flex; flex-direction: column; gap: 2px; }
.choice.role .muted { font-size: 13px; }
.form > .btn:not(.btn-block) { justify-self: start; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.filters .field { width: 200px; }
.filters .field:first-child { width: 280px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input[type="date"] { width: auto; }
.inline-form select { width: auto; }
.compact-form { gap: 10px; padding: 12px; min-width: 260px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radio);
  font: 600 14px/1.2 var(--sans); text-decoration: none; cursor: pointer;
  background: var(--superficie); color: var(--texto); border: 1px solid #c7cdd8;
}
.btn:hover { background: #f6f7f9; color: var(--texto); }
.btn-primary { background: var(--acento); border-color: var(--acento); color: #fff; }
.btn-primary:hover { background: var(--acento-oscuro); color: #fff; }
.btn-danger { color: var(--rojo); border-color: #e7b4ae; }
.btn-danger:hover { background: var(--rojo-tinte); color: var(--rojo); }
.btn-quiet { border-color: transparent; background: transparent; font-weight: 500; }
.btn-quiet:hover { background: var(--fondo); }
.btn-small { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }
.link-btn { background: none; border: 0; color: var(--acento); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
summary.btn { list-style: none; }
summary.btn::-webkit-details-marker { display: none; }
.js .js-hide { display: none; }

details.confirm-box, details.edit-row { position: relative; display: inline-block; margin: 4px 8px 4px 0; }
details.confirm-box[open] > form, details.edit-row[open] > form {
  position: absolute; z-index: 5; right: 0; top: calc(100% + 6px); width: 300px;
  background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 14px; box-shadow: 0 8px 24px rgba(31, 42, 68, .14);
}
.panel details.confirm-box[open] > form { left: 0; right: auto; }

.reopen-reason { display: grid; gap: 4px; margin-top: 6px; }
.js .reopen-reason { display: none; }
.js .reopen-reason.show { display: grid; }

/* ---------- Mensajes ---------- */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radio); margin-bottom: 18px; border: 1px solid; }
.flash-exito { background: var(--acento-tinte); border-color: #b9d4cc; color: var(--acento-oscuro); }
.flash-error { background: var(--rojo-tinte); border-color: #f1b9b3; color: var(--rojo); }
.flash-aviso { background: var(--ocre-tinte); border-color: #ecd9a7; color: var(--ocre); }

.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 8px 0 24px; color: var(--texto-2); }

/* ---------- Credenciales y doble factor ---------- */
.credentials { display: flex; gap: 32px; margin: 0; flex-wrap: wrap; }
.credentials dt { font-size: 13px; color: var(--texto-2); }
.credentials dd { margin: 0; font-size: 1.15rem; font-weight: 600; }
.secret { font: 600 1.2rem/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .06em; word-break: break-all; }
.codes { list-style: none; padding: 16px; margin: 16px 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 24px; background: var(--fondo); border-radius: var(--radio); font: 600 1.1rem ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .05em; }
.steps { padding-left: 1.25rem; display: grid; gap: 12px; }
.qr { margin: 12px 0; }
.qr svg { width: 200px; height: 200px; border: 1px solid var(--linea); border-radius: var(--radio); }
.code-input { font: 600 1.4rem/1 ui-monospace, Consolas, monospace; letter-spacing: .3em; text-align: center; }

/* ---------- Ingreso ---------- */
body.guest { background: var(--tinta); min-height: 100vh; display: flex; }
.guest-wrap { margin: auto; padding: 40px 16px; width: 100%; max-width: 440px; }
.guest-head { color: #fff; margin-bottom: 24px; }
.guest-inst { font: 400 2rem/1.15 var(--serif); margin: 0 0 6px; letter-spacing: -0.01em; }
.guest-sys { color: var(--tinta-texto); margin: 0; }
.guest-card { background: var(--superficie); border-radius: 10px; padding: 28px; }
.guest-title { font: 600 1.35rem/1.2 var(--serif); margin-bottom: 16px; }
.guest-foot { color: #8e9ab5; font-size: 13px; margin-top: 18px; }
.guest .setup .steps { margin-bottom: 18px; }
.guest-wrap:has(.setup) { max-width: 520px; }

/* ---------- Errores ---------- */
.error-page { max-width: 520px; padding: 40px 0; }
.error-code { font: 400 4rem/1 var(--serif); color: var(--texto-2); margin-bottom: 8px; }


/* ---------- Fase 2: académico ---------- */
textarea { width: 100%; padding: 9px 11px; font: inherit; color: var(--texto); background: #fff; border: 1px solid #c7cdd8; border-radius: var(--radio); resize: vertical; }
textarea:focus { border-color: var(--acento); box-shadow: var(--foco); outline: none; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.stack-lg > .panel { margin-bottom: 0; }
.kv.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.kv.two-col div { grid-template-columns: 120px 1fr; }
.note-sensitive { background: var(--ocre-tinte); border-left: 3px solid var(--ocre); padding: 10px 12px; border-radius: 0 var(--radio) var(--radio) 0; font-size: 14px; }
.add-block { margin-top: 14px; }
.add-block > summary { list-style: none; cursor: pointer; display: inline-flex; }
.add-block > summary::-webkit-details-marker { display: none; }
.add-block[open] > summary { margin-bottom: 12px; }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 16px; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.align-end { align-self: end; padding-bottom: 10px; }
.callout-warn { border-color: #ecd9a7; background: var(--ocre-tinte); }
.callout-warn h2 { color: var(--ocre); }
.text-error { color: var(--rojo); }
.actions.start { justify-content: flex-start; }
.table-wrap.flush { border: 0; border-radius: 0; margin: 0 -22px; }
.bottom-space { margin-bottom: 14px; }
details.confirm-box.block { display: block; margin: 10px 0 0; }
details.confirm-box.block[open] > form { position: static; width: auto; box-shadow: none; margin-top: 8px; }
.summary-list { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 8px 28px; }
.add-row { margin-top: 14px; }
.add-row .grow { flex: 1 1 240px; width: auto; }
.add-row select, .add-row input[type="date"] { width: auto; max-width: 100%; min-width: 0; }
.add-row select { flex: 1 1 220px; }
.num-sm { width: 74px !important; }

.plan-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 20px; align-items: start; }
.grade-list { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: 8px; position: sticky; top: 12px; }
.grade-list a { display: block; padding: 6px 10px; border-radius: var(--radio); color: var(--texto); text-decoration: none; font-size: 14px; }
.grade-list a:hover { background: var(--fondo); }
.grade-list a[aria-current="page"] { background: var(--acento-tinte); color: var(--acento-oscuro); font-weight: 600; }
.nav-group-dark { margin: 10px 10px 4px; font-size: 12px; color: var(--texto-2); }

.weights { display: block; width: 100%; height: 12px; border-radius: 3px; overflow: hidden; margin: 6px 0 10px; }
.w0 { fill: var(--acento); background: var(--acento); }
.w1 { fill: #6e93b8; background: #6e93b8; }
.w2 { fill: var(--ocre); background: var(--ocre); }
.w3 { fill: #9a7bb0; background: #9a7bb0; }
.weights-legend { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 4px; font-size: 14px; }
.weights-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: 0; }
.row-comp { display: grid; grid-template-columns: 1fr 90px; gap: 10px; margin-bottom: 8px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--linea); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--texto-2); border-bottom: 2px solid transparent; white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.tabs a[aria-current="page"] { color: var(--texto); border-bottom-color: var(--acento); font-weight: 600; }
.tabs .badge { font-size: 11px; padding: 1px 7px; }

.grades-wrap { max-height: 72vh; overflow: auto; }
.table.grades { font-size: 14px; }
.table.grades th, .table.grades td { padding: 6px 8px; border-right: 1px solid var(--linea-suave); }
.table.grades thead th { top: 0; z-index: 2; }
.table.grades thead tr:nth-child(2) th { top: 36px; }
.sticky-col { position: sticky; left: 0; z-index: 1; background: var(--superficie); min-width: 230px; text-align: left; font-weight: 500; }
thead .sticky-col { z-index: 3; background: #f8f9fb; }
.comp-head { text-align: center !important; background: #eef1f5 !important; }
.act-head { min-width: 74px; max-width: 120px; vertical-align: bottom !important; font-weight: 500 !important; }
.act-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 110px; color: var(--texto); }
.act-head .muted { display: block; font-size: 11px; }
.link-btn.tiny { font-size: 11px; color: var(--rojo); }
.num-col { text-align: center !important; white-space: nowrap; }
.avg, .avg-head { background: #f8f9fb; color: var(--texto-2); }
.grade-input { width: 58px !important; padding: 5px 6px !important; text-align: center; font-variant-numeric: tabular-nums; }
.grade-input:invalid, .grade-input.bad { border-color: var(--rojo); background: var(--rojo-tinte); }
.n-baja { color: var(--rojo); font-weight: 600; }
.n-media { color: var(--ocre); font-weight: 600; }
.miss { color: var(--ocre); margin-left: 2px; }
.estado-aprobado, .estado-aprobado_extraordinaria, .estado-recuperado { background: var(--acento-tinte); color: var(--acento-oscuro); }
.estado-recuperacion, .estado-extraordinaria { background: var(--ocre-tinte); color: var(--ocre); }
.estado-reprobado { background: var(--rojo-tinte); color: var(--rojo); }
.estado-sin_notas, .estado-en_curso { background: #eceef2; color: var(--texto-2); }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--fondo) 35%); padding: 16px 0 6px; }
.cuadro th.rot { height: 120px; vertical-align: bottom; }
.cuadro th.rot span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-weight: 500; }

@media (max-width: 960px) {
  .plan-layout { grid-template-columns: 1fr; }
  .grade-list { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .nav-group-dark { width: 100%; }
  .check-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv.two-col { grid-template-columns: 1fr; }
}

/* ---------- Pantallas pequeñas ---------- */
@media (max-width: 960px) {
  .grid-2, .grid-form { grid-template-columns: 1fr; }
  .role-list { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; inset: 0 25% 0 0; z-index: 20; overflow-y: auto; }
  .sidebar.open { display: block; }
  .menu-toggle { display: block; }
  .topbar { padding: 8px 16px; }
  .who { display: none; }
  main { padding: 20px 16px 40px; }
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .filters .field, .filters .field:first-child { width: 100%; }
  .activity li { grid-template-columns: 1fr; gap: 0; }
  h1 { font-size: 1.45rem; }
}

@media print {
  .sidebar, .topbar, .actions, .flash { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .panel { border: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Indicadores de logro */
.seg { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }
.seg .muted { margin-left: 6px; font-size: 13px; }
.ind-layout { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; align-items: start; }
.ind-list { padding: 12px; position: sticky; top: 12px; max-height: 80vh; overflow: auto; }
.ind-list h2 { font-size: .9rem; margin-bottom: 8px; }
.ind-list ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ind-list a { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px; border-radius: 4px; text-decoration: none; color: var(--texto); font-size: 13px; }
.ind-list a:hover { background: var(--fondo); }
.ind-list a[aria-current="page"] { background: var(--acento-tinte); font-weight: 600; }
.ind-num { font-variant-numeric: tabular-nums; }
.ind-prog { font-size: 11px; color: var(--texto-2); }
.ind-prog.part { color: var(--ocre); }
.ind-prog.done { color: var(--acento); }
.ind-prog .icon { width: 14px; height: 14px; }
.ind-title { font: 600 1.15rem/1.4 var(--serif); margin: 4px 0 12px; }
.ind-resp { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.ind-resp li { display: flex; gap: 10px; align-items: baseline; }
.ind-key { flex: none; min-width: 28px; text-align: center; font-weight: 600; font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--fondo); border: 1px solid var(--linea); }
.ind-table input[type="radio"] { width: 18px; height: 18px; accent-color: var(--acento); }
.ind-table td.center, .ind-table th.center { width: 48px; }
.ind-fill td { background: #f8f9fb; font-size: 12px; }
.ind-obs { width: 100%; min-width: 160px; padding: 4px 6px; border: 1px solid var(--linea); border-radius: 4px; font: inherit; font-size: 13px; }
.ind-matrix td.num-col, .ind-matrix th.num-col { min-width: 30px; padding: 4px 3px; text-align: center; }
.ind-matrix thead a { text-decoration: none; }
.ind-v1 { background: #fbf3df; }
.ind-v2 { background: #eef5f2; }
.ind-v3 { background: #dcebe6; color: var(--acento-oscuro); font-weight: 600; }
.ind-v4 { color: var(--texto-2); font-size: 11px; }
@media (max-width: 760px) {
  .ind-layout { grid-template-columns: minmax(0, 1fr); }
  .ind-obs { min-width: 120px; }
  .ind-list { position: static; max-height: none; }
  .ind-list ol { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
}
.ind-cat { font-size: 13px; }
.ind-cat td { vertical-align: top; }
.ind-main .actions { margin-top: 16px; }
.ind-main > .help { margin-top: 8px; }
.link-btn.fill { font-size: 12px; }
.ind-none { color: var(--texto-2); }
.ind-matrix .sticky-col { white-space: nowrap; }
.ind-matrix td { vertical-align: middle; }
.ind-main .table-wrap { margin-bottom: 0; }
/* Asistencia */
.att-panel .table-wrap, .ind-main-actions { margin-bottom: 0; }
.att-panel .actions, .ind-main-actions { margin-top: 16px; }
.att-fill { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 0 0 12px; font-size: 13px; }
.att-opts { display: inline-flex; border: 1px solid var(--linea); border-radius: 6px; overflow: hidden; }
.att-opt { position: relative; cursor: pointer; }
.att-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.att-opt > span { display: block; padding: 5px 10px; font-size: 13px; border-right: 1px solid var(--linea); color: var(--texto-2); }
.att-opt:last-child > span { border-right: 0; }
.att-opt input:focus-visible + span { box-shadow: var(--foco); }
.att-P input:checked + span { background: var(--acento-tinte); color: var(--acento-oscuro); font-weight: 600; }
.att-A input:checked + span { background: var(--rojo-tinte); color: var(--rojo); font-weight: 600; }
.att-T input:checked + span { background: var(--ocre-tinte); color: var(--ocre); font-weight: 600; }
.att-J input:checked + span { background: #e7f1fb; color: #1f4f82; font-weight: 600; }
.att-tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px; }
.att-tag.att-P { background: var(--acento-tinte); color: var(--acento-oscuro); }
.att-tag.att-A { background: var(--rojo-tinte); color: var(--rojo); }
.att-tag.att-T { background: var(--ocre-tinte); color: var(--ocre); }
.att-tag.att-J { background: #e7f1fb; color: #1f4f82; }
.att-c-A { background: var(--rojo-tinte); color: var(--rojo); font-weight: 600; }
.att-c-T { background: var(--ocre-tinte); color: var(--ocre); }
.att-c-J { background: #e7f1fb; color: #1f4f82; }
.att-c-x { background: repeating-linear-gradient(45deg, transparent, transparent 3px, #f0f1f4 3px, #f0f1f4 6px); }
.att-sm { display: none; }
@media (max-width: 760px) { .att-opt > span { padding: 6px 11px; } .att-lg { display: none; } .att-sm { display: inline; } .att-table .ind-obs { min-width: 110px; } }
/* Avisos y calendario */
.feed-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.feed { display: grid; gap: 14px; }
.aviso h2 { font: 600 1.15rem/1.3 var(--serif); margin: 4px 0 2px; }
.aviso.fijado { border-left: 4px solid var(--ocre); }
.aviso-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.aviso-meta { font-size: 13px; margin: 0 0 10px; }
.aviso-body { line-height: 1.6; overflow-wrap: anywhere; }
.adjuntos { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 14px; }
.adjuntos a { display: inline-flex; gap: 6px; align-items: center; }
.adjuntos .icon { width: 16px; height: 16px; }
fieldset.scope { border: 0; padding: 0; margin: 0 0 14px; }
fieldset.scope legend { font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.scope-opts { display: grid; gap: 6px; }
.scope-opts .choice { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 400; }
.scope-opts select { max-width: 100%; }
.cal-title { font: 600 1.1rem var(--serif); min-width: 170px; text-align: center; }
.cal-panel { padding: 0; overflow: hidden; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 8px; font-size: 12px; font-weight: 600; color: var(--texto-2); background: #f8f9fb; border-bottom: 1px solid var(--linea); text-align: center; }
.cal-day { min-height: 96px; border-right: 1px solid var(--linea-suave); border-bottom: 1px solid var(--linea-suave); padding: 4px 5px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.off { background: #fafbfc; color: #a2a9b6; }
.cal-day.we { background: #fbfbfd; }
.cal-day.today .cal-num { background: var(--acento); color: #fff; border-radius: 999px; }
.cal-num { font-size: 12px; font-weight: 600; width: 22px; height: 22px; display: grid; place-items: center; }
.cal-ev { font-size: 11px; line-height: 1.3; padding: 1px 5px; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-more { font-size: 11px; }
.ev-actividad { background: var(--acento-tinte); color: var(--acento-oscuro); }
.ev-examen { background: var(--rojo-tinte); color: var(--rojo); }
.ev-vacacion { background: #e7f1fb; color: #1f4f82; }
.ev-reunion { background: #efedff; color: #4b3c9e; }
.ev-entrega, .ev-periodo { background: var(--ocre-tinte); color: var(--ocre); }
.ev-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ev-list li { display: grid; grid-template-columns: 150px 130px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding-bottom: 10px; border-bottom: 1px solid var(--linea-suave); }
.ev-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.ev-date { font-variant-numeric: tabular-nums; font-size: 14px; }
.ev-tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px; justify-self: start; }
@media (max-width: 1000px) { .feed-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  .cal-day { min-height: 58px; }
  .cal-ev { font-size: 0; height: 6px; padding: 0; }
  .ev-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .ev-date, .ev-tag { grid-column: 1; }
}
.entrega-txt { margin: 6px 0; font-size: 14px; overflow-wrap: anywhere; }
.review-form textarea { width: 100%; min-width: 200px; font: inherit; font-size: 13px; padding: 6px; border: 1px solid var(--linea); border-radius: 4px; }
.review-form .actions { margin-top: 6px; }
.entregas td { vertical-align: top; }
.retro { margin-top: 12px; padding: 10px 12px; background: var(--acento-tinte); border-radius: var(--radio); }
.retro p { margin: 0 0 4px; }
/* Mensajes */
.conv-panel { padding: 0; }
.conv-list { list-style: none; margin: 0; padding: 0; }
.conv-list li { border-bottom: 1px solid var(--linea-suave); }
.conv-list li:last-child { border-bottom: 0; }
.conv-list a { display: grid; gap: 2px; padding: 12px 18px; text-decoration: none; color: var(--texto); }
.conv-list a:hover { background: #f8f9fb; }
.conv-list li.unread { box-shadow: inset 3px 0 0 var(--acento); }
.conv-list li.unread .conv-subj { font-weight: 700; }
.conv-top { display: flex; justify-content: space-between; gap: 12px; }
.conv-top time { font-size: 12px; color: var(--texto-2); white-space: nowrap; }
.conv-meta { font-size: 13px; color: var(--texto-2); }
.conv-last { font-size: 13px; color: var(--texto-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread { display: grid; gap: 10px; margin-bottom: 18px; max-width: 760px; }
.msg { background: var(--superficie); border: 1px solid var(--linea); border-radius: 10px; padding: 10px 14px; max-width: 88%; overflow-wrap: anywhere; }
.msg.mine { justify-self: end; background: var(--acento-tinte); border-color: #cfe2db; }
.msg header { font-size: 13px; margin-bottom: 4px; display: flex; gap: 10px; align-items: baseline; }
.msg time { color: var(--texto-2); font-size: 12px; }
.nav-badge { margin-left: auto; background: var(--acento); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 7px; line-height: 18px; }
/* Portal */
.kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kid h2 { font: 600 1.15rem/1.3 var(--serif); margin-bottom: 2px; }
.kid h2 a { color: var(--texto); text-decoration: none; }
.kid p { margin: 0 0 6px; font-size: 14px; }
.kid .actions { margin-top: 10px; }
.mini-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mini-feed li { display: grid; gap: 2px; }
.mini-feed p { margin: 2px 0 0; font-size: 14px; color: var(--texto-2); }
.mini-feed .muted { font-size: 13px; }
.sub-h { font-size: 1rem; margin: 18px 0 8px; }
.text-warn .icon { width: 16px; height: 16px; vertical-align: -3px; }
.acc-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; padding: 3px 0; }
.accesos td, .accesos th { vertical-align: top; }
.cred-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.cred h2 { font: 600 1.1rem var(--serif); margin: 2px 0; }
.cred-inst { font-size: 12px; color: var(--texto-2); margin: 0; text-transform: uppercase; letter-spacing: .04em; }
@media print {
  .sidebar, .topbar, .no-print, .flash { display: none !important; }
  .main { margin: 0 !important; }
  .cred-grid { grid-template-columns: 1fr 1fr; }
  .cred { break-inside: avoid; border: 1px dashed #999; box-shadow: none; }
}
.cred-dl { display: grid; gap: 8px; margin: 12px 0; }
.cred-dl dt { font-size: 12px; color: var(--texto-2); }
.cred-dl dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.cred-dl dd.secret { font: 600 1.15rem ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em; }
.kids > .panel { margin: 0; }

/* Cobros */
.money-figs { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 18px; }
.money-input { width: 90px; }
.cobro td, .cobro th { vertical-align: middle; }
.cobro-pie { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--linea); }
.cobro-pie .field { margin: 0; min-width: 180px; }
.cobro-total { display: grid; margin-left: auto; text-align: right; }
.cobro-total strong { font: 600 1.4rem var(--serif); }
details.mini { display: inline-block; font-size: 12px; }
details.mini summary { cursor: pointer; color: var(--acento); }
.mini-form { display: flex; gap: 6px; margin-top: 6px; }
.mini-form input { font: inherit; padding: 4px 6px; border: 1px solid var(--linea); border-radius: 4px; min-width: 160px; }
.pay-actions { margin-top: 14px; align-items: center; }
.mini-form.wrap { flex-wrap: wrap; }
.mini-form.wrap input { min-width: 110px; flex: 1; }
.filters-row { margin-bottom: 16px; flex-wrap: wrap; }
.bar-cell { width: 45%; }
.bar { width: 100%; height: 10px; display: block; }
.bar rect { fill: var(--acento); opacity: .75; }
.panel form .table-wrap { margin-bottom: 0; }

/* ---------- Contabilidad y factura electrónica ---------- */
.mt-14 { margin-top: 14px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; }
.small { font-size: 12px; }
.form-apilado .row-2, .form-apilado .row-3 { grid-template-columns: 1fr; }
details.reopen > summary { list-style: none; cursor: pointer; display: inline; }
details.reopen > summary::-webkit-details-marker { display: none; }
details.reopen[open] > summary { font-weight: 600; }
.catalogo .nivel-1 td { font-weight: 700; background: var(--fondo, #f4f5f7); }
.catalogo .nivel-2 td { font-weight: 600; }
.catalogo .nivel-2 .cta-nombre { padding-left: 10px; }
.catalogo .nivel-3 .cta-nombre { padding-left: 20px; }
.catalogo .nivel-4 .cta-nombre { padding-left: 30px; }
.catalogo .nivel-5 .cta-nombre { padding-left: 40px; color: var(--texto-2); }
.cta-nombre { display: inline-block; }
.diario-head td { background: #f6f7f9; }
.estado h2 { margin-top: 18px; }
.estado h2:first-child { margin-top: 0; }
.estado-total td { font-weight: 700; border-top: 2px solid var(--linea); }
.estado-resultado { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 0 0; padding-top: 12px; border-top: 3px double var(--linea); font-size: 1.05rem; }
.estado-resultado strong { font: 600 1.5rem/1 var(--serif); }
.dte-totales { margin-top: 16px; max-width: 420px; margin-left: auto; }
.dte-totales dd { font-size: 1.15rem; }
.partida-lineas input, .partida-lineas select { min-width: 0; }
.partida-lineas td:first-child { min-width: 240px; }
@media (max-width: 760px) { .partida-lineas td:first-child { min-width: 180px; } }
.mb-14 { margin-bottom: 14px; }
.table tr.row-detail td { padding-top: 0; border-top: 0; }
.table tr.row-detail details > summary { font-size: 13px; }
.panel .table-wrap:not(:last-child) { margin-bottom: 16px; }
/* Ficha SIGES */
.ficha-form { display: flex; flex-direction: column; gap: 18px; }
.ficha-sec { border: 1px solid var(--linea); border-radius: var(--radio); padding: 14px 16px 6px; margin: 0; min-width: 0; }
.ficha-sec > legend { font-weight: 600; padding: 0 6px; }
.ficha-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 16px; }
.ficha-grid .span-all { grid-column: 1 / -1; }
.ficha-lbl { display: block; font-weight: 500; font-size: 14px; margin-bottom: 6px; }
.ficha-val { display: block; }
.choice-row { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.form-actions { display: flex; gap: 10px; }
td.right, th.right { text-align: right; }
@media (max-width: 900px) { .ficha-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .ficha-grid { grid-template-columns: minmax(0, 1fr); } .ficha-sec { padding: 12px 12px 4px; } .check-grid { grid-template-columns: minmax(0, 1fr); } }

/* Pago en línea */
.pay-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 20px; align-items: start; }
.pay-layout > .panel { margin-bottom: 0; }
.pw-3ds { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.pw-3ds[hidden] { display: none; }
.pw-3ds-box { width: min(480px, 100%); margin: 0; }
.pw-3ds-box iframe { width: 100%; height: 460px; border: 0; background: #fff; }
#pw-iframe.oculto { width: 1px; height: 1px; }
@media (max-width: 900px) { .pay-layout { grid-template-columns: minmax(0, 1fr); } }
.mt-6 { margin-top: 6px; }
[hidden] { display: none !important; }
