/* ==========================================================================
   TUITIONPAY - MODERN DESIGN SYSTEM & RESPONSIVE PWA STYLES
   ========================================================================== */

:root {
  /* Color Tokens */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  
  --success: #059669;
  --success-light: #ecfdf5;
  --success-border: #a7f3d0;
  
  --warning: #d97706;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;
  
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;
  
  --info: #0284c7;
  --info-light: #f0f9ff;
  --info-border: #bae6fd;
  
  --ewallet-purple: #7c3aed;
  --ewallet-light: #f5f3ff;
  
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  
  /* Radii & Shadows */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-float: 0 20px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* Dimensions & Spacing */
  --sidebar-width: 260px;
  --header-height: 60px;
  --bottom-bar-height: 64px;
  
  /* iOS Safe Areas */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

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

html {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  overflow-x: hidden;
  padding-bottom: calc(var(--sab) + 70px);
}

@media (min-width: 1024px) {
  body {
    padding-bottom: 0;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* App Shell Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar (Desktop) */
/* Sidebar (Desktop & Mobile Responsive Slide-Out Drawer) */
.sidebar {
  display: flex;
  width: min(300px, 85vw);
  background-color: var(--bg-sidebar);
  color: var(--text-white);
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 1050;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s ease, visibility 0.28s;
  box-shadow: none;
  visibility: hidden;
}

.sidebar.sidebar-open {
  transform: translateX(0);
  box-shadow: 12px 0 35px rgba(0, 0, 0, 0.5);
  visibility: visible;
}

/* Mobile Sidebar Backdrop Overlay */
.mobile-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1040;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.mobile-sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-close-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

@media (min-width: 1024px) {
  .sidebar {
    width: var(--sidebar-width);
    transform: none !important;
    box-shadow: none !important;
    visibility: visible !important;
    z-index: 40;
  }
  .sidebar-close-btn {
    display: none !important;
  }
  .mobile-sidebar-overlay {
    display: none !important;
  }
  .main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
  }
}

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

.sidebar-logo-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.sidebar-brand-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(37, 99, 235, 0.3);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

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

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.sidebar-nav-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  padding: 8px 12px 4px 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: #cbd5e1;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

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

.nav-link.active {
  background-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.nav-link .badge {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-footer {
  padding: 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
}

@media (min-width: 1024px) {
  .sidebar-footer {
    display: none !important;
  }
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* Top App Header (Mobile & Desktop) - Always pinned at top when scrolling down */
.app-header {
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

@media (min-width: 1024px) {
  .app-header {
    padding: 0 28px;
  }
}

.desktop-only {
  display: none !important;
}

@media (min-width: 1024px) {
  .desktop-only {
    display: flex !important;
  }
}

.mobile-only {
  display: flex !important;
}

@media (min-width: 1024px) {
  .mobile-only {
    display: none !important;
  }
}

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

/* Centered Mobile Brand */
.header-mobile-brand {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  z-index: 5;
}

.mobile-brand-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.mobile-brand-text {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.header-title-wrap {
  display: flex;
  flex-direction: column;
}

.header-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.header-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  z-index: 10;
}

/* User Profile Dropdown (Desktop) */
.user-dropdown-container {
  position: relative;
  display: flex;
  align-items: center;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.user-profile-btn:hover, .user-profile-btn.active {
  background: var(--bg-app);
  border-color: var(--border);
}

.user-avatar-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1.5px solid #7dd3fc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.84rem;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
  transition: all 0.15s ease;
}

/* Role-based Avatar Backgrounds & Colors */
.avatar-superadmin {
  background-color: #f3e8ff !important;
  color: #7e22ce !important;
  border: 1.5px solid #d8b4fe !important;
  box-shadow: 0 2px 6px rgba(126, 34, 206, 0.18) !important;
}

.avatar-admin {
  background-color: #dcfce7 !important;
  color: #15803d !important;
  border: 1.5px solid #86efac !important;
  box-shadow: 0 2px 6px rgba(21, 128, 61, 0.18) !important;
}

.avatar-staff, .avatar-teacher {
  background-color: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1.5px solid #7dd3fc !important;
  box-shadow: 0 2px 6px rgba(3, 105, 161, 0.18) !important;
}

/* Role Badges */
.badge-role-superadmin {
  background: #f3e8ff !important;
  color: #7e22ce !important;
  border: 1px solid #d8b4fe !important;
  font-weight: 700 !important;
}

.badge-role-admin {
  background: #dcfce7 !important;
  color: #15803d !important;
  border: 1px solid #86efac !important;
  font-weight: 700 !important;
}

.badge-role-staff, .badge-role-teacher {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1px solid #7dd3fc !important;
  font-weight: 700 !important;
}

.user-meta-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.user-display-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.user-role-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.dropdown-chevron-icon {
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.user-profile-btn.active .dropdown-chevron-icon {
  transform: rotate(180deg);
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 250px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  padding: 8px;
  z-index: 100;
  animation: dropdownSlideDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownSlideDown {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-user-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.dropdown-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  flex-shrink: 0;
}

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

.dropdown-user-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-user-username {
  font-size: 0.76rem;
  color: var(--primary);
  font-weight: 600;
  font-family: monospace;
}

.dropdown-user-email {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all 0.12s ease;
}

.dropdown-item:hover {
  background: var(--bg-app);
  color: var(--primary);
}

.dropdown-logout-btn {
  color: var(--danger);
}

.dropdown-logout-btn:hover {
  background: #fef2f2;
  color: #b91c1c;
}

/* Period Selector Badge */
.period-selector {
  display: flex;
  align-items: center;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.period-select-input {
  background: transparent;
  border: none;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

/* Notification Button */
.btn-icon-badge {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.btn-icon-badge:hover {
  background: var(--bg-app);
  color: var(--text-main);
}

.badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  box-shadow: 0 0 0 2px #ffffff;
}

/* Content Container */
.page-container {
  padding: 16px;
  flex: 1;
  max-width: 1380px;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 768px) {
  .page-container {
    padding: 24px 28px;
  }
}

/* Page Header */
.page-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.page-description {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }
}

/* 3-Column Stats Grid (e.g. Student Detail Snapshot) */
.stats-grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 640px) {
  .stats-grid-3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

@media (min-width: 880px) {
  .stats-grid-3 {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
  min-width: 0;
  word-break: break-word;
}

.stat-card-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.accent-blue { background: var(--primary); }
.accent-emerald { background: var(--success); }
.accent-amber { background: var(--warning); }
.accent-purple { background: var(--ewallet-purple); }
.accent-rose { background: var(--danger); }

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

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-blue { background: var(--primary-light); color: var(--primary); }
.icon-emerald { background: var(--success-light); color: var(--success); }
.icon-amber { background: var(--warning-light); color: var(--warning); }
.icon-purple { background: var(--ewallet-light); color: var(--ewallet-purple); }
.icon-rose { background: var(--danger-light); color: var(--danger); }

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

@media (max-width: 640px) {
  .stat-card {
    padding: 12px 14px;
  }
  .stat-icon-wrap {
    display: none !important;
  }
  .stat-label {
    font-size: 0.72rem;
    letter-spacing: 0.02em;
  }
  .stat-value {
    font-size: 1.3rem;
  }
  .stat-emoji-icon {
    display: none !important;
  }
}

/* Family Summary Sibling Actions & Right-Alignment */
.family-summary-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  margin-left: auto;
  gap: 2px;
}

@media (max-width: 640px) {
  .family-summary-actions {
    width: 100%;
    align-items: flex-end;
    text-align: right;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px dashed rgba(244, 114, 182, 0.4);
  }
}

.desktop-overdue-table {
  display: none;
}
.mobile-overdue-list {
  display: flex;
  flex-direction: column;
}
@media (min-width: 768px) {
  .desktop-overdue-table {
    display: block;
  }
  .mobile-overdue-list {
    display: none;
  }
}

.stat-footer {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Method Breakdown Chips */
.method-pills-bar {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 24px;
  -webkit-overflow-scrolling: touch;
}

.method-pill {
  flex: 1;
  min-width: 140px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-xs);
}

.method-pill-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.method-pill-info {
  display: flex;
  flex-direction: column;
}

.method-pill-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.method-pill-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Cards & Containers */
.card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  margin-bottom: 24px;
  overflow: hidden;
}

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

.card-title {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

.card-body-flush {
  padding: 0;
}

/* Filter & Action Toolbar */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 380px;
}

.search-input {
  width: 100%;
  height: 42px;
  padding: 8px 14px 8px 38px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

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

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.select-filter {
  height: 42px;
  padding: 0 14px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.select-filter:focus {
  border-color: var(--primary);
}

/* Quick Filter Chips */
.chip-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 14px;
  -webkit-overflow-scrolling: touch;
}

.filter-chip {
  padding: 6px 14px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  background: var(--bg-app);
  color: var(--text-main);
}

.filter-chip.active {
  background: var(--text-main);
  border-color: var(--text-main);
  color: #ffffff;
}

.filter-chip .count-badge {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.08);
}

.filter-chip.active .count-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Modern Data Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background: #f8fafc;
  padding: 12px 16px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:hover td {
  background-color: #f8fafc;
}

/* Sticky First Column for Tables on Mobile Horizontal Scroll */
.table-sticky-col th:first-child,
.table-sticky-col td:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  background: #ffffff;
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.06);
}

.table-sticky-col thead th:first-child {
  z-index: 6;
  background: #f8fafc;
  border-right: 1px solid var(--border);
}

.table-sticky-col tr:hover td:first-child {
  background-color: #f8fafc;
}

.student-name-link {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s ease;
}

.student-name-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-paid {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge-partial {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.badge-pending {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.badge-overdue {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

/* Payment Method Badges */
.badge-cash {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-ewallet {
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.badge-bank {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}

.btn-success:hover {
  background: #047857;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.btn-outline {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-app);
  border-color: #cbd5e1;
}

.btn-danger-outline {
  background: #ffffff;
  border-color: var(--danger-border);
  color: var(--danger);
}

.btn-danger-outline:hover {
  background: var(--danger-light);
}

/* Mobile Action Card List (Visible only on mobile) */
.mobile-records-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 768px) {
  .mobile-records-list {
    display: none;
  }
}

@media (max-width: 767px) {
  .desktop-table-wrap {
    display: none;
  }
}

.mobile-record-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.student-meta-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.student-meta-code {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: monospace;
}

.student-meta-class {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.mobile-card-amounts {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-app);
  padding: 10px 14px;
  border-radius: var(--radius-md);
}

.amount-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.amount-val-paid {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--success);
}

.amount-val-due {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

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

/* Bottom Navigation Bar (Mobile / iOS Standalone) */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-bar-height) + var(--sab));
  padding-bottom: var(--sab);
  background: #ffffff;
  border-top: 1px solid var(--border);
  z-index: 45;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

@media (min-width: 1024px) {
  .bottom-nav {
    display: none;
  }
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  transition: color 0.15s ease;
  padding-top: 4px;
}

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item svg {
  width: 22px;
  height: 22px;
}

/* Modals & Dialogs (Bottom Sheet on Mobile, Centered on Desktop) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 60;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 768px) {
  .modal-backdrop {
    align-items: center;
    padding: 24px;
  }
}

.modal-backdrop.active {
  display: flex;
}

.modal-content {
  background: #ffffff;
  width: 100%;
  max-width: 560px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-float);
  animation: slideUp 0.25s ease-out;
}

@media (min-width: 768px) {
  .modal-content {
    border-radius: var(--radius-lg);
    animation: fadeInScale 0.2s ease-out;
  }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

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

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  height: 44px;
  padding: 8px 14px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
  transition: all 0.15s ease;
}

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

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.radio-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.radio-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.radio-card input {
  display: none;
}

.radio-card.selected, .radio-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

/* iOS Home Screen Install Helper Banner */
.ios-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: var(--shadow-md);
}

.ios-banner.show {
  display: flex;
}

.ios-banner-text h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.ios-banner-text p {
  font-size: 0.8rem;
  color: #cbd5e1;
}

/* Notification Toast Container */
.toast-container {
  position: fixed;
  top: calc(var(--sat) + 20px);
  right: 20px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  width: calc(100% - 40px);
  pointer-events: none;
}

.toast {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.25s ease;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(50px) scale(0.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

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

.toast-icon.toast-success {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.toast-icon.toast-danger,
.toast-icon.toast-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.toast-icon.toast-warning {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.toast-icon.toast-info {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.toast-content {
  flex: 1;
  padding-right: 16px;
}

.toast-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
  line-height: 1.3;
}

.toast-body {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.toast-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.toast-close:hover {
  color: var(--text-main);
  background: #f1f5f9;
}

/* Print Receipt Styles */
@media print {
  body {
    background: #ffffff;
    color: #000000;
    padding: 0;
  }
  .sidebar, .app-header, .bottom-nav, .no-print, .btn, .toolbar {
    display: none !important;
  }
  .main-content {
    margin: 0 !important;
    width: 100% !important;
  }
  .page-container {
    padding: 0 !important;
    max-width: 100% !important;
  }
  .receipt-box {
    border: 1px solid #000000 !important;
    box-shadow: none !important;
  }
}

/* ==========================================================================
   PAGINATION DESIGN SYSTEM & SVG ICON FIX
   ========================================================================== */
nav[role="navigation"] svg,
.pagination svg,
.custom-pagination svg,
svg.w-5.h-5 {
  width: 15px !important;
  height: 15px !important;
  display: inline-block !important;
  vertical-align: middle !important;
  max-width: 15px !important;
  max-height: 15px !important;
}

.custom-pagination {
  width: 100%;
}

.pagination-mobile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pagination-desktop {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

@media (min-width: 640px) {
  .pagination-mobile {
    display: none;
  }
  .pagination-desktop {
    display: flex;
  }
}

.pagination-info {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.pagination-info strong {
  color: var(--text-main);
  font-weight: 600;
}

.pagination-numbers {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  user-select: none;
}

.page-btn:hover:not(.disabled):not(.active) {
  background: var(--bg-app);
  border-color: #cbd5e1;
  color: var(--primary);
}

.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.page-btn.disabled {
  background: #f8fafc;
  color: #cbd5e1;
  border-color: var(--border);
  cursor: not-allowed;
}

.page-btn.dots {
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: default;
}

.page-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.page-link:hover:not(.disabled) {
  background: var(--bg-app);
  border-color: #cbd5e1;
}

.page-link.disabled {
  background: #f8fafc;
  color: #cbd5e1;
  border-color: var(--border);
  cursor: not-allowed;
}

.page-summary {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Payment Method Brand Badges */
.badge-method-cash {
  background: #ecfdf5 !important;
  color: #059669 !important;
  border: 1px solid #a7f3d0 !important;
  font-weight: 700 !important;
}

.badge-method-grab {
  background: #e6f7ee !important;
  color: #00B14F !important;
  border: 1px solid #80d8a7 !important;
  font-weight: 700 !important;
}

.badge-method-tng {
  background: #e6f0fa !important;
  color: #005BAC !important;
  border: 1px solid #99c2eb !important;
  font-weight: 700 !important;
}

.badge-method-duitnow {
  background: #fdf0f7 !important;
  color: #ED0080 !important;
  border: 1px solid #f799cc !important;
  font-weight: 700 !important;
}

.badge-method-bank {
  background: #eff6ff !important;
  color: #2563eb !important;
  border: 1px solid #bfdbfe !important;
  font-weight: 700 !important;
}

.badge-method-cheque {
  background: #f8fafc !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
  font-weight: 700 !important;
}

/* Modal Payment Channel Selectable Grid Cards */
.payment-channel-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.payment-channel-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.payment-channel-card.channel-cash.selected {
  border-color: #059669 !important;
  background: #ecfdf5 !important;
}

.payment-channel-card.channel-grab.selected {
  border-color: #00B14F !important;
  background: #e6f7ee !important;
}

.payment-channel-card.channel-tng.selected {
  border-color: #005BAC !important;
  background: #e6f0fa !important;
}

.payment-channel-card.channel-duitnow.selected {
  border-color: #ED0080 !important;
  background: #fdf0f7 !important;
}

.payment-channel-card.channel-bank.selected {
  border-color: #2563eb !important;
  background: #eff6ff !important;
}

.payment-channel-card.channel-cheque.selected {
  border-color: #475569 !important;
  background: #f8fafc !important;
}

/* Pull to Refresh Indicator (iOS Home Screen & Mobile) */
.ptr-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translate(-50%, -60px);
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.ptr-spinner-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  font-size: 0.82rem;
  font-weight: 600;
}

.ptr-icon {
  width: 18px;
  height: 18px;
  color: #60a5fa;
  transition: transform 0.1s linear;
}

.ptr-indicator.ptr-refreshing .ptr-icon {
  animation: ptrSpin 0.75s linear infinite;
}

@keyframes ptrSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (min-width: 1024px) {
  .ptr-indicator {
    display: none !important;
  }
}

/* ==========================================================================
   GLOBAL CUSTOM MODAL STYLES
   ========================================================================== */
.custom-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.custom-modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScale 0.15s ease-out;
}

@keyframes modalScale {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.custom-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  flex-shrink: 0;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s;
}

.modal-close-btn:hover {
  color: var(--danger);
}

.custom-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.custom-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
  flex-shrink: 0;
}



/* ==========================================================================
   DASHBOARD HCI & MOBILE-FIRST ACADEMIC OVERVIEW ENHANCEMENTS
   ========================================================================== */

html {
  scroll-padding-bottom: calc(var(--bottom-bar-height) + env(safe-area-inset-bottom, 0px) + 12px);
}

.dash-root {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dash-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Top Context Bar */
.dash-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dash-topbar-copy {
  min-inline-size: 0;
}

.dash-page-title {
  font-size: clamp(1.15rem, 3vw, 1.38rem);
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-wrap: balance;
  margin: 0;
}

.dash-page-subtitle {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin: 2px 0 0 0;
  text-wrap: pretty;
}

.dash-period-form {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.dash-period-select {
  font-weight: 700;
  color: var(--primary);
  border-color: var(--primary-border);
  background-color: #ffffff;
  min-block-size: 40px;
  padding-inline: 12px 34px;
  border-radius: var(--radius-md);
}

@media (max-width: 640px) {
  .dash-period-form,
  .dash-period-select {
    width: 100%;
  }
}

/* Section Headers */
.dash-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.dash-section-heading-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-inline-size: 0;
}

.dash-section-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.dash-section-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
  line-height: 1.25;
  text-wrap: balance;
}

.dash-title-period {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.dash-section-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 2px 0 0 0;
  text-wrap: pretty;
}

.dash-action-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Container-Queried KPI Grid: 2x2 on phones, 4-column on wider containers */
.dash-kpi-container {
  container: dash-kpi / inline-size;
}

.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@container dash-kpi (inline-size >= 44rem) {
  .dash-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
  }
}

.dash-kpi-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 13px 14px;
  box-shadow: var(--shadow-xs);
  text-decoration: none;
  color: inherit;
  min-inline-size: 0;
  overflow: hidden;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.dash-kpi-card::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  block-size: 3px;
}

.dash-accent-blue::before { background: var(--primary); }
.dash-accent-rose::before { background: #ec4899; }
.dash-accent-sky::before { background: #0284c7; }
.dash-accent-emerald::before { background: var(--success); }
.dash-accent-amber::before { background: var(--warning); }
.dash-accent-purple::before { background: var(--ewallet-purple); }

.dash-kpi-interactive:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.dash-kpi-interactive:active {
  transform: scale(0.985);
}

.dash-kpi-interactive:focus-visible,
.dash-grade-tile:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.dash-kpi-top {
  display: flex;
  align-items: center;
  gap: 7px;
  min-inline-size: 0;
}

.dash-kpi-badge {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  flex-shrink: 0;
}

.dash-kpi-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  line-height: 1.2;
  min-inline-size: 0;
  overflow-wrap: break-word;
}

.dash-label-sub {
  font-weight: 600;
  text-transform: none;
  opacity: 0.85;
  white-space: nowrap;
}

.dash-kpi-chevron {
  margin-inline-start: auto;
  color: var(--text-light);
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}

.dash-kpi-value {
  font-size: clamp(1.35rem, 4.2vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.dash-currency {
  font-size: clamp(1.08rem, 3.6vw, 1.48rem);
}

.dash-kpi-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.3;
}

.dash-meta-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.dash-dot-green { background: var(--success); }
.dash-meta-sep { opacity: 0.6; }

/* Progress Bar inside Collection Rate Card */
.dash-progress-track {
  width: 100%;
  block-size: 6px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.dash-progress-fill {
  display: block;
  block-size: 100%;
  background: linear-gradient(90deg, var(--primary), #7c3aed);
  border-radius: var(--radius-full);
}

/* Color Tones */
.dash-tone-blue { background: var(--primary-light); color: var(--primary); }
.dash-tone-rose { background: #fdf2f8; color: #db2777; }
.dash-tone-sky { background: #f0f9ff; color: #0284c7; }
.dash-tone-emerald { background: var(--success-light); color: var(--success); }
.dash-tone-amber { background: var(--warning-light); color: var(--warning); }
.dash-tone-purple { background: var(--ewallet-light); color: var(--ewallet-purple); }

.dash-text-primary { color: var(--primary); }
.dash-text-rose { color: #db2777; }
.dash-text-sky { color: #0284c7; }
.dash-text-purple { color: #7c3aed; }
.dash-text-success { color: var(--success); }
.dash-text-danger { color: var(--danger); }
.dash-text-warning { color: var(--warning); }

.dash-bg-rose { background: #ec4899; }
.dash-bg-sky { background: #0284c7; }
.dash-bg-purple { background: #7c3aed; }

.dash-pill-rose { background: #fdf2f8; color: #be185d; border: 1px solid #fbcfe8; font-weight: 700; font-size: 0.74rem; }
.dash-pill-sky { background: #f0f9ff; color: #0369a1; border: 1px solid #bae6fd; font-weight: 700; font-size: 0.74rem; }
.dash-pill-purple { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; font-weight: 700; font-size: 0.74rem; }
.dash-pill-xs { font-size: 0.68rem; padding: 2px 7px; }

/* Grade Distribution Card (Mobile-First 3-Column Symmetric Touch Tiles) */
.dash-grade-card {
  container: dash-grades / inline-size;
  border-radius: var(--radius-lg);
}

.dash-grade-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dash-mix-wrap {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.dash-mix-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-mix-title {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.dash-mix-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.dash-mix-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dash-legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.dash-mix-bar {
  display: flex;
  width: 100%;
  block-size: 8px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: #f1f5f9;
  gap: 2px;
}

.dash-mix-seg {
  display: block;
  block-size: 100%;
  min-inline-size: 4px;
}

.dash-grade-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.dash-grade-group-last {
  padding-bottom: 0;
  border-bottom: none;
}

.dash-grade-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dash-grade-group-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-grade-group-count {
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.dash-grade-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

@container dash-grades (inline-size >= 38rem) {
  .dash-grade-grid-primary {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .dash-grade-grid-secondary {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.dash-grade-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-block-size: 46px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 700;
  transition: transform 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}

.dash-grade-tile:active {
  transform: scale(0.97);
}

.dash-tile-sky {
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.dash-tile-sky:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
}

.dash-tile-sky .dash-grade-count {
  background: #0284c7;
  color: #ffffff;
}

.dash-tile-purple {
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.dash-tile-purple:hover {
  background: #ede9fe;
  border-color: #c4b5fd;
}

.dash-tile-purple .dash-grade-count {
  background: #7c3aed;
  color: #ffffff;
}

.dash-grade-tile.is-empty {
  background: #f8fafc;
  color: var(--text-muted);
  border-color: var(--border);
  opacity: 0.72;
}

.dash-grade-tile.is-empty .dash-grade-count {
  background: #cbd5e1;
  color: #475569;
}

.dash-grade-name {
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.dash-grade-count {
  min-inline-size: 24px;
  block-size: 24px;
  padding-inline: 6px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Overdue & Pending Fees Section */
.dash-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dash-overdue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.dash-overdue-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.dash-btn-remind-group {
  border-color: #d97706;
  color: #b45309;
  font-weight: 700;
  background: #fffbeb;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dash-btn-remind {
  color: #b45309;
  border-color: #f59e0b;
  background: #fffbeb;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dash-student-link {
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.94rem;
}

.dash-due-amount {
  font-size: 0.95rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.dash-due-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.dash-mobile-fee-row {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #ffffff;
}

.dash-mobile-fee-info {
  flex: 1;
  min-inline-size: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dash-mobile-fee-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.dash-mobile-student-name {
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.94rem;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.dash-mobile-fee-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-mobile-amount {
  font-size: 0.98rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
}

.dash-status-chip {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.dash-status-overdue { background: #fef2f2; color: #dc2626; }
.dash-status-partial { background: #fffbeb; color: #b45309; }
.dash-status-pending { background: #f1f5f9; color: #475569; }

.dash-mobile-fee-action {
  flex-shrink: 0;
}

.dash-empty-state {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Teaching Subjects Grid */
.dash-subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.dash-subject-tile {
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-app);
}

.dash-subject-name {
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--text-main);
}

.dash-subject-level {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Touch-Device Minimum 44x44 Targets (WCAG 2.5.5) */
@media (pointer: coarse) {
  .dash-period-select,
  .dash-action-link,
  .dash-btn-remind-group,
  .dash-btn-checklist,
  .dash-btn-remind-mobile,
  .dash-grade-tile {
    min-block-size: 44px;
  }
  .dash-btn-remind-mobile {
    padding-inline: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dash-kpi-card,
  .dash-grade-tile {
    transition: none;
  }
}


/* ==========================================================================
   CHECKLIST MODULE — ZERO-SCROLL MOBILE STUDENT CARDS & RESPONSIVE TABLE
   ========================================================================== */

.chk-root {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.chk-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chk-period-form {
  display: flex;
  align-items: center;
}

@media (max-width: 640px) {
  .chk-header-controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .chk-group-remind-btn,
  .chk-period-form,
  .chk-period-form .dash-period-select {
    width: 100%;
    justify-content: center;
  }
}

/* Filter Toolbar */
.chk-filter-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chk-search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.chk-search-input-wrap {
  flex: 1 1 220px;
  min-inline-size: 0;
}

.chk-filter-selects {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 8px;
  flex: 1 1 260px;
}

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

@media (max-width: 640px) {
  .chk-search-input-wrap,
  .chk-filter-selects,
  .chk-search-actions {
    width: 100%;
    flex: 1 1 100%;
  }
  .chk-search-actions .btn {
    flex: 1;
    justify-content: center;
  }
}

/* Level & Grade Navigation */
.chk-nav-tiers {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chk-level-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chk-grade-bars {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chk-grade-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chk-grade-row-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-inline-size: 74px;
}

.chk-grade-pills-scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.chk-grade-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border);
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.chk-grade-pill-sky:hover { border-color: #7dd3fc; background: #f0f9ff; color: #0369a1; }
.chk-grade-pill-sky.is-active { background: #0284c7; border-color: #0284c7; color: #ffffff; }

.chk-grade-pill-purple:hover { border-color: #c4b5fd; background: #f5f3ff; color: #6d28d9; }
.chk-grade-pill-purple.is-active { background: #7c3aed; border-color: #7c3aed; color: #ffffff; }

.chk-grade-short {
  font-weight: 600;
  opacity: 0.85;
}

/* Ledger Header & Container-Queried Responsive Table */
.chk-ledger-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.chk-ledger-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.chk-table-wrapper {
  container: checklist-table / inline-size;
  overflow-x: auto;
  max-inline-size: 100%;
}

.chk-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  --label-fee: "Fee Due";
  --label-paid: "Paid";
  --label-balance: "Balance";
  --label-method: "Method";
  --label-status: "Status";
}

.chk-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
}

.chk-table tbody th.chk-cell-student {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: #ffffff;
  text-align: left;
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.chk-student-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.chk-student-name {
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.94rem;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.chk-sibling-badge {
  font-size: 0.68rem;
  padding: 1px 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.chk-student-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chk-student-phone {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.chk-money {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chk-method-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chk-evidence-link {
  background: #eff6ff;
  color: #2563eb;
  font-size: 0.7rem;
  text-decoration: none;
  padding: 2px 7px;
}

.chk-cell-actions {
  text-align: right;
}

.chk-actions-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.chk-btn-pay,
.chk-btn-remind,
.chk-btn-receipt,
.chk-btn-details {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-weight: 700;
}

/* ==========================================================================
   MOBILE STACKED STUDENT CARD TRANSFORMATION (NO HORIZONTAL SCROLL < 46rem)
   ========================================================================== */
@container checklist-table (inline-size < 46rem) {
  .chk-table-wrapper {
    overflow-x: visible;
    padding: 12px;
    background: var(--bg-app);
  }

  .chk-table,
  .chk-table tbody {
    display: block;
    width: 100%;
  }

  /* MANDATORY per responsive-table: hide column headers cleanly */
  .chk-table thead {
    display: none;
  }

  .chk-table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .chk-table tbody tr.chk-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    background: #ffffff;
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
  }

  .chk-table tbody tr.chk-row[data-status="paid"] { border-left-color: var(--success); }
  .chk-table tbody tr.chk-row[data-status="partial"] { border-left-color: var(--warning); }
  .chk-table tbody tr.chk-row[data-status="overdue"] { border-left-color: var(--danger); }
  .chk-table tbody tr.chk-row[data-status="pending"] { border-left-color: #94a3b8; }

  .chk-table tbody tr.chk-empty-row,
  .chk-table tbody tr.chk-empty-row td {
    display: block;
    width: 100%;
    border: none;
    background: #ffffff;
    border-radius: var(--radius-lg);
  }

  /* Row 1: Full-width Student Header (not horizontally sticky) */
  .chk-table tbody th.chk-cell-student {
    grid-column: 1 / -1;
    position: static;
    background: #ffffff;
    padding: 13px 14px 10px 14px;
    border-bottom: 1px solid var(--border);
  }

  /* Row 2: 3-Column Financial Metric Strip (Fee / Paid / Balance) */
  .chk-table tbody td.chk-cell-fee,
  .chk-table tbody td.chk-cell-paid,
  .chk-table tbody td.chk-cell-balance {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    text-align: left;
  }

  .chk-table tbody td.chk-cell-balance {
    border-right: none;
  }

  .chk-table tbody td.chk-cell-fee::before {
    content: var(--label-fee);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
  }

  .chk-table tbody td.chk-cell-paid::before {
    content: var(--label-paid);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
  }

  .chk-table tbody td.chk-cell-balance::before {
    content: var(--label-balance);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
  }

  .chk-table tbody td.chk-cell-fee .chk-money,
  .chk-table tbody td.chk-cell-paid .chk-money,
  .chk-table tbody td.chk-cell-balance .chk-money {
    font-size: 0.9rem;
  }

  /* Row 3: Method (2 cols) + Status Badge (1 col, right-aligned) */
  .chk-table tbody td.chk-cell-method {
    grid-column: 1 / 3;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
  }

  .chk-table tbody td.chk-cell-method::before {
    content: var(--label-method) ":";
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
  }

  .chk-table tbody td.chk-cell-status {
    grid-column: 3 / 4;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 14px 10px 6px;
    border-bottom: 1px solid var(--border);
  }

  .chk-table.roster-only tbody td.chk-cell-status {
    grid-column: 1 / -1;
    justify-content: space-between;
    padding: 10px 14px;
  }

  .chk-table.roster-only tbody td.chk-cell-status::before {
    content: var(--label-status) ":";
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
  }

  /* Row 4: Full-Width Thumb-Friendly Action Bar */
  .chk-table tbody td.chk-cell-actions {
    grid-column: 1 / -1;
    display: block;
    padding: 10px 12px 12px 12px;
    border-bottom: none;
    text-align: left;
  }

  .chk-actions-group {
    display: flex;
    width: 100%;
    gap: 8px;
  }

  .chk-actions-group > * {
    flex: 1 1 0;
    min-block-size: 42px;
    font-size: 0.84rem;
    padding: 8px 10px;
  }
}

/* Coarse-pointer 44px touch targets */
@media (pointer: coarse) {
  .chk-grade-pill,
  .chk-group-remind-btn,
  .chk-actions-group > *,
  .chk-search-form .form-input,
  .chk-search-form .form-select,
  .chk-search-actions .btn {
    min-block-size: 44px;
  }
}


/* ==========================================================================
   CHECKLIST RECORD BUTTON & TRANSACTION HISTORY ZERO-SCROLL MOBILE CARDS
   ========================================================================== */

@media (max-width: 640px) {
  .chk-record-pay-btn {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
  }
}

.tx-root {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.tx-btn-checklist,
.tx-btn-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

@media (max-width: 640px) {
  .tx-header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .tx-btn-checklist,
  .tx-btn-export {
    width: 100%;
    justify-content: center;
  }
}

.tx-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tx-search-input-wrap {
  flex: 1 1 220px;
  min-inline-size: 0;
}

.tx-filter-selects {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 8px;
  flex: 2 1 390px;
}

@media (max-width: 768px) {
  .tx-filter-selects {
    grid-template-columns: 1fr;
    width: 100%;
    flex: 1 1 100%;
  }
}

.tx-table-wrapper {
  container: tx-table / inline-size;
  overflow-x: auto;
  max-inline-size: 100%;
}

.tx-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  --label-date: "Paid At";
  --label-period: "Period";
  --label-amount: "Amount";
  --label-method: "Channel";
  --label-recorder: "Recorded By";
}

.tx-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
}

.tx-table tbody th.tx-cell-student {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: #ffffff;
  text-align: left;
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.tx-ref-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: monospace;
}

.tx-cell-actions {
  text-align: right;
}

@container tx-table (inline-size < 46rem) {
  .tx-table-wrapper {
    overflow-x: visible;
    padding: 12px;
    background: var(--bg-app);
  }

  .tx-table,
  .tx-table tbody {
    display: block;
    width: 100%;
  }

  .tx-table thead {
    display: none;
  }

  .tx-table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .tx-table tbody tr.tx-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    background: #ffffff;
    border: 1px solid var(--border);
    border-left: 4px solid var(--success);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
  }

  .tx-table tbody th.tx-cell-student {
    grid-column: 1 / -1;
    position: static;
    padding: 13px 14px 10px 14px;
    border-bottom: 1px solid var(--border);
  }

  .tx-table tbody td.tx-cell-amount,
  .tx-table tbody td.tx-cell-period {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
  }

  .tx-table tbody td.tx-cell-amount {
    border-right: 1px solid var(--border);
    order: 1;
  }

  .tx-table tbody td.tx-cell-period {
    order: 2;
  }

  .tx-table tbody td.tx-cell-amount::before {
    content: var(--label-amount);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .tx-table tbody td.tx-cell-period::before {
    content: var(--label-period);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .tx-table tbody td.tx-cell-date,
  .tx-table tbody td.tx-cell-recorder {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    order: 3;
  }

  .tx-table tbody td.tx-cell-date {
    border-right: 1px solid var(--border);
  }

  .tx-table tbody td.tx-cell-date::before {
    content: var(--label-date);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .tx-table tbody td.tx-cell-recorder::before {
    content: var(--label-recorder);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .tx-table tbody td.tx-cell-grade {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    order: 4;
  }

  .tx-table tbody td.tx-cell-method {
    grid-column: 1 / 2;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 10px 6px 12px 14px;
    border-bottom: none;
    order: 5;
  }

  .tx-table tbody td.tx-cell-method::before {
    content: var(--label-method) ":";
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .tx-table tbody td.tx-cell-actions {
    grid-column: 2 / 3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 14px 12px 6px;
    border-bottom: none;
    text-align: right;
    order: 5;
  }

  .tx-table tbody td.tx-cell-actions .chk-actions-group {
    display: inline-flex;
    width: auto;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
  }

  .tx-table tbody td.tx-cell-actions .chk-actions-group > * {
    flex: 0 0 auto;
    padding: 6px 10px;
    font-size: 0.78rem;
  }
}

@media (pointer: coarse) {
  .chk-record-pay-btn,
  .tx-btn-checklist,
  .tx-btn-export,
  .tx-filter-form .form-input,
  .tx-filter-form .form-select {
    min-block-size: 44px;
  }
}


/* ==========================================================================
   UNIVERSAL ZERO-SCROLL MOBILE CARDS FOR ALL 6 REMAINING TABLE MODULES
   (Subjects, Students, Student Fee History, Users, Teacher Roster, Attendance Web)
   ========================================================================== */

.rt-wrapper {
  container: rt-table / inline-size;
  overflow-x: auto;
  max-inline-size: 100%;
}

.rt-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.rt-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
}

.rt-table tbody th[scope="row"] {
  background: #ffffff;
  text-align: left;
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.rt-actions-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.att-radio-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.att-radio-pill {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  user-select: none;
}

.att-mobile-bulk-bar {
  display: none;
}

/* Mobile Stacked Card Layout below 46rem */
@container rt-table (inline-size < 46rem) {
  .rt-wrapper {
    overflow-x: visible;
    padding: 12px;
    background: var(--bg-app);
  }

  .rt-table,
  .rt-table tbody {
    display: block;
    width: 100%;
  }

  .rt-table thead {
    display: none;
  }

  .rt-table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .rt-table tbody tr.rt-empty-row,
  .rt-table tbody tr.rt-empty-row td {
    display: block;
    width: 100%;
    border: none;
    background: #ffffff;
    border-radius: var(--radius-lg);
  }

  .rt-table tbody tr.rt-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    background: #ffffff;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
  }

  .rt-table tbody tr.rt-row[data-status="active"],
  .rt-table tbody tr.rt-row[data-status="paid"] { border-left-color: var(--success); }
  .rt-table tbody tr.rt-row[data-status="partial"] { border-left-color: var(--warning); }
  .rt-table tbody tr.rt-row[data-status="inactive"],
  .rt-table tbody tr.rt-row[data-status="overdue"] { border-left-color: var(--danger); }
  .rt-table tbody tr.rt-row[data-status="pending"] { border-left-color: #94a3b8; }

  .rt-table tbody th[scope="row"] {
    grid-column: 1 / -1;
    position: static;
    padding: 13px 14px 10px 14px;
    border-bottom: 1px solid var(--border);
    order: 0;
  }

  .rt-table tbody td {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    min-inline-size: 0;
    text-align: left !important;
  }

  /* ── 1. SUBJECT MANAGEMENT (.rt-subjects) ── */
  .rt-subjects {
    --label-level: "Level & Grade";
    --label-fee: "Monthly Fee";
    --label-teacher: "Assigned Teacher";
    --label-enrolled: "Enrolled";
  }

  .rt-subjects tbody td.sub-cell-level {
    order: 1;
    background: #f8fafc;
    border-right: 1px solid var(--border);
  }
  .rt-subjects tbody td.sub-cell-level::before { content: var(--label-level); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-subjects tbody td.sub-cell-fee {
    order: 2;
    background: #f8fafc;
  }
  .rt-subjects tbody td.sub-cell-fee::before { content: var(--label-fee); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-subjects tbody td.sub-cell-teacher {
    order: 3;
    border-right: 1px solid var(--border);
  }
  .rt-subjects tbody td.sub-cell-teacher::before { content: var(--label-teacher); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-subjects tbody td.sub-cell-enrolled {
    order: 4;
    align-items: flex-start;
  }
  .rt-subjects tbody td.sub-cell-enrolled::before { content: var(--label-enrolled); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-subjects tbody td.sub-cell-actions {
    grid-column: 1 / -1;
    order: 5;
    flex-direction: row;
    justify-content: flex-end;
    border-bottom: none;
    padding: 10px 12px 12px 12px;
  }

  /* ── 2. STUDENTS DIRECTORY (.rt-students) ── */
  .rt-students {
    --label-grade: "Level & Grade";
    --label-fee: "Monthly Fee";
    --label-subjects: "Enrolled Subjects";
    --label-guardian: "Guardian & Contact";
    --label-status: "Status";
  }

  .rt-students tbody td.stu-cell-grade {
    order: 1;
    background: #f8fafc;
    border-right: 1px solid var(--border);
  }
  .rt-students tbody td.stu-cell-grade::before { content: var(--label-grade); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-students tbody td.stu-cell-fee {
    order: 2;
    background: #f8fafc;
  }
  .rt-students tbody td.stu-cell-fee::before { content: var(--label-fee); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-students.no-fees tbody td.stu-cell-grade {
    grid-column: 1 / -1;
    border-right: none;
  }

  .rt-students tbody td.stu-cell-subjects {
    grid-column: 1 / -1;
    order: 3;
  }
  .rt-students tbody td.stu-cell-subjects::before { content: var(--label-subjects); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-students tbody td.stu-cell-guardian {
    order: 4;
    border-right: 1px solid var(--border);
  }
  .rt-students tbody td.stu-cell-guardian::before { content: var(--label-guardian); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-students tbody td.stu-cell-status {
    order: 5;
    align-items: flex-start;
  }
  .rt-students tbody td.stu-cell-status::before { content: var(--label-status); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-students tbody td.stu-cell-actions {
    grid-column: 1 / -1;
    order: 6;
    border-bottom: none;
    padding: 10px 12px 12px 12px;
  }

  /* ── 3. STUDENT PROFILE FEE HISTORY (.rt-student-fees) ── */
  .rt-student-fees {
    --label-fee: "Fee";
    --label-paid: "Paid";
    --label-balance: "Balance";
    --label-method: "Method";
  }

  .rt-student-fees tbody tr.rt-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .rt-student-fees tbody td.sf-cell-fee,
  .rt-student-fees tbody td.sf-cell-paid,
  .rt-student-fees tbody td.sf-cell-balance {
    background: #f8fafc;
    border-right: 1px solid var(--border);
    padding: 10px 12px;
    order: 1;
  }
  .rt-student-fees tbody td.sf-cell-balance { border-right: none; }
  .rt-student-fees tbody td.sf-cell-fee::before { content: var(--label-fee); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
  .rt-student-fees tbody td.sf-cell-paid::before { content: var(--label-paid); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
  .rt-student-fees tbody td.sf-cell-balance::before { content: var(--label-balance); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-student-fees tbody td.sf-cell-method {
    grid-column: 1 / 3;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    order: 2;
  }
  .rt-student-fees tbody td.sf-cell-method::before { content: var(--label-method) ":"; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-student-fees tbody td.sf-cell-status {
    grid-column: 3 / 4;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    order: 3;
  }

  .rt-student-fees tbody td.sf-cell-actions {
    grid-column: 1 / -1;
    order: 4;
    border-bottom: none;
    padding: 10px 12px 12px 12px;
  }

  /* ── 4. USER MANAGEMENT (.rt-users) ── */
  .rt-users {
    --label-username: "Username";
    --label-role: "Role";
    --label-email: "Email";
    --label-status: "Status";
    --label-pwd: "Password";
  }

  .rt-users tbody td.usr-cell-username {
    order: 1;
    background: #f8fafc;
    border-right: 1px solid var(--border);
  }
  .rt-users tbody td.usr-cell-username::before { content: var(--label-username); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-users tbody td.usr-cell-role {
    order: 2;
    background: #f8fafc;
    align-items: flex-start;
  }
  .rt-users tbody td.usr-cell-role::before { content: var(--label-role); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-users tbody td.usr-cell-email {
    grid-column: 1 / -1;
    order: 3;
  }
  .rt-users tbody td.usr-cell-email::before { content: var(--label-email); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-users tbody td.usr-cell-status {
    order: 4;
    border-right: 1px solid var(--border);
    align-items: flex-start;
  }
  .rt-users tbody td.usr-cell-status::before { content: var(--label-status); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-users tbody td.usr-cell-pwd {
    order: 5;
    align-items: flex-start;
  }
  .rt-users tbody td.usr-cell-pwd::before { content: var(--label-pwd); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-users tbody td.usr-cell-actions {
    grid-column: 1 / -1;
    order: 6;
    border-bottom: none;
    padding: 10px 12px 12px 12px;
  }

  /* ── 5. TEACHER ENROLLED ROSTER (.rt-teacher-roster) ── */
  .rt-teacher-roster {
    --label-grade: "Grade";
    --label-fee: "Monthly Fee";
    --label-subjects: "Enrolled Subjects";
    --label-guardian: "Guardian";
    --label-status: "Fee Status";
  }

  .rt-teacher-roster tbody td.tr-cell-grade {
    order: 1;
    background: #f8fafc;
    border-right: 1px solid var(--border);
    align-items: flex-start;
  }
  .rt-teacher-roster tbody td.tr-cell-grade::before { content: var(--label-grade); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-teacher-roster tbody td.tr-cell-fee {
    order: 2;
    background: #f8fafc;
  }
  .rt-teacher-roster tbody td.tr-cell-fee::before { content: var(--label-fee); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-teacher-roster.no-fees tbody td.tr-cell-grade {
    grid-column: 1 / -1;
    border-right: none;
  }

  .rt-teacher-roster tbody td.tr-cell-subjects {
    grid-column: 1 / -1;
    order: 3;
  }
  .rt-teacher-roster tbody td.tr-cell-subjects::before { content: var(--label-subjects); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-teacher-roster tbody td.tr-cell-guardian {
    order: 4;
    border-right: 1px solid var(--border);
  }
  .rt-teacher-roster tbody td.tr-cell-guardian::before { content: var(--label-guardian); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-teacher-roster.no-fees tbody td.tr-cell-guardian {
    grid-column: 1 / -1;
    border-right: none;
  }

  .rt-teacher-roster tbody td.tr-cell-status {
    order: 5;
    align-items: flex-start;
  }
  .rt-teacher-roster tbody td.tr-cell-status::before { content: var(--label-status); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

  .rt-teacher-roster tbody td.tr-cell-actions {
    grid-column: 1 / -1;
    order: 6;
    border-bottom: none;
    padding: 10px 12px 12px 12px;
  }

  /* ── 6. ATTENDANCE WEB MODE (.rt-att-web) ── */
  .rt-att-web tbody tr.att-web-row {
    grid-template-columns: auto 1fr;
    border-left-color: var(--primary);
  }

  .rt-att-web tbody td.att-cell-no {
    grid-column: 1 / 2;
    order: 0;
    padding: 13px 0 10px 14px !important;
    border-bottom: 1px solid var(--border);
    justify-content: center;
    font-size: 0.84rem;
  }

  .rt-att-web tbody th.att-cell-name {
    grid-column: 2 / 3;
    order: 0;
    padding: 12px 14px 10px 10px !important;
    border-bottom: 1px solid var(--border);
  }

  .rt-att-web tbody td.att-cell-status {
    grid-column: 1 / -1;
    order: 1;
    padding: 10px 14px !important;
    background: #f8fafc;
  }

  .rt-att-web .att-radio-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
  }

  .rt-att-web .att-radio-pill {
    min-block-size: 44px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    background: #ffffff;
  }

  .rt-att-web .att-radio-absent:has(input:checked) {
    background: #fff1f2;
    border-color: #fda4af;
  }

  .rt-att-web .att-radio-present:has(input:checked) {
    background: #f0fdf4;
    border-color: #86efac;
  }

  .rt-att-web tbody td.att-cell-remark {
    grid-column: 1 / -1;
    order: 2;
    padding: 10px 14px 12px 14px !important;
    border-bottom: none;
  }

  /* Full-width action bars on mobile cards */
  .rt-actions-group {
    display: flex;
    width: 100%;
    gap: 8px;
  }

  .rt-actions-group > a,
  .rt-actions-group > button,
  .rt-actions-group > form {
    flex: 1 1 auto;
    display: flex;
  }

  .rt-actions-group > a,
  .rt-actions-group > button,
  .rt-actions-group > form > button {
    width: 100%;
    justify-content: center;
    min-block-size: 40px;
  }
}

/* Show mobile Mark All Absent / Present bar on narrow screens */
@media (max-width: 767px) {
  .att-mobile-bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
  }
  .att-mobile-bulk-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
  }
  .att-mobile-bulk-btns {
    display: flex;
    gap: 8px;
  }
  .att-mobile-bulk-btns .btn {
    min-block-size: 38px;
  }
}

@media (pointer: coarse) {
  .rt-actions-group > a,
  .rt-actions-group > button,
  .rt-actions-group > form > button,
  .att-mobile-bulk-btns .btn {
    min-block-size: 44px;
  }
}


/* ==========================================================================
   DARK / LIGHT MODE THEME SYSTEM (color-scheme + light-dark() + fallback)
   ========================================================================== */

:root {
  color-scheme: light dark;

  --surface-app-light: #f8fafc;
  --surface-app-dark: #0b1120;
  --surface-card-light: #ffffff;
  --surface-card-dark: #111827;
  --surface-subtle-light: #f8fafc;
  --surface-subtle-dark: #1e293b;
  --ink-main-light: #0f172a;
  --ink-main-dark: #f1f5f9;
  --ink-muted-light: #64748b;
  --ink-muted-dark: #94a3b8;
  --ink-light-light: #94a3b8;
  --ink-light-dark: #64748b;
  --line-light: #e2e8f0;
  --line-dark: #1f2937;
  --brand-light: #2563eb;
  --brand-dark: #60a5fa;
  --brand-tint-light: #eff6ff;
  --brand-tint-dark: rgba(37, 99, 235, 0.22);
  --brand-border-light: #bfdbfe;
  --brand-border-dark: rgba(96, 165, 250, 0.35);

  --bg-page: var(--surface-subtle-light);

  /* Fallback for browsers without light-dark() */
  @media (prefers-color-scheme: dark) {
    --bg-app: var(--surface-app-dark);
    --bg-card: var(--surface-card-dark);
    --bg-page: var(--surface-subtle-dark);
    --text-main: var(--ink-main-dark);
    --text-muted: var(--ink-muted-dark);
    --text-light: var(--ink-light-dark);
    --border: var(--line-dark);
    --primary: var(--brand-dark);
    --primary-light: var(--brand-tint-dark);
    --primary-border: var(--brand-border-dark);
  }

  /* Modern light-dark() adapts automatically to color-scheme override */
  @supports (color: light-dark(white, black)) {
    --bg-app: light-dark(var(--surface-app-light), var(--surface-app-dark));
    --bg-card: light-dark(var(--surface-card-light), var(--surface-card-dark));
    --bg-page: light-dark(var(--surface-subtle-light), var(--surface-subtle-dark));
    --text-main: light-dark(var(--ink-main-light), var(--ink-main-dark));
    --text-muted: light-dark(var(--ink-muted-light), var(--ink-muted-dark));
    --text-light: light-dark(var(--ink-light-light), var(--ink-light-dark));
    --border: light-dark(var(--line-light), var(--line-dark));
    --primary: light-dark(var(--brand-light), var(--brand-dark));
    --primary-light: light-dark(var(--brand-tint-light), var(--brand-tint-dark));
    --primary-border: light-dark(var(--brand-border-light), var(--brand-border-dark));
    --success-light: light-dark(#ecfdf5, rgba(5, 150, 105, 0.2));
    --warning-light: light-dark(#fffbeb, rgba(217, 119, 6, 0.2));
    --danger-light: light-dark(#fef2f2, rgba(220, 38, 38, 0.2));
    --info-light: light-dark(#f0f9ff, rgba(2, 132, 199, 0.2));
    --ewallet-light: light-dark(#f5f3ff, rgba(124, 58, 237, 0.2));
  }

  &:has(> head > meta[name="color-scheme"][content="dark"]) {
    color-scheme: dark;
  }

  &:has(> head > meta[name="color-scheme"][content="light"]) {
    color-scheme: light;
  }
}

/* Theme Toggle Icon Branching (CSS-only, accessible without JS) */
.theme-toggle-btn .theme-option-dark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle-btn .theme-option-light {
  display: none;
  align-items: center;
  justify-content: center;
  color: #fbbf24;
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-toggle-btn .theme-option-dark {
  display: none;
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-toggle-btn .theme-option-light {
  display: inline-flex;
}

@media (prefers-color-scheme: dark) {
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-toggle-btn .theme-option-dark {
    display: none;
  }
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-toggle-btn .theme-option-light {
    display: inline-flex;
  }
}

/* Dark-Mode Surface & Control Overrides (for existing hardcoded #ffffff / #f8fafc surfaces) */
:root:has(> head > meta[name="color-scheme"][content="dark"]) .app-header,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .bottom-nav,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .card,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .stat-card,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .dash-kpi-card,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .dash-mobile-fee-row,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .btn-icon-badge,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .user-profile-btn,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .user-dropdown-menu,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .modal-content,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .toast,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .custom-modal-dialog,
:root:has(> head > meta[name="color-scheme"][content="dark"]) #clear-notifications-dialog,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .profile-accordion-header,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .profile-accordion-body,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .chk-table tbody th.chk-cell-student,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .tx-table tbody th.tx-cell-student,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .rt-table tbody th[scope="row"],
:root:has(> head > meta[name="color-scheme"][content="dark"]) .chk-table tbody tr.chk-row,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .tx-table tbody tr.tx-row,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .rt-table tbody tr.rt-row,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .chk-grade-pill,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .filter-chip:not(.active),
:root:has(> head > meta[name="color-scheme"][content="dark"]) .payment-channel-card,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .btn-outline {
  background-color: var(--bg-card) !important;
  color: var(--text-main);
  border-color: var(--border);
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) .card-header,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .card-footer,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .custom-modal-header,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .custom-modal-footer,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .data-table thead th,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .form-input,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .form-select,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .form-textarea,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .form-control,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .dash-period-select,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .chk-table tbody td.chk-cell-fee,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .chk-table tbody td.chk-cell-paid,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .chk-table tbody td.chk-cell-balance,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .tx-table tbody td.tx-cell-amount,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .tx-table tbody td.tx-cell-period,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .rt-table tbody td.sub-cell-level,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .rt-table tbody td.sub-cell-fee,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .rt-table tbody td.stu-cell-grade,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .rt-table tbody td.stu-cell-fee,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .rt-table tbody td.sf-cell-fee,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .rt-table tbody td.sf-cell-paid,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .rt-table tbody td.sf-cell-balance,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .rt-table tbody td.usr-cell-username,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .rt-table tbody td.usr-cell-role,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .rt-table tbody td.tr-cell-grade,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .rt-table tbody td.tr-cell-fee,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .rt-att-web tbody td.att-cell-status,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .att-mobile-bulk-bar {
  background-color: var(--bg-page) !important;
  color: var(--text-main);
  border-color: var(--border);
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) .badge-dot {
  box-shadow: 0 0 0 2px var(--bg-card);
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) .dash-grade-tile.is-empty {
  background-color: var(--bg-page);
  border-color: var(--border);
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) .dash-tile-sky {
  background-color: rgba(2, 132, 199, 0.16);
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) .dash-tile-purple {
  background-color: rgba(124, 58, 237, 0.18);
  border-color: rgba(167, 139, 250, 0.35);
  color: #c4b5fd;
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) .dash-progress-track,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .dash-mix-bar {
  background-color: #1e293b;
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) .rt-att-web .att-radio-pill {
  background-color: var(--bg-card);
  border-color: var(--border);
}

@media (prefers-color-scheme: dark) {
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .app-header,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .bottom-nav,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .card,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .stat-card,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .dash-kpi-card,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .dash-mobile-fee-row,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .btn-icon-badge,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .user-profile-btn,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .user-dropdown-menu,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .modal-content,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .toast,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .custom-modal-dialog,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) #clear-notifications-dialog,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .profile-accordion-header,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .profile-accordion-body,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .chk-table tbody th.chk-cell-student,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .tx-table tbody th.tx-cell-student,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .rt-table tbody th[scope="row"],
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .chk-table tbody tr.chk-row,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .tx-table tbody tr.tx-row,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .rt-table tbody tr.rt-row,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .chk-grade-pill,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .filter-chip:not(.active),
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .payment-channel-card,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .btn-outline {
    background-color: var(--bg-card) !important;
    color: var(--text-main);
    border-color: var(--border);
  }

  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .card-header,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .card-footer,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .custom-modal-header,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .custom-modal-footer,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .data-table thead th,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .form-input,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .form-select,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .form-textarea,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .form-control,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .dash-period-select,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .chk-table tbody td.chk-cell-fee,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .chk-table tbody td.chk-cell-paid,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .chk-table tbody td.chk-cell-balance,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .tx-table tbody td.tx-cell-amount,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .tx-table tbody td.tx-cell-period,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .rt-table tbody td.sub-cell-level,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .rt-table tbody td.sub-cell-fee,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .rt-table tbody td.stu-cell-grade,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .rt-table tbody td.stu-cell-fee,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .rt-table tbody td.sf-cell-fee,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .rt-table tbody td.sf-cell-paid,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .rt-table tbody td.sf-cell-balance,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .rt-table tbody td.usr-cell-username,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .rt-table tbody td.usr-cell-role,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .rt-table tbody td.tr-cell-grade,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .rt-table tbody td.tr-cell-fee,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .rt-att-web tbody td.att-cell-status,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .att-mobile-bulk-bar {
    background-color: var(--bg-page) !important;
    color: var(--text-main);
    border-color: var(--border);
  }

  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .badge-dot {
    box-shadow: 0 0 0 2px var(--bg-card);
  }

  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .dash-grade-tile.is-empty {
    background-color: var(--bg-page);
    border-color: var(--border);
  }

  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .dash-tile-sky {
    background-color: rgba(2, 132, 199, 0.16);
    border-color: rgba(56, 189, 248, 0.35);
    color: #7dd3fc;
  }

  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .dash-tile-purple {
    background-color: rgba(124, 58, 237, 0.18);
    border-color: rgba(167, 139, 250, 0.35);
    color: #c4b5fd;
  }

  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .dash-progress-track,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .dash-mix-bar {
    background-color: #1e293b;
  }

  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .rt-att-web .att-radio-pill {
    background-color: var(--bg-card);
    border-color: var(--border);
  }
}


/* ==========================================================================
   RESPONSIVE FORM GRIDS, COMPACT PHONE INPUTS & PRINTING FEE ALIGNMENT
   ========================================================================== */

.student-form-card-body {
  padding: 16px;
}

@media (min-width: 640px) {
  .student-form-card-body {
    padding: 28px;
  }
}

.student-form-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 640px) {
  .student-form-grid-2 {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

.student-form-grid-2 .form-group {
  margin-bottom: 0;
  min-width: 0;
}

/* Compact Country Code + Full-Width Phone Input */
.phone-input-group {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.phone-code-select {
  width: 84px;
  min-width: 84px;
  max-width: 84px;
  flex: 0 0 84px;
  padding: 8px 10px;
  font-weight: 700;
  color: var(--text-main);
}

.phone-number-input {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* Curriculum & Printing Fee Container */
.student-curriculum-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 20px;
  background: var(--bg-card);
}

@media (min-width: 640px) {
  .student-curriculum-section {
    padding: 18px;
  }
}

.printing-fee-box {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 18px;
}

.printing-fee-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-bottom: 10px;
}

.printing-fee-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 3px 9px;
  border-radius: 6px;
}

.printing-fee-schedule {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 600;
}

.printing-fee-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 640px) {
  .printing-fee-body {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }
}

.printing-fee-desc {
  flex: 1;
  min-width: 0;
}

.printing-fee-amount-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: var(--bg-card);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

@media (min-width: 640px) {
  .printing-fee-amount-wrap {
    width: auto;
    flex-shrink: 0;
  }
}

.printing-fee-currency {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.printing-fee-input {
  flex: 1 1 0%;
  min-width: 0;
  height: 36px;
  padding: 4px 10px;
  font-weight: 700;
  font-size: 0.94rem;
  text-align: right;
}

@media (min-width: 640px) {
  .printing-fee-input {
    width: 100px;
    flex: 0 0 100px;
  }
}

.subjects-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.subjects-section-title-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.subjects-section-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-page);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 6px;
}

.subject-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding: 2px;
}

.subject-card-option {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  background: var(--bg-card);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.subject-card-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.calculated-fee-bar {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}


/* ==========================================================================
   HCI FORM SECTIONS (STUDENT vs GUARDIAN CLEAR VISUAL SEPARATION)
   ========================================================================== */

.hci-form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  margin-bottom: 20px;
  overflow: hidden;
}

.hci-form-section.hci-section-student {
  border-top: 3px solid var(--primary);
}

.hci-form-section.hci-section-guardian {
  border-top: 3px solid #059669;
}

.hci-form-section.hci-section-fees {
  border-top: 3px solid #6366f1;
}

.hci-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border);
}

@media (min-width: 640px) {
  .hci-section-header {
    padding: 16px 20px;
  }
}

.hci-section-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.hci-section-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hci-section-icon.icon-student {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
}

.hci-section-icon.icon-guardian {
  background: rgba(5, 150, 105, 0.12);
  color: #10b981;
}

.hci-section-icon.icon-fees {
  background: rgba(99, 102, 241, 0.12);
  color: #6366f1;
}

.hci-section-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
}

.hci-section-subtitle {
  margin: 2px 0 0 0;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.hci-section-tag {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.hci-section-tag.tag-student {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
}

.hci-section-tag.tag-guardian {
  background: rgba(5, 150, 105, 0.12);
  color: #10b981;
}

.hci-section-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 640px) {
  .hci-section-body {
    padding: 20px;
  }
}

.hci-section-body .form-group {
  margin-bottom: 0;
}

.form-label-optional {
  font-weight: 500;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-left: 4px;
}

/* Student Profile Show Page: Dual Contact Panels */
.hci-contact-panels {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 768px) {
  .hci-contact-panels {
    grid-template-columns: 1fr 1.4fr;
    gap: 16px;
  }
}

.hci-contact-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-page);
  padding: 14px 16px;
}

.hci-contact-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.hci-contact-panel-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-main);
}

.hci-contact-kv-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 480px) {
  .hci-contact-panel.panel-guardian .hci-contact-kv-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}


/* ==========================================================================
   2-SECOND PRESS-AND-HOLD ACCOUNT STATUS BUTTON (INSTANT DB SAVE)
   ========================================================================== */

.status-hold-btn {
  position: relative;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: inherit;
  font-weight: 700;
  color: #ffffff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  transition: transform 0.12s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.status-hold-btn.is-active {
  background: #16a34a;
  border-color: #15803d;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
}

.status-hold-btn.is-inactive {
  background: #dc2626;
  border-color: #b91c1c;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

.status-hold-btn.is-holding {
  transform: scale(0.985);
}

.status-hold-btn:disabled {
  opacity: 0.78;
  cursor: wait;
}

.status-hold-progress {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  pointer-events: none;
  z-index: 1;
}

.status-hold-btn.is-active .status-hold-progress {
  background: rgba(220, 38, 38, 0.92);
}

.status-hold-btn.is-inactive .status-hold-progress {
  background: rgba(22, 163, 74, 0.92);
}

.status-hold-btn.is-holding .status-hold-progress {
  width: 100%;
  transition: width 2s linear;
}

.status-hold-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.status-hold-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 800;
}

.status-hold-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.28);
  flex-shrink: 0;
}

.status-hold-hint {
  font-size: 0.74rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(0, 0, 0, 0.16);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}


/* ==========================================================================
   STUDENTS DIRECTORY OVERHAULED FILTER BAR (MULTI-GRADE DROPDOWNS)
   ========================================================================== */

.stu-filter-card {
  margin-bottom: 20px;
  overflow: visible;
}

.stu-filter-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (min-width: 640px) {
  .stu-filter-body {
    padding: 18px 20px;
  }
}

.stu-search-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 768px) {
  .stu-search-form {
    grid-template-columns: minmax(220px, 1.4fr) minmax(200px, 1fr) auto;
    align-items: center;
  }
}

.stu-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.stu-search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
  display: inline-flex;
}

.stu-search-input-wrap .form-input {
  padding-left: 38px;
}

.stu-search-actions {
  display: flex;
  gap: 8px;
}

.stu-search-actions .btn {
  flex: 1;
  justify-content: center;
}

@media (min-width: 768px) {
  .stu-search-actions .btn {
    flex: 0 0 auto;
  }
}

/* Education Level Grid:
   Mobile: Row 1 = All Levels | Pre-School (2 cols)
           Row 2 = Primary School (full line, own aligned row)
           Row 3 = Secondary School (full line, own aligned row)
   Desktop: Clean 4-item inline flex bar */
.stu-level-bar {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (min-width: 900px) {
  .stu-level-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
}

.stu-level-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.stu-level-pill:hover {
  border-color: var(--primary);
}

.stu-level-pill.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.stu-level-pill.is-active.is-preschool {
  background: #db2777;
  border-color: #db2777;
  color: #ffffff;
}

.stu-level-count {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-page);
  color: var(--text-muted);
}

.stu-level-pill.is-active .stu-level-count,
.stu-split-dropdown.is-active .stu-level-count {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

/* Split Dropdown Container for Primary & Secondary (Full Separate Rows on Mobile) */
.stu-split-dropdown {
  grid-column: 1 / -1;
  position: relative;
}

@media (min-width: 900px) {
  .stu-split-dropdown {
    grid-column: auto;
  }
}

.stu-split-control {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.stu-split-dropdown.is-primary .stu-split-control:hover,
.stu-split-dropdown.is-primary.is-open .stu-split-control {
  border-color: #0284c7;
}

.stu-split-dropdown.is-secondary .stu-split-control:hover,
.stu-split-dropdown.is-secondary.is-open .stu-split-control {
  border-color: #7c3aed;
}

.stu-split-dropdown.is-active.is-primary .stu-split-control {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
}

.stu-split-dropdown.is-active.is-secondary .stu-split-control {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #ffffff;
}

.stu-split-main {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: inherit;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 700;
  min-width: 0;
}

.stu-split-main-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stu-split-dropdown.is-primary:not(.is-active) .stu-split-main-icon {
  color: #0284c7;
}

.stu-split-dropdown.is-secondary:not(.is-active) .stu-split-main-icon {
  color: #7c3aed;
}

.stu-split-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border: none;
  border-left: 1px solid var(--border);
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.stu-split-dropdown.is-active .stu-split-trigger {
  border-left-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.stu-split-trigger:hover {
  background: rgba(15, 23, 42, 0.04);
}

.stu-split-dropdown.is-active .stu-split-trigger:hover {
  background: rgba(255, 255, 255, 0.12);
}

.stu-split-chevron {
  transition: transform 0.2s ease;
}

.stu-split-dropdown.is-open .stu-split-chevron {
  transform: rotate(180deg);
}

/* Dropdown Panel: Inline Accordion on Mobile (< 900px), Floating Popover on Desktop */
.stu-dropdown-menu {
  display: none;
  margin-top: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 12px;
  z-index: 40;
}

.stu-split-dropdown.is-open .stu-dropdown-menu {
  display: block;
}

@media (min-width: 900px) {
  .stu-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    margin-top: 0;
    width: 300px;
    box-shadow: var(--shadow-float);
  }
}

.stu-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.stu-dropdown-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.stu-dropdown-showall {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.stu-dropdown-showall:hover {
  text-decoration: underline;
}

.stu-grade-check-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stu-grade-check-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.stu-grade-check-item:has(input:checked) {
  border-color: #0284c7;
  background: rgba(2, 132, 199, 0.1);
  color: #0284c7;
}

.stu-split-dropdown.is-secondary .stu-grade-check-item:has(input:checked) {
  border-color: #7c3aed;
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
}

.stu-grade-check-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.stu-grade-check-left input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #0284c7;
  cursor: pointer;
}

.stu-split-dropdown.is-secondary .stu-grade-check-left input[type="checkbox"] {
  accent-color: #7c3aed;
}

.stu-grade-mini-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.stu-dropdown-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* Active Selected Grade Chips Strip */
.stu-active-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 4px;
}

.stu-active-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  text-decoration: none;
}

.stu-active-chip:hover {
  opacity: 0.85;
}

/* Level Badges in Students Table */
.stu-level-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
}

.stu-level-badge.badge-preschool {
  background: rgba(219, 39, 119, 0.1);
  color: #db2777;
  border: 1px solid rgba(219, 39, 119, 0.28);
}

.stu-level-badge.badge-primary {
  background: rgba(2, 132, 199, 0.1);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.28);
}

.stu-level-badge.badge-secondary {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
  border: 1px solid rgba(124, 58, 237, 0.28);
}
