/* ==========================================================================
   EduTrack SIS — "Registro" (implements EduTrack Registro.dc.html)
   White · Inter · crimson #960E0B · rounded, listing-style layout.
   ========================================================================== */
:root {
  --brand: #960e0b;
  --brand-hover: #7a0b08;
  --ink: #222222;
  --muted: #6a6a6a;
  --ink-3: #3f3f3f;
  --line: #dddddd;
  --line-soft: #ebebeb;
  --fam-bg: #f6ecec;
  --chip: #f2f2f2;
  --row-hover: #f7f7f7;
  --danger: #c13515;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans); color: var(--ink); background: #fff;
  font-size: 14px; letter-spacing: -0.1px; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 13px; margin-top: 4px; }
input, select, button { font-family: inherit; }

.rows::-webkit-scrollbar, .modalscroll::-webkit-scrollbar { width: 10px; }
.rows::-webkit-scrollbar-thumb, .modalscroll::-webkit-scrollbar-thumb {
  background: #ddd; border-radius: 9999px; border: 3px solid #fff;
}

/* ---- Buttons ---- */
.btn { font-size: 16px; font-weight: 500; border: 1px solid transparent; border-radius: 8px;
  padding: 0 22px; height: 48px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; transition: background .13s ease, border-color .13s ease, color .13s ease, opacity .13s; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-outline { background: #fff; color: var(--ink); border-color: var(--ink); }
.btn-outline:hover:not(:disabled) { background: #f7f7f7; }
.btn-block { width: 100%; }
.plus { font-size: 19px; line-height: 1; margin-top: -1px; }
.lnk { background: none; border: none; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--ink); }
.lnk:hover { text-decoration: underline; }
.lnk-del { color: var(--danger); }

/* ---- Logo mark (Liceo Inglés icon) ---- */
.logo-mark { width: 42px; height: 42px; object-fit: contain; flex: none; display: block; }

/* ---- Login ---- */
.login-view { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; border: 1px solid var(--line); border-radius: 20px;
  padding: 34px 30px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: rgba(0,0,0,.03) 0 1px 3px, rgba(0,0,0,.06) 0 8px 28px; }
.login-logo { width: 210px; height: auto; display: block; margin: 4px 0 2px; }
.login-card h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.5px; margin-top: 12px; }
.login-card > p { margin-bottom: 6px; }
.login-card label, .form-grid label { display: flex; flex-direction: column; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.login-card input, .form-grid input, .form-grid select { font-size: 15px; font-weight: 400;
  text-transform: none; letter-spacing: -0.1px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; width: 100%; background: #fff; }
.login-card .btn { margin-top: 6px; }
input:focus, select:focus { outline: none; border-color: var(--ink); }
.multi-field { display: flex; flex-wrap: wrap; gap: 8px; }
.multi-opt { flex-direction: row; align-items: center; gap: 7px; text-transform: none; letter-spacing: 0;
  font-size: 14px; font-weight: 500; color: var(--ink); border: 1px solid var(--line); border-radius: 9999px;
  padding: 7px 14px; cursor: pointer; }
.multi-opt input { width: auto; margin: 0; }
.field-hint { font-size: 12px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); margin-top: 4px; }
.nivel-cell { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

/* ---- Portal padres (admin) ---- */
.table-scroll { overflow-x: auto; }
/* Vista Servicios: la tabla scrollea dentro de sí misma (vertical y horizontal) y el encabezado
   queda fijo. El max-height se ajusta por JS (servFitScroll) para que el scrollbar horizontal
   quede a la vista sin bajar toda la página. */
.serv-scroll { overflow: auto; }
.serv-scroll table.dt.grp-table thead th { position: sticky; top: 0; z-index: 2; background: #fff; }
/* Columna de Observaciones anclada al borde derecho: visible sin depender del scroll horizontal. */
.serv-scroll table.dt.grp-table .serv-obs-col {
  position: sticky;
  right: 0;
  background: #fff;
  z-index: 2;
  box-shadow: inset 1px 0 0 var(--line), -10px 0 12px -8px rgba(0,0,0,.20);
}
.serv-scroll table.dt.grp-table thead .serv-obs-col { z-index: 3; }
/* Campo de observación con resaltado de menciones: textarea transparente sobre un backdrop. */
#serv-obs-text::placeholder { color: #9ca3af; }
#serv-obs-text::selection { background: #cfe2ff; }
/* Sin scrollbar en el textarea para que el ancho del texto coincida con el backdrop. */
#serv-obs-text { scrollbar-width: none; }
#serv-obs-text::-webkit-scrollbar { display: none; }
table.dt { width: 100%; border-collapse: collapse; font-size: 14px; }
table.dt th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .3px; padding: 13px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.dt th.r, table.dt td.r { text-align: right; }
table.dt td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.dt tbody tr:last-child td, table.dt tr:last-child td { border-bottom: none; }
.portal-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: -6px 0 16px; }
.portal-search { flex: 1 1 260px; max-width: 420px; }
.pt-parent { line-height: 1.35; }
.pt-login { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.pt-copy { border: none; background: none; cursor: pointer; color: var(--brand); font-size: 14px; padding: 0 2px; line-height: 1; }
.pt-see { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--brand);
  color: var(--brand); background: #fff; font-size: 11px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.pt-see:hover { background: var(--brand); color: #fff; }

/* ---- Informes de progreso (admin) ---- */
.inf-gen { padding: 20px 22px 8px; }
.inf-h { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.inf-sub { font-size: 13px; margin: 4px 0 14px; max-width: 640px; line-height: 1.45; }
.inf-genrow { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.inf-select { height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; font: inherit; font-size: 14px; background: #fff; }
.inf-progress { margin-top: 14px; display: flex; align-items: center; gap: 12px; min-height: 8px; flex-wrap: wrap; }
.inf-bar { flex: 1; max-width: 320px; height: 8px; background: var(--line-soft); border-radius: 8px; overflow: hidden; }
.inf-bar-fill { height: 100%; background: var(--brand); border-radius: 8px; transition: width .2s; }
.inf-vis { margin-top: 8px; }
.inf-force { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.pt-toggle { width: 44px; height: 25px; border-radius: 9999px; border: none; background: #cfcfcf; cursor: pointer;
  position: relative; padding: 0; transition: background .15s ease; flex: none; }
.pt-toggle.on { background: #1a7f4b; }
.pt-toggle span { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: left .15s ease; }
.pt-toggle.on span { left: 22px; }
/* Variante pequeña: va dentro de la celda de estudiantes, junto al nombre, y no debe competir
   visualmente con el interruptor de la familia, que es el que manda. */
.pt-toggle--sm { width: 34px; height: 19px; }
.pt-toggle--sm span { top: 2px; left: 2px; width: 15px; height: 15px; }
.pt-toggle--sm.on span { left: 17px; }

.pt-stu { line-height: 1.35; padding: 5px 0; }
.pt-stu + .pt-stu { border-top: 1px solid var(--line-soft); }
.pt-stu-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* Familia bloqueada: el estudiante no entra aunque su interruptor esté encendido. */
.pt-stu--bloqueado { opacity: .55; }
/* Último ingreso del estudiante, al final de la línea del login. Se separa con un punto medio para
   que no se lea pegado al botón «Ver como». */
.pt-last { font-size: 11px; color: var(--muted); white-space: nowrap; }
.pt-last::before { content: "·"; margin-right: 6px; opacity: .6; }

.btn-google { width: 100%; height: 50px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font-size: 15px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 11px;
  transition: box-shadow .15s, border-color .15s; }
.btn-google:hover { box-shadow: rgba(0,0,0,.08) 0 3px 12px; border-color: #c9c9c9; }
.btn-google svg { width: 19px; height: 19px; }
.fineprint { font-size: 12.5px; line-height: 1.5; text-align: center; margin-top: 4px; }

/* ==========================================================================
   Login — editorial split (photo right, form left). Scoped to .login-split so
   it doesn't touch the app tokens or the restricted-view card.
   ========================================================================== */
.login-split { display: grid; grid-template-columns: 1fr 1.15fr; min-height: 100vh; }

/* -- left: form column -- */
.ls-form { display: flex; flex-direction: column; justify-content: space-between;
  padding: 40px 64px; background: #fff; }

.ls-lockup { display: flex; align-items: center; gap: 18px; }
.ls-logo { height: 56px; width: auto; display: block; }
.ls-divider { width: 1px; height: 32px; background: #e7e2dd; display: block; flex: none; }
.ls-kicker { font-family: var(--sans); font-size: 10px; font-weight: 600; line-height: 1.6;
  color: #78716c; letter-spacing: 2.2px; }

.ls-center { width: 100%; max-width: 400px; }
.ls-eyebrow { font-family: "Cormorant Garamond", Georgia, serif; font-style: italic; font-weight: 500;
  font-size: 22px; color: #960e0b; line-height: 1; }
.ls-title { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 400; font-size: 46px;
  line-height: 1.06; color: #1c1917; letter-spacing: 0; margin-top: 4px; }
.ls-lead { font-family: var(--sans); font-size: 15px; font-weight: 400; line-height: 1.65;
  color: #57534e; margin-top: 14px; letter-spacing: 0; }

.ls-google { width: 100%; height: 56px; margin-top: 36px; background: #fff;
  border: 1px solid #c7bda6; border-radius: 2px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font-family: var(--sans); font-size: 15px; font-weight: 600; color: #1c1917;
  transition: background .15s ease, border-color .15s ease,
    transform .3s cubic-bezier(.22,.61,.36,1), box-shadow .3s cubic-bezier(.22,.61,.36,1); }
.ls-google:hover { background: #F7EFE6; border-color: #1c1917; transform: translateY(-2px);
  box-shadow: 0 12px 28px -14px rgba(28,25,23,0.3); }
.ls-google svg { width: 19px; height: 19px; flex: none; }

.ls-error { font-family: var(--sans); font-size: 13px; font-weight: 500; color: #c13515; margin-top: 12px; }

.ls-notice { display: flex; align-items: center; gap: 10px; background: #F7EFE6; border-radius: 2px;
  padding: 14px 16px; margin-top: 22px; font-family: var(--sans); font-size: 13px; line-height: 1.5; color: #57534e; }
.ls-notice svg { width: 15px; height: 15px; color: #960e0b; flex: none; }
.ls-notice b { color: #1c1917; font-weight: 600; }

.ls-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px;
  font-family: var(--sans); font-size: 12px; color: #a9a29d; }
.ls-foot a { color: #78716c; transition: color .15s ease; }
.ls-foot a:hover { color: #960e0b; }

/* -- right: photo column -- */
.ls-photo { position: relative; overflow: hidden; background: #14100f; }
.ls-photo-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.62; }
.ls-photo-shade { position: absolute; inset: 0;
  background: linear-gradient(200deg, rgba(20,16,15,0.1) 0%, rgba(20,16,15,0.68) 100%); }
.ls-caption { position: absolute; left: 56px; right: 56px; bottom: 56px; }
.ls-cap-eyebrow { font-family: "Cormorant Garamond", Georgia, serif; font-style: italic; font-weight: 500;
  font-size: 22px; color: rgba(255,255,255,0.85); line-height: 1; }
.ls-cap-title { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 400; font-size: 44px;
  line-height: 1.1; color: #fff; max-width: 480px; margin-top: 6px; }
.ls-cap-meta { display: flex; align-items: center; gap: 14px; margin-top: 18px;
  font-family: var(--sans); font-size: 11px; font-weight: 600; letter-spacing: 2px; color: rgba(255,255,255,0.7); }
.ls-rule { width: 34px; height: 2px; background: #960e0b; display: block; flex: none; }

/* -- entrance cascade -- */
@keyframes lsRise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
.ls-lockup, .ls-eyebrow, .ls-title, .ls-lead, .ls-google, .ls-notice, .ls-foot {
  animation: lsRise .9s cubic-bezier(.22,.61,.36,1) both; }
.ls-lockup { animation-delay: 0s; }
.ls-eyebrow { animation-delay: .12s; }
.ls-title { animation-delay: .12s; }
.ls-lead { animation-delay: .24s; }
.ls-google { animation-delay: .36s; }
.ls-notice { animation-delay: .48s; }
.ls-foot { animation-delay: .6s; }
@media (prefers-reduced-motion: reduce) {
  .ls-lockup, .ls-eyebrow, .ls-title, .ls-lead, .ls-google, .ls-notice, .ls-foot { animation: none; }
}

/* -- responsive: collapse to one column, hide the photo -- */
@media (max-width: 1128px) {
  .login-split { grid-template-columns: 1fr; }
  .ls-photo { display: none; }
  .ls-form { align-items: center; padding: 40px 28px; }
  .ls-lockup, .ls-center, .ls-foot { width: 100%; max-width: 400px; }
}

/* role badges (Usuarios list) */
.role-badge { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600;
  padding: 4px 12px; border-radius: 9999px; background: var(--chip); color: var(--ink); }
.role-badge.role-admin { background: var(--fam-bg); color: var(--brand); }
.role-badge.role-academic { background: #e6f1f5; color: #1f6f8b; }
.role-badge.role-viewer { background: #f0f0f0; color: #6a6a6a; }

/* Solo admin y academic pueden escribir en students/guardians/families -- es lo que dice
   can_edit_sis() en la base. Antes esta regla solo ocultaba los controles al rol `viewer`, asi que
   las otras 129 cuentas (profesor, principal, viceprincipal, secretaria, supervisor) veian Nuevo,
   Editar y Eliminar y la base los rechazaba: crear daba un error crudo de RLS y BORRAR decia
   "Registro eliminado" sin borrar nada, porque un delete filtrado por RLS no devuelve error.
   La regla se escribe en negativo -- se oculta salvo que la clase este presente -- para que un rol
   nuevo herede "no edita", igual que la base deniega por defecto. */
body:not(.can-edit-sis) #new-btn,
body:not(.can-edit-sis) .row-actions [data-edit],
body:not(.can-edit-sis) .row-actions [data-del],
body:not(.can-edit-sis) #d-edit { display: none !important; }

/* ---- Top nav ---- */
.topbar { position: sticky; top: 0; z-index: 40; background: #fff; border-bottom: 1px solid var(--line-soft); }
.topbar-inner { max-width: 1360px; margin: 0 auto; height: 80px; padding: 0 40px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; flex: none; }
.wordmark { display: flex; flex-direction: column; line-height: 1.05; }
.logo-text { font-size: 19px; font-weight: 700; color: var(--brand); letter-spacing: -0.4px; }
.logo-sub { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 1px; margin-top: 2px; text-transform: uppercase; }

/* Un admin ya tenia 9 pestanas y la barra pedia ~1711px dentro de un contenedor de 1360: la pagina
   entera scrolleaba en horizontal. Gradebooks es la decima. En vez de recortar los rotulos, el
   desbordamiento se confina a la tira de pestanas (sin barra de scroll visible) y el resto de la
   cabecera deja de moverse. Un profesor solo ve 5 pestanas y nunca llega a este caso. */
.tabs { display: flex; align-items: flex-end; gap: 6px; height: 80px; flex: 0 1 auto;
  min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 80px; justify-content: center;
  padding: 0 14px; background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer;
  color: var(--muted); font-size: 15px; font-weight: 600; transition: color .13s, border-color .13s; }
.tab svg { width: 24px; height: 24px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }

.user { display: flex; align-items: center; gap: 14px; flex: none; }
.topbar-link { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; color: var(--muted);
  padding: 8px 12px; border-radius: 9999px; transition: background .13s, color .13s; }
.topbar-link:hover { color: var(--ink); background: #f2f2f2; }
.topbar-link svg { width: 18px; height: 18px; }
@media (max-width: 760px) { .topbar-link span { display: none; } }
#user-email { font-size: 14px; }
.user-pill { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 6px 0 14px;
  border: 1px solid var(--line); border-radius: 9999px; background: #fff; cursor: pointer;
  transition: box-shadow .15s ease; }
.user-pill:hover { box-shadow: rgba(0,0,0,.08) 0 2px 8px; }
.user-pill svg { width: 16px; height: 16px; }
.user-mono { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: 9999px; background: var(--brand); color: #fff; font-size: 13px; font-weight: 600; }
.user-mono { overflow: hidden; }
.user-mono img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Content ---- */
.content { max-width: 1360px; margin: 0 auto; padding: 32px 40px 64px; }

.toolbar { display: flex; align-items: center; gap: 24px; margin-bottom: 28px; }
.searchpill { flex: 1; display: flex; align-items: center; gap: 14px; height: 64px; background: #fff;
  border: 1px solid var(--line); border-radius: 9999px; padding: 0 8px 0 24px;
  box-shadow: rgba(0,0,0,.02) 0 0 0 1px, rgba(0,0,0,.04) 0 2px 6px, rgba(0,0,0,.06) 0 4px 8px;
  transition: box-shadow .15s ease; }
.searchpill:focus-within { box-shadow: rgba(0,0,0,.02) 0 0 0 1px, rgba(0,0,0,.06) 0 2px 8px, rgba(0,0,0,.12) 0 6px 16px; }
.searchpill input { flex: 1; height: 100%; border: none; outline: none; background: transparent; font-size: 16px; color: var(--ink); }
.orb { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 9999px;
  background: var(--brand); border: none; cursor: pointer; flex: none; transition: background .13s ease; }
.orb:hover { background: var(--brand-hover); }
.orb svg { width: 19px; height: 19px; }
.toolbar-actions { display: flex; align-items: center; gap: 22px; flex: none; }
#count-label { font-size: 15px; }
#count-label b { color: var(--ink); font-weight: 600; }

/* ---- Filter chips (parentesco / grado) ---- */
.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: -10px 0 26px; }
.filterbar .flabel { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .4px;
  text-transform: uppercase; margin-right: 4px; }
.fchip { height: 38px; padding: 0 16px; border: 1px solid var(--line); border-radius: 9999px; background: #fff;
  color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  transition: background .13s ease, border-color .13s ease, color .13s ease; }
.fchip:hover { border-color: var(--ink); }
.fchip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.fbreak { flex-basis: 100%; height: 0; margin: 0; }
.fselect { height: 38px; padding: 0 34px 0 14px; border: 1px solid var(--line); border-radius: 9999px; background: #fff;
  color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%23666' stroke-width='1.6'/></svg>");
  background-repeat: no-repeat; background-position: right 13px center;
  transition: border-color .13s ease; }
.fselect:hover { border-color: var(--ink); }
.fselect:focus { outline: none; border-color: var(--brand); }

/* ---- Family list ---- */
.fam-emblem { width: 52px; height: 52px; border-radius: 14px; background: var(--fam-bg); color: var(--brand);
  display: flex; align-items: center; justify-content: center; flex: none; }
.fam-emblem svg { width: 24px; height: 24px; }
.av-stack { display: flex; align-items: center; flex: none; }
.av-stack .sav { width: 42px; height: 42px; border-radius: 9999px; object-fit: cover; flex: none;
  border: 2px solid #fff; margin-left: -13px; background: #f2f2f2; font-size: 13px;
  display: flex; align-items: center; justify-content: center; }
.av-stack .sav:first-child { margin-left: 0; }
/* large member-photo stack in the family detail header (replaces the house emblem) */
.fam-stack-lg { flex: none; }
.fam-stack-lg .sav { width: 66px; height: 66px; font-size: 20px; margin-left: -24px; border-width: 3px; }
.fam-stack-lg .sav:first-child { margin-left: 0; }
.av-stack .sav.more { background: var(--chip); color: var(--muted); font-weight: 600; }
.fam-col { min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fam-col.parents { flex-direction: column; align-items: stretch; gap: 12px; flex-wrap: nowrap; }
.mini-chip { display: inline-flex; align-items: center; background: var(--chip); color: var(--ink);
  font-size: 13px; font-weight: 500; padding: 3px 10px; border-radius: 9999px; white-space: nowrap; }
.mini-chip.rel { background: var(--fam-bg); color: var(--brand); font-weight: 600; }
.fam-col .muted { font-size: 13px; }
.fam-parent { min-width: 0; }
.fp-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fp-name { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-contact { display: flex; flex-wrap: wrap; gap: 3px 18px; margin-top: 5px; min-width: 0; }
.fp-contact span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted);
  min-width: 0; font-variant-numeric: tabular-nums; }
.fp-contact svg { width: 14px; height: 14px; flex: none; }
.fp-contact .fp-email { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Register (grid table) ---- */
.grid-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.thead { display: grid; align-items: center; gap: 16px; padding: 16px 28px; border-bottom: 1px solid var(--line-soft); }
.thead .th { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .4px; }
.thead .th-right { text-align: right; }
.rows { max-height: 640px; overflow-y: auto; }
.rowline { display: grid; align-items: center; gap: 16px; padding: 12px 28px; border-bottom: 1px solid var(--line-soft);
  cursor: pointer; transition: background .13s ease; }
.rowline:last-child { border-bottom: none; }
.rowline:hover { background: var(--row-hover); }

.id-cell { display: flex; align-items: center; gap: 16px; min-width: 0; }
.av { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; flex: none; background: #f2f2f2; display: block; }
.mono-av { display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; }
.id-text { min-width: 0; }
.id-sub { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.id-name { font-size: 16px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- View toggle (Tarjetas / Lista) ---- */
.view-toggle { display: inline-flex; }
.seg { display: inline-flex; background: var(--chip); border-radius: 9999px; padding: 4px; gap: 2px; }
.seg-btn { border: none; background: none; cursor: pointer; height: 34px; padding: 0 16px; border-radius: 9999px;
  font-size: 14px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px;
  transition: background .13s ease, color .13s ease; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* ---- Group header (homeroom / grade summary) ---- */
.list-header { display: flex; align-items: center; gap: 20px; background: #fff; border: 1px solid var(--line);
  border-radius: 20px; padding: 18px 24px; margin-bottom: 18px; flex-wrap: wrap; }
.lh-badge { width: 58px; height: 58px; border-radius: 16px; background: var(--brand); color: #fff; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 700; }
.lh-id { flex: 1 1 160px; min-width: 0; }
.lh-id h2 { font-size: 22px; font-weight: 700; color: var(--ink); letter-spacing: -0.4px; }
.lh-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.lh-sub b { color: var(--ink); font-weight: 600; }
.lh-stats { display: flex; gap: 12px; flex-wrap: wrap; }
.lh-stat { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: var(--chip); border-radius: 14px; padding: 11px 22px; min-width: 82px; }
.lh-stat.lh-stat-main { background: var(--fam-bg); }
.lh-stat b { font-size: 25px; font-weight: 700; color: var(--ink); line-height: 1; }
.lh-stat.lh-stat-main b { color: var(--brand); }
.lh-stat span { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-top: 5px; }

/* ---- Card view ---- */
.rows.cards { max-height: none; overflow: visible; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; padding: 20px; }
.scard { border: 1px solid var(--line); border-radius: 18px; padding: 22px 16px 18px; text-align: center;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: box-shadow .13s ease, border-color .13s ease, transform .13s ease; }
.scard:hover { border-color: var(--brand); box-shadow: 0 6px 18px rgba(0, 0, 0, .08); transform: translateY(-2px); }
.card-av { width: 96px; height: 96px; border-radius: 9999px; object-fit: cover; flex: none; background: #f2f2f2;
  font-size: 30px; margin-bottom: 10px; }
.scard-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.scard-name { font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.scard-link { font-size: 13px; font-weight: 700; color: var(--brand); margin-top: 8px; }

/* Smooth entrance: each render mints fresh nodes, so this plays on every (re)render — tab switch,
   Tarjetas↔Lista toggle, pagination, filter. All items start together → reads as one soft fade+rise.
   No fill-mode: releases to the natural state on end, so .scard:hover transform still works. */
@keyframes gridItemIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.rowline, .scard { animation: gridItemIn .18s ease; }

.fam { display: inline-flex; align-items: center; gap: 7px; background: var(--fam-bg); color: var(--brand);
  font-size: 14px; font-weight: 600; padding: 5px 13px; border-radius: 9999px; font-variant-numeric: tabular-nums; }
.fam svg { width: 10px; height: 10px; }
.cell { font-size: 15px; color: var(--ink); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell.mono { font-variant-numeric: tabular-nums; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 20px; }
.empty { padding: 48px; text-align: center; color: var(--muted); font-size: 16px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 22px; }
.pager .btn { height: 42px; padding: 0 18px; font-size: 14px; }
#page-label { font-size: 14px; }

/* ---- Modals (shared) ---- */
.modal-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.5);
  display: flex; align-items: flex-start; justify-content: center; padding: 48px 24px; overflow-y: auto; }
.detail-card, .form-card { width: 100%; background: #fff; border-radius: 20px; max-height: calc(100vh - 96px);
  overflow-y: auto; box-shadow: rgba(0,0,0,.02) 0 0 0 1px, rgba(0,0,0,.18) 0 12px 40px; }
.detail-card { max-width: 920px; padding: 32px 40px 36px; }
.form-card { max-width: 640px; padding: 28px 32px 30px; }

.modal-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-topbar h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.4px; }
.modal-eyebrow { font-size: 14px; font-weight: 600; color: var(--muted); }
.close-btn { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9999px;
  background: #f2f2f2; border: none; cursor: pointer; color: var(--ink); flex: none; }
.close-btn:hover { background: #e8e8e8; }
.close-btn svg { width: 16px; height: 16px; }

/* identity row */
.identity { display: flex; align-items: center; gap: 28px; padding: 12px 0 28px; border-bottom: 1px solid var(--line-soft); }
.portrait { width: 128px; height: 128px; border-radius: 14px; object-fit: cover; flex: none; background: #f2f2f2; font-size: 44px; }
.portrait.fam-emblem-lg { display: flex; align-items: center; justify-content: center; background: var(--fam-bg); color: var(--brand); }
.portrait.fam-emblem-lg svg { width: 58px; height: 58px; }
.fam-display.clickable { cursor: pointer; border-radius: 12px; transition: background .13s ease; }
.fam-display.clickable:hover { background: var(--fam-bg); }
.identity-main { flex: 1; min-width: 0; }
.identity-main h2 { font-size: 26px; font-weight: 600; color: var(--ink); letter-spacing: -0.5px; line-height: 1.15; }
.chips { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; background: var(--chip); color: var(--ink);
  font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 9999px; }
.chips .meta { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* status (Activo/Inactivo) */
.st-chip { display: inline-flex; align-items: center; font-size: 13px; font-weight: 700;
  padding: 4px 12px; border-radius: 9999px; }
.st-chip.st-on { background: #e7f4ec; color: #1a7f4b; }
.st-chip.st-off { background: #efefef; color: #6a6a6a; }
.st-badge { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
  text-transform: uppercase; padding: 1px 7px; border-radius: 5px; background: #fbe9e4; color: #c13515;
  vertical-align: middle; margin-left: 8px; }
.chips .dot { color: var(--line); }

.fam-display { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding-left: 28px; border-left: 1px solid var(--line-soft); align-self: stretch; }
.fam-badge { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px;
  border-radius: 12px; background: var(--fam-bg); color: var(--brand); flex: none; }
.fam-badge svg { width: 22px; height: 22px; }
.fam-num { text-align: center; }
.fam-n { font-size: 28px; font-weight: 700; color: var(--ink); line-height: 1; letter-spacing: -0.6px; font-variant-numeric: tabular-nums; }
.fam-label { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .5px; margin-top: 5px; text-transform: uppercase; }
/* "Contactos emergencia" es la etiqueta más larga de las tres: se parte en dos líneas
   en vez de estirar la fila de identidad y empujar el nombre del estudiante. */
.fam-label.wrap2 { max-width: 96px; }

/* field grid */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; padding: 8px 0 4px; }
.field { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.field-k { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .3px; text-transform: uppercase; }
.field-v { font-size: 16px; color: var(--ink); margin-top: 5px; }

/* related sections (acudientes / hermanos cards) */
.rel-section { margin-top: 32px; }
.rel-section h3 { font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -0.3px; margin-bottom: 18px; }
.card-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }

/* ---- MAP (NWEA) results in the student detail ---- */
.map-term { margin-bottom: 16px; }
.map-term:last-child { margin-bottom: 0; }
.map-term-h { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.map-table { width: 100%; border: 1px solid var(--line); border-radius: 12px; border-collapse: separate;
  border-spacing: 0; overflow: hidden; font-size: 14px; }
.map-table th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .3px; color: var(--muted); background: #f7f7f7; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.map-table td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; color: var(--ink); }
.map-table tr:last-child td { border-bottom: none; }
.map-table .r { text-align: right; font-variant-numeric: tabular-nums; }
.map-chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px;
  font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .map-table { font-size: 13px; } .map-table th, .map-table td { padding: 8px 10px; } }
.person-card { min-width: 0; border: 1px solid var(--line); border-radius: 14px; padding: 20px; cursor: pointer; transition: border-color .13s, box-shadow .13s; }
.person-card:hover { border-color: var(--ink); box-shadow: rgba(0,0,0,.06) 0 4px 14px; }
.pc-head { display: flex; align-items: center; gap: 14px; }
.pc-av { width: 48px; height: 48px; border-radius: 9999px; font-size: 16px; flex: none; }
.pc-name { font-size: 16px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-rel { font-size: 14px; color: var(--muted); }
.pc-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--ink); min-width: 0; }
.pc-row svg { width: 16px; height: 16px; flex: none; }
.pc-row span { font-size: 15px; font-variant-numeric: tabular-nums; min-width: 0; }
.pc-email { flex: 1; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-copy { cursor: copy; margin-left: -8px; margin-right: -8px; padding: 2px 4px 2px 8px; border-radius: 8px; transition: background .13s; }
.pc-copy:hover { background: var(--chip); }
.pc-copy > span:not(.muted) { flex: 1; }
.pc-copy-btn { flex: none; margin-left: auto; width: 28px; height: 28px; display: inline-grid; place-items: center; border: none; background: none; border-radius: 6px; color: var(--muted); cursor: pointer; padding: 0; }
.pc-copy-btn svg { width: 15px; height: 15px; }
.pc-copy-btn:hover { color: var(--brand); }
.person-card.mini .pc-head { align-items: center; }
/* Los contactos de emergencia no son registros del SIS: no se navega a ellos. */
.person-card.static { cursor: default; }
.person-card.static:hover { border-color: var(--line); box-shadow: none; }
.emg-tel { font-size: 15px; font-variant-numeric: tabular-nums; color: var(--ink); text-decoration: none; }
.emg-tel:hover { text-decoration: underline; }

.modal-foot { display: flex; justify-content: flex-end; gap: 14px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line-soft); }

/* form */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-card .modal-foot { margin-top: 22px; padding-top: 18px; }

/* photo editor (admin|academic) */
.photo-editor { display: flex; align-items: center; gap: 18px; padding: 16px; margin-bottom: 18px;
  border: 1px solid var(--line); border-radius: 14px; background: #fafafa; }
.pe-pic { flex: none; }
.pe-portrait { width: 84px; height: 84px; border-radius: 14px; object-fit: cover; display: flex;
  align-items: center; justify-content: center; font-size: 26px; background: #f2f2f2; }
.pe-portrait.pe-loading { color: var(--muted); font-size: 22px; }
.pe-controls { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pe-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.pe-btns { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.btn-file { height: 40px; padding: 0 16px; font-size: 14px; cursor: pointer; }
.pe-hint { font-size: 12px; }

/* camera capture (webcam / phone) — sits above the edit modal (z 60) */
.cam-modal { position: fixed; inset: 0; z-index: 85; background: rgba(0, 0, 0, .82);
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.cam-card { background: #14100f; border-radius: 14px; padding: 14px; width: 100%; max-width: 560px;
  display: flex; flex-direction: column; gap: 12px; }
.cam-stage { border-radius: 10px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.cam-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-btns { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.cam-btns .btn-outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .4); }
.cam-btns .btn-outline:hover:not(:disabled) { border-color: #fff; }
@media (max-width: 560px) { .cam-btns { justify-content: stretch; } .cam-btns .btn { flex: 1; } }

/* image lightbox */
img.zoomable { cursor: zoom-in; }
/* En tarjetas la foto no hace zoom: la tarjeta entera abre la ficha. */
.scard img.zoomable { cursor: pointer; }
.img-lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.86);
  display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.img-lightbox img { max-width: 92vw; max-height: 92vh; object-fit: contain; border-radius: 12px;
  box-shadow: rgba(0,0,0,.5) 0 20px 60px; }
.lightbox-close { position: fixed; top: 16px; right: 20px; width: 44px; height: 44px; border-radius: 9999px;
  border: none; background: rgba(255,255,255,.15); color: #fff; font-size: 26px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .13s; }
.lightbox-close:hover { background: rgba(255,255,255,.3); }

/* toast */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 13px 20px; border-radius: 10px; z-index: 80; box-shadow: rgba(0,0,0,.25) 0 10px 30px; font-size: 14px; }
.toast.err { background: var(--danger); }

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

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .topbar-inner, .content { padding-left: 20px; padding-right: 20px; }
  #user-email { display: none; }
  /* Entre 760 y 1000 px las pestañas seguían a tamaño completo y los cinco elementos se
     desbordaban 130 px. Compactarlas aquí, y no solo por debajo de 760, cierra esa franja. */
  .tab { padding: 0 6px; font-size: 13px; }
  .tab svg { width: 21px; height: 21px; }
  .tabs { gap: 2px; }
  .field-grid, .card-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .identity { flex-wrap: wrap; row-gap: 16px; }
  .fam-display { padding-left: 0; border-left: none; align-self: auto; }
}

@media (max-width: 760px) {
  /* top nav — compact */
  .topbar-inner { height: 60px; gap: 10px; }
  .tabs { height: 60px; gap: 2px; }
  .tab { height: 60px; padding: 0 10px; font-size: 12px; gap: 4px; }
  .tab svg { width: 20px; height: 20px; }
  .logo-sub { display: none; }
  .logo-mark { width: 34px; height: 34px; }
  .user-pill { height: 40px; padding: 0 5px 0 12px; }

  /* toolbar stacks */
  .toolbar { flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 20px; }
  .searchpill { height: 54px; padding-left: 18px; }
  .searchpill input { font-size: 15px; }
  .orb { width: 42px; height: 42px; }
  .toolbar-actions { justify-content: space-between; }

  /* register: grid rows -> stacked cards (overrides JS inline grid) */
  .thead { display: none; }
  .grid-card { border-radius: 16px; }
  .rows { max-height: none; }
  .rowline { display: flex !important; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 14px 16px; }
  .id-cell { flex: 1 1 100%; }
  .rowline .cell, .rowline .fam-col { display: none; }  /* hide secondary columns; keep id + actions */
  .row-actions { margin-left: auto; gap: 18px; }

  /* modals */
  .modal-overlay { padding: 16px 12px; }
  .detail-card { padding: 24px 20px 26px; }
  .form-card { padding: 22px 20px 24px; }
  .identity-main h2 { font-size: 22px; }
  .fam-n { font-size: 26px; }
  .portrait { width: 104px; height: 104px; }
}

@media (max-width: 600px) {
  /* Detail identity was forcing the whole card wider than the phone (min-content
     of portrait + name + núcleo-familiar). Let the name shrink and drop the
     family core onto its own row so nothing overflows. */
  .identity { flex-wrap: wrap; align-items: flex-start; }
  .identity-main { flex: 1 1 150px; }
  .fam-display { flex-basis: 100%; flex-direction: row; align-items: center;
    justify-content: flex-start; gap: 12px; padding-top: 6px; }
  .fam-num { text-align: left; }
  .field-v { overflow-wrap: anywhere; }
}

@media (max-width: 480px) {
  .wordmark { display: none; }          /* keep just the icon mark */
  .user-pill svg { display: none; }     /* keep just the avatar */
  .user-pill { padding: 5px; gap: 0; }
  .tab { padding: 0 9px; }
}

@media (max-width: 440px) {
  .toolbar-actions .btn { padding: 0 16px; }
  #count-label { font-size: 14px; }
  .rowline .fam { font-size: 13px; }
  .av { width: 46px; height: 46px; }
  .modal-topbar h2 { font-size: 19px; }
}

/* ---- Reporte de grupos (admin/académico) ---- */
.grp-wrap { display: flex; flex-direction: column; gap: 18px; }
.grp-picker { border: 1px solid var(--line-soft); border-radius: 16px; padding: 18px 18px 16px; background: #fff; }
.grp-picker-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.grp-picker-top h2 { font-size: 18px; font-weight: 700; }
.grp-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.grp-group { border: 1px solid var(--line-soft); border-radius: 12px; padding: 10px 12px; background: #fcfcfc; }
.grp-group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.grp-niv { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.grp-selall { border: none; background: none; cursor: pointer; color: var(--brand); font-size: 12px; font-weight: 600; padding: 2px 4px; }
.grp-selall:hover { text-decoration: underline; }
.grp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.grp-chip { height: 30px; min-width: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--ink-3); transition: all .12s; }
.grp-chip:hover { border-color: var(--ink); }
.grp-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.grp-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.grp-result { min-height: 40px; }
.grp-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: -2px 0 12px; }
.grp-bar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
table.dt.grp-table { font-size: 13px; white-space: nowrap; }
table.dt.grp-table th, table.dt.grp-table td { padding: 9px 12px; }
table.dt.grp-table td.mono, table.dt.grp-table .mono { font-variant-numeric: tabular-nums; }
.svc-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.svc-chip.svc-yes { background: #e7f4ea; color: #1f7a3d; }
.svc-chip.svc-no { background: #f0f0f0; color: #6a6a6a; }

/* ---- Gradebooks (enlaces a las hojas de notas) ---- */
.gb-wrap { display: flex; flex-direction: column; gap: 16px; }
.gb-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gb-head h2 { font-size: 18px; font-weight: 700; }
.gb-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--line-soft); border-radius: 16px; padding: 14px 16px; background: #fff; }
.gb-search { flex: 1 1 260px; min-width: 0; font: inherit; font-size: 14px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 9999px; background: #fff; }
.gb-search:focus { outline: none; border-color: var(--ink); }
.gb-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.gb-seg button { border: none; background: #fff; cursor: pointer; padding: 7px 12px;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); }
.gb-seg button.active { background: var(--brand); color: #fff; }
.gb-note { font-size: 13px; color: var(--muted); }

.gb-sec { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.gb-sec-head { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px;
  margin-bottom: 10px; }
.gb-sec-head::-webkit-details-marker { display: none; }
.gb-sec-head::before { content: "▸"; font-size: 11px; transition: transform .13s ease; }
.gb-sec[open] > .gb-sec-head::before { transform: rotate(90deg); }
.gb-count { font-variant-numeric: tabular-nums; color: var(--ink-3); font-weight: 600; }
/* Agrupado por profesor el titulo es un correo: en mayusculas y espaciado se vuelve ilegible. */
.gb-sec-mail { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); }
/* Una etiqueta puede traer diez nombres (las electivas): se recorta, el completo va en el title. */
.gb-tl { display: inline-block; max-width: 340px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; vertical-align: bottom; }

.gb-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.gb-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: inherit;
  border: 1px solid var(--line-soft); border-radius: 14px; background: #fff;
  transition: border-color .13s, box-shadow .13s; }
.gb-card:hover { border-color: var(--ink); box-shadow: rgba(0,0,0,.07) 0 3px 12px; }
.gb-ico { flex: none; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: 10px; background: var(--fam-bg); color: var(--brand); }
.gb-ico svg { width: 20px; height: 20px; }
.gb-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.gb-subject { font-size: 15px; font-weight: 600; color: var(--ink); }
.gb-meta { font-size: 13px; color: var(--muted); }
.gb-co { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gb-arrow { flex: none; color: var(--muted); font-size: 15px; }
.gb-card:hover .gb-arrow { color: var(--brand); }

.gb-mail { color: var(--ink-3); }
.gb-open { color: var(--brand); font-weight: 600; white-space: nowrap; }
.gb-open:hover { text-decoration: underline; }
@media (max-width: 640px) { .gb-cards { grid-template-columns: 1fr; } }

/* editor de gradebooks (solo admin) */
.gbf-ctx { font-size: 14px; margin: -4px 0 14px; }
.gbf-wide { grid-template-columns: 1fr; }
.gbf-in { font: inherit; font-size: 14px; width: 100%; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
.gbf-in:focus { outline: none; border-color: var(--ink); }
.gbf-hint { font-size: 13px; margin-top: 12px; line-height: 1.5; }
/* Eliminar vive dentro del modal y pegado a la izquierda: separado de Guardar para que no se
   pulse por inercia, pero sin un enlace suelto por fila que invite al clic accidental. */
.gbf-del { margin-right: auto; color: var(--danger); border-color: var(--danger); }
.gbf-del:hover:not(:disabled) { background: #fdf3f1; }
#gbe-err { margin-top: 14px; }
.gbf-derived { font-size: 13px; color: var(--ink-3); margin-top: 12px; }
.gbf-bad { color: var(--danger); font-weight: 600; }
/* Tras guardar, la fila se resalta un instante: una recien creada puede haber caido en cualquier
   punto del orden y sin esto parece que no paso nada. */
@keyframes gb-flash { from { background: var(--fam-bg); } to { background: transparent; } }
tr.gb-flash > td { animation: gb-flash 1.6s ease-out; }

/* ---- Ficha médica (modal propio sobre el detalle) ---- */
.hl-head { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 8px; }
.hl-head h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.4px; }
.hl-block { margin-top: 26px; }
.hl-block h3 { font-size: 17px; font-weight: 600; color: var(--ink); letter-spacing: -0.2px; margin-bottom: 12px; }
.hl-row { display: grid; grid-template-columns: 240px 1fr; gap: 12px; align-items: baseline;
  padding: 9px 0; border-bottom: 1px solid var(--line, #ececec); }
.hl-row:last-child { border-bottom: 0; }
.hl-k { color: var(--muted); font-size: 14px; }
.hl-v { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hl-det { font-size: 14px; color: var(--ink); }
.hl-obs { white-space: pre-wrap; }
.hl-note, .hl-empty { margin-top: 18px; font-size: 14px; }
.hl-in { font: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--line, #ddd);
  border-radius: 8px; background: #fff; color: var(--ink); }
.hl-row-edit .hl-v { flex-wrap: nowrap; }
.hl-bool { flex: none; width: 90px; }
.hl-det-in { flex: 1 1 auto; min-width: 0; }
.hl-obs-in { width: 100%; resize: vertical; }
@media (max-width: 640px) {
  .hl-row { grid-template-columns: 1fr; gap: 4px; }
  .hl-row-edit .hl-v { flex-wrap: wrap; }
}

/* ---- Contactos de emergencia: modo edición ---- */
/* Cada contacto es una caja propia porque son cinco campos por persona y hasta cinco personas por
   sección: sin el marco no se ve dónde acaba uno y empieza el siguiente. */
.emg-edit { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.emg-row { border: 1px solid var(--line); border-radius: 14px; padding: 4px 18px 14px; }
.emg-row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 12px; }
.emg-pos { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .3px;
  text-transform: uppercase; }
.emg-row .field-grid { padding-bottom: 0; }
.emg-row .field:nth-last-child(-n+2) { border-bottom: none; }
.emg-row .hl-in { width: 100%; margin-top: 5px; }
/* Neutro en reposo: quitar un contacto de emergencia no es una acción que convenga invitar. */
.emg-del { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  padding: 0; border: none; background: none; border-radius: 8px; cursor: pointer;
  color: var(--muted); transition: color .13s, background .13s; }
.emg-del svg { width: 17px; height: 17px; }
.emg-del:hover { color: var(--danger); background: var(--line-soft); }
.emg-add[disabled] { opacity: .45; cursor: not-allowed; }
@media (max-width: 640px) {
  .emg-row .field-grid { grid-template-columns: 1fr; }
  .emg-row .field:nth-last-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
  .emg-row .field:last-child { border-bottom: none; }
}

/* ---- Ver como (preview de staff) ---- */
.lnk-veras { color: var(--brand) !important; font-weight: 600; }
body.preview-mode #new-btn,
body.preview-mode .row-actions [data-edit],
body.preview-mode .row-actions [data-del],
body.preview-mode #d-edit { display: none !important; }
body.preview-mode { padding-bottom: 52px; }
#preview-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; align-items: center; gap: 12px; padding: 10px 18px;
  background: #2a2a2a; color: #fff; font-size: 13px; box-shadow: 0 -2px 14px rgba(0, 0, 0, .22); }
#preview-bar .pv-badge { background: var(--brand); color: #fff; font-weight: 700; font-size: 11px;
  letter-spacing: .5px; padding: 3px 8px; border-radius: 6px; flex: none; }
#preview-bar .pv-tx { flex: 1; min-width: 0; }
#preview-bar .pv-tx strong { font-weight: 700; }
#preview-bar .pv-tx em { font-style: normal; color: #ffd7a8; font-weight: 600; }
#preview-bar .pv-exit { background: #fff; color: #222; border: none; border-radius: 8px;
  padding: 6px 14px; font-weight: 600; font-size: 13px; cursor: pointer; flex: none; }

/* ---- Learning Center ---- */
.detail-chips-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px 4px; align-items: flex-start; }
.lc-wrap { position: relative; }
.lc-btn { display: inline-flex; align-items: center; gap: 7px; background: #f1eafc; color: #7c4fd6;
  font-size: 12.5px; font-weight: 700; padding: 8px 14px; border-radius: 8px; border: none;
  cursor: pointer; transition: background .13s ease; }
.lc-btn:hover { background: #e8daf8; }
.lc-chev { transition: transform .18s ease; flex-shrink: 0; }
.lc-dropdown { position: absolute; left: 20px; top: calc(100% - 4px); z-index: 30;
  background: #fff; border: 1px solid #eee; border-radius: 8px; width: 280px;
  box-shadow: 0 4px 16px rgba(0,0,0,.10); overflow: hidden; }
.lc-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  font-size: 12.5px; color: var(--text); text-decoration: none; border-bottom: 1px solid #f0f0f0; }
.lc-item:last-child { border-bottom: none; }
.lc-item:hover { background: #faf7ff; }
.lc-dot { width: 6px; height: 6px; border-radius: 50%; background: #7c4fd6; flex-shrink: 0; }
#preview-bar .pv-exit:hover { background: #f0f0f0; }

/* ===== Menús de la barra superior =====
   Diez pestañas necesitaban 1.070 px y solo había 580: se desplazaban en silencio, porque .tabs
   lleva overflow-x con la barra oculta. Agrupadas en dos menús bajan a ~560 px y caben también en
   un portátil de 1.280. */
.tabgroup { position: relative; display: flex; }
/* .tab apila en columna (icono arriba, etiqueta abajo), así que la flecha tiene que ir dentro
   de un contenedor propio en fila; suelta caería bajo el texto. */
.tab-label { display: inline-flex; align-items: center; gap: 4px; }
.tab-caret { width: 13px !important; height: 13px !important; transition: transform .13s; }
.tab-trigger[aria-expanded="true"] .tab-caret { transform: rotate(180deg); }
/* El grupo se marca cuando la sección activa es uno de sus hijos, igual que .tab.active. */
.tab-trigger.active { color: var(--ink); border-bottom-color: var(--ink); }

/* Fija, no absoluta: .tabs necesita overflow-x para poder desplazarse en pantallas estrechas, y
   eso recorta a cualquier hijo posicionado dentro. La posición la calcula el JS al abrir. */
.menu { position: fixed; z-index: 60; min-width: 216px;
  padding: 6px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: rgba(0,0,0,.12) 0 10px 30px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: none; border-radius: 10px; background: none; cursor: pointer;
  color: var(--ink); font-size: 14.5px; font-weight: 600; text-align: left; white-space: nowrap;
  transition: background .12s, color .12s; }
.menu-item svg { width: 19px; height: 19px; flex: none; color: var(--muted); }
.menu-item:hover { background: #f4f4f4; }
.menu-item.active { color: var(--brand); }
.menu-item.active svg { color: var(--brand); }
.menu-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.menu-item--danger { color: var(--danger); }
.menu-item--danger svg { color: var(--danger); }
.menu-item--danger:hover { background: #fdecea; }
/* «Ver como»: módulo que la persona ve con su cuenta pero la vista previa no puede simular (0274). */
.menu-item--off { flex-wrap: wrap; opacity: .6; cursor: not-allowed; white-space: normal; }
.menu-item--off:hover { background: none; }
.menu-item--off::after { content: attr(data-nota); flex-basis: 100%; padding-left: 29px; font-size: 11.5px; font-weight: 500; color: var(--muted); }

/* El correo vive aquí desde que salió de la barra; no es accionable, solo contexto. */
.menu-head { padding: 10px 12px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line-soft);
  font-size: 13px; color: var(--muted); word-break: break-all; }
.usermenu { position: relative; display: flex; }

@media (max-width: 760px) {
  .menu { min-width: 200px; }
  .menu-item { font-size: 15px; padding: 11px 12px; }
  /* A la derecha del todo no cabría un panel anclado a la izquierda. */
  .tabgroup:last-child .menu { left: auto; right: 0; }
}

/* ---- Disciplina — chip en ficha ---- */
.disc-btn { display: inline-flex; align-items: center; gap: 7px; background: #fef2f2; color: #b91c1c;
  font-size: 12.5px; font-weight: 700; padding: 8px 14px; border-radius: 8px; border: none;
  cursor: pointer; transition: background .13s ease; }
.disc-btn:hover { background: #fee2e2; }
.disc-btn--beta { background: #fffbeb; color: #92400e; border: 1.5px dashed #f59e0b; }
.disc-btn--beta:hover { background: #fef3c7; }
.disc-beta-tag { display: inline-block; font-size: 9.5px; font-weight: 800; letter-spacing: .6px; padding: 2px 6px;
  border-radius: 999px; background: #f59e0b; color: #fff; vertical-align: middle; }
.disc-note--beta { margin: 0 0 14px; }
.couns-ref-btn { display: inline-flex; align-items: center; gap: 7px; background: #ecfeff; color: #0e7490;
  font-size: 12.5px; font-weight: 700; padding: 8px 14px; border-radius: 8px; border: none;
  cursor: pointer; transition: background .13s ease; white-space: nowrap; }
.couns-ref-btn:hover { background: #cffafe; }

/* ---- Disciplina — modal overlay ---- */
.disc-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.disc-modal { background: #fff; border-radius: 14px; width: 100%; max-width: 580px;
  max-height: 90vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.22); }
.disc-modal .modal-topbar { padding: 16px 20px 0; }
.disc-modal-body { overflow-y: auto; padding: 20px 24px 8px; flex: 1; }
.disc-student-name { font-weight: 700; font-size: 15px; margin: 0 0 16px; color: var(--text); }
.disc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.disc-field { display: flex; flex-direction: column; gap: 5px; }
.disc-field--2col { grid-column: span 2; }
.disc-field--hidden { display: none; }
.disc-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.disc-note { margin: 0; padding: 6px 10px; font-size: 12px; line-height: 1.4; color: #8a5a00; background: #fff8e6; border-left: 3px solid #e0a800; border-radius: 4px; }
.disc-input, .disc-select, .disc-textarea { border: 1px solid #ddd; border-radius: 7px;
  padding: 8px 10px; font-size: 13px; font-family: inherit; color: var(--text); background: #fff;
  outline: none; transition: border-color .15s; width: 100%; box-sizing: border-box; }
.disc-input:focus, .disc-select:focus, .disc-textarea:focus { border-color: var(--brand); }
.disc-input--readonly { background: #f5f5f5; color: var(--muted); cursor: default; }
.disc-checks { display: flex; flex-direction: column; gap: 8px; }
.disc-check-label { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; cursor: pointer; }
.disc-check-label input { margin-top: 2px; accent-color: var(--brand); flex-shrink: 0; }
.disc-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px;
  border-top: 1px solid #f0f0f0; }
.disc-confirm { display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 32px 24px; text-align: center; }
.disc-confirm p { font-size: 14px; color: var(--text); max-width: 340px; margin: 0; }

/* ============================================================
   Disciplina — vista de tabla (dtv-*)
   ============================================================ */

/* Tarjeta contenedora */
.dtv-card {
  margin: 24px;
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
}

/* Header */
.dtv-header { margin-bottom: 20px; }
.dtv-title { font-size: 22px; font-weight: 700; color: oklch(0.2 0.01 260); margin: 0 0 14px; }

/* Tabs de nivel */
.dtv-nivel-label { font-size: 13px; font-weight: 600; color: oklch(0.35 0.12 18); margin: 0; }
.dtv-header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.dtv-tabs { display: flex; gap: 8px; flex-wrap: wrap; }

/* Toggle Todas / Mías y pills de tipo */
.dtv-filter-toggle { display: flex; background: oklch(0.95 0.004 260); border-radius: 8px; padding: 3px; gap: 2px; }
.dtv-filter-btn { font-size: 12.5px; font-weight: 600; padding: 5px 14px; border-radius: 6px;
  border: none; background: transparent; color: oklch(0.5 0.01 260); cursor: pointer; transition: all .13s; white-space: nowrap; }
.dtv-filter-btn.active { background: #fff; color: oklch(0.35 0.12 18); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* Toolbar (buscador + tipo) */
.dtv-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 0 16px; border-bottom: 1px solid oklch(0.93 0.004 260); margin-bottom: 4px; }
.dtv-search-wrap { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 180px;
  border: 1px solid oklch(0.88 0.005 260); border-radius: 8px; padding: 7px 12px;
  background: #fff; color: oklch(0.55 0.01 260); }
.dtv-search-wrap:focus-within { border-color: oklch(0.6 0.01 260); }
.dtv-search { border: none; outline: none; font: inherit; font-size: 13px; flex: 1;
  color: oklch(0.2 0.01 260); background: transparent; }
.dtv-search::placeholder { color: oklch(0.65 0.01 260); }
.dtv-select { font: inherit; font-size: 12.5px; font-weight: 500; height: 34px; padding: 0 28px 0 12px;
  border: 1px solid oklch(0.88 0.005 260); border-radius: 8px; background-color: #fff;
  color: oklch(0.3 0.01 260); cursor: pointer; max-width: 100%; }
.dtv-select:focus { outline: none; border-color: oklch(0.6 0.01 260); }
.dtv-tab {
  padding: 6px 18px;
  border-radius: 999px;
  border: 1.5px solid #ddd;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  color: oklch(0.45 0.01 260);
  cursor: pointer;
  transition: all .14s;
}
.dtv-tab:hover { border-color: #bbb; color: oklch(0.25 0.01 260); }
.dtv-tab.active {
  background: oklch(0.35 0.12 18);
  border-color: oklch(0.35 0.12 18);
  color: #fff;
  font-weight: 600;
}

/* Outer (scroll) */
.dtv-table-outer { overflow-x: auto; }

/* Borde de tabla con esquinas redondeadas en header y última fila */
.dtv-table-wrap {
  border: 1px solid oklch(0.92 0.005 260);
  border-radius: 12px;
  overflow: hidden;
}
.dtv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

/* Header */
.dtv-thead-row th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: oklch(0.52 0.01 260);
  background: oklch(0.97 0.004 260);
  border-bottom: 1px solid oklch(0.92 0.005 260);
  white-space: nowrap;
}

/* Filas */
.dtv-row td { border-bottom: 1px solid oklch(0.95 0.004 260); }
.dtv-row--alt td { background: oklch(0.985 0.003 260); }
.dtv-row:last-child td { border-bottom: none; }
.dtv-td {
  padding: 12px 14px;
  vertical-align: middle;
  color: oklch(0.22 0.01 260);
  line-height: 1.4;
}
.dtv-td--date { white-space: nowrap; font-size: 12px; font-weight: 600; }
.dtv-time { font-weight: 400; color: oklch(0.55 0.01 260); }
.dtv-td--muted { color: oklch(0.52 0.01 260); font-size: 12px; }
.dtv-td--email { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dtv-td--falta { max-width: 240px; font-size: 12px; line-height: 1.45; }
.dtv-td--actions { white-space: nowrap; }

/* Celda de estudiante */
.dtv-student-cell { display: flex; align-items: center; gap: 9px; }
.dtv-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: oklch(0.93 0.03 18);
  color: oklch(0.35 0.12 18);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  letter-spacing: .02em;
}
.dtv-student-name { font-weight: 600; color: oklch(0.2 0.01 260); }

/* Lugar */
.dtv-lugar-inner { display: inline-flex; align-items: center; gap: 6px; }
.dtv-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: oklch(0.7 0.01 260);
  flex: none;
}

/* Badges */
.dtv-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.dtv-badge--gray   { background: #f0f0f2; color: #52525b; }
.dtv-badge--maroon { background: oklch(0.93 0.03 18); color: oklch(0.35 0.12 18); }
.dtv-badge--blue   { background: oklch(0.93 0.03 250); color: oklch(0.35 0.1 250); }
.dtv-badge--green  { background: oklch(0.93 0.03 160); color: oklch(0.35 0.1 160); }
.dtv-badge--amber  { background: oklch(0.96 0.06 80);  color: oklch(0.4 0.12 70); }
.dtv-badge--orange { background: oklch(0.95 0.06 45);  color: oklch(0.38 0.12 35); }
.dtv-badge--red    { background: oklch(0.95 0.05 18);  color: oklch(0.38 0.14 18); }

/* Botones de acción */
.dtv-btn-ver {
  font-size: 12px;
  font-weight: 600;
  color: oklch(0.35 0.12 18);
  background: #fff;
  border: 1.5px solid oklch(0.35 0.12 18);
  border-radius: 7px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.dtv-btn-ver:hover { background: oklch(0.35 0.12 18); color: #fff; }
.dtv-enviado-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #16a34a;
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.dtv-btn-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1.5px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  cursor: pointer;
  margin-left: 4px;
  transition: background .12s;
}
.dtv-btn-del:hover { background: #fee2e2; }
.dtv-btn-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1.5px solid #d4d4d8;
  background: #fafafa;
  color: #3f3f46;
  cursor: pointer;
  margin-left: 4px;
  transition: background .12s;
}
.dtv-btn-edit:hover { background: #f0f0f2; }

/* ---- Detalle de falta — modal ---- */
/* ============================================================
   Detalle de falta — rediseño visual (ddet-*)
   Fuentes: Zilla Slab (headings) · Karla (body)
   ============================================================ */
.ddet-card {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 32px -12px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.06);
  font-family: 'Karla', var(--sans);
  position: relative;
}

/* Topbar */
.ddet-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid #f0f0f0;
  flex: none;
}
.ddet-title {
  font-family: 'Zilla Slab', Georgia, serif;
  font-weight: 700;
  font-size: 21px;
  color: #1a1a1a;
  letter-spacing: -0.3px;
}
.ddet-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f3f4f6;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #555;
  flex: none;
}
.ddet-close:hover { background: #e5e7eb; }
.ddet-topbar-actions { display: flex; align-items: center; gap: 10px; }
.ddet-enviado-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eaf6ee;
  color: #1a7a45;
  border: 1px solid #b6dfc7;
  border-radius: 20px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.ddet-send-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: oklch(0.35 0.12 18);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .13s;
  white-space: nowrap;
}
.ddet-send-btn:hover { background: oklch(0.3 0.12 18); }

/* Modal de confirmación "Enviar a acudientes" */
.ddet-confirm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.ddet-confirm-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px 28px 24px;
  width: 90%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.ddet-confirm-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: oklch(0.95 0.03 18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.ddet-confirm-title {
  font-family: 'Zilla Slab', Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
}
.ddet-confirm-body {
  font-size: 13.5px;
  color: #555;
  margin: 0;
  line-height: 1.5;
  max-width: 300px;
}
.ddet-confirm-foot {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  width: 100%;
}
.ddet-confirm-foot .btn-outline { flex: 1; height: 40px; font-size: 14px; }
.ddet-confirm-cancel { flex: 1; height: 40px; font-size: 14px; font-weight: 500;
  border: 1px solid #ddd; border-radius: 8px; background: #fff; color: #333;
  cursor: pointer; font-family: inherit; }
.ddet-confirm-cancel:hover { background: #f7f7f7; }
.ddet-confirm-send {
  flex: 1;
  height: 40px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: oklch(0.35 0.12 18);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background .13s;
}
.ddet-confirm-send:hover { background: oklch(0.3 0.12 18); }

/* Body */
.ddet-body {
  overflow-y: auto;
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Student block */
.ddet-student { display: flex; align-items: center; gap: 20px; padding: 4px 0 6px; }
.ddet-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  overflow: hidden;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3e8e8;
  box-shadow: 0 0 0 4px #fff, 0 0 0 6px #960e0b;
}
.ddet-initials {
  font-family: 'Zilla Slab', Georgia, serif;
  font-weight: 700;
  font-size: 28px;
  color: #960e0b;
  line-height: 1;
}
.ddet-photo-img { width: 100%; height: 100%; object-fit: cover; }
.ddet-student-info { display: flex; flex-direction: column; gap: 9px; }
.ddet-name {
  font-family: 'Zilla Slab', Georgia, serif;
  font-weight: 700;
  font-size: 23px;
  color: #1a1a1a;
  margin: 0;
  line-height: 1.15;
}
.ddet-grade-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 13px;
  border-radius: 999px;
  background: #fef2f2;
  color: #960e0b;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  align-self: flex-start;
}

/* 2-col grid */
.ddet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
}
.ddet-field { display: flex; flex-direction: column; gap: 4px; }
.ddet-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #9ca3af;
}
.ddet-label--red { color: #960e0b; }
.ddet-val {
  font-size: 14.5px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.4;
}
.ddet-val--red { color: #960e0b; }
.ddet-tipo-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fefce8;
  color: #92400e;
  font-size: 12px;
  font-weight: 600;
  align-self: flex-start;
  border: 1px solid #fde68a;
}

/* Infracción */
.ddet-infraccion {
  background: #fef2f2;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ddet-infraccion-txt {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  margin: 0;
  line-height: 1.5;
}

/* Vertical list */
.ddet-vlist { display: flex; flex-direction: column; gap: 14px; }
.ddet-vfield { display: flex; flex-direction: column; gap: 4px; }

/* Historia */
.ddet-hist-section { border-top: 1px solid #f0f0f0; padding-top: 16px; }
.ddet-hist-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Karla', var(--sans);
  font-size: 13.5px;
  font-weight: 700;
  color: #1a1a1a;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 0 12px;
}
.ddet-hist-chev { transition: transform .2s; flex: none; }
.ddet-hist-body { display: flex; flex-direction: column; gap: 8px; }
.ddet-hist-item { display: flex; align-items: center; gap: 10px; }
.ddet-hist-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #960e0b;
  flex: none;
}
.ddet-hist-card {
  flex: 1;
  background: #f9fafb;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ddet-hist-info { display: flex; flex-direction: column; gap: 2px; }
.disc-hist-date { font-size: 12.5px; font-weight: 700; color: #1a1a1a; }
.disc-hist-cat { font-size: 12px; color: var(--muted); }

/* ---- Disciplina — botón de configuración y title row ---- */
.dtv-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.dtv-title-row .dtv-title { margin: 0; }
.dtv-config-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: transparent; border: 1px solid oklch(0.88 0.005 260);
  color: oklch(0.5 0.01 260); cursor: pointer; transition: background .13s, color .13s;
}
.dtv-config-btn:hover { background: oklch(0.95 0.004 260); color: oklch(0.25 0.01 260); }

/* ---- Disciplina — modal de configuración de envío automático (dconf-*) ---- */
.dconf-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.dconf-modal {
  background: #fff; border-radius: 18px;
  width: 100%; max-width: 480px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  display: flex; flex-direction: column; overflow: hidden;
}
.dconf-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 24px 24px 16px;
  border-bottom: 1px solid oklch(0.93 0.004 260);
}
.dconf-title { font-size: 15px; font-weight: 700; color: oklch(0.2 0.01 260); margin: 0 0 4px; }
.dconf-sub { font-size: 12.5px; color: oklch(0.5 0.01 260); margin: 0; line-height: 1.45; }
.dconf-body { padding: 20px 24px; }
.dconf-grid { width: 100%; border-collapse: collapse; }
.dconf-grid th {
  font-size: 12px; font-weight: 700; color: oklch(0.45 0.01 260);
  text-align: center; padding: 0 0 10px; letter-spacing: .02em;
}
.dconf-grid th:first-child { text-align: left; }
.dconf-grid td { padding: 10px 0; vertical-align: middle; text-align: center; }
.dconf-grid td:first-child { text-align: left; }
.dconf-grid tbody tr:not(:last-child) td { border-bottom: 1px solid oklch(0.95 0.004 260); }
.dconf-nivel-label { font-size: 13.5px; font-weight: 600; color: oklch(0.25 0.01 260); }
.dconf-toggle { position: relative; display: inline-block; width: 38px; height: 22px; cursor: pointer; }
.dconf-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.dconf-slider {
  position: absolute; inset: 0; border-radius: 22px;
  background: oklch(0.88 0.005 260); transition: background .2s;
}
.dconf-slider::after {
  content: ''; position: absolute;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  top: 3px; left: 3px; transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.dconf-toggle input:checked + .dconf-slider { background: oklch(0.35 0.12 18); }
.dconf-toggle input:checked + .dconf-slider::after { transform: translateX(16px); }
.dconf-th-staff { border-left: 2px solid oklch(0.9 0.005 260); color: oklch(0.35 0.12 18) !important; }
.dconf-td-staff { border-left: 2px solid oklch(0.93 0.004 260); }
.dconf-na { font-size: 14px; color: oklch(0.75 0.005 260); }
.dconf-foot {
  padding: 16px 24px;
  border-top: 1px solid oklch(0.93 0.004 260);
  display: flex; justify-content: flex-end;
}

/* ===== PQRs (bandeja) ===== */
.pq-wrap { display: flex; flex-direction: column; gap: 14px; }
.pq-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.pq-top h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.3px; margin: 0 0 2px; }
.pq-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line-soft); }
.pq-tab { border: none; background: none; padding: 0 0 10px; font-size: 14px; font-weight: 600; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent; }
.pq-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.pq-n { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--brand); color: #fff; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.pq-filters { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pq-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.pq-chip { height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff;
  font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink); }
.pq-chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.pq-search { max-width: 340px; width: 100%; }
.pq-scroll { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 14px; background: #fff; }
.pq-table { min-width: 860px; }
.pq-row { cursor: pointer; }
.pq-row:hover td { background: #fafafa; }
.pq-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.pq-nowrap { white-space: nowrap; }
.pq-small { font-size: 12px; }
.pq-stars { color: #d9a900; letter-spacing: 1px; }
.pq-stars span { color: #dedee3; }
.pq-tipo, .pq-est { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pq-tipo--peticion { background: #eaeefb; color: #232d75; }
.pq-tipo--queja { background: #fceae7; color: #960e0b; }
.pq-tipo--reclamo { background: #fff4d6; color: #8a6400; }
.pq-tipo--sugerencia { background: #e3f4e8; color: #1f6b41; }
.pq-est--nueva { background: #eaeefb; color: #232d75; }
.pq-est--en_proceso { background: #fff4d6; color: #8a6400; }
.pq-est--cerrada { background: #e3f4e8; color: #1f6b41; }
.pq-detalle { white-space: pre-wrap; line-height: 1.55; }
.pq-edit { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.pq-lab { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.pq-lab select { max-width: 240px; }
.pq-ta { min-height: 80px; resize: vertical; font: inherit; font-weight: 400; line-height: 1.5; }

/* ---- Actualización de datos (admin) ---- */
.ad-wrap { display: flex; flex-direction: column; gap: 18px; }
.ad-section { background: #fff; border: 1px solid var(--line-soft); border-radius: 10px; padding: 18px 20px; }
.ad-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-3); margin: 0 0 14px; }
.ad-switch-row { display: flex; align-items: flex-start; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.ad-switch-row:last-child { border-bottom: none; padding-bottom: 0; }
.ad-switch-row strong { font-size: 14px; display: block; margin-bottom: 2px; }
.ad-badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; vertical-align: middle; }
.ad-badge--cerrado { background: #f3f3f5; color: #666; }
.ad-badge--lectura { background: #fff4d6; color: #8a6400; }
.ad-badge--abierto { background: #e3f4e8; color: #1f6b41; }
.ad-fam-row { display: grid; grid-template-columns: 100px 1fr 32px; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.ad-fam-row:last-of-type { border-bottom: none; }
.ad-fam-code { font-variant-numeric: tabular-nums; font-weight: 600; }
.ad-add-row { display: flex; gap: 8px; margin-top: 14px; }
.ad-add-row input { flex: 1; max-width: 220px; }
/* ── importar expediente ── */
.ad-import-section { border-top: 3px solid var(--brand); }
.ad-import-help { font-size: 13px; color: var(--ink-3); margin: 0 0 14px; }
.ad-import-help code { background: #f3f3f5; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.ad-import-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ad-import-filelabel { display: flex; align-items: center; gap: 8px; padding: 7px 14px;
  border: 1px solid var(--line-soft); border-radius: 6px; font-size: 13px; cursor: pointer;
  background: var(--bg); transition: border-color .15s; }
.ad-import-filelabel:hover { border-color: var(--brand); }
.ad-import-filelabel svg { flex-shrink: 0; color: var(--brand); }
.ad-import-status { display: flex; align-items: center; gap: 10px; font-size: 14px;
  color: var(--ink-3); margin: 4px 0; }
@keyframes ad-spin { to { transform: rotate(360deg); } }
.ad-import-spin { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--line-soft);
  border-top-color: var(--brand); border-radius: 50%; animation: ad-spin .7s linear infinite; }
.ad-import-summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; background: #f6f9ff; border-radius: 6px; font-size: 13px;
  margin-bottom: 14px; }
.ad-import-family { font-weight: 600; }
.ad-import-persons { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.ad-import-person { padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: 6px; }
.ad-import-person-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.ad-import-person-head .muted { font-size: 12px; }
.ad-import-none { font-size: 12px; color: var(--ink-3); margin: 4px 0; }
.ad-import-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 4px 0 8px; }
.ad-import-table td { padding: 3px 6px; vertical-align: top; }
.ad-import-field { font-family: monospace; color: var(--brand); white-space: nowrap; }
.ad-import-from { color: var(--ink-3); max-width: 160px; word-break: break-all; }
.ad-import-from em { color: var(--ink-4); }
.ad-import-arrow { color: var(--ink-4); padding: 3px 4px; }
.ad-import-to { color: var(--ink); max-width: 200px; word-break: break-all; font-weight: 500; }
.ad-import-files { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.ad-import-filebadge { font-size: 11px; font-family: monospace; padding: 2px 8px;
  background: #eef3ff; color: #2d4a8a; border-radius: 4px; }
.ad-import-warn { background: #fffbf0; border: 1px solid #fde68a; border-radius: 6px;
  padding: 10px 14px; font-size: 13px; color: #92400e; margin-bottom: 12px; }
.ad-import-warn p { margin: 2px 0; }
.ad-import-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.ad-import-done p { font-size: 14px; margin: 0 0 10px; }
.ad-import-done strong { color: #1f6b41; }
.ad-import-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.ad-cred-ok { font-size: 13px; color: #1f6b41; font-weight: 600; }
.ad-cred-err { font-size: 13px; color: var(--rojo); }
.ad-import-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13px; margin-bottom: 14px; padding: 10px 14px;
  background: #f6f9ff; border-radius: 6px; }
/* mapping rows */
.ad-map-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.ad-map-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: 6px; }
.ad-map-info { display: flex; flex-direction: column; gap: 2px; }
.ad-map-meta { font-size: 12px; color: var(--ink-3); }
.ad-map-search { display: flex; align-items: center; gap: 6px; }
.ad-map-input-wrap { position: relative; flex: 1; }
.ad-map-input { width: 100%; }
.ad-map-dropdown { position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 20;
  background: #fff; border: 1px solid var(--line-soft); border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1); overflow: hidden; }
.ad-map-option { display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; cursor: pointer; font-size: 13px; gap: 8px; }
.ad-map-option:hover { background: #f6f9ff; }
.ad-map-opt-name { font-weight: 500; color: var(--ink); }
.ad-map-opt-cod { font-family: monospace; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.ad-map-chip { font-family: monospace; font-size: 12px; font-weight: 700; padding: 3px 8px;
  background: #e3f4e8; color: #1f6b41; border-radius: 4px; white-space: nowrap; }
.ad-map-clear { background: none; border: none; color: var(--ink-3); cursor: pointer;
  font-size: 13px; padding: 2px 4px; line-height: 1; }
.ad-map-clear:hover { color: var(--brand); }
@media (max-width: 600px) {
  .ad-map-row { grid-template-columns: 1fr; }
}
.ad-map-row--new { border-color: #e8a800; background: #fffdf0; }
.ad-map-chip--new { background: #fff0c0; color: #7a5500; }
.ad-map-badge-new { font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 2px 6px;
  border-radius: 4px; background: #ffcc00; color: #4a3200; white-space: nowrap; flex-shrink: 0; }
.ad-map-option--new { border-top: 1px solid var(--line-soft); background: #fffdf0; }
.ad-map-option--new .ad-map-opt-name { color: #7a5500; }
.ad-import-newfam-notice { padding: 8px 14px; background: #fff4cc; border: 1px solid #e8c300;
  border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.ad-import-person--new { border-left: 3px solid #ffcc00; }
.ad-import-confirm-modal { border: none; border-radius: 10px; padding: 0;
  max-width: 680px; width: 95vw; box-shadow: 0 8px 40px rgba(0,0,0,.18);
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; }
.ad-import-confirm-modal::backdrop { background: rgba(0,0,0,.45); }
.ad-import-confirm-modal .modal-head { display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--line-soft); }
.ad-import-confirm-modal .modal-body { padding: 16px 20px; overflow-y: auto; max-height: 58vh; }
.ad-import-confirm-modal .modal-foot { padding: 14px 20px; border-top: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 12px; }
.ad-import-confirm-checkbox { display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; background: var(--bg-alt, #f5f5f5); border-radius: 6px;
  border: 1px solid var(--line-soft); font-size: 13px; cursor: pointer; }
.ad-import-confirm-checkbox input[type=checkbox] { margin-top: 2px; flex-shrink: 0; }
.ad-import-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ─── Tabs principales de Actualización de datos ─── */
.ad-main-tabs { display: flex; gap: 4px; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.ad-main-tab { background: none; border: none; padding: 8px 20px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.ad-main-tab:not(.ad-main-tab--on):hover { background: var(--bg-hover); }
.ad-main-tab--on { background: var(--brand); color: #fff; }

/* ─── Info de familias — tarjetas ─── */
.adfam-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.adfam-card { background: #fff; border: 1.5px solid var(--line-soft); border-radius: 10px; padding: 16px 18px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.adfam-card:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0,0,0,0.08); }
.adfam-card-code { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-1); margin-bottom: 4px; }
.adfam-card-names { font-size: 12px; color: var(--ink-2); line-height: 1.5; margin-bottom: 10px; min-height: 36px; }
.adfam-card-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; display: inline-block; }
.adfam-status--ok   { background: #e3f4e8; color: #1f6b41; }
.adfam-status--pend { background: #fff4d6; color: #8a6400; }

/* ─── Proceso de matrícula — tarjetas de estudiante ─── */
.mt-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 1100px) { .mt-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px)  { .mt-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .mt-grid { grid-template-columns: 1fr; } }
.mt-card { background: #fff; border: 1.5px solid var(--line-soft); border-radius: 10px; overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s; }
.mt-card:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0,0,0,0.08); }
.mt-card-top { padding: 14px 16px 12px; cursor: pointer; }
.mt-card-name { font-size: 14px; font-weight: 700; color: var(--ink-1); margin-bottom: 4px; }
.mt-card-sub { font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }
.mt-card-switch-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line-soft); background: #fafafa; }
.mt-card-switch-label { font-size: 12px; color: var(--ink-2); }
.mt-chip { display: inline-flex; align-items: center; gap: 4px; width: fit-content;
  font-size: 11.5px; font-weight: 700; color: var(--brand); background: rgba(0,0,0,0.05);
  padding: 3px 10px; border-radius: 999px; text-decoration: none; }
.mt-chip:hover { background: rgba(0,0,0,0.09); }

/* ─── Modal familia ─── */
.adfam-modal-card { width: min(900px, 96vw); background: #fff; border-radius: 14px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.adfam-modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 24px 14px; border-bottom: 1px solid var(--line-soft); flex-shrink: 0; }
.adfam-modal-title { font-size: 18px; font-weight: 700; margin: 0 0 2px; }
.adfam-modal-sub { font-size: 13px; color: var(--ink-3); margin: 0; }
.adfam-tabs { display: flex; gap: 4px; padding: 10px 24px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
.adfam-tabs::-webkit-scrollbar { display: none; }
.adfam-tab { background: none; border: none; padding: 6px 14px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; color: var(--ink-2); }
.adfam-tab:hover { background: var(--bg-hover); }
.adfam-tab--on { background: var(--brand); color: #fff; }
.adfam-content { padding: 20px 24px; overflow-y: auto; flex: 1; }
.adfam-sec-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-3); margin: 0 0 14px 0; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.adfam-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 14px; }
.adfam-row1 { margin-bottom: 14px; }
.adfam-f { display: flex; flex-direction: column; gap: 3px; }
.adfam-l { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-3); }
.adfam-v { font-size: 14px; color: var(--ink-1); word-break: break-word; }
.adfam-empty { color: #bbb; font-style: italic; }
.adfam-slot { background: #fafafa; border: 1px solid var(--line-soft); border-radius: 8px; padding: 14px 16px; margin-bottom: 10px; }
.adfam-slot:last-child { margin-bottom: 0; }
.adfam-slot-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-3); margin: 0 0 12px; }
.adfam-slot-empty { font-size: 13px; color: #bbb; font-style: italic; }
.adfam-badge-ok     { display: inline-flex; align-items: center; gap: 6px; background: #e3f4e8; color: #1f6b41; font-weight: 600; font-size: 13px; padding: 6px 14px; border-radius: 8px; margin-bottom: 8px; }
.adfam-badge-pend   { display: inline-flex; align-items: center; gap: 6px; background: #fff4d6; color: #8a6400; font-weight: 600; font-size: 13px; padding: 6px 14px; border-radius: 8px; margin-bottom: 16px; }
.adfam-badge-reopen { display: inline-flex; align-items: center; gap: 6px; background: #fff0d6; color: #7a4f00; font-weight: 600; font-size: 13px; padding: 6px 14px; border-radius: 8px; margin-bottom: 16px; }
.btn-sm             { font-size: 13px; font-weight: 600; padding: 7px 16px; border-radius: 7px; border: none; cursor: pointer; }
.btn-neutral        { background: #f0f2f5; color: #333; }
.btn-neutral:hover  { background: #e2e5ea; }
.btn-danger-soft    { background: #fde8e8; color: #a81c1c; }
.btn-danger-soft:hover { background: #fbd2d2; }
.adfam-file-btn { font-size: 12px; color: var(--brand); background: none; border: 1px solid var(--brand); border-radius: 5px; padding: 3px 10px; cursor: pointer; margin-top: 2px; }
.adfam-file-btn:hover { background: #f0faf4; }

/* ===== Autorizaciones (bandeja) ===== */
.au-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.au-card { border: 1px solid var(--line-soft); border-radius: 14px; padding: 14px 16px; background: #fff; }
.au-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.au-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.au-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.au-det { font-size: 13.5px; color: var(--ink); margin-top: 8px; }
.au-mot { color: var(--muted); }
.au-firma { font-size: 12px; color: var(--muted); margin-top: 8px; }
.au-nota { font-size: 13px; color: var(--ink); background: #fafafa; border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
.au-est { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.au-est--pend { background: #fff4d6; color: #8a6400; }
.au-est--rep { background: #eaeefb; color: #232d75; }
.au-est--ok { background: #e3f4e8; color: #1f6b41; }
.au-est--no { background: #fceae7; color: #960e0b; }
.au-flags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.au-flag { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 8px; }
.au-flag--bus { background: #fceae7; color: #960e0b; }
.au-flag--extra { background: #fff4d6; color: #8a6400; }
.au-acc { display: flex; gap: 8px; margin-top: 12px; }
.au-ok, .au-no, .au-cancel { padding: 6px 16px; border-radius: 20px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.au-ok { border: none; background: #1f9254; color: #fff; }
.au-no { border: 1px solid #960e0b; background: #fff; color: #960e0b; }
.au-cancel { border: 1px solid var(--line); background: #fff; color: var(--muted); }
.au-rech { margin-top: 12px; }
.au-nota-in { width: 100%; resize: vertical; font: inherit; font-size: 13px; }
.au-excusa { margin-top: 8px; font-size: 12.5px; }
.au-excusa--falta { color: #8a6400; }
.au-ver { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 5px 14px;
  font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.au-ver:hover { border-color: var(--ink); }

/* ===== Autorizaciones · Configuración ===== */
.au-cfg { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.au-cfg-ro { padding: 10px 14px; background: #fff4d6; border-radius: 10px; color: #8a6400; }
.au-cfg-box { border: 1px solid var(--line-soft); border-radius: 14px; padding: 16px 18px; background: #fff; }
.au-cfg-box h3 { font-size: 15px; font-weight: 700; margin: 0 0 2px; }
.au-cfg-sub { font-size: 12.5px; margin: 0 0 12px; }
.au-cfg-row { display: flex; align-items: center; gap: 14px; padding: 7px 0; font-size: 13.5px; }
.au-cfg-row > span { min-width: 220px; color: var(--muted); }
.au-cfg-time { max-width: 140px; }
.au-cfg-num { max-width: 90px; }
.au-cfg-sel { max-width: 150px; }
.au-cfg-nivel { padding: 10px 0; border-top: 1px solid var(--line-soft); }
.au-cfg-nivel:first-child { border-top: none; }
.au-cfg-nivel-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.au-cfg-add { display: inline-flex; align-items: center; gap: 6px; }
.au-horas, .au-dest { display: flex; flex-wrap: wrap; gap: 7px; }
.au-hora, .au-mail { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  background: var(--chip); border-radius: 999px; padding: 4px 6px 4px 12px; }
.au-mail { border-radius: 10px; }
.au-hora--off, .au-mail--off { opacity: .45; text-decoration: line-through; }
.au-hora-x { border: none; background: none; cursor: pointer; color: var(--muted);
  font-size: 15px; line-height: 1; padding: 0 4px; }
.au-hora-x:hover { color: var(--brand); }
.au-cfg-tipo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  padding: 9px 0; border-top: 1px solid var(--line-soft); }
.au-cfg-tipo:first-child { border-top: none; }
.au-sw { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.au-sw--sm { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.btn-sm { font-size: 13px; padding: 5px 12px; }

/* Detalle de falta: «Mostrar a acudientes» (Tipo II/III) */
.ddet-vis { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 18px; padding: 10px 14px;
  border: 1.5px solid #e4e4e7; border-radius: 10px; background: #fafafa; cursor: pointer; font-size: 14px; }
.ddet-vis input { margin-top: 3px; width: 16px; height: 16px; accent-color: oklch(0.35 0.12 18); }
.ddet-vis small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); font-weight: 400; }
.ddet-vis--off { cursor: default; opacity: .75; }

/* ---- Adjuntos de faltas (disciplina-adjuntos.js) ---- */
.dadj-list { display: flex; flex-direction: column; gap: 6px; }
.dadj-it, .dadj-link { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px;
  border: 1px solid #e4e4e7; border-radius: 8px; background: #fff; font: inherit; font-size: 12.5px; }
.dadj-it--busy { color: var(--muted); font-style: italic; }
.dadj-link { cursor: pointer; text-align: left; }
.dadj-link:hover { border-color: oklch(0.35 0.12 18); background: #fdf5f5; }
.dadj-ic { display: flex; flex: none; color: oklch(0.35 0.12 18); }
.dadj-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dadj-sz { flex: none; font-size: 11px; color: var(--muted); }
.dadj-x { flex: none; border: none; background: none; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; padding: 0 2px; }
.dadj-x:hover { color: #b91c1c; }
.dadj-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dadj-add { display: inline-flex; align-items: center; gap: 6px; border: 1px dashed #c4c4cc; background: #fff;
  color: #52525b; font: inherit; font-size: 12.5px; font-weight: 600; padding: 7px 12px; border-radius: 8px; cursor: pointer; }
.dadj-add:hover { border-color: oklch(0.35 0.12 18); color: oklch(0.35 0.12 18); }
.dadj-hint { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); }
.dadj-det { margin-top: 16px; }
.dadj-det-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }

.dadj-viewer { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0,0,0,.72); }
.dadj-v-card { display: flex; flex-direction: column; width: min(960px, 100%); max-height: 100%; background: #fff; border-radius: 12px; overflow: hidden; }
.dadj-v-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #e4e4e7; }
.dadj-v-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dadj-v-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.dadj-v-count { font-size: 12px; color: var(--muted); }
.dadj-v-nav, .dadj-v-close { border: none; background: #f4f4f5; border-radius: 8px; width: 32px; height: 32px; font-size: 20px; cursor: pointer; line-height: 1; }
.dadj-v-nav:hover, .dadj-v-close:hover { background: #e4e4e7; }
.dadj-v-body { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; min-height: 240px; overflow: auto; background: #fafafa; }
.dadj-v-img { max-width: 100%; max-height: 74vh; object-fit: contain; border-radius: 6px; }
.dadj-v-pdf { width: 100%; height: 72vh; border: 0; background: #fff; }
.dadj-v-msg { text-align: center; color: #52525b; font-size: 14px; line-height: 1.6; }
.dadj-v-open { font-size: 13px; font-weight: 600; color: oklch(0.35 0.12 18); }

/* Detalle de falta: tarjeta de gestión (estado de seguimiento + mostrar a acudientes) */
.ddet-gest { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 18px; }
.ddet-gest .ddet-vis { flex: 1 1 230px; margin: 0; }
.ddet-est { flex: 1 1 200px; display: flex; flex-direction: column; gap: 6px; padding: 10px 14px;
  border: 1.5px solid #e4e4e7; border-radius: 10px; background: #fafafa; }
.ddet-est .dtv-select { width: 100%; }
.ddet-est--off { opacity: .75; }

/* Modal BETA: faltas con casillas, nombre corto y «Ver más» (modelo nuevo) */
.dfal { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow-y: auto;
  border: 1px solid #e4e4e7; border-radius: 8px; padding: 6px 10px; background: #fff; }
.dfal-empty { margin: 8px 0; font-size: 13px; color: var(--muted); }
.dfal-head { margin: 4px 0 6px; font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.dfal-it { border-bottom: 1px solid #f4f4f5; padding: 5px 0; }
.dfal-it:last-child { border-bottom: 0; }
.dfal-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dfal-row { display: flex; align-items: flex-start; gap: 8px; flex: 1; min-width: 0; font-size: 13px; cursor: pointer; }
.dfal-row input { margin-top: 3px; accent-color: var(--brand); flex-shrink: 0; }
.dfal-short { line-height: 1.35; }
.dfal-more { flex: none; border: none; background: none; padding: 2px 4px; font: inherit; font-size: 12px; font-weight: 600;
  color: oklch(0.35 0.12 18); cursor: pointer; text-decoration: underline; }
.dfal-full { margin: 6px 0 2px 24px; padding: 8px 10px; font-size: 12.5px; line-height: 1.5; color: #3f3f46;
  background: #fafafa; border-left: 3px solid #e4e4e7; border-radius: 4px; }
