/* =============================================================
   TPMS – Glassmorphism UI Stylesheet
   Version: 1.0.0
   ============================================================= */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --bg-from:       #0f172a;
  --bg-to:         #1e1b4b;
  --glass-bg:      rgba(255, 255, 255, 0.06);
  --glass-border:  rgba(255, 255, 255, 0.12);
  --glass-hover:   rgba(255, 255, 255, 0.10);
  --glass-blur:    blur(14px);
  --primary:       #6366f1;
  --primary-dark:  #4f46e5;
  --primary-glow:  rgba(99, 102, 241, 0.35);
  --secondary:     #0ea5e9;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --text:          #f1f5f9;
  --text-muted:    #94a3b8;
  --text-sub:      #64748b;
  --sidebar-w:     260px;
  --topbar-h:      64px;
  --radius:        14px;
  --radius-sm:     8px;
  --radius-lg:     20px;
  --shadow:        0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-sm:     0 2px 12px rgba(0, 0, 0, 0.25);
  --transition:    0.2s ease;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg-from) 0%, var(--bg-to) 100%) fixed;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }

/* ── Glass Card ─────────────────────────────────────────────── */
.glass-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .26s ease, box-shadow .26s ease, border-color .26s ease;
}

.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(145deg, rgba(255,255,255,.26) 0%, rgba(255,255,255,.09) 24%, rgba(255,255,255,0) 52%),
    radial-gradient(circle at 88% 10%, rgba(255,255,255,.2), transparent 34%);
  opacity: .62;
}

.glass-card > * {
  position: relative;
  z-index: 1;
}

/* ── Sidebar Overlay ───────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 99;
  animation: fadeIn .2s ease;
}
.sidebar-overlay.active { display: block; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: rgba(15, 23, 42, 0.82);
  border-right: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition), transform var(--transition);
}

/* ── Sidebar Collapsed (desktop) ────────────────────────────── */
.sidebar.collapsed {
  width: 72px;
}
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .user-details { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 20px 0; }
.sidebar.collapsed .nav-item      { justify-content: center; padding: 12px; position: relative; }
.sidebar.collapsed .sidebar-footer { justify-content: center; }
.sidebar.collapsed .user-info     { justify-content: center; }
.main-wrapper { transition: margin-left var(--transition), width var(--transition); }
.main-wrapper.collapsed { margin-left: 72px; }

/* Nav tooltip in collapsed mode */
.sidebar.collapsed .nav-item::after {
  content: attr(data-label);
  position: absolute; left: calc(100% + 8px); top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 23, 42, .98);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  font-size: 12px; font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 300;
  box-shadow: var(--shadow-sm);
}
.sidebar.collapsed .nav-item:hover::after { opacity: 1; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--glass-border);
}
.brand-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.brand-name  { font-size: 18px; font-weight: 800; color: #fff; line-height: 1.2; }
.brand-sub   { font-size: 11px; color: var(--text-muted); }

.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  transition: all var(--transition);
}
.nav-item:hover {
  background: var(--glass-hover);
  color: var(--text);
}
.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 16px var(--primary-glow);
}
.nav-icon { width: 18px; font-size: 15px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-info   { display: flex; align-items: center; gap: 10px; flex: 1; overflow: hidden; }
.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.user-details { overflow: hidden; }
.user-name  { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { display: block; font-size: 11px; color: var(--text-muted); }
.logout-btn {
  width: 34px; height: 34px;
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.25);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #f87171;
  transition: all var(--transition);
  flex-shrink: 0;
}
.logout-btn:hover { background: rgba(239,68,68,.3); }

/* ── Main Wrapper ───────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 50;
}
.sidebar-toggle {
  background: none;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-muted);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--glass-hover); color: var(--text); }
.topbar-title { font-size: 16px; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.date-display { color: var(--text-muted); font-size: 13px; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.topbar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.topbar-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.topbar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-user-role {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.topbar-logout {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.24), rgba(244, 63, 94, 0.24));
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition);
}
.topbar-logout:hover {
  color: #fff;
  border-color: rgba(252, 165, 165, 0.55);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.36), rgba(244, 63, 94, 0.36));
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.28);
  transform: translateY(-1px);
}

/* ── Page Content ───────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.btn-lg  { padding: 12px 24px; font-size: 14px; }
.btn-sm  { padding: 6px 12px;  font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover { filter: brightness(1.12); transform: translateY(-1px); }

.btn-secondary {
  background: rgba(14, 165, 233, .15);
  border-color: rgba(14, 165, 233, .3);
  color: var(--secondary);
}
.btn-secondary:hover { background: rgba(14, 165, 233, .28); }

.btn-danger {
  background: rgba(239, 68, 68, .15);
  border-color: rgba(239, 68, 68, .3);
  color: #f87171;
}
.btn-danger:hover { background: rgba(239, 68, 68, .3); }

.btn-ghost {
  background: var(--glass-bg);
  border-color: var(--glass-border);
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--glass-hover); color: var(--text); }
.btn:disabled, .btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
  filter: none;
  transform: none;
}

/* ── Alerts / Flash ─────────────────────────────────────────── */
.flash-wrap { padding: 0 24px; }
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  animation: slideDown .3s ease;
  position: relative;
}
.alert-success { background: rgba(16,185,129,.15); border: 1px solid rgba(16,185,129,.3); color: #6ee7b7; }
.alert-error   { background: rgba(239,68,68,.15);  border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.3); color: #fcd34d; }
.alert-info    { background: rgba(14,165,233,.15); border: 1px solid rgba(14,165,233,.3); color: #7dd3fc; }
.alert-close { margin-left: auto; background: none; border: none; color: inherit; font-size: 18px; cursor: pointer; opacity: .7; }
.alert-close:hover { opacity: 1; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Stat Cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border: 1px solid rgba(255,255,255,.16);
  background:
    linear-gradient(168deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,.04) 32%, rgba(255,255,255,0) 60%),
    rgba(15, 23, 42, .42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 12px 28px rgba(2, 6, 23, .24);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.stat-card:hover {
  transform: translateY(-5px);
  border-color: rgba(125, 211, 252, .42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 22px 36px rgba(2, 6, 23, .3);
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.icon-blue   { background: rgba(99,102,241,.2); color: #818cf8; }
.icon-green  { background: rgba(16,185,129,.2); color: #34d399; }
.icon-purple { background: rgba(168,85,247,.2); color: #c084fc; }
.icon-orange { background: rgba(245,158,11,.2); color: #fbbf24; }
.icon-cyan   { background: rgba(14,165,233,.2); color: #38bdf8; }
.icon-red    { background: rgba(239,68,68,.2);  color: #f87171; }
.stat-value  { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-label  { font-size: 12px; color: var(--text-muted); margin-top: 3px; font-weight: 500; }

/* ── Charts ─────────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
}
.chart-card  { padding: 20px; }
.chart-card {
  border: 1px solid rgba(255,255,255,.16);
  background:
    linear-gradient(165deg, rgba(255,255,255,.13) 0%, rgba(255,255,255,.03) 30%, rgba(255,255,255,0) 60%),
    rgba(15, 23, 42, .45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 14px 30px rgba(2, 6, 23, .26);
}
.chart-wide  {}
.chart-container { position: relative; height: 240px; }
.chart-sm    .chart-container { height: 220px; }

/* ── Tables ─────────────────────────────────────────────────── */
.tables-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.table-card  { overflow: hidden; }
.table-card {
  border: 1px solid rgba(255,255,255,.14);
  background:
    linear-gradient(165deg, rgba(255,255,255,.12) 0%, rgba(255,255,255,.03) 28%, rgba(255,255,255,0) 58%),
    rgba(15, 23, 42, .44);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 14px 28px rgba(2, 6, 23, .24);
}
.table-scroll { overflow-x: auto; }
.data-table  { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  background: rgba(99,102,241,.12);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 10px 14px;
  white-space: nowrap;
  text-align: left;
}
.data-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(255,255,255,.04); }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.small       { font-size: 12px; }

/* ── Card Header ────────────────────────────────────────────── */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--glass-border);
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title i { color: var(--primary); }

/* ── Teacher Card Grid ──────────────────────────────────────── */
.teacher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.teacher-card {
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background:
    linear-gradient(165deg, rgba(255,255,255,.12) 0%, rgba(255,255,255,.03) 30%, rgba(255,255,255,0) 58%),
    rgba(15, 23, 42, .42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 12px 28px rgba(2, 6, 23, .24);
  transition: transform var(--transition), box-shadow var(--transition);
}
.teacher-card:hover {
  transform: translateY(-5px);
  border-color: rgba(125, 211, 252, .4);
  box-shadow: 0 18px 40px rgba(2, 6, 23, .32), inset 0 1px 0 rgba(255,255,255,.2);
}

.tc-photo {
  width: 56px; height: 56px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--glass-border);
}
.tc-photo img { width: 100%; height: 100%; object-fit: cover; }
.tc-avatar-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  font-weight: 700;
}
.tc-body { flex: 1; overflow: hidden; }
.tc-name { font-size: 13px; font-weight: 600; line-height: 1.4; }
.tc-sub  { margin: 4px 0; }
.tc-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.tc-info span { display: flex; align-items: center; gap: 5px; }
.tc-info i { width: 12px; color: var(--primary); font-size: 11px; }
.tc-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.badge-blue   { background: rgba(99,102,241,.2);  color: #818cf8; }
.badge-green  { background: rgba(16,185,129,.2);  color: #34d399; }
.badge-orange { background: rgba(245,158,11,.2);  color: #fbbf24; }
.badge-red    { background: rgba(239,68,68,.2);   color: #f87171; }
.badge-purple { background: rgba(168,85,247,.2);  color: #c084fc; }
.badge-cyan   { background: rgba(14,165,233,.2);  color: #38bdf8; }
.badge-gray   { background: rgba(100,116,139,.2); color: #94a3b8; }
.tc-badge     { font-size: 11px; background: rgba(99,102,241,.15); color: #a5b4fc; padding: 2px 8px; border-radius: 99px; }

/* ── Filters ────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  flex-wrap: wrap;
}
.filter-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  flex-wrap: wrap;
}
.filter-actions { display: flex; align-items: center; gap: 8px; }
.filter-group   { display: flex; align-items: center; gap: 6px; }
.search-box     { position: relative; }
.search-icon    { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-sub); font-size: 13px; }
.search-box .form-input { padding-left: 32px; }
.results-info   { font-size: 13px; color: var(--text-muted); }

/* Teachers action bar redesign */
.teachers-actionbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
  border: 1px solid rgba(99, 102, 241, .24);
  background:
    radial-gradient(circle at 10% 15%, rgba(14,165,233,.11), transparent 38%),
    radial-gradient(circle at 90% 85%, rgba(16,185,129,.10), transparent 44%),
    linear-gradient(145deg, rgba(15,23,42,.78), rgba(15,23,42,.65));
  box-shadow: 0 12px 30px rgba(2, 6, 23, .26);
}

.teachers-filter-form {
  width: 100%;
  gap: 10px;
}

.teachers-filter-item .form-select,
.teachers-filter-item .form-input {
  min-height: 40px;
  border-radius: 11px;
  background: rgba(15, 23, 42, .35);
  border-color: rgba(148, 163, 184, .26);
}

.teachers-search-wrap .form-input {
  min-height: 40px;
  border-radius: 11px;
}

.teachers-actionbar .btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 11px;
}

.teachers-search-wrap {
  flex: 1 1 340px;
  min-width: 280px;
}

.teachers-search-wrap .search-box {
  width: 100%;
}

.teachers-clear-btn {
  border-radius: 10px;
}

.teachers-action-controls {
  width: 100%;
  margin-left: 0;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
}

.teachers-primary-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1 1 auto;
}

.teachers-undo-btn,
.teachers-bulk-btn,
.teachers-add-btn {
  min-width: 144px;
}

.teachers-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.24);
  background: rgba(15, 23, 42, .34);
}

.teachers-view-toggle .btn {
  min-height: 36px;
  min-width: 86px;
  padding: 0 12px;
  border-radius: 9px;
}

@media (max-width: 1260px) {
  .teachers-action-controls {
    flex-wrap: wrap;
  }
  .teachers-view-toggle {
    margin-left: auto;
  }
}

@media (max-width: 980px) {
  .teachers-search-wrap {
    min-width: 100%;
    flex: 1 1 100%;
  }
  .teachers-filter-item {
    flex: 1 1 calc(50% - 6px);
    min-width: 170px;
  }
  .teachers-filter-item .form-select {
    width: 100%;
  }
  .teachers-action-controls {
    align-items: stretch;
  }
  .teachers-primary-actions {
    width: 100%;
  }
  .teachers-view-toggle {
    margin-left: 0;
  }
}

.schools-type-links {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
  flex-wrap: wrap;
}
.schools-type-link {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--transition);
}
.schools-type-link:hover {
  border-color: rgba(99,102,241,.45);
  color: #c7d2fe;
}
.schools-type-link.active {
  background: rgba(99,102,241,.22);
  border-color: rgba(99,102,241,.42);
  color: #c7d2fe;
}

.school-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.school-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid rgba(255,255,255,.14);
  background:
    linear-gradient(165deg, rgba(255,255,255,.12) 0%, rgba(255,255,255,.03) 30%, rgba(255,255,255,0) 58%),
    rgba(15, 23, 42, .42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 12px 28px rgba(2, 6, 23, .24);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.school-card:hover {
  transform: translateY(-5px);
  border-color: rgba(125, 211, 252, .38);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 18px 36px rgba(2, 6, 23, .3);
}

@media (prefers-reduced-motion: reduce) {
  .glass-card,
  .stat-card,
  .teacher-card,
  .school-card {
    transition: none;
  }
}
.school-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.school-card-head h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}
.school-card-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.school-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.school-card-meta i {
  width: 14px;
  color: var(--primary);
}
.school-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-input, .form-select {
  background: rgba(255,255,255,.07);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}
.form-input::placeholder { color: var(--text-sub); }
.form-input:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(255,255,255,.1);
}
.form-input.is-invalid { border-color: var(--danger); }
.form-select option { background: #1e293b; color: var(--text); }
textarea.form-input { resize: vertical; min-height: 80px; }
.form-label  { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.form-label.required::after { content: ' *'; color: #f87171; }
.form-error  { display: block; font-size: 12px; color: #f87171; margin-top: 4px; }
.form-group  { display: flex; flex-direction: column; gap: 0; }

.input-with-toggle { position: relative; }
.input-with-toggle .form-input { padding-right: 40px; }
.toggle-password {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted); font-size: 14px;
  cursor: pointer; transition: color var(--transition);
}
.toggle-password:hover { color: var(--text); }

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  user-select: none;
}
.checkbox-label input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--primary);
  flex-shrink: 0;
  margin-top: 2px;
}
.grade-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px 12px;
  padding: 10px 0 6px;
}
.checkbox-label-sm {
  display: flex; align-items: center; gap: 7px;
  cursor: pointer; font-size: 13px; color: var(--text-muted);
  user-select: none;
}
.checkbox-label-sm input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--primary); flex-shrink: 0;
}

/* ── Form Pages ─────────────────────────────────────────────── */
.form-page-wrap { display: flex; flex-direction: column; gap: 20px; }
.form-section { overflow: hidden; }
.section-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(99,102,241,.07);
}
.section-header h3 {
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.section-header h3 i { color: var(--primary); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 20px 24px;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 4px 0 8px;
}
.photo-preview {
  width: 110px; height: 110px;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
  border: 2px dashed var(--glass-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-sub);
  overflow: hidden;
}

/* ── View Teacher Page ──────────────────────────────────────── */
.view-page       { display: flex; flex-direction: column; gap: 20px; }
.view-grid       { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; }
.detail-card     { overflow: hidden; }
.profile-header  {
  display: flex; align-items: flex-start; gap: 20px;
  padding: 24px;
}
.profile-photo {
  width: 100px; height: 100px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--glass-border);
  flex-shrink: 0;
}
.profile-photo img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-lg {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 700;
}
.profile-meta { flex: 1; }
.profile-name { font-size: 20px; font-weight: 700; line-height: 1.3; }
.profile-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.profile-sub-info {
  display: flex; flex-wrap: wrap; gap: 16px;
  font-size: 13px; color: var(--text-muted);
}
.profile-sub-info span { display: flex; align-items: center; gap: 5px; }
.profile-header-actions { flex-shrink: 0; }
.detail-list { padding: 16px 20px; }
.dl-row {
  display: flex; gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.dl-row:last-child { border-bottom: none; }
.dl-row dt { color: var(--text-muted); font-size: 12px; min-width: 160px; flex-shrink: 0; }
.dl-row dd { font-size: 13px; font-weight: 500; }

/* ── Upload Page ────────────────────────────────────────────── */
.upload-page   { display: flex; flex-direction: column; gap: 20px; }
.upload-tabs   { display: flex; gap: 8px; }
.upload-tab    { padding: 10px 22px; border-radius: 10px; border: 1px solid var(--border); background: var(--glass-bg); color: var(--text-muted); font-size: 14px; font-weight: 500; cursor: pointer; transition: all .2s; display: flex; align-items: center; gap: 8px; }
.upload-tab:hover  { border-color: var(--primary); color: var(--primary); }
.upload-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.upload-panel  { display: flex; flex-direction: column; gap: 20px; }
.upload-info   { padding: 20px 24px; }
.upload-steps  { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.step {
  display: flex; align-items: flex-start; gap: 10px;
  background: rgba(255,255,255,.04); border-radius: var(--radius-sm);
  padding: 12px 14px; flex: 1; min-width: 200px;
}
.step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.step-text { font-size: 13px; color: var(--text-muted); }
.step-text strong { color: var(--text); }
.required-headers { margin: 16px 0; }
.header-chips     { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  background: rgba(99,102,241,.15); border: 1px solid rgba(99,102,241,.25);
  color: #a5b4fc; padding: 3px 10px; border-radius: 99px; font-size: 11px;
}

.upload-form-card { padding: 24px; }
.drop-zone {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius);
  min-height: 180px;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 32px;
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: 16px;
}
.drop-zone.dragover { border-color: var(--primary); background: rgba(99,102,241,.08); }
.drop-zone-content  { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--text-muted); }
.drop-zone-text     { font-size: 15px; font-weight: 600; color: var(--text); }
.drop-zone-sub      { font-size: 13px; }
.drop-zone-info     { font-size: 12px; color: var(--text-sub); }
.file-selected {
  display: flex; align-items: center; gap: 12px;
  background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.25);
  border-radius: var(--radius-sm); padding: 12px 16px;
}
.file-icon { font-size: 24px; color: #34d399; }
.upload-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

/* ── Mini Teacher Avatar ─────────────────────────────────────── */
.teacher-mini { display: flex; align-items: center; gap: 8px; }
.mini-avatar  {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0; overflow: hidden;
}
.mini-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.page-btn {
  min-width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  transition: all var(--transition);
  padding: 0 10px;
}
.page-btn:hover  { background: var(--glass-hover); color: var(--text); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-info       { font-size: 12px; color: var(--text-muted); margin-left: 8px; }

/* ── Modals ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  animation: fadeIn .2s ease;
}
.modal {
  width: 100%; max-width: 480px;
  padding: 28px;
  animation: scaleIn .2s ease;
}
.modal-icon { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 14px; }
.modal-icon.danger { background: rgba(239,68,68,.2); color: #f87171; }
.modal-title  { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.modal-body   { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-close  { background: none; border: none; color: var(--text-muted); font-size: 22px; cursor: pointer; }
.modal-close:hover { color: var(--text); }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  grid-column: 1 / -1;
}

/* ── Login Page ─────────────────────────────────────────────── */
.login-body { overflow: hidden; }
.login-bg { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.boot-logo-screen {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(circle at 30% 20%, #132040 0%, #0b1731 42%, #050a17 100%);
  transition: opacity .5s ease, visibility .5s ease;
}
.boot-logo-core {
  position: relative;
  width: 152px;
  height: 152px;
  display: grid;
  place-items: center;
}
.boot-logo-image {
  width: 118px;
  height: 118px;
  object-fit: contain;
  position: relative;
  z-index: 2;
  animation: bootLogoPulse 1.05s ease-in-out infinite alternate;
}
.boot-logo-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid rgba(252, 211, 77, .9);
  box-shadow: 0 0 0 8px rgba(37, 99, 235, .22);
  animation: bootRingSpin 2.2s linear infinite;
}
.boot-logo-glow {
  position: absolute;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(252, 211, 77, .45) 0%, rgba(252, 211, 77, 0) 72%);
  filter: blur(6px);
  z-index: 1;
}
.boot-logo-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #eaf2ff;
  animation: bootTitleRise .9s ease-out;
}
.boot-logo-screen.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.booting .login-wrapper {
  opacity: 0;
  transform: translateY(8px) scale(.985);
}
.login-wrapper {
  transition: opacity .45s ease, transform .45s ease;
}
@keyframes bootLogoPulse {
  from { transform: scale(.95); }
  to { transform: scale(1.06); }
}
@keyframes bootRingSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes bootTitleRise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .35;
  animation: floatOrb 8s ease-in-out infinite alternate;
}
.orb1 { width: 500px; height: 500px; background: var(--primary);   top: -100px; left: -100px; animation-delay: 0s; }
.orb2 { width: 400px; height: 400px; background: var(--secondary); bottom: -80px; right: -80px; animation-delay: 2s; }
.orb3 { width: 350px; height: 350px; background: #a78bfa;          top: 50%; left: 50%; margin-top: -175px; margin-left: -175px; animation-delay: 1s; }
@keyframes floatOrb { from { transform: scale(1); } to { transform: scale(1.15) translate(20px, -20px); } }

.login-wrapper {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  transition: opacity .45s ease, transform .45s ease;
}
.login-card { width: 100%; max-width: 640px; padding: 40px; }
.login-brand { text-align: center; margin-bottom: 28px; }
.login-logo {
  width: 98px; height: 98px;
  background: whitesmoke;
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin: 0 auto 14px;
  box-shadow: 0 8px 24px var(--primary-glow);
}
.login-title    { font-size: 26px; font-weight: 800; }
.login-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.login-form     { display: flex; flex-direction: column; gap: 16px; }
.login-field    { position: relative; }
.login-field-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-sub); font-size: 13px; pointer-events: none; z-index: 1;
}
.login-field-input { padding-left: 36px !important; }
.login-field.input-with-toggle .login-field-input { padding-right: 42px; }
.login-divider  { height: 1px; background: var(--glass-border); margin: 4px 0 12px; }
.login-footer   { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text-sub); }

/* ── Users Page ─────────────────────────────────────────────── */
.users-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.user-card  { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.user-card-header { display: flex; align-items: center; gap: 12px; }
.user-card-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #a78bfa);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.user-card-info .user-full-name { font-weight: 600; }
.user-card-info .user-username  { font-size: 12px; color: var(--text-muted); }

/* ── Logs Page ──────────────────────────────────────────────── */
.log-action { font-weight: 600; }
.log-create { color: #34d399; }
.log-update { color: #38bdf8; }
.log-delete { color: #f87171; }
.log-upload { color: #fbbf24; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .charts-grid  { grid-template-columns: 1fr; }
  .tables-grid  { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-260px); width: 260px; }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .brand-text, .nav-label, .user-details { display: block; }
  .sidebar-brand { justify-content: flex-start; padding: 24px 20px; }
  .nav-item { justify-content: flex-start; padding: 11px 14px; position: static; }
  .nav-item::after { display: none; }
  .sidebar-footer { justify-content: flex-start; }
  .user-info { justify-content: flex-start; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .boot-logo-core { width: 132px; height: 132px; }
  .boot-logo-image { width: 102px; height: 102px; }
  .boot-logo-title { font-size: 18px; letter-spacing: .06em; }

  .sidebar { width: min(84vw, 280px); transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar-user-meta, .date-display { display: none; }
  .topbar-user { padding: 4px; }
  .topbar-logout span { display: none; }
  .topbar-logout { width: 34px; padding: 0; justify-content: center; }

  .filter-bar { padding: 12px; gap: 10px; }
  .filter-form { width: 100%; }
  .search-box { width: 100%; }
  .filter-actions { width: 100%; flex-wrap: wrap; }
  .teachers-actionbar { padding: 12px; }
  .teachers-filter-form { width: 100%; }
  .teachers-filter-item,
  .teachers-filter-item .form-select { width: 100%; }
  .teachers-action-controls { width: 100%; margin-left: 0; }
  .teachers-primary-actions,
  .teachers-undo-btn,
  .teachers-bulk-btn,
  .teachers-add-btn {
    width: 100%;
    min-width: 0;
  }
  .teachers-view-toggle {
    width: 100%;
    justify-content: space-between;
  }
  .teachers-view-toggle .btn {
    flex: 1 1 0;
  }
  .schools-type-links {
    width: 100%;
    margin-left: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .schools-type-link { flex: 0 0 auto; }

  .upload-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .upload-tab { flex: 0 0 auto; padding: 9px 14px; font-size: 13px; }

  #schoolsListView .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #schoolsListView .data-table { min-width: 760px; }
  #schoolsCardView { grid-template-columns: 1fr; }
  .school-card-head { flex-direction: column; align-items: flex-start; }
  .school-card-actions { flex-wrap: wrap; }
  .school-card-actions .btn { justify-content: center; }

  .login-card { padding: 28px 22px; }
  .page-content { padding: 16px; }
  .teacher-grid { grid-template-columns: 1fr; }
  .form-grid    { grid-template-columns: 1fr; }
  .view-grid    { grid-template-columns: 1fr; }
  .profile-header { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .boot-logo-ring,
  .boot-logo-image,
  .boot-logo-title,
  .login-orb {
    animation: none !important;
  }
}
