/* ============================================================
   Sistema de Asistencia — Colegio Hno. Felipe Palazón
   Tablet-first (1024px), colores institucionales
   ============================================================ */

/* ── Variables institucionales ──────────────────────────────── */
:root {
  --navy:    #2a3063;
  --navy-dk: #1e2347;
  --navy-lt: #3d4480;
  --green:   #4c7d60;
  --green-dk:#376048;
  --wine:    #701f40;
  --wine-dk: #541730;

  /* Estados de asistencia */
  --estado-p: #16a34a;   /* Presente   — verde */
  --estado-r: #ca8a04;   /* Retraso    — amarillo */
  --estado-l: #0891b2;   /* Licencia   — celeste */
  --estado-f: #dc2626;   /* Falta      — rojo */

  --estado-p-bg: #dcfce7;
  --estado-r-bg: #fef9c3;
  --estado-l-bg: #cffafe;
  --estado-f-bg: #fee2e2;

  /* UI */
  --bg:        #f1f5f9;
  --surface:   #ffffff;
  --border:    #e2e8f0;
  --text:      #1e293b;
  --text-muted:#64748b;
  --radius:    10px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

/* ── Reset mínimo ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Evita scroll horizontal de toda la página (header/footer sin fondo) */
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; }
svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor;
      stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-shrink: 0;
}

.header-logo { width: 36px; height: 36px; }

.header-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: #fff;
}

.header-subtitle {
  opacity: .7;
  font-weight: 400;
  font-size: .85rem;
  margin-left: .2rem;
}

.header-nav {
  display: flex;
  gap: .25rem;
  flex: 1;
  min-width: 0;            /* permite encoger en flex */
  overflow-x: auto;        /* si no entra, scrollea DENTRO del header navy */
  overflow-y: hidden;
  flex-wrap: nowrap;
  scrollbar-width: none;
}
.header-nav::-webkit-scrollbar { display: none; }

.nav-link {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .9rem;
  border-radius: 6px;
  font-size: .9rem;
  color: rgba(255,255,255,.8);
  transition: background .15s, color .15s;
  flex-shrink: 0;          /* no se aplastan; se mantiene el tamaño */
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255,255,255,.15);
  color: #fff;
}

/* ── Dropdown de Configuración (nav) ──────────────────────── */
.nav-dropdown { position: relative; flex-shrink: 0; }
.nav-dropdown-toggle { background: none; border: none; font: inherit; cursor: pointer; }
.nav-caret { width: 14px !important; height: 14px !important; opacity: .75; transition: transform .15s; }
.nav-dropdown.open .nav-caret { transform: rotate(180deg); }
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + .4rem);
  right: 0;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: .35rem;
  z-index: 200;
}
.nav-dropdown-menu[hidden] { display: none !important; }
.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .7rem;
  border-radius: 8px;
  color: var(--text);
  font-size: .9rem;
  text-decoration: none;
  white-space: nowrap;
}
.nav-dropdown-item:hover { background: var(--bg); color: var(--navy); }
.nav-dropdown-item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-muted); }
.nav-dropdown-item:hover svg { color: var(--navy); }

.header-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-left: auto;
  flex-shrink: 0;
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3);
}

.user-avatar-placeholder {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--navy-lt);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
}

.user-name {
  font-size: .9rem;
  color: rgba(255,255,255,.9);
}

.btn-logout {
  display: flex;
  align-items: center;
  padding: .35rem;
  border-radius: 6px;
  color: rgba(255,255,255,.7);
  transition: background .15s, color .15s;
}

.btn-logout:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
}

/* ── Main / Footer ───────────────────────────────────────────── */
.app-main {
  flex: 1;
  padding: 1.5rem 1.25rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.app-main.no-nav { max-width: 100%; padding: 0; }

.app-footer {
  text-align: center;
  padding: .75rem;
  font-size: .78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ── Login ───────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy-dk) 0%, var(--navy) 50%, var(--navy-lt) 100%);
  padding: 2rem 1rem;
}

.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.login-brand { text-align: center; }

.login-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto .75rem;
}

.login-school {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: .25rem;
}

.login-subtitle {
  font-size: .88rem;
  color: var(--text-muted);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  width: 100%;
  padding: .9rem 1.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

.btn-google:hover {
  border-color: #4285F4;
  box-shadow: 0 0 0 3px rgba(66,133,244,.15);
  background: #fafbff;
}

.google-icon { width: 20px; height: 20px; flex-shrink: 0; }

.login-note {
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── Alertas ─────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .85rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  width: 100%;
}

.alert svg { flex-shrink: 0; margin-top: .05rem; }

.alert-error {
  background: var(--estado-f-bg);
  color: var(--estado-f);
  border: 1px solid #fca5a5;
}

.alert-success {
  background: var(--estado-p-bg);
  color: var(--estado-p);
  border: 1px solid #86efac;
}

/* ── Dashboard ───────────────────────────────────────────────── */
.page-wrap { max-width: 1200px; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}

.page-desc {
  font-size: .9rem;
  color: var(--text-muted);
  margin-top: .25rem;
}

/* ── Tarjetas de acceso rápido ───────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.quick-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  box-shadow: var(--shadow);
}

.quick-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.quick-card__icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.5rem;
}

.quick-card__icon svg { width: 26px; height: 26px; stroke-width: 1.8; }

.quick-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.quick-card__body strong { font-size: 1rem; font-weight: 600; }
.quick-card__body span   { font-size: .8rem; color: var(--text-muted); }

.quick-card__arrow { font-size: 1.25rem; color: var(--text-muted); }

/* Variantes de color */
.quick-card--primary .quick-card__icon { background: #dbeafe; color: #1d4ed8; }
.quick-card--primary:hover              { border-color: #93c5fd; }
.quick-card--blue    .quick-card__icon  { background: var(--estado-l-bg); color: var(--estado-l); }
.quick-card--blue:hover                 { border-color: var(--estado-l); }
.quick-card--red     .quick-card__icon  { background: var(--estado-f-bg); color: var(--estado-f); }
.quick-card--red:hover                  { border-color: #fca5a5; }
.quick-card--green   .quick-card__icon  { background: var(--estado-p-bg); color: var(--estado-p); }
.quick-card--green:hover                { border-color: #86efac; }
.quick-card--dark    .quick-card__icon  { background: #f1f5f9; color: var(--navy); }
.quick-card--dark:hover                 { border-color: var(--navy); }

/* ── Info bar ────────────────────────────────────────────────── */
.info-bar {
  display: flex;
  gap: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.info-item { display: flex; flex-direction: column; gap: .15rem; }
.info-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.info-value  { font-size: .95rem; font-weight: 600; color: var(--navy); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .3rem .75rem;
  border-radius: 9999px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  flex-shrink: 0;
}

.badge-admin     { background: #fce7f3; color: #9d174d; }
.badge-director  { background: #ede9fe; color: #5b21b6; }
.badge-encargado { background: #dbeafe; color: #1e40af; }
.badge-teacher   { background: #f0fdf4; color: #15803d; }

/* ── Botones generales ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.25rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, box-shadow .15s;
}

.btn:hover { opacity: .9; box-shadow: var(--shadow-md); }

.btn-primary { background: var(--navy); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger  { background: var(--wine);  color: #fff; }
.btn-warn    { background: #fef9c3; color: #92400e; border: 1px solid #fde68a; }
.btn-warn:hover { background: #fef08a; }
.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px; height: 20px;
  padding: 0 5px;
  background: #b45309;
  color: #fff;
  border-radius: 10px;
  font-size: .75rem;
  font-weight: 700;
  margin-left: .35rem;
}

/* ── Páginas de error ────────────────────────────────────────── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  gap: 1rem;
  padding: 2rem;
}

.error-code  { font-size: 6rem; font-weight: 900; color: var(--navy); opacity: .12; line-height: 1; }
.error-title { font-size: 1.5rem; font-weight: 700; color: var(--navy); }
.error-desc  { color: var(--text-muted); max-width: 360px; }

/* ── Estados de asistencia (reutilizable en Fase 3) ─────────── */
.chip-P { background: var(--estado-p-bg); color: var(--estado-p); font-weight: 700; }
.chip-R { background: var(--estado-r-bg); color: var(--estado-r); font-weight: 700; }
.chip-L { background: var(--estado-l-bg); color: var(--estado-l); font-weight: 700; }
.chip-F { background: var(--estado-f-bg); color: var(--estado-f); font-weight: 700; }

.chip-P, .chip-R, .chip-L, .chip-F {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 8px;
  font-size: .95rem;
}

/* Variante navy para "Cursos" */
.quick-card--navy  .quick-card__icon { background: #eef0ff; color: var(--navy); }
.quick-card--navy:hover               { border-color: var(--navy); }

/* ── Fase 2: Cursos ──────────────────────────────────────────── */
.nivel-section { margin-bottom: 2rem; }

.nivel-titulo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .85rem;
  padding: .6rem .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  transition: background .12s, border-color .12s;
}
.nivel-titulo:hover { background: var(--bg); border-color: var(--text-muted); }

.nivel-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.nivel-dot--inicial    { background: var(--wine); }
.nivel-dot--primaria   { background: var(--green); }
.nivel-dot--secundaria { background: var(--navy); }
.nivel-dot--otro       { background: var(--text-muted); }

/* Secciones colapsables (niveles / grados) — indicadores */
.nivel-count {
  margin-left: auto;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 9999px;
  padding: .1rem .55rem;
}
.nivel-chevron {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform .15s;
}
.nivel-section.is-collapsed .nivel-chevron { transform: rotate(-90deg); }
.nivel-section.is-collapsed > :not(.nivel-titulo) { display: none; }

.cursos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .85rem;
}

.curso-card {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: 1.1rem 1.1rem;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}

.curso-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.curso-card--primaria:hover   { border-color: var(--green); }
.curso-card--secundaria:hover { border-color: var(--navy); }

.curso-card__sigla {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--navy);
  min-width: 52px;
  text-align: center;
  flex-shrink: 0;
}

.curso-card--primaria .curso-card__sigla { color: var(--green-dk); }

.curso-card__info {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  flex: 1;
  min-width: 0;
}

.curso-card__desc {
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.curso-card__count {
  display: flex;
  align-items: center;
  gap: .25rem;
  font-size: .8rem;
  color: var(--text-muted);
}

.curso-card__count svg { width: 13px; height: 13px; }

.curso-card__arrow { font-size: 1.4rem; color: var(--text-muted); flex-shrink: 0; }

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.breadcrumb a:hover { color: var(--navy); text-decoration: underline; }
.breadcrumb strong  { color: var(--text); }

/* ── Buscador ────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: .55rem 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.search-bar svg { color: var(--text-muted); flex-shrink: 0; }

.search-bar input {
  border: none;
  outline: none;
  width: 100%;
  font-size: .95rem;
  background: transparent;
  color: var(--text);
}

/* ── Tabla de alumnos ────────────────────────────────────────── */
.alumnos-table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.alumnos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.alumnos-table th {
  background: #f8fafc;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  padding: .7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.alumnos-table td {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.alumnos-table tr:last-child td { border-bottom: none; }
.alumnos-table tr:hover td      { background: #f8fafc; }

.alumnos-table .nro { color: var(--text-muted); font-size: .8rem; width: 36px; }

.alumno-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-weight: 500;
}

.alumno-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.genero-chip {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 9999px;
  font-size: .75rem;
  font-weight: 600;
}
.genero-masculino, .genero-m { background: #dbeafe; color: #1d4ed8; }
.genero-femenino,  .genero-f { background: #fce7f3; color: #9d174d; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  padding: .35rem;
  border-radius: 6px;
  color: var(--text-muted);
  transition: background .12s, color .12s;
}
.btn-icon:hover { background: var(--bg); color: var(--navy); }

/* ── Perfil alumno ───────────────────────────────────────────── */
.alumno-perfil { max-width: 900px; }

.perfil-header {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.5rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.perfil-avatar {
  width: 68px; height: 68px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 900;
  flex-shrink: 0;
}

.perfil-info { flex: 1; min-width: 0; }

.perfil-nombre {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: .4rem;
}

.perfil-tags { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

.perfil-acciones {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: flex-start;
  flex-shrink: 0;
}

.btn-sm { padding: .45rem .9rem; font-size: .82rem; }

.perfil-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

/* ── Cards genéricas ─────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .85rem 1.1rem;
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.card-header svg { width: 16px; height: 16px; }

/* ── Data list ───────────────────────────────────────────────── */
.data-list { padding: .5rem 0; }

.data-item {
  display: flex;
  gap: 1rem;
  padding: .55rem 1.1rem;
  align-items: baseline;
}

.data-item:not(:last-child) { border-bottom: 1px solid #f1f5f9; }

.data-item dt {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  min-width: 120px;
  flex-shrink: 0;
}

.data-item dd { font-size: .9rem; color: var(--text); display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

/* ── Contactos ───────────────────────────────────────────────── */
.contactos-list { padding: .5rem 0; }

.contacto-item {
  display: flex;
  gap: .85rem;
  padding: .85rem 1.1rem;
  align-items: flex-start;
}

.contacto-item:not(:last-child) { border-bottom: 1px solid #f1f5f9; }

.contacto-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
}

.contacto-body { flex: 1; }

.contacto-top {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-bottom: .35rem;
  flex-wrap: wrap;
}

.contacto-parentesco { font-weight: 600; font-size: .9rem; color: var(--navy); }

.contacto-datos {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.contacto-tel {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .88rem;
  color: var(--text);
}

.contacto-tel svg { width: 14px; height: 14px; color: var(--text-muted); }

.contacto-tel.whatsapp { color: #15803d; font-weight: 500; }
.contacto-tel.whatsapp svg { fill: #25D366; stroke: none; width: 16px; height: 16px; }

/* Celular + WhatsApp lado a lado */
.contacto-tel-group {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .85rem;
  align-items: center;
}
a.contacto-tel       { text-decoration: none; }
a.contacto-tel:hover { color: var(--navy); }
a.contacto-tel:hover svg { color: var(--navy); }

/* ── Admin · Usuarios ───────────────────────────────────── */
.user-avatar-mini, .user-avatar-placeholder-mini {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
}
.user-avatar-mini { object-fit: cover; border: 1.5px solid var(--border); }
.user-avatar-placeholder-mini {
  background: var(--navy); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .82rem;
}
.users-table { font-size: .92rem; }
.users-table td { vertical-align: middle; }

.badge-rol-admin     { background: #fee2e2; color: #991b1b; }
.badge-rol-director  { background: #ede9fe; color: #5b21b6; }
.badge-rol-encargado { background: #dcfce7; color: #166534; }
.badge-rol-teacher   { background: #e0e7ff; color: #3730a3; }

.asignaciones-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .45rem;
}

/* ── Matriz de asignaciones (admin/usuarios) ─────────────── */
.matrix-card {
  padding: 0;
  overflow: hidden;
}

.matrix-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1.1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 60px;          /* debajo del header */
  z-index: 50;
  flex-wrap: wrap;
}
.matrix-toolbar-left  { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.matrix-toolbar-right { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.matrix-counter {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  padding: .15rem .6rem;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 700;
}
.matrix-counter.hidden { display: none; }

.matrix-search {
  height: 2.2rem;
  width: 220px;
  padding: 0 .65rem;
  font-size: .88rem;
}

.matrix-legenda {
  padding: .55rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  font-size: .8rem;
}

.matrix-content { padding: 1rem 1.1rem; }
.matrix-nivel + .matrix-nivel { margin-top: 1.25rem; }
.matrix-nivel.hidden { display: none; }

.matrix-nivel-titulo {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: .6rem;
}
.matrix-nivel-count { font-weight: 400; color: var(--text-muted); }

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: .65rem;
}

.matrix-card-item {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: .65rem .75rem;
  transition: border-color .12s, background .12s, transform .08s;
  position: relative;
}
.matrix-card-item.hidden { display: none; }

.matrix-card--responsable {
  border-color: #fbbf24;
  background: linear-gradient(180deg, #fffbeb 0%, var(--surface) 60%);
}
.matrix-card--apoyo {
  border-color: #818cf8;
  background: linear-gradient(180deg, #eef2ff 0%, var(--surface) 60%);
}

.matrix-card--modificado::before {
  content: '●';
  position: absolute;
  top: 4px; right: 8px;
  color: #f59e0b;
  font-size: .75rem;
  line-height: 1;
}

.matrix-card-head {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  margin-bottom: .55rem;
  flex-wrap: wrap;
}
.matrix-sigla { font-weight: 700; font-size: 1rem; color: var(--navy); }
.matrix-meta  { font-size: .76rem; color: var(--text-muted); }

.matrix-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem;
}
.matrix-btn {
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  padding: .35rem .25rem;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s;
  -webkit-tap-highlight-color: transparent;
}
.matrix-btn:hover { color: var(--text); }
.matrix-btn:active { transform: scale(.96); }

.matrix-btn--responsable[aria-pressed="true"] {
  background: #fbbf24;
  border-color: #f59e0b;
  color: #78350f;
}
.matrix-btn--apoyo[aria-pressed="true"] {
  background: #818cf8;
  border-color: #6366f1;
  color: #fff;
}

/* Estado guardando: overlay sutil + cursor wait + bloquea clicks */
.matrix-saving                 { position: relative; pointer-events: none; }
.matrix-saving::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,.55);
  z-index: 60;
  cursor: progress;
}
.matrix-saving .matrix-toolbar { z-index: 70; pointer-events: auto; }

/* Spinner pequeño para el botón */
.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  vertical-align: -2px;
  margin-right: .25rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .matrix-toolbar     { top: 56px; padding: .6rem .85rem; }
  .matrix-search      { width: 100%; }
  .matrix-toolbar-right { width: 100%; }
  .matrix-grid        { grid-template-columns: 1fr; }
}
.asignacion-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  padding: .45rem .65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .88rem;
}
.btn-quitar {
  background: transparent;
  border: 1px solid #fecaca;
  color: #dc2626;
  width: 22px; height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: .85rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.btn-quitar:hover { background: #fee2e2; }

.alert-warn {
  padding: .75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: .9rem;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
  font-weight: 600;
}
.alert-ok {
  padding: .75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: .9rem;
  background: var(--estado-p-bg);
  color: var(--estado-p);
  border: 1px solid var(--estado-p);
}

/* Banner de conflicto de licencia (alumno Presente) */
.alert-conflicto {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 8px;
  padding: .85rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.conflicto-texto    { font-size: .9rem; line-height: 1.5; }
.conflicto-acciones { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.field-hint {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .2rem;
}
.field-hint.hidden { display: none; }

/* ── Badge rol del curso (responsable/apoyo) ────────────── */
.rol-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .55rem;
  border-radius: 12px;
  font-size: .72rem;
  font-weight: 600;
  margin-top: .35rem;
  width: max-content;
}
.rol-badge--responsable { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.rol-badge--apoyo       { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }

/* ── Toggle curso / grupo + chips de contexto ───────────── */
.modo-toggle {
  display: inline-flex;
  gap: .25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .2rem;
  margin-bottom: 1rem;
}
.modo-btn {
  padding: .4rem .9rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}
.modo-btn.active { background: var(--surface); color: var(--navy); box-shadow: var(--shadow); }
.lista-grupo-nombre { font-size: .85rem; color: var(--text-muted); margin-left: .4rem; }

/* Subtítulo de categoría dentro de la agrupación por grado */
.grupo-cat-titulo {
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin: .2rem 0 .55rem .15rem;
}
/* Sigla de grupo (S2-N0): una sola línea, algo más compacta */
.asis-sigla--grupo { white-space: nowrap; font-size: 1.45rem; }
.lista-paralelo {
  display: inline-block;
  font-size: .68rem; font-weight: 700;
  color: #3730a3; background: #e0e7ff;
  border-radius: 6px; padding: 0 .35rem;
  margin-left: .35rem; vertical-align: middle;
}
.asis-card-nombre { font-size: .85rem; color: var(--text-muted); margin: .25rem 0; }

/* ── Tarjeta de datos de salud ──────────────────────────── */
.card-salud .card-header svg { color: var(--wine); }
.card-salud--alerta {
  border-left: 4px solid var(--wine);
  background: linear-gradient(90deg, #fff5f7 0%, var(--surface) 30%);
}
.badge-alerta {
  margin-left: auto;
  background: var(--wine);
  color: #fff;
  padding: .15rem .55rem;
  border-radius: 12px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge-sangre {
  display: inline-block;
  background: #fef2f2;
  color: #b91c1c;
  border: 1.5px solid #fca5a5;
  font-weight: 700;
  font-size: .95rem;
  padding: .25rem .65rem;
  border-radius: 8px;
  letter-spacing: .03em;
}
.data-item--block {
  flex-direction: column;
  align-items: flex-start;
  gap: .25rem;
}
.data-item--block dt { min-width: 0; }
.text-salud {
  color: var(--text);
  background: #fffbeb;
  border-left: 3px solid #fbbf24;
  padding: .55rem .8rem;
  border-radius: 4px;
  font-size: .9rem;
  line-height: 1.55;
  width: 100%;
}

/* ── Tags / chips helpers ────────────────────────────────────── */
.tag-neutral {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 9999px;
  font-size: .75rem;
  background: var(--bg);
  color: var(--text-muted);
}

.tag-success {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 9999px;
  font-size: .75rem;
  background: var(--estado-p-bg);
  color: var(--estado-p);
  font-weight: 600;
}

.text-muted { color: var(--text-muted); font-size: .85rem; }

/* ── Módulos link bar ────────────────────────────────────────── */
.perfil-modulos {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

.modulo-link {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .6rem 1.1rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: .88rem;
  font-weight: 500;
  color: var(--text-muted);
  box-shadow: var(--shadow);
  transition: border-color .12s, color .12s;
}

.modulo-link:hover { border-color: var(--navy); color: var(--navy); }

/* ── Misc ────────────────────────────────────────────────────── */
.badge-gestion { background: #f1f5f9; color: var(--text-muted); border: 1px solid var(--border); }

.page-title-sub {
  font-size: .9rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: .4rem;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  padding: 3rem 1rem;
  color: var(--text-muted);
  text-align: center;
}

.empty-state svg { width: 48px; height: 48px; opacity: .3; }

/* ── Responsive (tablet 768–1024) ───────────────────────────── */
/* ═══════════════════════════════════════════════════════════
   FASE 3 — ASISTENCIA
   ═══════════════════════════════════════════════════════════ */

/* ── Cabecera del día (index asistencia) ─────────────────── */
.asis-day-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.asis-date-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}

.asis-day-name { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.asis-day-num  { font-size: 2.2rem; font-weight: 900; line-height: 1; color: var(--navy); }
.asis-month    { font-size: .78rem; color: var(--text-muted); white-space: nowrap; }

.input-date {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .5rem .75rem;
  font-size: .9rem;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

.input-date:focus { outline: none; border-color: var(--navy); }

/* ── Selector de turno ───────────────────────────────────── */
.turno-toggle {
  display: flex;
  gap: .25rem;
  background: var(--bg);
  border-radius: 9999px;
  padding: .2rem;
  border: 1px solid var(--border);
}

.turno-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  padding: .4rem 1rem;
  border-radius: 9999px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.turno-btn svg { display: inline-block; width: 15px; height: 15px; }

.turno-btn.active {
  background: var(--navy);
  color: #fff;
}

.turno-toggle--sm .turno-btn { padding: .3rem .7rem; font-size: .8rem; }

/* Iconos inline en badges/spans (el reset global pone svg en display:block) */
.asis-status-badge { display: inline-flex; align-items: center; gap: .25rem; }
.asis-status-badge svg { display: inline-block; width: 12px; height: 12px; }
.badge-alerta { display: inline-flex; align-items: center; gap: .25rem; }
.badge-alerta svg { display: inline-block; width: 12px; height: 12px; color: #fff !important; }
.lic-meta svg { display: inline-block; width: 13px; height: 13px; }
/* El atributo hidden lo pisa .fields-row{display:grid}: forzar el ocultado */
.fields-row[hidden] { display: none !important; }

/* Navegación de fecha (día anterior / siguiente) */
.fecha-nav { display: inline-flex; align-items: center; gap: .35rem; }
.fecha-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 9999px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background .12s, color .12s;
}
.fecha-nav-btn:hover { background: var(--bg); color: var(--navy); }
.fecha-nav-btn svg { width: 20px; height: 20px; }
.fecha-nav-btn--off { opacity: .25; pointer-events: none; }

/* ── Grid de cursos (index asistencia) ───────────────────── */
.asis-cursos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: .5rem;
}

.asis-curso-card {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 1.1rem 1.1rem;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}

.asis-curso-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.asis-curso-card[data-href] { cursor: pointer; }
.asis-card-detalle {
  margin-left: auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px;
  color: var(--text-muted); text-decoration: none;
  border: 1px solid var(--border); background: var(--surface);
}
.asis-card-detalle:hover { color: var(--navy); border-color: var(--navy); background: var(--bg); }
.asis-card-detalle svg { width: 15px; height: 15px; }
.asis-card-hora { font-size: .7rem; color: var(--text-muted); }

/* estados de la card */
.asis-curso-card--completo   { border-color: var(--estado-p); }
.asis-curso-card--incompleto { border-color: var(--estado-r); }
.asis-curso-card--pendiente  { border-color: var(--border); }

.asis-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .4rem;
}
.asis-card-top .asis-sigla { min-width: 0; }
.asis-status-badge { flex-shrink: 0; }

.asis-sigla {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--navy);
}

.asis-status-badge {
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .5rem;
  border-radius: 9999px;
  white-space: nowrap;
}

.asis-status-completo   { background: var(--estado-p-bg); color: var(--estado-p); }
.asis-status-incompleto { background: var(--estado-r-bg); color: var(--estado-r); }
.asis-status-pendiente  { background: var(--bg);          color: var(--text-muted); }

.asis-card-estados { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; }

/* Fila de sesión (chip estado+conteo coloreado · hora al lado) */
.asis-card-sesion { display: flex; align-items: center; gap: .5rem; }
/* Uniforme: extra (no es estado de asistencia) → badge violeta distinto, inline tras los chips */
.asis-uni { display: inline-flex; align-items: center; gap: .15rem; margin-left: .35rem; font-size: .75rem; font-weight: 700; color: #7c3aed; }
.asis-uni svg { width: 16px; height: 16px; }

.mini-chip {
  padding: .2rem .45rem;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 700;
}

.mini-P { background: var(--estado-p-bg); color: var(--estado-p); }
.mini-R { background: var(--estado-r-bg); color: var(--estado-r); }
.mini-L { background: var(--estado-l-bg); color: var(--estado-l); }
.mini-F { background: var(--estado-f-bg); color: var(--estado-f); }

/* Fila de etiquetas (Responsable / Apoyo + uniforme) */
.asis-card-tags {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .5rem;
}
.asis-card-tags .rol-badge { margin-top: 0; }

/* Uniforme: camiseta + badge tipo notificación (violeta, distinto de F) */
.uni-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: #7c3aed;
  flex-shrink: 0;
  margin-right: .35rem;
}
.uni-badge svg { width: 22px; height: 22px; }
.uni-badge-count {
  position: absolute;
  top: -6px; right: -9px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: #7c3aed;
  color: #fff;
  border-radius: 8px;
  font-size: .68rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

/* ── Barra de acciones masivas (pre-llenar / limpiar) ───── */
.lista-acciones {
  display: flex;
  align-items: center;
  gap: .6rem 1rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .7rem 1rem;
  margin-bottom: .75rem;
}
.lista-acciones-form { display: inline-flex; }
.lista-acciones-hint {
  font-size: .82rem;
  color: var(--text-muted);
  flex: 1;
  min-width: 160px;
}

/* ── Etiqueta-enlace de licencia bajo el nombre ─────────── */
.lic-tag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-top: .2rem;
  padding: .12rem .5rem;
  background: var(--estado-l-bg);
  color: #0e7490;
  border: 1px solid #a5f3fc;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 500;
  text-decoration: none;
  max-width: 100%;
  width: max-content;
  transition: background .12s, border-color .12s;
}
.lic-tag:hover { background: #cffafe; border-color: #67e8f9; }
/* Variante PENDIENTE de aprobación (ámbar) */
.lic-tag--pend { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.lic-tag--pend:hover { background: #fde68a; border-color: #fcd34d; }

/* ── Popup de auditoría de celda (ASIS.verHistorial) ─────── */
.hcell-box { max-width: 460px; text-align: left; }
.hcell-sub { margin: -.4rem 0 .8rem; font-size: .82rem; color: var(--text-muted); }
.hcell-lista { display: flex; flex-direction: column; gap: .45rem; max-height: 46vh; overflow-y: auto; }
.hcell-ev {
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
  padding: .45rem .6rem; background: var(--bg); border-radius: 8px; font-size: .82rem;
}
.hcell-hora { font-weight: 700; color: var(--navy); min-width: 2.9rem; }
.hcell-acc { color: var(--text-muted); font-size: .74rem; }
.hcell-cambio { display: inline-flex; align-items: center; gap: .3rem; }
.hcell-flecha { opacity: .5; }
.hcell-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.3rem; height: 1.3rem; border-radius: 5px; font-size: .7rem; font-weight: 700; font-style: normal;
}
.hcell-P { background: var(--estado-p-bg); color: var(--estado-p); }
.hcell-R { background: var(--estado-r-bg); color: var(--estado-r); }
.hcell-L { background: var(--estado-l-bg); color: var(--estado-l); }
.hcell-F { background: var(--estado-f-bg); color: var(--estado-f); }
.hcell-nada { color: var(--text-muted); font-weight: 700; }
/* Evento de licencia: chip L clicable + mini-link con el número */
.hcell-cambio a { text-decoration: none; }
.hcell-cambio a .hcell-chip:hover { outline: 1.5px solid var(--estado-l); outline-offset: 1px; }
.hcell-licacc { font-weight: 700; color: var(--estado-l); text-decoration: underline; }
.hcell-quien { margin-left: auto; font-size: .76rem; color: var(--text); }
.hcell-obs { flex-basis: 100%; font-size: .76rem; color: var(--text-muted); font-style: italic; }
.hcell-vacio { font-size: .84rem; color: var(--text-muted); margin: .4rem 0; }
.det-cell .g-chip { cursor: pointer; }
.det-cell .g-chip:hover { outline: 1.5px solid var(--navy); outline-offset: 1px; }

/* Línea de chips bajo el nombre (paralelo de grupo + estado del Período 1-2):
   FUERA del span del nombre para que el truncado en tablet nunca los tape. */
.lista-meta { display: inline-flex; align-items: center; gap: .4rem; margin-top: .1rem; }
/* En tablet, achicar levemente el nombre para que se lea más completo */
@media (max-width: 1100px) {
  .lista-nombre { font-size: .88rem; }
}
/* Chip "1-2: X" (modo Período 3-4): estado del bloque anterior de la tarde */
.b1-chip {
  display: inline-block; padding: .08rem .5rem;
  border-radius: 10px; font-size: .7rem; font-weight: 700;
  white-space: nowrap;
}
.b1-F { background: var(--estado-f-bg); color: var(--estado-f); }
.b1-R { background: var(--estado-r-bg); color: var(--estado-r); }
.b1-P { background: transparent; color: var(--text-muted); font-weight: 600; padding: 0; }
.b1-n { background: transparent; color: var(--text-muted); font-weight: 600; padding: 0; }

/* Indicador de reincidencia (últimos 7 días) en la toma de lista */
.reinc { display: inline-flex; align-items: center; gap: .3rem; margin-top: .15rem; font-size: .72rem; color: var(--text-muted); }
.reinc-lbl { font-weight: 600; opacity: .7; }
.reinc-f { color: var(--estado-f); font-weight: 700; }
.reinc-r { color: var(--estado-r); font-weight: 700; }
.reinc-u { color: #7c3aed; font-weight: 700; }
.reinc--alta { background: var(--estado-f-bg); padding: .1rem .45rem; border-radius: 8px; }
.reinc[href] { text-decoration: none; cursor: pointer; }
.reinc[href]:hover { text-decoration: underline; }

/* ── Detalle del curso (grilla estudiantes × días) ───────── */
.det-bar { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; margin-bottom: 1rem; }
.det-nav { display: inline-flex; align-items: center; gap: .4rem; }
.det-rango { font-size: .9rem; font-weight: 600; color: var(--text); min-width: 130px; text-align: center; }
.det-leyenda { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; color: var(--text-muted); margin-left: auto; flex-wrap: wrap; }
/* Grilla congelada: la tabla es su propio viewport (scroll interno en ambos
   ejes); cabecera de fechas fija arriba y columna de nombres fija a la izquierda. */
.det-grid-wrap {
  overflow: auto;
  max-height: calc(100vh - 240px);
  min-height: 300px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.det-grid { border-collapse: collapse; font-size: .8rem; }
.det-grid th, .det-grid td { border: 1px solid var(--border); padding: .3rem .4rem; text-align: center; white-space: nowrap; }
.det-grid thead th {
  background: var(--bg); color: var(--navy); font-weight: 700;
  position: sticky; top: 0; z-index: 3;
  box-shadow: 0 1px 0 var(--border); /* el borde inferior no se pierde al scrollear */
}
.det-nom { text-align: left !important; position: sticky; left: 0; background: var(--surface); z-index: 2; min-width: 180px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.det-grid thead .det-nom { background: var(--bg); z-index: 4; } /* esquina: fija arriba Y a la izquierda */
.det-nro { display: inline-block; min-width: 1.4em; color: var(--text-muted); font-size: .7rem; margin-right: .35rem; }
.det-dia-nom { display: block; font-size: .72rem; }
.det-dia-num { display: block; font-size: .68rem; font-weight: 400; color: var(--text-muted); }
.det-dia-turnos { display: block; font-size: .58rem; font-weight: 400; color: var(--text-muted); letter-spacing: .08em; }
/* Día actual: azul franco para no confundirse con el gris de "Sin clases"
   (si hoy es sin clases, el gris gana por especificidad). */
.det-hoy { background: #dde7ff; }
.det-cell .g-chip { margin: 1px; }
/* Columnas de totales P/R/L/F (junto al nombre, siempre visibles al cargar) */
.det-tot, .det-tot-h { width: 2.4rem; min-width: 2.4rem; font-weight: 700; font-size: .74rem; }
.det-grid thead .det-tot-h { font-size: .72rem; line-height: 1.15; }
/* Total del curso bajo la letra, en la cabecera */
.det-th-n { display: block; font-size: .82rem; font-weight: 800; }
/* Meta bajo "Estudiante" (n° estudiantes · días) */
.det-nom-meta { display: block; font-size: .66rem; font-weight: 400; color: var(--text-muted); margin-top: .1rem; }
.det-tot-F { border-right: 2px solid var(--border); }   /* separador con el bloque de días */
.det-grid thead .det-tot-F { border-right: 2px solid var(--border); }
.det-tot-P, .det-grid thead .det-tot-P { color: var(--estado-p); background: var(--estado-p-bg); }
.det-tot-R, .det-grid thead .det-tot-R { color: var(--estado-r); background: var(--estado-r-bg); }
.det-tot-L, .det-grid thead .det-tot-L { color: var(--estado-l); background: var(--estado-l-bg); }
.det-tot-F, .det-grid thead .det-tot-F { color: var(--estado-f); background: var(--estado-f-bg); }
.g-chip { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; border-radius: 6px; font-weight: 700; font-size: .72rem; }
/* L de licencia PENDIENTE: mismo chip celeste + punto ámbar (como en la lista) */
.g-pend::after {
  content: ''; position: absolute; top: -3px; right: -3px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #f59e0b; border: 1.5px solid var(--surface);
}
/* L SUELTA en el Detalle: punto rojo (mismo lenguaje que la toma de lista) */
.g-suelta::after {
  content: ''; position: absolute; top: -3px; right: -3px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--estado-f); border: 1.5px solid var(--surface);
}
/* Celda con OBSERVACIÓN: triangulito en la esquina INFERIOR derecha
   (la superior la ocupan los puntos de pendiente/suelta) */
.g-obs::before {
  content: ''; position: absolute; bottom: 0; right: 0;
  border-style: solid; border-width: 0 0 7px 7px;
  border-color: transparent transparent #f59e0b transparent;
  border-bottom-right-radius: 5px;
}
/* ── Novedades del sistema (dashboard) ───────────────────── */
.nov-barra {
  display: flex; align-items: center; gap: .55rem; width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .55rem 1rem; margin-bottom: .8rem; cursor: pointer;
  font-size: .9rem; font-weight: 600; color: var(--navy); box-shadow: var(--shadow);
}
.nov-barra svg { width: 17px; height: 17px; flex-shrink: 0; }
.nov-barra .nov-chev { margin-left: auto; transition: transform .15s; }
.nov-barra--abierta .nov-chev { transform: rotate(180deg); }
.nov-barra:hover { border-color: var(--navy); }
.nov-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--navy); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem 1.2rem; margin-bottom: 1.4rem;
}
.nov-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .6rem; }
.nov-titulo { display: inline-flex; align-items: center; gap: .5rem; margin: 0; font-size: 1rem; color: var(--navy); }
.nov-titulo svg { width: 18px; height: 18px; }
.nov-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.nov-lista.nov-scroll { max-height: 330px; overflow-y: auto; padding-right: .35rem; }
.nov-item { display: flex; gap: .7rem; align-items: flex-start; }
.nov-item strong { font-size: .92rem; }
.nov-cuerpo { flex: 1; min-width: 0; }
.nov-fecha {
  flex-shrink: 0; font-size: .72rem; font-weight: 700; color: var(--navy);
  background: var(--bg); padding: .1rem .45rem; border-radius: 8px; margin-top: .1rem;
}
.nov-detalle { margin: .15rem 0 0; font-size: .82rem; color: var(--text-muted); }
/* Contador "N sin leer" y atajo "Marcar todas" */
.nov-cont {
  font-size: .7rem; font-weight: 700; color: #92400e; background: #fef3c7;
  padding: .1rem .5rem; border-radius: 10px; vertical-align: 2px;
}
.nov-todas {
  background: none; border: none; cursor: pointer;
  font-size: .78rem; color: var(--text-muted); text-decoration: underline; padding: .2rem;
}
.nov-todas:hover { color: var(--navy); }
/* Check individual: círculo vacío → check verde; el ítem leído se atenúa */
.nov-check {
  flex-shrink: 0; background: none; border: none; cursor: pointer;
  padding: .15rem; color: var(--text-muted); margin-top: .05rem;
}
.nov-check svg { width: 20px; height: 20px; display: inline-block; }
.nov-check .nov-ico-check { display: none; }
.nov-item--leida .nov-check .nov-ico-circulo { display: none; }
.nov-item--leida .nov-check .nov-ico-check { display: inline-block; color: var(--estado-p); }
.nov-item--leida .nov-cuerpo, .nov-item--leida .nov-fecha { opacity: .55; }
.nov-check:hover { color: var(--navy); }

/* ── ABM Calendario (días sin clases) ────────────────────── */
.cal-form {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem 1.2rem; margin-bottom: 1.4rem;
}
.cal-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; }
.cal-field-motivo { grid-column: 1 / -1; }
.cal-check { display: flex; align-items: center; gap: .5rem; margin-top: .8rem; font-size: .86rem; color: var(--text); }
.cal-check--inline { margin-top: .45rem; }
/* Fechas en palabras (anti día/mes invertido) */
.cal-fechas-preview { margin: .5rem 0 0; font-weight: 600; }
.cal-fechas-preview[hidden] { display: none !important; }
/* Selección múltiple de cursos (por nivel / grado / sueltos) */
.cal-cursos {
  margin-top: .7rem; padding: .65rem .8rem; border: 1px solid #e3e6ec;
  border-radius: 10px; background: #f8f9fb;
  display: flex; flex-direction: column; gap: .6rem;
}
.cal-cursos[hidden] { display: none !important; }
.cal-cursos-nivel-t { font-weight: 700; font-size: .85rem; display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; }
.cal-cursos-grados { display: flex; flex-wrap: wrap; gap: .4rem .6rem; margin: .35rem 0 0 1.5rem; }
.cal-cursos-grado {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .2rem .55rem; background: #fff; border: 1px solid #e3e6ec; border-radius: 8px;
  font-size: .84rem;
}
.cal-cursos-grado-t { font-weight: 600; display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; }
.cal-curso-chip { display: inline-flex; align-items: center; gap: .25rem; cursor: pointer; }
.field-hint-inline { font-weight: 400; color: var(--text-muted); font-size: .78rem; }
.cal-lista { display: flex; flex-direction: column; gap: .55rem; }
.cal-item {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: .6rem .9rem;
}
.cal-item--pasado { opacity: .65; }
.cal-item-info { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; font-size: .9rem; }
.cal-tag { background: #eceef2; color: var(--text-muted); font-size: .72rem; font-weight: 700; padding: .08rem .5rem; border-radius: 10px; }
.cal-tag--curso { background: var(--estado-l-bg); color: var(--estado-l); }
.cal-motivo { color: var(--text-muted); font-size: .85rem; }

/* ── Días NO LECTIVOS ────────────────────────────────────── */
/* Columna sombreada en el Detalle (cabecera y celdas) */
.det-grid th.det-nolec, .det-grid td.det-nolec { background: #eceef2; color: var(--text-muted); }
.det-grid th.det-nolec { color: var(--text-muted); }
/* Sugerencia de corrección en "L sin licencia" (Por aprobar) */
.suelta-sugerencia {
  margin-top: .3rem; font-size: .78rem; color: var(--text-muted);
  padding: .15rem .55rem; border-radius: 8px; background: var(--bg); width: max-content; max-width: 100%;
}
.suelta-sugerencia--turno   { background: var(--estado-l-bg); color: var(--estado-l); font-weight: 600; }
.suelta-sugerencia--ampliar { background: #fef3c7; color: #92400e; font-weight: 600; }

/* Columna # del listado de licencias: mínima, sin robar ancho en tablet */
.td-id { font-size: .72rem; color: var(--text-muted); padding-left: .3rem !important; padding-right: .3rem !important; white-space: nowrap; }

/* Badge rojo del botón "Por aprobar": L sueltas sin licencia */
.badge-count--rojo { background: var(--estado-f); color: #fff; }

/* Chip de leyenda "✕ Sin clases" */
.g-nolec-lgd { background: #eceef2; color: var(--text-muted); }
/* Turno individual sin clases (SOLO caso parcial: solo mañana o solo tarde).
   Mismo color que el fondo de columna: se lee como sombreado, no como chip.
   En día completo NO se aplica (la columna entera ya está gris, como 1.4.63). */
.g-chip.g-nolec { background: #eceef2; color: var(--text-muted); }
/* Línea de motivos (chips que fluyen; no generan filas) */
.det-nolec-chips {
  display: flex; align-items: baseline; gap: .35rem .5rem; flex-wrap: wrap;
  margin: -.4rem 0 .9rem; font-size: .78rem;
}
.det-nolec-lbl { color: var(--text-muted); font-weight: 600; }
.det-nolec-chip {
  background: #eceef2; color: var(--text-muted);
  padding: .1rem .6rem; border-radius: 12px; white-space: nowrap;
}
/* Fila propia del filtro de turno (bajo el toggle de tiempo) */
.det-bar--turno { margin: -.4rem 0 1rem; }
/* Leyenda: "✕ Sin clases: N" abre el popup con el detalle por día */
.det-leyenda-nolec {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: inherit; display: inline-flex; align-items: center; gap: .35rem;
}
.det-leyenda-nolec:hover { color: var(--text); text-decoration: underline; }
.nolec-modal-lista { max-height: 50vh; overflow-y: auto; margin: .4rem 0 1rem; text-align: left; }
.nolec-modal-row {
  display: flex; gap: .6rem; padding: .4rem .1rem;
  border-bottom: 1px solid #e8eaef; font-size: .85rem;
}
.nolec-modal-row:last-child { border-bottom: 0; }
.nolec-modal-fecha { font-weight: 600; white-space: nowrap; min-width: 7.5rem; color: var(--text-muted); }
/* Día sin clases: tap muestra el motivo */
th.det-nolec, .det-nolec-mini { cursor: pointer; }
/* Entrega de intransferibles (Disciplina) — fila compacta por estudiante */
.ent-tabla { display: flex; flex-direction: column; }
.ent-row {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem .4rem; border-bottom: 1px solid #eceef2;
}
.ent-row--ok { background: #f4faf6; }
.ent-nom { flex: 1; min-width: 0; font-size: .9rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.ent-lic {
  font-size: .72rem; font-weight: 600; color: #2a6fbb;
  background: #e7f1fb; padding: .05rem .45rem; border-radius: 10px; white-space: nowrap;
}
/* Línea extra del popup de historial: registrar licencia de una L suelta */
.hcell-extra { font-size: .8rem; margin: .55rem 0 0; color: #8c2f39; text-align: left; }
.hcell-extra a { font-weight: 700; }
.hcell-extra-hint { color: var(--text-muted); font-size: .72rem; }
/* Observación tipeada sobre fila SIN estado: retenida sin guardar */
.lista-obs-input--pend { border-color: #b3372f !important; background: #fdf1f0; }
.obs-pend-msg { color: #8c2f39; font-size: .72rem; font-weight: 600; margin-top: .2rem; }
/* Sigla del paralelo en la vista por grupo (mezcla cursos) */
.ent-curso {
  font-size: .7rem; font-weight: 700; color: var(--text-muted);
  background: #eef0f4; padding: .05rem .4rem; border-radius: 8px;
}
.ent-estado { font-size: .76rem; color: var(--text-muted); white-space: nowrap; }
.ent-row--ok .ent-estado { color: #3d7a55; font-weight: 600; }
/* Totales del evento (control físico) */
.ent-totales { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0 0 .8rem; }
.ent-tot {
  font-size: .82rem; color: var(--text-muted);
  background: #f1f3f6; padding: .25rem .7rem; border-radius: 14px;
}
.ent-tot b { font-size: .95rem; }
.ent-tot--ok   { background: #e6f4ea; color: #2f6b46; }
.ent-tot--pend { background: #fdeaea; color: #8c2f39; }
/* Tarjeta de curso seleccionada */
.ent-card--sel { outline: 2px solid var(--navy, #2a3063); outline-offset: 1px; }
/* La observación reusa .lista-obs-wrap/.lista-obs-input de la toma de lista */
.ent-item { border-bottom: 1px solid #eceef2; }
.ent-item .ent-row { border-bottom: 0; }
.ent-item .lista-obs-wrap { padding: 0 .4rem .45rem; }
.ent-item .lista-obs-wrap[hidden] { display: none !important; }
/* Banner en la toma de lista */
.alert-nolectivo {
  padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem;
  font-size: .9rem; font-weight: 600;
  background: #eceef2; color: var(--text-muted); border: 1px solid var(--border);
}

/* Fechas de cabecera del Detalle: links discretos a la toma de lista del día */
.det-dia-link { color: inherit; text-decoration: none; display: inline-block; }
.det-dia-link:hover { text-decoration: underline; color: var(--navy); }
/* Columna U (sin uniforme) en los totales del Detalle */
.det-tot-U, .det-grid thead .det-tot-U { color: #7c3aed; background: #ede9fe; }
/* Observación actual en el popup de historial (va PRIMERA: es lo que buscan) */
.hcell-obsact {
  margin: 0 0 .6rem; padding: .45rem .6rem; border-radius: 8px;
  background: #fef3c7; color: #92400e; font-size: .8rem;
}
/* Modal de confirmación con acción recomendada (Editar/Registrar licencia):
   se apila en columna — recomendada arriba (primaria), la otra salida
   secundaria, Cancelar al final. Sin alt: fila de 2 como siempre. */
.btn-outline {
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--navy); color: var(--navy); }
.modal-actions #confirmModalCancel { order: 1; }
.modal-actions #confirmModalOk     { order: 2; }
.modal-actions--stack { flex-direction: column; }
.modal-actions--stack .btn { width: 100%; justify-content: center; }
.modal-actions--stack #confirmModalAlt    { order: 1; }
.modal-actions--stack #confirmModalOk     { order: 2; }
.modal-actions--stack #confirmModalCancel { order: 3; }
#confirmModalAlt[hidden] { display: none !important; }
.g-P { background: var(--estado-p-bg); color: var(--estado-p); }
.g-R { background: var(--estado-r-bg); color: var(--estado-r); }
.g-L { background: var(--estado-l-bg); color: var(--estado-l); }
.g-F { background: var(--estado-f-bg); color: var(--estado-f); }
.g-n { background: transparent; color: #cbd5e1; }
.lic-tag svg { width: 14px; height: 14px; flex-shrink: 0; }
.lic-tag-ext { opacity: .6; }
.lic-tag-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Fila "sin marcar" (no registrada todavía) ──────────── */
.lista-row { position: relative; }
.lista-row--sinmarcar::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #f59e0b;
  opacity: .55;
}
.lista-row--sinmarcar .lista-nombre { color: var(--text); }

.asis-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .78rem;
  color: var(--text-muted);
}

/* ── Barra sticky de la lista ────────────────────────────── */
.lista-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .85rem 1.1rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  position: sticky;
  top: 60px; /* altura del app-header */
  z-index: 50;
  transition: box-shadow .15s;
}

.lista-header.sticky-active {
  border-radius: 0;
  border-left: none;
  border-right: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  margin-left: -1.25rem;
  margin-right: -1.25rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.lista-header-left {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex: 1;
  min-width: 0;
}

.lista-sigla {
  font-size: 1.3rem;
  font-weight: 900;
  flex-shrink: 0;
}

.nivel-color--primaria   { color: var(--green-dk); }
.nivel-color--secundaria { color: var(--navy); }
.nivel-color--otro       { color: var(--text-muted); }

.lista-info {
  font-size: .82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-pasado {
  background: var(--estado-r-bg);
  color: var(--estado-r);
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .5rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

/* ── Contador de estados ─────────────────────────────────── */
.lista-conteo {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
}

.conteo-chip {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  padding: .3rem .6rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 700;
}

.conteo-P { background: var(--estado-p-bg); color: var(--estado-p); }
.conteo-R { background: var(--estado-r-bg); color: var(--estado-r); }
.conteo-L { background: var(--estado-l-bg); color: var(--estado-l); }
.conteo-F { background: var(--estado-f-bg); color: var(--estado-f); }

.conteo-total { font-size: .8rem; color: var(--text-muted); padding-left: .25rem; }

.lista-header-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-shrink: 0;
}

/* ── Indicador de sincronización ─────────────────────────── */
.sync-indicator {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .8rem;
  color: var(--text-muted);
  padding: .3rem .7rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  transition: background .15s, color .15s;
}

.sync-icon { width: 14px; height: 14px; }

.sync-saving { color: var(--estado-r); border-color: var(--estado-r-bg); background: var(--estado-r-bg); }
.sync-saved  { color: var(--estado-p); border-color: var(--estado-p-bg); background: var(--estado-p-bg); }
.sync-error  { color: var(--estado-f); border-color: var(--estado-f-bg); background: var(--estado-f-bg); }

/* ── Lista de alumnos — el núcleo de la app ──────────────── */
.lista-alumnos {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.lista-row {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
  min-height: 60px; /* Touch target generoso */
}

/* Desktop: el wrapper es transparente (sus hijos toman flex de .lista-row) */
.lista-row-top {
  display: contents;
}
.row-sync--mobile { display: none; } /* solo aparece en móvil */

/* ── Extras: botones uniforme + observación ─────────────── */
.lista-extras {
  display: flex;
  gap: .3rem;
  align-items: center;
  flex-shrink: 0;
}

/* Mismo lenguaje visual que .btn-estado pero un poco más chico */
.btn-extra {
  width: 40px;
  height: 48px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .12s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  padding: 0;
}
.btn-extra:active { transform: scale(.93); }
.btn-extra:hover  { border-color: var(--text-muted); color: var(--text); }

/* Iconos dentro de los botones extra */
.btn-extra svg { width: 22px; height: 22px; }

/* Sin uniforme: violeta (distinto del rojo de Falta) */
.btn-uniforme.active {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}
.btn-uniforme.active:hover { background: #6d28d9; border-color: #6d28d9; }

/* Observación con contenido: amarillo */
.btn-obs.has-obs {
  background: #fef9c3;
  border-color: #facc15;
  color: #92400e;
}

/* ── Input de observación inline ─────────────────────────── */
.lista-obs-wrap {
  width: 100%;
  flex-basis: 100%;
  margin-top: .5rem;
}
.lista-obs-wrap[hidden] { display: none; }

.lista-obs-input {
  width: 100%;
  padding: .55rem .85rem;
  border: 1.5px solid #fde68a;
  border-radius: 8px;
  font-size: .92rem;
  font-family: inherit;
  background: #fffbeb;     /* amarillo suave tipo sticky note */
  color: var(--text);
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.lista-obs-input:focus {
  outline: none;
  background: #fff;
  border-color: var(--navy-lt);
  box-shadow: 0 0 0 3px rgba(61,68,128,.12);
}
.lista-obs-input:disabled {
  /* Modo label: no se ve "deshabilitado" feo */
  cursor: pointer;
  opacity: 1;
  color: var(--text);
}
.lista-obs-input:disabled:hover {
  border-color: #facc15;
  background: #fef9c3;
}

/* Fila puede envolver para que el input caiga debajo */
.lista-row { flex-wrap: wrap; }

/* Contador de uniforme en el header */
.conteo-U { background: #ede9fe; color: #6d28d9; display: inline-flex; align-items: center; gap: .2rem; }
.conteo-shirt { width: 15px; height: 15px; }

/* ── Modal de confirmación (tablet-first) ───────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 1000;
  opacity: 0;
  transition: opacity .18s ease;
}
/* Cuando tiene el atributo hidden NO debe ocupar la pantalla */
.modal-overlay[hidden] { display: none !important; }
.modal-overlay.show { opacity: 1; }
.modal-box {
  background: var(--surface);
  border-radius: 16px;
  padding: 1.75rem 1.5rem 1.25rem;
  width: 100%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  transform: translateY(8px) scale(.98);
  transition: transform .18s ease;
}
.modal-overlay.show .modal-box { transform: translateY(0) scale(1); }
.modal-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
}
.modal-icon svg { width: 28px; height: 28px; }
.modal-icon--danger  { background: var(--estado-f-bg); color: var(--estado-f); }
.modal-icon--primary { background: #eef2ff; color: var(--navy); }
.modal-title { font-size: 1.2rem; font-weight: 700; color: var(--text); margin-bottom: .4rem; }
.modal-text  { font-size: .95rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 1.4rem; }
.modal-actions {
  display: flex;
  gap: .6rem;
}
.modal-actions .btn { flex: 1; justify-content: center; }
@media (max-width: 480px) {
  .modal-actions { flex-direction: column-reverse; }
}

/* ── Licencias: política, acciones, pendientes ──────────── */
.politica-nota {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem .85rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
}
.politica-nota--ok   { background: var(--estado-p-bg); color: #166534; border: 1px solid #86efac; }
.politica-nota--pend { background: #fef9c3;            color: #92400e; border: 1px solid #fde68a; }
.politica-nota--wait { background: var(--bg);          color: var(--text-muted); border: 1px solid var(--border); }
.politica-ico { font-size: 1.1rem; }

.lic-acciones {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.lic-estado-razon {
  display: block;
  width: 100%;
  font-size: .82rem;
  font-weight: 400;
  opacity: .85;
  margin-top: .15rem;
}

.lic-card-pend {
  display: flex;
  align-items: stretch;
  gap: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid #facc15;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .85rem 1rem;
  margin-bottom: .65rem;
}
.lic-card-pend-info { flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.lic-card-pend-actions {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  justify-content: center;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .lic-card-pend { flex-direction: column; }
  .lic-card-pend-actions { flex-direction: row; }
}

.lista-row:last-child { border-bottom: none; }

.lista-row--marcado {
  background: #fefce8; /* toque sutil para filas no-P */
}

.lista-row:active { background: #f8fafc; }

.lista-nro {
  min-width: 28px;
  text-align: right;
  font-size: .8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.lista-alumno-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.lista-nombre {
  font-size: .95rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.lista-obs {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Botones de estado P/R/L/F ───────────────────────────── */
.lista-estados-btns {
  display: flex;
  gap: .3rem;
  flex-shrink: 0;
}

.btn-estado {
  width:  48px;
  height: 48px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: .95rem;
  font-weight: 800;
  cursor: pointer;
  transition: background .1s, border-color .1s, color .1s, transform .08s;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-estado:active { transform: scale(.93); }

/* Estado activo con colores */
.btn-estado-P.active {
  background: var(--estado-p);
  border-color: var(--estado-p);
  color: #fff;
}
.btn-estado-R.active {
  background: var(--estado-r);
  border-color: var(--estado-r);
  color: #fff;
}
.btn-estado-L.active {
  background: var(--estado-l);
  border-color: var(--estado-l);
  color: #fff;
}
.btn-estado-F.active {
  background: var(--estado-f);
  border-color: var(--estado-f);
  color: #fff;
}

/* Hover (sutil, para desktop) */
.btn-estado-P:hover:not(.active) { border-color: var(--estado-p); color: var(--estado-p); }
.btn-estado-R:hover:not(.active) { border-color: var(--estado-r); color: var(--estado-r); }
.btn-estado-L:hover:not(.active) { border-color: var(--estado-l); color: var(--estado-l); }
.btn-estado-F:hover:not(.active) { border-color: var(--estado-f); color: var(--estado-f); }

/* Puntito de alerta en el botón L cuando hay licencia pendiente de aprobación */
.btn-estado--alerta { position: relative; }
.btn-alerta-dot {
  position: absolute;
  top: -4px; right: -4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #f59e0b;
  border: 2px solid var(--surface);
}
/* Licencia APROBADA (aún no aplicada): punto verde en el botón L */
.btn-aprob-dot {
  position: absolute;
  top: -4px; right: -4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--estado-p);
  border: 2px solid var(--surface);
}
/* L SUELTA (sin licencia registrada que la respalde): punto rojo */
.btn-suelta-dot {
  position: absolute;
  top: -4px; right: -4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--estado-f);
  border: 2px solid var(--surface);
}
/* Badge en la sección "L sin licencia" de /licencias/pendientes */
.suelta-badge {
  display: inline-block; margin-left: .45rem; padding: .05rem .5rem;
  background: var(--estado-f-bg); color: var(--estado-f);
  border: 1px solid #fca5a5; border-radius: 10px;
  font-size: .72rem; font-weight: 700; vertical-align: 2px;
}

/* Indicador de guardado por fila */
.row-sync {
  font-size: .75rem;
  color: var(--text-muted);
  min-width: 16px;
  text-align: center;
  flex-shrink: 0;
}

/* ── Historial — resumen anual ───────────────────────────── */
.historial-resumen {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.hres-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .9rem 1.25rem;
  border-radius: var(--radius);
  flex: 1;
  min-width: 80px;
}

.hres-num  { font-size: 1.8rem; font-weight: 900; line-height: 1; }
.hres-lbl  { font-size: .75rem; margin-top: .2rem; font-weight: 600; opacity: .8; }

.hres-P { background: var(--estado-p-bg); color: var(--estado-p); }
.hres-R { background: var(--estado-r-bg); color: var(--estado-r); }
.hres-L { background: var(--estado-l-bg); color: var(--estado-l); }
.hres-F { background: var(--estado-f-bg); color: var(--estado-f); }

/* ── Navegación de mes ───────────────────────────────────── */
.mes-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.mes-titulo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
}

/* ── Calendario ─────────────────────────────────────────── */
.cal-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  overflow-x: auto;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .3rem;
  min-width: 500px;
}

.cal-head {
  text-align: center;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  padding: .4rem 0;
}

.cal-day {
  min-height: 60px;
  border-radius: 8px;
  padding: .35rem .4rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  border: 1px solid transparent;
}

.cal-day--hoy    { border-color: var(--navy); background: #eef0ff; }
.cal-day--futuro { opacity: .35; }
.cal-day--finsem { background: var(--bg); }
.cal-empty       { min-height: 60px; }

.cal-num {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1;
}

.cal-day--hoy .cal-num { color: var(--navy); font-weight: 900; }

.cal-estados { display: flex; gap: .2rem; flex-wrap: wrap; }

.cal-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 22px;
  border-radius: 5px;
  font-size: .72rem;
  font-weight: 700;
}

.cal-chip-P { background: var(--estado-p-bg); color: var(--estado-p); }
.cal-chip-R { background: var(--estado-r-bg); color: var(--estado-r); }
.cal-chip-L { background: var(--estado-l-bg); color: var(--estado-l); }
.cal-chip-F { background: var(--estado-f-bg); color: var(--estado-f); }

.cal-sin-reg { font-size: .75rem; color: #cbd5e1; }

.cal-leyenda {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

/* ── Page-wrap full width para la lista ──────────────────── */
.page-wrap--full { max-width: 100%; }

/* ══════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .header-inner { padding: 0 1rem; }
  .app-main { padding: 1rem; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .cursos-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .perfil-body { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════
   MÓVIL (≤ 640px) — Refactor completo
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* Prevenir scroll horizontal global */
  html, body { overflow-x: hidden; }

  /* ── Header: nav horizontal scrollable con solo iconos ── */
  .header-inner {
    padding: 0 .75rem;
    gap: .5rem;
    height: 56px;
  }
  .header-title { font-size: 1rem; }
  .header-title .header-subtitle { display: none; }
  .header-logo { width: 30px; height: 30px; }

  .header-nav {
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Indicador sutil de scroll: degradado al borde */
    mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  }
  .header-nav::-webkit-scrollbar { display: none; }

  .nav-link {
    padding: .4rem .55rem;
    font-size: .78rem;
    flex-direction: column;
    gap: .15rem;
    flex-shrink: 0;
    min-width: 56px;
    text-align: center;
    line-height: 1;
  }
  .nav-link svg { width: 18px; height: 18px; }

  .user-name { display: none; }
  .user-avatar, .user-avatar-placeholder { width: 28px; height: 28px; }

  /* ── Layout general ─────────────────────────────────────── */
  .app-main      { padding: .75rem; }
  .card-grid     { grid-template-columns: 1fr; }
  .page-header   { flex-direction: column; align-items: stretch; }
  .perfil-header { flex-direction: column; }
  .perfil-acciones { width: 100%; }
  .data-item dt  { min-width: 90px; }

  /* ── Cursos: 1 columna en móvil, 2 en móvil mediano ──── */
  .cursos-grid      { grid-template-columns: 1fr; gap: .6rem; }
  .asis-cursos-grid { grid-template-columns: 1fr; gap: .6rem; }
  .curso-card       { padding: .9rem; }

  /* ── Tabla de alumnos → tarjetas apiladas ──────────────── */
  .alumnos-table-wrap { border: none; box-shadow: none; background: transparent; }
  .alumnos-table,
  .alumnos-table thead,
  .alumnos-table tbody,
  .alumnos-table tr,
  .alumnos-table th,
  .alumnos-table td { display: block; }
  .alumnos-table thead { display: none; } /* ocultamos cabecera */
  .alumnos-table tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: .5rem;
    padding: .65rem .85rem;
  }
  .alumnos-table td {
    border: none;
    padding: .15rem 0;
  }
  .alumnos-table td:first-child { display: none; } /* ocultamos nro */
  .alumno-link { gap: .6rem; }
  .alumnos-table .genero-chip { font-size: .7rem; }

  /* ── Pasar lista: stack vertical (nombre arriba, botones abajo) ── */
  .lista-row {
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
    padding: .7rem .85rem;
    min-height: 0;
  }
  .lista-row-top {
    display: flex !important;
    align-items: center;
    gap: .6rem;
    width: 100%;
  }
  .lista-nro      { min-width: 24px; }
  .lista-alumno-info { flex: 1; min-width: 0; }
  .lista-nombre   { white-space: normal; font-size: .92rem; line-height: 1.25; }
  .lista-estados-btns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .4rem;
    width: 100%;
  }
  .btn-estado     { width: 100%; height: 44px; font-size: .95rem; }
  .row-sync       { display: none; }            /* el sync de la derecha desktop se oculta */
  .row-sync--mobile { display: inline; font-size: 1.1rem; color: var(--text-muted); }

  /* Extras: en su propia fila debajo de los botones de estado */
  .lista-extras {
    width: 100%;
    justify-content: flex-end;
  }
  .btn-uniforme, .btn-obs-toggle { width: 40px; height: 40px; }

  /* ── Resto ──────────────────────────────────────────────── */
  .lista-conteo  { gap: .2rem; }
  .conteo-chip   { padding: .25rem .4rem; font-size: .78rem; }
  .lista-header  { gap: .5rem; padding: .65rem .75rem; flex-wrap: wrap; }
  .hres-chip     { padding: .7rem .9rem; }
  .hres-num      { font-size: 1.4rem; }
  .page-title    { font-size: 1.25rem; }
  .page-wrap     { padding-inline: 0; }
}

/* Móvil muy pequeño */
@media (max-width: 360px) {
  .nav-link    { min-width: 50px; padding: .35rem .35rem; font-size: .72rem; }
  .nav-link svg{ width: 16px; height: 16px; }
  .btn-estado  { height: 40px; font-size: .9rem; }
}

/* ============================================================
   Fase 4 — Licencias
   ============================================================ */

/* ── Página genérica: cabecera + filtros ─────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.page-title    { font-size: 1.5rem; font-weight: 700; color: var(--navy); }
.page-subtitle { font-size: .9rem; color: var(--text-muted); margin-top: .15rem; }
.header-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Ancho estrecho para formularios y detalle ───────────── */
.page-wrap--narrow { max-width: 720px; margin-inline: auto; }

/* ── Barra de filtros ────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: .6rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  background: var(--surface);
  padding: .75rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.input-select {
  height: 2.4rem;
  padding: 0 .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  cursor: pointer;
}

/* ── Botones ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary   { background: var(--navy); color: #fff; }
.btn-primary:hover  { background: var(--navy-dk); }
.btn-secondary { background: var(--green); color: #fff; }
.btn-secondary:hover { background: var(--green-dk); }
.btn-ghost     { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-lg        { padding: .7rem 1.4rem; font-size: 1rem; }
.btn-sm        { padding: .35rem .75rem; font-size: .82rem; }
.btn-wa        { background: #25d366; color: #fff; }
.btn-wa:hover  { background: #1da851; }
.btn-wa svg    { width: 20px; height: 20px; fill: currentColor; stroke: none; }

/* ── Badges ──────────────────────────────────────────────── */
.badge       { display: inline-block; padding: .2rem .6rem; border-radius: 20px; font-size: .78rem; font-weight: 600; }
.badge-ok    { background: var(--estado-p-bg); color: var(--estado-p); }
.badge-warn  { background: var(--estado-r-bg); color: var(--estado-r); }
.badge-error { background: var(--estado-f-bg); color: var(--estado-f); }

/* ── Lista de licencias ──────────────────────────────────── */
.lic-list { display: flex; flex-direction: column; gap: .6rem; }

.lic-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  border-left: 4px solid var(--border);
  transition: box-shadow .15s, border-color .15s;
}
.lic-card:hover { box-shadow: var(--shadow-md); border-left-color: var(--navy-lt); }

.lic-card-left  { flex-shrink: 0; }
.lic-medio-icon {
  width: 38px; height: 38px;
  border-radius: 9px;
  background: var(--bg);
  color: var(--navy);
  display: flex; align-items: center; justify-content: center;
}
.lic-medio-icon svg { width: 20px; height: 20px; }

/* Licencia mayor a 3 días: borde + número de días destacado */
.lic-card--larga { border-left: 4px solid #d97706; }
.lic-dias--larga {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: .05rem .5rem;
  font-weight: 700;
}
.lic-card-body  { flex: 1; min-width: 0; }
.lic-card-right { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; }

.lic-alumno  { font-weight: 600; font-size: 1rem; color: var(--text); }
.lic-meta    { display: flex; flex-wrap: wrap; gap: .25rem .5rem; font-size: .82rem; color: var(--text-muted); margin-top: .2rem; }
.lic-sep     { color: var(--border); }
.lic-motivo  { font-size: .82rem; color: var(--text-muted); margin-top: .25rem; font-style: italic; }
.lic-wa-indicator { font-size: .9rem; }
.lic-count   { font-size: .82rem; color: var(--text-muted); }

/* Check de filtro (vigentes hoy) */
.filter-check {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
}
.filter-check input { width: 16px; height: 16px; cursor: pointer; }

/* Footer de la lista de licencias + paginación */
.lic-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: .85rem;
}
.pager { display: inline-flex; align-items: center; gap: .5rem; }
.pager-info { font-size: .82rem; color: var(--text-muted); }
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem; height: 2rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: background .12s, color .12s;
}
.pager-btn:hover { background: var(--bg); color: var(--navy); }
.pager-btn svg { width: 18px; height: 18px; }
.pager-btn--off { opacity: .35; pointer-events: none; }
.pager-btn[disabled] { opacity: .35; pointer-events: none; }

/* ── Selector de trimestre ───────────────────────────────── */
.trim-bar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; align-items: center; }
.trim-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .8rem; border: 1px solid var(--border); border-radius: 9999px;
  font-size: .85rem; font-weight: 600; color: var(--text-muted);
  background: var(--surface); text-decoration: none; white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.trim-chip:hover { border-color: var(--navy); color: var(--navy); }
.trim-chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.trim-rango { font-size: .72rem; font-weight: 400; opacity: .85; }
.trim-hoy {
  font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: var(--estado-p-bg); color: var(--estado-p); padding: .05rem .35rem; border-radius: 6px;
}
.trim-chip.active .trim-hoy { background: rgba(255,255,255,.25); color: #fff; }
.trim-empty { font-size: .85rem; color: var(--text-muted); }

/* ── Tabla de licencias (client-side) ────────────────────── */
.lic-tabla-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.lic-tabla { width: 100%; border-collapse: collapse; font-size: .85rem; }
.lic-tabla thead th {
  text-align: left; font-weight: 700; color: var(--navy);
  padding: .6rem .75rem; white-space: nowrap; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.lic-tabla th.th-sort { cursor: pointer; user-select: none; }
.lic-tabla th.th-sort:hover { color: var(--wine); }
.lic-tabla td { padding: .55rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.lic-tabla tbody tr:last-child td { border-bottom: none; }
.lic-tabla tbody tr[data-href] { cursor: pointer; }
.lic-tabla tbody tr:hover { background: var(--bg); }
.lic-tabla .ta-c { text-align: center; }
.lic-tabla .td-muted { color: var(--text-muted); }
.lic-tabla-vacia { text-align: center; color: var(--text-muted); padding: 1.5rem !important; }
.medio-ic { display: inline-block; width: 18px; height: 18px; color: var(--text-muted); vertical-align: -3px; }
.trim-badge  { font-size: .72rem; font-weight: 700; color: var(--navy); background: #eef2ff; padding: .1rem .4rem; border-radius: 6px; }
.turno-badge { font-size: .68rem; font-weight: 600; color: var(--estado-r); background: var(--estado-r-bg); padding: .05rem .35rem; border-radius: 6px; white-space: nowrap; }
.vig-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--estado-p); margin-right: .4rem; vertical-align: 1px; }
/* Licencia aprobada con días en Presente sin aplicar (conflicto sin resolver) */
.conf-warn {
  display: inline-block; margin-left: .4rem; padding: .05rem .45rem;
  background: var(--estado-f-bg); color: var(--estado-f);
  border: 1px solid #fca5a5; border-radius: 10px;
  font-size: .72rem; font-weight: 800; white-space: nowrap;
}
.reg-ava { display: inline-block; width: 26px; height: 26px; border-radius: 50%; object-fit: cover; vertical-align: middle; }
.reg-ava--ph { background: var(--navy); color: #fff; font-size: .72rem; font-weight: 700; text-align: center; line-height: 26px; }
.lic-perpage { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--text-muted); }
.lic-perpage select { padding: .15rem .4rem; height: auto; }

/* ── Estado banner (show) ────────────────────────────────── */
.lic-estado-banner {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .7rem 1rem;
  border-radius: var(--radius);
  border-left: 4px solid currentColor;
  margin-bottom: 1.25rem;
}
.lic-estado-aprobada  { background: var(--estado-p-bg); color: var(--estado-p); }
.lic-estado-pendiente { background: #fefbe8; color: var(--estado-r); }
.lic-estado-rechazada { background: var(--estado-f-bg); color: var(--estado-f); }
.lic-estado-ico   { display: inline-flex; flex-shrink: 0; }
.lic-estado-ico svg { width: 22px; height: 22px; }
.lic-estado-body  { display: flex; flex-direction: column; }
.lic-estado-label { font-size: 1rem; font-weight: 600; }

/* Volver consistente (parte superior izquierda de las vistas de detalle) */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .6rem;
  text-decoration: none;
}
.back-link:hover { color: var(--navy); }
.back-link svg { width: 18px; height: 18px; }

/* Barra de acciones de licencia: grupos a la izquierda */
.lic-acciones { column-gap: 1rem; }
.lic-acciones-grupo { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.dd-medio { display: inline-flex; align-items: center; gap: .4rem; }
.dd-medio svg { width: 18px; height: 18px; }
.politica-ico { display: inline-flex; }
.politica-ico svg { width: 20px; height: 20px; }

/* Switch de alcance de turno (licencia) — mismo lenguaje que el toggle de asistencia */
.turno-switch {
  display: inline-flex;
  gap: .25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: .2rem;
}
.turno-seg {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .9rem;
  border-radius: 9999px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.turno-seg svg { width: 16px; height: 16px; }
.turno-seg.active { background: var(--navy); color: #fff; }

/* Fila de gestión (editar/eliminar) alineada a la derecha */
.lic-acciones--manage { justify-content: flex-end; }

/* Rechazar: fondo de color (rojo suave) — distinto del Eliminar sólido */
.btn-outline-danger {
  background: var(--estado-f-bg);
  color: var(--estado-f);
  border: 1px solid #fca5a5;
}
.btn-outline-danger:hover { background: #fecaca; }

/* Caja de estudiante seleccionado: nombre/curso + botón cambiar */
.alumno-info-box { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.alumno-info-main { display: flex; flex-direction: column; gap: .15rem; }

/* ── Tarjeta de detalle ──────────────────────────────────── */
.detail-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1rem;
}
.detail-section {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.detail-section:last-child { border-bottom: none; }

.detail-section-title {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: .75rem;
}
.detail-section-title svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.detail-obs {
  font-size: .9rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.6;
}

/* ── WhatsApp action ─────────────────────────────────────── */
.wa-action { margin-top: .9rem; }
.wa-hint   { font-size: .8rem; color: var(--text-muted); margin-top: .35rem; }

/* ── Quick links ─────────────────────────────────────────── */
.quick-links { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }

/* ── Formulario de licencia ──────────────────────────────── */
.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.form-section {
  padding: 1.1rem 1.25rem;
}
.form-section + .form-section { border-top: 1px solid var(--border); }
.form-section-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: .85rem;
}
.fields-row--3 { grid-template-columns: 1fr 1fr auto; }

.field        { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .85rem; }
.field:last-child { margin-bottom: 0; }
.field-label  { font-size: .88rem; font-weight: 500; color: var(--text); }
.field-error  { font-size: .8rem; color: var(--estado-f); }

.fields-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field--dias  { grid-column: auto; }

.input-text, .input-textarea {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .9rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s;
  font-family: inherit;
}
.input-text:focus, .input-textarea:focus {
  outline: none;
  border-color: var(--navy-lt);
  box-shadow: 0 0 0 3px rgba(61,68,128,.12);
}
.input-textarea { resize: vertical; min-height: 80px; }

/* ── Selector de medio (radio visual) ────────────────────── */
.medio-group {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.medio-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  padding: .6rem .9rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: var(--bg);
  transition: border-color .15s, background .15s;
  min-width: 72px;
}
.medio-btn.active  { border-color: var(--navy); background: var(--surface); }
.medio-ico { font-size: 1.5rem; line-height: 1; display: inline-flex; color: var(--text-muted); }
.medio-ico svg { width: 24px; height: 24px; }
.medio-btn.active .medio-ico { color: var(--navy); }
.medio-lbl { font-size: .75rem; font-weight: 500; color: var(--text-muted); }
.medio-btn.active .medio-lbl { color: var(--navy); font-weight: 600; }

/* ── Buscador de alumnos (autocomplete) ──────────────────── */
.alumno-search-wrap { position: relative; }
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  z-index: 100;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 2px;
  list-style: none;
}
.autocomplete-item {
  padding: .6rem .9rem;
  cursor: pointer;
  font-size: .9rem;
  border-bottom: 1px solid var(--border);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--bg); }
.autocomplete-empty { padding: .6rem .9rem; font-size: .85rem; color: var(--text-muted); font-style: italic; }

.alumno-info-box {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--estado-p-bg);
  border: 1px solid var(--estado-p);
  border-radius: 8px;
  padding: .5rem .85rem;
  font-size: .9rem;
  margin-top: .4rem;
}
.alumno-info-box.hidden { display: none; }
.alumno-curso { font-size: .8rem; color: var(--estado-p); font-weight: 600; }

/* ── Cálculo de días ─────────────────────────────────────── */
.dias-display {
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 .75rem;
}
.dias-display.dias-ok { color: var(--navy); background: var(--estado-l-bg); border-color: var(--estado-l); }

/* ── Acciones del formulario ─────────────────────────────── */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* ── Alerta de error ─────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }
.alert-error { background: var(--estado-f-bg); color: var(--estado-f); border: 1px solid var(--estado-f); }

/* ── Selector de contactos ───────────────────────────────── */
.contacto-opciones {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin-bottom: .5rem;
}
.contacto-opcion {
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  transition: border-color .15s, background .15s;
  overflow: hidden;
}
.contacto-opcion.selected {
  border-color: var(--navy);
  background: var(--surface);
}
.contacto-opcion--otro { border-style: dashed; }
.contacto-opcion--otro.selected { border-style: solid; border-color: var(--estado-r); }

.contacto-opcion-label {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .7rem .9rem;
  cursor: pointer;
  width: 100%;
}
.contacto-opcion-label input[type=radio] { margin-top: .2rem; flex-shrink: 0; accent-color: var(--navy); width: 16px; height: 16px; }
.contacto-opcion-body { display: flex; flex-direction: column; gap: .2rem; }
.ctc-nombre  { font-weight: 600; font-size: .95rem; color: var(--text); }
.ctc-meta    { font-size: .82rem; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: .25rem .5rem; align-items: center; }
.ctc-badge   { background: var(--estado-p-bg); color: var(--estado-p); padding: .1rem .4rem; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.ctc-sin-cel { color: var(--border); font-style: italic; }

.otro-fields {
  padding: .6rem .9rem .85rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.otro-fields.hidden { display: none; }

.field-hint {
  font-size: .85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: .5rem;
}
.field-hint.hidden { display: none; }
.dias-warn { color: var(--estado-r) !important; border-color: var(--estado-r) !important; }

/* ── Responsive Fase 4 ───────────────────────────────────── */
@media (max-width: 640px) {
  .fields-row  { grid-template-columns: 1fr; }
  .filter-bar  { gap: .4rem; }
  .medio-group { gap: .35rem; }
  .medio-btn   { min-width: 60px; padding: .5rem .6rem; }
  .lic-card    { gap: .6rem; padding: .75rem .85rem; }
  .form-actions { flex-direction: column-reverse; }
  .btn-lg      { width: 100%; justify-content: center; }
  .quick-links { flex-direction: column; }
}
