/* =========================================================
   SREE VIDYA EM SCHOOL — ADMIN DASHBOARD
   Design System: Premium Indigo / Slate — Refined & Authoritative
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Serif+Display:ital@0;1&display=swap');

/* ── TOKENS ─────────────────────────────────────────────── */
:root {
  /* Brand */
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-900: #1e1b4b;

  /* Accent */
  --accent-400: #fb923c;
  --accent-500: #f97316;

  /* Greens / Reds / Yellows */
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --red-400:   #f87171;
  --red-500:   #ef4444;
  --yellow-400:#facc15;
  --yellow-500:#eab308;

  /* Surface palette (light) */
  --bg:          #f1f5f9;
  --surface:     #ffffff;
  --surface-2:   #f8fafc;
  --surface-3:   #f1f5f9;
  --border:      #e2e8f0;
  --border-muted:#f1f5f9;

  /* Text */
  --text-primary:  #0f172a;
  --text-secondary:#475569;
  --text-muted:    #94a3b8;
  --text-inverse:  #ffffff;

  /* Aliases for backward compat */
  --primary-color: var(--brand-600);
  --primary-light: var(--brand-400);
  --primary-dark:  var(--brand-700);
  --secondary-color: var(--accent-500);
  --background: var(--bg);
  --on-primary: var(--text-inverse);
  --on-secondary: var(--text-inverse);
  --on-background: var(--text-primary);
  --on-surface: var(--text-primary);
  --error: var(--red-500);
  --success: var(--green-500);
  --info: var(--brand-500);
  --on-error: #fff;

  /* Layout */
  --sidebar-w:    260px;
  --sidebar-w-c:  72px;
  --topnav-h:     68px;

  /* Shape */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-2xl: 28px;
  --border-radius: var(--radius-lg);

  /* Shadow */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .08), 0 2px 4px -2px rgb(0 0 0 / .08);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .08), 0 4px 6px -4px rgb(0 0 0 / .06);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .06);
  --box-shadow: var(--shadow-md);

  /* Motion */
  --ease: cubic-bezier(.4,0,.2,1);
  --duration: 200ms;
  --transition: all var(--duration) var(--ease);

  /* Typography */
  --font-body:    'DM Sans', sans-serif;
  --font-display: 'DM Serif Display', serif;
}

/* ── DARK THEME ─────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:          #0a0f1e;
  --surface:     #111827;
  --surface-2:   #1a2235;
  --surface-3:   #1e2a3a;
  --border:      #1e293b;
  --border-muted:#1e293b;
  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #475569;
  --brand-50:  #1e1b4b;
  --brand-100: #312e81;
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .3), 0 2px 4px -2px rgb(0 0 0 / .3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .3), 0 4px 6px -4px rgb(0 0 0 / .2);
  --box-shadow: var(--shadow-md);
}

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

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}

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

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════════ */
#loginPage {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #0f0e2e 0%, #1a1654 40%, #2a1f7a 70%, #3b2cb5 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

#loginPage::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 20% 80%, rgba(99,102,241,.18) 0%, transparent 70%),
    radial-gradient(ellipse 400px 300px at 80% 20%, rgba(249,115,22,.12) 0%, transparent 70%);
  pointer-events: none;
}

/* Floating orbs */
#loginPage::after {
  content: '';
  position: absolute; top: 15%; left: 10%;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(99,102,241,.2) 0%, transparent 70%);
  border-radius: 50%;
  animation: floatOrb 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%       { transform: translate(30px, -20px) scale(1.05); }
}

.login-card {
  background: rgba(255,255,255,.97);
  border-radius: var(--radius-2xl);
  padding: 52px 44px;
  width: 100%; max-width: 430px;
  box-shadow: 0 32px 80px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.1);
  text-align: center;
  position: relative;
  backdrop-filter: blur(20px);
  animation: slideUp .5s var(--ease) both;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}

[data-theme="dark"] .login-card {
  background: rgba(17,24,39,.95);
  color: var(--text-primary);
}

.login-logo-wrap {
  display: inline-flex; align-items: center; justify-content: center;
  width: 68px; height: 68px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  box-shadow: 0 8px 24px rgba(99,102,241,.4);
  margin-bottom: 16px;
}

.login-logo-wrap .material-icons { font-size: 34px; color: #fff; }

.login-card h1 {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-card p.sub {
  font-size: 13px; color: var(--text-secondary);
  margin-bottom: 32px;
}

.login-field {
  margin-bottom: 18px; text-align: left;
}

.login-field label {
  display: block;
  font-size: 12.5px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.login-field input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px; font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--surface-2);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  outline: none;
}

.login-field input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(99,102,241,.15);
  background: var(--surface);
}

#loginError {
  color: var(--red-500);
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 14px;
  text-align: left;
}

#loginSubmitBtn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px; font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: opacity var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  box-shadow: 0 4px 14px rgba(99,102,241,.4);
  letter-spacing: .02em;
}

#loginSubmitBtn:hover { opacity: .92; box-shadow: 0 6px 20px rgba(99,102,241,.5); }
#loginSubmitBtn:active { opacity: .85; }

/* ═══════════════════════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════════════════════ */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--brand-900);
  color: #c7d2fe;
  transition: width var(--duration) var(--ease);
  z-index: 100;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* Subtle gradient overlay on sidebar */
.sidebar::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 200px;
  background: linear-gradient(180deg, rgba(99,102,241,.15) 0%, transparent 100%);
  pointer-events: none;
}

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

/* Header */
.sidebar-header {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  min-height: var(--topnav-h);
}

.school-logo {
  display: flex; align-items: center; gap: 11px;
  overflow: hidden;
}

.school-logo img {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.15);
}

.school-name {
  font-weight: 700; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #fff;
  line-height: 1.3;
  letter-spacing: -.01em;
}

.collapse-btn {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  color: #c7d2fe;
  cursor: pointer;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  flex-shrink: 0;
}

.collapse-btn:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
}

/* Menu */
.sidebar-menu {
  padding: 12px 0 24px;
  flex-grow: 1;
  position: relative; z-index: 1;
}

.menu-section { margin-bottom: 6px; display: none; }

.menu-title {
  padding: 14px 18px 6px;
  font-size: 10.5px; text-transform: uppercase;
  color: rgba(165,180,252,.5);
  font-weight: 700; letter-spacing: .1em;
  white-space: nowrap;
}

.sidebar-collapsed .menu-title { opacity: 0; pointer-events: none; }

.menu-items { list-style: none; }

.menu-item {
  padding: 10px 12px 10px 16px;
  display: none; align-items: center; gap: 12px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  color: rgba(199,210,254,.75);
  border-radius: 0;
  margin: 1px 8px;
  border-radius: var(--radius-md);
  white-space: nowrap;
}

.menu-item:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.menu-item.active {
  background: linear-gradient(90deg, rgba(99,102,241,.35), rgba(99,102,241,.18));
  color: #fff;
  font-weight: 600;
}

.menu-item.active::before {
  content: '';
  position: absolute; left: -8px; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 60%;
  background: var(--brand-400);
  border-radius: 0 4px 4px 0;
}

.menu-item-icon {
  font-size: 20px;
  flex-shrink: 0;
  opacity: .85;
}

.menu-item.active .menu-item-icon { opacity: 1; color: var(--brand-400); }

.menu-item-text {
  font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.menu-item-badge {
  margin-left: auto;
  background: var(--accent-500);
  color: #fff;
  border-radius: 99px;
  padding: 2px 8px;
  font-size: 11px; font-weight: 700;
  min-width: 22px; text-align: center;
  flex-shrink: 0;
}

/* Collapsed state */
.sidebar-collapsed .school-name,
.sidebar-collapsed .menu-item-text,
.sidebar-collapsed .menu-item-badge { display: none; }

.sidebar-collapsed .menu-item {
  justify-content: center;
  padding: 12px;
}

.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: 18px 0;
}

.sidebar-collapsed .collapse-btn {
  position: absolute; right: -14px; top: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  color: var(--brand-600);
  z-index: 200;
  border-radius: 50%;
  width: 28px; height: 28px;
}

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════════════════════════ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  transition: margin-left var(--duration) var(--ease);
  display: flex; flex-direction: column;
  min-height: 100vh;
}

.main-content-expanded { margin-left: var(--sidebar-w-c); }

/* ── TOP NAV ────────────────────────────────────────────── */
.top-nav {
  background: var(--surface);
  padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 90;
  flex-shrink: 0;
  height: var(--topnav-h);
  border-bottom: 1px solid var(--border);
}

.nav-action-btn {
  background: transparent;
  border: none; cursor: pointer;
  color: var(--text-secondary);
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  position: relative;
}

.nav-action-btn:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

#mobileMenuBtn { display: none; }

/* Search */
.search-bar {
  flex: 1; max-width: 480px; margin: 0 20px;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 9px 16px 9px 40px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 13.5px; font-family: var(--font-body);
  transition: var(--transition);
  outline: none;
}

.search-bar input::placeholder { color: var(--text-muted); }

.search-bar input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
  background: var(--surface);
}

.search-icon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); font-size: 18px;
  pointer-events: none;
}

/* Nav right */
.nav-actions {
  display: flex; align-items: center; gap: 6px;
}

.notification-badge {
  position: absolute; top: 5px; right: 5px;
  background: var(--red-500); color: #fff;
  font-size: 9px; font-weight: 700;
  border-radius: 99px; padding: 1px 4px;
  min-width: 16px; text-align: center;
  line-height: 14px;
  border: 1.5px solid var(--surface);
}

/* User profile pill */
.user-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  border: 1.5px solid transparent;
}

.user-profile:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  letter-spacing: .05em;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px; font-weight: 600;
  color: var(--text-primary); line-height: 1.2;
}

.user-role {
  font-size: 11px; color: var(--text-muted); line-height: 1.2;
}

/* ── CONTENT AREA ───────────────────────────────────────── */
.content-area {
  padding: 28px 32px;
  flex: 1;
}

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

.page-title {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -.02em;
}

.page-subtitle {
  font-size: 13px; color: var(--text-muted);
  margin-top: 2px;
}

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

/* ── BREADCRUMB ─────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-muted);
  margin-bottom: 20px;
}

.breadcrumb-sep { color: var(--border); }
.breadcrumb-current { color: var(--text-secondary); font-weight: 500; }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px; font-weight: 600; font-family: var(--font-body);
  cursor: pointer; border: none;
  transition: var(--transition);
  text-decoration: none; white-space: nowrap;
  letter-spacing: .01em;
}

.btn .material-icons { font-size: 17px; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(99,102,241,.45);
  opacity: .92;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

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

.btn-danger {
  background: var(--red-500); color: #fff;
}

.btn-danger:hover { background: #dc2626; }

.btn-success {
  background: var(--green-600); color: #fff;
}

.btn-sm {
  padding: 6px 12px; font-size: 12.5px;
}

.btn-sm .material-icons { font-size: 15px; }

.btn-icon {
  padding: 8px; gap: 0;
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
}

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

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

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative; overflow: hidden;
  transition: var(--transition);
}

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

.stat-card-accent {
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}

.stat-card-icon .material-icons { font-size: 22px; }

.stat-value {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -.03em;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12.5px; color: var(--text-muted);
  font-weight: 500; letter-spacing: .02em;
  text-transform: uppercase;
}

.stat-change {
  display: inline-flex; align-items: center; gap: 3px;
  margin-top: 10px;
  font-size: 12px; font-weight: 600;
  padding: 3px 8px; border-radius: 99px;
}

.stat-change.up   { background: #dcfce7; color: var(--green-600); }
.stat-change.down { background: #fee2e2; color: var(--red-500); }

[data-theme="dark"] .stat-change.up   { background: rgba(34,197,94,.15); color: var(--green-400); }
[data-theme="dark"] .stat-change.down { background: rgba(239,68,68,.15); color: var(--red-400); }

/* Color variants */
.accent-indigo .stat-card-accent { background: linear-gradient(90deg, var(--brand-500), var(--brand-400)); }
.accent-orange .stat-card-accent { background: linear-gradient(90deg, var(--accent-500), var(--yellow-400)); }
.accent-green  .stat-card-accent { background: linear-gradient(90deg, var(--green-500), #34d399); }
.accent-red    .stat-card-accent { background: linear-gradient(90deg, var(--red-500), #fb923c); }
.accent-purple .stat-card-accent { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

.accent-indigo .stat-card-icon { background: var(--brand-50); color: var(--brand-600); }
.accent-orange .stat-card-icon { background: #fff7ed; color: var(--accent-500); }
.accent-green  .stat-card-icon { background: #f0fdf4; color: var(--green-600); }
.accent-red    .stat-card-icon { background: #fef2f2; color: var(--red-500); }
.accent-purple .stat-card-icon { background: #f5f3ff; color: #7c3aed; }

[data-theme="dark"] .accent-indigo .stat-card-icon { background: rgba(99,102,241,.15); color: var(--brand-400); }
[data-theme="dark"] .accent-orange .stat-card-icon { background: rgba(249,115,22,.15); color: var(--accent-400); }
[data-theme="dark"] .accent-green  .stat-card-icon { background: rgba(34,197,94,.15);  color: var(--green-400); }
[data-theme="dark"] .accent-red    .stat-card-icon { background: rgba(239,68,68,.15);  color: var(--red-400); }
[data-theme="dark"] .accent-purple .stat-card-icon { background: rgba(139,92,246,.15); color: #a78bfa; }

/* ═══════════════════════════════════════════════════════════
   DASHBOARD GRID / QUICK ACTIONS
═══════════════════════════════════════════════════════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

/* ═══════════════════════════════════════════════════════════
   IMPROVED DASHBOARD LAYOUT
═══════════════════════════════════════════════════════════ */

/* 5-column stat cards row */
/* ===================== HOME SCREEN ===================== */
.home-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(120deg, #a7f3d0, #fbcfe8);
  border-radius: 20px;
  padding: 28px 32px;
  margin-bottom: 20px;
}
[data-theme="dark"] .home-banner {
  background: linear-gradient(120deg, rgba(16,185,129,.18), rgba(236,72,153,.18));
}
.home-banner-text h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}
.home-banner-text p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}
.home-banner-icon { font-size: 48px; color: #d97706; opacity: .85; }

.home-shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}
@media (max-width: 1200px) { .home-shortcuts-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 768px)  { .home-shortcuts-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 480px)  { .home-shortcuts-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }

.home-shortcut-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 6px 16px rgba(15,23,42,.05);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.home-shortcut-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand-200);
  box-shadow: 0 4px 10px rgba(15,23,42,.06), 0 14px 28px rgba(99,102,241,.14);
}
[data-theme="dark"] .home-shortcut-card {
  background: var(--surface-2);
  border-color: var(--border-muted);
  box-shadow: 0 1px 2px rgba(0,0,0,.25), 0 6px 16px rgba(0,0,0,.25);
}
[data-theme="dark"] .home-shortcut-card:hover {
  border-color: var(--brand-500);
  box-shadow: 0 4px 10px rgba(0,0,0,.3), 0 14px 28px rgba(99,102,241,.22);
}
.home-shortcut-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.4);
}
.home-shortcut-icon .material-icons { font-size: 24px; }
.home-shortcut-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.home-shortcut-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fbbf24;
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-shortcut-badge .material-icons { font-size: 13px; color: #fff; }
/* ===================== /HOME SCREEN ===================== */

.db-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

/* 2-column charts row */
.db-charts-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.db-chart-card { min-height: 0; }

/* 2-column bottom row (quick actions + activity) */
.db-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 16px;
}

/* Skeleton loader for stat values */
.db-skeleton {
  display: inline-block;
  width: 70px; height: 28px;
  background: linear-gradient(90deg, var(--border) 25%, var(--surface-2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: db-shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  vertical-align: middle;
}

@keyframes db-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Responsive breakpoints */
@media (max-width: 1200px) {
  .db-stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .db-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .db-charts-grid { grid-template-columns: 1fr; }
  .db-bottom-grid { grid-template-columns: 1fr; }
}

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

.quick-action-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px 18px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}

.quick-action-card:hover {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px rgba(99,102,241,.08), var(--shadow-md);
  transform: translateY(-2px);
}

.quick-action-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-md);
  background: var(--brand-50);
  color: var(--brand-600);
  display: flex; align-items: center; justify-content: center;
}

.quick-action-icon .material-icons { font-size: 22px; }

.quick-action-label {
  font-size: 12.5px; font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.3;
}

[data-theme="dark"] .quick-action-icon {
  background: rgba(99,102,241,.15); color: var(--brand-400);
}

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

.card:hover { box-shadow: var(--shadow-md); }

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

.card-title {
  font-size: 15px; font-weight: 700;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 12.5px; color: var(--text-muted);
  margin-top: 2px;
}

.card-body { padding: 22px; }

.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: space-between;
}

/* ═══════════════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════════════ */
.table-wrapper {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

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

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

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.data-table th:hover { color: var(--text-primary); }

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

.data-table tbody tr {
  transition: background var(--duration) var(--ease);
}

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

.data-table .cell-primary {
  color: var(--text-primary); font-weight: 600;
}

/* Table action buttons */
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  max-width: 68px; /* fits exactly 2 buttons (30px each + 4px gap) → forces 3rd+ to next row */
}

/* Single row when ≤ 3 buttons */
.table-actions:has(.action-btn:nth-child(1):nth-last-child(1)),
.table-actions:has(.action-btn:nth-child(1):nth-last-child(2)),
.table-actions:has(.action-btn:nth-child(1):nth-last-child(3)) {
  max-width: none;
  flex-wrap: nowrap;
}

/* td that directly holds action buttons (no wrapper div) */
td:has(> .action-btn) {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

/* 4 buttons → 2×2 grid */
td:has(> .action-btn:nth-child(4)),
td.action-cell--wrap {
  flex-wrap: wrap;
  max-width: 68px;
}

.action-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  background: transparent;
  flex-shrink: 0;
}

.action-btn .material-icons { font-size: 16px; }

.action-btn.view-btn   { color: var(--brand-500); }
.action-btn.edit-btn   { color: var(--yellow-500); }
.action-btn.delete-btn { color: var(--red-500); }

/* legacy class names */
.action-btn.view   { color: var(--brand-500); }
.action-btn.edit   { color: var(--yellow-500); }
.action-btn.delete { color: var(--red-500); }

.action-btn:hover  { background: var(--surface-3); }

/* ═══════════════════════════════════════════════════════════
   BADGES / STATUS CHIPS
═══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}

.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  flex-shrink: 0;
}

.badge-success { background: #dcfce7; color: var(--green-600); }
.badge-warning { background: #fef9c3; color: #92400e; }
.badge-danger  { background: #fee2e2; color: var(--red-500); }
.badge-info    { background: var(--brand-50); color: var(--brand-700); }
.badge-neutral { background: var(--surface-3); color: var(--text-secondary); }

.badge-success .badge-dot { background: var(--green-500); }
.badge-warning .badge-dot { background: var(--yellow-500); }
.badge-danger  .badge-dot { background: var(--red-500); }
.badge-info    .badge-dot { background: var(--brand-500); }

[data-theme="dark"] .badge-success { background: rgba(34,197,94,.15);  color: var(--green-400); }
[data-theme="dark"] .badge-warning { background: rgba(234,179,8,.15);  color: var(--yellow-400); }
[data-theme="dark"] .badge-danger  { background: rgba(239,68,68,.15);  color: var(--red-400); }
[data-theme="dark"] .badge-info    { background: rgba(99,102,241,.15); color: var(--brand-400); }
[data-theme="dark"] .badge-neutral { background: var(--surface-3);     color: var(--text-secondary); }

/* ── Bulk announcement variable tag buttons ─────────────────────── */
.bulk-var-tag {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px; font-weight: 600;
    border: 1.5px solid var(--brand-200);
    background: var(--brand-50); color: var(--brand-700);
    cursor: pointer; transition: var(--transition);
    white-space: nowrap;
}
.bulk-var-tag:hover {
    background: var(--brand-100); border-color: var(--brand-400);
    transform: translateY(-1px);
}
[data-theme="dark"] .bulk-var-tag {
    background: rgba(99,102,241,.12); border-color: rgba(99,102,241,.35); color: var(--brand-400);
}
[data-theme="dark"] .bulk-var-tag:hover {
    background: rgba(99,102,241,.22); border-color: var(--brand-400);
}

/* ═══════════════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12.5px; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13.5px; font-family: var(--font-body);
  transition: var(--transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
  background: var(--surface);
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 38px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: flex; gap: 16px; }
.form-col { flex: 1; }

.form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

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

/* Checkbox */
input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--brand-600);
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════
   MODALS
═══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; visibility: hidden;
  transition: opacity .25s var(--ease), visibility .25s var(--ease);
}

.modal-overlay.active {
  opacity: 1; visibility: visible;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 92%; max-width: 680px;
  max-height: 90vh; overflow-y: auto;
  transform: scale(.96) translateY(16px);
  transition: transform .28s var(--ease);
  border: 1px solid var(--border);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 10;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

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

.modal-close {
  background: var(--surface-2);
  border: none; cursor: pointer;
  color: var(--text-muted);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}

.modal-body { padding: 22px 26px; }

.student-profile-modal {
  max-width: 980px;
}

.student-profile-modal #viewStudentModalBody {
  padding: 0;
  background: var(--surface-2);
}

.student-view {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.sv-hero {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.sv-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--brand-500), #0ea5e9);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
}

.sv-identity {
  min-width: 0;
}

.sv-name {
  font-size: 22px;
  line-height: 1.15;
  font-weight: 800;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.sv-id {
  margin-top: 5px;
  font-size: 13px;
  color: var(--text-secondary);
}

.sv-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.sv-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.sv-tags .navodaya {
  background: #e0f2fe;
  color: #0369a1;
}

.sv-tags .residential {
  background: #ede9fe;
  color: #7c3aed;
}

.sv-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.sv-metric {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.sv-metric-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--brand-50);
  color: var(--brand-600);
  flex: 0 0 auto;
}

.sv-metric-icon .material-icons {
  font-size: 18px;
}

.sv-metric-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
}

.sv-metric-value {
  margin-top: 2px;
  font-size: 18px;
  line-height: 1.1;
  font-weight: 800;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.sv-metric.paid .sv-metric-icon {
  background: #dcfce7;
  color: #16a34a;
}

.sv-metric.due .sv-metric-icon {
  background: #fee2e2;
  color: #ef4444;
}

.sv-metric.soft .sv-metric-icon {
  background: #fef3c7;
  color: #d97706;
}

.sv-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  gap: 12px;
}

.sv-panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.sv-wide {
  grid-column: 1 / -1;
}

.sv-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
}

.sv-panel-head div {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.sv-panel-head .material-icons {
  font-size: 17px;
  color: var(--brand-600);
}

.sv-panel-head strong {
  color: var(--brand-700);
  white-space: nowrap;
}

.sv-fee-list,
.sv-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.sv-fee-row,
.sv-payment-row,
.sv-prev-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-2);
}

.sv-fee-main {
  min-width: 170px;
  flex: 1;
}

.sv-fee-title,
.sv-payment-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}

.sv-fee-amounts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.sv-progress {
  height: 6px;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.sv-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-500), #22c55e);
  border-radius: inherit;
}

.sv-totals {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

.sv-totals strong,
.sv-fee-amounts .paid,
.sv-fee-amounts .clear {
  color: #16a34a;
}

.sv-totals .due,
.sv-fee-amounts .due {
  color: #ef4444;
}

.sv-payment-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-muted);
}

.sv-payment-right {
  display: grid;
  gap: 4px;
  justify-items: end;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}

.sv-status {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 800;
}

.sv-status.completed {
  background: #dcfce7;
  color: #16a34a;
}

.sv-status.pending {
  background: #fef3c7;
  color: #d97706;
}

.sv-prev-summary {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 12px 0;
}

.sv-prev-summary span {
  flex: 1 1 120px;
  padding: 8px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.sv-prev-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  font-size: 12px;
  color: var(--text-secondary);
}

.sv-prev-row strong {
  color: var(--text-primary);
}

.sv-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

.sv-detail-item {
  display: flex;
  gap: 9px;
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-2);
}

.sv-detail-item .material-icons {
  font-size: 18px;
  color: var(--brand-600);
  flex: 0 0 auto;
}

.sv-detail-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 800;
  text-transform: uppercase;
}

.sv-detail-value {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.sv-empty {
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 820px) {
  .student-view {
    padding: 12px;
  }

  .sv-metrics,
  .sv-grid,
  .sv-details {
    grid-template-columns: 1fr;
  }

  .sv-fee-row,
  .sv-payment-row,
  .sv-totals {
    align-items: stretch;
    flex-direction: column;
  }

  .sv-fee-amounts {
    justify-content: flex-start;
  }
}

.modal-footer {
  padding: 16px 26px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}

/* ═══════════════════════════════════════════════════════════
   MESSAGE BOX
═══════════════════════════════════════════════════════════ */
.message-box-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
  opacity: 0; visibility: hidden;
  transition: opacity .25s var(--ease), visibility .25s var(--ease);
}

.message-box-overlay.active { opacity: 1; visibility: visible; }

.message-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 36px 32px;
  width: 92%; max-width: 420px;
  text-align: center;
  transform: scale(.95);
  transition: transform .25s var(--ease);
  border: 1px solid var(--border);
}

.message-box-overlay.active .message-box { transform: scale(1); }

.message-box-icon {
  font-size: 52px; margin-bottom: 14px;
  color: var(--brand-500);
}

.message-box-title {
  font-size: 20px; font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.message-box-text {
  font-size: 14.5px; color: var(--text-secondary);
  margin-bottom: 24px; line-height: 1.6;
}

.message-box-actions {
  display: flex; justify-content: center; gap: 12px;
}

/* ═══════════════════════════════════════════════════════════
   FILTER CONTROLS
═══════════════════════════════════════════════════════════ */
.filter-controls {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex; flex-wrap: wrap; gap: 14px;
  align-items: flex-end;
}

.filter-group {
  display: flex; flex-direction: column;
  min-width: 150px; flex-grow: 1;
}

.filter-group label {
  margin-bottom: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.filter-group select,
.filter-group input[type="text"],
.filter-group input[type="date"] {
  padding: 9px 13px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 13.5px; font-family: var(--font-body);
  outline: none;
  transition: var(--transition);
}

.filter-group select:focus,
.filter-group input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}

.filter-actions {
  display: flex; gap: 8px; margin-left: auto; flex-shrink: 0;
  align-items: flex-end;
}

/* ═══════════════════════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════════════════════ */
.pagination-controls {
  display: flex; justify-content: flex-end; align-items: center;
  gap: 8px; margin-top: 18px; padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}

.pagination-controls button {
  padding: 7px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600; font-size: 13px; font-family: var(--font-body);
}

.pagination-controls button:hover:not(:disabled) {
  background: var(--brand-50); color: var(--brand-700);
  border-color: var(--brand-400);
}

.pagination-controls button:disabled {
  opacity: .35; cursor: not-allowed;
}

.pagination-controls span {
  font-size: 13.5px; color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════
   LOADING OVERLAY
═══════════════════════════════════════════════════════════ */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 3000;
  opacity: 0; visibility: hidden;
  transition: opacity .2s var(--ease), visibility .2s var(--ease);
}

.loading-overlay.active { opacity: 1; visibility: visible; }

.spinner {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: var(--brand-400);
  animation: spin .75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════
   NOTIFICATIONS / ANNOUNCEMENTS
═══════════════════════════════════════════════════════════ */
.notif-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-muted);
}

.notif-item:last-child { border-bottom: none; }

.notif-icon {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
}

.notif-icon .material-icons { font-size: 19px; }

.notif-content { flex: 1; }

.notif-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }

.notif-desc {
  font-size: 12.5px; color: var(--text-muted);
  margin-top: 2px; line-height: 1.5;
}

.notif-time { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════
   TIMELINE / ACTIVITY
═══════════════════════════════════════════════════════════ */
.timeline {
  position: relative; padding-left: 22px;
}

.timeline::before {
  content: '';
  position: absolute; left: 7px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border);
}

.timeline-item {
  position: relative; margin-bottom: 20px;
}

.timeline-dot {
  position: absolute; left: -22px; top: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2.5px solid var(--surface);
  background: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}

.timeline-content {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid var(--border);
}

.timeline-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.timeline-time  { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }

/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 56px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}

.empty-state-icon {
  width: 72px; height: 72px;
  border-radius: var(--radius-xl);
  background: var(--surface-2);
  border: 2px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}

.empty-state-icon .material-icons { font-size: 32px; }

.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.empty-state p  { font-size: 13.5px; color: var(--text-muted); max-width: 320px; }

/* ═══════════════════════════════════════════════════════════
   CHARTS WRAPPER
═══════════════════════════════════════════════════════════ */
.chart-wrapper {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.chart-title {
  font-size: 14.5px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 4px;
}

.chart-subtitle { font-size: 12.5px; color: var(--text-muted); margin-bottom: 18px; }

/* ═══════════════════════════════════════════════════════════
   PROFILE / DETAIL VIEWS
═══════════════════════════════════════════════════════════ */
.profile-header {
  display: flex; gap: 20px; align-items: flex-start;
  padding: 24px;
  background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-900) 100%);
  border-radius: var(--radius-lg);
  color: #fff;
  margin-bottom: 20px;
  position: relative; overflow: hidden;
}

.profile-header::after {
  content: '';
  position: absolute; right: -30px; top: -30px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}

.profile-avatar {
  width: 66px; height: 66px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.3);
}

.profile-name { font-size: 20px; font-weight: 700; margin-bottom: 3px; }
.profile-meta { font-size: 13px; opacity: .8; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.detail-item {}
.detail-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 3px; }
.detail-value { font-size: 14px; color: var(--text-primary); font-weight: 500; }

/* ═══════════════════════════════════════════════════════════
   MISC UTILITIES
═══════════════════════════════════════════════════════════ */
.divider { height: 1px; background: var(--border); margin: 18px 0; }

.text-primary    { color: var(--text-primary)   !important; }
.text-secondary  { color: var(--text-secondary) !important; }
.text-muted      { color: var(--text-muted)     !important; }
.text-brand      { color: var(--brand-600)      !important; }
.text-success    { color: var(--green-600)      !important; }
.text-danger     { color: var(--red-500)        !important; }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.mt-0  { margin-top: 0;  }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE SIDEBAR — Full premium slide-in panel
═══════════════════════════════════════════════════════════ */
@media (max-width: 992px) {

  /* ── Sidebar base reset for mobile ── */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 280px;                          /* wider than desktop collapsed */
    max-width: 85vw;
    height: 100dvh;                        /* dynamic viewport height — fixes iOS bar */
    height: 100vh;                         /* fallback */
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 320ms cubic-bezier(.4,0,.2,1),
                box-shadow 320ms cubic-bezier(.4,0,.2,1);
    box-shadow: none;
    overflow-y: auto;
    overflow-x: hidden;
    /* Momentum scrolling on iOS */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Always show all text — never collapsed on mobile */
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
  }

  /* Opened state */
  .sidebar.active {
    transform: translateX(0);
    box-shadow:
      4px 0 32px rgba(0,0,0,.32),
      8px 0 64px rgba(0,0,0,.16);
  }

  /* Never apply collapsed styles on mobile */
  .sidebar.sidebar-collapsed {
    width: 280px !important;
    transform: translateX(-100%);
  }
  .sidebar.sidebar-collapsed.active {
    transform: translateX(0);
  }
  .sidebar.sidebar-collapsed .school-name,
  .sidebar.sidebar-collapsed .menu-item-text,
  .sidebar.sidebar-collapsed .menu-item-badge {
    display: block !important;
  }
  .sidebar.sidebar-collapsed .menu-item {
    justify-content: flex-start !important;
    padding: 10px 12px 10px 16px !important;
  }
  .sidebar.sidebar-collapsed .sidebar-header {
    justify-content: space-between !important;
    padding: 20px 16px !important;
  }
  .sidebar.sidebar-collapsed .menu-title {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .sidebar.sidebar-collapsed .collapse-btn {
    position: static !important;
    background: rgba(255,255,255,.08) !important;
    border: 1px solid rgba(255,255,255,.1) !important;
    color: #c7d2fe !important;
    box-shadow: none !important;
    border-radius: var(--radius-sm) !important;
    width: 30px !important; height: 30px !important;
  }

  /* ── Sidebar header on mobile ── */
  .sidebar-header {
    padding: 18px 16px;
    min-height: 64px;
  }

  /* ── Menu items — bigger tap targets on mobile ── */
  .menu-item {
    padding: 12px 14px 12px 16px;
    margin: 2px 8px;
    min-height: 48px;                     /* WCAG tap target */
  }

  .menu-item-text {
    font-size: 14px;
  }

  .menu-item-icon {
    font-size: 22px;
  }

  /* ── Sidebar user footer on mobile ── */
  .sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,.08);
    margin-top: auto;
  }

  /* ── Main content — no left margin on mobile ── */
  .main-content {
    margin-left: 0 !important;
  }

  /* ── Show hamburger ── */
  #mobileMenuBtn { display: flex; }

  /* ── Top nav adjustments ── */
  .top-nav { padding: 0 16px; }
  .search-bar { margin: 0 10px; }

  /* ── Page layout ── */
  .filter-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .content-area { padding: 18px 16px; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE SIDEBAR OVERLAY — backdrop blur + dim
═══════════════════════════════════════════════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  z-index: 1000;
  transition: background 320ms cubic-bezier(.4,0,.2,1),
              backdrop-filter 320ms cubic-bezier(.4,0,.2,1);
  /* Prevent any touch scroll passing through */
  touch-action: none;
}

.sidebar-overlay.active {
  display: block;
  background: rgba(0, 0, 0, .48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: overlayFadeIn 320ms cubic-bezier(.4,0,.2,1) both;
}

@keyframes overlayFadeIn {
  from {
    background: rgba(0,0,0,0);
    backdrop-filter: blur(0);
    -webkit-backdrop-filter: blur(0);
  }
  to {
    background: rgba(0,0,0,.48);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
  }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — 768px and below extra tightening
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --topnav-h: 60px; }

  .form-row { flex-direction: column; gap: 0; }

  .filter-controls { flex-direction: column; }
  .filter-group    { min-width: unset; width: 100%; }

  .user-info { display: none; }
  .user-profile > .material-icons { display: none; }

  .search-bar { display: none; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .quick-actions-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

  /* Sidebar even tighter on small phones */
  .sidebar {
    width: 272px;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  }
}

/* 768px styles are in the MOBILE SIDEBAR section above */

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .content-area { padding: 16px 14px; }
  .modal { max-width: 98%; border-radius: var(--radius-lg); }
}

/* sidebar-overlay styles are in the MOBILE SIDEBAR section above */

/* ═══════════════════════════════════════════════════════════
   ATTENDANCE-SPECIFIC
═══════════════════════════════════════════════════════════ */
select[class^="att-status"],
.att-status-select {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 12.5px;
  font-family: var(--font-body);
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════
   PRINT
═══════════════════════════════════════════════════════════ */
@media print {
  .sidebar, .top-nav, .page-actions, .filter-controls,
  .pagination-controls, .modal-overlay, .loading-overlay { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .content-area { padding: 0 !important; }
}
/* ═══════════════════════════════════════════════════════════
   ATTENDANCE RADIO PILL BUTTONS
═══════════════════════════════════════════════════════════ */
.att-radio-group {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}

.att-radio-group input[type="radio"] {
  display: none;
}

.att-radio-group label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.18s ease;
  white-space: nowrap;
  user-select: none;
  background: var(--surface);
}

.att-radio-group label:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* Present */
.att-radio-group input[value="present"]:checked + label {
  background: #22c55e;
  border-color: #16a34a;
  color: #fff;
  box-shadow: 0 3px 10px rgba(34,197,94,0.35);
}

/* Absent */
.att-radio-group input[value="absent"]:checked + label {
  background: #ef4444;
  border-color: #dc2626;
  color: #fff;
  box-shadow: 0 3px 10px rgba(239,68,68,0.35);
}

/* Late */
.att-radio-group input[value="late"]:checked + label {
  background: #f59e0b;
  border-color: #d97706;
  color: #fff;
  box-shadow: 0 3px 10px rgba(245,158,11,0.35);
}

/* Reason input inside attendance row */
.att-reason-input {
  padding: 5px 9px;
  border: 1.5px solid #f59e0b;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-body);
  animation: fadeIn 0.18s ease;
}

.att-reason-input:focus {
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.2);
}

.att-reason-input.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.2);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}/* style.css lo Dropdown dynamic transitions */
.profile-dropdown a:hover {
    background-color: var(--brand-50) !important;
    color: var(--danger-dark) !important;
}
/* ── Previous Dues Section Styles ── */
.prev-dues-section {
    margin-top: 20px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.prev-dues-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}

.prev-dues-header .material-icons {
    color: var(--brand-500);
}

.prev-dues-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.prev-due-summary-item {
    background: var(--surface-2);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.prev-due-summary-item.academic { border-left: 3px solid #6366f1; }
.prev-due-summary-item.transport { border-left: 3px solid #0ea5e9; }
.prev-due-summary-item.hostel { border-left: 3px solid #8b5cf6; }
.prev-due-summary-item.total { border-left: 3px solid #dc2626; background: #fef2f2; }

.prev-due-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.prev-due-total {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.prev-due-summary-item.total .prev-due-total {
    color: #dc2626;
}

.prev-dues-list {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.prev-dues-list-header {
    display: grid;
    grid-template-columns: 100px 100px 1fr 60px;
    background: var(--surface-2);
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.prev-dues-list-body {
    max-height: 200px;
    overflow-y: auto;
}

.prev-due-row {
    display: grid;
    grid-template-columns: 100px 100px 1fr 60px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-muted);
    font-size: 12px;
    align-items: center;
}

.prev-due-row:last-child {
    border-bottom: none;
}

.prev-due-row:hover {
    background: var(--surface-2);
}

.prev-due-year {
    color: var(--text-secondary);
    font-family: monospace;
}

.prev-due-amount {
    font-weight: 600;
    color: #d97706;
}

.prev-due-desc {
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prev-due-actions {
    display: flex;
    gap: 5px;
}

.prev-dues-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

.prev-dues-error {
    text-align: center;
    padding: 24px;
    color: #dc2626;
    font-size: 13px;
    background: #fef2f2;
    border-radius: 10px;
}

@media (max-width: 640px) {
    .prev-dues-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .prev-dues-list-header,
    .prev-due-row {
        grid-template-columns: 80px 80px 1fr 50px;
    }
}
/* ── Previous Dues page shared badge styles ── */
.fp-badge { display:inline-block; padding:2px 10px; border-radius:20px; font-size:11px; font-weight:700; }
.fp-badge-cleared  { background:#dcfce7; color:#15803d; }
.fp-badge-pending  { background:#fef9c3; color:#854d0e; }
.fp-badge-overpaid { background:#e0f2fe; color:#0369a1; }
.fp-badge-due      { background:#fef3c7; color:#92400e; }
.fp-badge-nodues   { background:#dcfce7; color:#15803d; }

/* ═══════════════════════════════════════════════════════════
   RECORD PAYMENT MODAL — Redesigned
═══════════════════════════════════════════════════════════ */

/* Modal size */
.rpm-modal {
  max-width: 580px;
  width: 96%;
}

/* Header */
.rpm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.rpm-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.rpm-header-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--brand-50);
  border: 1.5px solid var(--brand-200);
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-600);
}
.rpm-header-icon .material-icons { font-size: 20px; }
.rpm-title {
  font-size: 16px; font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.rpm-subtitle {
  font-size: 11px; color: var(--text-muted);
  margin-top: 1px;
}
.rpm-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.rpm-close:hover { background: var(--surface-3); color: var(--text-primary); }
.rpm-close .material-icons { font-size: 18px; }

/* Body */
.rpm-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Sections */
.rpm-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rpm-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-secondary);
}
.rpm-step {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--brand-500);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Inputs */
.rpm-input {
  font-size: 14px !important;
  padding: 10px 13px !important;
  border-radius: var(--radius-md) !important;
  border: 1.5px solid var(--border) !important;
  transition: border-color .15s, box-shadow .15s !important;
  background: var(--surface) !important;
}
.rpm-input:focus {
  border-color: var(--brand-400) !important;
  box-shadow: 0 0 0 3px rgba(99,102,241,.1) !important;
  outline: none !important;
}
.rpm-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  color: var(--text-muted);
  pointer-events: none;
}
.rpm-input-with-icon { padding-left: 40px !important; }
.rpm-currency {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  font-size: 14px; font-weight: 700;
  color: var(--text-secondary);
  pointer-events: none;
}
.rpm-input-currency { padding-left: 28px !important; font-weight: 600 !important; }
.rpm-select { cursor: pointer; }
.rpm-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 5px;
  display: block;
}

/* 3-column row */
.rpm-row-3 {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.1fr;
  gap: 10px;
}
.rpm-field { display: flex; flex-direction: column; }

/* Suggestions dropdown */
.rpm-suggestions {
  display: none;
  position: absolute;
  top: 100%; left: 0; right: 0;
  z-index: 9999;
  background: var(--surface);
  border: 1.5px solid var(--brand-300);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  max-height: 220px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

/* QR Box */
.rpm-qr-box {
  background: var(--surface-2);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 16px 14px;
  text-align: center;
  margin-bottom: 12px;
}
.rpm-qr-label {
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex; align-items: center;
  justify-content: center; gap: 6px;
}

/* Fee list */
.rpm-fee-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Auto-fill bar */
.rpm-autofill-bar {
  margin-top: 4px;
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
}
.rpm-autofill-btn {
  background: var(--brand-50);
  color: var(--brand-600);
  border: 1.5px solid var(--brand-200);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  transition: background .15s;
}
.rpm-autofill-btn:hover { background: var(--brand-100); }

/* Total badge */
.rpm-total-badge {
  background: var(--brand-600);
  color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: .02em;
}

/* Paste button */
.rpm-paste-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--brand-50); color: var(--brand-600);
  border: 1px solid var(--brand-200);
  border-radius: var(--radius-sm);
  font-size: 11.5px; font-weight: 600;
  padding: 4px 10px; cursor: pointer;
  display: flex; align-items: center; gap: 3px;
}

/* Actions bar */
.rpm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.rpm-btn-cancel {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.rpm-btn-cancel:hover { background: var(--surface-2); border-color: var(--text-muted); }
.rpm-btn-submit {
  padding: 10px 22px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--brand-600);
  color: #fff;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: background .15s, transform .1s;
  box-shadow: 0 2px 8px rgba(79,70,229,.25);
}
.rpm-btn-submit:hover { background: var(--brand-700); transform: translateY(-1px); }
.rpm-btn-submit:active { transform: translateY(0); }
.rpm-btn-submit:disabled {
  opacity: .65; cursor: not-allowed; transform: none;
}

@media (max-width: 520px) {
  .rpm-row-3 { grid-template-columns: 1fr 1fr; }
  .rpm-row-3 .rpm-field:first-child { grid-column: 1 / -1; }
  .rpm-body { padding: 16px; gap: 14px; }
}

/* RPM Student Info Card */
.rpm-student-card {
  background: var(--brand-50);
  border: 1.5px solid var(--brand-200);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.rpm-student-card-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rpm-student-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand-100);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rpm-student-name {
  font-size: 14px; font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rpm-student-meta {
  font-size: 11px; color: var(--text-muted);
  margin-top: 1px;
}
.rpm-student-due-badge {
  background: #fef2f2; color: #dc2626;
  border: 1px solid #fca5a5;
  font-size: 12px; font-weight: 800;
  padding: 4px 10px; border-radius: 20px;
  white-space: nowrap; flex-shrink: 0;
}
.rpm-student-cleared-badge {
  background: #dcfce7; color: #16a34a;
  border: 1px solid #86efac;
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 20px;
  white-space: nowrap; flex-shrink: 0;
}
.rpm-student-due-row {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.rpm-due-pill {
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 12px;
}
.rpm-due-curr {
  background: #fef3c7; color: #92400e;
  border: 1px solid #fde68a;
}
.rpm-due-prev {
  background: #ede9fe; color: #5b21b6;
  border: 1px solid #c4b5fd;
}
td.action-cell--wrap {
  display: grid !important;
  grid-template-columns: repeat(2, 30px);
  grid-auto-rows: 30px;
  gap: 4px;
  align-items: center;
  justify-content: center;
  width: 68px;
  min-width: 68px;
  max-width: 68px;
}

.action-btn.receipt-btn { color: #059669; }

/* ═══════════════════════════════════════════════════════════
   DIALER PAGE — Student Contact Directory
═══════════════════════════════════════════════════════════ */
.dialer-count {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  margin: -8px 0 12px 4px;
}

.dialer-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.dialer-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: var(--transition);
}

.dialer-card:hover {
  border-color: var(--brand-400);
  box-shadow: 0 4px 14px rgba(99,102,241,.14);
  transform: translateY(-1px);
}

.dialer-avatar {
  flex-shrink: 0;
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  font-weight: 700;
  font-size: 18px;
}

.dialer-info {
  flex: 1;
  min-width: 0;
}

.dialer-name {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dialer-meta {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.dialer-parent {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dialer-actions {
  flex-shrink: 0;
}

.dialer-call-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--green-500);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}

.dialer-call-btn:hover {
  background: var(--green-600);
}

.dialer-call-btn .material-icons {
  font-size: 16px;
}

.dialer-phone-text {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dialer-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
}

.dialer-empty .material-icons {
  font-size: 48px;
  margin-bottom: 10px;
}

[data-theme="dark"] .dialer-call-btn { color: #fff; }
