/* ==========================================================================
   EduTrack — Attendance mini-app. Mobile-first. Brand: crimson #960E0B.
   ========================================================================== */
:root {
  --brand:       #960e0b;
  --brand-hover: #7a0b08;
  --ink:         #1a1a1a;
  --muted:       #6b7280;
  --line:        #e5e7eb;
  --line-soft:   #f3f4f6;
  --bg:          #f8f9fb;
  --card:        #ffffff;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  /* attendance status colors */
  --s-p:    #16a34a;  --s-p-bg:    #dcfce7;  /* Presente */
  --s-a:    #dc2626;  --s-a-bg:    #fee2e2;  /* Ausente  */
  --s-t:    #d97706;  --s-t-bg:    #fef3c7;  /* Tarde    */
  --s-ea:   #2563eb;  --s-ea-bg:   #dbeafe;  /* Excusa Ausente */
  --s-ep:   #7c3aed;  --s-ep-bg:   #ede9fe;  /* Excusa Presente */

  --radius: 12px;
  --nav-h:  62px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 15px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---- view switcher ---- */
.view { display: block; }

/* App shell: flex column that fills the viewport — nav never moves */
#view-app {
  display: flex; flex-direction: column; height: 100%;
}

/* ---- toast ---- */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 200;
  background: #1f2937; color: #fff; font-size: 14px; font-weight: 500;
  padding: 10px 20px; border-radius: 100px; z-index: 1000;
  white-space: nowrap; box-shadow: 0 4px 20px rgba(0,0,0,.25);
  animation: toast-in .18s ease;
}
.toast.error { background: #dc2626; color: #fff; }
@keyframes toast-in { from { opacity:0; transform:translateX(-50%) translateY(8px); } }

/* ==========================================================================
   LOGIN
   ========================================================================== */
.login-wrap {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 44px 32px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 12px 40px rgba(0,0,0,.07);
}
.login-logo  { width: 200px; height: auto; margin: 0 auto 24px; display: block; }
.login-card h1 { font-size: 24px; font-weight: 700; letter-spacing: -.5px; color: var(--brand); }
.login-card > p { margin-top: 6px; }
.btn-google {
  width: 100%; margin-top: 28px; height: 52px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink);
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  transition: box-shadow .15s, border-color .15s;
}
.btn-google:hover { box-shadow: 0 3px 12px rgba(0,0,0,.09); border-color: #c1c7d0; }
.btn-google svg { width: 20px; height: 20px; flex: none; }
.fineprint { font-size: 12.5px; margin-top: 18px; line-height: 1.5; }
.error { color: var(--s-a); font-size: 13px; margin-top: 10px; }

/* ==========================================================================
   APP SHELL
   ========================================================================== */

/* ---- topbar ---- */
.topbar {
  flex-shrink: 0; z-index: 30;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar-inner {
  height: 56px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1400px; margin: 0 auto; width: 100%;
}
@media (min-width: 768px) { .topbar-inner { padding: 0 32px; } }
.brand { display: flex; align-items: center; gap: 10px; }
.logo-mark { width: 30px; height: 30px; object-fit: contain; }
.wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.logo-text { font-size: 16px; font-weight: 700; color: var(--brand); letter-spacing: -.3px; }
.logo-sub  { font-size: 10.5px; font-weight: 600; color: var(--muted); letter-spacing: .4px; text-transform: uppercase; }
.topbar-rotday {
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  color: var(--brand); background: rgba(150,14,11,.09);
  border-radius: 6px; padding: 3px 8px;
}
.user-area  { display: flex; align-items: center; gap: 8px; }
.user-name  { font-size: 13px; color: var(--muted); max-width: 35vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 14px; font-weight: 600; border-radius: 8px;
  padding: 0 16px; height: 40px;
  transition: background .13s, border-color .13s, opacity .13s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-outline:hover { border-color: #aaa; background: var(--line-soft); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }

/* ---- main content ---- */
#main-content {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
}
.page-content {
  max-width: 900px; margin: 0 auto; padding: 16px;
}
@media (min-width: 768px) {
  .page-content { padding: 24px 32px; }
  #page-reports .page-content { max-width: 1400px; }
}
.page { display: none; }
.page.active { display: block; }

/* ---- card ---- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
}

/* ---- bottom nav ---- */
.bottom-nav {
  flex-shrink: 0; z-index: 30;
  height: var(--nav-h);
  background: var(--card); border-top: 1px solid var(--line);
  display: flex; align-items: stretch;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav::-webkit-scrollbar { display: none; }
.nav-item {
  flex: 1; min-width: 64px; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); font-size: 11px; font-weight: 500;
  padding: 8px 4px; cursor: pointer;
  transition: color .15s;
  border: none; background: none; font-family: inherit;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--brand); }
.nav-item.active svg path, .nav-item.active svg rect, .nav-item.active svg circle { stroke: var(--brand); }

/* ==========================================================================
   PAGE: TOMA DE ASISTENCIA
   ========================================================================== */

/* session selector */
.session-bar { margin-bottom: 12px; }
.session-bar-row {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 0;
}
.session-bar-row + .session-bar-row { border-top: 1px solid var(--line-soft); }
.field-label { font-size: 12px; font-weight: 600; color: var(--muted); min-width: 48px; letter-spacing: .3px; text-transform: uppercase; }

.date-input, .select-input, .text-input {
  flex: 1; height: 38px; border: 1px solid var(--line);
  border-radius: 8px; padding: 0 10px; color: var(--ink);
  background: var(--card); outline: none;
  transition: border-color .15s;
}
.date-input:focus, .select-input:focus, .text-input:focus { border-color: var(--brand); }

/* homeroom picker grid (admin/principal manual selection) */
.session-manual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 10px;
}

.take-subtabs {
  display: flex; gap: 6px; margin-bottom: 14px;
}
.take-subtab {
  flex: 1; padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--card); font-size: 13px; font-weight: 500; color: var(--muted);
  cursor: pointer; transition: all .15s;
}
.take-subtab.active {
  background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600;
}
.sessions-dia-label {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; display: block;
}
.session-card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}

/* manual group cards (homeroom picker) */
.session-card-manual { text-align: center; padding: 20px 10px; }
.session-card-manual .session-card-subject { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.session-card-manual .session-card-block-row { justify-content: center; margin-bottom: 4px; }
.session-card:hover  { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.session-card:active { background: var(--line-soft); }
.session-card-block-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 7px;
}
.session-card-bloque {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; flex: 1;
}
.session-card-sub {
  background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa;
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px;
  letter-spacing: .4px; flex-shrink: 0;
}
.session-card-status {
  font-size: 11.5px; font-weight: 600; padding: 2px 10px; border-radius: 20px; flex-shrink: 0;
}
.session-card-status.completed { background: var(--s-p-bg); color: var(--s-p); }
.session-card-status.draft     { background: var(--s-t-bg); color: var(--s-t); }
.session-card-status.pending   { background: var(--line-soft); color: var(--muted); }
.session-card-subject {
  font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 5px; line-height: 1.3;
}
.session-card-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.session-card-homeroom { font-size: 13px; font-weight: 600; color: var(--brand); }
.session-card-absent { font-size: 12px; font-weight: 600; color: var(--muted); }

/* status banner */
.status-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px; margin-bottom: 12px;
  font-size: 14px; font-weight: 500;
}
.status-banner.draft     { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.status-banner.completed { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.status-banner.new       { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* substitute notice */
.sub-notice {
  display: flex; align-items: center; gap: 10px;
  background: #fff7ed; border: 1px solid #fed7aa;
  border-radius: 10px; padding: 9px 14px; margin-bottom: 12px;
  font-size: 14px; font-weight: 500; color: #9a3412;
}
.sub-badge {
  background: #ea580c; color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 100px; letter-spacing: .5px; flex: none;
}

/* student list */
.student-list-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px; margin-bottom: 8px;
}
.student-list-title { font-size: 13px; font-weight: 600; color: var(--muted); }
.student-count { font-size: 12px; color: var(--muted); }

.student-row {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 8px;
  overflow: hidden;
}
.student-row-main {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
}
.student-row.locked .student-row-main { opacity: .7; }

.student-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  flex: none; object-fit: cover;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
}
.student-name { flex: 1; font-size: 14px; font-weight: 500; line-height: 1.2; min-width: 0; }
.student-name small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }

/* status toggle */
.status-toggle {
  display: flex; gap: 6px; flex: none;
}
.status-btn {
  min-width: 38px; height: 38px; border-radius: 8px; border: none; cursor: pointer;
  font-size: 12px; font-weight: 700; letter-spacing: .3px;
  background: var(--line-soft); color: var(--muted);
  transition: background .13s, color .13s, transform .1s;
  display: flex; align-items: center; justify-content: center;
}
.status-btn:active { transform: scale(.93); }
.status-btn[data-s="A"].active { background: var(--s-a-bg); color: var(--s-a); }
.status-btn[data-s="P"].active { background: var(--s-p-bg); color: var(--s-p); }
.status-btn[data-s="T"].active { background: var(--s-t-bg); color: var(--s-t); }
.status-btn[data-s="EA"].active { background: var(--s-ea-bg); color: var(--s-ea); }
.status-btn[data-s="EP"].active { background: var(--s-ep-bg); color: var(--s-ep); }

/* minutes late input */
.late-row {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px 10px 62px; /* align with name */
}
.late-row label { font-size: 12px; color: var(--muted); }
.late-input {
  width: 70px; height: 32px; border: 1px solid var(--line);
  border-radius: 6px; padding: 0 8px; font-size: 13px;
  outline: none; text-align: center;
}
.late-input:focus { border-color: var(--s-t); }

/* student card grid */
.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
  padding-bottom: 8px;
}
.stu-card {
  background: var(--card); border: 2px solid var(--line); border-radius: 14px;
  padding: 12px 8px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  transition: border-color .15s, background .15s;
}
.stu-card.locked { opacity: .72; pointer-events: none; }
.stu-card.status-A  { border-color: var(--s-a);  background: var(--s-a-bg);  }
.stu-card.status-P  { border-color: var(--s-p);  background: var(--s-p-bg);  }
.stu-card.status-T  { border-color: var(--s-t);  background: var(--s-t-bg);  }
.stu-card.status-EA { border-color: var(--s-ea); background: var(--s-ea-bg); }
.stu-card.status-EP { border-color: var(--s-ep); background: var(--s-ep-bg); }
.stu-card-photo { width: 60px; height: 60px; flex: none; }
.stu-card-img  { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; display: block; }
.stu-card-initials {
  width: 60px; height: 60px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff;
}
.stu-card-name {
  font-size: 11.5px; font-weight: 500; text-align: center; line-height: 1.3; width: 100%;
}
.stu-card-btns { display: flex; gap: 4px; width: 100%; }
.stu-card-btns .status-btn { min-width: 0; flex: 1; height: 30px; border-radius: 6px; font-size: 11px; }
.stu-card-btns-sec .status-btn { height: 24px !important; font-size: 10px !important; border-radius: 5px; }
.stu-card-late { width: 100%; }
.stu-card-late .late-input { width: 100%; text-align: center; }

/* loading / empty states */
.loading-state { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.empty-state p { font-size: 14px; color: var(--muted); }

/* action bar */
.action-bar {
  position: sticky; bottom: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
}
.action-bar-left  { display: flex; align-items: center; gap: 8px; }
.action-bar-right { display: flex; gap: 8px; }

/* Observation button in action bar */
.obs-btn { color: var(--muted); font-size: 13px; }
.obs-btn--active { color: var(--brand); font-weight: 600; }
.obs-btn--active::after {
  content: ''; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand); margin-left: 5px; vertical-align: middle;
}

/* Observation modal internals */
.obs-empty {
  font-size: 13px; color: var(--muted); text-align: center;
  padding: 20px 0 12px;
}
.obs-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 4px; }
.obs-item {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  background: var(--line-soft);
}
.obs-item-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.obs-item-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 6px; font-size: 11px; color: var(--muted);
}
.obs-item-author { font-weight: 500; color: var(--ink); }
.obs-sep { color: var(--line); }
.obs-edited { font-style: italic; }
.btn-link {
  background: none; border: none; padding: 0; cursor: pointer;
  font-size: 11px; color: var(--brand); text-decoration: underline;
  margin-left: auto;
}
.obs-edit-wrap { }
.obs-edit-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.obs-add-wrap { margin-top: 12px; }

/* Report matrix */
.th-obs-dot { font-size: 10px; margin-left: 2px; cursor: default; }

/* ==========================================================================
   PAGE: PANEL DEL DÍA
   ========================================================================== */
.page-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -.4px; }
.page-date { font-size: 13px; color: var(--muted); }

/* shared: session-card-info + status pill used in take page and day panel expand */
.session-card-info { flex: 1; min-width: 0; }
.session-card-info strong { font-size: 14px; font-weight: 600; display: block; }
.session-card-info span { font-size: 12.5px; color: var(--muted); }
.session-status-pill {
  font-size: 11px; font-weight: 700; letter-spacing: .4px;
  padding: 3px 9px; border-radius: 100px; flex: none;
}
.pill-completada { background: var(--s-p-bg); color: var(--s-p); }
.pill-borrador   { background: var(--s-t-bg);  color: var(--s-t); }
.pill-sin        { background: var(--line-soft); color: var(--muted); }

/* ==========================================================================
   PAGE: PANEL DEL DÍA
   ========================================================================== */
.dp-summary-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px; margin-bottom: 20px;
}
.dp-summary-top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.dp-summary-nums { font-size: 32px; font-weight: 700; color: var(--ink); line-height: 1; }
.dp-summary-denom { font-size: 18px; font-weight: 500; color: var(--muted); }
.dp-summary-label { font-size: 13px; color: var(--muted); flex: 1; }
.dp-progress-bar { height: 6px; background: var(--line); border-radius: 100px; overflow: hidden; }
.dp-progress-fill { height: 100%; background: var(--s-p); border-radius: 100px; transition: width .3s; }

.dp-nivel-title {
  font-size: 11px; font-weight: 700; color: var(--muted);
  letter-spacing: .8px; text-transform: uppercase;
  margin: 20px 0 8px; padding: 0 2px;
}
.dp-section-label {
  font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  padding: 2px 8px; border-radius: 6px; margin: 14px 0 6px; display: inline-block;
}
.dp-section-pending { color: #92400e; background: #fef3c7; }
.dp-section-done    { color: #14532d; background: #dcfce7; }

.dp-teacher-row {
  background: var(--card); border: 1px solid var(--line); border-left-width: 3px;
  border-radius: 10px; padding: 12px 14px; margin-bottom: 6px;
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.dp-teacher-row:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); background: var(--bg); }
.dp-teacher-row.pending { border-left-color: #f97316; }
.dp-teacher-row.done    { border-left-color: var(--s-p); }

.dp-teacher-info { flex: 1; min-width: 0; }
.dp-teacher-name { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.dp-teacher-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.dp-sess-chip {
  font-size: 10px; font-weight: 600; padding: 2px 7px;
  border-radius: 100px; white-space: nowrap;
}
.dp-chip-done  { background: var(--s-p-bg); color: var(--s-p); }
.dp-chip-draft { background: var(--s-t-bg);  color: var(--s-t); }
.dp-chip-sin   { background: var(--line-soft); color: var(--muted); }

.dp-teacher-count { font-size: 13px; font-weight: 700; color: var(--muted); flex-shrink: 0; }
.dp-teacher-count.count-done { color: var(--s-p); }

.dp-chevron { flex-shrink: 0; color: var(--muted); transition: transform .2s ease; }
.dp-teacher-row.expanded .dp-chevron { transform: rotate(90deg); }

.dp-sessions-expand { margin: -2px 0 8px 3px; border-left: 2px solid var(--line); padding-left: 12px; }
.dp-expand-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 6px;
  display: flex; align-items: center; gap: 10px;
}
.dp-expand-card.dp-session-link { cursor: pointer; }
.dp-expand-card.dp-session-link:hover { border-color: var(--brand); background: #f5f3ff; }

/* --------------------------------------------------------------------------
   EXTRA RPT — Listado sub-tab
   -------------------------------------------------------------------------- */
.listado-count {
  font-size: 12px; color: var(--muted); margin-bottom: 8px;
}
.listado-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 6px;
}
.listado-student { flex: 1; min-width: 0; }
.listado-name    { display: block; font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.listado-meta    { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.listado-badge   { flex-shrink: 0; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 100px; white-space: nowrap; }
.badge-present   { background: var(--s-p-bg); color: var(--s-p); }
.badge-absent    { background: var(--s-a-bg); color: var(--s-a); }
.badge-late      { background: var(--s-t-bg); color: var(--s-t); }
.badge-nr        { background: var(--line);   color: var(--muted); }

/* gen-chk-label */
.gen-chk-label   { font-size: 14px; }

/* ==========================================================================
   PAGE: SUSTITUCIONES
   ========================================================================== */
.badge-active-subs {
  font-size: 11px; font-weight: 700; background: var(--s-a-bg); color: var(--s-a);
  padding: 2px 8px; border-radius: 100px;
}
/* substitutions card grid */
.subs-filters {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px;
}
.subs-filter-btn {
  padding: 5px 14px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
  border: 1.5px solid var(--line); color: var(--muted);
  background: transparent; cursor: pointer; transition: all .15s;
}
.subs-filter-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.subs-filter-btn:not(.active):hover { background: var(--line-soft); color: var(--ink); }

.sub-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
}
.sub-teacher-card {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color .15s, background .15s;
}
.sub-teacher-card.absent {
  border-color: var(--s-t); background: var(--s-t-bg);
}
.sub-teacher-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 8px;
}
.sub-teacher-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff; flex: none;
}
.sub-teacher-name {
  font-size: 13px; font-weight: 600; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sub-teacher-nivel { font-size: 11px; color: var(--muted); margin-top: 1px; }
.sub-cover-label {
  font-size: 11.5px; color: var(--s-t); font-weight: 600; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sub-add-btn {
  margin-top: 6px; align-self: flex-start;
  font-size: 11.5px; font-weight: 600; color: var(--brand);
  background: transparent; border: 1px dashed color-mix(in srgb, var(--brand) 45%, transparent);
  border-radius: 8px; padding: 3px 8px; cursor: pointer;
  transition: background .12s;
}
.sub-add-btn:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.sub-conflict-warn {
  margin-top: 10px; padding: 9px 12px; border-radius: 8px;
  font-size: 12.5px; font-weight: 500; line-height: 1.4;
  background: #fef9c3; color: #854d0e; border: 1px solid #fde68a;
}

/* toggle switch */
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; border-radius: 100px;
  background: var(--line); cursor: pointer; transition: background .2s;
}
.slider::before {
  content: ''; position: absolute;
  width: 20px; height: 20px; border-radius: 50%;
  left: 3px; top: 3px; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .2s;
}
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ==========================================================================
   PAGE: REPORTES
   ========================================================================== */
.report-tabs {
  display: flex; gap: 4px; background: var(--line-soft);
  border-radius: 10px; padding: 4px; margin-bottom: 16px;
}
.report-tab {
  flex: 1; height: 36px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  transition: background .15s, color .15s;
}
.report-tab.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

.filters-row { display: flex; gap: 10px; margin-bottom: 10px; }
.filter-field { flex: 1; display: flex; flex-direction: column; gap: 4px; }

/* week navigator */
.week-nav {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px;
}
.week-label { flex: 1; text-align: center; font-size: 14px; font-weight: 600; }
.btn-week-nav {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--line-soft); cursor: pointer; font-size: 18px; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: background .13s;
}
.btn-week-nav:hover { background: var(--line); }

/* homeroom cards grid */
.homeroom-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px;
}
.hr-card {
  background: var(--card); border: 2px solid var(--line); border-radius: 12px;
  padding: 14px 10px 12px; text-align: center; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.hr-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.1); }
.hr-card-name { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.hr-card-nivel { font-size: 10px; color: var(--muted); margin: 2px 0 6px; text-transform: uppercase; letter-spacing: .4px; }
.hr-card-status { font-size: 11px; font-weight: 500; }
.hr-card-done    { border-color: var(--s-p); }
.hr-card-done .hr-card-status { color: var(--s-p); }
.hr-card-partial { border-color: var(--s-t); }
.hr-card-partial .hr-card-status { color: var(--s-t); }
.hr-card-none .hr-card-status { color: var(--muted); }

/* non-school day column */
.th-date-off .th-date-num { color: var(--muted); }
.th-date-off .th-date-day { color: var(--muted); }
.cell-off { background: var(--line-soft); color: var(--muted); }
.cell-off .cell-text { font-weight: 400; color: var(--muted); }

.report-output { margin-top: 16px; overflow-x: auto; }
.report-summary {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px;
}
.summary-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 16px; flex: 1; min-width: 80px;
}
.summary-chip .chip-val { font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.summary-chip .chip-label { font-size: 11px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.chip-p  .chip-val { color: var(--s-p); }
.chip-a  .chip-val { color: var(--s-a); }
.chip-t  .chip-val { color: var(--s-t); }

/* report legend bar */
.rpt-legend-bar { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; font-size: 12px; align-items: center; }
.rpt-leg-item { display: flex; align-items: center; gap: 5px; font-weight: 500; color: var(--ink); }
.rpt-leg-dot { width: 9px; height: 9px; border-radius: 50%; }
.dot-p { background: var(--s-p); }
.dot-a { background: var(--s-a); }
.dot-t { background: var(--s-t); }

/* matrix table */
.matrix-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--line); }
.matrix-table { border-collapse: collapse; font-size: 13px; min-width: 500px; width: 100%; table-layout: auto; }
.matrix-table th, .matrix-table td {
  border: 1px solid var(--line); padding: 12px 14px; text-align: center; white-space: nowrap;
}
.matrix-table thead th { background: var(--line-soft); font-weight: 600; font-size: 12px; }
.matrix-table .col-name {
  text-align: left; min-width: 200px; width: 22%; font-weight: 500; background: var(--card);
  position: sticky; left: 0; z-index: 2;
}
.matrix-table thead th.col-name { background: var(--line-soft); z-index: 3; }

/* date column header */
.th-date { min-width: 60px; vertical-align: top; padding: 10px 14px !important; text-align: center; }
.th-date-num { display: block; font-size: 18px; font-weight: 700; line-height: 1.1; color: var(--ink); }
.th-date-day { display: block; font-size: 11px; color: var(--muted); font-weight: 400; text-transform: capitalize; margin-top: 2px; }
.th-rot { margin-left: 4px; color: var(--s-p); font-weight: 600; font-size: 10px; }
.th-block { min-width: 72px; font-size: 11px; font-weight: 700; color: var(--ink); padding: 6px 8px !important; text-align: center; border-top: 1px solid var(--line); }
.th-block-off { background: var(--line-soft); }
.th-block-subj { font-size: 9px; font-weight: 400; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70px; }
/* bold left border marks the start of each new day */
.day-start { border-left: 2.5px solid #64748b !important; }

/* student name column content */
.rpt-student-avatar { display: inline-block; width: 34px; height: 34px; border-radius: 50%; vertical-align: middle; margin-right: 10px; overflow: hidden; flex: none; }
.rpt-student-img { width: 34px; height: 34px; object-fit: cover; border-radius: 50%; display: block; }
.rpt-student-ini {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; vertical-align: middle;
}
.rpt-student-name { font-size: 14px; vertical-align: middle; }

/* status cells */
.cell-text { display: block; font-size: 12px; font-weight: 600; }
.cell-sub  { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; font-weight: 400; }
.cell-P  { background: var(--s-p-bg); box-shadow: inset 3px 0 0 var(--s-p); }
.cell-P .cell-text { color: var(--s-p); font-weight: 500; }
.cell-A  { background: var(--s-a-bg); box-shadow: inset 3px 0 0 var(--s-a); }
.cell-A .cell-text { color: var(--s-a); }
.cell-T  { background: var(--s-t-bg); box-shadow: inset 3px 0 0 var(--s-t); }
.cell-T .cell-text { color: var(--s-t); }
.cell-EA { background: var(--s-ea-bg); box-shadow: inset 3px 0 0 var(--s-ea); }
.cell-EA .cell-text { color: var(--s-ea); }
.cell-EP { background: var(--s-ep-bg); box-shadow: inset 3px 0 0 var(--s-ep); }
.cell-EP .cell-text { color: var(--s-ep); }
.cell-nd { background: var(--line-soft); color: var(--muted); }

/* individual report — student list */
.indiv-list-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--muted); margin-bottom: 8px; padding: 0 2px;
}
.indiv-count { font-weight: 500; }
.indiv-pages { }

.indiv-student-list { display: flex; flex-direction: column; gap: 6px; }
.indiv-student-row {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 14px; display: flex; align-items: center; gap: 12px;
  cursor: pointer; transition: background .12s, border-color .12s;
}
.indiv-student-row:hover { background: var(--line-soft); border-color: #bbb; }

.indiv-avatar-wrap {
  width: 40px; height: 40px; border-radius: 50%; flex: none; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.indiv-avatar-img { width: 40px; height: 40px; object-fit: cover; border-radius: 50%; display: block; flex: none; }
.indiv-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
}
.indiv-avatar-lg { width: 60px; height: 60px; font-size: 20px; }

.indiv-row-info { flex: 1; min-width: 0; }
.indiv-row-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.indiv-row-meta { font-size: 12px; color: var(--muted); margin-top: 1px; }

.indiv-pagination {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin-top: 16px; font-size: 13px; color: var(--muted);
}
.indiv-pag-label { font-weight: 500; }

/* individual report — detail view */
.indiv-detail-header {
  display: flex; align-items: center; gap: 16px; margin-bottom: 20px;
  padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.indiv-detail-avatar-wrap { position: relative; flex: none; }
.indiv-detail-photo {
  width: 60px; height: 60px; border-radius: 50%; object-fit: cover; display: block;
}
.indiv-detail-name { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }

.indiv-stat-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 16px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 12px; text-align: center;
}
.stat-val { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.stat-label { font-size: 11px; color: var(--muted); font-weight: 500; margin-top: 3px; }

.rec-list { display: flex; flex-direction: column; gap: 6px; }
.rec-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-left-width: 4px; border-radius: 8px; padding: 10px 12px;
}
.rec-row.rec-p  { border-left-color: var(--s-p); }
.rec-row.rec-a  { border-left-color: var(--s-a); }
.rec-row.rec-t  { border-left-color: var(--s-t); }
.rec-row.rec-ea { border-left-color: var(--s-ea); }
.rec-row.rec-ep { border-left-color: var(--s-ep); }
.rec-row-date { font-size: 13px; font-weight: 600; min-width: 56px; color: var(--text); }
.rec-row-info { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rec-row-subj { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-row-blq  { font-size: 11px; color: var(--muted); }
.rec-row-badge { font-size: 12px; font-weight: 600; white-space: nowrap; }
.rec-row.rec-p  .rec-row-badge { color: var(--s-p); }
.rec-row.rec-a  .rec-row-badge { color: var(--s-a); }
.rec-row.rec-t  .rec-row-badge { color: var(--s-t); }
.rec-row.rec-ea .rec-row-badge { color: var(--s-ea); }
.rec-row.rec-ep .rec-row-badge { color: var(--s-ep); }

/* ==========================================================================
   PAGE: ADMIN
   ========================================================================== */
.admin-tabs {
  display: flex; gap: 4px; background: var(--line-soft);
  border-radius: 10px; padding: 4px; margin-bottom: 16px;
}
.admin-tab {
  flex: 1; height: 36px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  transition: background .15s, color .15s;
}
.admin-tab.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

.users-subtabs {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.users-subtab {
  padding: 7px 18px; border-radius: 20px; font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--line); color: var(--muted);
  background: transparent; cursor: pointer; transition: all .15s;
}
.users-subtab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.users-subtab:not(.active):hover { background: var(--line-soft); color: var(--ink); }

.users-panel-toolbar {
  display: flex; gap: 8px; align-items: center; margin-bottom: 12px;
}

.admin-list-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
}
.admin-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--ink);
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 12px;
}
.admin-count { font-size: 13px; color: var(--muted); }
.admin-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.admin-row {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 12px;
}
.admin-cards-grid .admin-row { margin-bottom: 0; }
.admin-row-info { flex: 1; min-width: 0; overflow: hidden; }
.admin-row-info strong { font-size: 14px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-row-info span { font-size: 12.5px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-row-actions { display: flex; gap: 6px; flex: none; }
.btn-icon {
  width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: pointer; background: transparent; font-size: 14px;
  transition: background .13s, color .13s;
}
.btn-icon:hover { background: var(--line-soft); color: var(--ink); }
.btn-icon.danger:hover { background: var(--s-a-bg); color: var(--s-a); border-color: var(--s-a); }

/* subject toolbar: search + level filters */
.subj-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.subj-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.subj-filter-btn {
  padding: 5px 12px; border-radius: 20px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: background .13s, color .13s, border-color .13s;
  white-space: nowrap;
}
.subj-filter-btn:hover { background: var(--line-soft); color: var(--ink); }
.subj-filter-btn.active {
  background: var(--brand); color: #fff; border-color: var(--brand);
}

/* view-as impersonation */
.viewas-search-wrap { margin-bottom: 12px; }
.viewas-search-wrap .text-input { width: 100%; }
.viewas-section-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 16px 0 6px; }
.viewas-section-label:first-child { margin-top: 0; }
.viewas-row { cursor: pointer; transition: background .13s, border-color .13s; }
.viewas-row:hover { background: var(--line-soft); border-color: #ccc; }
.viewas-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.viewas-banner {
  display: flex; align-items: center; gap: 10px;
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px;
  padding: 10px 14px; margin-bottom: 12px; font-size: 13px;
}
.viewas-badge {
  background: #f97316; color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 20px; letter-spacing: .5px; flex-shrink: 0;
}
.viewas-status {
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
}
.viewas-status.completed { background: var(--s-p-bg); color: var(--s-p); }
.viewas-status.draft     { background: var(--s-t-bg); color: var(--s-t); }
.viewas-status.pending   { background: var(--line-soft); color: var(--muted); }

/* impersonation topbar pill */
.imp-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 20px;
  padding: 4px 10px; font-size: 12px; color: var(--ink);
  white-space: nowrap; max-width: 45vw; overflow: hidden;
}
.imp-badge {
  background: #f97316; color: #fff; font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 20px; letter-spacing: .5px; flex-shrink: 0;
}
.imp-pill strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.imp-close {
  background: none; border: none; cursor: pointer; color: #9a3412;
  font-size: 14px; padding: 0 2px; line-height: 1; flex-shrink: 0;
}

/* schedule grid */
.sched-hr-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sched-grid-wrap-inner { margin-bottom: 12px; }
.sched-grid {
  border-collapse: collapse; width: 100%; table-layout: fixed; font-size: 11.5px;
}
.sched-grid th, .sched-grid td {
  border: 1px solid var(--line); text-align: center; vertical-align: middle;
}
.sched-corner { width: 62px; background: var(--bg); }
.sched-day-hdr {
  padding: 6px 2px; background: var(--bg); font-weight: 600;
  font-size: 11px; color: var(--muted);
}
.sched-bloque-num {
  padding: 6px 4px; font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--bg); white-space: nowrap; width: 62px;
}
.sched-cell {
  padding: 5px 4px; cursor: pointer; transition: background .13s;
  height: 52px; overflow: hidden;
}
.sched-cell.empty { color: var(--muted); }
.sched-cell.empty:hover { background: var(--line-soft); }
.sched-cell.occupied { background: #f0fdf4; }
.sched-cell.occupied:hover { background: #dcfce7; }
.sched-subject {
  display: block; font-weight: 600; font-size: 11px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sched-teacher { display: block; font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-add { font-size: 18px; color: var(--line); line-height: 1; }
.sched-cell.empty:hover .sched-add { color: var(--brand); }

#admin-content { position: relative; }

/* session form overlay (inside admin-content) */
.sched-form-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 20; border-radius: 14px;
}
.sched-form-card {
  background: var(--card); border-radius: 14px; padding: 20px;
  width: min(420px, 92%); box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.sched-form-hdr {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 8px;
}
.sched-form-hdr strong { font-size: 14px; }

/* mini form inside admin */
.admin-form { background: var(--card); border: 1px solid var(--brand); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.admin-form .form-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.admin-form .form-field { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 4px; }
.admin-form .text-input, .admin-form .select-input { width: 100%; }
.admin-form .form-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.4); backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
@media (min-width: 480px) {
  .modal-overlay { align-items: center; padding: 24px; }
}
.modal-card {
  background: var(--card); border-radius: 20px 20px 0 0; width: 100%;
  max-width: 480px; padding: 0;
  box-shadow: 0 -4px 40px rgba(0,0,0,.15);
}
@media (min-width: 480px) { .modal-card { border-radius: 16px; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 30px; height: 30px; border-radius: 50%; background: var(--line-soft);
  color: var(--muted); font-size: 14px; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 20px; }

/* substitute teacher picker */
.sub-pick-list {
  max-height: 260px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 10px;
  display: flex; flex-direction: column;
}
.sub-pick-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
  transition: background .12s;
}
.sub-pick-row:last-child { border-bottom: none; }
.sub-pick-row:hover { background: var(--line-soft); }
.sub-pick-row.selected { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.sub-pick-check {
  width: 16px; height: 16px; flex: none; margin: 0;
  accent-color: var(--brand); cursor: pointer;
}
.sub-pick-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.sub-pick-name { font-size: 13px; font-weight: 500; }

/* ==========================================================================
   LEGEND
   ========================================================================== */
.status-legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 12px;
  font-size: 12px;
}
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }

/* ==========================================================================
   RESPONSIVE — mobile (≤ 599px)
   ========================================================================== */
@media (max-width: 599px) {

  /* ---- Topbar ---- */
  .logo-sub { display: none; }
  .user-name { max-width: 30vw; }

  /* ---- Nav inferior ---- */
  .nav-item { font-size: 12px; }

  /* ---- Página ---- */
  .page-content { padding: 12px !important; }
  .page-header { flex-wrap: wrap; gap: 2px; }

  /* ---- Selector de sesión (grid de tarjetas) ---- */
  .session-manual-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

  /* ---- Lista de estudiantes: 2 líneas por alumno ----
     Línea 1: avatar + nombre
     Línea 2: botones de estado a ancho completo            */
  .student-row-main { flex-wrap: wrap; padding: 10px 12px 6px; }
  .status-toggle {
    width: 100%; gap: 6px; margin-top: 6px;
    display: flex !important;
  }
  .status-toggle .status-btn {
    flex: 1; min-width: 0 !important; height: 54px !important;
    font-size: 15px !important; border-radius: 10px;
  }

  /* Botones de estado en vista de tarjeta: 2 columnas → botones más anchos */
  .student-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .stu-card-btns { gap: 6px; width: 100%; }
  .stu-card-btns .status-btn {
    flex: 1; min-width: 0 !important;
    height: 48px !important; font-size: 15px !important;
    border-radius: 10px;
  }
  .stu-card-btns-sec { gap: 6px; }
  .stu-card-btns-sec .status-btn {
    height: 34px !important; font-size: 12px !important;
    border-radius: 8px;
  }

  /* Campo de minutos tarde */
  .late-row { padding-left: 12px; }
  .late-input { height: 38px !important; }

  /* ---- Barra de acciones: apilada ----
     Fila 1: "Todos presentes" (ancho completo)
     Fila 2: Borrador + Completar (mitad cada uno)          */
  .action-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px;
  }
  .action-bar-left  { width: 100%; }
  .action-bar-left #btn-all-present { flex: 1; }
  .action-bar-right { display: flex; gap: 8px; }
  .action-bar-right .btn { flex: 1; }

  /* ---- Reportes ---- */
  .btn-week-nav { width: 40px !important; height: 40px !important; font-size: 20px; }
  .homeroom-cards { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  .filters-row { flex-direction: column; }

  /* Tabs de reportes: scroll horizontal */
  .report-tabs {
    overflow-x: auto; flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .report-tabs::-webkit-scrollbar { display: none; }
  .report-tab { flex: none !important; white-space: nowrap; }
  /* Tabs con solo 2 opciones (ej: Docentes/Listado): llenan el ancho */
  #extra-rpt-tabs .report-tab,
  #obs-tabs .report-tab { flex: 1 !important; }

  /* ---- Admin ---- */
  /* Tabs de admin: scroll horizontal */
  .admin-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .admin-tabs::-webkit-scrollbar { display: none; }
  .admin-tab { flex: none !important; white-space: nowrap; padding: 0 14px !important; }

  /* Subtabs de usuarios */
  .users-subtabs {
    overflow-x: auto; flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
  }
  .users-subtabs::-webkit-scrollbar { display: none; }
  .users-subtab { flex-shrink: 0; }

  /* Grid de tarjetas de admin: una columna */
  .admin-cards-grid { grid-template-columns: 1fr !important; }

  /* Botones de icono */
  .btn-icon { width: 36px !important; height: 36px !important; }

  /* ---- Sustituciones ---- */
  .sub-cards-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

  /* ---- Modal ---- */
  .modal-close { width: 38px !important; height: 38px !important; font-size: 16px; }

  /* ---- Panel del día ---- */
  .dp-sess-chip { font-size: 11px; padding: 3px 8px; }
  .dp-teacher-name { font-size: 13px; }
}

/* ==========================================================================
   GENERAL REPORT
   ========================================================================== */
.gen-rpt-section { margin-bottom: 20px; }
.gen-rpt-time-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px;
}
.gen-time-input { width: 130px; }
.gen-time-sep { color: var(--ink-muted); font-size: 14px; }
.gen-chk-list {
  display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 8px;
}
.gen-chk-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; cursor: pointer; user-select: none;
}
.gen-chk-item input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.gen-grupo-sel { height: 36px; }
.gen-preview { margin-top: 20px; }
.gprev-hint { font-size: 13px; color: var(--muted); text-align: center; padding: 20px 0; }
.gprev-summary {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--line-soft); border-radius: 8px;
  font-size: 13px; margin-bottom: 16px;
}
.gprev-cnt { font-weight: 600; padding: 2px 8px; border-radius: 100px; font-size: 12px; }
.gprev-cnt-P  { background: var(--s-p-bg);  color: var(--s-p);  }
.gprev-cnt-A  { background: var(--s-a-bg);  color: var(--s-a);  }
.gprev-cnt-T  { background: var(--s-t-bg);  color: var(--s-t);  }
.gprev-cnt-EA { background: var(--s-ea-bg); color: var(--s-ea); }
.gprev-cnt-nr { background: var(--line);    color: var(--muted); }
.gprev-nivel { font-size: 11px; font-weight: 700; text-transform: uppercase;
               letter-spacing: .5px; color: var(--muted); margin: 16px 0 6px; }
.gprev-hr-hdr {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: 8px 8px 0 0; border-bottom: none; margin-top: 6px;
}
.gprev-hr-name { font-weight: 700; font-size: 13px; }
.gprev-hr-meta { font-size: 11px; color: var(--muted); flex: 1; }
.gprev-done    { font-size: 11px; color: var(--s-p); font-weight: 600; }
.gprev-pending { font-size: 11px; color: var(--s-t); }
.gprev-rows { border: 1px solid var(--line); border-radius: 0 0 8px 8px; overflow: hidden; }
.gprev-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px;
  border-bottom: 1px solid var(--line-soft); background: var(--card);
}
.gprev-row:last-child { border-bottom: none; }
.gprev-ini {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
}
.gprev-name  { flex: 1; font-size: 13px; }
.gprev-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 100px; }
.gprev-badge-P  { background: var(--s-p-bg);  color: var(--s-p);  }
.gprev-badge-A  { background: var(--s-a-bg);  color: var(--s-a);  }
.gprev-badge-T  { background: var(--s-t-bg);  color: var(--s-t);  }
.gprev-badge-EA { background: var(--s-ea-bg); color: var(--s-ea); }
.gprev-badge-EP { background: var(--s-ep-bg); color: var(--s-ep); }
.gprev-badge-nr { background: var(--line);    color: var(--muted); }

/* ==========================================================================
   PRINT — individual student report
   ========================================================================== */
@media print {
  .topbar, .bottom-nav, .report-tabs,
  #btn-export-pdf, #btn-indiv-back, #rpt-student-search,
  .page:not(#page-reports), #report-group { display: none !important; }
  #page-reports, #report-individual { display: block !important; }
  #report-individual { padding: 0 !important; }
  body { background: #fff; }
  .indiv-stat-grid { break-inside: avoid; }
  .absence-list { break-inside: avoid; }
}

/* ==========================================================================
   PAGE: NOVEDADES (page-obs)
   ========================================================================== */

.obs-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 8px;
}
.obs-card-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.obs-card-extra {
  font-size: 13px; font-weight: 600; color: var(--brand);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.obs-card-student { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.obs-card-tipo  { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.obs-card-desc  { font-size: 13px; color: var(--ink); margin: 4px 0; line-height: 1.5; }
.obs-coord-comment {
  font-size: 13px; background: var(--line-soft); border-radius: 6px;
  padding: 6px 10px; margin-top: 6px; color: var(--ink);
}
.obs-comment-label { font-weight: 600; margin-right: 4px; }
.obs-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; gap: 8px;
}
.obs-card-meta { font-size: 12px; color: var(--muted); }

.obs-badge {
  flex-shrink: 0; font-size: 11px; font-weight: 700;
  padding: 2px 9px; border-radius: 100px;
}
.obs-badge-pending { background: #fff3cd; color: #92600a; }
.obs-badge-done    { background: var(--s-p-bg); color: var(--s-p); }

/* Review modal info block */
.obs-review-info { display: flex; flex-direction: column; gap: 4px; }
.obs-review-info p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink); }

/* Textarea reutilizable */
.obs-textarea {
  width: 100%; resize: vertical; min-height: 80px;
  padding: 8px 10px; height: auto;
}

/* field-group spacing inside modals */
.field-group { display: flex; flex-direction: column; gap: 6px; }

/* ==========================================================================
   PAGE: EXTRACURRICULARES
   ========================================================================== */
.extra-day-filter {
  margin-bottom: 12px;
}
.extra-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.extra-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s;
}
.extra-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft, #f0f4ff);
}
.extra-chip-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}
.extra-chip-days {
  font-size: 11px;
  color: var(--muted);
}

/* Search bar (coord only) */
.extra-search-box {
  position: relative;
  margin-bottom: 14px;
}
.extra-search-input {
  width: 100%;
  box-sizing: border-box;
}
.extra-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.10);
  z-index: 50;
  max-height: 360px;
  overflow-y: auto;
}
.sr-loading, .sr-empty {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
}
.sr-student {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.sr-student:last-child { border-bottom: none; }
.sr-student-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.sr-student-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.sr-student-code {
  font-size: 11px;
  color: var(--muted);
}
.sr-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.sr-row:last-child { margin-bottom: 0; }
.sr-extra-name {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sr-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.sr-badge.sr-P    { background: #dcfce7; color: #166534; }
.sr-badge.sr-A    { background: #fee2e2; color: #991b1b; }
.sr-badge.sr-T    { background: #fef9c3; color: #854d0e; }
.sr-badge.sr-none { background: var(--surface); color: var(--muted); }

/* ---------- Ausencias futuras ---------- */
.fa-form { display: flex; flex-direction: column; gap: 12px; padding: 14px; margin-bottom: 18px; }
.fa-results { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.fa-picked { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--line-soft); font-size: 14px; font-weight: 600; }
.fa-picked button { border: 0; background: none; font-size: 16px; cursor: pointer; color: var(--muted); }
.fa-subtitle { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; margin: 0 0 8px; }
.fa-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; background: #fff; }
.fa-row-info { min-width: 0; flex: 1; }
.fa-row-name { font-size: 14px; font-weight: 600; }
.fa-row-meta { font-size: 12px; color: var(--muted); }
.fa-del { border: 0; background: none; color: #991b1b; font-size: 13px; font-weight: 600; cursor: pointer; }
.fa-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.fa-month-label { font-size: 15px; font-weight: 700; text-transform: capitalize; }
.fa-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.fa-wd { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.fa-day { height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink); }
.fa-day:hover:not(:disabled) { border-color: #a00000; }
.fa-day.sel { background: #a00000; border-color: #a00000; color: #fff; }
.fa-day.reg { background: #fee2e2; border-color: #fecaca; color: #991b1b; }
.fa-day:disabled { background: var(--line-soft); color: #bbb; cursor: default; border-color: transparent; }
.fa-day.reg:disabled { color: #991b1b; }
.fa-legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.fa-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 8px; }
.fa-dot:first-child { margin-left: 0; }
.fa-dot-sel { background: #a00000; }
.fa-dot-reg { background: #fecaca; }
.fa-cal-wrap { max-width: 340px; margin: 0 auto; width: 100%; }
.fa-form .text-input {
  flex: none; width: 100%; height: 44px; padding: 0 14px; font-size: 14px; font-family: inherit;
  background: #f9fafb; border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.fa-form .text-input::placeholder { color: #9ca3af; }
.fa-form .text-input:focus { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(150,14,11,.12); }
#fa-search {
  padding-left: 40px;
  background: #f9fafb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 12px center;
}
#fa-search:focus { background-color: #fff; }
.fa-form .field-group { gap: 6px; }
.fa-form .btn-primary { height: 44px; border-radius: 10px; font-size: 14px; }
