/* ========================================
   TuniCheck – Custom CSS
   Centro Tunivers
   ======================================== */

/* ---------- Variables ---------- */
:root {
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a8a;

  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;

  --red-50:  #fef2f2;
  --red-100: #fee2e2;
  --red-400: #f87171;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;

  --yellow-50:  #fefce8;
  --yellow-100: #fef9c3;
  --yellow-400: #facc15;
  --yellow-500: #eab308;
  --yellow-600: #ca8a04;

  --purple-100: #f3e8ff;
  --purple-600: #9333ea;
  --purple-700: #7e22ce;

  --orange-100: #ffedd5;
  --orange-500: #f97316;
  --orange-600: #ea580c;

  --teal-100: #ccfbf1;
  --teal-600: #0d9488;

  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --sidebar-w: 260px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1), 0 2px 4px rgba(0,0,0,.06);
  --transition: 150ms ease;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ========================================
   LAYOUT
   ======================================== */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--blue-700) 0%, var(--blue-900) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
}
.sidebar-brand:hover { opacity: .88; }

.sidebar-brand img {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.sidebar-brand-name { font-size: 1.2rem; font-weight: 700; }
.sidebar-brand-sub  { font-size: .75rem; color: rgba(255,255,255,.6); }

.sidebar-nav { flex: 1; padding: 16px 12px; }

.sidebar-section-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.45);
  padding: 4px 12px 8px;
  margin-top: 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  color: rgba(255,255,255,.75);
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-link:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.sidebar-link.active { background: rgba(255,255,255,.2); color: #fff; }

.sidebar-divider { border: 0; border-top: 1px solid rgba(255,255,255,.1); margin: 10px 0; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.1);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  margin-bottom: 8px;
}

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

.sidebar-user-name { font-size: .875rem; font-weight: 600; color: #fff; }
.sidebar-user-role { font-size: .75rem; color: rgba(255,255,255,.55); text-transform: capitalize; }

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  color: rgba(255,255,255,.65);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-family: inherit;
}
.btn-logout svg { width: 16px; height: 16px; }
.btn-logout:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ---------- Main ---------- */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 1.15rem; font-weight: 700; color: var(--gray-800); }
.topbar-date  { font-size: .8rem; color: var(--gray-400); }

.page-content { flex: 1; padding: 32px; }

/* ========================================
   ALERTS
   ======================================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: .875rem;
  margin-bottom: 24px;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.alert-success { background: var(--green-50); border: 1px solid #bbf7d0; color: #166534; }
.alert-success svg { color: var(--green-600); }

.alert-error { background: var(--red-50); border: 1px solid #fecaca; color: #991b1b; }
.alert-error svg { color: var(--red-500); }

.alert-warning { background: var(--yellow-50); border: 1px solid #fde68a; color: #92400e; }
.alert-warning svg { color: var(--yellow-500); }

.alert-info { background: var(--blue-50); border: 1px solid var(--blue-100); color: #1e40af; }
.alert-info svg { color: var(--blue-600); }

/* ========================================
   CARDS
   ======================================== */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title { font-size: 1rem; font-weight: 700; color: var(--gray-800); }
.card-subtitle { font-size: .8rem; color: var(--gray-400); margin-top: 2px; }

.card-body  { padding: 24px; }
.card-footer{ padding: 16px 24px; border-top: 1px solid var(--gray-100); }

/* ---------- Stat cards ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.stat-label { font-size: .75rem; color: var(--gray-500); margin-bottom: 4px; }
.stat-value { font-size: 2rem; font-weight: 800; }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-icon svg { width: 22px; height: 22px; }

.stat-blue   .stat-value { color: var(--blue-700); }
.stat-blue   .stat-icon  { background: var(--blue-100); color: var(--blue-600); }
.stat-green  .stat-value { color: var(--green-700); }
.stat-green  .stat-icon  { background: var(--green-100); color: var(--green-600); }
.stat-purple .stat-value { color: var(--purple-700); }
.stat-purple .stat-icon  { background: var(--purple-100); color: var(--purple-600); }
.stat-orange .stat-value { color: var(--orange-600); }
.stat-orange .stat-icon  { background: var(--orange-100); color: var(--orange-500); }
.stat-teal   .stat-value { color: var(--teal-600); }
.stat-teal   .stat-icon  { background: var(--teal-100); color: var(--teal-600); }

/* ---------- Quick action cards ---------- */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.action-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--gray-800);
  transition: box-shadow var(--transition), transform var(--transition);
}
.action-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; }

.action-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.action-icon svg { width: 22px; height: 22px; }

.action-blue   .action-icon { background: var(--blue-100); color: var(--blue-600); }
.action-green  .action-icon { background: var(--green-100); color: var(--green-600); }
.action-orange .action-icon { background: var(--orange-100); color: var(--orange-500); }
.action-card:hover .action-icon { filter: brightness(1.1); }

.action-title { font-weight: 600; font-size: .9rem; margin-bottom: 2px; }
.action-desc  { font-size: .75rem; color: var(--gray-500); }

/* ========================================
   SUBJECT CARDS
   ======================================== */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.subject-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}
.subject-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }

.subject-card-bar { height: 5px; flex-shrink: 0; }
.subject-card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.subject-card-name { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; color: var(--gray-800); }
.subject-card-desc { font-size: .8rem; color: var(--gray-500); margin-bottom: 14px; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.subject-card-meta {
  display: flex;
  gap: 14px;
  font-size: .8rem;
  color: var(--gray-600);
  margin-bottom: 14px;
}
.subject-card-meta span { display: flex; align-items: center; gap: 5px; }
.subject-card-meta svg { width: 14px; height: 14px; color: var(--gray-400); }

.subject-card-teachers { margin-bottom: 14px; }
.subject-card-teachers-label { font-size: .65rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gray-400); margin-bottom: 6px; }
.subject-card-no-teacher { font-size: .8rem; color: var(--gray-400); font-style: italic; }

.subject-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--gray-100);
}

/* ========================================
   BADGES & TAGS
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-blue   { background: var(--blue-100);   color: var(--blue-700); }
.badge-green  { background: var(--green-100);  color: var(--green-700); }
.badge-red    { background: var(--red-100);    color: var(--red-600); }
.badge-yellow { background: var(--yellow-100); color: var(--yellow-600); }
.badge-purple { background: var(--purple-100); color: var(--purple-700); }
.badge-orange { background: var(--orange-100); color: var(--orange-600); }
.badge-gray   { background: var(--gray-100);   color: var(--gray-600); }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 500;
  margin-right: 4px;
  margin-bottom: 4px;
}
.tag-purple { background: var(--purple-100); color: var(--purple-700); }
.tag-green  { background: var(--green-100);  color: var(--green-700); }
.tag-blue   { background: var(--blue-100);   color: var(--blue-700); }

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  text-decoration: none;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn svg { width: 15px; height: 15px; }

.btn-primary   { background: var(--blue-600); color: #fff; box-shadow: 0 1px 4px rgba(37,99,235,.3); }
.btn-primary:hover { background: var(--blue-700); }

.btn-success   { background: var(--green-600); color: #fff; box-shadow: 0 1px 4px rgba(22,163,74,.3); }
.btn-success:hover { background: var(--green-700); }

.btn-danger    { background: var(--red-600); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-orange    { background: var(--orange-500); color: #fff; box-shadow: 0 1px 4px rgba(249,115,22,.3); }
.btn-orange:hover { background: var(--orange-600); }

.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }

.btn-ghost     { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-300); }
.btn-ghost:hover { background: var(--gray-50); }

.btn-sm { padding: 6px 12px; font-size: .78rem; }
.btn-xs { padding: 4px 9px; font-size: .72rem; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--gray-500);
  transition: background var(--transition), color var(--transition);
  font-family: inherit;
}
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon:hover { background: var(--gray-100); color: var(--gray-700); }
.btn-icon.edit:hover  { background: var(--blue-50);  color: var(--blue-600); }
.btn-icon.del:hover   { background: var(--red-50);   color: var(--red-600); }

/* ========================================
   TABLES
   ======================================== */
.table-wrap {
  overflow-x: auto;
}

table.tc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.tc-table thead {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.tc-table th {
  padding: 11px 20px;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--gray-500);
  white-space: nowrap;
}

.tc-table th.text-center,
.tc-table td.text-center { text-align: center; }

.tc-table th.text-right,
.tc-table td.text-right  { text-align: right; }

.tc-table td {
  padding: 12px 20px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
}

.tc-table tr:last-child td { border-bottom: 0; }
.tc-table tbody tr:hover { background: var(--gray-50); }

.table-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--gray-400);
  font-size: .9rem;
}

/* ---------- User cell ---------- */
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell .avatar { flex-shrink: 0; }
.user-cell-name  { font-weight: 600; color: var(--gray-800); font-size: .875rem; }
.user-cell-email { font-size: .75rem; color: var(--gray-400); }

/* ========================================
   FORMS
   ======================================== */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-label .required { color: var(--red-500); margin-left: 2px; }
.form-label .optional  { font-weight: 400; color: var(--gray-400); font-size: .8rem; }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  color: var(--gray-800);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-input.error, .form-select.error { border-color: var(--red-500); }

.form-textarea { resize: vertical; min-height: 90px; }

.form-hint  { font-size: .75rem; color: var(--gray-400); margin-top: 4px; }
.form-error { font-size: .75rem; color: var(--red-600); margin-top: 4px; }

.form-color-row { display: flex; align-items: center; gap: 10px; }
input[type="color"] {
  width: 44px;
  height: 38px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 2px;
  background: #fff;
}

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.checkbox-list {
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  font-size: .875rem;
  transition: background var(--transition);
}
.checkbox-item:last-child { border-bottom: 0; }
.checkbox-item:hover { background: var(--gray-50); }
.checkbox-item input[type="checkbox"] { accent-color: var(--blue-600); width: 15px; height: 15px; }
.checkbox-item-sub { font-size: .75rem; color: var(--gray-400); margin-left: auto; }
.checkbox-empty { padding: 14px; font-size: .85rem; color: var(--gray-400); text-align: center; }

.form-actions { display: flex; gap: 10px; margin-top: 28px; }

/* ---------- Toolbar (search + actions) ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.toolbar-left  { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; flex: 1; }
.toolbar-right { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.search-input {
  padding: 8px 13px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  min-width: 220px;
  font-family: inherit;
  color: var(--gray-800);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* ========================================
   PROGRESS BAR
   ======================================== */
.progress-wrap { display: flex; align-items: center; gap: 10px; }
.progress-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .4s ease;
}
.progress-bar-fill.green  { background: var(--green-500); }
.progress-bar-fill.yellow { background: var(--yellow-500); }
.progress-bar-fill.red    { background: var(--red-500); }
.progress-pct { font-size: .85rem; font-weight: 700; color: var(--gray-700); min-width: 40px; text-align: right; }

/* ========================================
   ATTENDANCE BUTTONS
   ======================================== */
.att-group { display: flex; gap: 6px; }

.att-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--gray-100);
  color: var(--gray-500);
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.att-btn:hover { filter: brightness(.93); }

.att-btn.active-present  { background: var(--green-500);  color: #fff; border-color: #16a34a;  box-shadow: 0 0 0 3px rgba(34,197,94,.25); }
.att-btn.active-absent   { background: var(--red-500);    color: #fff; border-color: #dc2626;  box-shadow: 0 0 0 3px rgba(239,68,68,.25); }
.att-btn.active-late     { background: var(--yellow-500); color: #fff; border-color: #ca8a04;  box-shadow: 0 0 0 3px rgba(234,179,8,.25); }
.att-btn.active-justified{ background: var(--blue-500);   color: #fff; border-color: #2563eb;  box-shadow: 0 0 0 3px rgba(59,130,246,.25); }

/* ========================================
   ATTENDANCE LEGEND
   ======================================== */
.att-legend-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.att-legend-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-400);
  white-space: nowrap;
  flex-shrink: 0;
}
.att-legend-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.att-legend-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  font-size: .8rem;
  font-weight: 500;
}
.att-pill-key {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.att-pill-desc { color: var(--gray-600); }
.pill-p { background: var(--green-50); }
.pill-p .att-pill-key { background: var(--green-500); }
.pill-p .att-pill-desc { color: var(--green-700); }
.pill-f { background: var(--red-50); }
.pill-f .att-pill-key { background: var(--red-500); }
.pill-f .att-pill-desc { color: var(--red-600); }
.pill-t { background: var(--yellow-50); }
.pill-t .att-pill-key { background: var(--yellow-500); }
.pill-t .att-pill-desc { color: var(--yellow-600); }
.pill-j { background: var(--blue-50); }
.pill-j .att-pill-key { background: var(--blue-500); }
.pill-j .att-pill-desc { color: var(--blue-600); }

/* ========================================
   ENROLLMENT LIST
   ======================================== */
.enrollment-list { }
.enrollment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--gray-100);
}
.enrollment-item:last-child { border-bottom: 0; }
.enrollment-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--gray-400);
  font-size: .875rem;
}

/* ========================================
   PAGINATION
   ======================================== */
.pagination-wrap { padding: 0; }

.tc-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  gap: 16px;
  flex-wrap: wrap;
}

.tc-pagination-info {
  font-size: .8rem;
  color: var(--gray-500);
}
.tc-pagination-info strong { color: var(--gray-700); }

.tc-pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tc-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 500;
  border: 1px solid var(--gray-200);
  background: #fff;
  color: var(--gray-600);
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  cursor: pointer;
  user-select: none;
}
.tc-page-btn:hover { background: var(--blue-50); border-color: var(--blue-300); color: var(--blue-700); text-decoration: none; }
.tc-page-btn.active { background: var(--blue-600); border-color: var(--blue-600); color: #fff; font-weight: 700; cursor: default; }
.tc-page-btn.disabled { background: var(--gray-50); border-color: var(--gray-100); color: var(--gray-300); cursor: not-allowed; }
.tc-page-btn svg { display: block; }

/* ========================================
   SESSION HISTORY TABLE
   ======================================== */
.history-row td { font-size: .875rem; }

/* ========================================
   INFO BOX (import instructions)
   ======================================== */
.info-box {
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}
.info-box-icon { flex-shrink: 0; color: var(--blue-500); }
.info-box-icon svg { width: 22px; height: 22px; }
.info-box h3 { font-size: .95rem; font-weight: 700; color: var(--blue-800); margin-bottom: 8px; }
.info-box p  { font-size: .85rem; color: var(--blue-700); margin-bottom: 10px; }
.info-box a  { color: var(--blue-700); font-weight: 600; }

.info-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.info-table thead { background: var(--blue-100); }
.info-table th { padding: 7px 12px; text-align: left; font-weight: 600; color: var(--blue-800); }
.info-table td { padding: 7px 12px; border-bottom: 1px solid var(--blue-50); color: var(--gray-600); }
.info-table tr:last-child td { border-bottom: 0; }
.info-table td:first-child { font-family: monospace; font-weight: 700; color: var(--gray-800); }

code {
  background: var(--gray-100);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: .85em;
  font-family: monospace;
}

/* File input */
.file-input-wrap { position: relative; }
input[type="file"] {
  display: block;
  width: 100%;
  font-size: .875rem;
  color: var(--gray-600);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  background: #fff;
  cursor: pointer;
}

/* ========================================
   STUDENT SUBJECT CARD
   ======================================== */
.student-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.student-stat-cell {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  text-align: center;
}
.student-stat-num  { font-size: 1.3rem; font-weight: 800; }
.student-stat-label{ font-size: .72rem; color: var(--gray-500); }
.student-stat-num.green  { color: var(--green-600); }
.student-stat-num.red    { color: var(--red-600); }
.student-stat-num.gray   { color: var(--gray-700); }

/* ========================================
   SUBJECT SHOW (teacher)
   ======================================== */
.subject-topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.hours-form {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .875rem;
  color: var(--gray-600);
}
.hours-form input { width: 80px; padding: 7px 10px; font-size: .875rem; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-family: inherit; }
.hours-form input:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }

/* ========================================
   DATE/HOUR selector
   ======================================== */
.att-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}
.att-selector .form-group { margin-bottom: 0; }

/* ========================================
   QUICK SELECT (attendance)
   ======================================== */
.att-quick { display: flex; gap: 8px; }

/* ========================================
   LOGIN PAGE
   ======================================== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--blue-700) 0%, var(--blue-900) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  overflow: hidden;
}

.login-header {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-800));
  padding: 40px 32px;
  text-align: center;
}

.login-logo {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  object-fit: cover;
  margin: 0 auto 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
}

.login-title { font-size: 1.8rem; font-weight: 800; color: #fff; }
.login-sub   { font-size: .85rem; color: rgba(255,255,255,.65); margin-top: 4px; }

.login-body  { padding: 32px; }

.login-footer {
  text-align: center;
  color: rgba(255,255,255,.5);
  font-size: .78rem;
  margin-top: 24px;
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
}
.empty-state svg { width: 64px; height: 64px; color: var(--gray-200); margin-bottom: 16px; }
.empty-state p { color: var(--gray-400); font-size: .9rem; }
.empty-state a { color: var(--blue-600); }

/* ========================================
   MISC
   ======================================== */
.divider { border: 0; border-top: 1px solid var(--gray-200); margin: 20px 0; }

.text-muted  { color: var(--gray-400); }
.text-small  { font-size: .8rem; }
.font-mono   { font-family: monospace; }
.font-bold   { font-weight: 700; }

.mt-4  { margin-top: 16px; }
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .form-grid-2, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .subjects-grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .drive-cycles-grid, .drive-files-grid { grid-template-columns: 1fr; }
}

/* ========================================
   ABSENCE LIMIT ALERTS (20% rule)
   ======================================== */
.absence-alert {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  border-radius: var(--radius-sm);
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 8px 10px;
  margin-bottom: 12px;
}
.absence-alert svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

.absence-alert-danger  { background: var(--red-50);    color: var(--red-600);    border: 1px solid #fca5a5; }
.absence-alert-warning { background: var(--yellow-50); color: var(--yellow-600); border: 1px solid #fcd34d; }

.subject-card-danger  { outline: 2px solid #fca5a5; }
.subject-card-warning { outline: 2px solid #fcd34d; }

/* Table row highlight */
.row-danger  { background: #fff5f5 !important; }
.row-warning { background: #fffbeb !important; }

/* ========================================
   ATTENDANCE GRID (multi-hour columns)
   ======================================== */
.att-grid-scroll {
  overflow-x: auto;
  overflow-y: visible;
  border-top: 1px solid var(--gray-200);
}

.att-grid-table {
  border-collapse: collapse;
  min-width: max-content;
  width: 100%;
}

.att-grid-table th,
.att-grid-table td {
  border-right: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
}
.att-grid-table th:last-child,
.att-grid-table td:last-child { border-right: 0; }

/* Sticky student column */
.att-gcol-name {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--gray-50);
  min-width: 230px;
  padding: 10px 16px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .05em;
  box-shadow: 2px 0 6px rgba(0,0,0,.06);
}

/* Hour column headers */
.att-gcol-hour {
  min-width: 116px;
  background: var(--gray-50);
  padding: 8px 8px 6px;
  text-align: center;
  vertical-align: top;
  transition: background .15s, opacity .15s;
}

.att-hour-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--gray-700);
  cursor: pointer;
  white-space: nowrap;
}

.att-hour-toggle {
  width: 13px;
  height: 13px;
  accent-color: var(--blue-600);
  cursor: pointer;
  flex-shrink: 0;
}

.att-saved-dot {
  color: var(--green-500);
  font-size: .55rem;
  line-height: 1;
}

.att-col-actions {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-top: 5px;
}

.att-cq {
  width: 22px;
  height: 18px;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 3px;
  border: 1.5px solid;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: filter .1s;
}
.att-cq:hover { filter: brightness(.9); }
.att-cq-p { background: var(--green-100); border-color: #86efac; color: var(--green-700); }
.att-cq-f { background: var(--red-100);   border-color: #fca5a5; color: var(--red-600); }

/* Inactive hour column */
.att-gcol-hour.att-hour-inactive,
.att-gcell.att-hour-inactive {
  opacity: .28;
  pointer-events: none;
}
.att-gcol-hour.att-hour-inactive .att-hour-toggle {
  pointer-events: all;
}
.att-gcol-hour.att-hour-inactive .att-hour-label {
  pointer-events: all;
}

/* Sticky student name cells */
.att-gname-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  box-shadow: 2px 0 6px rgba(0,0,0,.04);
  padding: 10px 16px;
}
.att-grid-row:hover .att-gname-cell,
.att-grid-row:hover .att-gcell { background: #f8faff; }

/* Attendance cells */
.att-gcell {
  padding: 8px 6px;
  text-align: center;
  vertical-align: middle;
}

/* Group of 4 P/F/T/J buttons inside a cell */
.att-ggroup {
  display: flex;
  gap: 2px;
  justify-content: center;
}

.att-gbtn {
  width: 24px;
  height: 26px;
  font-size: .65rem;
  font-weight: 700;
  border: 1.5px solid var(--gray-200);
  border-radius: 4px;
  background: #fff;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0;
  transition: all .1s;
  line-height: 1;
  font-family: inherit;
}
.att-gbtn:hover { filter: brightness(.92); }

.att-gbtn.active-present  { background: var(--green-500); border-color: #16a34a; color: #fff; }
.att-gbtn.active-absent   { background: var(--red-500);   border-color: #dc2626; color: #fff; }
.att-gbtn.active-late     { background: var(--yellow-500); border-color: #ca8a04; color: #fff; }
.att-gbtn.active-justified{ background: var(--blue-500);  border-color: #2563eb; color: #fff; }

/* ========================================
   DRIVE — Shared Library
   ======================================== */
.drive-cycles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.drive-cycle-card {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s, transform .15s;
}
.drive-cycle-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: inherit;
}

.drive-cycle-bar { height: 5px; flex-shrink: 0; }

.drive-cycle-body { padding: 20px; flex: 1; display: flex; flex-direction: column; gap: 6px; }

.drive-cycle-icon svg {
  width: 44px;
  height: 44px;
  margin-bottom: 4px;
}

.drive-cycle-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
  line-height: 1.3;
}

.drive-cycle-desc {
  font-size: .8rem;
  color: var(--gray-500);
  line-height: 1.4;
}

.drive-cycle-meta {
  margin-top: auto;
  padding-top: 10px;
  font-size: .75rem;
  color: var(--gray-400);
  display: flex;
  align-items: center;
  gap: 4px;
}
.drive-cycle-meta svg { width: 13px; height: 13px; }

/* File grid */
.drive-files-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drive-file-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow .12s, background .12s;
}
.drive-file-card:hover { background: var(--gray-50); box-shadow: var(--shadow-sm); }

.drive-file-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.drive-file-icon svg { width: 22px; height: 22px; }

.drive-icon-pdf     { background: #fef2f2; color: #dc2626; }
.drive-icon-word    { background: #eff6ff; color: #2563eb; }
.drive-icon-excel   { background: #f0fdf4; color: #16a34a; }
.drive-icon-ppt     { background: #fff7ed; color: #ea580c; }
.drive-icon-image   { background: #faf5ff; color: #9333ea; }
.drive-icon-video   { background: #fdf4ff; color: #a21caf; }
.drive-icon-zip     { background: #fefce8; color: #ca8a04; }
.drive-icon-file    { background: var(--gray-100); color: var(--gray-500); }

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

.drive-file-name {
  font-weight: 600;
  font-size: .9rem;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drive-file-desc {
  font-size: .78rem;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.drive-file-meta {
  font-size: .72rem;
  color: var(--gray-400);
  margin-top: 4px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.drive-file-orig {
  font-size: .68rem;
  color: var(--gray-300);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drive-file-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Upload zone */
.drive-upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drive-upload-zone:hover,
.drive-upload-zone.drag-over {
  border-color: var(--blue-500);
  background: var(--blue-50);
}
.drive-upload-zone svg {
  width: 36px;
  height: 36px;
  color: var(--gray-400);
  margin: 0 auto 8px;
  display: block;
}
.drive-upload-zone p { margin: 0 0 4px; font-size: .875rem; color: var(--gray-600); }
.upload-link {
  color: var(--blue-600);
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  text-decoration: underline;
}

/* ========================================
   DRIVE BROWSER v2 (folders + context menu)
   ======================================== */
.drive-browser {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.drive-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
  flex-wrap: wrap;
}

.drive-breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
}
.drive-bc-link {
  font-size: .82rem;
  color: var(--blue-600);
  text-decoration: none;
  font-weight: 500;
}
.drive-bc-link:hover { text-decoration: underline; }
.drive-bc-active { color: var(--gray-700) !important; font-weight: 600; cursor: default; }
.drive-bc-active:hover { text-decoration: none; }
.drive-bc-sep { font-size: .75rem; color: var(--gray-400); }

.drive-search-form {
  display: flex;
  align-items: center;
  gap: 6px;
}
.drive-search-input {
  padding: 6px 10px 6px 30px;
  font-size: .82rem;
  height: 32px;
  width: 220px;
}

.drive-hint-bar {
  padding: 8px 16px;
  background: #eff6ff;
  border-bottom: 1px solid #dbeafe;
  font-size: .75rem;
  color: #1d4ed8;
  display: flex;
  align-items: center;
  gap: 6px;
}
.drive-hint-bar svg { width: 13px; height: 13px; flex-shrink: 0; }

.drive-content {
  min-height: 360px;
  padding: 20px;
  user-select: none;
}

/* Section labels */
.drive-section-label {
  font-size: .7rem;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 10px;
}

/* ── Folders ── */
.drive-folders-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.drive-folder-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  transition: background .12s, border-color .12s, box-shadow .12s;
  position: relative;
  min-width: 150px;
  max-width: 260px;
}
.drive-folder-chip:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  box-shadow: var(--shadow-sm);
}
.drive-folder-chip.selected {
  background: #eff6ff;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 2px rgba(59,130,246,.18);
}
.drive-folder-chip.drive-drop-target {
  background: #fefce8;
  border-color: var(--yellow-400);
  box-shadow: 0 0 0 3px rgba(250,204,21,.35);
  transform: scale(1.04);
  transition: transform .1s, box-shadow .1s;
}
.drive-folder-chip.drive-moving {
  opacity: .6;
  pointer-events: none;
}
.drive-folder-chip.drive-dragging,
.drive-file-row2.drive-dragging {
  opacity: .35;
}
/* Prevent text/icon selection during drag */
.drive-folder-chip, .drive-file-row2 {
  user-select: none;
  -webkit-user-drag: none;
}
.drive-folder-chip *, .drive-file-row2 * {
  user-select: none;
}

.drive-folder-chip-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.drive-folder-chip-icon svg { width: 28px; height: 28px; }

.drive-folder-chip-name {
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-800);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-folder-chip-count {
  font-size: .68rem;
  background: var(--gray-100);
  color: var(--gray-500);
  border-radius: 20px;
  padding: 1px 7px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ── Files list ── */
.drive-file-row2 {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .1s;
}
.drive-file-row2:hover { background: var(--gray-50); }
.drive-file-row2.selected {
  background: #eff6ff;
  outline: 1px solid var(--blue-200);
  outline-offset: -1px;
}

.drive-file-row2-icon {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.drive-file-row2-icon svg { width: 18px; height: 18px; }

.drive-file-row2-info { flex: 1; min-width: 0; }
.drive-file-row2-name {
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drive-file-row2-desc {
  font-size: .72rem;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drive-file-row2-meta {
  font-size: .7rem;
  color: var(--gray-400);
  display: flex;
  gap: 5px;
  flex-shrink: 0;
  white-space: nowrap;
}
.drive-file-row2-actions { flex-shrink: 0; }

/* ── Empty state ── */
.drive-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 8px;
  color: var(--gray-400);
}
.drive-empty svg { width: 56px; height: 56px; }
.drive-empty p { margin: 0; font-size: .9rem; }

/* ── Selection bar ── */
.drive-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: var(--blue-50);
  border: 1px solid var(--blue-200);
  border-radius: 8px;
  margin-bottom: 12px;
  animation: slideDown .15s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.drive-selection-count {
  font-size: .84rem;
  font-weight: 600;
  color: var(--blue-700);
}
.drive-selection-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Context menu ── */
.ctx-menu {
  position: fixed;
  z-index: 9998;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.14);
  min-width: 200px;
  padding: 5px 0;
  overflow: hidden;
}
.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: .84rem;
  color: var(--gray-700);
  cursor: pointer;
  transition: background .1s;
}
.ctx-item:hover { background: var(--gray-100); }
.ctx-item svg { flex-shrink: 0; }
.ctx-separator { height: 1px; background: var(--gray-100); margin: 3px 0; }
.ctx-danger { color: var(--red-600) !important; }
.ctx-danger:hover { background: var(--red-50) !important; }

/* ── Drive modals ── */
.drive-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.drive-modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  animation: modalIn .18s ease;
}
.drive-modal-lg { max-width: 580px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(-8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}

.drive-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  font-weight: 700;
  font-size: .95rem;
  color: var(--gray-800);
  border-bottom: 1px solid var(--gray-100);
}
.drive-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--gray-400);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.drive-modal-close:hover { background: var(--gray-100); color: var(--gray-700); }

.drive-modal-body { padding: 20px; }
.drive-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

/* ── Color palette ── */
.drive-color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
  flex-shrink: 0;
}
.color-swatch:hover { transform: scale(1.2); }
.color-swatch.selected {
  border-color: var(--gray-800);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--gray-700);
  transform: scale(1.15);
}

/* ========================================
   SIDEBAR USER LINK
   ======================================== */
.sidebar-user-link {
  text-decoration: none;
  border-radius: 8px;
  transition: background .15s;
  cursor: pointer;
}
.sidebar-user-link:hover { background: rgba(255,255,255,.1); }
.sidebar-user-link.active { background: rgba(255,255,255,.12); }

/* ========================================
   MFA SETUP PAGE
   ======================================== */
.mfa-setup-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}
.mfa-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .875rem;
  color: var(--gray-600);
}
.mfa-step-num {
  width: 22px;
  height: 22px;
  background: var(--blue-600);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.mfa-qr-wrap {
  display: flex;
  justify-content: center;
  padding: 20px 0;
}
.mfa-qr-wrap img, .mfa-qr-wrap canvas {
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--gray-200);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.mfa-secret-toggle {
  font-size: .8rem;
  color: var(--gray-500);
  cursor: pointer;
  margin-bottom: 8px;
}
.mfa-secret-toggle summary { list-style: none; }
.mfa-secret-toggle summary::-webkit-details-marker { display: none; }
.mfa-secret-toggle summary { cursor: pointer; }
.mfa-secret-key {
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--gray-100);
  border-radius: 8px;
  font-family: monospace;
  font-size: .9rem;
  letter-spacing: .08em;
  color: var(--gray-700);
  word-break: break-all;
  border: 1px solid var(--gray-200);
}

/* ========================================
   TOGGLE SWITCH
   ======================================== */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.toggle-input { display: none; }
.toggle-track {
  width: 42px;
  height: 24px;
  background: var(--gray-300);
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
  transition: background .2s;
}
.toggle-input:checked + .toggle-track { background: var(--blue-500); }
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .2s;
}
.toggle-input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }
.toggle-text { font-size: .875rem; color: var(--gray-700); }
.toggle-sub { font-size: .75rem; color: var(--gray-400); margin-left: 2px; }

/* ========================================
   RADIO LIST (docente único)
   ======================================== */
.radio-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}
.radio-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid var(--gray-100);
}
.radio-item:last-child { border-bottom: none; }
.radio-item:hover { background: var(--gray-50); }
.radio-item input[type=radio] { flex-shrink: 0; accent-color: var(--blue-600); width: 15px; height: 15px; cursor: pointer; }
.radio-item span { font-size: .875rem; color: var(--gray-700); }
.radio-item-sub { font-size: .75rem; color: var(--gray-400); margin-left: auto; }
.radio-none { font-size: .875rem; color: var(--gray-400); font-style: italic; }

/* ========================================
   Grade Book
   ======================================== */

/* Top bar */
.grade-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.grade-topbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.grade-topbar-title { font-size: 1.1rem; font-weight: 700; color: var(--gray-800); margin: 0; }

/* Empty state */
.grade-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 60px 20px;
  color: var(--gray-400);
  text-align: center;
}
.grade-empty p { margin: 0; }

/* Table wrapper — horizontal scroll */
.grade-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.grade-table {
  border-collapse: collapse;
  width: 100%;
  table-layout: auto;
  font-size: .83rem;
}

/* Header rows */
.grade-table thead th {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  border-right: 1px solid var(--gray-100);
  padding: 0;
  white-space: nowrap;
  vertical-align: middle;
}
.grade-table thead th:last-child { border-right: none; }

/* Student name column */
.grade-th-student {
  min-width: 120px;
  white-space: nowrap;
  position: relative;
  background: var(--gray-50) !important;
  border-right: 2px solid var(--gray-200) !important;
  padding: 10px 14px !important;
  font-weight: 700;
  font-size: .8rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Evaluation header */
.grade-th-eval {
  text-align: center;
  border-right: 2px solid var(--gray-200) !important;
  padding: 0 !important;
}
.grade-eval-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.grade-eval-name { font-weight: 700; color: var(--gray-800); }
.grade-eval-meta { font-size: .72rem; color: var(--gray-400); }
.grade-eval-actions { display: flex; gap: 3px; margin-left: 4px; }

/* Column header */
.grade-th-col {
  width: 92px;
  min-width: 84px;
  text-align: center;
  padding: 0 !important;
}
.grade-col-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
}
.grade-col-name {
  font-weight: 600;
  color: var(--gray-700);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
  display: block;
}
.grade-col-type {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 1px 5px;
  border-radius: 4px;
}
.grade-col-actions { display: flex; gap: 2px; }
.grade-col-exam .grade-col-type   { background: var(--blue-50); color: var(--blue-700); }
.grade-col-activity .grade-col-type { background: var(--green-50); color: var(--green-700); }

/* Eval avg + final columns */
.grade-th-eval-avg, .grade-th-final {
  width: 86px;
  min-width: 80px;
  text-align: center;
  font-weight: 700;
  color: var(--gray-500);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 8px 10px !important;
}
.grade-th-final {
  background: var(--gray-50) !important;
  border-left: 2px solid var(--gray-200) !important;
  width: 90px;
  min-width: 80px;
}

/* Body rows */
.grade-row:hover td { background: var(--blue-50); }
.grade-row td {
  border-bottom: 1px solid var(--gray-100);
  border-right: 1px solid var(--gray-100);
  padding: 0;
}
.grade-row td:last-child { border-right: none; }

/* Exam/activity column tint */
.grade-table td.grade-col-exam     { background: #f7f9ff; }
.grade-table td.grade-col-activity { background: #f4fdf6; }
.grade-row:hover td.grade-col-exam, .grade-row:hover td.grade-col-activity { background: var(--blue-50); }

/* Student cell */
.grade-td-student {
  min-width: 120px;
  background: #fff;
  border-right: 2px solid var(--gray-200) !important;
  padding: 8px 12px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Column resize handle */
.col-resizer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 8px;
  cursor: col-resize;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}
.col-resizer::after {
  content: '';
  display: block;
  width: 2px;
  height: 40%;
  border-radius: 2px;
  background: var(--gray-300);
  transition: background .15s, height .15s;
}
.col-resizer:hover::after,
.col-resizer--active::after {
  background: var(--blue-500);
  height: 60%;
}
.grade-row:hover .grade-td-student { background: var(--blue-50); }

/* Entry cell */
.grade-td-entry { padding: 4px 4px !important; text-align: center; }
.grade-cell {
  width: 72px;
  text-align: center;
  border: 1px solid var(--gray-200);
  border-radius: 5px;
  padding: 5px 4px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-800);
  background: #fff;
  transition: border-color .15s, box-shadow .15s, background .15s;
  -moz-appearance: textfield;
}
.grade-cell::-webkit-inner-spin-button,
.grade-cell::-webkit-outer-spin-button { -webkit-appearance: none; }
.grade-cell:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 2px rgba(59,130,246,.18);
  background: #fff;
}
.grade-cell::placeholder { color: var(--gray-300); font-weight: 400; }
.grade-cell-saving  { border-color: var(--yellow-400) !important; background: var(--yellow-50) !important; }
.grade-cell-saved   { border-color: var(--green-500) !important; background: var(--green-50) !important; }
.grade-cell-error   { border-color: var(--red-500) !important; background: var(--red-50) !important; }
.grade-cell-below4 {
  border-color: var(--red-400) !important;
  background: var(--red-50) !important;
  color: var(--red-700) !important;
}
.grade-cell-below4:focus {
  box-shadow: 0 0 0 2px rgba(239,68,68,.22) !important;
  border-color: var(--red-500) !important;
}
.grade-cell-recovered {
  border-color: #eab308 !important;
  background: #fffbeb !important;
  color: #92400e !important;
}
.grade-cell-recovered:focus {
  box-shadow: 0 0 0 2px rgba(234,179,8,.25) !important;
  border-color: #eab308 !important;
}

/* Eval avg cell */
.grade-td-avg {
  text-align: center;
  font-weight: 700;
  font-size: .85rem;
  color: var(--gray-600);
  padding: 0 10px !important;
  border-right: 2px solid var(--gray-200) !important;
  background: var(--gray-50);
}

/* Final grade cell */
.grade-td-final {
  text-align: center;
  background: var(--gray-50);
  border-left: 2px solid var(--gray-200) !important;
  padding: 8px 10px !important;
  min-width: 80px;
}
.grade-row:hover .grade-td-final { background: var(--blue-50); }
.grade-final-val { font-weight: 700; font-size: .9rem; }
.grade-pass { color: var(--green-600); }
.grade-fail { color: var(--red-600); }
.grade-final-recovered { color: #92400e; }
.grade-td-avg-fail {
  color: var(--red-700) !important;
  background: var(--red-50) !important;
}
.grade-td-avg-recovered {
  color: #92400e !important;
  background: #fffbeb !important;
}

/* Recovery button */
.grade-cell-wrap { position: relative; display: inline-block; }
.grade-rec-btn {
  position: absolute; top: -6px; right: -6px;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--red-600); color: #fff; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.3); z-index: 2; padding: 0;
  transition: background .15s, transform .12s;
}
.grade-rec-btn:hover { background: var(--red-700); transform: scale(1.18); }

/* Btn-icon */
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  color: var(--gray-400);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s;
}
.btn-icon:hover { background: var(--gray-100); color: var(--gray-700); }
.btn-icon-danger:hover { background: var(--red-50); color: var(--red-600); }

/* form-row-3: 3-column grid */
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
@media (max-width: 520px) { .form-row-3 { grid-template-columns: 1fr; } }

.form-hint { font-size: .78rem; color: var(--gray-400); margin-top: -8px; margin-bottom: 0; }

/* ── Grade tabs ─────────────────────────────────────────────── */
.grade-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.grade-tabs::-webkit-scrollbar { display: none; }

.grade-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 9px 18px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.grade-tab:hover { color: var(--gray-800); background: var(--gray-50); }
.grade-tab.active {
  color: var(--blue-600);
  border-bottom-color: var(--blue-600);
  background: var(--blue-50);
}
.grade-tab-summary { color: var(--gray-400); }
.grade-tab-summary.active { color: var(--purple-700); border-bottom-color: var(--purple-600); background: var(--purple-100); }

.grade-tab-panel { display: none; }
.grade-tab-panel.active { display: block; }

/* Evaluation header bar inside each tab */
.grade-eval-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.grade-eval-bar-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.grade-eval-bar-name { font-weight: 700; font-size: .95rem; color: var(--gray-800); }
.grade-eval-bar-meta { font-size: .8rem; color: var(--gray-500); }
.grade-eval-bar-meta strong { color: var(--gray-700); }
.grade-eval-bar-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Ghost danger button variant */
.btn-danger-ghost { color: var(--red-600) !important; }
.btn-danger-ghost:hover { background: var(--red-50) !important; border-color: var(--red-200) !important; }

/* Summary avg cell */
.summary-avg { text-align: center; font-weight: 600; color: var(--gray-700); }

/* ── Schedule grid (subject create/edit) ────────────────────── */
.schedule-grid-wrap { overflow-x: auto; }
.schedule-grid {
  border-collapse: collapse;
  font-size: .83rem;
}
.schedule-th-hour { width: 72px; }
.schedule-th-day {
  width: 60px;
  text-align: center;
  font-weight: 600;
  color: var(--gray-600);
  padding: 6px 8px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
}
.schedule-td-label {
  padding: 6px 10px 6px 0;
  color: var(--gray-500);
  font-size: .8rem;
  white-space: nowrap;
}
.schedule-td-cell {
  border: 1px solid var(--gray-200);
  text-align: center;
  padding: 4px;
}
.schedule-checkbox-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  cursor: pointer;
}
.schedule-checkbox { display: none; }
.schedule-checkmark {
  width: 22px;
  height: 22px;
  border: 2px solid var(--gray-300);
  border-radius: 5px;
  background: #fff;
  transition: background .12s, border-color .12s;
}
.schedule-checkbox:checked + .schedule-checkmark {
  background: var(--blue-600);
  border-color: var(--blue-600);
  background-image: url("data:image/svg+xml,%3Csvg fill='none' stroke='%23fff' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M5 13l4 4L19 7'/%3E%3C/svg%3E");
  background-size: 14px;
  background-repeat: no-repeat;
  background-position: center;
}
.schedule-td-cell:hover .schedule-checkmark { border-color: var(--blue-400); }

/* ── Group cards on teacher dashboard ───────────────────────── */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.group-att-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  transition: box-shadow .15s, transform .15s;
}
.group-att-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.09); transform: translateY(-2px); }
.group-att-bar { height: 5px; }
.group-att-body { padding: 14px 16px; }
.group-att-name { font-weight: 700; font-size: .95rem; color: var(--gray-800); margin-bottom: 3px; }
.group-att-meta { font-size: .78rem; color: var(--gray-400); margin-bottom: 12px; }
.group-att-action { font-size: .82rem; font-weight: 600; color: var(--blue-600); }

/* ── Timetable attendance view ──────────────────────────────── */
.timetable-block {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}
.timetable-block-readonly { opacity: .85; }
.timetable-block-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  flex-wrap: wrap;
}
.timetable-hour-badge {
  background: var(--blue-600);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.timetable-hour-badge-empty {
  background: var(--gray-300);
}
.timetable-subject-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}
.timetable-subject-name { font-weight: 700; color: var(--gray-800); font-size: .9rem; }
.timetable-bulk-actions { display: flex; gap: 6px; margin-left: auto; }
.timetable-empty-hour {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 8px;
  background: var(--gray-50);
  border: 1px dashed var(--gray-200);
  border-radius: 8px;
}

/* Timetable student table */
.att-timetable-table {
  width: 100%;
  border-collapse: collapse;
}
.att-timetable-table th {
  padding: 8px 14px;
  text-align: left;
  font-size: .78rem;
  font-weight: 600;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.att-timetable-row td { border-bottom: 1px solid var(--gray-100); }
.att-timetable-row:last-child td { border-bottom: none; }
.att-col-name { padding: 8px 14px; width: 220px; }
.att-btn-cell { padding: 6px 14px; }
.att-col-status { text-align: left; }

/* P/F/T/J radio buttons */
.att-status-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-weight: 700;
  font-size: .82rem;
  cursor: pointer;
  border: 2px solid transparent;
  margin-right: 4px;
  transition: background .1s, border-color .1s, color .1s;
  user-select: none;
}
.att-status-btn input { display: none; }
.att-btn-p { background: var(--gray-100); color: var(--gray-500); }
.att-btn-p.active { background: var(--green-100); color: var(--green-700); border-color: var(--green-500); }
.att-btn-f { background: var(--gray-100); color: var(--gray-500); }
.att-btn-f.active { background: var(--red-100); color: var(--red-700); border-color: var(--red-500); }
.att-btn-t { background: var(--gray-100); color: var(--gray-500); }
.att-btn-t.active { background: var(--yellow-100); color: var(--yellow-600); border-color: var(--yellow-400); }
.att-btn-j { background: var(--gray-100); color: var(--gray-500); }
.att-btn-j.active { background: var(--blue-50); color: var(--blue-600); border-color: var(--blue-400); }
.att-status-btn:hover { filter: brightness(.96); }

/* ── Teacher dashboard — group cards ────────────────────────── */
/* ========================================
   GROUP DASHBOARD CARDS
   ======================================== */
.groups-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.group-dash-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: box-shadow .15s, transform .15s;
}
.group-dash-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.10); transform: translateY(-2px); text-decoration: none; }
.group-dash-header {
  padding: 20px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.group-dash-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: rgba(255,255,255,.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: rgba(255,255,255,.92);
  margin-bottom: 4px;
  flex-shrink: 0;
}
.group-dash-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: rgba(255,255,255,.95);
  line-height: 1.2;
}
.group-dash-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  color: rgba(255,255,255,.7);
}
.group-dash-body {
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
}
.group-dash-link {
  font-size: .82rem;
  font-weight: 600;
  color: var(--blue-600);
}
.group-dash-att-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .74rem;
  font-weight: 600;
  color: var(--green-700);
  background: var(--green-50);
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 5px 10px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s;
}
.group-dash-att-btn:hover { background: var(--green-100); text-decoration: none; }

/* ========================================
   EXAM / RECOVERY CALENDAR
   ======================================== */
.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.cal-legend {
  display: flex;
  gap: 14px;
  font-size: .8rem;
  color: var(--gray-500);
}
.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cal-nav-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.cal-month-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
  min-width: 160px;
  text-align: center;
  margin: 0;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
  background: var(--gray-200);
  gap: 1px;
}
.cal-day-header {
  background: var(--gray-50);
  padding: 8px 4px;
  text-align: center;
  font-size: .72rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.cal-day-header--weekend { color: var(--gray-400); }
.cal-day {
  background: #fff;
  min-height: 108px;
  padding: 6px 5px 5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cal-day--other   { background: var(--gray-50); }
.cal-day--weekend { background: #fafafe; }
.cal-day--today   { background: var(--blue-50); }
.cal-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}
.cal-day-num {
  font-size: .78rem;
  font-weight: 600;
  color: var(--gray-600);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-day--today .cal-day-num {
  background: var(--blue-600);
  color: #fff;
}
.cal-day--other .cal-day-num { color: var(--gray-300); }
.cal-add-btn {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .12s, background .12s, color .12s;
  padding: 0;
}
.cal-day:hover .cal-add-btn { opacity: 1; }
.cal-add-btn:hover { background: var(--blue-50); color: var(--blue-600); }
.cal-day-slots { display: flex; flex-direction: column; gap: 2px; }
.cal-slot {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 5px;
  border-radius: 4px;
  cursor: pointer;
  font-size: .7rem;
  border-left: 3px solid var(--slot-color, var(--blue-400));
  background: var(--gray-50);
  transition: background .1s;
  overflow: hidden;
  min-width: 0;
}
.cal-slot:hover { background: var(--gray-100); }
.cal-slot-type {
  flex-shrink: 0;
  font-size: .62rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1.4;
}
.cal-slot-type--examen       { background: var(--blue-100); color: var(--blue-700); }
.cal-slot-type--recuperacion { background: var(--orange-100); color: var(--orange-600); }
.cal-slot-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--gray-700);
  font-weight: 500;
}
.cal-slot-time { flex-shrink: 0; color: var(--gray-400); font-size: .65rem; }
.cal-type-toggle {
  display: flex;
  gap: 8px;
}
.cal-type-opt {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: border-color .12s, background .12s;
}
.cal-type-opt input[type="radio"] { display: none; }
.cal-type-opt:has(input:checked) {
  border-color: var(--blue-500);
  background: var(--blue-50);
  color: var(--blue-700);
  font-weight: 600;
}

/* ── Attendance Spreadsheet ─────────────────────────────── */
.att-sheet-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.att-sheet-toolbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 12px 16px;
}
.att-legend-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--gray-600);
}
.att-legend-inline span { display: flex; align-items: center; gap: 3px; }
.att-sheet-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
}
.att-sheet-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 260px);
}
.att-sheet {
  border-collapse: collapse;
  font-size: .82rem;
  width: max-content;
  min-width: 100%;
}
.att-sheet thead tr:first-child th { position: sticky; top: 0; z-index: 3; background: #fff; }
.att-sheet thead tr:nth-child(2) th { position: sticky; top: 42px; z-index: 3; }
.att-name-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  min-width: 180px;
  max-width: 220px;
  border-right: 2px solid var(--gray-200);
}
.att-sheet thead .att-name-col { z-index: 4; }
.att-subject-th {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  border-right: 1px solid var(--gray-100);
  padding: 0;
  white-space: nowrap;
  text-align: center;
}
.att-subject-th-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 10px 6px;
}
.att-subject-th-name {
  font-weight: 700;
  font-size: .8rem;
  color: var(--gray-800);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.att-th-label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 10px 14px;
  display: block;
}
.att-hour-th {
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
  border-right: 1px solid var(--gray-100);
  padding: 6px 4px;
  text-align: center;
  min-width: 52px;
  white-space: nowrap;
}
.att-hour-num {
  display: block;
  font-weight: 700;
  font-size: .75rem;
  color: var(--gray-700);
}
.att-hour-time {
  display: block;
  font-size: .65rem;
  color: var(--gray-400);
  margin-top: 1px;
}
.att-markall {
  display: flex;
  gap: 2px;
  margin-top: 2px;
}
.att-ma {
  border: none;
  border-radius: 4px;
  font-size: .66rem;
  font-weight: 800;
  width: 20px;
  height: 20px;
  cursor: pointer;
  line-height: 1;
  transition: opacity .1s;
}
.att-ma:hover { opacity: .8; }
.att-ma-p { background: var(--green-100);  color: var(--green-700);  }
.att-ma-f { background: var(--red-100);    color: var(--red-700);    }
.att-ma-t { background: var(--orange-100); color: var(--orange-700); }
.att-ma-j { background: var(--blue-100);   color: var(--blue-700);   }
.att-readonly-badge {
  font-size: .65rem;
  color: var(--gray-400);
  font-weight: 500;
  margin-top: 2px;
}
.att-name-td {
  background: #fff;
  border-bottom: 1px solid var(--gray-100);
  border-right: 2px solid var(--gray-200);
  padding: 4px 12px 4px 10px;
}
.att-student-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--gray-800);
  white-space: nowrap;
}
.att-cell-td {
  padding: 4px 3px;
  text-align: center;
  border-right: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
  background: #fff;
}
.att-cell-td--last { border-right: 2px solid var(--gray-200); }
.att-cell-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1.5px solid transparent;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
  transition: background .1s, transform .06s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.att-cell-btn:hover:not([disabled]) { transform: scale(1.12); }
.att-cell-btn[disabled], .att-cell-readonly { cursor: default; opacity: .65; }
.att-cell-empty { background: var(--gray-50);    border-color: var(--gray-200);   color: var(--gray-400);   }
.att-cell-p     { background: var(--green-100);  border-color: var(--green-300);  color: var(--green-700);  }
.att-cell-f     { background: var(--red-100);    border-color: var(--red-300);    color: var(--red-700);    }
.att-cell-t     { background: var(--orange-100); border-color: var(--orange-300); color: var(--orange-700); }
.att-cell-j     { background: var(--blue-100);   border-color: var(--blue-300);   color: var(--blue-700);   }
.att-cell-na {
  display: inline-block;
  width: 32px;
  text-align: center;
  color: var(--gray-300);
  font-size: 1rem;
}
.att-save-bar {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: #fff;
  border-radius: 12px;
  padding: 10px 16px;
  gap: 14px;
  align-items: center;
  box-shadow: 0 4px 24px rgba(0,0,0,.22);
  z-index: 100;
  white-space: nowrap;
  font-size: .85rem;
}
.att-save-bar--visible { display: flex; }
.att-save-bar-msg {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-300);
}

/* ── Year navigation (shared across teacher/secretaria views) ── */
.top-bar       { display:flex; align-items:center; gap:12px; margin-bottom:20px; }
.year-nav      { display:flex; align-items:center; gap:6px; overflow-x:auto;
                 padding-bottom:2px; scrollbar-width:none; flex:1; }
.year-nav::-webkit-scrollbar { display:none; }
.year-nav-arrow { flex-shrink:0; width:34px; height:34px; border-radius:8px;
  border:1px solid var(--gray-200); background:var(--gray-50); color:var(--gray-500);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; text-decoration:none; transition:background .15s,color .15s; }
.year-nav-arrow:hover { background:var(--gray-100); color:var(--gray-800); }
.year-nav-arrow.disabled { opacity:.35; pointer-events:none; }
.year-tab { flex-shrink:0; display:inline-flex; align-items:center; gap:6px;
  padding:6px 16px; border-radius:8px; border:1.5px solid var(--gray-200);
  background:transparent; font-size:.85rem; font-weight:600; color:var(--gray-500);
  text-decoration:none; transition:all .15s; white-space:nowrap; }
.year-tab:hover  { border-color:var(--blue-300); color:var(--blue-600); background:var(--blue-50); }
.year-tab.active { background:var(--blue-600); border-color:var(--blue-600); color:#fff; }
.year-badge-current { font-size:.65rem; font-weight:700; padding:1px 6px; border-radius:20px;
  background:rgba(255,255,255,.25); color:inherit; letter-spacing:.03em; }
.year-tab:not(.active) .year-badge-current { background:var(--green-100); color:var(--green-700); }

/* ── Student search (secretaria) ── */
.stu-search-wrap  { position:relative; flex-shrink:0; }
.stu-search-icon  { position:absolute; left:10px; top:50%; transform:translateY(-50%);
                    color:var(--gray-400); pointer-events:none; }
.stu-search-input { padding:6px 12px 6px 32px; border:1.5px solid var(--gray-200);
  border-radius:8px; font-size:.85rem; width:220px; outline:none;
  transition:border-color .15s,box-shadow .15s; background:white; color:var(--gray-800); }
.stu-search-input:focus { border-color:#93c5fd; box-shadow:0 0 0 3px rgba(59,130,246,.1); }
.stu-search-input::placeholder { color:var(--gray-400); }
.stu-dropdown { position:absolute; top:calc(100% + 4px); right:0; width:300px; max-height:280px;
  overflow-y:auto; background:white; border:1.5px solid var(--gray-200); border-radius:10px;
  box-shadow:0 8px 24px rgba(0,0,0,.12); z-index:200; display:none; }
.stu-dropdown-item { display:flex; flex-direction:column; gap:2px; padding:10px 14px;
  cursor:pointer; border-bottom:1px solid var(--gray-100); }
.stu-dropdown-item:last-child { border-bottom:none; }
.stu-dropdown-item:hover { background:#eff6ff; }
.stu-dropdown-name  { font-size:.85rem; font-weight:600; color:var(--gray-800); }
.stu-dropdown-group { font-size:.72rem; color:var(--gray-400); }
.stu-dropdown-empty { padding:18px; text-align:center; color:var(--gray-400); font-size:.85rem; }
