:root {
  --sidebar-w: 250px;
  --brand: #6d28d9;       /* violet */
  --brand-2: #4f46e5;     /* indigo */
  --brand-light: #f1edfd;
  --ink: #1e1b2e;
  --muted: #8b87a3;
  --bg: #f7f7fb;
  --border: #edecf3;
  --card-shadow: 0 2px 14px rgba(31,23,64,0.05);
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  margin: 0;
}

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

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: #ffffff;
  border-right: 1px solid var(--border);
  color: var(--ink);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 1030;
  transition: transform .25s ease;
}

.sidebar .brand {
  padding: 1.3rem 1.1rem 1rem;
  display: flex;
  align-items: center;
  gap: .7rem;
  border-bottom: 1px solid var(--border);
}

.sidebar .brand .logo-badge {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg,#a78bfa,#6d28d9);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar .brand .name {
  font-weight: 700;
  font-size: .96rem;
  line-height: 1.2;
  color: var(--ink);
}
.sidebar .brand .tagline {
  font-size: .7rem;
  color: var(--muted);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem .8rem;
  overflow-y: auto;
}

.sidebar-nav .nav-link {
  color: #55506b;
  padding: .62rem .9rem;
  border-radius: 10px;
  margin-bottom: .2rem;
  display: flex;
  align-items: center;
  gap: .7rem;
  font-size: .9rem;
  font-weight: 500;
  transition: all .15s ease;
  border-left: 3px solid transparent;
}

.sidebar-nav .nav-link i { font-size: 1rem; width: 18px; text-align: center; color: #a09bb8; }

.sidebar-nav .nav-link:hover {
  background: #faf9fd;
  color: var(--ink);
}

.sidebar-nav .nav-link.active {
  background: var(--brand-light);
  color: var(--brand);
  border-left-color: var(--brand);
  font-weight: 600;
}
.sidebar-nav .nav-link.active i { color: var(--brand); }

.sidebar-footer {
  padding: .9rem;
  border-top: 1px solid var(--border);
}

.sidebar-footer .nav-link {
  color: #8b87a3;
  display: flex; align-items: center; gap: .6rem;
  font-size: .87rem;
  padding: .5rem .7rem;
  border-radius: 8px;
}
.sidebar-footer .nav-link:hover { background: #faf9fd; color: var(--ink); }

.sidebar-close-btn { display: none; }

/* ---------- Main content ---------- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1010;
}

.topbar .page-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin: 0;
  color: var(--ink);
}
.topbar .page-sub {
  font-size: .78rem;
  color: var(--muted);
}

.topbar .menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--ink);
  margin-right: .8rem;
}

.topbar .admin-chip {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.topbar .admin-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg,var(--brand-2),var(--brand));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}
.topbar .admin-name { font-size: .85rem; font-weight: 600; color: var(--ink); line-height: 1.15; }
.topbar .admin-role { font-size: .72rem; color: var(--muted); }

.page-content {
  padding: 1.5rem 1.6rem;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,15,40,.35);
  z-index: 1020;
}

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .sidebar-close-btn {
    display: block;
    margin-left: auto;
    background: none; border: none; color: var(--ink); font-size: 1.3rem;
  }
  .main-content { margin-left: 0; }
  .topbar .menu-toggle { display: inline-block; }
  .sidebar-overlay.show { display: block; }
}

/* ---------- Stat cards (accent color lives only here) ---------- */
.stat-card {
  border: none;
  border-radius: 16px;
  color: #fff;
  padding: 1.25rem 1.35rem;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 80px; height: 80px;
  background: rgba(255,255,255,.12);
  border-radius: 50%;
}
.stat-card h3 { font-size: 1.6rem; font-weight: 700; margin-bottom: 0; }
.stat-card .label { opacity: .92; font-size: .8rem; font-weight: 500; }
.stat-card .bi { font-size: 1.5rem; opacity: .9; }

.bg-c1 { background: linear-gradient(135deg,#7c3aed,#4f46e5); }
.bg-c2 { background: linear-gradient(135deg,#0d9488,#0891b2); }
.bg-c3 { background: linear-gradient(135deg,#ea580c,#dc2626); }
.bg-c4 { background: linear-gradient(135deg,#c026d3,#7c3aed); }

/* ---------- Cards / tables ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
}

.table thead th {
  background: #faf9fd;
  color: #55506b;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-weight: 600;
}

.table td { vertical-align: middle; font-size: .9rem; }

.btn-brand {
  background: var(--brand);
  border: 1px solid var(--brand);
  color: #fff;
  font-weight: 500;
}
.btn-brand:hover { color: #fff; background: var(--brand-2); border-color: var(--brand-2); }

/* ---------- Login page ---------- */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  border-radius: 18px;
  padding: 2.1rem;
  border: 1px solid var(--border);
}

.login-logo {
  width: 54px; height: 54px;
  border-radius: 15px;
  background: linear-gradient(135deg,#a78bfa,#6d28d9);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  margin: 0 auto .8rem;
}

/* ---------- Badges ---------- */
.badge-present { background:#0d9488; }
.badge-absent { background:#dc2626; }
.badge-leave { background:#d97706; }
.badge-paid { background:#0d9488; }
.badge-partial { background:#d97706; }
.badge-pending { background:#dc2626; }
.badge-role-super_admin { background:#7c3aed; }
.badge-role-admin { background:#4f46e5; }
.badge-role-teacher { background:#0891b2; }
.badge-role-student { background:#0d9488; }

/* ---------- Misc ---------- */
.progress { border-radius: 20px; background:#f1edfd; height: 18px; }
.progress-bar { border-radius: 20px; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-state i { font-size: 2.2rem; opacity: .5; margin-bottom: .6rem; display:block; }

.credentials-box {
  background: var(--brand-light);
  border: 1px dashed var(--brand);
  border-radius: 10px;
  padding: .9rem 1rem;
  font-size: .88rem;
}
