/* ========================================
   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-500: #ef4444;
  --red-600: #dc2626;

  --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);
}

.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; }

.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; }

/* ── 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;
  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; }
