/* ============================================================
   SCHOOLSYS — Premium School Admin Dashboard
   Theme: Deep Space Navy + Electric Teal
   Fonts: Syne (headings) + DM Sans (body)
   ============================================================ */
   
  

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Manrope:wght@400;500;600;700;800&display=swap');

/* ─── CSS Variables g ──────────────────────────────────────── */
:root {
  /* Core Backgrounds - Obsidian & Deep Emerald */
  --bg:           #050505; /* Pure Obsidian */
  --bg2:          #0f0f0f; 
  --surface:      #161616; /* Dark Charcoal */
  --surface2:     #1e1e1e; 
  --surface3:     #ffffff; /* Pure Snow for specific panels */

  /* Borders */
  --border:       rgba(255, 255, 255, 0.08);
  --border2:      rgba(16, 185, 129, 0.20); /* Emerald tinted border */

  /* Primary Action - Emerald Green */
  --primary:      #10b981; /* Emerald */
  --primary-dim:  rgba(16, 185, 129, 0.12);
  --primary-glow: rgba(16, 185, 129, 0.30);
  --primary-hover: #34d399;

  /* Status Colors */
  --green:        #10b981;
  --green-dim:    rgba(16, 185, 129, 0.13);
  --yellow:       #fbbf24;
  --yellow-dim:   rgba(251, 191, 36, 0.13);
  --red:          #ef4444;
  --red-dim:      rgba(239, 68, 68, 0.13);
  --purple:       #8b5cf6;
  --purple-dim:   rgba(139, 92, 246, 0.13);
  --orange:       #f59e0b;
  --orange-dim:   rgba(245, 158, 11, 0.13);

  /* Typography */
  --text:         #ffffff; /* Pure White */
  --text2:        #a1a1aa; /* Muted Grey */
  --text3:        #52525b; /* Dark Zinc */

  --sidebar-w:    256px;
  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    16px;
  --shadow:       0 10px 40px rgba(0,0,0,0.8);
  --shadow-sm:    0 4px 20px rgba(0,0,0,0.5);
  --transition:   .2s cubic-bezier(.4, 0, .2, 1);

  --font-head:    'Manrope', 'Segoe UI', Arial, sans-serif;
  --font-body:    'Inter', 'Segoe UI', Arial, sans-serif;
}

/* ─── Light Mode Theme (Matching Reference) ──────────────── */
/* ─── Light Mode Force Override ─────────────────────────── */
body.light-mode {
  --bg: #F3F4F6 !important;
  --bg2: #F8FAFC !important;
  --surface: #FFFFFF !important;
  --surface2: #F9FAFB !important;
  --surface3: #E5E7EB !important;
  --text: #111827 !important;
  --text2: #4B5563 !important;
  --text3: #6B7280 !important;
  --border: rgba(15, 23, 42, 0.10) !important;
  --border2: rgba(16, 185, 129, 0.22) !important;
  --shadow: 0 12px 35px rgba(15, 23, 42, 0.08) !important;
  --shadow-sm: 0 6px 20px rgba(15, 23, 42, 0.06) !important;
}

body.light-mode,
body.light-mode .main-content,
body.light-mode .content-area,
body.light-mode .sidebar,
body.light-mode .topbar,
body.light-mode .stat-card,
body.light-mode .chart-card,
body.light-mode .table-container,
body.light-mode .panel,
body.light-mode .settings-panel,
body.light-mode .modal-content,
body.light-mode .profile-modal-layout,
body.light-mode .calendar-container,
body.light-mode .profile-card,
body.light-mode .card,
body.light-mode .section-card {
  background-color: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

body.light-mode .main-content *,
body.light-mode .sidebar *,
body.light-mode .topbar *,
body.light-mode .panel *,
body.light-mode .stat-card *,
body.light-mode .chart-card *,
body.light-mode .table-container *,
body.light-mode .settings-panel *,
body.light-mode .modal-content *,
body.light-mode .profile-modal-layout *,
body.light-mode .calendar-container * {
  color: inherit;
}

body.light-mode .nav-link,
body.light-mode .nav-link:hover,
body.light-mode .nav-item {
  color: var(--text2) !important;
}

body.light-mode .nav-link.active {
  background: rgba(16, 185, 129, 0.12) !important;
  color: var(--primary) !important;
}

body.light-mode .sb-search-inner,
body.light-mode .toolbar .search-box,
body.light-mode .toolbar .filter-select,
body.light-mode .toolbar input[type="search"],
body.light-mode .toolbar input[type="date"],
body.light-mode .search-box,
body.light-mode .form-input,
body.light-mode .setting-row input,
body.light-mode .setting-row select,
body.light-mode .profile-section input:not([disabled]),
body.light-mode #chartMonth {
  background-color: #FFFFFF !important;
  color: #111827 !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
}

body.light-mode .sb-search-inner {
  background: var(--bg2) !important;
}

body.light-mode #sidebarSearch,
body.light-mode .search-box input,
body.light-mode .toolbar input::placeholder {
  color: var(--text) !important;
}

body.light-mode .toolbar .search-box svg,
body.light-mode .toolbar .search-box .icon,
body.light-mode #chartMonth::-webkit-calendar-picker-indicator {
  color: var(--text2) !important;
  filter: invert(0) !important;
}

body.light-mode .filter-select,
body.light-mode .setting-row select,
body.light-mode #settingsTimezone,
body.light-mode #settingsLanguage,
body.light-mode #settingsDateFormat,
body.light-mode #settingsTimeout {
  background-color: #FFFFFF !important;
  color: #111827 !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  padding: 8px 12px !important;
  border-radius: var(--radius-sm);
  appearance: none !important;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234B5563'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.8rem center !important;
  background-size: 1rem !important;
  padding-right: 2.5rem !important;
}

body.light-mode .panel-actions .btn-secondary,
body.light-mode .btn-secondary {
  background: #F3F4F6 !important;
  color: #374151 !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
}

body.light-mode .panel-actions .btn-secondary:hover,
body.light-mode .btn-secondary:hover {
  background: #E5E7EB !important;
  color: #111827 !important;
}

body.light-mode .btn-primary {
  background: var(--primary) !important;
  color: #FFFFFF !important;
}

body.light-mode .modal-head,
body.light-mode .modal-foot,
body.light-mode .profile-left {
  background-color: #F9FAFB !important;
  border-color: rgba(0, 0, 0, 0.10) !important;
  color: #111827 !important;
}

body.light-mode .modal-content h3,
body.light-mode .modal-content h4,
body.light-mode .profile-section h4,
body.light-mode .setting-row label,
body.light-mode .setting-info h4 {
  color: #111827 !important;
}

body.light-mode .form-input:disabled,
body.light-mode input:disabled {
  background-color: #F3F4F6 !important;
  color: #6B7280 !important;
  border-color: rgba(0, 0, 0, 0.05) !important;
}

body.light-mode .setting-row,
body.light-mode .settings-group,
body.light-mode .table-row {
  border-color: rgba(0, 0, 0, 0.08) !important;
}

body.light-mode .setting-info p,
body.light-mode .setting-row small,
body.light-mode .stat-label,
body.light-mode .empty-title,
body.light-mode .toast-msg {
  color: #4B5563 !important;
}


/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
button { font-family: var(--font-body); cursor: pointer; }
input, select, textarea { font-family: var(--font-body); }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dim); }

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  padding: 24px;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(56,189,248,.06) 0%, transparent 65%);
  top: -200px; right: -200px;
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(52,211,153,.04) 0%, transparent 65%);
  bottom: -150px; left: -150px;
  pointer-events: none;
}

.login-wrap {
  z-index: 1;
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 44px 40px;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
  text-align: center;
}
.login-brand-icon {
  width: 86px;
  height: 86px;
  padding: 10px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(52, 211, 153, 0.08));
  border: 1px solid var(--border2);
  box-shadow: 0 10px 28px rgba(16, 185, 129, 0.12);
}

.login-brand-icon img{
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.login-brand-name {
  font-family: var(--font-head);
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--primary);
  line-height: 1.1;
}
.login-brand-sub {
  font-size: .72rem;
  color: var(--text2);
  letter-spacing: .2em;
  text-transform: uppercase;
  font-weight: 600;
}

.login-card h2 {
  font-family: var(--font-head);
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.login-card p.sub {
  font-size: .85rem;
  color: var(--text2);
  margin-bottom: 28px;
}

.login-form { display: flex; flex-direction: column; gap: 14px; }

.login-field { display: flex; flex-direction: column; gap: 5px; }
.login-field label { font-size: .78rem; font-weight: 600; color: var(--text2); letter-spacing: .03em; }
.login-field input {
  padding: 12px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .88rem;
  transition: var(--transition);
}
.login-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.login-field input::placeholder { color: var(--text3); }

.login-btn {
  margin-top: 6px;
  padding: 13px;
  background: var(--primary);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-head);
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .04em;
  transition: var(--transition);
}
.login-btn:hover {
  background: #60CDFF;
  transform: translateY(-1px);
  box-shadow: 0 4px 24px var(--primary-glow);
}
.forgot-password-btn,
.login-back-btn {
  display: block;
  margin: 14px auto 0;
  padding: 0;
  background: none;
  border: none;
  color: var(--primary);
  font-size: .8rem;
  cursor: pointer;
}
.forgot-password-btn:hover,
.login-back-btn:hover { color: var(--primary-hover); text-decoration: underline; }
.login-back-btn { margin-top: -4px; color: var(--text2); }

#loginStatus {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: .83rem;
  text-align: center;
  min-height: 36px;
  display: none;
}
#loginStatus.error   { display: block; background: var(--red-dim);   color: var(--red);   border: 1px solid rgba(248,113,113,.25); }
#loginStatus.success { display: block; background: var(--green-dim); color: var(--green); border: 1px solid rgba(52,211,153,.25); }

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

/* ─── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
  transition: transform var(--transition);
  overflow: hidden;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sb-brand-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}
.sb-brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.sb-brand-text {
  font-family: var(--font-head);
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--primary);
  line-height: 1.1;
}
.sb-brand-sub {
  font-size: .66rem;
  color: var(--text2);
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 2px;
}

.sb-search {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sb-search-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
}
.sb-search-inner input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: .82rem;
}
.sb-search-inner input:focus { outline: none; }
.sb-search-inner input::placeholder { color: var(--text3); }
.sb-search-icon { color: var(--text3); font-size: 12px; }

.sb-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav-group-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 0 8px;
  margin-bottom: 4px;
}

.nav-group { display: flex; flex-direction: column; gap: 2px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: .85rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  position: relative;
}
.nav-link:hover { color: var(--text); background: var(--surface2); }
.nav-link.active { color: var(--primary); background: var(--primary-dim); font-weight: 600; }
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
  margin-left: -10px;
}

.nav-icon { font-size: 14px; width: 16px; text-align: center; flex-shrink: 0; }

/* ─── Dropdown Menu Styles ─────────────────────────────────── */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: .85rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 45%;
  text-align: left;
  position: relative;
}

.nav-dropdown-toggle:hover {
  color: var(--text);
  background: var(--surface2);
}

.nav-dropdown-toggle.active {
  color: var(--primary);
  background: var(--primary-dim);
  font-weight: 600;
}

.nav-dropdown-toggle.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
  margin-left: -10px;
}

.nav-dropdown-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform var(--transition);
}

.nav-dropdown-toggle.active .nav-dropdown-icon {
  transform: rotate(180deg);
}

/* Submenu Container */
.nav-submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height var(--transition), opacity var(--transition);
  pointer-events: none;
}

.nav-submenu.open {
  max-height: 500px;
  opacity: 1;
  pointer-events: auto;
}

/* Submenu Items */
.nav-submenu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px 8px 28px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: .80rem;
  font-weight: 400;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
}

.nav-submenu-item:hover {
  color: var(--text);
  background: var(--surface2);
  padding-left: 30px;
}

.nav-submenu-item.active {
  color: var(--primary);
  background: var(--primary-dim);
  font-weight: 500;
  padding-left: 26px;
}

.nav-submenu-item.active::before {
  content: '';
  position: absolute;
  left: 10px;
  width: 3px;
  height: 16px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.submenu-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.nav-submenu-item:hover .submenu-icon,
.nav-submenu-item.active .submenu-icon {
  opacity: 1;
}

/* Mobile responsive - ensure touch-friendly sizes */
@media (max-width: 768px) {
  .nav-dropdown-toggle,
  .nav-submenu-item {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .nav-submenu-item {
    padding-left: 32px;
  }
}

.nav-badge {
  margin-left: auto;
  background: var(--primary-dim);
  color: var(--primary);
  font-size: .66rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
}

.sb-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 8px;
}
.sb-user:hover { background: var(--bg2); }
.sb-avatar {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--primary-dim);
  border: 1px solid var(--border2);
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: .75rem;
  color: var(--primary);
  flex-shrink: 0;
}
.sb-user-name { font-size: .83rem; font-weight: 600; color: var(--text); }
.sb-user-role { font-size: .68rem; color: var(--text3); }

.btn-logout {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: .82rem;
  transition: var(--transition);
}
.btn-logout:hover { border-color: var(--red); color: var(--red); background: var(--red-dim); }

/* ─── Main Content ────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Topbar ──────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
  flex-shrink: 0;
}
.topbar-left { min-width: 0; }
.topbar-title {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-sub { font-size: .78rem; color: var(--text3); margin-top: 1px; }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-search {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
}
.topbar-search input {
  border: none; background: transparent; color: var(--text);
  font-size: .83rem; width: 160px;
}
.topbar-search input:focus { outline: none; }
.topbar-search input::placeholder { color: var(--text3); }

.topbar-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
  position: relative;
  color: var(--text2);
}
.topbar-icon:hover { border-color: var(--border2); color: var(--text); }

.notif-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--surface);
}

/* ─── Page Body ───────────────────────────────────────────── */
.page-body {
  flex: 1;
  padding: 26px 28px;
}

.hidden { display: none !important; }

/* ─── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header h2 {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.page-header p { font-size: .78rem; color: var(--text3); margin-top: 2px; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════
   STAT CARDS
   ═══════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  place-items: center;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card.c-blue::after   { background: var(--primary); }
.stat-card.c-green::after  { background: var(--green); }
.stat-card.c-yellow::after { background: var(--yellow); }
.stat-card.c-red::after    { background: var(--red); }
.stat-card.c-purple::after { background: var(--purple); }
.stat-card:hover { border-color: var(--border2); transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }

.c-blue   .stat-icon { background: var(--primary-dim); }
.c-green  .stat-icon { background: var(--green-dim); }
.c-yellow .stat-icon { background: var(--yellow-dim); }
.c-red    .stat-icon { background: var(--red-dim); }
.c-purple .stat-icon { background: var(--purple-dim); }

.stat-change {
  font-size: .68rem;
  padding: 2px 7px;
  border-radius: 99px;
  font-weight: 600;
}
.stat-change.up   { background: var(--green-dim);  color: var(--green); }
.stat-change.down { background: var(--red-dim);    color: var(--red); }
.stat-change.flat { background: var(--surface2);   color: var(--text3); }

.stat-value {
  font-family: var(--font-head);
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
  color: white;
}
.stat-label { font-size: .78rem; color: var(--text2); }

/* ═══════════════════════════════════════════════════════════
   PANELS / CARDS
   ═══════════════════════════════════════════════════════════ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-padded { padding: 20px 22px; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.panel-title { font-family: var(--font-head); font-size: .92rem; font-weight: 700; color: var(--text); }
.panel-sub   { font-size: .75rem; color: var(--text3); margin-top: 2px; }
.panel-actions { display: flex; gap: 8px; align-items: center; }

/* ─── Chart ───────────────────────────────────────────────── */
.chart-area { padding: 20px 22px 14px; }
canvas { width: 100% !important; height: 200px; display: block; }

.chart-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 22px;
}

/* ═══════════════════════════════════════════════════════════
   CALENDAR
   ═══════════════════════════════════════════════════════════ */
.calendar-container {
  padding: 18px;
  background: var(--surface);
}

.calendar {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: min(100%, 760px);
  margin: 0 auto;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.calendar-weekday {
  text-align: center;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 0;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-day {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--surface2);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 74px;
}

.calendar-day.empty {
  background: transparent;
  border: none;
  cursor: default;
}

.calendar-day:not(.empty):hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
}

.calendar-day.today {
  border: 2px solid var(--primary);
  background: var(--primary-dim) !important;
  font-weight: 700;
}

/* Status borders */
.calendar-day.status-full {
  background: var(--surface2);
  border-color: var(--green);
}

.calendar-day.status-good {
  background: var(--surface2);
  border-color: rgba(52, 211, 153, 0.6);
}

.calendar-day.status-medium {
  background: var(--surface2);
  border-color: rgba(251, 191, 36, 0.6);
}

.calendar-day.status-low {
  background: var(--surface2);
  border-color: rgba(239, 68, 68, 0.6);
}

.day-number {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.day-stats {
  display: flex;
  gap: 3px;
  justify-content: center;
  flex-wrap: wrap;
}

.stat-badge {
  font-size: .65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  min-width: 20px;
  text-align: center;
  color: white;
}

.stat-badge.present {
  background: var(--green);
  color: white;
}

.stat-badge.absent {
  background: var(--red);
  color: white;
}

.stat-badge.late {
  background: var(--yellow);
  color: #000;
}

/* Light mode calendar fixes */
body.light-mode .calendar-container {
  background: #FFFFFF;
}

body.light-mode .calendar-day {
  background: #F9FAFB;
  border-color: rgba(0, 0, 0, 0.1);
  color: #111827;
}

body.light-mode .calendar-day.empty {
  background: transparent;
}

body.light-mode .calendar-day.status-full {
  background: #F9FAFB;
  border-color: var(--green);
}

body.light-mode .calendar-day.status-good {
  background: #F9FAFB;
  border-color: rgba(52, 211, 153, 0.7);
}

body.light-mode .calendar-day.status-medium {
  background: #F9FAFB;
  border-color: rgba(251, 191, 36, 0.7);
}

body.light-mode .calendar-day.status-low {
  background: #F9FAFB;
}

body.light-mode .calendar-day.today {
  background: rgba(16, 185, 129, 0.16) !important;
}

body.light-mode .day-number {
  color: #111827;
}

body.light-mode .calendar-weekday {
  color: #4B5563;
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: .84rem;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: var(--bg); border-color: var(--primary); font-weight: 600; }
.btn-primary:hover { background: #60CDFF; box-shadow: 0 4px 16px var(--primary-glow); transform: translateY(-1px); }
.btn-secondary { background: var(--surface2); color: var(--text2); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--border2); color: var(--text); }
.btn-danger { background: var(--red-dim); color: var(--red); border-color: rgba(248,113,113,.3); }
.btn-danger:hover { background: rgba(248,113,113,.22); }
.btn-sm { padding: 5px 11px; font-size: .78rem; }

/* ═══════════════════════════════════════════════════════════
   TOOLBAR (above tables)
   ═══════════════════════════════════════════════════════════ */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.search-box {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  transition: var(--transition);
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.search-box input { border: none; background: transparent; color: var(--text); font-size: .83rem; width: 190px; }
.search-box input:focus { outline: none; }
.search-box input::placeholder { color: var(--text3); }
.search-box svg { color: var(--text3); flex-shrink: 0; }

.filter-select {
  padding: 7px 28px 7px 11px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: .82rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%234E6580' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  cursor: pointer;
  transition: var(--transition);
}
.filter-select:focus { outline: none; border-color: var(--primary); }

/* ═══════════════════════════════════════════════════════════
   DATA TABLE
   ═══════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; min-width: 650px; }

thead tr { background: var(--surface2); }
th {
  padding: 11px 16px;
  text-align: left;
  font-size: .69rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 13px 16px;
  font-size: .84rem;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--surface2); }
tbody tr:last-child td { border-bottom: none; }

.cb-cell { width: 42px; }
.cb-cell input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

/* ─── Table footer ────────────────────────────────────────── */
.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}
.table-count { font-size: .78rem; color: var(--text3); }

.pagination { display: flex; gap: 4px; }
.page-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: .78rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: var(--transition);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: var(--bg); border-color: var(--primary); font-weight: 700; }

/* ═══════════════════════════════════════════════════════════
   ENTITY DISPLAY (avatars, names, pills)
   ═══════════════════════════════════════════════════════════ */
.ent-row { display: flex; align-items: center; gap: 10px; }
.ent-name { font-size: .86rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.ent-sub  { font-size: .73rem; color: var(--text3); }

.av {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: .72rem;
  flex-shrink: 0;
  text-transform: uppercase;
}
.av-blue   { background: var(--primary-dim); color: var(--primary); }
.av-green  { background: var(--green-dim);   color: var(--green);   }
.av-yellow { background: var(--yellow-dim);  color: var(--yellow);  }
.av-purple { background: var(--purple-dim);  color: var(--purple);  }
.av-red    { background: var(--red-dim);     color: var(--red);     }
.av-orange { background: var(--orange-dim);  color: var(--orange);  }

.pill {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 99px;
  font-size: .71rem; font-weight: 600; letter-spacing: .02em;
}
.pill-green  { background: var(--green-dim);    color: var(--green);   }
.pill-red    { background: var(--red-dim);      color: var(--red);     }
.pill-yellow { background: var(--yellow-dim);   color: var(--yellow);  }
.pill-blue   { background: var(--primary-dim);  color: var(--primary); }
.pill-purple { background: var(--purple-dim);   color: var(--purple);  }
.pill-grey   { background: var(--surface2);     color: var(--text3);   }
.pill-orange { background: var(--orange-dim);   color: var(--orange);  }

.tag-row { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
  padding: 2px 8px; border-radius: 99px;
  background: var(--surface3);
  color: var(--text2);
  font-size: .71rem; font-weight: 500;
}

/* ─── Row actions ─────────────────────────────────────────── */
.row-acts { display: flex; gap: 5px; }
.act-btn {
  width: 27px; height: 27px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 11px;
  transition: var(--transition);
}
.act-btn:hover             { border-color: var(--primary); color: var(--primary); background: var(--primary-dim); }
.act-btn.danger:hover      { border-color: var(--red);     color: var(--red);     background: var(--red-dim); }

/* ═══════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════ */
.user-management-count {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text2);
  font-size: .78rem;
  font-weight: 600;
}
.user-management-search input { width: min(320px, 52vw); }
.user-management-table { min-width: 780px; }
.user-management-username {
  font-size: .78rem;
  color: var(--text3);
}
.password-target {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
}
.password-rules {
  display: grid;
  gap: 7px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg2);
}
.password-rules span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text3);
  font-size: .76rem;
}
.password-rules span::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text3);
}
.password-rules span.passed {
  color: var(--green);
}
.password-rules span.passed::before {
  background: var(--green);
}
.btn:disabled {
  opacity: .65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(5px);
  display: grid; place-items: center;
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  width: 100%; max-width: 520px;
  box-shadow: var(--shadow);
  animation: mIn .2s cubic-bezier(.34,1.56,.64,1);
}
.modal-box.wide { max-width: 680px; }
.modal-box.x-wide { max-width: 820px; }

@keyframes mIn {
  from { opacity: 0; transform: scale(.93) translateY(12px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.modal-head h2 { font-family: var(--font-head); font-size: 1.05rem; font-weight: 700; color: var(--text); }
.modal-close {
  width: 28px; height: 28px; border-radius: 7px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text3); cursor: pointer; display: grid; place-items: center;
  font-size: 15px; transition: var(--transition);
}
.modal-close:hover { border-color: var(--border2); color: var(--text); background: var(--surface2); }

.modal-body {
  padding: 22px 24px;
  max-height: 62vh;
  overflow-y: auto;
  background: var(--surface);
}

.modal-foot {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}

/* ═══════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════ */
.form-grid   { display: grid; gap: 14px; }
.form-2col   { grid-template-columns: 1fr 1fr; display: grid; gap: 14px; }
.form-group  { display: flex; flex-direction: column; gap: 5px; }

.form-label {
  font-size: .77rem;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: .03em;
}
.form-label .req { color: var(--red); margin-left: 2px; }

.form-input, .form-select {
  padding: 9px 13px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .86rem;
  transition: var(--transition);
  width: 100%;
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-input::placeholder { color: var(--text3); }
.form-input[readonly] { background: var(--surface2); color: var(--text3); cursor: not-allowed; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%234E6580' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-color: var(--bg2);
  padding-right: 30px;
  cursor: pointer;
}

.input-row { display: flex; gap: 8px; }
.input-row .form-input { flex: 1; }

.form-hint { font-size: .73rem; color: var(--text3); margin-top: 2px; }

.form-divider {
  font-size: .71rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin: 4px 0;
}

/* ═══════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════ */
#toastContainer {
  position: fixed;
  bottom: 22px; right: 22px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 270px; max-width: 350px;
  animation: tIn .28s cubic-bezier(.34,1.56,.64,1);
  pointer-events: all;
}
@keyframes tIn { from { opacity:0; transform: translateX(40px); } to { opacity:1; transform: translateX(0); } }
.toast-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title  { font-size: .84rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.toast-msg    { font-size: .78rem; color: var(--text2); margin-top: 1px; }
.toast-dismiss { color: var(--text3); cursor: pointer; font-size: 14px; flex-shrink: 0; transition: color var(--transition); }
.toast-dismiss:hover { color: var(--text); }
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--primary); }
.toast.warning { border-left: 3px solid var(--yellow); }

/* ═══════════════════════════════════════════════════════════
   SETTINGS MODAL
   ═══════════════════════════════════════════════════════════ */
.settings-layout {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 22px;
}
.settings-tabs { display: flex; flex-direction: column; gap: 3px; }
.tab-btn {
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  border: none; background: transparent;
  color: var(--text2);
  font-size: .83rem; cursor: pointer;
  text-align: left; transition: var(--transition);
}
.tab-btn:hover { background: var(--surface2); color: var(--text); }
.tab-btn.active { background: var(--primary-dim); color: var(--primary); font-weight: 600; }
.settings-panel { display: none; }
.settings-panel.active { display: grid; gap: 18px; }
.settings-panel h3 { font-family: var(--font-head); font-size: .95rem; font-weight: 700; margin-bottom: 4px; }

.setting-row { display: grid; gap: 6px; }
.setting-row label { font-size: .78rem; font-weight: 600; color: var(--text2); }
.setting-row input, .setting-row select, .setting-row textarea {
  padding: 9px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .85rem;
  width: 100%;
  font-family: var(--font-body);
  transition: var(--transition);
}
.setting-row input:focus, .setting-row select:focus { outline: none; border-color: var(--primary); }
.setting-row textarea { resize: vertical; min-height: 90px; }
.setting-hint { font-size: .73rem; color: var(--text3); }

.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.toggle-label { flex: 1; }
.toggle-label span { font-size: .78rem; font-weight: 600; color: var(--text2); display: block; }
.toggle-label small { font-size: .72rem; color: var(--text3); }

.toggle {
  position: relative;
  width: 46px; height: 25px;
  background: var(--surface3);
  border-radius: 99px;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}
.toggle input { display: none; }
.toggle-knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 19px; height: 19px;
  background: #fff;
  border-radius: 50%;
  transition: left var(--transition);
}
.toggle input:checked ~ .toggle-knob { left: 24px; }
.toggle:has(input:checked) { background: var(--primary); }

/* ═══════════════════════════════════════════════════════════
   PROFILE MODAL
   ═══════════════════════════════════════════════════════════ */
.profile-modal-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
}
.profile-left {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  border-right: 1px solid var(--border);
  padding-right: 24px;
  background: var(--surface2);
  border-radius: 12px;
  padding: 16px;
}
.profile-av-lg {
  width: 90px; height: 90px;
  border-radius: 18px;
  background: var(--primary-dim);
  border: 2px solid var(--border2);
  display: grid; place-items: center;
  font-family: var(--font-head);
  font-weight: 800; font-size: 1.8rem;
  color: var(--primary);
}
.profile-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--primary-dim);
  color: var(--primary);
  font-size: .72rem; font-weight: 700;
}
.profile-right { display: grid; gap: 22px; }
.profile-section h4 { font-family: var(--font-head); font-size: .83rem; font-weight: 700; margin-bottom: 12px; color: var(--text); }
.profile-section { display: grid; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.profile-section:last-child { border-bottom: none; padding-bottom: 0; }

.inline-edit { display: flex; gap: 7px; align-items: center; }
.inline-edit .form-input { flex: 1; }
.edit-btn {
  width: 33px; height: 33px;
  border: 1px solid var(--border); background: var(--surface2);
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  cursor: pointer; font-size: 12px;
  transition: var(--transition);
}
.edit-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ═══════════════════════════════════════════════════════════
   GRADES SECTION SPECIFIC
   ═══════════════════════════════════════════════════════════ */
.grade-badge {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--font-head);
  font-weight: 800; font-size: .9rem;
}
.grade-A  { background: var(--green-dim);  color: var(--green); }
.grade-B  { background: var(--primary-dim); color: var(--primary); }
.grade-C  { background: var(--yellow-dim); color: var(--yellow); }
.grade-D  { background: var(--orange-dim); color: var(--orange); }
.grade-F  { background: var(--red-dim);    color: var(--red); }

.score-bar-wrap { flex: 1; height: 5px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.score-bar { height: 100%; border-radius: 99px; background: var(--green); }

/* ═══════════════════════════════════════════════════════════
   ATTENDANCE SECTION
   ═══════════════════════════════════════════════════════════ */
.att-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.att-mini {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.att-mini-val { font-family: var(--font-head); font-size: 1.4rem; font-weight: 800; }
.att-mini-lbl { font-size: .73rem; color: var(--text3); margin-top: 2px; }

.scanner-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 20px;
  align-items: center;
  margin: 18px 22px;
  padding: 16px 18px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
}
.scanner-panel-copy { min-width: 0; }
.scanner-status {
  margin-top: 8px;
  color: var(--text3);
  font-size: .76rem;
}
.scanner-indicator {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-dim);
}
.scanner-indicator.busy { background: var(--yellow); box-shadow: 0 0 0 4px var(--yellow-dim); }
.scanner-indicator.success { background: var(--green); box-shadow: 0 0 0 4px var(--green-dim); }
.scanner-indicator.error,
.scanner-indicator.duplicate { background: var(--red); box-shadow: 0 0 0 4px var(--red-dim); }
.scanner-indicator.idle { background: var(--text3); box-shadow: 0 0 0 4px var(--surface); }
.scanner-result {
  grid-column: 1 / -1;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.scanner-result-title { color: var(--green); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.scanner-student-name { margin-top: 5px; color: var(--text); font-family: var(--font-head); font-size: 1.05rem; font-weight: 700; }
.scanner-detail { margin-top: 3px; color: var(--text2); font-size: .78rem; }
.scanner-result-status { margin-top: 8px; color: var(--green); font-family: var(--font-head); font-size: .95rem; font-weight: 800; }
.scanner-result-error .scanner-result-title,
.scanner-result-error .scanner-result-status { color: var(--red); }
.scanner-result-duplicate .scanner-result-title { color: var(--yellow); }

/* ═══════════════════════════════════════════════════════════
   EMPTY STATE / LOADER
   ═══════════════════════════════════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
  padding: 56px 20px;
  color: var(--text3);
  text-align: center;
}
.empty-icon { font-size: 2.6rem; opacity: .4; }
.empty-title { font-family: var(--font-head); font-size: .95rem; font-weight: 700; color: var(--text2); }
.empty-sub   { font-size: .8rem; max-width: 260px; line-height: 1.6; }

.loader { display: flex; justify-content: center; padding: 48px; }
.spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════
   TIME / DATE cells
   ═══════════════════════════════════════════════════════════ */
.time-cell .date { display: block; font-size: .84rem; font-weight: 600; color: var(--text); }
.time-cell .time { font-size: .73rem; color: var(--text3); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .chart-row { grid-template-columns: 1fr; }
  .att-mini-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 640px) {
  .scanner-panel { margin: 14px; }
}
@media (max-width: 860px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); width: 256px; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .settings-layout { grid-template-columns: 1fr; }
  .profile-modal-layout { grid-template-columns: 1fr; }
  .profile-left { border-right: none; border-bottom: 1px solid var(--border); padding-right: 0; padding-bottom: 18px; }
  .form-2col { grid-template-columns: 1fr; }
}

/* ─── Month/Date inputs ───────────────────────────────────── */
input[type="month"], input[type="date"], input[type="time"], input[type="number"] {
  padding: 7px 11px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: .82rem;
  cursor: pointer;
}
input[type="month"]:focus, input[type="date"]:focus, input[type="time"]:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ═══════════════════════════════════════════════════════════
   REPORTS & CHARTS
   ═══════════════════════════════════════════════════════════ */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.chart-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.1);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.chart-header h3 {
  font-family: var(--font-head);
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.chart-loader {
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-body {
  position: relative;
  height: 300px;
}

.chart-card[style*="grid-column: 1 / -1"] .chart-body {
  height: 250px;
}

/* Chart.js customization */
canvas {
  max-height: 100%;
}

/* Summary stat cards */
.stat-card {
  border-radius: var(--radius-lg);
  padding: 20px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
  border: 1px solid var(--border2);
  transition: all var(--transition);
}

.stat-card.c-blue {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
  border-color: rgba(59, 130, 246, 0.2);
}

.stat-card.c-green {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
  border-color: rgba(16, 185, 129, 0.2);
}

.stat-card.c-purple {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
  border-color: rgba(139, 92, 246, 0.2);
}

.stat-card.c-orange {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
  border-color: rgba(245, 158, 11, 0.2);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.15);
  border-color: var(--primary);
}

.stat-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.stat-change {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--green-dim);
  color: var(--green);
}

.stat-change.flat {
  background: var(--yellow-dim);
  color: var(--yellow);
}

.stat-value {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin: 8px 0;
}

.stat-label {
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
}

/* Responsive design for mobile */
@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .chart-body {
    height: 250px;
  }

  .chart-card[style*="grid-column: 1 / -1"] .chart-body {
    height: 200px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .chart-header h3 {
    font-size: 0.85rem;
  }

  .chart-body {
    height: 200px;
  }

  .stat-value {
    font-size: 24px;
  }
}

/* Print styles */
@media print {
  .page-header-actions,
  .toolbar,
  .pagination,
  .table-footer {
    display: none !important;
  }

  .chart-card,
  .stat-card {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  body {
    background: white;
    color: black;
  }

  .main-content section {
    background: white;
    color: black;
  }
}

@media (max-width: 860px) {
  .user-management-search,
  .user-management-search input,
  .user-management-toolbar .toolbar-left,
  .user-management-toolbar .toolbar-right {
    width: 100%;
  }
  .user-management-toolbar .filter-select {
    flex: 1 1 150px;
  }
}

@media (max-width: 640px) {
  .user-management-table {
    min-width: 0;
  }
  .user-management-table thead {
    display: none;
  }
  .user-management-table,
  .user-management-table tbody,
  .user-management-table tr,
  .user-management-table td {
    display: block;
    width: 100%;
  }
  .user-management-table tr {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }
  .user-management-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 0;
    text-align: right;
  }
  .user-management-table td::before {
    content: attr(data-label);
    color: var(--text3);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-align: left;
  }
  .user-management-table td:first-child {
    display: block;
    text-align: left;
  }
  .user-management-table td:first-child::before {
    display: none;
  }
  .table-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
}
