/* ═══════════════════════════════════════════════════════════════
   INSHAL SCHOOL ERP — COMPLETE DESIGN SYSTEM
   Version 2.0 | Vijayapur, Karnataka
═══════════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  /* Brand */
  --brand-primary:        #1a6b3c;
  --brand-primary-dark:   #145530;
  --brand-primary-light:  #2d8a52;
  --brand-primary-xlight: #e8f5ee;
  --brand-accent:         #f59e0b;
  --brand-accent-dark:    #d97706;
  --brand-accent-xlight:  #fef3c7;

  /* Semantic */
  --success:        #16a34a;
  --success-light:  #dcfce7;
  --warning:        #d97706;
  --warning-light:  #fef3c7;
  --danger:         #dc2626;
  --danger-light:   #fee2e2;
  --info:           #2563eb;
  --info-light:     #dbeafe;
  --purple:         #7c3aed;
  --purple-light:   #ede9fe;

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

  /* Surfaces */
  --bg-page:      #f0f4f8;
  --bg-card:      #ffffff;
  --bg-sidebar:   #0f1f14;
  --bg-topbar:    #ffffff;
  --border-color: #e5e7eb;
  --border-light: #f3f4f6;

  /* Text */
  --text-primary:  #111827;
  --text-secondary:#374151;
  --text-muted:    #6b7280;
  --text-light:    #9ca3af;
  --text-inverse:  #ffffff;

  /* Sidebar */
  --sidebar-width:          240px;
  --sidebar-collapsed-width: 64px;
  --topbar-height:           60px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:  0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
  --shadow-xl:  0 20px 25px rgba(0,0,0,0.10), 0 10px 10px rgba(0,0,0,0.04);

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: 0.2s ease;
  --transition-slow: 0.35s ease;
}

/* Dark theme */
[data-theme="dark"] {
  --bg-page:      #0d1117;
  --bg-card:      #161b22;
  --bg-sidebar:   #0a0f0d;
  --bg-topbar:    #161b22;
  --border-color: #30363d;
  --border-light: #21262d;
  --text-primary:  #e6edf3;
  --text-secondary:#c9d1d9;
  --text-muted:    #8b949e;
  --text-light:    #6e7681;
  --gray-50:   #161b22;
  --gray-100:  #21262d;
  --gray-200:  #30363d;
  --brand-primary-xlight: #0d2818;
  --brand-accent-xlight:  #2d1f00;
  --success-light:  #0d2818;
  --danger-light:   #2d0a0a;
  --info-light:     #0d1f3c;
  --purple-light:   #1a0d3c;
  --warning-light:  #2d1f00;
}

/* ── RESET & BASE ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,h2,h3,h4,h5,h6 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ── ANIMATIONS ─────────────────────────────────────────────── */
@keyframes fadeIn    { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes slideIn   { from { opacity:0; transform:translateX(-16px); } to { opacity:1; transform:translateX(0); } }
@keyframes scaleIn   { from { opacity:0; transform:scale(0.95); } to { opacity:1; transform:scale(1); } }
@keyframes pulse     { 0%,100% { opacity:1; } 50% { opacity:0.5; } }
@keyframes spin      { to { transform:rotate(360deg); } }
@keyframes blobFloat { 0%,100% { transform:translate(0,0) scale(1); } 33% { transform:translate(30px,-20px) scale(1.05); } 66% { transform:translate(-20px,15px) scale(0.97); } }
@keyframes toastIn   { from { opacity:0; transform:translateX(100%); } to { opacity:1; transform:translateX(0); } }
@keyframes toastOut  { from { opacity:1; transform:translateX(0); } to { opacity:0; transform:translateX(100%); } }

.fade-in  { animation: fadeIn 0.3s ease forwards; }
.slide-in { animation: slideIn 0.3s ease forwards; }

/* ═══════════════════════════════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════════════════════════════ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0a1f10 0%, #1a3d20 50%, #0f2d18 100%);
}

.login-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: blobFloat 12s ease-in-out infinite;
}
.blob-1 { width:500px; height:500px; background:#2d8a52; top:-100px; left:-100px; animation-delay:0s; }
.blob-2 { width:400px; height:400px; background:#f59e0b; bottom:-80px; right:-80px; animation-delay:-4s; }
.blob-3 { width:300px; height:300px; background:#1a6b3c; top:50%; left:50%; transform:translate(-50%,-50%); animation-delay:-8s; }

.login-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 960px;
  width: 100%;
  margin: 20px;
  gap: 0;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.05);
  position: relative;
  z-index: 1;
}

/* Left panel */
.login-left {
  background: linear-gradient(160deg, rgba(26,107,60,0.9) 0%, rgba(15,31,20,0.95) 100%);
  backdrop-filter: blur(20px);
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  color: white;
  border-right: 1px solid rgba(255,255,255,0.08);
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  border: 2px solid rgba(255,255,255,0.15);
}
.login-logo img { width: 100%; height: 100%; object-fit: cover; }
.login-logo-fallback { font-size: 36px; }

.login-school-name {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: white;
  margin-bottom: 4px;
}
.login-school-sub { font-size: 13px; opacity: 0.7; margin-bottom: 24px; }

.login-tagline {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  opacity: 0.9;
  margin-bottom: 28px;
  border-left: 3px solid var(--brand-accent);
  padding-left: 12px;
}

.login-features { display: flex; flex-direction: column; gap: 10px; margin-bottom: 32px; }
.login-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  opacity: 0.85;
}
.login-feature span { font-size: 16px; }

.login-stats {
  display: flex;
  gap: 24px;
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.login-stat { text-align: center; }
.login-stat-val { font-family: 'Bricolage Grotesque', sans-serif; font-size: 24px; font-weight: 800; color: var(--brand-accent); }
.login-stat-lbl { font-size: 11px; opacity: 0.7; margin-top: 2px; }

/* Right panel */
.login-right {
  background: var(--bg-card);
  padding: 48px 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card { width: 100%; max-width: 380px; }

.login-card-header { margin-bottom: 24px; }
.login-card-header h2 { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.login-card-header p { font-size: 13px; color: var(--text-muted); }

/* Role grid */
.role-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.role-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  transition: all var(--transition);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.role-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); background: var(--brand-primary-xlight); }
.role-btn.active { border-color: var(--brand-primary); background: var(--brand-primary-xlight); color: var(--brand-primary); }
.role-icon { font-size: 20px; }
.role-label { font-size: 10px; font-weight: 600; }

/* Login button */
.btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-light));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  font-family: 'Bricolage Grotesque', sans-serif;
  transition: all var(--transition);
  box-shadow: 0 4px 12px rgba(26,107,60,0.3);
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(26,107,60,0.4); }
.btn-login:active { transform: translateY(0); }

/* OTP inputs */
.otp-input {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: all var(--transition);
}
.otp-input:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(26,107,60,0.1); }

/* ═══════════════════════════════════════════════════════════════
   APP SHELL LAYOUT
═══════════════════════════════════════════════════════════════ */
#app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  transition: grid-template-columns var(--transition-slow);
}

#app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}

/* ── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
  background: var(--bg-sidebar);
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition-slow);
  width: var(--sidebar-width);
  z-index: 100;
}

.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  min-height: 64px;
  flex-shrink: 0;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.12);
}
.sidebar-logo img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-school { flex: 1; overflow: hidden; }
.sidebar-school-name {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-school-sub { font-size: 10px; color: rgba(255,255,255,0.4); margin-top: 1px; }

.sidebar-collapse-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  padding: 4px;
  border-radius: 6px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover { color: white; background: rgba(255,255,255,0.08); }
.sidebar-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }

.nav-section-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  padding: 12px 16px 4px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  margin: 1px 8px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
  border: none;
  background: none;
  width: calc(100% - 16px);
  text-align: left;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.9); }
.nav-item.active {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-light));
  color: white;
  box-shadow: 0 2px 8px rgba(26,107,60,0.4);
}

.nav-icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-label { flex: 1; }
.nav-badge {
  background: var(--danger);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 99px;
  flex-shrink: 0;
}

/* Collapsed sidebar */
.sidebar-collapsed .sidebar-school,
.sidebar-collapsed .sidebar-collapse-btn,
.sidebar-collapsed .nav-section-label,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-badge,
.sidebar-collapsed .sidebar-user-info { display: none; }

.sidebar-collapsed .nav-item { justify-content: center; padding: 10px; margin: 1px 8px; }
.sidebar-collapsed .sidebar-header { justify-content: center; }
.sidebar-collapsed .sidebar-user { justify-content: center; }

/* Sidebar footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
}
.sidebar-user:hover { background: rgba(255,255,255,0.06); }

.sidebar-user-name { font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.85); }
.sidebar-user-role { font-size: 10px; color: rgba(255,255,255,0.4); }

/* ── TOPBAR ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

.topbar-menu-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  display: flex;
  align-items: center;
}
.topbar-menu-btn:hover { background: var(--gray-100); color: var(--text-primary); }

.topbar-breadcrumb {
  font-size: 15px;
  font-weight: 700;
  font-family: 'Bricolage Grotesque', sans-serif;
  color: var(--text-primary);
}

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

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gray-100);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  transition: all var(--transition);
}
.topbar-search:focus-within { border-color: var(--brand-primary); background: var(--bg-card); box-shadow: 0 0 0 3px rgba(26,107,60,0.08); }
.topbar-search svg { color: var(--text-muted); flex-shrink: 0; }
.topbar-search input { border: none; background: none; outline: none; font-size: 13px; width: 180px; color: var(--text-primary); }
.topbar-search input::placeholder { color: var(--text-muted); }

.topbar-icon-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 7px 9px;
  color: var(--text-muted);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  position: relative;
}
.topbar-icon-btn:hover { background: var(--gray-100); color: var(--text-primary); }

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: white;
  font-size: 9px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-topbar);
}

.topbar-year-badge {
  background: var(--brand-primary-xlight);
  color: var(--brand-primary);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(26,107,60,0.2);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
}
.topbar-user:hover { background: var(--gray-100); }

/* ── MAIN CONTENT ───────────────────────────────────────────── */
.main-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
}

.module-area {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════════
   COMPONENT LIBRARY
═══════════════════════════════════════════════════════════════ */

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--gray-50);
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'Bricolage Grotesque', sans-serif;
}

.card-body { padding: 16px; }

/* ── KPI CARDS ──────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.kpi-card.green::before  { background: var(--success); }
.kpi-card.blue::before   { background: var(--info); }
.kpi-card.gold::before   { background: var(--warning); }
.kpi-card.red::before    { background: var(--danger); }
.kpi-card.purple::before { background: var(--purple); }
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

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

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.kpi-icon.green  { background: var(--success-light); }
.kpi-icon.blue   { background: var(--info-light); }
.kpi-icon.gold   { background: var(--warning-light); }
.kpi-icon.red    { background: var(--danger-light); }
.kpi-icon.purple { background: var(--purple-light); }

.kpi-trend {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}
.kpi-trend.up   { background: var(--success-light); color: var(--success); }
.kpi-trend.down { background: var(--danger-light); color: var(--danger); }

.kpi-value {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.kpi-sub   { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-accent, .btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
}

.btn-primary {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}
.btn-primary:hover { background: var(--brand-primary-dark); border-color: var(--brand-primary-dark); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(26,107,60,0.25); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--border-color);
}
.btn-secondary:hover { background: var(--gray-100); border-color: var(--gray-300); }

.btn-accent {
  background: var(--brand-accent);
  color: white;
  border-color: var(--brand-accent);
}
.btn-accent:hover { background: var(--brand-accent-dark); }

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.w-full { width: 100%; justify-content: center; }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background: var(--success-light); color: var(--success); }
.badge-red    { background: var(--danger-light); color: var(--danger); }
.badge-yellow { background: var(--warning-light); color: var(--warning); }
.badge-blue   { background: var(--info-light); color: var(--info); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-gray   { background: var(--gray-100); color: var(--gray-600); }

/* ── FORMS ──────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

.form-control {
  padding: 8px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  transition: all var(--transition);
  width: 100%;
}
.form-control:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(26,107,60,0.08); }
.form-control::placeholder { color: var(--text-light); }

.form-select {
  padding: 8px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}
.form-select:focus { outline: none; border-color: var(--brand-primary); }

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead tr {
  background: var(--gray-50);
  border-bottom: 2px solid var(--border-color);
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: middle;
}

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

/* ── AVATARS ────────────────────────────────────────────────── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.avatar-sm  { width: 28px; height: 28px; font-size: 10px; }
.avatar-lg  { width: 48px; height: 48px; font-size: 18px; }
.avatar-xl  { width: 72px; height: 72px; font-size: 26px; }

.avatar.green  { background: linear-gradient(135deg, #16a34a, #22c55e); }
.avatar.blue   { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.avatar.purple { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.avatar.orange { background: linear-gradient(135deg, #ea580c, #f97316); }
.avatar.red    { background: linear-gradient(135deg, #dc2626, #ef4444); }
.avatar.teal   { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.avatar.pink   { background: linear-gradient(135deg, #db2777, #ec4899); }
.avatar.indigo { background: linear-gradient(135deg, #4338ca, #6366f1); }

/* ── PROGRESS BARS ──────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}
.progress-fill.green  { background: linear-gradient(90deg, #16a34a, #22c55e); }
.progress-fill.gold   { background: linear-gradient(90deg, #d97706, #f59e0b); }
.progress-fill.red    { background: linear-gradient(90deg, #dc2626, #ef4444); }
.progress-fill.blue   { background: linear-gradient(90deg, #2563eb, #3b82f6); }

/* ── TABS ───────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--gray-100);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 16px;
  width: fit-content;
  border: 1px solid var(--border-color);
}

.tab {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.tab:hover { color: var(--text-primary); }
.tab.active { background: var(--bg-card); color: var(--brand-primary); box-shadow: var(--shadow-xs); }

/* ── FILTER BAR ─────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 7px 12px;
  flex: 1;
  transition: all var(--transition);
}
.search-box:focus-within { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(26,107,60,0.08); }
.search-box svg { color: var(--text-muted); flex-shrink: 0; }
.search-box input { border: none; background: none; outline: none; font-size: 13px; width: 100%; color: var(--text-primary); }

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

.page-title h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.page-title p { font-size: 13px; color: var(--text-muted); }

.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── CHARTS ─────────────────────────────────────────────────── */
.chart-container {
  position: relative;
  height: 260px;
  width: 100%;
}

/* ── GRID LAYOUTS ───────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* ── MODAL ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.2s ease;
}
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.modal-title { font-size: 16px; font-weight: 700; font-family: 'Bricolage Grotesque', sans-serif; }
.modal-close {
  background: var(--gray-100);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 16px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-body { padding: 20px; }

/* ── TOAST ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  animation: toastIn 0.3s ease;
  border-left: 4px solid var(--brand-primary);
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info    { border-left-color: var(--info); }
.toast.removing { animation: toastOut 0.3s ease forwards; }

.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-msg  { flex: 1; color: var(--text-primary); }

/* ── ATTENDANCE CALENDAR ────────────────────────────────────── */
.attendance-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  cursor: default;
  transition: all var(--transition);
}
.cal-day.empty   { background: transparent; }
.cal-day.present { background: var(--success-light); color: var(--success); }
.cal-day.absent  { background: var(--danger-light); color: var(--danger); }
.cal-day.holiday { background: var(--warning-light); color: var(--warning); }
.cal-day.today   { background: var(--brand-primary); color: white; box-shadow: 0 2px 6px rgba(26,107,60,0.4); }

/* ── MAP PLACEHOLDER ────────────────────────────────────────── */
.map-placeholder {
  height: 180px;
  background: linear-gradient(135deg, var(--gray-100), var(--gray-50));
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px dashed var(--border-color);
  color: var(--text-muted);
}

/* ── PORTAL HEADER ──────────────────────────────────────────── */
.portal-header {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-light) 100%);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(26,107,60,0.25);
}
.portal-header::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.portal-header::after {
  content: '';
  position: absolute;
  bottom: -60px; left: 40%;
  width: 280px; height: 280px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}

.portal-greeting { font-size: 14px; color: rgba(255,255,255,0.75); margin-bottom: 4px; }
.portal-name { font-family: 'Bricolage Grotesque', sans-serif; font-size: 28px; font-weight: 800; color: white; margin-bottom: 8px; }
.portal-meta { display: flex; gap: 16px; flex-wrap: wrap; }
.portal-meta span { font-size: 12px; color: rgba(255,255,255,0.75); display: flex; align-items: center; gap: 4px; }

/* ── FEE STATUS CARD ────────────────────────────────────────── */
.fee-status-card {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: white;
  box-shadow: 0 4px 16px rgba(22,163,74,0.3);
}

/* ── QUICK ACTIONS ──────────────────────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: var(--gray-50);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
}
.quick-action-btn:hover {
  background: var(--brand-primary-xlight);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  transform: translateY(-2px);
}
.quick-action-icon { font-size: 22px; }

/* ── NOTIFICATIONS MODULE ───────────────────────────────────── */
.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
  cursor: pointer;
}
.notif-item:hover { background: var(--gray-50); }
.notif-item.unread { background: var(--brand-primary-xlight); }
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-primary);
  flex-shrink: 0;
  margin-top: 5px;
}

/* ── SETTINGS ───────────────────────────────────────────────── */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}
.settings-row:last-child { border-bottom: none; }

/* Toggle switch */
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: all var(--transition);
  box-shadow: var(--shadow-xs);
}
.toggle input:checked + .toggle-slider { background: var(--brand-primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── LOADING SPINNER ────────────────────────────────────────── */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-title { font-size: 16px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state-sub { font-size: 13px; }

/* ── DASHBOARD SPECIFIC ─────────────────────────────────────── */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  #app-shell { grid-template-columns: 0 1fr; }
  #app-shell.sidebar-open { grid-template-columns: 240px 1fr; }

  .sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    height: 100vh;
    z-index: 200;
    transition: left var(--transition-slow);
    width: 240px;
  }
  .sidebar-open .sidebar { left: 0; }

  .login-container { grid-template-columns: 1fr; }
  .login-left { display: none; }

  .module-area { padding: 14px 16px; }
  .topbar-search { display: none; }
  .topbar-year-badge { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .role-grid { grid-template-columns: repeat(3, 1fr); }
  .filter-bar { flex-direction: column; align-items: stretch; }
}

/* ── PRINT ──────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .page-actions, .filter-bar { display: none !important; }
  .module-area { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}