/* ----------------------------------------------------
 * DESIGN SYSTEM & ROOT VARIABLES (AL-KARIMAH PREMIUM)
 * ---------------------------------------------------- */
:root {
  /* Colors - Ultra Premium Emerald & Warm Golden Amber */
  --primary: #059669;          /* Emerald 600 */
  --primary-dark: #047857;     /* Emerald 700 */
  --primary-deep: #022c22;     /* Deep forest green */
  --primary-light: #ecfdf5;    /* Emerald 50 */
  --primary-gradient: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
  
  --accent: #f59e0b;           /* Amber 500 */
  --accent-dark: #d97706;      /* Amber 600 */
  --accent-light: #fef3c7;     /* Amber 100 */
  --accent-gradient: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  
  --bg-app: #f6f2ea;           /* Soft elegant warm cream/linen — extremely easy on eyes */
  --bg-card: #ffffff;
  --bg-card-glass: rgba(255, 255, 255, 0.85);
  --bg-navbar-glass: rgba(246, 242, 234, 0.72);
  --bg-sidebar: #022c22;       /* Premium Deep Forest Green */
  --bg-hover: rgba(5, 150, 105, 0.04); /* Ultra-soft emerald hover */
  
  --text-main: #0f172a;        /* Slate 900 */
  --text-muted: #64748b;       /* Slate 500 — balanced readability */
  --text-light: #f8fafc;
  
  --border: rgba(15, 23, 42, 0.06);  /* Transparent modern borders */
  --border-dark: #e2e8f0;      /* Slate 200 */
  --border-focus: #34d399;     /* Emerald 400 */
  --border-light: rgba(15, 23, 42, 0.03);
  
  /* Status Colors */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  /* Radius — Softer, more premium */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 28px;
  --radius-pill: 9999px;
  
  /* Shadows — Colored & Layered for depth */
  --shadow-sm: 0 1px 3px rgba(5, 150, 105, 0.03), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px -2px rgba(5, 150, 105, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 12px 40px -8px rgba(5, 150, 105, 0.1), 0 4px 12px -4px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 24px 50px -12px rgba(5, 150, 105, 0.15), 0 12px 24px -8px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 24px rgba(16, 185, 129, 0.2);
  --shadow-glow-accent: 0 0 24px rgba(245, 158, 11, 0.2);
  
  /* Transitions — Spring-like easing */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ----------------------------------------------------
 * BASE RESETS & SCROLLBAR
 * ---------------------------------------------------- */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Custom Scrollbar — Sleek & Minimal */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.25);
  border-radius: 100px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.45);
}

/* Fonts styling */
.font-amiri {
  font-family: 'Amiri', serif;
}

/* ----------------------------------------------------
 * APP LAYOUT STRUCTURE
 * ---------------------------------------------------- */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar Styling - Ultra Premium Dark Forest */
.sidebar {
  width: 264px;
  background-color: var(--bg-sidebar);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  left: 0;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(2, 44, 34, 0.35);
  transition: width 0.35s var(--transition-normal), transform 0.35s ease, min-width 0.35s ease, opacity 0.3s ease;
  background-image: linear-gradient(175deg, #0a1f1a 0%, #061210 40%, #030a08 100%);
  position: relative;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.03);
}

.sidebar.sidebar-manual-collapsed {
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  border: none !important;
}

.main-content {
  flex-grow: 1;
  width: 100%;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Glowing accent orb — sidebar decoration */
.sidebar::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, rgba(245, 158, 11, 0.04) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: sidebarOrbFloat 12s ease-in-out infinite;
}

.sidebar::after {
  content: '';
  position: absolute;
  bottom: -60px;
  left: -60px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

@keyframes sidebarOrbFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-12px, 16px); }
}

.sidebar-header {
  padding: 28px 22px 18px 22px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.logo-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-box i {
  font-size: 28px;
}

.app-logo-sidebar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  object-fit: cover;
  border: 2px solid rgba(245, 158, 11, 0.5);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.2), 0 0 0 4px rgba(245, 158, 11, 0.06);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.app-logo-sidebar:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.3), 0 0 0 6px rgba(245, 158, 11, 0.08);
}

.gold-text {
  color: var(--accent);
  filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.3));
}

.logo-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  font-family: 'Outfit', sans-serif;
  background: linear-gradient(135deg, #ffffff 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}

.logo-subtitle {
  font-size: 8.5px;
  color: #a7f3d0; /* emerald-200 */
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  margin: 0;
  opacity: 0.8;
  padding-left: 56px;
  margin-top: -4px;
  white-space: nowrap;
}

.sidebar-nav {
  flex-grow: 1;
  padding: 12px 14px;
  overflow-y: auto;
  position: relative;
  z-index: 1;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li {
  margin-bottom: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: rgba(148, 163, 184, 0.9);
  text-decoration: none;
  border-radius: 12px;
  font-weight: 500;
  font-size: 13.5px;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  border: 1px solid transparent;
  letter-spacing: 0.01em;
}

.nav-link i {
  font-size: 19px;
  transition: transform 0.25s ease, color 0.25s ease;
  color: rgba(100, 116, 139, 0.8);
  width: 22px;
  text-align: center;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.03);
  transform: translateX(2px);
}

.nav-link:hover i {
  color: var(--accent);
  transform: scale(1.08);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(6, 95, 70, 0.1) 100%);
  border: 1px solid rgba(16, 185, 129, 0.18);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.nav-link.active i {
  color: #fbbf24;
  filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.3));
}

/* Glowing accent bar inside active nav link */
.nav-link.active::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.18) 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.2s ease;
}

.user-profile-badge:hover {
  background: rgba(255, 255, 255, 0.06);
}

.badge-icon {
  width: 38px;
  height: 38px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  transition: all 0.25s ease;
}

.badge-icon.admin-active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.08));
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.25);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.1);
}

.badge-icon.teacher-active {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.15), rgba(52, 211, 153, 0.08));
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.25);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.1);
}

.badge-icon.caregiver-active {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.15), rgba(96, 165, 250, 0.08));
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.2);
  box-shadow: 0 0 12px rgba(96, 165, 250, 0.1);
}

.badge-info h4 {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-info p {
  font-size: 11px;
  color: #6ee7b7;
  font-weight: 500;
}

/* Main Content Area Styling */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  scroll-behavior: smooth !important;
  position: relative;
  /* Premium Islamic Geometric pattern with warm wash */
  background-color: var(--bg-app);
  background-image: 
    linear-gradient(rgba(246, 242, 234, 0.95) 0%, rgba(246, 242, 234, 0.97) 100%),
    url('bg_islamic.jpg');
  background-repeat: repeat;
  background-size: 360px;
  background-attachment: scroll;
}

.landing-body section {
  scroll-margin-top: 80px;
}

/* Top Navbar — Glassmorphism */
.top-navbar {
  background: var(--bg-navbar-glass);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  height: 68px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.mobile-toggle {
  display: block;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-main);
  cursor: pointer;
}

/* Back Navigation Button - Premium Styled */
.back-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary-light);
  border: 1px solid rgba(5, 150, 105, 0.2);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  padding: 7px 14px 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.back-nav-btn i {
  font-size: 20px;
  transition: transform 0.2s ease;
}

.back-nav-btn:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(5, 150, 105, 0.2);
}

.back-nav-btn:hover i {
  transform: translateX(-3px);
}

.back-nav-btn:active {
  transform: scale(0.96);
}

/* Dark mode overrides for back button */
body.dark-theme .back-nav-btn {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
}
body.dark-theme .back-nav-btn:hover {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.4);
}

.navbar-title h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -0.01em;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.date-display {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(241, 245, 249, 0.8);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(15, 23, 42, 0.04);
}

.date-display i {
  color: var(--primary);
  font-size: 15px;
}

.notification-bell {
  position: relative;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition-fast);
}

.notification-bell:hover {
  color: var(--primary);
}

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

/* Notification Dropdown */
.notification-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-top: 12px;
  overflow: hidden;
  z-index: 200;
}

.notification-dropdown.hidden {
  display: none;
}

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

.dropdown-header h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.dropdown-header button {
  background: none;
  border: none;
  font-size: 11px;
  color: var(--danger);
  cursor: pointer;
  font-weight: 500;
}

.notification-list {
  list-style: none;
  max-height: 250px;
  overflow-y: auto;
}

.notification-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  font-size: 12px;
  transition: background-color var(--transition-fast);
}

.notification-item:hover {
  background-color: #f1f5f9;
}

.notification-item i {
  font-size: 18px;
  margin-top: 2px;
}

.notification-item.info i { color: var(--info); }
.notification-item.success i { color: var(--success); }
.notification-item.warning i { color: var(--warning); }

.notification-content p {
  line-height: 1.4;
  color: var(--text-main);
}

.notification-content span {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
  margin-top: 4px;
}

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

/* Content Body */
.content-body {
  flex-grow: 1;
  padding: 16px 16px;
  overflow-y: auto;
}

.app-footer {
  padding: 20px 32px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  background-color: var(--bg-card);
}

/* ----------------------------------------------------
 * GENERAL BUTTONS & ALERTS
 * ---------------------------------------------------- */
/* ----------------------------------------------------
 * GENERAL BUTTONS & ALERTS
 * ---------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-normal);
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97) !important;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.35), var(--shadow-glow);
  filter: brightness(1.06);
}

.btn-accent {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.2);
}
.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35), var(--shadow-glow-accent);
  filter: brightness(1.06);
}

.btn-secondary {
  background-color: rgba(241, 245, 249, 0.9);
  color: var(--text-main);
  border: 1px solid var(--border-dark);
}
.btn-secondary:hover {
  background-color: #e2e8f0;
  transform: translateY(-1px);
}

.btn-outline {
  background-color: transparent;
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text-light);
}
.btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.btn-outline-primary {
  background-color: transparent;
  border-color: var(--primary);
  color: var(--primary);
}
.btn-outline-primary:hover {
  background-color: var(--primary-light);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
  filter: brightness(1.06);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn:disabled, .btn.btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Size Helpers */
.btn-sm {
  padding: 8px 14px;
  font-size: 11.5px;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-danger {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-info {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.alert-success {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

/* ----------------------------------------------------
 * UTILITY STYLES & LAYOUTS
 * ---------------------------------------------------- */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

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

.flex-end {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.flex-gap {
  display: flex;
  gap: 12px;
}

.hidden {
  display: none !important;
}

.shadow-lg {
  box-shadow: var(--shadow-lg);
}

.margin-top-md { margin-top: 16px; }
.margin-bottom-md { margin-bottom: 16px; }
.margin-bottom-lg { margin-bottom: 24px; }
.text-center { text-align: center; }

/* ----------------------------------------------------
 * DASHBOARD VIEW COMPONENTS
 * ---------------------------------------------------- */
.stat-card {
  background-color: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  position: relative;
  overflow: hidden;
  animation: cardFadeSlideUp 0.6s var(--transition-spring) both;
}

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

/* Stagger animations for stat cards */
.grid-4 > div:nth-child(1) { animation-delay: 0.05s; }
.grid-4 > div:nth-child(2) { animation-delay: 0.1s; }
.grid-4 > div:nth-child(3) { animation-delay: 0.15s; }
.grid-4 > div:nth-child(4) { animation-delay: 0.2s; }

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(5, 150, 105, 0.15);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-gradient);
}

.stat-card.stat-gold::before { background: var(--accent-gradient); }
.stat-card.stat-danger::before { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); }
.stat-card.stat-info::before { background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); }

/* Decorative translucent circle ornament */
.stat-card::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.015);
  pointer-events: none;
}

.stat-info-box h3 {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 4px;
  letter-spacing: -0.02em;
}

.stat-info-box p {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.stat-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background-color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--primary);
  box-shadow: 0 8px 16px -4px rgba(5, 150, 105, 0.1);
  transition: transform var(--transition-normal);
}

.stat-card:hover .stat-icon-wrapper {
  transform: scale(1.08) rotate(4deg);
}

.stat-gold .stat-icon-wrapper {
  background-color: var(--accent-light);
  color: var(--accent-dark);
  box-shadow: 0 8px 16px -4px rgba(245, 158, 11, 0.1);
}

.stat-danger .stat-icon-wrapper {
  background-color: #fee2e2;
  color: var(--danger);
  box-shadow: 0 8px 16px -4px rgba(239, 68, 68, 0.1);
}

.stat-info .stat-icon-wrapper {
  background-color: #dbeafe;
  color: var(--info);
  box-shadow: 0 8px 16px -4px rgba(59, 130, 246, 0.1);
}

/* Dark mode overrides for stat cards icon wrappers to look elegant and theme-compliant */
body.dark-theme .stat-icon-wrapper {
  background-color: rgba(16, 185, 129, 0.12) !important;
  color: #34d399 !important;
  box-shadow: none !important;
}
body.dark-theme .stat-gold .stat-icon-wrapper {
  background-color: rgba(245, 158, 11, 0.12) !important;
  color: #fbbf24 !important;
}
body.dark-theme .stat-danger .stat-icon-wrapper {
  background-color: rgba(239, 68, 68, 0.12) !important;
  color: #f87171 !important;
}
body.dark-theme .stat-info .stat-icon-wrapper {
  background-color: rgba(59, 130, 246, 0.12) !important;
  color: #60a5fa !important;
}

/* Card Widget (e.g. recent logs, lists) — Premium Glassmorphism */
.card-widget {
  background: var(--bg-card-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  height: 100%;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  position: relative;
}

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

.card-widget-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

/* Elegant left indicator bar */
.card-widget-header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 30%;
  bottom: 30%;
  width: 4px;
  background: var(--primary-gradient);
  border-radius: 0 4px 4px 0;
}

.card-widget-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.card-widget-header h3 i {
  font-size: 20px;
  color: var(--accent);
}

.card-widget-body {
  padding: 24px;
}

/* Recent Activity List */
.activity-list {
  list-style: none;
}

.activity-item {
  display: flex;
  gap: 16px;
  padding-bottom: 18px;
  border-left: 2px solid #e2e8f0;
  padding-left: 20px;
  position: relative;
}

.activity-item:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.activity-dot {
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--primary);
  border: 2px solid var(--bg-card);
}

.activity-item.grade .activity-dot { background-color: var(--info); }
.activity-item.student .activity-dot { background-color: var(--accent); }
.activity-item.attendance .activity-dot { background-color: var(--success); }

.activity-body {
  flex-grow: 1;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  float: right;
}

.activity-body p {
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.4;
}

.activity-body span {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* ----------------------------------------------------
 * DATA TABLES & CONTROLS
 * ---------------------------------------------------- */
/* Controls panel */
.control-panel {
  background: var(--bg-card-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 20px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.search-input-wrapper {
  position: relative;
  width: 320px;
}

.search-input-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
  transition: color var(--transition-fast);
}

.search-input-wrapper input {
  padding-left: 40px;
  border-radius: var(--radius-pill) !important;
}

.search-input-wrapper input:focus + i {
  color: var(--primary);
}

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

/* Table Style — Rounded & Modern */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background-color: var(--bg-card);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.custom-table th {
  background: rgba(248, 250, 252, 0.85);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 1px;
  padding: 14px 16px;
  border-bottom: 1.5px solid var(--border-dark);
  font-family: 'Outfit', sans-serif;
  vertical-align: middle !important;
}

.custom-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
  transition: background-color var(--transition-fast);
}

.custom-table tbody tr {
  transition: background-color var(--transition-fast);
}

.custom-table tbody tr:hover {
  background-color: var(--bg-hover) !important;
}

.custom-table tbody tr:hover td {
  color: var(--primary-dark);
}

.custom-table tbody tr:last-child td {
  border-bottom: none;
}

/* Table Badges — Soft Colored Glows */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: currentColor;
  display: inline-block;
}

.badge-active { background-color: #d1fae5; color: #065f46; }
.badge-inactive { background-color: #f1f5f9; color: var(--text-muted); }

/* Attendance status badges */
.badge-hadir { background-color: #d1fae5; color: #065f46; }
.badge-sakit { background-color: #fef3c7; color: #92400e; }
.badge-izin { background-color: #dbeafe; color: #1e40af; }
.badge-alfa { background-color: #fee2e2; color: #991b1b; }

/* Grade badges */
.badge-grade-a { background-color: #d1fae5; color: #065f46; font-size: 13px; padding: 6px 14px; }
.badge-grade-b { background-color: #dbeafe; color: #1e40af; font-size: 13px; padding: 6px 14px; }
.badge-grade-c { background-color: #fef3c7; color: #92400e; font-size: 13px; padding: 6px 14px; }
.badge-grade-d { background-color: #ffedd5; color: #c2410c; font-size: 13px; padding: 6px 14px; }
.badge-grade-e { background-color: #fee2e2; color: #991b1b; font-size: 13px; padding: 6px 14px; }

/* Actions Table Buttons */
.table-actions {
  display: flex;
  gap: 8px;
}

.btn-action {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition-fast);
}

.btn-action:hover {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.btn-action.btn-edit:hover {
  color: var(--info);
  border-color: var(--info);
  background-color: #e0f2fe;
}

.btn-action.btn-delete:hover {
  color: var(--danger);
  border-color: var(--danger);
  background-color: #fee2e2;
}

/* Empty Table View */
.table-empty {
  padding: 48px;
  text-align: center;
  color: var(--text-muted);
}

.table-empty i {
  font-size: 48px;
  color: var(--border-dark);
  margin-bottom: 12px;
}

/* ----------------------------------------------------
 * FORM FIELDS
 * ---------------------------------------------------- */
/* ----------------------------------------------------
 * FORM FIELDS
 * ---------------------------------------------------- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-main);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1.5px solid rgba(15, 23, 42, 0.1);
  border-radius: var(--radius-sm);
  background-color: rgba(248, 250, 252, 0.6);
  color: var(--text-main);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.form-control::placeholder {
  color: #94a3b8;
  font-style: italic;
  font-size: 13px;
}

.form-control:focus {
  background-color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

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

.input-icon-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
}

.input-icon-wrapper .form-control {
  padding-left: 40px;
}

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

/* ----------------------------------------------------
 * ATTENDANCE MATRIX SHEET
 * ---------------------------------------------------- */
.attendance-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.attendance-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.attendance-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.attendance-card-name h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.attendance-card-name p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.attendance-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
  margin-top: auto;
}

.att-option {
  position: relative;
}

.att-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.att-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.att-label:hover {
  background-color: #f8fafc;
}

/* Hadir */
.att-option-hadir input[type="radio"]:checked + .att-label {
  background-color: #d1fae5;
  border-color: var(--success);
  color: #065f46;
}
/* Sakit */
.att-option-sakit input[type="radio"]:checked + .att-label {
  background-color: #fef3c7;
  border-color: var(--warning);
  color: #92400e;
}
/* Izin */
.att-option-izin input[type="radio"]:checked + .att-label {
  background-color: #dbeafe;
  border-color: var(--info);
  color: #1e40af;
}
/* Alfa */
.att-option-alfa input[type="radio"]:checked + .att-label {
  background-color: #fee2e2;
  border-color: var(--danger);
  color: #991b1b;
}

/* ----------------------------------------------------
 * DETAIL SANTRI & RAPOR VIEW
 * ---------------------------------------------------- */
.student-detail-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}

.student-detail-sidebar {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
}

.student-avatar-big {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin: 0 auto 16px auto;
  border: 4px solid var(--border);
}

.student-detail-sidebar h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.student-detail-sidebar p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.student-detail-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.detail-section-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
}

.detail-section-card h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.info-item label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.info-item p {
  font-size: 14px;
  color: var(--text-main);
  margin-top: 4px;
  font-weight: 500;
}

/* Rapor digital layout */
.rapor-wrapper {
  position: relative;
  background-color: #ffffff;
  border: 2px solid var(--primary-dark);
  border-radius: var(--radius-md);
  padding: 32px;
  max-width: 800px;
  margin: 0 auto;
  box-shadow: var(--shadow-md);
  z-index: 1;
}

.rapor-wrapper::before {
  content: "";
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 440px;
  height: 440px;
  background-image: url('../logo.jpg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.05; /* faint background watermark */
  z-index: -1;
  pointer-events: none;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.rapor-header {
  text-align: center;
  border-bottom: 3px double var(--primary);
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.rapor-title {
  font-family: 'Amiri', serif;
  font-size: 32px;
  color: var(--primary-dark);
}

.rapor-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
  font-size: 13px;
}

.rapor-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.rapor-table th, .rapor-table td {
  border: 1px solid #000000;
  padding: 8px;
  font-size: 13px;
  color: #000000 !important;
}

.rapor-table th {
  background-color: #f8fafc;
  font-weight: 700;
  text-align: center;
}

.rapor-table td.center {
  text-align: center;
}

.rapor-average-row {
  background-color: #f8fafc;
  font-weight: 700;
}

/* ----------------------------------------------------
 * MODAL SYSTEM (PREMIUM GLASSMORPHISM & SPRING SPRING)
 * ---------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity var(--transition-normal);
}

.modal-box {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  transform-origin: center;
}

.modal-box form {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-grow: 1;
  min-height: 0;
}

.modal-sm {
  max-width: 420px;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(248, 250, 252, 0.8);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 750;
  color: var(--primary-dark);
  letter-spacing: -0.01em;
}

.close-modal-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

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

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
  min-height: 0;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: rgba(248, 250, 252, 0.8);
  flex-shrink: 0;
}

/* Entrance Spring animation for modals */
.animate-scale {
  animation: modalScaleSpring 0.4s var(--transition-spring) forwards;
}

@keyframes modalScaleSpring {
  from {
    transform: scale(0.94);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ----------------------------------------------------
 * TOAST NOTIFICATIONS
 * ---------------------------------------------------- */
/* ----------------------------------------------------
 * TOAST NOTIFICATIONS (WITH TIMED PROGRESS BAR)
 * ---------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2000;
}

.toast {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-xl);
  border-left: 5px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 420px;
  font-size: 13.5px;
  font-weight: 600;
  animation: toastSlideIn 0.4s var(--transition-spring) forwards;
  color: var(--text-main);
  position: relative;
  overflow: hidden;
  border-top: 1px solid rgba(15, 23, 42, 0.02);
  border-right: 1px solid rgba(15, 23, 42, 0.02);
}

/* Timed Progress Bar at the bottom of Toast */
.toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: rgba(15, 23, 42, 0.06);
}

/* Inner progress colored strip */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background-color: inherit;
  width: 100%;
  animation: toastProgressShrink 3s linear forwards;
}

@keyframes toastProgressShrink {
  from { width: 100%; }
  to { width: 0%; }
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-danger { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info { border-left-color: var(--info); }

.toast i {
  font-size: 22px;
  flex-shrink: 0;
}

.toast.toast-success i { color: var(--success); }
.toast.toast-danger i { color: var(--danger); }
.toast.toast-warning i { color: var(--warning); }
.toast.toast-info i { color: var(--info); }

@keyframes toastSlideIn {
  from {
    transform: translateX(120%) translateY(0);
    opacity: 0;
  }
  to {
    transform: translateX(0) translateY(0);
    opacity: 1;
  }
}

.toast.fade-out {
  animation: toastFadeOut 0.35s var(--transition-normal) forwards;
}

@keyframes toastFadeOut {
  to {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
}

/* ----------------------------------------------------
 * RESPONSIVE MEDIA QUERIES
 * ---------------------------------------------------- */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .mobile-toggle {
    display: block;
  }
  
  .top-navbar {
    padding: 0 20px;
  }
  
  .content-body {
    padding: 20px;
  }
}

@media (max-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  
  .control-panel {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-input-wrapper {
    width: 100%;
  }
  
  .filter-group {
    flex-wrap: wrap;
  }
  
  .student-detail-grid {
    grid-template-columns: 1fr;
  }
  
  .rapor-wrapper {
    padding: 16px;
  }
}

/* ----------------------------------------------------
 * PRINT STYLE (CETAK LAPORAN)
 * ---------------------------------------------------- */
@media print {
  /* Hide interactive layouts */
  .sidebar,
  .top-navbar,
  .control-panel,
  .app-footer,
  .toast-container,
  .modal-overlay,
  .btn,
  .table-actions,
  .no-print,
  .custom-table th:last-child,
  .custom-table td:last-child,
  #clear-notifications-btn {
    display: none !important;
  }
  
  body, 
  .app-container, 
  .main-content, 
  .content-body, 
  #app-content, 
  #view-content-wrapper, 
  #grades-workspace {
    background-color: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
    box-shadow: none !important;
    border: none !important;
  }
  
  .custom-table {
    border: 1px solid #000000 !important;
    font-size: 12px !important;
  }
  
  .custom-table th, .custom-table td {
    border-bottom: 1px solid #000000 !important;
    padding: 8px !important;
    color: #000000 !important;
  }
  
  .custom-table th {
    background-color: #e2e8f0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  .rapor-wrapper {
    border: 6px double #000000 !important;
    border-radius: 12px !important; /* Premium rounded corner border */
    box-shadow: none !important;
    padding: 12px 20px !important;
    margin: 2mm auto !important; /* Centered with small top/bottom safety margin */
    width: 190mm !important; /* Fits A4 nicely */
    height: 275mm !important; /* Safe height to ensure exactly one page on A4 (297mm) */
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    page-break-inside: avoid !important;
    position: relative !important;
  }

  .rapor-wrapper * {
    font-size: 11.5px !important;
  }

  .rapor-header {
    margin-bottom: 12px !important;
    padding-bottom: 8px !important;
    border-bottom: 2.5px double #000000 !important;
  }

  .rapor-header img {
    width: 65px !important;
    height: 65px !important;
  }

  .rapor-header div div {
    font-size: 15px !important;
  }

  .rapor-header div p {
    font-size: 9.5px !important;
    margin-top: 2px !important;
  }

  .rapor-wrapper img[alt="Logo Watermark"] {
    width: 320px !important;
    height: 320px !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    opacity: 0.12 !important;
  }

  .rapor-table th, .rapor-table td {
    padding: 5.5px 8px !important;
    font-size: 10.5px !important;
  }

  .rapor-table {
    margin-bottom: 12px !important;
  }

  .detail-section-card {
    border: 1px solid #000000 !important;
    page-break-inside: avoid;
    margin-bottom: 16px;
  }
  
  /* Show headers specifically for print if needed */
  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 24px;
  }
}

@media print {
  /* ── MASTER PAGE RULE ── Forces A4 paper with zero margins to hide browser headers/footers */
  @page {
    size: A4;
    margin: 0 !important;
  }

  /* ── GLOBAL PRINT RESET ── Ensure html and body have zero padding/margin */
  html {
    margin: 0 !important;
    padding: 0 !important;
  }
  body {
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ----------------------------------------------------
 * TEACHER DASHBOARD CUSTOM STYLES
 * ---------------------------------------------------- */
.btn-menu-teacher {
  transition: all 0.2s ease-in-out !important;
}
.btn-menu-teacher:hover {
  transform: translateY(-2px);
  border-color: var(--primary) !important;
  box-shadow: var(--shadow-md) !important;
  background-color: var(--bg-body) !important;
}
.btn-menu-teacher:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm) !important;
}

.class-select-tile {
  transition: all 0.2s ease-in-out !important;
}
.class-select-tile:hover {
  transform: translateX(4px);
  border-color: var(--primary) !important;
  background-color: var(--bg-card) !important;
}
.class-select-tile:active {
  transform: translateX(0);
}

/* ----------------------------------------------------
 * PREMIUM THEME (DARK MODE) & SEARCH STYLES
 * ---------------------------------------------------- */
body.dark-theme {
  --bg-app: #0c1222;           /* Deep elegant dark navy */
  --bg-card: rgba(30, 41, 59, 0.7); /* Dark glassmorphism card */
  --bg-card-glass: rgba(30, 41, 59, 0.75); /* Dark translucent card */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.1);
  --border-dark: #1e293b;
  --primary-light: rgba(16, 185, 129, 0.15);
  --bg-sidebar: #070d19;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 40px -8px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 24px 50px -12px rgba(0, 0, 0, 0.7);
  --bg-hover: rgba(16, 185, 129, 0.06);
  --accent-light: rgba(245, 158, 11, 0.15);
  --accent-dark: #fbbf24;
  --bg-navbar-glass: rgba(15, 23, 42, 0.6);
}

body.dark-theme .main-content {
  background-image: 
    linear-gradient(rgba(12, 18, 34, 0.96) 0%, rgba(12, 18, 34, 0.98) 100%),
    url('bg_islamic.jpg');
}

/* Dark mode form inputs */
body.dark-theme input, 
body.dark-theme select, 
body.dark-theme textarea {
  background-color: rgba(30, 41, 59, 0.6) !important;
  color: #f8fafc !important;
  border-color: rgba(148, 163, 184, 0.15) !important;
}

body.dark-theme input:focus, 
body.dark-theme select:focus, 
body.dark-theme textarea:focus {
  background-color: #1e293b !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
}

body.dark-theme .form-control[disabled], 
body.dark-theme .form-control[readonly] {
  background-color: rgba(15, 23, 42, 0.5) !important;
  color: #475569 !important;
}

body.dark-theme .custom-table th {
  background-color: rgba(15, 23, 42, 0.6) !important;
  color: #34d399 !important;
  border-bottom: 2px solid rgba(148, 163, 184, 0.1) !important;
}

body.dark-theme .custom-table td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.08) !important;
}

body.dark-theme .custom-table tr:hover {
  background-color: rgba(16, 185, 129, 0.08) !important;
}

body.dark-theme .card-widget-header {
  border-bottom: 1px solid rgba(148, 163, 184, 0.1) !important;
}

body.dark-theme .modal-box {
  background-color: #151f32 !important;
  color: #f8fafc !important;
  border: 1px solid rgba(148, 163, 184, 0.15) !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.8) !important;
}

body.dark-theme .modal-header {
  background-color: rgba(15, 23, 42, 0.4) !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1) !important;
}

body.dark-theme .modal-footer {
  background-color: rgba(15, 23, 42, 0.4) !important;
  border-top: 1px solid rgba(148, 163, 184, 0.1) !important;
}

body.dark-theme .activity-list::before {
  background-color: #334155 !important;
}

body.dark-theme .activity-dot {
  border-color: #151f32 !important;
  background-color: #334155 !important;
}

/* Dark mode specific fine-tuning overrides for inline styles and elements */
body.dark-theme div[style*="background-color: var(--accent-light)"] {
  background-color: var(--accent-light) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}

body.dark-theme div[style*="background-color: var(--accent-light)"] p {
  color: rgba(248, 250, 252, 0.8) !important;
}

body.dark-theme div[style*="background-color: var(--accent-light)"] h4,
body.dark-theme div[style*="background-color: var(--accent-light)"] p[style*="font-family: 'Amiri'"] {
  color: #fbbf24 !important;
}

/* Force dark mode progress bar track to be dark slate instead of light gray */
body.dark-theme div[style*="background-color: #e2e8f0"] {
  background-color: #1e293b !important;
}

/* Ensure navbar title stands out beautifully in dark mode */
body.dark-theme .navbar-title h2 {
  color: #34d399 !important;
}

/* Enhance dark mode date display block */
body.dark-theme .date-display {
  background: rgba(30, 41, 59, 0.6) !important;
  color: #94a3b8 !important;
  border-color: rgba(148, 163, 184, 0.08) !important;
}

body.dark-theme .global-search-dropdown {
  background-color: #151f32 !important;
  border-color: rgba(148, 163, 184, 0.15) !important;
}

/* Global Search Elements */
.global-search-container {
  position: relative;
  max-width: 280px;
  width: 100%;
}

.global-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 250px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 6px;
}

.global-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background-color 0.2s;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
}

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

.global-search-item:hover {
  background-color: var(--primary-light);
}

.global-search-item img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.global-search-item-info {
  display: flex;
  flex-direction: column;
}

.global-search-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.global-search-item-class {
  font-size: 11px;
  color: var(--text-muted);
}

/* ----------------------------------------------------
 * PRINT LAYOUT KOP SURAT
 * ---------------------------------------------------- */
.print-header-kop {
  display: none;
}

@media print {
  .print-header-kop {
    display: block !important;
    width: 100%;
    margin-bottom: 24px;
  }

  /* Override general print layout hiding for the active detail modal */
  body.modal-print-active .app-container,
  body.modal-print-active .sidebar,
  body.modal-print-active .top-navbar,
  body.modal-print-active .app-footer,
  body.modal-print-active .toast-container {
    display: none !important;
  }

  body.modal-print-active .modal-overlay,
  body.modal-print-active #detail-modal-overlay {
    display: block !important;
    position: static !important;
    background: none !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    width: 100% !important;
    height: auto !important;
    z-index: auto !important;
  }

  body.modal-print-active .modal-overlay .modal-box,
  body.modal-print-active #detail-modal-overlay .modal-box {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
  }

  body.modal-print-active #detail-modal-overlay #close-detail-modal,
  body.modal-print-active #detail-modal-overlay #print-profile-btn,
  body.modal-print-active .modal-header .close-modal-btn,
  body.modal-print-active .modal-body #print-profile-btn {
    display: none !important;
  }

  /* Override general print layout for cumulative report cards */
  body.cumulative-print-active .app-container,
  body.cumulative-print-active .main-content,
  body.cumulative-print-active #app-content,
  body.cumulative-print-active #grades-workspace {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
  }

  body.cumulative-print-active .sidebar,
  body.cumulative-print-active .top-navbar,
  body.cumulative-print-active .control-panel,
  body.cumulative-print-active .app-footer,
  body.cumulative-print-active .toast-container,
  body.cumulative-print-active .no-print,
  body.cumulative-print-active #grades-filter-container {
    display: none !important;
  }

  body.cumulative-print-active #cumulative-print-container {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
    display: block !important;
  }

  /* Override general print layout for Invoice A4 Receipts */
  body.invoice-print-active .app-container,
  body.invoice-print-active .sidebar,
  body.invoice-print-active .top-navbar,
  body.invoice-print-active .app-footer,
  body.invoice-print-active .toast-container,
  body.invoice-print-active .modal-overlay,
  body.invoice-print-active #invoice-modal-overlay {
    display: none !important;
  }

  body.invoice-print-active #temp-print-wrapper,
  body.invoice-print-active .invoice-a4-layout {
    position: relative !important;
    display: block !important;
    width: 210mm !important;
    height: auto !important;
    padding: 0mm 15mm 15mm 15mm !important;
    margin: 0 auto !important;
    background: #ffffff !important;
    color: #000000 !important;
    border: none !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
  }

  /* Compress statement card elements vertically when printing */
  .print-area {
    margin: 0 auto !important;
    padding: 0px 20px 12px 20px !important;
    border: 1px solid #000000 !important;
    border-radius: 4px !important;
    max-width: 100% !important;
    box-shadow: none !important;
  }
  
  .print-area > div[style*="border-bottom"] {
    padding-bottom: 6px !important;
    margin-bottom: 10px !important;
  }
  
  .print-area > div[style*="text-align: center"] {
    margin-bottom: 12px !important;
  }
  
  .print-area > div[style*="display: flex"] {
    margin-bottom: 12px !important;
    padding: 8px !important;
  }
  
  .print-area table td {
    padding: 4px 8px !important;
  }
  
  .print-area table td input {
    height: 26px !important;
    font-size: 11.5px !important;
  }
  
  .print-area table th {
    padding: 6px 8px !important;
    font-size: 11.5px !important;
  }
}


/* ----------------------------------------------------
 * MOBILE BOTTOM NAVIGATION BAR & MORE OVERLAY
 * ---------------------------------------------------- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.04);
  z-index: 1500;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 700;
  width: 20%;
  height: 100%;
  gap: 2px;
  transition: all 0.25s var(--transition-normal);
  outline: none;
  position: relative;
}

.bottom-nav-link i {
  font-size: 22px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
}

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

.bottom-nav-link.active i {
  transform: translateY(-2px) scale(1.08);
}

/* Active indicator bar at top of bottom nav link */
.bottom-nav-link.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 30%;
  right: 30%;
  height: 3px;
  background: var(--primary-gradient);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.4);
}

/* More Menu Overlay — Elegant Bottom Sheet */
.mobile-more-overlay {
  display: none;
  position: fixed;
  top: 0;
  bottom: 64px;
  left: 0;
  right: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1400;
  justify-content: center;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-more-overlay.active {
  display: flex;
  opacity: 1;
}

.mobile-more-content {
  background-color: var(--bg-card);
  width: 100%;
  max-width: 600px;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 16px 20px 24px 20px;
  box-sizing: border-box;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.08);
}

.mobile-more-overlay.active .mobile-more-content {
  transform: translateY(0);
}

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

/* Bottom Sheet drag indicator handle bar */
.mobile-more-header::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  background-color: var(--border-dark);
  border-radius: 2px;
  opacity: 0.8;
}

.mobile-more-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 750;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.btn-close-menu {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  transition: color var(--transition-fast);
}

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

.mobile-menu-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 8px 0;
}

.mobile-menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  text-decoration: none;
  font-size: 10.5px;
  font-weight: 600;
  gap: 6px;
  padding: 12px 6px;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s, transform 0.2s;
  border: 1.5px solid var(--border);
  background-color: rgba(248, 250, 252, 0.4);
}

.mobile-menu-item:active {
  background-color: var(--bg-hover);
  transform: scale(0.96);
}

.mobile-menu-item i {
  font-size: 24px;
  color: var(--primary);
  transition: transform 0.2s;
}

.mobile-menu-item:active i {
  transform: translateY(-2px);
}

.mobile-menu-item.text-danger {
  border-color: rgba(239, 68, 68, 0.1);
  background-color: rgba(239, 68, 68, 0.02);
}

.mobile-menu-item.text-danger i {
  color: var(--danger);
}

/* Responsive Overrides */
@media (max-width: 768px) {
  /* Prevent horizontal scroll wrapper from leaking width */
  .table-responsive {
    overflow-x: visible !important;
    border: none !important;
  }
  
  .bottom-nav {
    display: flex;
  }
  
  .app-container {
    padding-bottom: 62px;
  }
  
  /* Hide desktop sidebar on mobile since bottom nav handles navigation */
  .sidebar {
    display: none !important;
  }
  
  /* Make top navbar menu toggle button hidden since sidebar is disabled */
  .mobile-toggle {
    display: none !important;
  }
  
  /* Reduce content body padding on mobile to maximize viewport space */
  .content-body {
    padding: 12px 14px !important;
  }
  
  /* Make main content stretch since sidebar is hidden */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .grid-3, .grid-4 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}


/* ----------------------------------------------------
 * CLEAN MOBILE (HP / ANDROID) WEB LAYOUT OVERRIDES
 * ---------------------------------------------------- */
@media (max-width: 768px) {
  /* 1. Remove large, messy overlapping header widgets */
  .date-display {
    display: none !important;
  }
  
  .global-search-container {
    display: none !important;
  }
  
  .top-navbar {
    height: 56px !important;
    padding: 0 12px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
  
  .navbar-title h2 {
    font-size: 14px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    margin: 0 !important;
  }

  .navbar-right {
    gap: 12px !important;
  }

  /* 2. Hide large Bismillah banners to save screen height */
  .bismillah-banner {
    display: none !important;
  }

  /* 3. Convert large, squished tables to clean vertical list cards */
  table.custom-table thead, table.table thead {
    display: none !important;
  }
  
  table.custom-table, 
  table.custom-table tbody, 
  table.custom-table tr, 
  table.custom-table td,
  table.table,
  table.table tbody,
  table.table tr,
  table.table td {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important; /* Force override inline min-width */
    box-sizing: border-box !important;
    table-layout: auto !important;
  }
  
  /* Each row is a beautiful mobile card with 2-column grid layout (dua-dua) */
  table.custom-table tr, table.table tr {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important; /* 2-by-2 column grid! */
    gap: 8px 12px !important;
    position: relative !important;
    margin-bottom: 14px !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    background-color: var(--bg-card) !important;
    padding: 16px !important;
    box-shadow: var(--shadow-sm) !important;
    width: 100% !important;
  }
  
  /* Every cell stacks label on top and value below inside its grid cell */
  table.custom-table td, table.table td {
    border: none !important;
    padding: 2px 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
    font-size: 13px !important;
    width: 100% !important;
    min-width: 0 !important;
    border-bottom: none !important;
    margin-bottom: 0 !important;
  }

  /* Full width items in the 2-column card */
  table.custom-table td[data-label="Nama Santri"],
  table.custom-table td[data-label="Aksi"],
  table.table td[data-label="Nama Lengkap"],
  table.table td[data-label="Aksi"] {
    grid-column: 1 / -1 !important; /* Span across both columns! */
  }

  table.custom-table td[data-label="Nama Santri"] {
    border-bottom: 1px dashed var(--border) !important;
    padding-bottom: 8px !important;
    margin-bottom: 4px !important;
  }

  table.custom-table td[data-label="Aksi"] {
    border-top: 1px dashed var(--border) !important;
    padding-top: 8px !important;
    margin-top: 4px !important;
  }
  
  /* Column headers as small uppercase labels on top */
  table.custom-table td::before, table.table td::before {
    content: attr(data-label);
    font-weight: 750 !important;
    color: var(--text-muted) !important;
    text-align: left !important;
    font-size: 10.5px !important;
    text-transform: uppercase !important;
    margin-bottom: 6px !important; /* Space between label and input */
    display: block !important;
  }

  /* Hide colgroup on mobile to prevent fixed column widths */
  table.table colgroup, table.custom-table colgroup {
    display: none !important;
  }

  /* Hide "No" column on mobile cards to save space */
  table.table td[data-label="No"] {
    display: none !important;
  }

  /* Specific mobile layouts for User Management (table.table) cards */
  table.table tr {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important; /* Perfect 50% split */
    gap: 12px 16px !important; /* Gap between grid items (row gap, column gap) */
    padding: 16px !important;
  }

  /* Keep full width for Name by spanning 2 grid columns */
  table.table td[data-label="Nama Lengkap"] {
    grid-column: span 2 !important;
    border-bottom: 1px dashed var(--border-dark) !important;
    padding-bottom: 10px !important;
    margin-bottom: 2px !important;
    width: 100% !important;
    display: block !important;
  }

  /* Reset layout for cells to display normally inside the grid */
  table.table td[data-label="Username"],
  table.table td[data-label="Peran"],
  table.table td[data-label="Password"],
  table.table td[data-label="Aksi"] {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    width: 100% !important;
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    min-height: auto !important;
  }

  /* Specific margin/alignment fine-tuning */
  table.table td[data-label="Aksi"] .table-actions {
    justify-content: flex-start !important;
    margin-top: 4px !important;
  }

  table.table td[data-label="Peran"] .badge {
    margin-top: 4px !important;
    display: inline-block !important;
  }

  table.table td[data-label="Username"] code {
    margin-top: 4px !important;
    display: inline-block !important;
  }

  table.table td[data-label="Password"] {
    font-family: monospace !important;
    font-size: 16px !important;
    letter-spacing: 2px !important;
    padding-top: 4px !important;
  }

  /* 4. Simaan: Position Checkbox in top right and Student Name in top left for app-like header */
  table.custom-table td[data-label="Setor?"] {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    width: auto !important;
    border-bottom: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    z-index: 10;
  }
  
  table.custom-table td[data-label="Setor?"]::before {
    display: none !important; /* Hide label */
  }

  table.custom-table td[data-label="Nama Santri"] {
    font-size: 15px !important;
    font-weight: 800 !important;
    color: var(--text-main) !important;
    padding: 0 0 8px 0 !important;
    margin-bottom: 8px !important;
    border-bottom: 1px dashed var(--border-dark) !important;
  }

  /* Specific Grid for Reports View Table on Mobile */
  #report-view-content table.custom-table tr {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 12px 10px !important;
    padding: 16px !important;
  }

  #report-view-content table.custom-table td {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    width: 100% !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #report-view-content table.custom-table td[data-label="NIS"],
  #report-view-content table.custom-table td[data-label="Nama Santri"] {
    grid-column: span 4 !important;
  }

  /* H, S, I, A align perfectly side-by-side (1 column each in a 4-column grid) */
  #report-view-content table.custom-table td[data-label="H"],
  #report-view-content table.custom-table td[data-label="S"],
  #report-view-content table.custom-table td[data-label="I"],
  #report-view-content table.custom-table td[data-label="A"] {
    grid-column: span 1 !important;
    border-bottom: 1px dashed var(--border-light) !important;
    padding-bottom: 8px !important;
  }

  /* % Hadir and Rata-rata Nilai sit side-by-side (2 columns each) */
  #report-view-content table.custom-table td[data-label="% Hadir"],
  #report-view-content table.custom-table td[data-label="Rata-rata Nilai"] {
    grid-column: span 2 !important;
    border-bottom: 1px dashed var(--border-light) !important;
    padding-bottom: 8px !important;
  }

  /* Hafalan Terakhir spans full width at the bottom */
  #report-view-content table.custom-table td[data-label="Hafalan Terakhir"] {
    grid-column: span 4 !important;
  }  
  
  table.custom-table td[data-label="Nama Santri"]::before {
    display: none !important; /* Hide label */
  }

  /* 5. Simaan: Hide other inputs if unchecked for extreme simplicity */
  table.custom-table tr:has(.setor-check:not(:checked)) td:not([data-label="Setor?"]):not([data-label="Nama Santri"]) {
    display: none !important;
  }
  
  table.custom-table tr:has(.setor-check:not(:checked)) td[data-label="Nama Santri"] {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }

  /* 6. Form control elements take full width on mobile card */
  table.custom-table td .form-control {
    max-width: 100% !important;
    width: 100% !important;
    height: 38px !important;
    font-size: 13px !important;
    box-sizing: border-box !important;
  }
  
  /* Double pojok inputs flexed side by side */
  table.custom-table td div:has(.col-start-pojok) {
    display: flex !important;
    width: 100% !important;
    gap: 8px !important;
    align-items: center !important;
  }

  table.custom-table td div:has(.col-start-pojok) .form-control {
    flex: 1 !important;
  }

  table.custom-table td input[type="checkbox"] {
    width: 26px !important;
    height: 26px !important;
    margin: 0 !important;
    cursor: pointer;
  }

  /* Surah & Ayat preview looks like a highlighted pill on mobile */
  table.custom-table td div[id^="info_surah_ayat_"] {
    background-color: #ecfdf5 !important;
    color: #047857 !important;
    border: 1px solid #a7f3d0 !important;
    border-radius: 6px !important;
    padding: 6px 12px !important;
    font-weight: 700 !important;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    text-align: center !important;
  }

  /* Recommendations target button full width */
  table.custom-table td .btn-col-target {
    width: 100% !important;
    height: 36px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    font-size: 12px !important;
    font-weight: 700 !important;
  }

  table.custom-table td:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }

  /* 7. Absensi Page: Make radio buttons grid span full width */
  .attendance-options {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px !important;
    margin-top: 4px !important;
    padding-top: 0 !important;
    border-top: none !important;
  }

  .att-label {
    padding: 10px 4px !important;
    font-size: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
}


/* ----------------------------------------------------
 * ADDITIONAL MOBILE OVERRIDES FOR ABSENSI & RAPOR
 * ---------------------------------------------------- */
@media (max-width: 768px) {
  /* 1. Hide the right-side summary columns in Absensi view on mobile */
  .grid-2:has(#attendance-table) > div:nth-child(2) {
    display: none !important;
  }
  
  .grid-2:has(#attendance-table) {
    grid-template-columns: 1fr !important;
  }

  /* 2. Rapor Digital & Official Documents Mobile Container */
  .rapor-wrapper,
  .print-frame-doc {
    width: 100% !important;
    max-width: 800px !important;
    margin: 0 auto !important;
    padding: 20px !important;
    box-shadow: var(--shadow-md) !important;
    background: #ffffff !important;
    color: #000000 !important;
    box-sizing: border-box !important;
    border-radius: var(--radius-md) !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
}


/* ----------------------------------------------------
 * LEGER TABLE COMPACT MOBILE OVERRIDES
 * ---------------------------------------------------- */
@media (max-width: 768px) {
  /* Hide all subject columns and total column inside Leger cards to save height */
  table:has(thead th[title="Tajwid"]) td:nth-child(n+4):nth-child(-n+14) {
    display: none !important;
  }
  
  /* Make Leger student cards look clean, compact, and centered */
  table:has(thead th[title="Tajwid"]) td[data-label="Nama Santri"] {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-default) !important;
    padding-bottom: 8px !important;
    margin-bottom: 8px !important;
    width: 100% !important;
    text-align: left !important;
  }
  
  table:has(thead th[title="Tajwid"]) td[data-label="Nama Santri"]::before {
    display: block !important;
    content: attr(data-label) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--text-secondary) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    margin-bottom: 4px !important;
    margin-right: 0 !important;
  }

  table:has(thead th[title="Tajwid"]) tbody tr {
    display: flex !important;
    flex-direction: column !important;
  }

  table:has(thead th[title="Tajwid"]) td[data-label="No"] {
    order: 1 !important;
  }

  table:has(thead th[title="Tajwid"]) td[data-label="Nama Santri"] {
    order: 2 !important;
  }

  table:has(thead th[title="Tajwid"]) td[data-label="NIS"] {
    order: 3 !important;
  }

  /* Style average and rank inside Leger card */
  table:has(thead th[title="Tajwid"]) td[data-label="Rata"] {
    font-size: 14px !important;
    font-weight: 800 !important;
    color: var(--primary-dark) !important;
  }

  table:has(thead th[title="Tajwid"]) td[data-label="Rank"] {
    font-size: 14px !important;
    font-weight: 800 !important;
    color: #b45309 !important; /* Amber rank color */
  }
}

/* ----------------------------------------------------
 * DARK MODE RECEIPT/A4 PRINT PREVIEW TEXT VISIBILITY FIX
 * ---------------------------------------------------- */
body.dark-theme .invoice-a4-layout {
  background-color: #ffffff !important;
  color: #000000 !important;
}

body.dark-theme .invoice-a4-layout,
body.dark-theme .invoice-a4-layout * {
  color: #000000 !important;
  border-color: #000000 !important;
}

body.dark-theme .invoice-a4-layout p,
body.dark-theme .invoice-a4-layout span,
body.dark-theme .invoice-a4-layout strong,
body.dark-theme .invoice-a4-layout td,
body.dark-theme .invoice-a4-layout th,
body.dark-theme .invoice-a4-layout h1,
body.dark-theme .invoice-a4-layout h2,
body.dark-theme .invoice-a4-layout h3 {
  color: #000000 !important;
}

body.dark-theme .invoice-a4-layout tr {
  border-bottom-color: #dddddd !important;
}

body.dark-theme .invoice-a4-layout td span[style*="background-color"] {
  background-color: #eaeaea !important;
  color: #000000 !important;
}

body.dark-theme .invoice-a4-layout tr[style*="background-color"],
body.dark-theme .invoice-a4-layout div[style*="background-color"] {
  background-color: #f2f2f2 !important;
}

/* ----------------------------------------------------
 * DARK MODE SECONDARY BUTTONS TEXT READABILITY FIX
 * ---------------------------------------------------- */
body.dark-theme .btn-secondary {
  background-color: #334155 !important;
  color: #f8fafc !important;
  border-color: #475569 !important;
}

body.dark-theme .btn-secondary:hover {
  background-color: #475569 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}


/* ----------------------------------------------------
 * DARK MODE BADGES CONTRAST & READABILITY FIXES
 * ---------------------------------------------------- */
.education-badge {
  background-color: #f1f5f9;
  color: var(--text-main);
  font-weight: 700;
}

body.dark-theme .education-badge {
  background-color: #334155 !important;
  color: #f8fafc !important;
}

body.dark-theme .badge-active {
  background-color: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
}

body.dark-theme .badge-inactive {
  background-color: #334155 !important;
  color: #94a3b8 !important;
}

body.dark-theme .badge-hadir {
  background-color: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
}

body.dark-theme .badge-sakit {
  background-color: rgba(245, 158, 11, 0.15) !important;
  color: #fbbf24 !important;
}

body.dark-theme .badge-izin {
  background-color: rgba(59, 130, 246, 0.15) !important;
  color: #60a5fa !important;
}

body.dark-theme .badge-alfa {
  background-color: rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
}

body.dark-theme .badge-grade-a {
  background-color: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
}

body.dark-theme .badge-grade-b {
  background-color: rgba(59, 130, 246, 0.15) !important;
  color: #60a5fa !important;
}

body.dark-theme .badge-grade-c {
  background-color: rgba(245, 158, 11, 0.15) !important;
  color: #fbbf24 !important;
}

body.dark-theme .badge-grade-d {
  background-color: rgba(249, 115, 22, 0.15) !important;
  color: #ff9736 !important;
}

body.dark-theme .badge-grade-e {
  background-color: rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
}

/* Force receipt / A4 layouts and print areas to remain black on white even in dark theme */
body.dark-theme .invoice-a4-layout,
body.dark-theme .print-area {
  background-color: #ffffff !important;
  background: #ffffff !important;
  color: #000000 !important;
  border-color: #000000 !important;
  box-shadow: none !important;
}
body.dark-theme .invoice-a4-layout *,
body.dark-theme .print-area * {
  background-color: transparent !important;
  background: transparent !important;
  color: #000000 !important;
  border-color: #000000 !important;
}

/* ===== Compact Grade Input Grid Responsive ===== */
/* Hide number input spinners for cleaner grade inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

@media (max-width: 600px) {
  #grade-input-form > div[style*="grid-template-columns"],
  #grade-monthly-input-form > div[style*="grid-template-columns"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 400px) {
  #grade-input-form > div[style*="grid-template-columns"],
  #grade-monthly-input-form > div[style*="grid-template-columns"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ===== Monthly Rekap Table 2x2 Grid on Mobile ===== */
@media (max-width: 768px) {
  /* Make the row card a 2-column grid */
  table.grades-rekap-bulanan-table tr {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px 16px !important;
    padding: 16px !important;
  }

  /* Full-width headers and summary cells spanning 2 columns */
  table.grades-rekap-bulanan-table td[data-label="Mata Pelajaran"],
  table.grades-rekap-bulanan-table td[data-label="No"],
  table.grades-rekap-bulanan-table td[data-label="Mata Pelajaran (Diniyah)"],
  table.grades-rekap-bulanan-table td[data-label="Rata-rata Bulanan (40%)"],
  table.grades-rekap-bulanan-table td[data-label="Rata-rata"],
  table.grades-rekap-bulanan-table td[data-label="Ujian Rapor (60%)"],
  table.grades-rekap-bulanan-table td[data-label="Nilai Akhir (Rapor)"] {
    grid-column: span 2 !important;
    width: 100% !important;
    border-bottom: 1px solid var(--border-light) !important;
    padding-bottom: 8px !important;
  }

  /* Month 1-4 and Imtihan 1-4 cells as 2x2 grid blocks (span 1 column) */
  table.grades-rekap-bulanan-table td[data-label^="Bulan"],
  table.grades-rekap-bulanan-table td[data-label^="Imtihan"] {
    grid-column: span 1 !important;
    width: 100% !important;
    padding: 6px 12px !important;
    background-color: var(--bg-body) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    border-bottom: 1px solid var(--border) !important;
    margin-bottom: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important; /* Centered scores */
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  /* Style labels inside the 2x2 grid boxes */
  table.grades-rekap-bulanan-table td[data-label^="Bulan"]::before,
  table.grades-rekap-bulanan-table td[data-label^="Imtihan"]::before {
    margin-bottom: 2px !important;
    font-size: 8.5px !important;
    text-align: center !important;
    width: 100% !important;
  }

  /* Style scores inside the 2x2 grid boxes */
  table.grades-rekap-bulanan-table td[data-label^="Bulan"] span,
  table.grades-rekap-bulanan-table td[data-label^="Bulan"] font,
  table.grades-rekap-bulanan-table td[data-label^="Imtihan"] span {
    font-size: 13.5px !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
  }
}

/* ===== Cumulative Table 2x2 Grid on Mobile ===== */
@media (max-width: 768px) {
  /* Make the row card a 2-column grid */
  table.grades-cumulative-table tr {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px 16px !important;
    padding: 16px !important;
  }

  /* Full-width headers and summary cells spanning 2 columns */
  table.grades-cumulative-table td[data-label="No"],
  table.grades-cumulative-table td[data-label="NIS"],
  table.grades-cumulative-table td[data-label="Nama Santri"],
  table.grades-cumulative-table td[data-label="Akumulasi"],
  table.grades-cumulative-table td[data-label="Aksi"] {
    grid-column: span 2 !important;
    width: 100% !important;
    border-bottom: 1px solid var(--border-light) !important;
    padding-bottom: 8px !important;
  }

  /* Semester 1-4 cells as 2x2 grid blocks (span 1 column) */
  table.grades-cumulative-table td[data-label^="Semester"] {
    grid-column: span 1 !important;
    width: 100% !important;
    padding: 6px 12px !important;
    background-color: var(--bg-body) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    border-bottom: 1px solid var(--border) !important;
    margin-bottom: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important; /* Centered scores */
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  /* Style labels inside the 2x2 grid boxes */
  table.grades-cumulative-table td[data-label^="Semester"]::before {
    margin-bottom: 2px !important;
    font-size: 8.5px !important;
    text-align: center !important;
    width: 100% !important;
  }
}

/* ----------------------------------------------------
 * DARK THEME BUTTON & BUTTON OUTLINE VISIBILITY FIXES
 * ---------------------------------------------------- */
body.dark-theme .ak-btn-outline,
body.dark-theme .btn-outline {
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  background-color: rgba(255, 255, 255, 0.06) !important;
}

body.dark-theme .ak-btn-outline:hover,
body.dark-theme .btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
}

body.dark-theme .ak-tabs {
  background-color: rgba(15, 23, 42, 0.92) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4) !important;
}

body.dark-theme .ak-tab-btn,
body.dark-theme .ak-tab,
body.dark-theme .ak-tab-item {
  color: #94a3b8 !important;
}

body.dark-theme .ak-tab-btn:hover,
body.dark-theme .ak-tab:hover,
body.dark-theme .ak-tab-item:hover {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .ak-tab-btn.active,
body.dark-theme .ak-tab.active,
body.dark-theme .ak-tab-item.active {
  background-color: var(--color-primary-600) !important;
  color: #ffffff !important;
}

/* ----------------------------------------------------
 * PRINT ENGINE & FORCED TABLE BORDER STYLES
 * ---------------------------------------------------- */
@media print {
  @page {
    size: A4 portrait;
    margin: 18mm 12mm 10mm 12mm;
  }

  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Hide app shell elements when printing */
  header,
  nav,
  aside,
  .sidebar,
  .top-nav,
  .bottom-nav,
  .ak-btn,
  .btn,
  button,
  .ak-tabs,
  #sidebar,
  #top-navbar,
  .mobile-menu-grid,
  .bottom-nav-link,
  .no-print {
    display: none !important;
  }

  /* Isolate printable Rapor card with comfortable top spacing (~2cm) */
  .rapor-wrapper,
  .print-frame-doc,
  #student-rapor-printable-frame,
  .ak-print-container,
  .print-area {
    display: block !important;
    visibility: visible !important;
    position: relative !important;
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 10px auto 0 auto !important;
    padding: 10px 16px 0 16px !important;
    background: #ffffff !important;
    color: #000000 !important;
  }

  /* Force 100% visible solid black table borders on print */
  table,
  .print-frame-doc table,
  .rapor-wrapper table,
  .print-area table {
    border-collapse: collapse !important;
    width: 100% !important;
    border: 1.5px solid #000000 !important;
  }

  table th,
  table td,
  .print-frame-doc th,
  .print-frame-doc td,
  .rapor-wrapper th,
  .rapor-wrapper td,
  .print-area th,
  .print-area td {
    border: 1px solid #000000 !important;
    color: #000000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .border-none,
  .border-none td,
  .border-none th,
  .meta-table td,
  .meta-table th {
    border: none !important;
  }
}
