/* =====================================================================
   SAGA — Tema visual
   Paleta: azul noche + cian + violeta. Modo claro y oscuro.
   Para cambiar colores basta editar las variables de :root.
   ===================================================================== */
:root {
  --saga-primary: #4f46e5;
  --saga-primary-rgb: 79, 70, 229;
  --saga-accent: #06b6d4;
  --saga-violet: #8b5cf6;
  --saga-success: #10b981;
  --saga-warning: #f59e0b;
  --saga-danger: #ef4444;
  --saga-grad: linear-gradient(135deg, #06b6d4 0%, #4f46e5 55%, #8b5cf6 100%);
  --saga-side-bg: linear-gradient(180deg, #0b1024 0%, #151a3d 60%, #1e1b4b 100%);
  --saga-bg: #f3f5fb;
  --saga-card: #ffffff;
  --saga-border: #e6e9f2;
  --saga-text: #1f2437;
  --saga-muted: #6b7289;
  --saga-radius: 16px;
  --saga-font-display: 'Outfit', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --saga-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 24px rgba(16, 24, 40, .06);
  --sidebar-w: 262px;
  --bs-primary: var(--saga-primary);
  --bs-primary-rgb: var(--saga-primary-rgb);
  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bs-link-color: var(--saga-primary);
  --bs-link-color-rgb: var(--saga-primary-rgb);
}
[data-bs-theme="dark"] {
  --saga-bg: #0b0f1f;
  --saga-card: #121833;
  --saga-border: #232b4d;
  --saga-text: #e6e8f2;
  --saga-muted: #9aa3c2;
  --saga-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 30px rgba(0, 0, 0, .35);
  --bs-body-bg: #0b0f1f;
  --bs-body-color: #e6e8f2;
  --bs-border-color: #232b4d;
  --bs-tertiary-bg: #161d3b;
}

body.app-body { background: var(--saga-bg); color: var(--saga-text); font-size: .925rem; }
h1, h2, h3, h4, h5, .font-display { font-family: var(--saga-font-display); letter-spacing: -.01em; }
.text-muted { color: var(--saga-muted) !important; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
  background: var(--saga-side-bg); color: #cdd3ee; display: flex; flex-direction: column;
  box-shadow: 4px 0 30px rgba(10, 12, 40, .25); transition: transform .25s ease;
}
.sidebar::after { /* brillo futurista */
  content: ''; position: absolute; top: -120px; right: -120px; width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(6, 182, 212, .25), transparent 70%); pointer-events: none;
}
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1.25rem 1rem; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px; background: var(--saga-grad); display: grid; place-items: center;
  font-size: 1.35rem; color: #fff; box-shadow: 0 6px 18px rgba(79, 70, 229, .5);
}
.brand-logo { width: 46px; height: 46px; object-fit: contain; border-radius: 10px; background: #fff; padding: 3px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-family: var(--saga-font-display); color: #fff; font-size: 1.15rem; letter-spacing: .02em; }
.brand-text small { color: #8f98c4; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .25rem .75rem 1rem; }
.nav-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: #6f78a8; margin: 1.1rem .75rem .4rem; font-weight: 600; }
.nav-item-link {
  display: flex; align-items: center; gap: .75rem; padding: .58rem .8rem; border-radius: 10px;
  color: #c3c9e6; text-decoration: none; font-weight: 500; transition: all .15s; margin-bottom: 2px;
}
.nav-item-link i { font-size: 1.05rem; width: 20px; text-align: center; opacity: .85; }
.nav-item-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item-link.active {
  background: linear-gradient(90deg, rgba(6, 182, 212, .22), rgba(139, 92, 246, .18)); color: #fff;
  box-shadow: inset 3px 0 0 var(--saga-accent);
}
.sidebar-foot { padding: .9rem 1.25rem; font-size: .72rem; display: flex; justify-content: space-between; border-top: 1px solid rgba(255, 255, 255, .07); }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 3px; }

/* ---------- Layout ---------- */
.main-wrap { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.main-wrap.no-sidebar { margin-left: 0; }
.topbar {
  position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1.5rem; background: color-mix(in srgb, var(--saga-bg) 80%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--saga-border);
}
.topbar-title { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.topbar-title i { font-size: 1.3rem; background: var(--saga-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar-title h1 { font-size: 1.25rem; margin: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { padding: 1.5rem; flex: 1; max-width: 1500px; width: 100%; }
.content-full { max-width: none; padding: 1rem; }
.app-footer { padding: 1rem 1.5rem; font-size: .75rem; color: var(--saga-muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; }
.btn-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; padding: 0; border: 1px solid var(--saga-border); background: var(--saga-card); color: var(--saga-text); }
.btn-icon:hover { border-color: var(--saga-primary); color: var(--saga-primary); }
.user-chip { display: flex; align-items: center; gap: .6rem; padding: .3rem .7rem .3rem .3rem; border-radius: 999px; border: 1px solid var(--saga-border); background: var(--saga-card); color: var(--saga-text); }
.user-chip small { color: var(--saga-muted); font-size: .72rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--saga-grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .main-wrap { margin-left: 0; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 1030; }
  .content { padding: 1rem; }
}

/* ---------- Tarjetas ---------- */
.card { background: var(--saga-card); border: 1px solid var(--saga-border); border-radius: var(--saga-radius); box-shadow: var(--saga-shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--saga-border); padding: 1rem 1.25rem; font-weight: 600; }
.card-header:first-child { border-radius: var(--saga-radius) var(--saga-radius) 0 0; }
.card-title-sm { font-family: var(--saga-font-display); font-weight: 600; font-size: 1.02rem; margin: 0; }

.stat-card { position: relative; overflow: hidden; padding: 1.15rem 1.25rem; }
.stat-card .stat-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; color: #fff; }
.stat-card .stat-val { font-family: var(--saga-font-display); font-size: 1.85rem; font-weight: 700; line-height: 1; margin-top: .6rem; }
.stat-card .stat-lbl { color: var(--saga-muted); font-size: .8rem; margin-top: .25rem; }
.stat-card::after { content: ''; position: absolute; right: -30px; bottom: -30px; width: 110px; height: 110px; border-radius: 50%; background: currentColor; opacity: .05; }
.bg-g1 { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.bg-g2 { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.bg-g3 { background: linear-gradient(135deg, #10b981, #14b8a6); }
.bg-g4 { background: linear-gradient(135deg, #f59e0b, #f97316); }
.bg-g5 { background: linear-gradient(135deg, #ef4444, #ec4899); }

.hero {
  border-radius: var(--saga-radius); padding: 1.6rem 1.75rem; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(circle at 85% 20%, rgba(6, 182, 212, .55), transparent 45%), var(--saga-side-bg);
}
.hero h2 { font-weight: 700; margin: 0 0 .25rem; }
.hero p { color: #c7cdf0; margin: 0; }
.hero .grid-lines { position: absolute; inset: 0; opacity: .12; background-image: linear-gradient(rgba(255, 255, 255, .5) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .5) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(90deg, transparent, #000); }

/* ---------- Botones ---------- */
.btn { border-radius: 10px; font-weight: 500; }
.btn-primary { background: var(--saga-primary); border-color: var(--saga-primary); }
.btn-primary:hover { background: #4338ca; border-color: #4338ca; }
.btn-grad { background: var(--saga-grad); color: #fff; border: 0; box-shadow: 0 6px 18px rgba(79, 70, 229, .35); }
.btn-grad:hover { color: #fff; filter: brightness(1.08); }
.form-control, .form-select { border-radius: 10px; border-color: var(--saga-border); }
.form-control:focus, .form-select:focus { border-color: var(--saga-primary); box-shadow: 0 0 0 .2rem rgba(var(--saga-primary-rgb), .15); }
.form-label { font-weight: 500; font-size: .85rem; }

/* ---------- Tablas ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--saga-muted); font-weight: 600; border-bottom-width: 1px; white-space: nowrap; }
.table-hover > tbody > tr:hover > * { --bs-table-hover-bg: rgba(var(--saga-primary-rgb), .04); }
.badge-soft { padding: .35em .65em; border-radius: 6px; font-weight: 600; font-size: .72rem; }
.badge-soft-primary { background: rgba(79, 70, 229, .12); color: #4f46e5; }
.badge-soft-success { background: rgba(16, 185, 129, .14); color: #059669; }
.badge-soft-warning { background: rgba(245, 158, 11, .16); color: #b45309; }
.badge-soft-danger { background: rgba(239, 68, 68, .14); color: #dc2626; }
.badge-soft-info { background: rgba(6, 182, 212, .14); color: #0e7490; }
.badge-soft-secondary { background: rgba(107, 114, 137, .14); color: var(--saga-muted); }
[data-bs-theme="dark"] .badge-soft-primary { color: #a5b4fc; }
[data-bs-theme="dark"] .badge-soft-success { color: #6ee7b7; }
[data-bs-theme="dark"] .badge-soft-warning { color: #fcd34d; }
[data-bs-theme="dark"] .badge-soft-danger { color: #fca5a5; }
[data-bs-theme="dark"] .badge-soft-info { color: #67e8f9; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--saga-muted); }
.empty-state i { font-size: 2.6rem; display: block; margin-bottom: .6rem; opacity: .5; }

/* ---------- Login ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--saga-bg); }
.auth-side { position: relative; overflow: hidden; background: var(--saga-side-bg); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side .orb { position: absolute; border-radius: 50%; filter: blur(10px); opacity: .55; }
.auth-side .orb.a { width: 380px; height: 380px; background: radial-gradient(circle, #06b6d4, transparent 65%); top: -80px; right: -80px; }
.auth-side .orb.b { width: 420px; height: 420px; background: radial-gradient(circle, #8b5cf6, transparent 65%); bottom: -140px; left: -120px; }
.auth-side .grid-lines { position: absolute; inset: 0; opacity: .08; background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px); background-size: 36px 36px; }
.auth-side > * { position: relative; }
.auth-side h1 { font-size: 2.6rem; font-weight: 800; line-height: 1.05; }
.auth-side h1 span { background: linear-gradient(90deg, #67e8f9, #c4b5fd); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-feature { display: flex; gap: .75rem; align-items: center; color: #c7cdf0; margin-bottom: .7rem; }
.auth-feature i { width: 36px; height: 36px; border-radius: 10px; background: rgba(255, 255, 255, .08); display: grid; place-items: center; color: #67e8f9; }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card { width: 100%; max-width: 410px; }
.auth-card .brand-mark { width: 54px; height: 54px; font-size: 1.6rem; }
.input-group .btn-ver { border-color: var(--saga-border); border-radius: 0 10px 10px 0; }
.auth-autor { display: none; }
@media (max-width: 900px) { .auth-page { grid-template-columns: 1fr; } .auth-side { display: none; } .auth-autor { display: block; } }

/* ---------- Anuncios ---------- */
.anuncio { border-left: 4px solid var(--saga-primary); border-radius: 12px; padding: .85rem 1rem; background: var(--saga-card); border-top: 1px solid var(--saga-border); border-right: 1px solid var(--saga-border); border-bottom: 1px solid var(--saga-border); }
.anuncio.cierre, .anuncio.urgente { border-left-color: var(--saga-danger); }
.anuncio.apertura { border-left-color: var(--saga-success); }
.anuncio.info { border-left-color: var(--saga-accent); }

/* ---------- Tarjetas de asignación (docente) ---------- */
.asig-card { transition: transform .15s, box-shadow .15s; text-decoration: none; color: inherit; display: block; height: 100%; }
.asig-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(79, 70, 229, .15); color: inherit; }
.asig-card .sec { font-family: var(--saga-font-display); font-size: 1.8rem; font-weight: 800; background: var(--saga-grad); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }
.progress-thin { height: 6px; border-radius: 3px; }
.progress-thin .progress-bar { background: var(--saga-grad); }

.alerta-perdida { animation: pulso 1.6s infinite; }
@keyframes pulso { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .4); } 50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); } }

@media print {
  .sidebar, .topbar, .app-footer, .no-print { display: none !important; }
  .main-wrap { margin: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  body.app-body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}

/* =====================================================================
   PLANILLA DE NOTAS
   ===================================================================== */
.planilla-wrap { overflow: auto; max-height: calc(100vh - 230px); padding: 0; }
.planilla { border-collapse: separate; border-spacing: 0; font-size: .74rem; width: max-content; min-width: 100%; }
.planilla th, .planilla td { border-right: 1px solid var(--saga-border); border-bottom: 1px solid var(--saga-border); padding: 0; text-align: center; white-space: nowrap; position: relative; background: var(--saga-card); }
.planilla thead th { position: sticky; z-index: 3; font-weight: 600; color: var(--saga-muted); }
.planilla thead tr:first-child th { top: 0; height: 34px; }
.planilla thead tr:nth-child(2) th { top: 34px; height: 28px; padding: 0 3px; font-size: .7rem; }
.planilla th.grp { font-family: var(--saga-font-display); font-size: .78rem; letter-spacing: .03em; text-transform: uppercase; color: var(--saga-text); padding: 2px 6px; line-height: 1.1; }
.planilla th.grp small { font-size: .62rem; text-transform: none; }
.planilla .grp-1 { background: color-mix(in srgb, var(--saga-card) 94%, #6366f1); }
.planilla th.grp-abierto { box-shadow: inset 0 3px 0 var(--saga-success); }
.planilla th.grp-final { background: color-mix(in srgb, var(--saga-card) 88%, #8b5cf6); }
.planilla th.col-h.hab { color: var(--saga-primary); cursor: pointer; }
.planilla th.col-h.hab:hover { background: rgba(var(--saga-primary-rgb), .1); }
.planilla th.col-h i { font-size: .55rem; margin-left: 2px; opacity: .6; }
.planilla .sticky-1, .planilla .sticky-2, .planilla .sticky-3 { position: sticky; z-index: 2; }
.planilla thead .sticky-1, .planilla thead .sticky-2, .planilla thead .sticky-3 { z-index: 5; top: 0; }
.planilla .sticky-1 { left: 0; width: 32px; min-width: 32px; }
.planilla .sticky-2 { left: 32px; width: 78px; min-width: 78px; }
.planilla .sticky-3 { left: 110px; width: 250px; min-width: 250px; max-width: 250px; text-align: left !important; padding: 0 8px !important; overflow: hidden; text-overflow: ellipsis; box-shadow: 3px 0 6px -3px rgba(0, 0, 0, .12); }
.planilla td.c-num { color: var(--saga-muted); font-size: .68rem; }
.planilla td.c-cod { color: var(--saga-muted); font-variant-numeric: tabular-nums; }
.planilla td.c-nom { font-weight: 500; }
.planilla td { height: 27px; }
.planilla td.det, .planilla th.det { width: 40px; min-width: 40px; }
.planilla .c-np { width: 44px; min-width: 44px; font-weight: 700; color: var(--saga-text); background: color-mix(in srgb, var(--saga-card) 92%, #06b6d4); }
.planilla .c-final { width: 44px; min-width: 44px; font-weight: 700; background: color-mix(in srgb, var(--saga-card) 90%, #8b5cf6); }
.planilla .c-mod { background: color-mix(in srgb, var(--saga-card) 85%, #f59e0b); cursor: help; border-left: 2px solid color-mix(in srgb, var(--saga-card) 50%, #f59e0b); }
.planilla .celda { width: 100%; height: 26px; border: 0; background: transparent; text-align: center; font-size: .78rem; color: var(--saga-text); padding: 0; font-variant-numeric: tabular-nums; outline: none; }
.planilla td.hab { background: color-mix(in srgb, var(--saga-card) 97%, #10b981); }
.planilla td.hab .celda { cursor: text; }
.planilla td:not(.hab) .celda { color: var(--saga-muted); cursor: default; }
.planilla .celda:focus { background: rgba(var(--saga-primary-rgb), .1); box-shadow: inset 0 0 0 2px var(--saga-primary); border-radius: 2px; }
.planilla tbody tr:hover td { background-color: color-mix(in srgb, var(--saga-card) 92%, #4f46e5); }
.planilla tbody tr:focus-within td { background-color: color-mix(in srgb, var(--saga-card) 86%, #4f46e5); }
.planilla td.baja .celda, .planilla td.baja.calc, .planilla td.baja.c-final { color: var(--saga-danger) !important; font-weight: 700; }
.planilla td.marca { color: var(--saga-danger); font-weight: 800; font-size: .82rem; cursor: default; }
.planilla td.marca-hab.x-activa { cursor: pointer; }
.planilla td.marca-hab.x-activa:hover { background: rgba(239, 68, 68, .1); }
.planilla td.marca.x-quitada { color: var(--saga-muted); font-weight: 400; }
.planilla td.marca:focus { outline: 2px solid var(--saga-primary); outline-offset: -2px; }
.planilla td[data-def]::after { content: attr(data-def); position: absolute; bottom: 0; right: 2px; font-size: .55rem; font-weight: 700; line-height: 1; color: var(--saga-success); }
.planilla td.baja[data-def]::after { color: var(--saga-danger); }
.planilla td.def-baja[data-def]::after { color: var(--saga-danger); }
.planilla th.grp .peso { font-size: .62rem; font-weight: 600; color: var(--saga-primary); background: rgba(var(--saga-primary-rgb), .1); border-radius: 4px; padding: 0 4px; margin-left: 2px; letter-spacing: 0; }
.planilla .celda.rechazo { animation: rechazo .4s; background: rgba(239, 68, 68, .15); }
@keyframes rechazo { 20%, 60% { transform: translateX(-3px); } 40%, 80% { transform: translateX(3px); } }
.planilla .chk { margin: 0; cursor: pointer; }
.planilla tfoot td { position: sticky; bottom: 0; z-index: 2; font-weight: 600; font-size: .68rem; color: var(--saga-muted); height: 30px; border-top: 2px solid var(--saga-border); }
.planilla tfoot .sticky-1, .planilla tfoot .sticky-2, .planilla tfoot .sticky-3 { z-index: 4; }
.planilla .pierden { display: block; color: var(--saga-danger); font-size: .6rem; line-height: 1; }
.planilla .pierden::before { content: '▼'; font-size: .5rem; margin-right: 1px; }
.menu-columna { position: fixed; z-index: 1080; min-width: 250px; }
.estado-guardado { font-size: .78rem; padding: .3rem .7rem; border-radius: 999px; background: rgba(16, 185, 129, .12); color: #059669; white-space: nowrap; }
.estado-guardado.guardando { background: rgba(79, 70, 229, .1); color: var(--saga-primary); }
.estado-guardado.pend, .estado-guardado.error { background: rgba(239, 68, 68, .12); color: var(--saga-danger); }
.spin { display: inline-block; animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
@media (max-width: 767.98px) { .planilla .sticky-3 { width: 150px; min-width: 150px; max-width: 150px; } .planilla .sticky-2 { display: none; } .planilla .sticky-3 { left: 32px; } }

.planilla td.nr-pierde { font-size: .62rem; text-transform: uppercase; }

/* =====================================================================
   CONSOLIDADO DE SECCIÓN (v1.4)
   ===================================================================== */
.consolidado-wrap { overflow: auto; max-height: calc(100vh - 250px); }
.consolidado { border-collapse: separate; border-spacing: 0; font-size: .78rem; width: max-content; min-width: 100%; }
.consolidado th, .consolidado td { border-right: 1px solid var(--saga-border); border-bottom: 1px solid var(--saga-border); padding: 4px 6px; text-align: center; white-space: nowrap; background: var(--saga-card); }
.consolidado thead th { position: sticky; z-index: 3; font-weight: 600; color: var(--saga-muted); }
.consolidado thead tr:first-child th { top: 0; height: 30px; }
.consolidado thead tr:nth-child(2) th { top: 30px; }
.consolidado th.area { white-space: normal; line-height: 1.05; font-size: .6rem; text-transform: uppercase; letter-spacing: .03em; color: var(--saga-text); max-width: 160px; overflow: hidden; text-overflow: ellipsis; background: color-mix(in srgb, var(--saga-card) 93%, #6366f1); }
.consolidado th.asig { color: var(--saga-text); min-width: 44px; cursor: help; }
.consolidado th.asig sup, .consolidado th.asig sup { color: #b45309; font-weight: 700; margin-left: 1px; }
.consolidado th.asig.mia { color: #fff; background: var(--saga-primary, #4f46e5); }
.consolidado td.mia { box-shadow: inset 2px 0 0 color-mix(in srgb, var(--saga-primary, #4f46e5) 55%, transparent), inset -2px 0 0 color-mix(in srgb, var(--saga-primary, #4f46e5) 55%, transparent); }
.consolidado th.res, .consolidado td.res { background: color-mix(in srgb, var(--saga-card) 94%, #8b5cf6); }
.consolidado .fx { position: sticky; z-index: 2; }
.consolidado thead .fx { z-index: 4; }
.consolidado .fx1 { left: 0; width: 38px; min-width: 38px; }
.consolidado .fx2 { left: 38px; min-width: 240px; box-shadow: 2px 0 0 var(--saga-border); }
.consolidado td.nom { font-weight: 500; }
.consolidado td.n { font-variant-numeric: tabular-nums; }
.consolidado td.baja { color: #dc2626; font-weight: 700; background: rgba(239, 68, 68, .09); }
.consolidado td.sup { color: #059669; }
.consolidado td.vacia { color: var(--saga-muted); }
.consolidado tbody tr:hover td { background: rgba(var(--saga-primary-rgb), .06); }
.consolidado tbody tr:hover td.baja { background: rgba(239, 68, 68, .16); }
.consolidado tfoot td { position: sticky; bottom: 0; z-index: 2; font-weight: 600; background: color-mix(in srgb, var(--saga-card) 90%, #06b6d4); font-size: .74rem; }
.consolidado tfoot tr:nth-child(1) td { bottom: 50px; }
.consolidado tfoot tr:nth-child(2) td { bottom: 25px; }
.consolidado tfoot tr:nth-child(3) td { bottom: 0; }
.consolidado tfoot td { height: 25px; padding-top: 2px; padding-bottom: 2px; }
.consolidado tfoot .fx { z-index: 3; }
[data-bs-theme="dark"] .consolidado td.baja { color: #fca5a5; }
[data-bs-theme="dark"] .consolidado td.sup { color: #6ee7b7; }
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card[open] > summary { border-bottom: 1px solid var(--saga-border); }

/* Panel del tutor en el inicio del docente */
.tutor-card { border-left: 4px solid var(--saga-warning); }
.tutor-sec { width: 74px; height: 74px; border-radius: 16px; background: var(--saga-grad); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; }
.tutor-sec small { font-size: .6rem; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.tutor-sec b { font-family: var(--saga-font-display); font-size: 1.45rem; }
.tutor-kpis .v { font-family: var(--saga-font-display); font-size: 1.35rem; font-weight: 700; }

/* Jornadas (v1.5) */
.badge-jornada.j-manana { background: rgba(245, 158, 11, .15); color: #b45309; }
.badge-jornada.j-tarde { background: rgba(99, 102, 241, .14); color: #4338ca; }
[data-bs-theme="dark"] .badge-jornada.j-manana { color: #fcd34d; }
[data-bs-theme="dark"] .badge-jornada.j-tarde { color: #a5b4fc; }
.chip-jornada { border-radius: 999px; }

/* =====================================================================
   DIARIO DE CLASE (v1.7)
   ===================================================================== */
.diario .pie-tot { font-weight: 800; cursor: help; }
.diario .pie-tot.con-f { color: #dc2626; }
.diario .pie-tot.solo-x { color: #059669; }
.diario td.ca { width: 38px; min-width: 38px; max-width: 38px; padding: 0 !important; cursor: pointer; user-select: none; outline: none; }
.diario td.ca:focus { box-shadow: inset 0 0 0 2px var(--saga-primary); }
.diario td.ca:hover { background: rgba(var(--saga-primary-rgb), .08); }
.marca-f, .marca-e, .marca-x { display: inline-grid; place-items: center; width: 22px; height: 20px; border-radius: 5px; font-weight: 800; font-size: .74rem; }
.marca-f { background: rgba(239, 68, 68, .16); color: #dc2626; }
.marca-e { background: rgba(245, 158, 11, .2); color: #b45309; }
.marca-x { background: rgba(16, 185, 129, .18); color: #047857; }
.marca-f.sm, .marca-e.sm, .marca-x.sm { width: auto; min-width: 18px; padding: 0 4px; height: 17px; font-size: .66rem; margin: 0 1px; }
[data-bs-theme="dark"] .marca-f { color: #fca5a5; } [data-bs-theme="dark"] .marca-e { color: #fcd34d; } [data-bs-theme="dark"] .marca-x { color: #6ee7b7; }
/* Suspensión (S) y trabajo en casa (C) en el diario (v1.30) */
.aus-tag { display: inline-grid; place-items: center; min-width: 16px; height: 16px; margin-left: 5px; border-radius: 4px; font-size: .62rem; font-weight: 800; cursor: help; vertical-align: 1px; }
.aus-tag.aus-s { background: rgba(239, 68, 68, .16); color: #b91c1c; } .aus-tag.aus-c { background: rgba(14, 165, 233, .18); color: #0369a1; }
td.ca.aus-s { background: repeating-linear-gradient(135deg, rgba(239, 68, 68, .07) 0 6px, transparent 6px 12px); }
td.ca.aus-c { background: repeating-linear-gradient(135deg, rgba(14, 165, 233, .09) 0 6px, transparent 6px 12px); }
td.ca.aus-s:empty::after, td.ca.aus-c:empty::after { font-weight: 800; font-size: .72rem; opacity: .55; }
td.ca.aus-s:empty::after { content: 'S'; color: #b91c1c; } td.ca.aus-c:empty::after { content: 'C'; color: #0369a1; }
/* R = retardo, U = sin uniforme (v1.29): asistió, no es falla */
.marca-r, .marca-u { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 4px; border-radius: 5px; font-weight: 800; font-size: .74rem; }
.marca-r { background: rgba(59, 130, 246, .16); color: #1d4ed8; }
.marca-u { background: rgba(100, 116, 139, .2); color: #475569; }
.marca-r.sm, .marca-u.sm { min-width: 18px; padding: 0 4px; height: 17px; font-size: .66rem; margin: 0 1px; }
[data-bs-theme="dark"] .marca-r { color: #93c5fd; } [data-bs-theme="dark"] .marca-u { color: #cbd5e1; }
.diario th.dh, .diario th.ah { cursor: pointer; line-height: 1.05; padding: 2px 16px 2px 6px !important; position: sticky; }
/* Fechas angostas: el × aparece al pasar el cursor */
.diario th.dh { width: 38px; min-width: 38px; max-width: 38px; padding: 2px 1px !important; text-align: center; }
.diario th.dh small { font-size: .52rem !important; letter-spacing: -.01em; white-space: nowrap; }
.diario th.dh b { font-size: .66rem !important; letter-spacing: -.02em; }
.diario th.dh .x, .diario th.ah .x { opacity: 0; }
.diario th.dh:hover .x, .diario th.ah:hover .x { opacity: 1; background: var(--saga-card); }
.diario thead tr:nth-child(2) th { height: 38px; }
.diario th.dh small, .diario th.ah small { display: block; font-size: .6rem; font-weight: 500; color: var(--saga-muted); }
.diario th.dh b { font-size: .74rem; color: var(--saga-text); }
/* Actividades: columnas angostas (como las fechas); el título completo sale al pasar el cursor */
.diario th.ah { width: 62px; min-width: 62px; max-width: 62px; padding: 2px 12px 2px 4px !important; white-space: normal; vertical-align: bottom; }
.diario th.ah .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word;
  font-size: .64rem; line-height: 1.1; color: var(--saga-text); text-align: left; }
.diario td.cn { width: 62px; min-width: 62px; max-width: 62px; padding: 0; }
.diario td.cn .celda { width: 100%; min-width: 0; }
.diario th.hoy { background: color-mix(in srgb, var(--saga-card) 85%, #10b981) !important; }
.diario th .x { position: absolute; top: 1px; right: 1px; border: 0; background: transparent; color: var(--saga-muted); font-size: .85rem; line-height: 1; padding: 0 3px; border-radius: 4px; }
.diario th .x:hover { color: #dc2626; background: rgba(239, 68, 68, .12); }
.diario th.grp-act { background: color-mix(in srgb, var(--saga-card) 90%, #06b6d4); }
.diario th.res, .diario td.res { background: color-mix(in srgb, var(--saga-card) 94%, #8b5cf6); width: 34px; min-width: 34px; max-width: 40px; padding: 0 2px !important; }
.diario th.res { font-size: .62rem; }
.diario th.res small { font-size: .52rem; }
.diario td.baja .celda { color: #dc2626; font-weight: 700; }
.diario td.c-nom { min-width: 230px; }
.diario tfoot td { position: sticky; bottom: 0; background: color-mix(in srgb, var(--saga-card) 90%, #06b6d4); font-size: .7rem; font-weight: 600; height: 26px; z-index: 2; }
.diario tfoot td.sticky-1, .diario tfoot td.sticky-2 { z-index: 3; }
.diario th.col-vacia { min-width: 90px; }
.asig-acciones { position: relative; z-index: 2; }
.diario .sticky-2 { min-width: 230px; width: 230px; }
.diario td.r-pct { font-size: .72rem; }
.diario td.r-pct.alerta { color: #fff; background: #dc2626 !important; font-weight: 700; }
.diario tr.fila-alerta td.c-nom { color: #dc2626; }
.diario .ico-alerta { display: none; color: #dc2626; font-size: .7rem; }
.diario tr.fila-alerta .ico-alerta { display: inline; }
.marca-f, .marca-e, .marca-x { width: auto !important; min-width: 26px; padding: 0 4px; gap: 1px; display: inline-flex !important; align-items: baseline; justify-content: center; }
.marca-f small, .marca-e small, .marca-x small { font-size: .62rem; font-weight: 700; }
.marca-f.parcial, .marca-e.parcial, .marca-x.parcial { outline: 1.5px dashed currentColor; outline-offset: -2px; }
.menu-marca { min-width: 220px; z-index: 2000; }
.diario td.ca { position: relative; }
.diario .horas-btn { position: absolute; top: 0; right: 0; font-size: .55rem; line-height: 1; padding: 2px; opacity: .5; cursor: pointer; }
.diario .horas-btn:hover, .diario td.ca:focus .horas-btn { opacity: 1; color: var(--bs-primary); }

/* Observador del estudiante (v1.9) */
.obs-card { border-left: 4px solid var(--saga-border); }
.obs-card.obs-success { border-left-color: #10b981; }
.obs-card.obs-warning { border-left-color: #f59e0b; }
.obs-card.obs-danger { border-left-color: #dc2626; }
.obs-segs { background: color-mix(in srgb, var(--saga-card) 94%, #6366f1); border-radius: 10px; padding: 8px 10px; }

/* Observador: descargos del estudiante */
.obs-desc { border-top: 1px dashed var(--bs-border-color); padding-top: .6rem; }
.obs-desc-item { background: var(--bs-tertiary-bg); border-left: 3px solid #6366f1; border-radius: 8px; padding: .55rem .75rem; margin-top: .5rem; }
.obs-desc-item.alterado { border-left-color: #dc2626; background: rgba(220, 38, 38, .07); }
.obs-firma { max-height: 70px; max-width: 240px; background: #fff; border: 1px solid var(--bs-border-color); border-radius: 6px; margin-top: .35rem; }

/* Ficha del estudiante (observador) */
.foto-est { object-fit: cover; border-radius: 10px; border: 2px solid var(--bs-border-color); background: #fff; flex-shrink: 0; }
.ficha-datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .25rem 1rem; }
.ficha-datos span { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; color: var(--bs-secondary-color); }
.ficha-datos a { word-break: break-all; }
.obs-desc-item.borrador { border-left-color: #f59e0b; background: rgba(245, 158, 11, .08); border-left-style: dashed; }
.obs-desc-item.acud { border-left-color: #0ea5e9; }

/* Horario de clases (v1.22) */
.hor-grid { font-size: .8rem; }
.hor-grid thead th { font-weight: 600; background: var(--bs-tertiary-bg); }
.hor-grid th.hor-h { width: 58px; text-align: right; vertical-align: top; color: var(--bs-secondary-color); font-weight: 600; background: var(--bs-tertiary-bg); }
.hor-grid th.hor-h div { font-weight: 400; opacity: .65; font-size: .7rem; }
.hor-grid td { padding: 3px; vertical-align: top; min-width: 118px; }
.hor-grid tr.hor-libre th, .hor-grid tr.hor-libre td { background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(127,127,127,.08) 6px 12px); }
.hor-cl { background: rgba(79, 70, 229, .08); border-left: 3px solid #4f46e5; border-radius: 6px; padding: 4px 7px; line-height: 1.25; }
.hor-cl + .hor-cl { margin-top: 3px; }
.hor-cl b { display: block; }
.hor-cl div, .hor-cl small { color: var(--bs-secondary-color); }
.hor-cl small { font-size: .7rem; }
.hor-cl.hor-sin { background: rgba(127, 127, 127, .08); border-left: 3px dashed #9ca3af; }
.hor-cl.hor-ok { background: rgba(16, 185, 129, .1); border-left-color: #10b981; }
.hor-cl.hor-falta { background: rgba(239, 68, 68, .08); border-left-color: #ef4444; }
.hor-cl.hor-ahora { box-shadow: 0 0 0 2px #f59e0b inset; }
th.col-pend { background: repeating-linear-gradient(45deg, transparent 0 5px, rgba(127,127,127,.12) 5px 10px) !important; color: var(--bs-secondary-color); }
td.col-pend { background: repeating-linear-gradient(45deg, transparent 0 5px, rgba(127,127,127,.07) 5px 10px); }
@media print { .hor-grid { font-size: 9pt; } .hor-cl { border-left-width: 2px; } }

/* Ayuda: panel «?» y recorrido guiado (v1.23) */
.tour-capa { position: fixed; inset: 0; z-index: 2000; }
.tour-hueco { position: fixed; z-index: 2001; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(15, 18, 40, .58); outline: 2px solid #facc15; outline-offset: 0; pointer-events: none; transition: all .22s ease; }
.tour-globo { position: fixed; z-index: 2002; background: var(--bs-body-bg); color: var(--bs-body-color); border-radius: 14px; padding: 14px 16px 12px; box-shadow: 0 18px 50px rgba(0,0,0,.35); transition: top .22s ease, left .22s ease; }
.tour-num { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #6366f1; }
.tour-tit { font-weight: 700; font-size: 1.02rem; margin: 2px 0 4px; }
.tour-txt { font-size: .9rem; line-height: 1.45; }
.tour-txt b { font-weight: 700; }
.tour-btns { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
#ayudaPanel { width: 420px; max-width: 100vw; }
#ayudaPanel .ay-paso { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--bs-border-color); font-size: .9rem; }
#ayudaPanel .ay-paso:last-child { border-bottom: 0; }
#ayudaPanel .ay-n { flex: 0 0 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, #06b6d4, #6366f1); }
#ayudaPanel details { border: 1px solid var(--bs-border-color); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
#ayudaPanel details summary { font-weight: 600; cursor: pointer; font-size: .9rem; }
#ayudaPanel details div { font-size: .88rem; margin-top: 6px; }
.btn-ayuda { color: #6366f1; }
@media print { .tour-capa, .tour-hueco, .tour-globo { display: none !important; } }

/* v1.31.4 · Diario de clase en el celular: el nombre del estudiante sigue visible (fijo a la izquierda, recortado) y la hoja
   ocupa casi toda la pantalla para desplazarse dentro de ella con el dedo en ambas direcciones */
@media (max-width: 767.98px) {
  .diario .sticky-2 { display: table-cell !important; left: 32px; width: 118px; min-width: 118px !important; max-width: 118px;
                      overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .68rem; padding-left: 4px !important;
                      box-shadow: 3px 0 6px -3px rgba(0, 0, 0, .15); }
  .diario td.c-nom .aus-tag { margin-left: 2px; }
  .diario th.grp { white-space: normal; }
  .planilla-wrap { max-height: calc(100svh - 100px); scroll-margin-top: 92px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-x pan-y; }
}

/* ---------- Chat institucional (v1.33) ---------- */
.chat-globo { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--saga-danger); color: #fff; font-size: .7rem; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; }
.chat-globo[hidden] { display: none; }
.chat-globo-top { position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; font-size: .64rem; box-shadow: 0 0 0 2px var(--saga-card); }
.chat-app { display: grid; grid-template-columns: 330px 1fr; height: calc(100vh - 205px); min-height: 460px; overflow: hidden; padding: 0; }
.chat-lista { border-right: 1px solid var(--saga-border); display: flex; flex-direction: column; min-height: 0; }
.chat-lista-cab { display: flex; gap: .5rem; padding: .75rem; border-bottom: 1px solid var(--saga-border); }
.chat-convs { flex: 1; overflow-y: auto; }
.chat-conv { display: flex; gap: .65rem; align-items: center; width: 100%; padding: .7rem .85rem; border: 0; border-bottom: 1px solid var(--saga-border); background: transparent; color: inherit; text-align: left; }
.chat-conv:hover { background: rgba(var(--saga-primary-rgb), .05); }
.chat-conv.active { background: rgba(var(--saga-primary-rgb), .1); box-shadow: inset 3px 0 0 var(--saga-primary); }
.chat-conv.nueva b { color: var(--saga-primary); }
.chat-conv-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.chat-app .avatar, .chat-directorio .avatar, #infoLista .avatar { position: relative; width: 40px; height: 40px; font-size: .85rem; }
.avatar-grupo { background: linear-gradient(135deg, #10b981, #06b6d4); }
.chat-punto { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--saga-success); box-shadow: 0 0 0 2px var(--saga-card); }
.chat-hilo { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--saga-bg); }
.chat-vacio { margin: auto; text-align: center; padding: 2rem; }
.chat-vacio > i { font-size: 3rem; color: var(--saga-primary); opacity: .55; display: block; margin-bottom: .5rem; }
.chat-hilo-cab { display: flex; align-items: center; gap: .65rem; padding: .6rem .9rem; background: var(--saga-card); border-bottom: 1px solid var(--saga-border); }
.min-w-0 { min-width: 0; }
.chat-mensajes { flex: 1; overflow-y: auto; padding: 1rem 1.1rem; display: flex; flex-direction: column; }
.chat-dia { text-align: center; margin: .9rem 0 .5rem; }
.chat-dia span { background: var(--saga-card); border: 1px solid var(--saga-border); border-radius: 20px; padding: .15rem .75rem; font-size: .72rem; color: var(--saga-muted); text-transform: capitalize; }
.chat-sistema { text-align: center; font-size: .75rem; color: var(--saga-muted); margin: .4rem 0; font-style: italic; }
.chat-msj { max-width: min(75%, 620px); margin-top: .55rem; align-self: flex-start; }
.chat-msj.seguido { margin-top: .15rem; }
.chat-msj.mio { align-self: flex-end; }
.chat-autor { font-size: .72rem; font-weight: 600; color: var(--saga-primary); margin: 0 0 2px .6rem; }
.chat-burbuja { background: var(--saga-card); border: 1px solid var(--saga-border); border-radius: 14px 14px 14px 4px; padding: .45rem .7rem .3rem; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
.chat-msj.mio .chat-burbuja { background: var(--saga-primary); border-color: transparent; color: #fff; border-radius: 14px 14px 4px 14px; }
.chat-msj.mio .chat-burbuja a { color: #fff; }
.chat-hora { display: inline-block; font-size: .64rem; opacity: .65; margin-left: .55rem; vertical-align: bottom; white-space: nowrap; }
.chat-visto { font-size: .68rem; color: var(--saga-muted); text-align: right; margin-top: 2px; }
.chat-escribir { display: flex; gap: .5rem; align-items: flex-end; padding: .65rem .8rem; background: var(--saga-card); border-top: 1px solid var(--saga-border); }
.chat-escribir textarea { resize: none; max-height: 160px; border-radius: 12px; }
.chat-escribir .btn { border-radius: 12px; height: 38px; }
.chat-directorio { max-height: 55vh; }
.chat-persona[hidden] { display: none !important; }
@media (max-width: 767.98px) {
  .chat-app { grid-template-columns: 1fr; height: calc(100vh - 170px); }
  .chat-app .chat-hilo { display: none; }
  .chat-app.con-hilo .chat-lista { display: none; }
  .chat-app.con-hilo .chat-hilo { display: flex; }
  .chat-msj { max-width: 88%; }
}

/* =====================================================================
   SECCIONES DE LA ASIGNATURA (v1.36): Diario · Planilla · Tareas
   Diario = fechas (asistencia) + actividades · Planilla = periodos / cortes · Tareas = portal
   ===================================================================== */
:root { --sec-a: #0ea5e9; --sec-t: #10b981; --sec-p: #6366f1; --sec-w: #f59e0b; }
.sec-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.sec-tab { flex: 1 1 0; min-width: 190px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px;
  background: var(--saga-card); border: 1px solid var(--saga-border); color: var(--saga-muted); text-decoration: none; position: relative; transition: background .15s, border-color .15s; }
.sec-tab > i { font-size: 1.25rem; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--saga-card) 86%, var(--c)); color: var(--c); }
.sec-tab span { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sec-tab b { font-family: var(--saga-font-display); font-size: .92rem; color: var(--saga-text); }
.sec-tab small { font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-tab:hover { border-color: var(--c); color: var(--saga-text); }
.sec-tab.active { border-color: var(--c); background: color-mix(in srgb, var(--saga-card) 93%, var(--c)); box-shadow: inset 0 -3px 0 var(--c); }
.sec-tab.active > i { background: var(--c); color: #fff; }
.sec-tab-diario { --c: var(--sec-a); } .sec-tab-planilla { --c: var(--sec-p); } .sec-tab-tareas { --c: var(--sec-w); } .sec-tab-aula { --c: var(--sec-t); }
@media (max-width: 575.98px) { .sec-tab { min-width: 150px; padding: 6px 8px; gap: 6px; } .sec-tab > i { width: 30px; height: 30px; font-size: 1rem; } .sec-tab small { display: none; } }

/* Diario: herramientas agrupadas por sección */
.grp-herr { display: inline-flex; align-items: center; gap: 2px; border-radius: 8px; padding: 2px 2px 2px 8px; border: 1px solid color-mix(in srgb, var(--saga-card) 55%, var(--c));
  background: color-mix(in srgb, var(--saga-card) 94%, var(--c)); }
.grp-herr > span { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--c); margin-right: 4px; white-space: nowrap; }
.grp-herr .btn { color: var(--saga-text); border: 0; padding: 2px 8px; }
.grp-herr .btn:hover { background: color-mix(in srgb, var(--saga-card) 80%, var(--c)); }
.grp-herr-a { --c: var(--sec-a); } .grp-herr-t { --c: var(--sec-t); }

/* Diario: las dos secciones de la tabla */
.diario th.sec-a.grp, .diario th.res-a { background: color-mix(in srgb, var(--saga-card) 86%, var(--sec-a)) !important; }
.diario th.sec-t.grp, .diario th.res-t { background: color-mix(in srgb, var(--saga-card) 86%, var(--sec-t)) !important; }
.diario th.dh.sec-a:not(.hoy) { background: color-mix(in srgb, var(--saga-card) 95%, var(--sec-a)); }
.diario th.ah.sec-t { background: color-mix(in srgb, var(--saga-card) 95%, var(--sec-t)); }
.diario td.res-a { background: color-mix(in srgb, var(--saga-card) 95%, var(--sec-a)); }
.diario td.res-t { background: color-mix(in srgb, var(--saga-card) 94%, var(--sec-t)); }
.diario th.grp.sec-a { box-shadow: inset 0 3px 0 var(--sec-a); color: color-mix(in srgb, var(--saga-text) 70%, var(--sec-a)); }
.diario th.grp.sec-t { box-shadow: inset 0 3px 0 var(--sec-t); color: color-mix(in srgb, var(--saga-text) 70%, var(--sec-t)); }
.diario .ini-a { border-left: 3px solid var(--sec-a) !important; }
.diario .ini-t { border-left: 3px solid var(--sec-t) !important; }
.diario th.grp .grp-add { border: 0; background: transparent; color: inherit; margin-left: 6px; padding: 0 5px; border-radius: 5px; font-size: .8rem; line-height: 1.3; }
.diario th.grp .grp-add:hover { background: color-mix(in srgb, var(--saga-card) 70%, currentColor); }
.ayuda-sec { height: 100%; border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px;
  border-left: 3px solid var(--c); background: color-mix(in srgb, var(--saga-card) 96%, var(--c)); }
.ayuda-sec .ayuda-tit { font-weight: 700; color: var(--saga-text); font-size: .8rem; }
.ayuda-sec-a { --c: var(--sec-a); } .ayuda-sec-t { --c: var(--sec-t); }

/* Planilla: cada periodo / corte separado con una línea fuerte */
.planilla:not(.diario) .ini-per, .planilla:not(.diario) .c-final.c-np:not(.c-mod), .planilla:not(.diario) td[data-pie="final"] { border-left: 3px solid color-mix(in srgb, var(--saga-card) 40%, var(--sec-p)) !important; }

/* ---------------------------------------------------------------- v1.37 Comunidad: calendario, álbum, encuestas */
.cal-mes { table-layout: fixed; }
.cal-mes td { height: 92px; vertical-align: top; padding: 4px; font-size: .78rem; }
.cal-mes td.otro { background: var(--bs-tertiary-bg); opacity: .55; }
.cal-mes td.finde { background: rgba(107, 114, 137, .05); }
.cal-mes td.hoy { box-shadow: inset 0 0 0 2px var(--saga-primary, #4f46e5); }
.cal-num { font-weight: 700; font-size: .8rem; margin-bottom: 2px; }
.cal-ev { display: block; border-radius: 5px; padding: 1px 5px; margin-bottom: 2px; text-decoration: none; font-size: .72rem; line-height: 1.35;
          overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #fff; }
.cal-ev:hover { filter: brightness(1.1); color: #fff; }
.cal-primary { background: #4f46e5; } .cal-info { background: #0891b2; } .cal-success { background: #059669; }
.cal-warning { background: #d97706; } .cal-secondary { background: #6b7289; } .cal-danger { background: #dc2626; }
.cal-dia { min-width: 46px; border-radius: 10px; background: var(--bs-tertiary-bg); padding: 4px 0; }
.cal-dia-n { font-family: var(--saga-font-display); font-size: 1.35rem; font-weight: 800; line-height: 1.1; }
@media (max-width: 575px) { .cal-mes td { height: 64px; padding: 2px; } .cal-ev { font-size: .62rem; padding: 0 3px; } .cal-mes th { font-size: .65rem; } }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.album-grid img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--bs-border-color); }
.barra-res { height: 10px; border-radius: 6px; background: var(--bs-tertiary-bg); overflow: hidden; }
.barra-res > span { display: block; height: 100%; background: var(--saga-grad, #4f46e5); }
.preg-editor { border: 1px solid var(--bs-border-color); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--bs-body-bg); }
.com-sub .nav-link { border-radius: 999px; padding: .3rem .85rem; font-size: .85rem; }
.com-sub .nav-link.active { background: #4f46e5; color: #fff; }
.globo-n { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #dc2626; color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center; }
@media print { .no-print { display: none !important; } }

/* ---------- Menú lateral plegable (v1.37.2) ---------- */
.menu-buscar { position: relative; margin: 0 .9rem .35rem; }
.menu-buscar i { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: #8a93c2; font-size: .85rem; pointer-events: none; }
.menu-buscar input { width: 100%; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); border-radius: 10px; color: #fff; padding: .45rem .7rem .45rem 2rem; font-size: .85rem; outline: none; }
.menu-buscar input::placeholder { color: #8a93c2; }
.menu-buscar input:focus { border-color: rgba(129, 140, 248, .7); background: rgba(255, 255, 255, .1); }
button.nav-group { display: flex; align-items: center; gap: .4rem; width: calc(100% - .5rem); background: none; border: 0; padding: .45rem .5rem; margin: .35rem .25rem .1rem; border-radius: 8px; text-align: left; cursor: default; }
.sidebar-nav.plegable button.nav-group { cursor: pointer; }
.sidebar-nav.plegable button.nav-group:hover { background: rgba(255, 255, 255, .05); color: #aab2e0; }
button.nav-group > span:first-child { flex: 1; }
.nav-flecha { font-size: .7rem; transition: transform .2s; display: none; }
.sidebar-nav.plegable .nav-flecha { display: inline-block; }
.grupo-globo { font-size: .62rem; letter-spacing: 0; }
.nav-sec.abierto .grupo-globo, .sidebar-nav.buscando .grupo-globo { display: none; }
.sidebar-nav.plegable .nav-sec .nav-items { display: none; }
.sidebar-nav.plegable .nav-sec.abierto .nav-items, .sidebar-nav.buscando .nav-sec .nav-items { display: block; }
.nav-sec.abierto .nav-flecha, .sidebar-nav.buscando .nav-flecha { transform: rotate(180deg); }
.nav-sec.con-activo:not(.abierto) button.nav-group { color: #c7cdf5; }
.nav-sec.con-activo:not(.abierto) button.nav-group::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #818cf8; }

/* ---------- Aula virtual (v1.40) ---------- */
.aula-ico { width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; flex: none; font-size: 1.05rem;
  color: var(--c, #6366f1); background: color-mix(in srgb, var(--saga-card, #fff) 85%, var(--c, #6366f1)); }
.aula-guia { --c: #6366f1; } .aula-archivo { --c: #0ea5e9; } .aula-video { --c: #ef4444; } .aula-enlace { --c: #10b981; }
.aula-oculto { opacity: .6; }
.aula-unidad .list-group-item { background: transparent; }
.aula-texto { white-space: normal; line-height: 1.55; overflow-wrap: anywhere; }
.aula-asigs { overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.aula-asig { flex: none; text-decoration: none; color: inherit; border: 1px solid var(--bs-border-color); border-radius: 12px; padding: 6px 12px;
  background: var(--bs-body-bg); display: flex; flex-direction: column; line-height: 1.2; }
.aula-asig small { color: var(--bs-secondary-color); font-size: .75rem; }
.aula-asig.act { border-color: #4f46e5; box-shadow: 0 0 0 2px rgba(79,70,229,.15); }
.aula-examen { --c: #8b5cf6; }
/* ---------- Evaluaciones en línea (v1.41) ---------- */
.ex-num { flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .78rem; font-weight: 700;
  background: color-mix(in srgb, var(--saga-card, #fff) 85%, #8b5cf6); color: #6d28d9; }
.ex-opc { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--bs-border-color); border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; cursor: pointer; }
.ex-opc:has(input:checked) { border-color: #6d28d9; background: color-mix(in srgb, var(--bs-body-bg) 92%, #8b5cf6); }
.ex-opc input { margin-top: .2rem; flex: none; }
.ex-reloj { position: sticky; top: 0; z-index: 20; }
.ex-reloj.poco { background: #fef2f2 !important; color: #b91c1c; }

/* v1.43.1 · Pantalla completa en la planilla y el diario de clase: se ocultan el menú y la barra de arriba, la tabla usa todo
   el ancho y el alto de la pantalla; el mismo botón (o Esc) vuelve a la vista normal */
body.modo-amplio .sidebar, body.modo-amplio .sidebar-backdrop, body.modo-amplio .topbar, body.modo-amplio .app-footer { display: none !important; }
body.modo-amplio .main-wrap { margin-left: 0 !important; }
body.modo-amplio .content { max-width: none !important; padding: .5rem .75rem !important; }
body.modo-amplio .content > .card.mb-3:first-of-type { margin-bottom: .5rem !important; }
body.modo-amplio .content > .alert { display: none; }
body.modo-amplio .planilla-wrap { margin-bottom: 0; }
body.modo-amplio [data-amplio] { background: var(--saga-primary, #4f46e5); color: #fff; border-color: transparent; }
@media (max-width: 767.98px) { [data-amplio] span { display: none; } }

/* v1.43.2 · Diario y planilla más compactos: periodos cortos (P1, P2… / C1, C2…) en pantallas pequeñas, ayuda del diario
   resumida en una línea con «Ver más ayuda», y encabezado más pequeño en el celular */
.per-corto { display: none; }
.ayuda-corta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: .78rem; }
.ayuda-corta .marca-f, .ayuda-corta .marca-e, .ayuda-corta .marca-x, .ayuda-corta .marca-r, .ayuda-corta .marca-u { padding: 0 5px; }
@media (max-width: 991.98px) { .sel-periodos .per-largo { display: none; } .sel-periodos .per-corto { display: inline; } .sel-periodos .btn { min-width: 38px; } }
@media (max-width: 767.98px) {
  .sec-tabs { margin-bottom: .35rem !important; }
  .sec-tab { min-width: 118px; padding: 5px 8px; gap: 6px; }
  .sec-tab > i { width: 26px; height: 26px; font-size: .9rem; border-radius: 8px; }
  .sec-tab b { font-size: .78rem; }
  .sec-tab small { display: none; }
  .content > .card.mb-3:has(.sel-periodos) { margin-bottom: .5rem !important; }
  .content > .card .card-body:has(.sel-periodos) { padding: .45rem .6rem !important; gap: .35rem !important; font-size: .85rem; }
  .card-body:has(.sel-periodos) .fs-4 { font-size: 1.2rem !important; }
  .card-body:has(.sel-periodos) .fw-semibold { font-size: .88rem; }
  .card-body:has(.sel-periodos) .info-asig { font-size: .72rem; }
  .card-body:has(.sel-periodos) .badge-soft { font-size: .66rem; }
  .card-body:has(.sel-periodos) .btn-sm { font-size: .78rem; padding: .2rem .45rem; }
  .card-body:has(.sel-periodos) .grp-herr > span { display: none; }
  .card-body:has(.sel-periodos) .grp-herr { padding: 1px; }
  .card-body:has(.sel-periodos) .estado-guardado { font-size: .7rem; padding: .2rem .5rem; }
  .card-body:has(.sel-periodos) > .w-100 { display: none; }
  .ayuda-corta { font-size: .72rem; }
}
@media (max-width: 767.98px) { .content > .alert { font-size: .78rem; padding: .4rem .6rem !important; margin-bottom: .5rem; } }
/* v1.44.1 · Botón «Pantalla completa» legible en modo oscuro */
[data-bs-theme="dark"] .btn-outline-dark[data-amplio] { --bs-btn-color: #e5e7eb; --bs-btn-border-color: #6b7280; --bs-btn-hover-color: #111827; --bs-btn-hover-bg: #e5e7eb; --bs-btn-hover-border-color: #e5e7eb; --bs-btn-active-color: #111827; --bs-btn-active-bg: #e5e7eb; }
body.modo-amplio .btn-outline-dark[data-amplio] { --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--saga-primary, #4f46e5); }
