/* =========================================================
   PADMAVANI SCHOOL — ADMIN DASHBOARD
   Design System: Premium Indigo / Slate — Refined & Authoritative
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Serif+Display:ital@0;1&display=swap');

/* ── TOKENS ─────────────────────────────────────────────── */
:root {
  /* Brand */
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-900: #1e1b4b;

  /* Accent */
  --accent-400: #fb923c;
  --accent-500: #f97316;

  /* Greens / Reds / Yellows */
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --red-400:   #f87171;
  --red-500:   #ef4444;
  --yellow-400:#facc15;
  --yellow-500:#eab308;

  /* Surface palette (light) */
  --bg:          #f1f5f9;
  --surface:     #ffffff;
  --surface-2:   #f8fafc;
  --surface-3:   #f1f5f9;
  --border:      #e2e8f0;
  --border-muted:#f1f5f9;

  /* Text */
  --text-primary:  #0f172a;
  --text-secondary:#475569;
  --text-muted:    #94a3b8;
  --text-inverse:  #ffffff;

  /* Aliases for backward compat */
  --primary-color: var(--brand-600);
  --primary-light: var(--brand-400);
  --primary-dark:  var(--brand-700);
  --secondary-color: var(--accent-500);
  --background: var(--bg);
  --on-primary: var(--text-inverse);
  --on-secondary: var(--text-inverse);
  --on-background: var(--text-primary);
  --on-surface: var(--text-primary);
  --error: var(--red-500);
  --success: var(--green-500);
  --info: var(--brand-500);
  --on-error: #fff;

  /* Layout */
  --sidebar-w:    260px;
  --sidebar-w-c:  72px;
  --topnav-h:     68px;

  /* Shape */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-2xl: 28px;
  --border-radius: var(--radius-lg);

  /* Shadow */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .08), 0 2px 4px -2px rgb(0 0 0 / .08);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .08), 0 4px 6px -4px rgb(0 0 0 / .06);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .06);
  --box-shadow: var(--shadow-md);

  /* Motion */
  --ease: cubic-bezier(.4,0,.2,1);
  --duration: 200ms;
  --transition: all var(--duration) var(--ease);

  /* Typography */
  --font-body:    'DM Sans', sans-serif;
  --font-display: 'DM Serif Display', serif;
}

/* ── DARK THEME ─────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:          #0a0f1e;
  --surface:     #111827;
  --surface-2:   #1a2235;
  --surface-3:   #1e2a3a;
  --border:      #1e293b;
  --border-muted:#1e293b;
  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #475569;
  --brand-50:  #1e1b4b;
  --brand-100: #312e81;
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .3), 0 2px 4px -2px rgb(0 0 0 / .3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .3), 0 4px 6px -4px rgb(0 0 0 / .2);
  --box-shadow: var(--shadow-md);
}

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}

/* ── SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar          { width: 5px; height: 5px; }
::-webkit-scrollbar-track    { background: transparent; }
::-webkit-scrollbar-thumb    { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-400); }

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════════ */
#loginPage {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #0f0e2e 0%, #1a1654 40%, #2a1f7a 70%, #3b2cb5 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

#loginPage::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 20% 80%, rgba(99,102,241,.18) 0%, transparent 70%),
    radial-gradient(ellipse 400px 300px at 80% 20%, rgba(249,115,22,.12) 0%, transparent 70%);
  pointer-events: none;
}

/* Floating orbs */
#loginPage::after {
  content: '';
  position: absolute; top: 15%; left: 10%;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(99,102,241,.2) 0%, transparent 70%);
  border-radius: 50%;
  animation: floatOrb 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%       { transform: translate(30px, -20px) scale(1.05); }
}

.login-card {
  background: rgba(255,255,255,.97);
  border-radius: var(--radius-2xl);
  padding: 52px 44px;
  width: 100%; max-width: 430px;
  box-shadow: 0 32px 80px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.1);
  text-align: center;
  position: relative;
  backdrop-filter: blur(20px);
  animation: slideUp .5s var(--ease) both;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}

[data-theme="dark"] .login-card {
  background: rgba(17,24,39,.95);
  color: var(--text-primary);
}

.login-logo-wrap {
  display: inline-flex; align-items: center; justify-content: center;
  width: 68px; height: 68px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  box-shadow: 0 8px 24px rgba(99,102,241,.4);
  margin-bottom: 16px;
}

.login-logo-wrap .material-icons { font-size: 34px; color: #fff; }

.login-card h1 {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-card p.sub {
  font-size: 13px; color: var(--text-secondary);
  margin-bottom: 32px;
}

.login-field {
  margin-bottom: 18px; text-align: left;
}

.login-field label {
  display: block;
  font-size: 12.5px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.login-field input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px; font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--surface-2);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  outline: none;
}

.login-field input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(99,102,241,.15);
  background: var(--surface);
}

#loginError {
  color: var(--red-500);
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 14px;
  text-align: left;
}

#loginSubmitBtn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px; font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: opacity var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  box-shadow: 0 4px 14px rgba(99,102,241,.4);
  letter-spacing: .02em;
}

#loginSubmitBtn:hover { opacity: .92; box-shadow: 0 6px 20px rgba(99,102,241,.5); }
#loginSubmitBtn:active { opacity: .85; }

/* ═══════════════════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════════════════ */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--brand-900);
  color: #c7d2fe;
  transition: width var(--duration) var(--ease);
  z-index: 100;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* Subtle gradient overlay on sidebar */
.sidebar::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 200px;
  background: linear-gradient(180deg, rgba(99,102,241,.15) 0%, transparent 100%);
  pointer-events: none;
}

.sidebar-collapsed { width: var(--sidebar-w-c); }

/* Header */
.sidebar-header {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  min-height: var(--topnav-h);
}

.school-logo {
  display: flex; align-items: center; gap: 11px;
  overflow: hidden;
}

.school-logo img {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.15);
}

.school-name {
  font-weight: 700; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #fff;
  line-height: 1.3;
  letter-spacing: -.01em;
}

.collapse-btn {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  color: #c7d2fe;
  cursor: pointer;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  flex-shrink: 0;
}

.collapse-btn:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
}

/* Menu */
.sidebar-menu {
  padding: 12px 0 24px;
  flex-grow: 1;
  position: relative; z-index: 1;
}

.menu-section { margin-bottom: 6px; }

.menu-title {
  padding: 14px 18px 6px;
  font-size: 10.5px; text-transform: uppercase;
  color: rgba(165,180,252,.5);
  font-weight: 700; letter-spacing: .1em;
  white-space: nowrap;
}

.sidebar-collapsed .menu-title { opacity: 0; pointer-events: none; }

.menu-items { list-style: none; }

.menu-item {
  padding: 10px 12px 10px 16px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  color: rgba(199,210,254,.75);
  border-radius: 0;
  margin: 1px 8px;
  border-radius: var(--radius-md);
  white-space: nowrap;
}

.menu-item:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.menu-item.active {
  background: linear-gradient(90deg, rgba(99,102,241,.35), rgba(99,102,241,.18));
  color: #fff;
  font-weight: 600;
}

.menu-item.active::before {
  content: '';
  position: absolute; left: -8px; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 60%;
  background: var(--brand-400);
  border-radius: 0 4px 4px 0;
}

.menu-item-icon {
  font-size: 20px;
  flex-shrink: 0;
  opacity: .85;
}

.menu-item.active .menu-item-icon { opacity: 1; color: var(--brand-400); }

.menu-item-text {
  font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.menu-item-badge {
  margin-left: auto;
  background: var(--accent-500);
  color: #fff;
  border-radius: 99px;
  padding: 2px 8px;
  font-size: 11px; font-weight: 700;
  min-width: 22px; text-align: center;
  flex-shrink: 0;
}

/* Collapsed state */
.sidebar-collapsed .school-name,
.sidebar-collapsed .menu-item-text,
.sidebar-collapsed .menu-item-badge { display: none; }

.sidebar-collapsed .menu-item {
  justify-content: center;
  padding: 12px;
}

.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: 18px 0;
}

.sidebar-collapsed .collapse-btn {
  position: absolute; right: -14px; top: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  color: var(--brand-600);
  z-index: 200;
  border-radius: 50%;
  width: 28px; height: 28px;
}

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════════════════════════ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  transition: margin-left var(--duration) var(--ease);
  display: flex; flex-direction: column;
  min-height: 100vh;
}

.main-content-expanded { margin-left: var(--sidebar-w-c); }

/* ── TOP NAV ────────────────────────────────────────────── */
.top-nav {
  background: var(--surface);
  padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 90;
  flex-shrink: 0;
  height: var(--topnav-h);
  border-bottom: 1px solid var(--border);
}

.nav-action-btn {
  background: transparent;
  border: none; cursor: pointer;
  color: var(--text-secondary);
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  position: relative;
}

.nav-action-btn:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

#mobileMenuBtn { display: none; }

/* Search */
.search-bar {
  flex: 1; max-width: 480px; margin: 0 20px;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 9px 16px 9px 40px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 13.5px; font-family: var(--font-body);
  transition: var(--transition);
  outline: none;
}

.search-bar input::placeholder { color: var(--text-muted); }

.search-bar input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
  background: var(--surface);
}

.search-icon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); font-size: 18px;
  pointer-events: none;
}

/* Nav right */
.nav-actions {
  display: flex; align-items: center; gap: 6px;
}

.notification-badge {
  position: absolute; top: 5px; right: 5px;
  background: var(--red-500); color: #fff;
  font-size: 9px; font-weight: 700;
  border-radius: 99px; padding: 1px 4px;
  min-width: 16px; text-align: center;
  line-height: 14px;
  border: 1.5px solid var(--surface);
}

/* User profile pill */
.user-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  border: 1.5px solid transparent;
}

.user-profile:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  letter-spacing: .05em;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px; font-weight: 600;
  color: var(--text-primary); line-height: 1.2;
}

.user-role {
  font-size: 11px; color: var(--text-muted); line-height: 1.2;
}

/* ── CONTENT AREA ───────────────────────────────────────── */
.content-area {
  padding: 28px 32px;
  flex: 1;
}

/* ── PAGE HEADER ────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap; gap: 12px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -.02em;
}

.page-subtitle {
  font-size: 13px; color: var(--text-muted);
  margin-top: 2px;
}

.page-actions {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}

/* ── BREADCRUMB ─────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-muted);
  margin-bottom: 20px;
}

.breadcrumb-sep { color: var(--border); }
.breadcrumb-current { color: var(--text-secondary); font-weight: 500; }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px; font-weight: 600; font-family: var(--font-body);
  cursor: pointer; border: none;
  transition: var(--transition);
  text-decoration: none; white-space: nowrap;
  letter-spacing: .01em;
}

.btn .material-icons { font-size: 17px; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(99,102,241,.45);
  opacity: .92;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-outline:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-danger {
  background: var(--red-500); color: #fff;
}

.btn-danger:hover { background: #dc2626; }

.btn-success {
  background: var(--green-600); color: #fff;
}

.btn-sm {
  padding: 6px 12px; font-size: 12.5px;
}

.btn-sm .material-icons { font-size: 15px; }

.btn-icon {
  padding: 8px; gap: 0;
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
}

.btn-icon:hover { background: var(--surface-2); color: var(--text-primary); }

/* ═══════════════════════════════════════════════════════════
   STAT CARDS
═══════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative; overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card-accent {
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}

.stat-card-icon .material-icons { font-size: 22px; }

.stat-value {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -.03em;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12.5px; color: var(--text-muted);
  font-weight: 500; letter-spacing: .02em;
  text-transform: uppercase;
}

.stat-change {
  display: inline-flex; align-items: center; gap: 3px;
  margin-top: 10px;
  font-size: 12px; font-weight: 600;
  padding: 3px 8px; border-radius: 99px;
}

.stat-change.up   { background: #dcfce7; color: var(--green-600); }
.stat-change.down { background: #fee2e2; color: var(--red-500); }

[data-theme="dark"] .stat-change.up   { background: rgba(34,197,94,.15); color: var(--green-400); }
[data-theme="dark"] .stat-change.down { background: rgba(239,68,68,.15); color: var(--red-400); }

/* Color variants */
.accent-indigo .stat-card-accent { background: linear-gradient(90deg, var(--brand-500), var(--brand-400)); }
.accent-orange .stat-card-accent { background: linear-gradient(90deg, var(--accent-500), var(--yellow-400)); }
.accent-green  .stat-card-accent { background: linear-gradient(90deg, var(--green-500), #34d399); }
.accent-red    .stat-card-accent { background: linear-gradient(90deg, var(--red-500), #fb923c); }
.accent-purple .stat-card-accent { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

.accent-indigo .stat-card-icon { background: var(--brand-50); color: var(--brand-600); }
.accent-orange .stat-card-icon { background: #fff7ed; color: var(--accent-500); }
.accent-green  .stat-card-icon { background: #f0fdf4; color: var(--green-600); }
.accent-red    .stat-card-icon { background: #fef2f2; color: var(--red-500); }
.accent-purple .stat-card-icon { background: #f5f3ff; color: #7c3aed; }

[data-theme="dark"] .accent-indigo .stat-card-icon { background: rgba(99,102,241,.15); color: var(--brand-400); }
[data-theme="dark"] .accent-orange .stat-card-icon { background: rgba(249,115,22,.15); color: var(--accent-400); }
[data-theme="dark"] .accent-green  .stat-card-icon { background: rgba(34,197,94,.15);  color: var(--green-400); }
[data-theme="dark"] .accent-red    .stat-card-icon { background: rgba(239,68,68,.15);  color: var(--red-400); }
[data-theme="dark"] .accent-purple .stat-card-icon { background: rgba(139,92,246,.15); color: #a78bfa; }

/* ═══════════════════════════════════════════════════════════
   DASHBOARD GRID / QUICK ACTIONS
═══════════════════════════════════════════════════════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

/* ═══════════════════════════════════════════════════════════
   IMPROVED DASHBOARD LAYOUT
═══════════════════════════════════════════════════════════ */

/* 5-column stat cards row */
.db-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

/* 2-column charts row */
.db-charts-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.db-chart-card { min-height: 0; }

/* 2-column bottom row (quick actions + activity) */
.db-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 16px;
}

/* Skeleton loader for stat values */
.db-skeleton {
  display: inline-block;
  width: 70px; height: 28px;
  background: linear-gradient(90deg, var(--border) 25%, var(--surface-2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: db-shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  vertical-align: middle;
}

@keyframes db-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Responsive breakpoints */
@media (max-width: 1200px) {
  .db-stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .db-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .db-charts-grid { grid-template-columns: 1fr; }
  .db-bottom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .db-stats-grid { grid-template-columns: 1fr 1fr; }
}

.quick-action-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px 18px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}

.quick-action-card:hover {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px rgba(99,102,241,.08), var(--shadow-md);
  transform: translateY(-2px);
}

.quick-action-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-md);
  background: var(--brand-50);
  color: var(--brand-600);
  display: flex; align-items: center; justify-content: center;
}

.quick-action-icon .material-icons { font-size: 22px; }

.quick-action-label {
  font-size: 12.5px; font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.3;
}

[data-theme="dark"] .quick-action-icon {
  background: rgba(99,102,241,.15); color: var(--brand-400);
}

/* ═══════════════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
}

.card-title {
  font-size: 15px; font-weight: 700;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 12.5px; color: var(--text-muted);
  margin-top: 2px;
}

.card-body { padding: 22px; }

.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: space-between;
}

/* ═══════════════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════════════ */
.table-wrapper {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px;
}

.data-table thead {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.data-table th:hover { color: var(--text-primary); }

.data-table td {
  padding: 13px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-muted);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--duration) var(--ease);
}

.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table .cell-primary {
  color: var(--text-primary); font-weight: 600;
}

/* Table action buttons */
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  max-width: 68px; /* fits exactly 2 buttons (30px each + 4px gap) → forces 3rd+ to next row */
}

/* Single row when ≤ 3 buttons */
.table-actions:has(.action-btn:nth-child(1):nth-last-child(1)),
.table-actions:has(.action-btn:nth-child(1):nth-last-child(2)),
.table-actions:has(.action-btn:nth-child(1):nth-last-child(3)) {
  max-width: none;
  flex-wrap: nowrap;
}

/* td that directly holds action buttons (no wrapper div) */
td:has(> .action-btn) {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
}

/* 4+ buttons → wrap into 2×2 grid */
td:has(> .action-btn:nth-child(4)),
td.action-cell--wrap {
  flex-wrap: wrap;
  max-width: 68px; /* 30px btn × 2 + 4px gap = 64px, cap at 68px */
}

.action-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  background: transparent;
  flex-shrink: 0;
}

.action-btn .material-icons { font-size: 16px; }

.action-btn.view-btn   { color: var(--brand-500); }
.action-btn.edit-btn   { color: var(--yellow-500); }
.action-btn.delete-btn { color: var(--red-500); }

/* legacy class names */
.action-btn.view   { color: var(--brand-500); }
.action-btn.edit   { color: var(--yellow-500); }
.action-btn.delete { color: var(--red-500); }

.action-btn:hover  { background: var(--surface-3); }

/* ═══════════════════════════════════════════════════════════
   BADGES / STATUS CHIPS
═══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}

.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  flex-shrink: 0;
}

.badge-success { background: #dcfce7; color: var(--green-600); }
.badge-warning { background: #fef9c3; color: #92400e; }
.badge-danger  { background: #fee2e2; color: var(--red-500); }
.badge-info    { background: var(--brand-50); color: var(--brand-700); }
.badge-neutral { background: var(--surface-3); color: var(--text-secondary); }

.badge-success .badge-dot { background: var(--green-500); }
.badge-warning .badge-dot { background: var(--yellow-500); }
.badge-danger  .badge-dot { background: var(--red-500); }
.badge-info    .badge-dot { background: var(--brand-500); }

[data-theme="dark"] .badge-success { background: rgba(34,197,94,.15);  color: var(--green-400); }
[data-theme="dark"] .badge-warning { background: rgba(234,179,8,.15);  color: var(--yellow-400); }
[data-theme="dark"] .badge-danger  { background: rgba(239,68,68,.15);  color: var(--red-400); }
[data-theme="dark"] .badge-info    { background: rgba(99,102,241,.15); color: var(--brand-400); }
[data-theme="dark"] .badge-neutral { background: var(--surface-3);     color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12.5px; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13.5px; font-family: var(--font-body);
  transition: var(--transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
  background: var(--surface);
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 38px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: flex; gap: 16px; }
.form-col { flex: 1; }

.form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.form-hint {
  font-size: 12px; color: var(--text-muted);
  margin-top: 5px;
}

/* Checkbox */
input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--brand-600);
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════
   MODALS
═══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; visibility: hidden;
  transition: opacity .25s var(--ease), visibility .25s var(--ease);
}

.modal-overlay.active {
  opacity: 1; visibility: visible;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 92%; max-width: 680px;
  max-height: 90vh; overflow-y: auto;
  transform: scale(.96) translateY(16px);
  transition: transform .28s var(--ease);
  border: 1px solid var(--border);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 10;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-title {
  font-size: 18px; font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: var(--surface-2);
  border: none; cursor: pointer;
  color: var(--text-muted);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}

.modal-body { padding: 22px 26px; }

.modal-footer {
  padding: 16px 26px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}

/* ═══════════════════════════════════════════════════════════
   MESSAGE BOX
═══════════════════════════════════════════════════════════ */
.message-box-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
  opacity: 0; visibility: hidden;
  transition: opacity .25s var(--ease), visibility .25s var(--ease);
}

.message-box-overlay.active { opacity: 1; visibility: visible; }

.message-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 36px 32px;
  width: 92%; max-width: 420px;
  text-align: center;
  transform: scale(.95);
  transition: transform .25s var(--ease);
  border: 1px solid var(--border);
}

.message-box-overlay.active .message-box { transform: scale(1); }

.message-box-icon {
  font-size: 52px; margin-bottom: 14px;
  color: var(--brand-500);
}

.message-box-title {
  font-size: 20px; font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.message-box-text {
  font-size: 14.5px; color: var(--text-secondary);
  margin-bottom: 24px; line-height: 1.6;
}

.message-box-actions {
  display: flex; justify-content: center; gap: 12px;
}

/* ═══════════════════════════════════════════════════════════
   FILTER CONTROLS
═══════════════════════════════════════════════════════════ */
.filter-controls {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex; flex-wrap: wrap; gap: 14px;
  align-items: flex-end;
}

.filter-group {
  display: flex; flex-direction: column;
  min-width: 150px; flex-grow: 1;
}

.filter-group label {
  margin-bottom: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.filter-group select,
.filter-group input[type="text"],
.filter-group input[type="date"] {
  padding: 9px 13px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 13.5px; font-family: var(--font-body);
  outline: none;
  transition: var(--transition);
}

.filter-group select:focus,
.filter-group input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}

.filter-actions {
  display: flex; gap: 8px; margin-left: auto; flex-shrink: 0;
  align-items: flex-end;
}

/* ═══════════════════════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════════════════════ */
.pagination-controls {
  display: flex; justify-content: flex-end; align-items: center;
  gap: 8px; margin-top: 18px; padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}

.pagination-controls button {
  padding: 7px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600; font-size: 13px; font-family: var(--font-body);
}

.pagination-controls button:hover:not(:disabled) {
  background: var(--brand-50); color: var(--brand-700);
  border-color: var(--brand-400);
}

.pagination-controls button:disabled {
  opacity: .35; cursor: not-allowed;
}

.pagination-controls span {
  font-size: 13.5px; color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════
   LOADING OVERLAY
═══════════════════════════════════════════════════════════ */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 3000;
  opacity: 0; visibility: hidden;
  transition: opacity .2s var(--ease), visibility .2s var(--ease);
}

.loading-overlay.active { opacity: 1; visibility: visible; }

.spinner {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: var(--brand-400);
  animation: spin .75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════
   NOTIFICATIONS / ANNOUNCEMENTS
═══════════════════════════════════════════════════════════ */
.notif-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-muted);
}

.notif-item:last-child { border-bottom: none; }

.notif-icon {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
}

.notif-icon .material-icons { font-size: 19px; }

.notif-content { flex: 1; }

.notif-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }

.notif-desc {
  font-size: 12.5px; color: var(--text-muted);
  margin-top: 2px; line-height: 1.5;
}

.notif-time { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════
   TIMELINE / ACTIVITY
═══════════════════════════════════════════════════════════ */
.timeline {
  position: relative; padding-left: 22px;
}

.timeline::before {
  content: '';
  position: absolute; left: 7px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border);
}

.timeline-item {
  position: relative; margin-bottom: 20px;
}

.timeline-dot {
  position: absolute; left: -22px; top: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2.5px solid var(--surface);
  background: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}

.timeline-content {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid var(--border);
}

.timeline-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.timeline-time  { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }

/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 56px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}

.empty-state-icon {
  width: 72px; height: 72px;
  border-radius: var(--radius-xl);
  background: var(--surface-2);
  border: 2px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}

.empty-state-icon .material-icons { font-size: 32px; }

.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.empty-state p  { font-size: 13.5px; color: var(--text-muted); max-width: 320px; }

/* ═══════════════════════════════════════════════════════════
   CHARTS WRAPPER
═══════════════════════════════════════════════════════════ */
.chart-wrapper {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.chart-title {
  font-size: 14.5px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 4px;
}

.chart-subtitle { font-size: 12.5px; color: var(--text-muted); margin-bottom: 18px; }

/* ═══════════════════════════════════════════════════════════
   PROFILE / DETAIL VIEWS
═══════════════════════════════════════════════════════════ */
.profile-header {
  display: flex; gap: 20px; align-items: flex-start;
  padding: 24px;
  background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-900) 100%);
  border-radius: var(--radius-lg);
  color: #fff;
  margin-bottom: 20px;
  position: relative; overflow: hidden;
}

.profile-header::after {
  content: '';
  position: absolute; right: -30px; top: -30px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}

.profile-avatar {
  width: 66px; height: 66px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.3);
}

.profile-name { font-size: 20px; font-weight: 700; margin-bottom: 3px; }
.profile-meta { font-size: 13px; opacity: .8; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.detail-item {}
.detail-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 3px; }
.detail-value { font-size: 14px; color: var(--text-primary); font-weight: 500; }

/* ═══════════════════════════════════════════════════════════
   MISC UTILITIES
═══════════════════════════════════════════════════════════ */
.divider { height: 1px; background: var(--border); margin: 18px 0; }

.text-primary    { color: var(--text-primary)   !important; }
.text-secondary  { color: var(--text-secondary) !important; }
.text-muted      { color: var(--text-muted)     !important; }
.text-brand      { color: var(--brand-600)      !important; }
.text-success    { color: var(--green-600)      !important; }
.text-danger     { color: var(--red-500)        !important; }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.mt-0  { margin-top: 0;  }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE SIDEBAR — Full premium slide-in panel
═══════════════════════════════════════════════════════════ */
@media (max-width: 992px) {

  /* ── Sidebar base reset for mobile ── */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 280px;                          /* wider than desktop collapsed */
    max-width: 85vw;
    height: 100dvh;                        /* dynamic viewport height — fixes iOS bar */
    height: 100vh;                         /* fallback */
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 320ms cubic-bezier(.4,0,.2,1),
                box-shadow 320ms cubic-bezier(.4,0,.2,1);
    box-shadow: none;
    overflow-y: auto;
    overflow-x: hidden;
    /* Momentum scrolling on iOS */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Always show all text — never collapsed on mobile */
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
  }

  /* Opened state */
  .sidebar.active {
    transform: translateX(0);
    box-shadow:
      4px 0 32px rgba(0,0,0,.32),
      8px 0 64px rgba(0,0,0,.16);
  }

  /* Never apply collapsed styles on mobile */
  .sidebar.sidebar-collapsed {
    width: 280px !important;
    transform: translateX(-100%);
  }
  .sidebar.sidebar-collapsed.active {
    transform: translateX(0);
  }
  .sidebar.sidebar-collapsed .school-name,
  .sidebar.sidebar-collapsed .menu-item-text,
  .sidebar.sidebar-collapsed .menu-item-badge {
    display: block !important;
  }
  .sidebar.sidebar-collapsed .menu-item {
    justify-content: flex-start !important;
    padding: 10px 12px 10px 16px !important;
  }
  .sidebar.sidebar-collapsed .sidebar-header {
    justify-content: space-between !important;
    padding: 20px 16px !important;
  }
  .sidebar.sidebar-collapsed .menu-title {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .sidebar.sidebar-collapsed .collapse-btn {
    position: static !important;
    background: rgba(255,255,255,.08) !important;
    border: 1px solid rgba(255,255,255,.1) !important;
    color: #c7d2fe !important;
    box-shadow: none !important;
    border-radius: var(--radius-sm) !important;
    width: 30px !important; height: 30px !important;
  }

  /* ── Sidebar header on mobile ── */
  .sidebar-header {
    padding: 18px 16px;
    min-height: 64px;
  }

  /* ── Menu items — bigger tap targets on mobile ── */
  .menu-item {
    padding: 12px 14px 12px 16px;
    margin: 2px 8px;
    min-height: 48px;                     /* WCAG tap target */
  }

  .menu-item-text {
    font-size: 14px;
  }

  .menu-item-icon {
    font-size: 22px;
  }

  /* ── Sidebar user footer on mobile ── */
  .sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,.08);
    margin-top: auto;
  }

  /* ── Main content — no left margin on mobile ── */
  .main-content {
    margin-left: 0 !important;
  }

  /* ── Show hamburger ── */
  #mobileMenuBtn { display: flex; }

  /* ── Top nav adjustments ── */
  .top-nav { padding: 0 16px; }
  .search-bar { margin: 0 10px; }

  /* ── Page layout ── */
  .filter-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .content-area { padding: 18px 16px; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE SIDEBAR OVERLAY — backdrop blur + dim
═══════════════════════════════════════════════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  z-index: 1000;
  transition: background 320ms cubic-bezier(.4,0,.2,1),
              backdrop-filter 320ms cubic-bezier(.4,0,.2,1);
  /* Prevent any touch scroll passing through */
  touch-action: none;
}

.sidebar-overlay.active {
  display: block;
  background: rgba(0, 0, 0, .48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: overlayFadeIn 320ms cubic-bezier(.4,0,.2,1) both;
}

@keyframes overlayFadeIn {
  from {
    background: rgba(0,0,0,0);
    backdrop-filter: blur(0);
    -webkit-backdrop-filter: blur(0);
  }
  to {
    background: rgba(0,0,0,.48);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
  }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — 768px and below extra tightening
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --topnav-h: 60px; }

  .form-row { flex-direction: column; gap: 0; }

  .filter-controls { flex-direction: column; }
  .filter-group    { min-width: unset; width: 100%; }

  .user-info { display: none; }
  .user-profile > .material-icons { display: none; }

  .search-bar { display: none; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .quick-actions-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

  /* Sidebar even tighter on small phones */
  .sidebar {
    width: 272px;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  }
}

/* 768px styles are in the MOBILE SIDEBAR section above */

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .content-area { padding: 16px 14px; }
  .modal { max-width: 98%; border-radius: var(--radius-lg); }
}

/* sidebar-overlay styles are in the MOBILE SIDEBAR section above */

/* ═══════════════════════════════════════════════════════════
   ATTENDANCE-SPECIFIC
═══════════════════════════════════════════════════════════ */
select[class^="att-status"],
.att-status-select {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 12.5px;
  font-family: var(--font-body);
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════
   PRINT
═══════════════════════════════════════════════════════════ */
@media print {
  .sidebar, .top-nav, .page-actions, .filter-controls,
  .pagination-controls, .modal-overlay, .loading-overlay { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .content-area { padding: 0 !important; }
}
/* ═══════════════════════════════════════════════════════════
   ATTENDANCE RADIO PILL BUTTONS
═══════════════════════════════════════════════════════════ */
.att-radio-group {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}

.att-radio-group input[type="radio"] {
  display: none;
}

.att-radio-group label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.18s ease;
  white-space: nowrap;
  user-select: none;
  background: var(--surface);
}

.att-radio-group label:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* Present */
.att-radio-group input[value="present"]:checked + label {
  background: #22c55e;
  border-color: #16a34a;
  color: #fff;
  box-shadow: 0 3px 10px rgba(34,197,94,0.35);
}

/* Absent */
.att-radio-group input[value="absent"]:checked + label {
  background: #ef4444;
  border-color: #dc2626;
  color: #fff;
  box-shadow: 0 3px 10px rgba(239,68,68,0.35);
}

/* Late */
.att-radio-group input[value="late"]:checked + label {
  background: #f59e0b;
  border-color: #d97706;
  color: #fff;
  box-shadow: 0 3px 10px rgba(245,158,11,0.35);
}

/* Reason input inside attendance row */
.att-reason-input {
  padding: 5px 9px;
  border: 1.5px solid #f59e0b;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-body);
  animation: fadeIn 0.18s ease;
}

.att-reason-input:focus {
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.2);
}

.att-reason-input.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.2);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}/* style.css lo Dropdown dynamic transitions */
.profile-dropdown a:hover {
    background-color: var(--brand-50) !important;
    color: var(--danger-dark) !important;
}