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

@font-face {
  font-family: 'Tajawal';
  src: url('../fonts/Tajawal-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Tajawal';
  src: url('../fonts/Tajawal-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Tajawal';
  src: url('../fonts/Tajawal-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

: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: 'Tajawal', '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;
}

/* ==========================================================================
   Root Viewport & Scrollbar Placement (RTL Arabic Scrollbar on Opposite / Right Side)
   ========================================================================== */
/* In browsers, root direction determines which side the viewport scrollbar appears on.
   By setting html direction to LTR, the scrollbar is placed on the RIGHT side.
   Setting body direction to RTL ensures 100% Arabic text, flexbox, and layout flow remain untouched. */
html[dir="rtl"],
html:not([dir="ltr"]) {
  direction: ltr;
}

html[dir="rtl"]>body,
html:not([dir="ltr"])>body {
  direction: rtl;
}

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

/* High-contrast, permanent modern scrollbars (prevents scrollbars from auto-hiding / disappearing) */
* {
  scrollbar-width: auto;
  scrollbar-color: #64748b #f1f5f9;
}

body.theme-dark *,
html.theme-dark * {
  scrollbar-color: #64748b #0f172a;
}

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

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

body.theme-dark ::-webkit-scrollbar-track {
  background: #0f172a;
}

::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 6px;
  border: 2px solid #f1f5f9;
  min-height: 48px;
}

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

body.theme-dark ::-webkit-scrollbar-thumb {
  background: #475569;
  border-color: #0f172a;
}

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

/* ==========================================================================
   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);
}

[dir="rtl"] .sidebar,
html:not([dir="ltr"]) .sidebar {
  right: 0 !important;
  left: auto !important;
}

[dir="ltr"] .sidebar {
  left: 0 !important;
  right: auto !important;
}

.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,
.sidebar.collapsed .nav-item svg,
.sidebar.collapsed .nav-item .lucide {
  margin: 0 !important;
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  flex-shrink: 0 !important;
}

.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,
.nav-item svg,
.nav-item .lucide {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}

.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;
}

/* Enhanced Notification Center & Dropdown */
.btn-icon.has-badge {
  position: relative;
}

.notif-count-badge {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.45);
  animation: notifPulse 2.5s infinite ease-in-out;
  pointer-events: none;
  border: 2px solid var(--bg-surface);
  line-height: 1;
}

@keyframes notifPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

.dropdown-menu-large {
  width: 390px;
  max-width: calc(100vw - 1.5rem);
  padding: 0;
  border-radius: var(--radius-lg, 14px);
  box-shadow: 0 14px 40px -10px rgba(0, 0, 0, 0.22), 0 4px 14px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color);
  overflow: hidden;
  background: var(--bg-surface);
  z-index: 1000;
}

.notif-panel-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle, rgba(0,0,0,0.02));
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notif-filter-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  background: var(--bg-subtle, rgba(0,0,0,0.02));
  border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.06));
  overflow-x: auto;
  scrollbar-width: none;
}

.notif-filter-tabs::-webkit-scrollbar {
  display: none;
}

.notif-tab-btn {
  background: transparent;
  border: none;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.notif-tab-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}

.notif-tab-btn.active {
  background: var(--color-primary, #2563eb);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.notif-list {
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.notif-item {
  display: flex;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.05));
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  align-items: flex-start;
}

.notif-item:hover {
  background: var(--bg-card-hover, rgba(0,0,0,0.03));
}

.notif-item.unread {
  background: rgba(37, 99, 235, 0.04);
}

.notif-item.unread::before {
  content: '';
  position: absolute;
  top: 14px;
  inset-inline-start: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary, #2563eb);
}

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

.notif-icon svg {
  width: 18px;
  height: 18px;
}

.notif-body {
  flex: 1;
  min-width: 0;
}

.notif-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}

.notif-item-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

.notif-badge-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.notif-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 4px;
  word-break: break-word;
}

.notif-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-top: 2px;
}

.notif-action-hint {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-primary, #2563eb);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.notif-empty-state {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.notif-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.75rem auto;
  opacity: 0.4;
  color: var(--color-primary);
}

.notif-dropdown-footer {
  padding: 0.6rem 1rem;
  background: var(--bg-subtle, rgba(0,0,0,0.02));
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   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-purple {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #ffffff !important;
  border-color: #7c3aed;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.28);
}

.btn-purple:hover {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  border-color: #6d28d9;
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.4);
  transform: translateY(-1px);
  color: #ffffff !important;
}

.btn-dark-orange {
  background: linear-gradient(135deg, #ea580c, #c2410c);
  color: #ffffff !important;
  border-color: #c2410c;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.35);
}

.btn-dark-orange:hover {
  background: linear-gradient(135deg, #c2410c, #9a3412);
  border-color: #9a3412;
  box-shadow: 0 6px 16px rgba(234, 88, 12, 0.45);
  transform: translateY(-1px);
  color: #ffffff !important;
}

.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.online {
  background: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4), 0 0 6px rgba(16, 185, 129, 0.6) !important;
  animation: presencePulse 2.2s infinite ease-in-out;
}

.student-status-dot.offline {
  background: #94a3b8 !important;
  box-shadow: 0 0 0 1.5px rgba(148, 163, 184, 0.3) !important;
}

@keyframes presencePulse {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4), 0 0 4px rgba(16, 185, 129, 0.5);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2), 0 0 10px rgba(16, 185, 129, 0.85);
  }
}

.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 {
  color: #ef4444 !important;
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.05);
}

.btn-action-icon.btn-action-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.5);
  color: #dc2626 !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 {
  background: #dcfce7 !important;
  color: #15803d !important;
  border-bottom: 2px solid #86efac;
  padding: 0.65rem 1rem;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.verification-badge span {
  color: #15803d !important;
  font-weight: 800;
}

.verification-badge i,
.verification-badge svg {
  color: #16a34a !important;
  width: 18px;
  height: 18px;
}

.verification-badge.bg-emerald-500 {
  background-color: #dcfce7 !important;
  color: #15803d !important;
}

[data-theme="dark"] .verification-badge {
  background: rgba(34, 197, 94, 0.18) !important;
  border-bottom: 2px solid rgba(74, 222, 128, 0.35) !important;
}

[data-theme="dark"] .verification-badge span,
[data-theme="dark"] .verification-badge i,
[data-theme="dark"] .verification-badge svg {
  color: #4ade80 !important;
}

.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 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr));
  gap: 1.25rem;
}

.teachers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 1.25rem;
}

.teacher-card {
  box-sizing: border-box;
  min-width: 0;
  overflow: hidden;
}

.teacher-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.teacher-actions-bar {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-shrink: 0;
}

.teacher-speciality-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(37, 99, 235, 0.09);
  color: var(--primary-700, #1d4ed8);
  border: 1px solid rgba(59, 130, 246, 0.28);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.4;
  margin: 0.4rem 0 0.85rem 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

[data-theme="dark"] .teacher-speciality-badge {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.4);
}

.teacher-card-footer {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.teacher-footer-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 580px) {
  .teachers-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  .teacher-card-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .teacher-footer-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
  }
  .teacher-footer-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 0.45rem 0.5rem;
    font-size: 0.78rem;
  }
}

.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-directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
}

.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;
  box-sizing: border-box;
  min-width: 0;
}

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

@media (max-width: 580px) {
  #staff-directory-grid {
    grid-template-columns: 1fr !important;
  }
}

/* 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: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  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: 16px;
  padding: 6px 0;
}

.badge-media-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.badge-photo {
  width: 82px;
  height: 96px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid #ffffff;
  background: #1e293b;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

.badge-qr-box {
  background: #ffffff;
  padding: 3px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.badge-details {
  flex: 1;
  min-width: 0;
  text-align: right;
}

.badge-student-name {
  font-size: 1.25rem;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 6px;
  line-height: 1.2;
}

.badge-row {
  font-size: 0.88rem;
  margin-bottom: 4px;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-row strong {
  color: #93c5fd;
  font-weight: 700;
}

.badge-row .ltr-phone {
  direction: ltr !important;
  unicode-bidi: embed !important;
  display: inline-block;
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  color: #fde047;
}

.id-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: #cbd5e1;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 6px;
}

/* ==========================================================================
   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 spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@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;
}

/* Webcam Toggle Dynamic States */
#btn-toggle-webcam.btn-emerald {
  background: #16a34a !important;
  border-color: #15803d !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.35) !important;
  font-weight: 700;
}
#btn-toggle-webcam.btn-emerald:hover {
  background: #15803d !important;
  border-color: #166534 !important;
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.45) !important;
}
#btn-toggle-webcam.btn-danger {
  background: #dc2626 !important;
  border-color: #b91c1c !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35) !important;
  font-weight: 700;
}
#btn-toggle-webcam.btn-danger:hover {
  background: #b91c1c !important;
  border-color: #991b1b !important;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.45) !important;
}

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

/* 1. Large Tablets & Small Laptops (<= 1200px) */
@media (max-width: 1200px) {
  .content-area {
    padding: 1.25rem;
  }

  .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 {
    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.85);
    transform-origin: top center;
    margin: 0.5rem auto -20px auto;
  }

  #modal-student-card .modal-body {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
  }

  @media (max-width: 380px) {
    .id-card-preview {
      transform: scale(0.78);
      transform-origin: top center;
      margin: 0.5rem auto -30px auto;
    }
  }

  .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;
  }

  .topbar-right {
    gap: 0.25rem;
  }

  .btn-icon-pill {
    padding: 0 0.4rem;
    font-size: 0.78rem;
  }

  #current-lang-label {
    display: none;
  }

  .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 {
    width: 100% !important;
    max-width: 100% !important;
    border: 1px solid #94a3b8 !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
  }

  .printable-a4-document {
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: none !important;
    page-break-inside: auto !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
   ========================================================================== */
.btn-success {
  background: linear-gradient(135deg, #059669, #10b981) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25) !important;
}

.btn-success:hover {
  background: linear-gradient(135deg, #047857, #059669) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35) !important;
}

.btn-warning {
  background: linear-gradient(135deg, #d97706, #f59e0b) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25) !important;
}

.btn-warning:hover {
  background: linear-gradient(135deg, #b45309, #d97706) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35) !important;
}

.btn-indigo {
  background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25) !important;
}

.btn-indigo:hover {
  background: linear-gradient(135deg, #4338ca, #4f46e5) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35) !important;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.85rem;
  margin-bottom: 1rem;
}

.backup-actions .btn {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  height: auto;
  min-height: 38px;
  line-height: 1.3;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.82rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  white-space: normal;
}

.backup-actions .btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.backup-actions .btn i,
.backup-actions .btn svg {
  color: inherit !important;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .backup-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
  }

  .backup-actions .btn {
    width: 100%;
    padding: 0.4rem 0.55rem;
    font-size: 0.77rem;
    gap: 0.35rem;
  }
}

@media (max-width: 440px) {
  .backup-actions {
    grid-template-columns: 1fr;
  }
}

/* Dual Backup History Tabs & Tables */
.backup-history-card {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
}

.backup-tabs-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  background: var(--bg-surface-2, #f1f5f9);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 4px;
  flex-wrap: wrap;
}

.backup-tab-btn {
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.backup-tab-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #1e293b;
}

.backup-tab-btn.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
  border-color: #1d4ed8 !important;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.35) !important;
}

.backup-tab-btn.active .badge-pill {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
}

.cloud-vault-auth-box {
  background: rgba(99, 102, 241, 0.04);
  border: 1.5px dashed rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.25rem;
  text-align: center;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.backup-table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  -webkit-overflow-scrolling: touch;
}

.backup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: right;
}

.backup-table th {
  background: var(--bg-card-hover);
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.backup-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
  white-space: nowrap;
}

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

.backup-table tr:hover td {
  background: var(--bg-card-hover);
}

.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 (Days across Top, Times down Side) */
.timetable-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}

.timetable-table th {
  background: var(--primary-900, #0f172a);
  color: #ffffff;
  padding: 0.85rem 0.5rem;
  font-weight: 800;
  font-size: 0.85rem;
  white-space: nowrap;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.timetable-table th:first-child {
  min-width: 135px;
  width: 135px;
  position: sticky;
  z-index: 2;
  background: #090d16;
}

html[dir="rtl"] .timetable-table th:first-child,
html[dir="rtl"] .timetable-table td:first-child {
  right: 0;
  left: auto;
}

html[dir="ltr"] .timetable-table th:first-child,
html[dir="ltr"] .timetable-table td:first-child {
  left: 0;
  right: auto;
}

.timetable-table td {
  padding: 0.65rem 0.5rem;
  vertical-align: top;
  min-height: 70px;
  border-bottom: 1px solid var(--border-color);
  border-left: 1px solid var(--border-color);
}

.timetable-table td:first-child {
  position: sticky;
  z-index: 1;
  background: var(--bg-surface);
  font-weight: 800;
  vertical-align: middle;
  text-align: center;
}

.timetable-slot-card {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.55rem 0.55rem;
  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;
}

/* ==========================================================================
   Sidebar Backdrop & Utility Fixes
   ========================================================================== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 999;
}

.sidebar-backdrop:not(.hidden) {
  display: block;
}

.hidden {
  display: none !important;
}

/* Mobile Student Actions */
.mobile-student-actions {
  display: none;
}

@media (max-width: 768px) {
  .mobile-student-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.45rem;
    flex-wrap: wrap;
  }

  .col-actions {
    display: none !important;
  }
}

/* Cohorts & Assign Students Mobile Grid */
@media (max-width: 640px) {
  .assign-tabs-nav {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.4rem !important;
    width: 100% !important;
  }

  .assign-tabs-nav .assign-gender-tab {
    width: 100% !important;
    justify-content: center !important;
    font-size: 0.75rem !important;
    padding: 0.45rem 0.35rem !important;
  }

  /* #view-classes header actions moved to unified 768px mobile block */
}

/* #view-finance header actions moved to unified 768px block */

/* .btn-lime Custom Style */
.btn-lime {
  background: linear-gradient(135deg, #84cc16 0%, #65a30d 100%) !important;
  color: #ffffff !important;
  border: 1px solid #65a30d !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 6px rgba(101, 163, 13, 0.3) !important;
}

.btn-lime:hover {
  background: linear-gradient(135deg, #65a30d 0%, #4d7c0f 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(101, 163, 13, 0.4) !important;
}

/* #view-teachers header actions moved to unified 768px block */

#btn-chat-mobile-back {
  display: none;
}

/* Communications Mobile Chat App */
@media (max-width: 768px) {
  #subview-inbox-container {
    grid-template-columns: 1fr !important;
  }

  #subview-inbox-container:not([style*="display: none"]):not([style*="display:none"]) {
    display: flex !important;
    flex-direction: column !important;
    min-height: 560px;
  }

  #subview-inbox-container:not(.mobile-chat-open)>.card:nth-child(2),
  #subview-inbox-container:not(.mobile-chat-open) #admin-inbox-chat-panel {
    display: none !important;
  }

  #subview-inbox-container.mobile-chat-open>.card:nth-child(1),
  #subview-inbox-container.mobile-chat-open #admin-inbox-threads-panel {
    display: none !important;
  }

  #subview-inbox-container.mobile-chat-open>.card:nth-child(2),
  #subview-inbox-container.mobile-chat-open #admin-inbox-chat-panel {
    display: flex !important;
    flex: 1 1 auto;
    min-height: 520px;
  }

  #subview-inbox-container.mobile-chat-open #admin-chat-messages-body {
    flex: 1 1 auto !important;
    max-height: none !important;
    min-height: 0 !important;
  }

  #btn-chat-mobile-back {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
  }

  [dir="ltr"] #btn-chat-mobile-back i,
  [dir="ltr"] #btn-chat-mobile-back svg {
    transform: scaleX(-1);
  }

  #admin-chat-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  #admin-chat-header #chat-active-subject {
    width: 100%;
    order: 3;
    font-size: 0.78rem;
  }

  .broadcast-layout-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Communications Responsive Adjustments */
@media (max-width: 640px) {
  #view-broadcast .view-header-actions {
    width: 100%;
  }

  #view-broadcast .view-header-actions .tab-nav-bar {
    flex-direction: column;
    width: 100%;
  }

  #view-broadcast .view-header-actions .tab-nav-bar button {
    width: 100%;
    justify-content: center;
  }

  .broadcast-actions-container {
    flex-direction: column;
  }

  .broadcast-actions-container button {
    width: 100%;
    justify-content: center;
  }

  #btn-broadcast-dispatch-all-inline {
    order: 1;
  }

  #btn-broadcast-send-test-inline {
    order: 2;
  }
}

/* Broadcast Message Body Resizing */
#broadcast-body,
#broadcast-body-textarea {
  min-height: 220px !important;
  resize: vertical !important;
  line-height: 1.75;
}

/* Communications Center Inbox & Chat Console Refinements */
#subview-inbox-container {
  min-height: 500px;
  height: clamp(500px, calc(100vh - 220px), 620px);
}

#admin-inbox-threads-panel,
#admin-inbox-chat-panel {
  height: 100%;
}

#admin-chat-messages-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-y: auto;
}

#admin-inbox-reply-container {
  margin-top: auto !important;
  padding: 0.65rem 1.15rem !important;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
  flex-shrink: 0 !important;
}

#admin-msg-reply-form {
  display: flex !important;
  gap: 0.65rem !important;
  align-items: center !important;
  margin: 0 !important;
}

#admin-reply-body {
  min-height: 42px !important;
  height: 42px !important;
  max-height: 100px !important;
  padding: 0.5rem 0.85rem !important;
  line-height: 1.4 !important;
  margin: 0 !important;
  resize: none !important;
  box-sizing: border-box !important;
}


/* ==========================================================================
   Mobile Attendance & Student Directory Responsive Refinements
   ========================================================================== */

/* 1. Mobile Attendance Header Buttons (Stacked & Full Text Visibility) */
@media (max-width: 768px) {
  #view-attendance .view-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
    margin-bottom: 1rem !important;
  }

  #view-attendance .view-title {
    font-size: 1.3rem !important;
    line-height: 1.3 !important;
  }

  #view-attendance .view-subtitle {
    font-size: 0.8rem !important;
    line-height: 1.4 !important;
    margin-top: 0.25rem !important;
  }

  #view-attendance .view-header-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }

  #view-attendance .view-header-actions #btn-mark-all-present {
    grid-column: 1 / -1 !important;
    min-height: 42px !important;
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    justify-content: center !important;
    width: 100% !important;
  }

  #view-attendance .view-header-actions #btn-export-all-attendance-pdf,
  #view-attendance .view-header-actions #btn-export-class-attendance-pdf {
    min-height: 40px !important;
    font-size: 0.78rem !important;
    justify-content: center !important;
    padding: 0.45rem 0.5rem !important;
    width: 100% !important;
  }
}

@media (max-width: 440px) {
  #view-attendance .view-header-actions {
    grid-template-columns: 1fr !important;
  }
}

/* 2. Today's Attendance Sheet Table: Desktop Column Sizing */
@media (min-width: 769px) {
  #view-attendance .data-table th:first-child,
  #view-attendance .data-table td:first-child,
  #view-attendance .col-student-cell,
  .col-student-cell {
    min-width: 200px !important;
    white-space: nowrap !important;
  }

  .attendance-student-row {
    display: flex !important;
    align-items: center !important;
    gap: 0.65rem !important;
    white-space: nowrap !important;
  }

  .attendance-student-row>div {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    white-space: nowrap !important;
  }
}

.attendance-ref-pill {
  display: inline-block !important;
  white-space: nowrap !important;
  font-size: 0.72rem !important;
  font-family: monospace !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  letter-spacing: 0.03em !important;
}

/* 3. Student Page: "Enroll New Student" Button First on Mobile */
@media (max-width: 768px) {
  #view-students .view-header-actions {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }

  #view-students .view-header-actions #btn-open-add-student-modal {
    order: -1 !important;
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center !important;
  }

  #view-students .view-header-actions .btn {
    width: 100% !important;
    justify-content: center !important;
  }
}

/* 4. Classes & Cohorts Page: "Create New Cohort" Button On Top & All Action Buttons Stacked Under Each Other on Mobile */
@media (max-width: 768px) {
  #view-classes .view-header-actions {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.6rem !important;
    align-items: stretch !important;
  }

  #view-classes .view-header-actions #btn-add-class-modal {
    order: -1 !important;
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
  }

  #cohorts-header-actions,
  #timetable-header-actions {
    order: 2 !important;
    width: 100% !important;
  }

  #cohorts-header-actions:not([style*="display: none"]):not([style*="display:none"]) {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }

  #timetable-header-actions:not([style*="display: none"]):not([style*="display:none"]) {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }

  #cohorts-header-actions[style*="display: none"],
  #cohorts-header-actions[style*="display:none"],
  #timetable-header-actions[style*="display: none"],
  #timetable-header-actions[style*="display:none"] {
    display: none !important;
  }

  #cohorts-header-actions .btn,
  #timetable-header-actions .btn {
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    white-space: normal !important;
    line-height: 1.35 !important;
  }
}

/* ==========================================================================
   UI / UX Enhancements: Finance, Faculty, Communications & Settings (Mobile & All Sizes)
   ========================================================================== */

/* 1. Global Styles for Payroll Voucher Button (Lime Green) & Commission Models (Purple) */
[onclick*="showTeacherVoucher"],
.btn-teacher-voucher,
#btn-print-teacher-voucher {
  background: linear-gradient(135deg, #84cc16 0%, #65a30d 100%) !important;
  color: #ffffff !important;
  border: 1px solid #65a30d !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 6px rgba(101, 163, 13, 0.35) !important;
}

[onclick*="showTeacherVoucher"]:hover,
.btn-teacher-voucher:hover,
#btn-print-teacher-voucher:hover {
  background: linear-gradient(135deg, #65a30d 0%, #4d7c0f 100%) !important;
  box-shadow: 0 4px 10px rgba(101, 163, 13, 0.45) !important;
  transform: translateY(-1px);
}

#btn-page-manage-comm-models,
#btn-open-comm-models-mgr {
  background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%) !important;
  border: 1px solid #7e22ce !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(147, 51, 234, 0.35) !important;
}

#btn-page-manage-comm-models:hover,
#btn-open-comm-models-mgr:hover {
  background: linear-gradient(135deg, #7e22ce 0%, #6b21a8 100%) !important;
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.5) !important;
  transform: translateY(-1px);
}

/* 2. Communications Center Online / Offline Status Dot Styling */
.chat-avatar-wrapper {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.chat-avatar-wrapper .status-dot {
  position: absolute;
  bottom: 0;
  inset-inline-end: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface, #fff);
  box-sizing: border-box;
}

.badge .status-dot,
.status-pill .status-dot {
  position: static !important;
  display: inline-block !important;
  vertical-align: middle;
}

.status-dot.online {
  background: #84cc16 !important;
  border-color: #65a30d !important;
  box-shadow: 0 0 0 2px rgba(132, 204, 22, 0.3) !important;
}

.status-dot.offline {
  background: #ef4444 !important;
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3) !important;
}

/* 3. Invoices & Receipts Ledger Table: Receipt # and Date Columns (One Single Line on Mobile) */
#fin-subview-tuition .data-table th:first-child,
#fin-subview-tuition .data-table td:first-child,
.col-receipt-num {
  white-space: nowrap !important;
  min-width: 140px !important;
}

#fin-subview-tuition .data-table th:nth-child(8),
#fin-subview-tuition .data-table td:nth-child(8),
.col-receipt-date {
  white-space: nowrap !important;
  min-width: 110px !important;
}

/* 4. Mobile Responsive Rules (< 768px) */
@media (max-width: 768px) {

  /* A. Finance Page Header Actions */
  #view-finance .view-header-actions {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }

  #view-finance .view-header-actions .btn {
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
  }

  #btn-open-payment-modal {
    order: 1 !important;
  }

  #btn-open-expense-modal {
    order: 2 !important;
  }

  #btn-export-financial-statement {
    order: 3 !important;
    white-space: normal !important;
    line-height: 1.35 !important;
    padding: 0.65rem 0.85rem !important;
    height: auto !important;
  }

  /* B. Faculty & Payroll Management Header Actions */
  #view-teachers .view-header-actions,
  #view-staff .view-header-actions {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }

  #view-teachers .view-header-actions .btn,
  #view-staff .view-header-actions .btn {
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center !important;
    text-align: center !important;
  }

  #btn-add-teacher-modal {
    order: 1 !important;
  }

  #btn-page-manage-comm-models {
    order: 2 !important;
  }

  #btn-export-faculty-pdf {
    order: 3 !important;
    white-space: normal !important;
    line-height: 1.35 !important;
    height: auto !important;
  }

  /* C. Add New Teacher Modal Header */
  #modal-add-teacher-form .modal-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    position: relative !important;
    gap: 0.75rem !important;
    padding-top: 2.25rem !important;
  }

  #modal-add-teacher-form .modal-header .modal-close-btn {
    position: absolute !important;
    top: 0.75rem !important;
    left: 0.75rem !important;
  }

  [dir="ltr"] #modal-add-teacher-form .modal-header .modal-close-btn {
    left: auto !important;
    right: 0.75rem !important;
  }

  #modal-teacher-form-title {
    white-space: nowrap !important;
    font-size: clamp(0.92rem, 3.8vw, 1.2rem) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
    text-align: start !important;
  }

  #modal-add-teacher-form #btn-open-comm-models-mgr {
    width: 100% !important;
    justify-content: center !important;
    min-height: 44px !important;
    order: 2 !important;
  }

  /* D. Communications Center Mobile Chat App */
  #admin-msg-reply-form {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    gap: 0.5rem !important;
    align-items: center !important;
    margin: 0 !important;
  }

  #admin-msg-reply-form>div {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  #admin-reply-body {
    width: 100% !important;
    min-height: 42px !important;
    height: 42px !important;
    max-height: 90px !important;
    resize: none !important;
    font-size: 0.88rem !important;
    padding: 0.5rem 0.75rem !important;
    margin: 0 !important;
  }

  #admin-msg-reply-form button[type="submit"] {
    width: auto !important;
    min-height: 42px !important;
    height: 42px !important;
    padding: 0 0.85rem !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    justify-content: center !important;
  }

  #admin-inbox-reply-container {
    margin-top: auto !important;
    padding: 0.5rem 0.75rem !important;
  }

  #btn-chat-mobile-back {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    background: #ef4444 !important;
    border: 1px solid #dc2626 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35) !important;
  }

  #btn-chat-mobile-back:hover {
    background: #dc2626 !important;
    color: #ffffff !important;
  }

  #btn-chat-mobile-back i,
  #btn-chat-mobile-back svg {
    stroke: #ffffff !important;
  }

  #view-broadcast .view-header-actions,
  #view-broadcast .view-header-actions .tab-nav-bar {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }

  #btn-tab-inbox,
  #btn-tab-campaigns {
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
  }

  /* E. School Settings & System Config Page */
  #view-settings .view-title {
    white-space: nowrap !important;
    font-size: clamp(1.1rem, 4.2vw, 1.55rem) !important;
  }

  #card-school-branding .card-header,
  .card-header-stacked {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 0.35rem !important;
    width: 100% !important;
  }

  [data-i18n="school_logo_branding_title"] {
    white-space: nowrap !important;
    font-size: clamp(0.75rem, 3.5vw, 1.15rem) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
    width: 100% !important;
    line-height: 1.3 !important;
  }

  [data-i18n="school_logo_branding_desc"] {
    font-size: clamp(0.72rem, 2.8vw, 0.84rem) !important;
    display: block !important;
    width: 100% !important;
    margin-top: 0.15rem !important;
    line-height: 1.4 !important;
  }

  .logo-actions-container {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }

  /* Update Password stacked above Save System button on mobile */
  .security-action-buttons {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.6rem !important;
    margin: 0.75rem 0 0 0 !important;
  }

  .security-action-buttons #btn-change-admin-password {
    order: 1 !important;
    width: 100% !important;
    min-width: 100% !important;
    margin: 0 !important;
  }

  .security-action-buttons #btn-save-settings-security {
    order: 2 !important;
    width: 100% !important;
    min-width: 100% !important;
    margin: 0 !important;
  }

  /* Save SMTP Settings screen width on mobile */
  .smtp-save-btn-container {
    width: 100% !important;
    display: flex !important;
    justify-content: stretch !important;
    margin-top: 0.5rem !important;
  }

  .smtp-save-btn-container #btn-save-smtp-settings {
    width: 100% !important;
    min-width: 100% !important;
    margin: 0 !important;
  }

  .card-footer-save {
    width: 100% !important;
  }

  /* Screen-wide buttons on mobile in Settings */
  #btn-trigger-logo-upload,
  #btn-reset-default-logo,
  #btn-save-settings-logo,
  .btn-save-settings-inline,
  #btn-save-settings,
  #btn-save-tva-settings,
  #btn-change-admin-password,
  #btn-create-cloud-now,
  #btn-sync-cloud,
  #btn-refresh-cloud-backups,
  #btn-lock-cloud-vault,
  #btn-toggle-cloud-vault,
  #btn-submit-unlock-cloud,
  #btn-tab-smtp-google,
  #btn-tab-smtp-brevo,
  #btn-tab-smtp-custom,
  #btn-save-smtp-settings,
  #btn-test-smtp-connection {
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
  }

  .settings-smtp-card .tab-nav-bar,
  .smtp-bottom-action-row,
  .smtp-test-group,
  .cloud-vault-auth-box form,
  .backup-actions {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }

  .smtp-test-group input,
  .cloud-vault-auth-box input {
    max-width: 100% !important;
    width: 100% !important;
  }

  #pane-cloud-backups .card-header-actions,
  #cloud-vault-unlocked-panel>div:first-child>div:last-child {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }
}

/* ==========================================================================
   Email Templates & Settings Customizer
   ========================================================================== */
.tpl-var-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--bg-surface, #ffffff);
  border: 1px solid rgba(37, 99, 235, 0.25);
  color: var(--color-primary, #2563eb);
  font-size: 0.76rem;
  font-family: monospace;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  user-select: none;
}

.tpl-var-chip:hover {
  background: var(--color-primary, #2563eb);
  color: #ffffff;
  border-color: var(--color-primary, #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.tpl-var-chip:active {
  transform: translateY(0);
}

.tpl-var-chip .var-desc {
  font-weight: 400;
  font-size: 0.7rem;
  opacity: 0.8;
}

@media (max-width: 1024px) {
  #tpl-editor-main-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   Comprehensive Mobile & Tablet Responsiveness for Attendance Page (#view-attendance)
   ========================================================================== */

/* 1. Mobile Segmented Navigation Switcher */
.attendance-mobile-nav {
  display: none;
}

@media (max-width: 768px) {
  .attendance-mobile-nav {
    display: flex !important;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 4px;
    gap: 4px;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
  }

  .att-mobile-tab-btn {
    flex: 1 1 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 42px;
  }

  .att-mobile-tab-btn.active {
    background: var(--primary-600);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
  }

  .att-mobile-tab-btn i {
    width: 18px;
    height: 18px;
  }

  /* Grid collapse & tab panel switching on mobile: cards must be normal vertical blocks */
  .attendance-grid-layout {
    display: block !important;
    width: 100% !important;
  }

  .attendance-grid-layout[data-active-tab="sheet"] .attendance-panel-scanner {
    display: none !important;
  }
  .attendance-grid-layout[data-active-tab="sheet"] .attendance-panel-sheet {
    display: block !important;
    width: 100% !important;
  }

  .attendance-grid-layout[data-active-tab="scanner"] .attendance-panel-sheet {
    display: none !important;
  }
  .attendance-grid-layout[data-active-tab="scanner"] .attendance-panel-scanner {
    display: block !important;
    width: 100% !important;
  }

  .attendance-sheet-card,
  .scanner-card {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

@media (min-width: 769px) {
  .attendance-mobile-nav {
    display: none !important;
  }
  .attendance-grid-layout {
    display: grid !important;
    grid-template-columns: 1fr 1.3fr !important;
    gap: 1.5rem !important;
  }
  .attendance-grid-layout .attendance-panel-scanner,
  .attendance-grid-layout .attendance-panel-sheet {
    display: block !important;
    width: auto !important;
  }
}

/* 2. Scanner Card Mobile Responsiveness */
@media (max-width: 768px) {
  .scanner-card .card-body {
    padding: 1rem !important;
  }

  .scanner-viewport-wrapper {
    padding: 0.75rem 0 !important;
  }

  .scanner-viewport {
    max-width: 100% !important;
    width: min(260px, 82vw) !important;
    height: auto !important;
    aspect-ratio: 7 / 6 !important;
  }

  .scanner-mode-selector {
    display: flex !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }

  .scanner-mode-selector .btn {
    flex: 1 1 50% !important;
    min-height: 40px !important;
    justify-content: center !important;
    font-size: 0.82rem !important;
  }

  .scanner-input-bar {
    display: flex !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }

  .scanner-input-bar #barcode-manual-input {
    height: 42px !important;
    font-size: 16px !important;
    width: 100% !important;
  }

  .scanner-input-bar #btn-trigger-scan {
    height: 42px !important;
    min-width: 72px !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

  .badge-test-list {
    justify-content: center !important;
    gap: 0.4rem !important;
  }

  .test-pill {
    padding: 0.35rem 0.6rem !important;
    font-size: 0.75rem !important;
    min-height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  .verified-student-card {
    margin-top: 1rem !important;
  }

  .verified-body {
    padding: 0.85rem !important;
    gap: 0.75rem !important;
  }

  .verified-avatar {
    width: 50px !important;
    height: 50px !important;
  }

  .verified-name {
    font-size: 1rem !important;
    word-break: break-word !important;
  }
}

/* 3. Searchable Class Dropdown in Today's Attendance Sheet */
.attendance-sheet-card {
  overflow: visible !important;
}

.attendance-sheet-card .card-header {
  overflow: visible !important;
  position: relative;
  z-index: 50;
}

.sheet-filter-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.custom-class-dropdown {
  position: relative;
  min-width: 220px;
  max-width: 360px;
  flex: 1 1 240px;
  width: auto;
}

.custom-class-dropdown .form-control {
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  font-size: 0.85rem;
  height: 38px;
  width: 100%;
}

.custom-class-dropdown .form-control:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.custom-class-dropdown.dropdown-open {
  z-index: 1050;
}

.custom-class-dropdown.dropdown-open #attendance-class-dropdown-toggle {
  transform: translateY(-50%) rotate(180deg) !important;
}

.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  max-height: min(320px, 60vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-lg, 10px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 1050;
  padding: 6px;
  animation: dropdownFadeIn 0.16s ease-out;
}

.custom-dropdown-menu::-webkit-scrollbar {
  width: 6px;
}
.custom-dropdown-menu::-webkit-scrollbar-track {
  background: transparent;
}
.custom-dropdown-menu::-webkit-scrollbar-thumb {
  background: var(--border-color, #cbd5e1);
  border-radius: 4px;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.class-dropdown-item {
  padding: 8px 12px;
  border-radius: var(--radius-md, 6px);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s ease;
  user-select: none;
  border: 1px solid transparent;
  margin-bottom: 3px;
  min-height: 44px;
}

.class-dropdown-item:hover,
.class-dropdown-item.highlighted {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.2);
}

.class-dropdown-item.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(29, 78, 216, 0.15));
  border-color: var(--primary-500);
}

.class-dropdown-item.active .class-item-name {
  color: var(--primary-600) !important;
  font-weight: 800 !important;
}

.class-dropdown-item-main {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.class-dropdown-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.class-item-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-main);
  word-break: break-word;
}

.class-item-code {
  font-family: monospace;
  font-size: 0.68rem;
  padding: 1px 6px;
  flex-shrink: 0;
}

.class-dropdown-item-details {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.class-dropdown-item-details span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.class-dropdown-item-meta {
  text-align: end;
  font-size: 0.72rem;
  flex-shrink: 0;
  margin-inline-start: 8px;
}

body.theme-dark .custom-dropdown-menu {
  background: var(--bg-surface, #1e293b);
  border-color: var(--border-color, #334155);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6);
}

body.theme-dark .class-dropdown-item:hover,
body.theme-dark .class-dropdown-item.highlighted {
  background: rgba(59, 130, 246, 0.15);
}

/* 4. Responsive Overrides for Dropdown & Attendance Filters */
@media (max-width: 768px) {
  .attendance-sheet-card .card-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  .sheet-filter-group {
    flex-direction: column !important;
    gap: 0.6rem !important;
    width: 100% !important;
    align-items: stretch !important;
  }

  .custom-class-dropdown {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
  }

  .custom-class-dropdown .form-control {
    width: 100% !important;
    height: 42px !important;
    font-size: 16px !important; /* Prevents auto-zoom on mobile Safari */
  }

  .sheet-filter-group input[type="date"] {
    width: 100% !important;
    height: 42px !important;
    font-size: 16px !important;
  }

  .custom-dropdown-menu {
    position: absolute !important;
    top: calc(100% + 5px) !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    max-height: min(340px, 60vh) !important;
    border-radius: 12px !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22) !important;
  }

  .class-dropdown-item {
    padding: 10px 12px !important;
    min-height: 48px !important;
  }

  .filter-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }
}

@media (max-width: 480px) {
  .class-dropdown-item {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
  }

  .class-dropdown-item-meta {
    align-self: flex-start !important;
    margin-inline-start: 0 !important;
  }

  .class-item-name {
    font-size: 0.84rem !important;
  }
}

/* 5. Responsive Attendance Table -> Touch-Friendly Card Transformation on Mobile */
@media (max-width: 768px) {
  .attendance-sheet-card .card-body {
    padding: 0 !important;
    background: var(--bg-app) !important;
  }

  .attendance-sheet-card .table-responsive {
    overflow: visible !important;
  }

  .attendance-sheet-card .data-table {
    display: block !important;
    width: 100% !important;
    border: none !important;
    background: transparent !important;
  }

  .attendance-sheet-card .data-table thead {
    display: none !important;
  }

  .attendance-sheet-card .data-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
    padding: 0.75rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .attendance-sheet-card .data-table tr.attendance-table-row {
    display: flex !important;
    flex-direction: column !important;
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    padding: 0.85rem !important;
    gap: 0.65rem !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }

  .attendance-sheet-card .data-table td {
    display: block !important;
    padding: 0 !important;
    border: none !important;
    width: 100% !important;
  }

  .attendance-sheet-card .data-table td.desktop-only-cell {
    display: none !important;
  }

  .attendance-sheet-card .data-table td.mobile-only-cell {
    display: block !important;
  }

  .attendance-status-mobile-only {
    display: flex !important;
    align-items: center !important;
    margin-inline-start: auto !important;
  }

  .attendance-student-row {
    display: flex !important;
    align-items: center !important;
    gap: 0.65rem !important;
    width: 100% !important;
  }

  .attendance-student-avatar {
    width: 44px !important;
    height: 44px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }

  .attendance-student-info {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .attendance-student-name {
    font-size: 0.9rem !important;
    font-weight: 700 !important;
    color: var(--text-main) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .attendance-ref-pill {
    align-self: flex-start !important;
    font-size: 0.7rem !important;
    font-family: monospace !important;
    padding: 1px 6px !important;
  }

  .attendance-mobile-meta-bar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0.35rem 0.65rem !important;
    background: var(--bg-app) !important;
    border-radius: var(--radius-md) !important;
    font-size: 0.76rem !important;
    color: var(--text-muted) !important;
  }

  .attendance-mobile-meta-bar span {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
  }

  .col-action-cell {
    margin-top: 0.15rem !important;
    padding-top: 0.5rem !important;
    border-top: 1px dashed var(--border-color) !important;
  }

  .btn-attendance-action-group {
    display: flex !important;
    width: 100% !important;
    gap: 0.5rem !important;
    align-items: center !important;
  }

  .btn-attendance-action-group .btn {
    flex: 1 1 auto !important;
    min-height: 40px !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: var(--radius-md) !important;
  }

  .btn-attendance-action-group .btn-ghost {
    flex: 0 0 42px !important;
    min-height: 40px !important;
    padding: 0 !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
  }
}

@media (min-width: 769px) {
  .attendance-status-mobile-only {
    display: none !important;
  }
  .mobile-only-cell {
    display: none !important;
  }
  .desktop-only-cell {
    display: table-cell !important;
  }
  .attendance-student-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    white-space: nowrap;
  }
  .attendance-student-avatar {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
  }
  .attendance-student-info {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
  }
  .btn-attendance-action-group {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
  }
}

/* ==========================================================================
   Users & Roles Management & Role Mission Matrix Editor (RBAC) Modern Styles
   ========================================================================== */
.users-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.stat-card-modern {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card-modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

/* User Avatar & Role Badges */
.user-avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  border: 2px solid #ffffff;
}

.badge-role-admin {
  background: #ede9fe !important;
  color: #6d28d9 !important;
  border: 1px solid #c4b5fd !important;
}

.badge-role-pedago {
  background: #dbeafe !important;
  color: #1d4ed8 !important;
  border: 1px solid #93c5fd !important;
}

.badge-role-accountant {
  background: #d1fae5 !important;
  color: #047857 !important;
  border: 1px solid #6ee7b7 !important;
}

.badge-role-registrar {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border: 1px solid #fde68a !important;
}

.badge-role-attendance {
  background: #e0e7ff !important;
  color: #4338ca !important;
  border: 1px solid #a5b4fc !important;
}

/* iOS-Style Toggle Switch */
.switch-toggle-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.switch-toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.25s;
  border-radius: 34px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  inset-inline-start: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.switch-toggle input:checked + .switch-slider {
  background-color: #10b981;
}

.switch-toggle input:checked + .switch-slider:before {
  transform: translateX(16px);
}

[dir="rtl"] .switch-toggle input:checked + .switch-slider:before {
  transform: translateX(-16px);
}

.switch-toggle input:disabled + .switch-slider {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Action Icon Buttons */
.user-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-muted);
}

.user-action-btn:hover {
  background: var(--bg-app);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.user-action-btn.edit:hover {
  color: #2563eb;
  border-color: #93c5fd;
  background: #eff6ff;
}

.user-action-btn.key:hover {
  color: #d97706;
  border-color: #fde68a;
  background: #fffbeb;
}

.user-action-btn.delete:hover {
  color: #ef4444;
  border-color: #fca5a5;
  background: #fef2f2;
}

.user-action-btn.login:hover {
  color: #10b981;
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.user-action-btn.login.active {
  color: #10b981;
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.12);
}

/* Role Mission Matrix Table & Modal Styles */
.role-matrix-table th {
  padding: 12px 14px;
  font-weight: 700;
  border-bottom: 2px solid var(--border-color);
  background: var(--bg-app);
}

.role-matrix-table td {
  padding: 10px 14px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
}

.role-matrix-table tr:hover td {
  background-color: rgba(99, 102, 241, 0.03);
}

.matrix-module-header {
  background: rgba(99, 102, 241, 0.06) !important;
  font-weight: 800;
  color: var(--text-main);
  border-top: 1px solid var(--border-color);
}

.matrix-checkbox-cell {
  text-align: center;
}

.matrix-checkbox-cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #6366f1;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.matrix-checkbox-cell input[type="checkbox"]:hover {
  transform: scale(1.15);
}

.matrix-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.matrix-tab-btn.active {
  background: var(--primary-600) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.matrix-role-pill-btn {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  color: var(--text-muted);
}

.matrix-role-pill-btn:hover {
  background: var(--bg-app);
  border-color: #94a3b8;
}

.matrix-role-pill-btn.active {
  background: #6366f1;
  color: #ffffff;
  border-color: #6366f1;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.role-detail-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  transition: box-shadow 0.2s ease;
}

.role-detail-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.role-detail-card-header {
  padding: 10px 14px;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.role-detail-perm-item {
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.role-detail-perm-item:last-child {
  border-bottom: none;
}

.role-detail-perm-item:hover {
  background: rgba(99, 102, 241, 0.02);
}

/* Mobile & Tablet Card Layout for Users */
.user-card-mobile {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

@media (max-width: 768px) {
  .users-view-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.75rem;
  }
  .users-header-actions {
    width: 100%;
    justify-content: stretch;
  }
  .users-header-actions .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
    font-size: 0.8rem;
  }
  .users-table-card .table-responsive {
    border: none;
  }
  .user-card-mobile {
    display: block;
  }
  .users-data-table {
    min-width: 650px;
  }
  .matrix-editor-toolbar {
    flex-direction: column;
    align-items: stretch !important;
  }
}

/* ==========================================================================
   MODERN SYSTEM AUDIT & ACTIVITY TRAIL (UI/UX)
   ========================================================================== */

.audit-kpi-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.audit-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.audit-filter-pill {
  background: var(--bg-app);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.75rem;
  padding: 4px 12px;
  font-weight: 600;
  transition: all 0.15s ease;
  cursor: pointer;
}
.audit-filter-pill:hover {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--primary-400);
}
.audit-filter-pill.active {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #ffffff !important;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.audit-table tr {
  border-bottom: 1px solid var(--border-color);
  transition: background 0.12s ease;
}
.audit-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.035);
}

.audit-user-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.audit-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.audit-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.audit-badge-login {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.audit-badge-failed {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.audit-badge-create {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
  border: 1px solid rgba(99, 102, 241, 0.25);
}
.audit-badge-update {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.25);
}
.audit-badge-delete {
  background: rgba(225, 29, 72, 0.12);
  color: #e11d48;
  border: 1px solid rgba(225, 29, 72, 0.25);
}
.audit-badge-rbac {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
  border: 1px solid rgba(124, 58, 237, 0.25);
}
.audit-badge-security {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
  border: 1px solid rgba(217, 119, 6, 0.25);
}
.audit-badge-default {
  background: rgba(107, 114, 128, 0.12);
  color: #4b5563;
  border: 1px solid rgba(107, 114, 128, 0.25);
}

.audit-detail-box {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.79rem;
  color: var(--text-main);
  word-break: break-word;
  line-height: 1.4;
}

.audit-ip-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--text-main);
  white-space: nowrap;
  direction: ltr;
}

.audit-time-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
}
.audit-time-main {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}
.audit-time-rel {
  font-size: 0.7rem;
  color: var(--text-muted);
}