/* ==========================================================================
   ASSOCIATION AL BUSHRA - DESIGN SYSTEM & STYLESHEET
   Supports Arabic (RTL), French/English (LTR), Dark/Light Modes, 80mm Print
   ========================================================================== */

:root {
  /* Color Palette - Light Mode Tokens */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-active: #1e293b;
  --bg-card-hover: #f1f5f9;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --text-inverted: #ffffff;

  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  
  /* Primary & Accent Accents */
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-500: #4f46e5;
  --primary-600: #4338ca;
  --primary-700: #3730a3;
  --primary-glow: rgba(79, 70, 229, 0.25);

  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-glow: rgba(16, 185, 129, 0.25);

  --amber-500: #f59e0b;
  --rose-500: #f43f5e;
  --rose-600: #e11d48;
  --blue-500: #0284c7;
  --violet-500: #8b5cf6;

  /* Typography & Sizing */
  --font-arabic: 'Cairo', system-ui, -apple-system, sans-serif;
  --font-latin: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --sidebar-width: 270px;
  --sidebar-collapsed-width: 80px;
  --topbar-height: 70px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.15);
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Tokens */
body.theme-dark {
  --bg-app: #090d16;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f2937;
  --bg-sidebar: #0b0f19;
  --bg-sidebar-active: #1e293b;
  --bg-card-hover: #1f2937;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --text-inverted: #0f172a;

  --border-color: #1f2937;
  --border-subtle: #172033;
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 25px rgba(0, 0, 0, 0.45);
}

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

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-arabic);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html[lang="fr"] body,
html[lang="en"] body {
  font-family: var(--font-latin);
}

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

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

/* Universal Modern Scrollbars for all pages (Arabic RTL & English/French LTR) */
* {
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 var(--bg-app);
}

body.theme-dark * {
  scrollbar-color: #475569 var(--bg-app);
}

/* WebKit / Chromium / Edge / Safari custom scrollbars */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-app);
}

::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 9999px;
  border: 2px solid var(--bg-app);
}

::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

body.theme-dark ::-webkit-scrollbar-thumb {
  background: #475569;
}

body.theme-dark ::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Ensure permanent scrollbar gutter & smooth scrolling across RTL & LTR */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

/* ==========================================================================
   Layout Architecture
   ========================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  z-index: 50;
  transition: var(--transition);
  border-inline-end: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.12);
  color: #38bdf8;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.sidebar-toggle {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Sidebar Collapsed Mode (Mini Sidebar / Icon-Only) */
.sidebar.collapsed {
  width: 76px !important;
}
.sidebar.collapsed .brand-info,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-count,
.sidebar.collapsed .nav-pulse,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .user-details,
.sidebar.collapsed #role-dropdown-wrapper {
  display: none !important;
}
.sidebar.collapsed .sidebar-header {
  padding: 0 0.5rem;
  justify-content: center;
}
.sidebar.collapsed .sidebar-toggle {
  transform: rotate(180deg);
}
.sidebar.collapsed .logo-icon {
  margin: 0 auto;
}
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0.85rem 0;
  width: 100%;
}
.sidebar.collapsed .nav-item i {
  margin: 0;
  width: 22px;
  height: 22px;
}
.sidebar.collapsed .sidebar-footer {
  padding: 0.75rem 0.5rem;
}
.sidebar.collapsed .user-card {
  justify-content: center;
  padding: 0.4rem;
}
.sidebar.collapsed ~ .main-wrapper {
  margin-inline-start: 76px !important;
  width: calc(100% - 76px) !important;
}
[dir="rtl"] .sidebar.collapsed ~ .main-wrapper,
html:not([dir="ltr"]) .sidebar.collapsed ~ .main-wrapper {
  margin-right: 76px !important;
  margin-left: 0 !important;
}
[dir="ltr"] .sidebar.collapsed ~ .main-wrapper {
  margin-left: 76px !important;
  margin-right: 0 !important;
}

/* Sidebar Nav Items */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.nav-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  padding: 0.75rem 0.75rem 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.95rem;
  background: transparent;
  border: none;
  color: #94a3b8;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  text-align: start;
  width: 100%;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  transform: translateX(-2px);
}
[dir="ltr"] .nav-item:hover {
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.nav-item i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
}

.nav-count {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-full);
}

.nav-pulse {
  width: 8px;
  height: 8px;
  background-color: var(--emerald-500);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--emerald-500);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
}

.user-avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #10b981, #0284c7);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  position: relative;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  position: absolute;
  bottom: 0;
  right: 0;
  border: 2px solid var(--bg-sidebar);
}
.status-dot.online {
  background-color: #10b981;
}

.user-details {
  flex: 1;
  overflow: hidden;
}
.user-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.user-role {
  font-size: 0.72rem;
  color: #94a3b8;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  margin-inline-start: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

[dir="rtl"] .main-wrapper,
html:not([dir="ltr"]) .main-wrapper {
  margin-right: var(--sidebar-width);
  margin-left: 0;
}

[dir="ltr"] .main-wrapper {
  margin-left: var(--sidebar-width);
  margin-right: 0;
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.mobile-menu-toggle {
  display: none;
}

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

.global-search-wrapper .search-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  inset-inline-start: 0.85rem;
  color: var(--text-subtle);
  width: 18px;
  height: 18px;
}

.search-input {
  width: 100%;
  height: 40px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding-inline-start: 2.5rem;
  padding-inline-end: 4.5rem;
  font-size: 0.88rem;
  transition: var(--transition);
}
.search-input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: var(--bg-surface);
}

.search-shortcut {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  inset-inline-end: 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--border-color);
  color: var(--text-muted);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}

.academic-year-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-50);
  color: var(--primary-600);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--primary-100);
}
body.theme-dark .academic-year-pill {
  background: rgba(79, 70, 229, 0.15);
  color: #a5b4fc;
  border-color: rgba(79, 70, 229, 0.3);
}

/* Topbar Buttons */
.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-subtle);
}

.btn-icon.has-badge .badge-dot {
  width: 8px;
  height: 8px;
  background: var(--rose-500);
  border-radius: 50%;
  position: absolute;
  top: 8px;
  right: 8px;
}

.btn-icon-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 40px;
  padding: 0 0.95rem;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon-pill:hover {
  border-color: var(--primary-500);
}

/* Theme Icon Toggle */
#theme-toggle-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.theme-icon-sun {
  display: none !important;
}
.theme-icon-moon {
  display: block !important;
}
body.theme-dark .theme-icon-sun,
[data-theme="dark"] .theme-icon-sun {
  display: block !important;
  color: #fbbf24;
}
body.theme-dark .theme-icon-moon,
[data-theme="dark"] .theme-icon-moon {
  display: none !important;
}

/* Dropdowns */
.dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 0.45rem;
  min-width: 190px;
  display: none;
  z-index: 1000;
  animation: fadeInDown 0.15s ease-out;
}
.dropdown-menu.show {
  display: block !important;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-main) !important;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: start;
  transition: var(--transition);
}
.dropdown-item i,
.dropdown-item svg {
  color: var(--text-muted);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: var(--transition);
}
.dropdown-item:hover {
  background: var(--bg-card-hover);
  color: var(--primary-600) !important;
}
.dropdown-item:hover i,
.dropdown-item:hover svg {
  color: var(--primary-600);
}
.dropdown-item.active {
  background: var(--primary-50) !important;
  color: var(--primary-600) !important;
}
body.theme-dark .dropdown-item.active {
  background: rgba(79, 70, 229, 0.2) !important;
  color: #a5b4fc !important;
}
.dropdown-item .lang-flag {
  font-size: 1.15rem;
  line-height: 1;
}
.dropdown-item .lang-name {
  flex: 1;
}

body.theme-light .dropdown-menu {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}
body.theme-light .dropdown-item {
  color: #1e293b !important;
}
body.theme-light .dropdown-item:hover {
  background: #f1f5f9;
  color: #2563eb !important;
}
body.theme-light .dropdown-item.active {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
}
body.theme-dark .dropdown-menu {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
body.theme-dark .dropdown-item {
  color: #f1f5f9 !important;
}
body.theme-dark .dropdown-item:hover {
  background: #334155;
  color: #a5b4fc !important;
}
body.theme-dark .dropdown-item.active {
  background: rgba(79, 70, 229, 0.25) !important;
  color: #a5b4fc !important;
}
body.theme-dark .dropdown-item.active i,
body.theme-dark .dropdown-item.active svg {
  color: #a5b4fc !important;
}

.dropdown-menu-large {
  width: 320px;
  padding: 0;
}
.dropdown-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notif-list {
  max-height: 280px;
  overflow-y: auto;
}
.notif-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition);
}
.notif-item:hover {
  background: var(--bg-card-hover);
}
.notif-item.unread {
  background: rgba(79, 70, 229, 0.04);
}
.notif-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notif-text {
  font-size: 0.84rem;
  line-height: 1.4;
}
.notif-time {
  font-size: 0.72rem;
  color: var(--text-subtle);
}

/* ==========================================================================
   Buttons & Form Controls
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 40px;
  padding: 0 1.15rem;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-sm {
  height: 34px;
  padding: 0 0.85rem;
  font-size: 0.82rem;
}
.btn-xs {
  height: 28px;
  padding: 0 0.55rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}
.btn-icon.btn-xs {
  width: 28px;
  height: 28px;
}
.btn-icon i, .btn-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}
.btn-danger-soft {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.btn-danger-soft:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: #ffffff;
  box-shadow: 0 4px 12px var(--primary-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  box-shadow: 0 6px 16px var(--primary-glow);
  transform: translateY(-1px);
}
.btn-emerald {
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
  color: #ffffff;
  box-shadow: 0 4px 12px var(--emerald-glow);
}
.btn-emerald:hover {
  transform: translateY(-1px);
}
.btn-outline {
  background: var(--bg-surface);
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-outline:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
}
.btn-ghost {
  background: transparent;
  color: var(--primary-500);
}
.btn-ghost:hover {
  background: var(--primary-50);
}
.btn-white {
  background: #ffffff;
  color: var(--primary-600);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.btn-white:hover {
  background: #f8fafc;
}
.btn-primary-glass {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
}
.btn-primary-glass:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Form inputs */
.form-control, .form-select {
  width: 100%;
  height: 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 0.85rem;
  font-size: 0.9rem;
  color: var(--text-main);
  transition: var(--transition);
}
.form-control-sm, .form-select-sm {
  height: 34px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0 0.65rem;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.form-group label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

/* ==========================================================================
   Filter Cards & Responsive Search System
   ========================================================================== */
.filter-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(280px, 2fr) minmax(160px, 1fr) minmax(160px, 1fr) minmax(150px, 1fr) auto;
  align-items: flex-end;
  gap: 1rem;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.filter-item label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.filter-item label i,
.filter-item label svg {
  color: var(--primary-500);
}

.filter-item .form-control,
.filter-item .form-select {
  height: 42px;
  font-size: 0.88rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-app);
  color: var(--text-main);
  transition: all 0.2s ease;
}

.filter-item .form-control:focus,
.filter-item .form-select:focus {
  border-color: var(--primary-500);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Integrated Input Icon Wrapper */
.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-icon-wrapper > i,
.input-icon-wrapper > svg {
  position: absolute;
  inset-inline-start: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-subtle);
  pointer-events: none;
  transition: var(--transition);
  z-index: 2;
}

.input-icon-wrapper .form-control {
  padding-inline-start: 2.5rem !important;
  padding-inline-end: 0.85rem !important;
  width: 100%;
}

.input-icon-wrapper:focus-within > i,
.input-icon-wrapper:focus-within > svg {
  color: var(--primary-600);
}

.filter-btn-wrapper {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

.filter-btn-wrapper .btn {
  height: 42px;
  padding: 0 1.15rem;
  border: 1px solid var(--border-color);
  background: var(--bg-app);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--radius-md);
}

.filter-btn-wrapper .btn:hover {
  background: var(--bg-card-hover);
  color: var(--rose-500);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Quick Filter Chips Bar */
.filter-chips-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  overflow-x: auto;
  white-space: nowrap;
}

.filter-chips-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-subtle);
  margin-inline-end: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.filter-chip {
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.filter-chip:hover {
  background: var(--bg-card-hover);
  color: var(--primary-600);
  border-color: var(--primary-200);
}

.filter-chip.active {
  background: var(--primary-500);
  color: #ffffff;
  border-color: var(--primary-600);
  box-shadow: 0 2px 8px var(--primary-glow);
}

body.theme-dark .filter-chip.active {
  background: var(--primary-600);
  color: #ffffff;
}

/* Responsive Grid Rules for Filters */
@media (max-width: 1280px) {
  .filter-grid {
    grid-template-columns: minmax(240px, 1.5fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(130px, 1fr) auto;
    gap: 0.75rem;
  }
}

@media (max-width: 1024px) {
  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }
  .filter-item.search-filter {
    grid-column: span 2;
  }
  .filter-btn-wrapper {
    grid-column: span 2;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .filter-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .filter-item.search-filter {
    grid-column: span 1;
  }
  .filter-btn-wrapper {
    grid-column: span 1;
  }
}

/* ==========================================================================
   Cards, Badges & Tables
   ========================================================================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 1.15rem 1.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-header.border-b {
  border-bottom: 1px solid var(--border-color);
}
.card-title {
  font-size: 1.05rem;
  font-weight: 800;
}
.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.card-body {
  padding: 1.35rem;
}
.card-body.p-0 {
  padding: 0;
}
.card-footer {
  padding: 1rem 1.35rem;
  border-top: 1px solid var(--border-color);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.76rem;
  font-weight: 800;
  border-radius: var(--radius-full);
  line-height: 1;
  white-space: nowrap;
}
.badge-primary {
  background: rgba(79, 70, 229, 0.14);
  color: #4f46e5;
  border: 1px solid rgba(79, 70, 229, 0.3);
}
.badge-success {
  background: #059669;
  color: #ffffff !important;
  border: 1px solid #047857;
  box-shadow: 0 1px 4px rgba(5, 150, 105, 0.25);
}
.badge-danger {
  background: #dc2626;
  color: #ffffff !important;
  border: 1px solid #b91c1c;
  box-shadow: 0 1px 4px rgba(220, 38, 38, 0.25);
}
.badge-warning {
  background: #d97706;
  color: #ffffff !important;
  border: 1px solid #b45309;
  box-shadow: 0 1px 4px rgba(217, 119, 6, 0.25);
}
.badge-info {
  background: #0284c7;
  color: #ffffff !important;
  border: 1px solid #0369a1;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.25);
}
.badge-neutral {
  background: var(--bg-app);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* Tables & Modern Students Directory */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
  background: var(--bg-app);
}
.table-responsive::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: start;
}

.data-table th {
  background: var(--bg-app);
  padding: 0.85rem 1rem;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.88rem;
  vertical-align: middle;
}

.data-table tbody tr {
  transition: all 0.15s ease;
}

.data-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

.data-table tbody tr.row-selected {
  background-color: rgba(79, 70, 229, 0.06);
}

body.theme-dark .data-table tbody tr.row-selected {
  background-color: rgba(99, 102, 241, 0.12);
}

/* Students Directory Specific Column Layout */
.students-directory-table th.col-checkbox,
.students-directory-table td.col-checkbox {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  text-align: center;
  padding: 0.8rem 0.5rem;
}

.students-directory-table th.col-student {
  min-width: 250px;
}

.students-directory-table th.col-academic {
  min-width: 190px;
}

.students-directory-table th.col-contact {
  min-width: 200px;
}

.students-directory-table th.col-status {
  min-width: 130px;
  text-align: center;
}

.students-directory-table th.col-actions {
  min-width: 180px;
  text-align: end;
}

/* Student Identity Cell */
.student-cell {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.student-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.student-avatar-img {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1.5px solid var(--border-color);
  background: var(--bg-app);
  box-shadow: var(--shadow-sm);
  display: block;
}

.student-status-dot,
.student-gender-dot {
  position: absolute;
  bottom: -2px;
  inset-inline-end: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid var(--bg-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.student-status-dot.approved,
.student-gender-dot.approved {
  background: #10b981;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.4);
}
.student-status-dot.waiting,
.student-gender-dot.waiting {
  background: #f59e0b;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.4);
}
.student-status-dot.rejected,
.student-gender-dot.rejected {
  background: #ef4444;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.4);
}
.student-status-dot.pending,
.student-gender-dot.pending {
  background: #0ea5e9;
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.4);
}
.student-status-dot.male { background: #0284c7; }
.student-status-dot.female { background: #ec4899; }

.student-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.student-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.student-full-name {
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--text-main);
  line-height: 1.25;
}

.student-ref-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: 'JetBrains Mono', 'Roboto Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary-600);
  border: 1px solid rgba(79, 70, 229, 0.2);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.student-ref-badge:hover {
  background: rgba(79, 70, 229, 0.18);
  border-color: var(--primary-500);
  transform: translateY(-1px);
}
body.theme-dark .student-ref-badge {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.3);
}

.student-email-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* Academic Cell */
.academic-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
}

.academic-level-pill {
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  line-height: 1.3;
}
body.theme-dark .academic-level-pill {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.3);
}

.cohorts-pills-wrap {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.cohort-mini-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--bg-app);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.language-mini-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.2);
}
body.theme-dark .language-mini-pill {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}

/* Guardian & Contact Cell */
.guardian-cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.guardian-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.contact-links-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
}

.contact-phone-text {
  font-family: monospace;
  color: var(--text-muted);
  font-weight: 600;
}

.btn-contact-action {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: var(--bg-app);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.btn-contact-action i,
.btn-contact-action svg {
  width: 12px;
  height: 12px;
}
.btn-contact-action:hover {
  background: var(--bg-surface-elevated);
  color: var(--primary-600);
  border-color: var(--primary-400);
  transform: scale(1.1);
}
.btn-contact-action.whatsapp:hover {
  background: #25d366;
  color: #ffffff;
  border-color: #25d366;
}

.location-tag {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-pill.approved {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
body.theme-dark .status-pill.approved {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
}
.status-pill.pending {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.25);
}
body.theme-dark .status-pill.pending {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}
.status-pill.waiting {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.25);
}
body.theme-dark .status-pill.waiting {
  background: rgba(2, 132, 199, 0.18);
  color: #38bdf8;
}
.status-pill.rejected {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
body.theme-dark .status-pill.rejected {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Actions Group */
.table-action-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.btn-action-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}
.btn-action-icon i,
.btn-action-icon svg {
  width: 15px;
  height: 15px;
}
.btn-action-icon:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--primary-400);
  color: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-action-icon.btn-action-primary {
  background: var(--primary-600);
  color: #ffffff !important;
  border-color: var(--primary-600);
}
.btn-action-icon.btn-action-primary:hover {
  background: var(--primary-700);
  border-color: var(--primary-700);
  color: #ffffff !important;
}

.btn-action-icon.btn-action-danger:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444 !important;
}

/* View Toggle Buttons */
.view-toggle-btns {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-app);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
.btn-icon-toggle {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon-toggle i,
.btn-icon-toggle svg {
  width: 16px;
  height: 16px;
}
.btn-icon-toggle:hover {
  color: var(--text-main);
}
.btn-icon-toggle.active {
  background: var(--bg-surface);
  color: var(--primary-600);
  box-shadow: var(--shadow-sm);
}
body.theme-dark .btn-icon-toggle.active {
  background: var(--bg-surface-elevated);
  color: #a5b4fc;
}

/* Smart Student Cards Grid View */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  padding: 1.25rem;
}
.cards-grid.hidden {
  display: none !important;
}

.student-card-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
}
.student-card-item:hover {
  border-color: var(--primary-400);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.student-card-item.card-selected {
  border-color: var(--primary-500);
  background-color: rgba(79, 70, 229, 0.04);
}
body.theme-dark .student-card-item.card-selected {
  background-color: rgba(99, 102, 241, 0.1);
}

.student-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.student-card-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.student-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.student-card-details {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

.student-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.student-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* ==========================================================================
   Views & Dashboard Section
   ========================================================================== */
.content-area {
  flex: 1;
  padding: 1.75rem;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  min-width: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.5rem;
  width: 100%;
  box-sizing: border-box;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  width: 100%;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  width: 100%;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  width: 100%;
}

.app-view {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.app-view.active {
  display: block;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.view-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.view-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}
.view-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Hero Banner */
.dashboard-hero {
  background: linear-gradient(135deg, #1e1b4b, #312e81, #0f766e);
  color: #ffffff;
  border-radius: var(--radius-xl);
  padding: 2rem 2.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(30, 27, 75, 0.35);
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dashboard-hero::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, rgba(255,255,255,0) 70%);
  border-radius: 50%;
}

.hero-content {
  max-width: 700px;
  position: relative;
  z-index: 2;
}
.greeting-time {
  font-size: 0.85rem;
  font-weight: 700;
  color: #a5b4fc;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.hero-title {
  font-size: 1.75rem;
  font-weight: 900;
  margin: 0.35rem 0 0.5rem;
}
.hero-subtitle {
  font-size: 0.95rem;
  color: #cbd5e1;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}
.hero-actions {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}
.hero-date-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-500);
}

.kpi-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.bg-blue-grad { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.bg-violet-grad { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.bg-emerald-grad { background: linear-gradient(135deg, #10b981, #047857); }
.bg-amber-grad { background: linear-gradient(135deg, #f59e0b, #d97706); }
.bg-rose-grad { background: linear-gradient(135deg, #f43f5e, #be123c); }

.kpi-content {
  flex: 1;
}
.kpi-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}
.kpi-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0.25rem 0;
}
.kpi-value {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.currency-tag {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
}
.kpi-trend {
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}
.kpi-trend.positive { color: var(--emerald-500); }
.kpi-trend.neutral { color: var(--blue-500); }
.kpi-subtext {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

/* 2-Column Dashboard Grid */
.dashboard-grid-2col {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
}
.mt-6 { margin-top: 1.5rem; }

/* Today's Schedule List */
.today-schedule-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.schedule-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: var(--transition);
}
.schedule-item:hover {
  border-color: var(--primary-500);
  background: var(--bg-card-hover);
}
.schedule-time-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--primary-600);
}
.schedule-info h4 {
  font-size: 0.92rem;
  font-weight: 800;
}
.schedule-info span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Attendance & QR Scanner Section
   ========================================================================== */
.attendance-grid-layout {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 1.5rem;
}

.scanner-viewport-wrapper {
  padding: 1.5rem 0;
  display: flex;
  justify-content: center;
}

.scanner-viewport {
  width: 280px;
  height: 240px;
  background: #090d16;
  border-radius: var(--radius-xl);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  border: 2px solid #334155;
}

.webcam-live-stream {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 1 !important;
  border-radius: inherit;
  background: #000;
}

.scanner-laser {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #10b981, transparent);
  box-shadow: 0 0 12px #10b981, 0 0 20px #10b981;
  animation: scanLaser 2s infinite ease-in-out;
  z-index: 3;
  pointer-events: none;
}

.scanner-corners {
  position: absolute;
  inset: 14px;
  border: 2px solid rgba(16, 185, 129, 0.4);
  border-radius: 12px;
  pointer-events: none;
  z-index: 4;
}

.scanner-placeholder-content {
  position: relative;
  z-index: 2;
  padding: 1rem;
  text-align: center;
}
.qr-big-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 0.5rem;
  color: #38bdf8;
}
.scanner-placeholder-content p {
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.4;
}

.btn-danger-soft {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.btn-danger-soft:hover {
  background: #ef4444;
  color: #ffffff;
}

.scanner-input-bar {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.quick-test-badges {
  margin-top: 1.25rem;
  text-align: start;
}
.badge-test-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.test-pill {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.test-pill:hover {
  background: var(--primary-50);
  border-color: var(--primary-500);
  color: var(--primary-600);
}

.verified-student-card {
  margin-top: 1.5rem;
  background: var(--bg-app);
  border: 2px solid var(--emerald-500);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: slideUp 0.25s ease-out;
}
.verification-badge {
  color: #fff;
  padding: 0.5rem;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.verified-body {
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: start;
}
.verified-avatar {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 2px solid var(--emerald-500);
}
.verified-name {
  font-size: 1.1rem;
  font-weight: 800;
}
.verified-ref {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.verified-class-tag {
  display: inline-block;
  background: var(--primary-50);
  color: var(--primary-600);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  margin: 0.25rem 0;
}
.verified-timestamp {
  display: block;
  font-size: 0.72rem;
  color: var(--text-subtle);
}

/* ==========================================================================
   Cohorts & Teachers Grid
   ========================================================================== */
.cohorts-grid, .teachers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.cohort-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
}
.cohort-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-500);
  box-shadow: var(--shadow-md);
}
.cohort-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}
.cohort-title {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.3;
}
.cohort-code {
  font-size: 0.75rem;
  color: var(--text-subtle);
  font-weight: 700;
}
.cohort-capacity-bar {
  height: 8px;
  background: var(--bg-app);
  border-radius: var(--radius-full);
  margin: 0.85rem 0 0.4rem;
  overflow: hidden;
}
.cohort-capacity-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #3b82f6);
  border-radius: var(--radius-full);
}

.cohort-footer {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.cohort-price-tag {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  flex-shrink: 0;
}
.cohort-price-tag strong {
  color: var(--primary-600);
  font-size: 1.05rem;
  font-weight: 800;
}
.cohort-actions-group {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  flex-wrap: nowrap;
  margin-inline-start: auto;
}
.cohort-actions-group .btn-sm {
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  height: 32px;
  box-sizing: border-box;
}
.cohort-actions-group .btn-icon {
  width: 32px;
  min-width: 32px;
  padding: 0;
}
.cohort-actions-group .btn-icon i {
  width: 14px;
  height: 14px;
}

/* SMTP Email Card & Tabs */
.settings-smtp-card {
  transition: var(--transition);
}
.settings-smtp-card .tab-nav-bar {
  display: flex;
  gap: 0.4rem;
}
#smtp-test-result-box.success {
  display: block;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid #10b981;
  color: #065f46;
}
#smtp-test-result-box.error {
  display: block;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid #ef4444;
  color: #991b1b;
}

/* ==========================================================================
   Finance & Thermal Receipt 80mm
   ========================================================================== */
.finance-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
}
.f-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}
.f-stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.f-stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}
.f-stat-val {
  font-size: 1.35rem;
  font-weight: 900;
  margin-top: 0.2rem;
}
.f-stat-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  display: block;
}

/* Finance Sub-Tabs Navigation */
.finance-tabs-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding: 0.35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  scrollbar-width: none;
}
.finance-tabs-nav::-webkit-scrollbar {
  display: none;
}
.fin-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.fin-tab-btn i {
  width: 16px;
  height: 16px;
}
.fin-tab-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}
.fin-tab-btn.active {
  background: var(--primary-600);
  color: #fff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
}
.fin-tab-btn .badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
}

/* Sub-views visibility */
.fin-subview {
  display: none;
  animation: fadeInSubView 0.25s ease-out;
}
.fin-subview.active {
  display: block;
}
@keyframes fadeInSubView {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Category Badges & Color Tokens */
.badge-cat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-cat-rent { background: rgba(245, 158, 11, 0.12); color: #d97706; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-cat-electricity { background: rgba(234, 179, 8, 0.12); color: #ca8a04; border: 1px solid rgba(234, 179, 8, 0.3); }
.badge-cat-water { background: rgba(59, 130, 246, 0.12); color: #2563eb; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-cat-fuel { background: rgba(249, 115, 22, 0.12); color: #ea580c; border: 1px solid rgba(249, 115, 22, 0.3); }
.badge-cat-internet { background: rgba(6, 182, 212, 0.12); color: #0891b2; border: 1px solid rgba(6, 182, 212, 0.3); }
.badge-cat-phone { background: rgba(99, 102, 241, 0.12); color: #4f46e5; border: 1px solid rgba(99, 102, 241, 0.3); }
.badge-cat-supplies { background: rgba(16, 185, 129, 0.12); color: #059669; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-cat-maintenance { background: rgba(168, 85, 247, 0.12); color: #9333ea; border: 1px solid rgba(168, 85, 247, 0.3); }
.badge-cat-cleaning { background: rgba(20, 184, 166, 0.12); color: #0d9488; border: 1px solid rgba(20, 184, 166, 0.3); }
.badge-cat-other { background: rgba(100, 116, 139, 0.12); color: #475569; border: 1px solid rgba(100, 116, 139, 0.3); }

/* Staff Directory Cards */
.staff-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.staff-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-400);
}

/* Modal Payment & 80mm Thermal Receipt Preview */
.payment-modal-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
}

.thermal-receipt-preview-box {
  background: var(--bg-app);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.thermal-receipt {
  width: 280px;
  background: #fff;
  color: #000;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  padding: 14px;
  border-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  line-height: 1.35;
  border-top: 4px dashed #94a3b8;
  border-bottom: 4px dashed #94a3b8;
}

.tr-header h3 {
  font-size: 14px;
  font-weight: 900;
  text-align: center;
  font-family: var(--font-arabic);
}
.tr-header p {
  font-size: 10px;
  text-align: center;
  color: #444;
  font-family: var(--font-arabic);
}
.tr-doc-title {
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  margin: 4px 0;
  font-family: var(--font-arabic);
}
.tr-divider {
  font-size: 9px;
  text-align: center;
  letter-spacing: -1px;
  color: #888;
  margin: 3px 0;
}
.tr-row {
  display: flex;
  justify-content: space-between;
  margin: 3px 0;
  font-family: var(--font-arabic);
}
.tr-total-row {
  font-size: 14px;
  font-weight: 900;
}
.tr-qr {
  display: flex;
  justify-content: center;
  margin: 8px 0 4px;
}
.tr-thanks {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-arabic);
}
.tr-notice {
  font-size: 9px;
  color: #666;
  font-family: var(--font-arabic);
}

/* ==========================================================================
   Student ID Card Preview (PVC Card)
   ========================================================================== */
.id-card-preview {
  display: inline-block;
  perspective: 1000px;
}
.id-card-front {
  width: 380px;
  height: 240px;
  background: linear-gradient(135deg, #1e1b4b, #312e81, #0f766e);
  color: #fff;
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  text-align: start;
}
.id-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 6px;
}
.id-card-logo {
  width: 32px;
  height: 32px;
  background: #38bdf8;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
}
.id-card-title-box h4 {
  font-size: 0.9rem;
  font-weight: 800;
}
.id-card-title-box span {
  font-size: 0.65rem;
  color: #94a3b8;
}
.id-card-body {
  display: flex;
  align-items: center;
  gap: 12px;
}
.badge-photo {
  width: 75px;
  height: 85px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid #38bdf8;
  background: #fff;
}
.badge-details {
  flex: 1;
}
.badge-student-name {
  font-size: 1.05rem;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 4px;
}
.badge-row {
  font-size: 0.75rem;
  margin-bottom: 2px;
  color: #cbd5e1;
}
.badge-qr-box {
  background: #fff;
  padding: 4px;
  border-radius: 6px;
}
.id-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: #94a3b8;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 4px;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.15s ease-out;
}
.modal-backdrop.hidden {
  display: none;
}
.modal-dialog {
  width: 100%;
  max-width: 600px;
  animation: scaleUp 0.2s ease-out;
}
.modal-lg { max-width: 800px; }
.modal-md { max-width: 500px; }
.modal-sm { max-width: 420px; }
.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}
.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
}
.btn-close {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-subtle);
  cursor: pointer;
  transition: var(--transition);
}
.btn-close:hover {
  color: var(--rose-500);
}
.modal-body {
  padding: 1.5rem;
  max-height: 75vh;
  overflow-y: auto;
}
.modal-footer {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-app);
}

/* ==========================================================================
   Bulletin / Report Sheet (Algerian Standard)
   ========================================================================== */
.bulletin-sheet {
  background: #ffffff;
  color: #000000;
  padding: 2rem;
  border-radius: var(--radius-md);
  border: 2px solid #1e293b;
  font-family: var(--font-arabic);
}
.bulletin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #000;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}
.b-school-info h3 { font-size: 0.95rem; font-weight: 700; }
.b-school-info h4 { font-size: 1.15rem; font-weight: 900; color: #1e1b4b; }
.b-school-info p { font-size: 0.8rem; color: #475569; }
.b-logo {
  width: 55px;
  height: 55px;
  background: #1e1b4b;
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bulletin-student-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  background: #f8fafc;
  padding: 0.85rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
}
.bulletin-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.5rem;
  scrollbar-width: thin;
}
.bulletin-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}
.bulletin-table th, .bulletin-table td {
  border: 1px solid #94a3b8;
  padding: 0.65rem 0.85rem;
  font-size: 0.86rem;
  text-align: center;
  white-space: nowrap;
}
.bulletin-table th {
  background: #e2e8f0;
  font-weight: 800;
}
.b-total-row {
  background: #f1f5f9;
  font-weight: 800;
}
.b-final-average {
  background: #dbeafe;
  color: #1e40af;
  font-size: 1rem;
}
.bulletin-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
}
.sig-box {
  width: 250px;
  border: 1px dashed #94a3b8;
  padding: 1rem;
  border-radius: 6px;
  text-align: center;
}
.stamp-placeholder {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  font-size: 0.8rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  inset-inline-end: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 2000;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease-out;
}
.toast-success { background: linear-gradient(135deg, #10b981, #059669); }
.toast-error { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.toast-info { background: linear-gradient(135deg, #3b82f6, #2563eb); }

/* Real-time Message Popup Toast */
.realtime-msg-popup {
  position: relative;
  background: var(--bg-surface, #ffffff);
  color: var(--text-main, #0f172a);
  border: 1px solid var(--border-color, #e2e8f0);
  border-inline-start: 4px solid var(--primary-600, #2563eb);
  border-radius: var(--radius-lg, 12px);
  padding: 0.9rem 1.15rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
  min-width: 320px;
  max-width: 400px;
  cursor: pointer;
  overflow: hidden;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease;
  z-index: 2500;
}

.realtime-msg-popup:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
}

.realtime-msg-popup.fade-out {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

.realtime-popup-progress {
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  height: 3.5px;
  width: 100%;
  background: linear-gradient(90deg, var(--primary-500, #3b82f6), var(--emerald-500, #10b981));
  animation: shrinkProgress 4s linear forwards;
}

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


/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes scanLaser {
  0% { top: 0; }
  50% { top: 100%; }
  100% { top: 0; }
}

/* Certificate Designer & Generator Studio Styles */
.badge-tag-btn {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary-600);
  cursor: pointer;
  transition: var(--transition);
}
.badge-tag-btn:hover {
  background: var(--primary-50);
  border-color: var(--primary-500);
  transform: translateY(-1px);
}

.cert-layer.active-selected {
  outline: 2px dashed #3b82f6 !important;
  outline-offset: 4px;
}

.cert-frame-decor.royal-gold-border {
  border: 10px solid #935817;
  outline: 3px solid #030344;
  outline-offset: -18px;
}

.cert-frame-decor.emerald-border {
  border: 8px solid #065f46;
  outline: 2px solid #d97706;
  outline-offset: -14px;
}

.cert-frame-decor.classic-guilloche {
  border: 12px double #1e1b4b;
  outline: 1px solid #94a3b8;
  outline-offset: -16px;
}

.cert-frame-decor.diploma-modern {
  border-top: 10px solid #030344;
  border-bottom: 10px solid #2563eb;
  border-left: 2px solid #cbd5e1;
  border-right: 2px solid #cbd5e1;
}

/* Utilities */
.hidden { display: none !important; }
.flex-1 { flex: 1; }
.rtl-flip { transform: scaleX(-1); }
[dir="ltr"] .rtl-flip { transform: scaleX(1); }

/* Mobile Sidebar Backdrop Overlay */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 990;
  transition: opacity 0.25s ease-in-out;
}
.sidebar-backdrop.hidden {
  display: none !important;
}

/* Bulk Action Bar & Danger Soft Button */
.bulk-action-bar {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(239, 68, 68, 0.15));
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  animation: fadeIn 0.2s ease-in-out;
}
.bulk-action-bar.hidden {
  display: none !important;
}
.bulk-action-info {
  font-weight: 700;
  color: var(--rose-600);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.bulk-action-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-danger-soft {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger-soft:hover {
  background: #ef4444;
  color: #ffffff !important;
}
.btn-danger {
  background: #ef4444;
  color: #ffffff;
  border: 1px solid #dc2626;
}
.btn-danger:hover {
  background: #dc2626;
}

/* ==========================================================================
   Responsive Breakpoints System (Desktop, Tablet, Mobile)
   ========================================================================== */

/* 1. Large Tablets & Small Laptops (<= 1200px) */
@media (max-width: 1200px) {
  .content-area {
    padding: 1.25rem;
  }
  .dashboard-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .finance-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .recent-tables-grid {
    grid-template-columns: 1fr;
  }
}

/* 2. Tablets (<= 1024px) */
@media (max-width: 1024px) {
  .dashboard-grid-2col,
  .attendance-grid-layout,
  .payment-modal-layout,
  .settings-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }
  
  .filter-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
  .filter-item.search-filter {
    grid-column: span 2;
  }
  .filter-btn-wrapper {
    grid-column: span 2;
    justify-content: flex-start;
  }
}

/* 3. Mobile Landscape & Tablets Portrait (<= 768px) */
@media (max-width: 768px) {
  :root {
    --topbar-height: 58px;
  }

  .content-area {
    padding: 1rem 0.85rem;
  }

  /* Sidebar Drawer on Mobile & Tablets - Hidden by default */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    width: 280px !important;
    z-index: 1000 !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: none !important;
  }
  
  /* RTL slide: hidden to the right by default */
  [dir="rtl"] .sidebar,
  html:not([dir="ltr"]) .sidebar {
    right: 0 !important;
    left: auto !important;
    transform: translateX(100%) !important;
  }
  [dir="rtl"] .sidebar.mobile-open,
  html:not([dir="ltr"]) .sidebar.mobile-open {
    transform: translateX(0) !important;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.55) !important;
  }

  /* LTR slide: hidden to the left by default */
  [dir="ltr"] .sidebar {
    left: 0 !important;
    right: auto !important;
    transform: translateX(-100%) !important;
  }
  [dir="ltr"] .sidebar.mobile-open {
    transform: translateX(0) !important;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.55) !important;
  }

  .main-wrapper,
  .sidebar ~ .main-wrapper,
  .sidebar.collapsed ~ .main-wrapper,
  [dir="rtl"] .sidebar.collapsed ~ .main-wrapper,
  [dir="ltr"] .sidebar.collapsed ~ .main-wrapper,
  html:not([dir="ltr"]) .sidebar.collapsed ~ .main-wrapper {
    margin: 0 !important;
    margin-inline-start: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Topbar Mobile Layout */
  .topbar {
    padding: 0 0.65rem;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
  }

  .topbar-left {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    min-width: 0;
  }

  .mobile-menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    cursor: pointer;
  }

  .global-search-wrapper {
    flex: 1;
    max-width: 160px;
    min-width: 80px;
  }
  .search-input {
    height: 34px;
    font-size: 0.78rem;
    padding-inline-start: 1.85rem;
    padding-inline-end: 0.5rem;
  }
  .global-search-wrapper .search-icon {
    width: 14px;
    height: 14px;
    inset-inline-start: 0.55rem;
  }
  .search-shortcut {
    display: none !important;
  }
  .academic-year-pill {
    display: none !important;
  }

  .topbar-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
  }
  #btn-open-scanner-top span {
    display: none;
  }
  #btn-open-scanner-top {
    padding: 0 0.5rem;
    height: 34px;
  }
  .btn-icon, .btn-icon-pill {
    height: 34px;
  }

  /* View Header Mobile Wrap */
  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
  }
  .view-header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .view-header-actions .btn {
    flex: 1;
    min-width: 130px;
    justify-content: center;
    font-size: 0.82rem;
  }

  /* Dashboard Hero Mobile */
  .dashboard-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.25rem;
    gap: 1rem;
  }
  .hero-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Form Grids on Mobile */
  .form-grid,
  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }

  /* Filter Bar Mobile */
  .filter-chips-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    scrollbar-width: thin;
  }
  .filter-chips-bar .chip-item {
    flex-shrink: 0;
  }

  /* Cards Grid 1-column on mobile */
  .cards-grid {
    grid-template-columns: 1fr !important;
    padding: 0.85rem;
    gap: 0.85rem;
  }
  .cohorts-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem;
  }
  .teachers-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem;
  }

  /* Modals Mobile Sheet / Responsive Dialog */
  .modal-backdrop {
    padding: 0.5rem;
    align-items: flex-end;
  }
  .modal-dialog {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    max-height: 92vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
  .modal-content {
    max-height: 92vh;
    display: flex;
    flex-direction: column;
  }
  .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem;
  }
  .modal-footer {
    flex-direction: column-reverse;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
  }
  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }

  /* Bulk Action Floating Dock */
  .bulk-action-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 0.65rem;
  }
  .bulk-action-buttons {
    width: 100%;
    display: flex;
  }
  .bulk-action-buttons .btn {
    flex: 1;
    justify-content: center;
  }

  /* Receipt and Card Preview on Mobile */
  .id-card-preview {
    transform: scale(0.9);
    transform-origin: top center;
    margin-bottom: -15px;
  }
  .thermal-receipt {
    max-width: 100%;
    width: 100%;
  }

  /* Bulletin Sheet Mobile */
  .bulletin-sheet {
    padding: 0.85rem 0.65rem;
    overflow: hidden;
  }
  .bulletin-header {
    flex-direction: column;
    text-align: center;
    gap: 0.65rem;
  }
  .bulletin-student-row {
    grid-template-columns: 1fr !important;
    gap: 0.4rem;
    font-size: 0.82rem;
    padding: 0.65rem 0.75rem;
  }
  .bulletin-table-wrapper {
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    width: calc(100% + 0.5rem);
  }
  .bulletin-table th, .bulletin-table td {
    padding: 0.45rem 0.5rem;
    font-size: 0.78rem;
  }
  .bulletin-signatures {
    flex-direction: column;
    gap: 1rem;
    width: 100%;
  }
  .sig-box {
    width: 100%;
  }
}

/* 4. Small Mobile Phones (<= 480px) */
@media (max-width: 480px) {
  .topbar {
    padding: 0 0.5rem;
  }
  .global-search-wrapper {
    max-width: 120px;
  }
  .search-input {
    font-size: 0.78rem;
    padding: 0.4rem 0.5rem;
  }
  .topbar-right {
    gap: 0.25rem;
  }
  .btn-icon-pill {
    padding: 0 0.4rem;
    font-size: 0.78rem;
  }
  #current-lang-label {
    display: none;
  }

  .dashboard-kpi-grid,
  .finance-stats-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }

  .kpi-card,
  .f-stat-card {
    padding: 1rem;
  }

  .scanner-viewport {
    height: 180px;
  }

  .tab-nav-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .tab-nav-bar .btn {
    flex-shrink: 0;
    font-size: 0.78rem;
    padding: 0.4rem 0.75rem;
  }
}

/* Broadcast & Communications View Styles */
.broadcast-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 992px) {
  .broadcast-layout-grid {
    grid-template-columns: 1fr !important;
  }
}
.academic-year-pill select {
  background: transparent;
  border: none;
  color: inherit;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
}
.academic-year-pill select option {
  background: var(--bg-surface);
  color: var(--text-main);
}
.report-term-tabs .term-tab-btn {
  border-radius: 9999px;
  font-weight: 700;
  transition: var(--transition);
}

/* Dedicated Print Stylesheet for A4 Reports & Bulletins */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 15mm;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt !important;
  }
  body * {
    visibility: hidden;
  }
  .print-active, .print-active * {
    visibility: visible;
  }
  .print-active {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    background: #ffffff !important;
  }
  .sidebar, .topbar, .app-topbar, .modal-backdrop, .modal-footer, .btn, .view-header-actions, .report-term-tabs, .filter-card, .pagination-footer {
    display: none !important;
  }
  .bulletin-sheet, .printable-a4-document {
    width: 100% !important;
    max-width: 100% !important;
    border: 1px solid #94a3b8 !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
  }
}

/* ==========================================================================
   Certificate Designer & Studio Styles
   ========================================================================== */
.cert-studio-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .cert-studio-layout {
    grid-template-columns: 1fr !important;
  }
  .cert-canvas-viewport {
    padding: 0.75rem !important;
  }
}

.cert-canvas-viewport {
  width: 100%;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #0f172a;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  min-height: 480px;
}

.cert-canvas-a4 {
  width: 800px;
  height: 565px;
  position: relative;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  border-radius: 4px;
  overflow: hidden;
  user-select: none;
  flex-shrink: 0;
  transition: transform 0.15s ease-out;
}

.cert-decorative-frame {
  position: absolute;
  inset: 12px;
  pointer-events: none;
}

.cert-decorative-frame.royal-gold-border {
  border: 4px solid #935817;
  outline: 2px solid #030344;
  outline-offset: 6px;
  box-shadow: inset 0 0 0 1px #935817;
}

.cert-decorative-frame.emerald-border {
  border: 4px solid #059669;
  outline: 2px dashed #065f46;
  outline-offset: 6px;
  box-shadow: inset 0 0 0 2px #34d399;
}

.cert-decorative-frame.classic-academic-border {
  border: 6px double #0f172a;
  outline: 1px solid #94a3b8;
  outline-offset: 8px;
}

.cert-decorative-frame.language-diploma-border {
  border: 3px solid #1e3a8a;
  outline: 2px solid #935817;
  outline-offset: 5px;
  box-shadow: inset 0 0 0 1px #93c5fd;
}

.selected-layer {
  outline: 2px dashed #2563eb !important;
  outline-offset: 4px;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.35);
}

.badge-tag-btn {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.badge-tag-btn:hover {
  background: var(--primary-50);
  border-color: var(--primary-500);
  color: var(--primary-600);
}

/* ==========================================================================
   Student Portal Main Grid - RTL (Right pass) / LTR (Right pass swap)
   ========================================================================== */
#student-main-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* In LTR (English / French), place the Digital Pass Card on the right side */
html[dir="ltr"] #student-main-grid,
body[dir="ltr"] #student-main-grid {
  grid-template-columns: 1fr 360px !important;
}

html[dir="ltr"] #student-pass-column,
body[dir="ltr"] #student-pass-column {
  order: 2 !important;
}

html[dir="ltr"] #student-content-column,
body[dir="ltr"] #student-content-column {
  order: 1 !important;
}

@media (max-width: 992px) {
  #student-main-grid,
  html[dir="ltr"] #student-main-grid,
  body[dir="ltr"] #student-main-grid {
    grid-template-columns: 1fr !important;
  }
  html[dir="ltr"] #student-pass-column,
  body[dir="ltr"] #student-pass-column {
    order: 1 !important;
  }
  html[dir="ltr"] #student-content-column,
  body[dir="ltr"] #student-content-column {
    order: 2 !important;
  }
}

/* ==========================================================================
   Backup Actions & SMTP Settings Card Fixes
   ========================================================================== */
.backup-actions {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.75rem;
}

.backup-actions .btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.backup-actions .btn:hover {
  background: var(--bg-hover);
  border-color: var(--primary-500);
  color: var(--primary-600);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.backup-actions .btn i,
.backup-actions .btn svg {
  color: var(--primary-500);
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.settings-smtp-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.settings-smtp-card .card-body {
  padding: 1.75rem;
}

.settings-smtp-card .form-group {
  margin-bottom: 1rem;
}

.settings-smtp-card input.form-control {
  border-radius: var(--radius-md);
}

.smtp-sender-row {
  margin-top: 1.5rem !important;
  padding-top: 1.5rem !important;
  border-top: 1px solid var(--border-color) !important;
}

.smtp-bottom-action-row {
  margin-top: 1.5rem !important;
  padding-top: 1.5rem !important;
  border-top: 1px solid var(--border-color) !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 1.25rem !important;
  padding-bottom: 0.5rem !important;
}

.smtp-test-group {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  flex: 1 !important;
  min-width: 280px !important;
  flex-wrap: wrap !important;
}

/* Global Spacing Utilities */
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-4 { margin-top: 1rem !important; }
.mt-5 { margin-top: 1.25rem !important; }
.mt-6 { margin-top: 1.5rem !important; }
.pt-1 { padding-top: 0.25rem !important; }
.pt-2 { padding-top: 0.5rem !important; }
.pt-3 { padding-top: 0.75rem !important; }
.pt-4 { padding-top: 1rem !important; }
.pt-5 { padding-top: 1.25rem !important; }
.pt-6 { padding-top: 1.5rem !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem !important; }
.mb-5 { margin-bottom: 1.25rem !important; }
.mb-6 { margin-bottom: 1.5rem !important; }


/* Timetable styling */
.timetable-table th {
  background: var(--primary-900, #0f172a);
  color: #ffffff;
  padding: 0.85rem 0.5rem;
  font-weight: 800;
  font-size: 0.85rem;
}

.timetable-table td {
  padding: 0.75rem 0.5rem;
  vertical-align: middle;
  min-height: 75px;
}

.timetable-slot-card {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.timetable-slot-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-400);
}

/* ==========================================================================
   Comprehensive Utility Classes & Spacing
   ========================================================================== */
.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.p-5 { padding: 2rem !important; }
.p-6 { padding: 2.5rem !important; }

.px-0 { padding-left: 0 !important; padding-right: 0 !important; }
.px-1 { padding-left: 0.25rem !important; padding-right: 0.25rem !important; }
.px-2 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
.px-3 { padding-left: 1rem !important; padding-right: 1rem !important; }
.px-4 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
.px-5 { padding-left: 2rem !important; padding-right: 2rem !important; }

.py-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.py-5 { padding-top: 2rem !important; padding-bottom: 2rem !important; }

.m-0 { margin: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 2rem !important; }

.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 2rem !important; }

/* Enhanced Finance Hub Specific Padding & Spacing */
.finance-toolbar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem !important;
  margin-top: 0.75rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.fin-subview {
  display: none !important;
  padding-top: 0.5rem;
  animation: fadeInSubView 0.25s ease-out;
}

.fin-subview.active {
  display: block !important;
}

.fin-subview .card.p-4 {
  padding: 1.5rem !important;
}

.fin-subview .card.p-3 {
  padding: 1.25rem !important;
}

/* ==========================================================================
   Universal Phone Number LTR Enforcement (BiDi Arabic Inversion Fix)
   ========================================================================== */
a[href^="tel:"],
.contact-phone-text,
.phone-number,
.phone-val,
.phone-text,
.student-phone,
.parent-phone,
.badge-parent-phone,
#badge-parent-phone,
#profile-phone,
#profile-parent-phone,
#quick-student-phone,
#quick-parent-phone,
#teacher-phone,
#setting-phone,
#setting-whatsapp,
#reg-phone,
#reg-parent-phone,
#stu-phone,
#stu-parent-phone,
#contact-phone-link,
#hero-teacher-phone,
#nav-parent-phone,
.ltr-phone,
.ltr-number,
.phone,
[data-phone] {
  direction: ltr !important;
  unicode-bidi: embed !important;
  display: inline-block;
  text-align: left;
}

[dir="rtl"] a[href^="tel:"],
[dir="rtl"] .contact-phone-text,
[dir="rtl"] .phone-number,
[dir="rtl"] .phone-val,
[dir="rtl"] .phone-text,
[dir="rtl"] .student-phone,
[dir="rtl"] .parent-phone,
[dir="rtl"] .badge-parent-phone,
[dir="rtl"] #badge-parent-phone,
[dir="rtl"] #profile-phone,
[dir="rtl"] #profile-parent-phone,
[dir="rtl"] #quick-student-phone,
[dir="rtl"] #quick-parent-phone,
[dir="rtl"] #teacher-phone,
[dir="rtl"] #setting-phone,
[dir="rtl"] #setting-whatsapp,
[dir="rtl"] #reg-phone,
[dir="rtl"] #reg-parent-phone,
[dir="rtl"] #stu-phone,
[dir="rtl"] #stu-parent-phone,
[dir="rtl"] #contact-phone-link,
[dir="rtl"] #hero-teacher-phone,
[dir="rtl"] #nav-parent-phone,
[dir="rtl"] .ltr-phone,
[dir="rtl"] .ltr-number,
[dir="rtl"] .phone,
[dir="rtl"] [data-phone] {
  direction: ltr !important;
  unicode-bidi: embed !important;
  display: inline-block;
  text-align: left;
}

[dir="rtl"] input[type="tel"],
[dir="rtl"] input[name*="phone"],
[dir="rtl"] input[id*="phone"],
[dir="rtl"] input[id*="whatsapp"] {
  direction: ltr !important;
  unicode-bidi: embed !important;
  text-align: right;
}

