/* ============================================================
   INSHAL SCHOOL ERP — Global Design System
   Islamic Modern Theme: Deep Green + White + Gold
   Font: Plus Jakarta Sans (display) + Noto Nastaliq Urdu
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Playfair+Display:wght@600;700&family=Noto+Nastaliq+Urdu:wght@400;700&display=swap');

/* ── CSS Variables ── */
:root {
  /* Brand Colors */
  --green-950: #052e16;
  --green-900: #14532d;
  --green-800: #166534;
  --green-700: #15803d;
  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-400: #4ade80;
  --green-100: #dcfce7;
  --green-50:  #f0fdf4;

  --gold-600:  #b45309;
  --gold-500:  #d97706;
  --gold-400:  #f59e0b;
  --gold-300:  #fcd34d;
  --gold-100:  #fef3c7;
  --gold-50:   #fffbeb;

  --white:     #ffffff;
  --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;

  --red-500:   #ef4444;
  --red-100:   #fee2e2;
  --blue-500:  #3b82f6;
  --blue-100:  #dbeafe;
  --purple-500:#8b5cf6;
  --purple-100:#ede9fe;
  --orange-500:#f97316;
  --orange-100:#ffedd5;

  /* Semantic */
  --primary:        var(--green-700);
  --primary-dark:   var(--green-900);
  --primary-light:  var(--green-100);
  --accent:         var(--gold-400);
  --accent-dark:    var(--gold-600);
  --surface:        var(--white);
  --surface-2:      var(--gray-50);
  --border:         var(--gray-200);
  --text-primary:   var(--gray-900);
  --text-secondary: var(--gray-500);
  --text-muted:     var(--gray-400);

  /* Dark mode */
  --dark-bg:        #0a1628;
  --dark-surface:   #0f2040;
  --dark-surface-2: #162a4a;
  --dark-border:    #1e3a5f;
  --dark-text:      #e2e8f0;

  /* Spacing */
  --sidebar-w: 260px;
  --header-h:  64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:  0 10px 40px rgba(0,0,0,.14);
  --shadow-xl:  0 20px 60px rgba(0,0,0,.18);
  --shadow-green: 0 4px 20px rgba(21,128,61,.25);
  --shadow-gold:  0 4px 20px rgba(245,158,11,.25);

  /* Transitions */
  --transition: all .2s cubic-bezier(.4,0,.2,1);
  --transition-slow: all .4s cubic-bezier(.4,0,.2,1);
}

/* Dark Mode */
[data-theme="dark"] {
  --surface:        var(--dark-surface);
  --surface-2:      var(--dark-surface-2);
  --border:         var(--dark-border);
  --text-primary:   var(--dark-text);
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --primary-light:  rgba(21,128,61,.2);
}

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

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--surface-2);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}

[data-theme="dark"] body { background: var(--dark-bg); }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, select, textarea { font-family: inherit; outline: none; }

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

/* ── Islamic Pattern Background ── */
.islamic-pattern {
  background-color: var(--green-900);
  background-image:
    radial-gradient(circle at 25% 25%, rgba(245,158,11,.08) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(245,158,11,.06) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ── Layout ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--green-900);
  background-image: linear-gradient(180deg, var(--green-950) 0%, var(--green-900) 40%, var(--green-800) 100%);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform .3s cubic-bezier(.4,0,.2,1), width .3s;
  overflow: hidden;
  box-shadow: 4px 0 24px rgba(0,0,0,.2);
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.sidebar-logo {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  object-fit: contain;
  background: rgba(255,255,255,.1);
  padding: 4px;
  flex-shrink: 0;
}

.sidebar-brand { flex: 1; min-width: 0; }
.sidebar-brand h2 {
  font-size: 13px; font-weight: 700;
  color: var(--white);
  line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-brand span {
  font-size: 10px; color: var(--gold-300);
  font-weight: 500; letter-spacing: .5px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.nav-section-label {
  font-size: 10px; font-weight: 700;
  color: rgba(255,255,255,.35);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 12px 20px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin: 1px 8px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,.7);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}

.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: var(--white);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
  color: var(--green-950);
  font-weight: 700;
  box-shadow: var(--shadow-gold);
}

.nav-item .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: .8;
}
.nav-item.active .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--red-500);
  color: white;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px; text-align: center;
}

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

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

.user-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  color: var(--green-950);
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-info strong {
  display: block;
  font-size: 12px; font-weight: 700;
  color: var(--white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-info span {
  font-size: 10px; color: var(--gold-300);
}

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

/* ── Top Header ── */
.top-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-title {
  flex: 1;
  font-size: 18px; font-weight: 700;
  color: var(--text-primary);
}

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

.header-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
  position: relative;
}
.header-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

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

/* ── Page Content ── */
.page-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
}

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

.page-header-left h1 {
  font-size: 24px; font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}
.page-header-left p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.page-header-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, var(--primary));
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-info { flex: 1; }
.stat-value {
  font-size: 28px; font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.stat-change {
  font-size: 12px; font-weight: 600;
  margin-top: 6px;
  display: flex; align-items: center; gap: 4px;
}
.stat-change.up { color: var(--green-600); }
.stat-change.down { color: var(--red-500); }

/* Stat card color variants */
.stat-card.green  { --card-accent: var(--green-500); }
.stat-card.gold   { --card-accent: var(--gold-400); }
.stat-card.blue   { --card-accent: var(--blue-500); }
.stat-card.red    { --card-accent: var(--red-500); }
.stat-card.purple { --card-accent: var(--purple-500); }
.stat-card.orange { --card-accent: var(--orange-500); }

.stat-card.green  .stat-icon { background: var(--green-100); color: var(--green-700); }
.stat-card.gold   .stat-icon { background: var(--gold-100);  color: var(--gold-600); }
.stat-card.blue   .stat-icon { background: var(--blue-100);  color: var(--blue-500); }
.stat-card.red    .stat-icon { background: var(--red-100);   color: var(--red-500); }
.stat-card.purple .stat-icon { background: var(--purple-100);color: var(--purple-500); }
.stat-card.orange .stat-icon { background: var(--orange-100);color: var(--orange-500); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px; font-weight: 700;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}

.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ── Grid Layouts ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
  border: 1.5px solid transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  color: white;
  box-shadow: var(--shadow-green);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--green-800), var(--green-700));
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(21,128,61,.35);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
  color: var(--green-950);
  box-shadow: var(--shadow-gold);
}
.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold-600), var(--gold-500));
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: var(--surface-2);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--red-500);
  color: white;
}
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 9px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.form-label .required { color: var(--red-500); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21,128,61,.12);
}
.form-control::placeholder { color: var(--text-muted); }

.form-control-icon {
  position: relative;
}
.form-control-icon .form-control { padding-left: 40px; }
.form-control-icon .icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--red-500); margin-top: 4px; }

/* ── Tables ── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead {
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .8px;
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
}

.badge-green   { background: var(--green-100);  color: var(--green-700); }
.badge-gold    { background: var(--gold-100);   color: var(--gold-600); }
.badge-red     { background: var(--red-100);    color: var(--red-500); }
.badge-blue    { background: var(--blue-100);   color: var(--blue-500); }
.badge-purple  { background: var(--purple-100); color: var(--purple-500); }
.badge-orange  { background: var(--orange-100); color: var(--orange-500); }
.badge-gray    { background: var(--gray-100);   color: var(--gray-600); }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  flex: 1;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  transition: var(--transition);
  white-space: nowrap;
  min-width: fit-content;
}
.tab-btn:hover { color: var(--text-primary); background: var(--surface); }
.tab-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(.95) translateY(10px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
}
.modal-close:hover { background: var(--red-100); color: var(--red-500); }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Search Bar ── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  transition: var(--transition);
}
.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21,128,61,.1);
}
.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-primary);
}
.search-bar input::placeholder { color: var(--text-muted); }

/* ── Progress Bar ── */
.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--green-600), var(--green-400));
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

/* ── Avatar ── */
.avatar {
  border-radius: var(--radius-full);
  object-fit: cover;
  flex-shrink: 0;
}
.avatar-sm  { width: 32px; height: 32px; }
.avatar-md  { width: 40px; height: 40px; }
.avatar-lg  { width: 56px; height: 56px; }
.avatar-xl  { width: 80px; height: 80px; }

.avatar-placeholder {
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--green-600), var(--green-400));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700;
  flex-shrink: 0;
}

/* ── Notification Toast ── */
.toast-container {
  position: fixed;
  top: 80px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 400px;
  pointer-events: all;
  animation: slideInRight .3s ease;
  border-left: 4px solid var(--toast-color, var(--primary));
}

.toast.success { --toast-color: var(--green-500); }
.toast.error   { --toast-color: var(--red-500); }
.toast.warning { --toast-color: var(--gold-400); }
.toast.info    { --toast-color: var(--blue-500); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Dropdown ── */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 200;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity .15s, transform .15s;
}
.dropdown.open .dropdown-menu {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  transition: var(--transition);
  cursor: pointer;
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.danger { color: var(--red-500); }
.dropdown-item.danger:hover { background: var(--red-100); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Chart Container ── */
.chart-container {
  position: relative;
  width: 100%;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}
.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: .5;
}
.empty-state h3 {
  font-size: 16px; font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.empty-state p { font-size: 14px; }

/* ── Loading Spinner ── */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── PWA Install Banner ── */
.pwa-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(135deg, var(--green-900), var(--green-800));
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 9998;
  box-shadow: 0 -4px 24px rgba(0,0,0,.2);
  transform: translateY(100%);
  transition: transform .4s cubic-bezier(.4,0,.2,1);
}
.pwa-banner.show { transform: translateY(0); }
.pwa-banner-icon { font-size: 32px; flex-shrink: 0; }
.pwa-banner-text { flex: 1; }
.pwa-banner-text strong { display: block; font-size: 14px; font-weight: 700; }
.pwa-banner-text span { font-size: 12px; opacity: .8; }
.pwa-banner-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Sidebar Toggle (Mobile) ── */
.sidebar-toggle {
  display: none;
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  align-items: center; justify-content: center;
  color: var(--text-primary);
}

/* ── Overlay (Mobile Sidebar) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}

/* ── Quick Action Cards ── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.quick-action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.quick-action-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.quick-action-card .qa-icon {
  font-size: 28px;
  margin-bottom: 8px;
}
.quick-action-card span {
  font-size: 12px; font-weight: 600;
  color: var(--text-primary);
  display: block;
}

/* ── Timeline ── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 8px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  padding-bottom: 20px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px; top: 4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--primary);
}
.timeline-time { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.timeline-content { font-size: 13.5px; color: var(--text-primary); }

/* ── Attendance Grid ── */
.attendance-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.att-day {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.att-day.present { background: var(--green-100); color: var(--green-700); }
.att-day.absent  { background: var(--red-100);   color: var(--red-500); }
.att-day.holiday { background: var(--gold-100);  color: var(--gold-600); }
.att-day.empty   { background: transparent; }

/* ── ID Card ── */
.id-card {
  width: 340px;
  background: linear-gradient(135deg, var(--green-900) 0%, var(--green-700) 100%);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  color: white;
  position: relative;
}
.id-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(245,158,11,.15);
}
.id-card::after {
  content: '';
  position: absolute;
  bottom: -30px; left: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
}

.id-card-header {
  background: rgba(0,0,0,.2);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.id-card-body { padding: 20px; position: relative; z-index: 1; }
.id-card-footer {
  background: rgba(0,0,0,.2);
  padding: 12px 20px;
  text-align: center;
  font-size: 11px;
  opacity: .7;
  border-top: 1px solid rgba(255,255,255,.1);
}

/* ── Fee Receipt ── */
.receipt {
  max-width: 480px;
  background: white;
  border: 2px solid var(--green-700);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.receipt-header {
  background: linear-gradient(135deg, var(--green-900), var(--green-700));
  color: white;
  padding: 20px;
  text-align: center;
}
.receipt-body { padding: 20px; }
.receipt-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--gray-200);
  font-size: 13.5px;
}
.receipt-row:last-child { border-bottom: none; }
.receipt-total {
  background: var(--green-50);
  border: 1px solid var(--green-200);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 16px;
  color: var(--green-800);
}
.receipt-footer {
  background: var(--gray-50);
  padding: 12px 20px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ── Appointment Letter ── */
.letter-paper {
  max-width: 680px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.letter-header {
  background: linear-gradient(135deg, var(--green-900), var(--green-700));
  padding: 24px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
  color: white;
}
.letter-body {
  padding: 32px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--gray-800);
}
.letter-footer {
  padding: 20px 32px;
  border-top: 2px solid var(--green-700);
  background: var(--green-50);
}

/* ── Bonafide Certificate ── */
.certificate {
  max-width: 680px;
  background: white;
  border: 8px double var(--green-700);
  border-radius: var(--radius-xl);
  padding: 40px;
  text-align: center;
  position: relative;
}
.certificate::before {
  content: '';
  position: absolute;
  inset: 12px;
  border: 2px solid var(--gold-400);
  border-radius: var(--radius-lg);
  pointer-events: none;
}
.certificate-watermark {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 120px;
  opacity: .03;
  pointer-events: none;
  z-index: 0;
}

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

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

  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay { display: block; }

  .main-content { margin-left: 0; }

  .sidebar-toggle { display: flex; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .page-content { padding: 16px; }

  .page-header { flex-direction: column; }

  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tab-btn { flex: none; }

  .modal { max-width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}

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

/* ── Print Styles ── */
@media print {
  .sidebar, .top-header, .pwa-banner, .toast-container { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  body { background: white !important; }
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.fade-in { animation: fadeIn .3s ease forwards; }

.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ── Utility Classes ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 22px; }
.text-muted { color: var(--text-secondary); }
.text-primary-color { color: var(--primary); }
.text-gold { color: var(--gold-500); }
.text-red { color: var(--red-500); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.rounded { border-radius: var(--radius-md); }
.rounded-full { border-radius: var(--radius-full); }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.hidden { display: none !important; }
.block { display: block; }
.inline-flex { display: inline-flex; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.section-gap { margin-bottom: 24px; }