/* ═══════════════════════════════════════════════════════════════
   School Management System - Main Design Tokens & Global Styles
   نظام إدارة المدارس الخاصة - نظام التصميم
   ═══════════════════════════════════════════════════════════════ */

/* ─── Local Fonts: Almarai ────────────────────────────── */
@font-face {
  font-family: 'Almarai';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/Almarai-Light.ttf') format('truetype');
}
@font-face {
  font-family: 'Almarai';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/Almarai-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Almarai';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/Almarai-Bold.ttf') format('truetype');
}
@font-face {
  font-family: 'Almarai';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../fonts/Almarai-ExtraBold.ttf') format('truetype');
}

/* Force English Numbers Globally */
@font-face {
  font-family: 'SystemNumbers';
  src: url('../fonts/Almarai-Regular.ttf') format('truetype');
  unicode-range: U+0030-0039;
}

/* Prevent Translation FOUC by hiding only translatable elements until ready */
html:not(.i18n-ready) [data-i18n],
html:not(.i18n-ready) [data-i18n-placeholder],
html:not(.i18n-ready) [data-i18n-title] {
  visibility: hidden;
}

/* ─── CSS Variables (Design Tokens) ─────────────────────────── */
:root {
  /* Primary Palette - Royal Blue */
  --clr-primary-50:  #eef1fd;
  --clr-primary-100: #d5dcfb;
  --clr-primary-200: #aab9f7;
  --clr-primary-300: #7f95f4;
  --clr-primary-400: #5572ef;
  --clr-primary-500: #3B5CE8;
  --clr-primary-600: #2e4fd4;
  --clr-primary-700: #2340b8;
  --clr-primary-800: #1a319c;
  --clr-primary-900: #112280;

  /* Accent - Deep Purple */
  --clr-accent-400: #a855f7;
  --clr-accent-500: #9333ea;
  --clr-accent-600: #8B35C8;

  /* Gradient - Royal Blue → Deep Purple (matching logo) */
  --gradient-primary: linear-gradient(135deg, #3B5CE8 0%, #6344C8 50%, #8B35C8 100%);
  --gradient-card:    linear-gradient(135deg, rgba(59,92,232,0.15) 0%, rgba(139,53,200,0.10) 100%);
  --gradient-sidebar: linear-gradient(180deg, #0d1533 0%, #160828 50%, #1a0630 100%);
  --gradient-hero:    linear-gradient(135deg, #3B5CE8 0%, #8B35C8 100%);

  /* Status */
  --clr-success: #10b981;
  --clr-warning: #f59e0b;
  --clr-danger:  #ef4444;
  --clr-info:    #3b82f6;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 40px rgba(0,0,0,.16), 0 4px 12px rgba(0,0,0,.08);
  --shadow-xl:  0 20px 60px rgba(0,0,0,.22);
  --shadow-purple: 0 8px 32px rgba(59,92,232,.35);
  --shadow-glow:   0 0 20px rgba(99,68,200,.45);

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Typography */
  --font-ar: 'SystemNumbers', 'Almarai', 'Segoe UI', sans-serif;
  --font-en: 'SystemNumbers', 'Almarai', 'Segoe UI', sans-serif;
  --font-size-xs:   0.75rem;
  --font-size-sm:   0.875rem;
  --font-size-base: 1rem;
  --font-size-lg:   1.125rem;
  --font-size-xl:   1.25rem;
  --font-size-2xl:  1.5rem;
  --font-size-3xl:  1.875rem;
  --font-size-4xl:  2.25rem;

  /* Spacing */
  --space-1: 4px;  --space-2: 8px;   --space-3: 12px;
  --space-4: 16px; --space-5: 20px;  --space-6: 24px;
  --space-8: 32px; --space-10: 40px; --space-12: 48px; --space-20: 80px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4,0,0.2,1);

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  --bg-app: #070d22; /* Default to dark to match initial data-theme */
}

/* ─── Prevent Transition Flash on Load ──────────────────────── */

.preload, .preload * {
  transition: none !important;
  -webkit-transition: none !important;
  -moz-transition: none !important;
  -ms-transition: none !important;
  -o-transition: none !important;
}

/* ─── Page Loader (Gears) ────────────────────────────────────── */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 250; /* Above content (50-100), below sidebar (300) */
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
  opacity: 0;
  visibility: hidden;
}

.page-loader.active {
  opacity: 1;
  visibility: visible;
}

.gear-container {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: var(--space-6);
}

.gear {
  position: absolute;
  color: var(--clr-primary-400);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gear-big {
  font-size: 80px;
  top: 0;
  left: 0;
  animation: rotate-right 4s linear infinite;
  color: var(--clr-primary-500);
}

.gear-medium {
  font-size: 50px;
  top: 45px;
  right: 0;
  animation: rotate-left 3s linear infinite;
  color: var(--clr-accent-500);
}

.gear-small {
  font-size: 35px;
  bottom: 0;
  left: 35px;
  animation: rotate-right 2s linear infinite;
  color: var(--clr-primary-300);
}

.loader-text {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 1px;
  text-align: center;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes rotate-right {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes rotate-left {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1); }
}

/* ─── Light Theme ────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-app:       #edf0fd;
  --bg-main:      #f4f6fe;
  --bg-card:      rgba(255,255,255,0.88);
  --bg-card-hover:rgba(255,255,255,0.96);
  --bg-input:     rgba(255,255,255,0.92);
  --bg-input-focus:rgba(255,255,255,1);
  --bg-sidebar:   rgba(13,21,51,0.97);
  --bg-overlay:   rgba(13,21,51,0.4);
  --bg-badge:     var(--clr-primary-100);
  --bg-table-alt: rgba(59,92,232,0.04);

  --text-primary:   #0d1533;
  --text-secondary: #1e40af;
  --text-muted:     #6b7280;
  --text-inverse:   #ffffff;
  --text-on-primary:#ffffff;
  --text-placeholder:rgba(13,21,51,0.35);

  --border-color:  rgba(59,92,232,0.15);
  --border-focus:  var(--clr-primary-500);
  --border-input:  rgba(59,92,232,0.2);
  --divider:       rgba(59,92,232,0.08);

  --backdrop: saturate(180%) blur(20px);
}

/* ─── Dark Theme ─────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-app:       #070d22;
  --bg-main:      #0d1533;
  --bg-card:      rgba(255,255,255,0.04);
  --bg-card-hover:rgba(255,255,255,0.07);
  --bg-input:     rgba(255,255,255,0.05);
  --bg-input-focus:rgba(255,255,255,0.08);
  --bg-sidebar:   rgba(5,10,28,0.98);
  --bg-overlay:   rgba(0,0,0,0.6);
  --bg-badge:     rgba(59,92,232,0.22);
  --bg-table-alt: rgba(255,255,255,0.02);

  --text-primary:   #ffffff;
  --text-secondary: #cbd5fe;
  --text-muted:     #9ca3af;
  --text-inverse:   #0d1533;
  --text-on-primary:#ffffff;
  --text-placeholder:rgba(232,238,255,0.45);

  --border-color:  rgba(85,114,239,0.15);
  --border-focus:  var(--clr-primary-400);
  --border-input:  rgba(85,114,239,0.2);
  --divider:       rgba(255,255,255,0.06);

  --backdrop: saturate(150%) blur(20px);
}

/* ─── Dark Mode: Select / Dropdown Polish ─────────────────────── */
[data-theme="dark"] .form-select,
[data-theme="dark"] select.form-input,
[data-theme="dark"] select {
  background-color: #0b1228;
  color: #e8eeff;
  border-color: rgba(85, 114, 239, 0.3);
}

[data-theme="dark"] .form-select:focus,
[data-theme="dark"] select.form-input:focus,
[data-theme="dark"] select:focus {
  background-color: #0f1836;
  border-color: var(--clr-primary-400);
  box-shadow: 0 0 0 3px rgba(59, 92, 232, 0.25);
  color: #ffffff;
}

[data-theme="dark"] select option,
[data-theme="dark"] .form-select option,
[data-theme="dark"] select.form-input option {
  background-color: #0b1228;
  color: #e8eeff;
  padding: 10px 14px;
}

[data-theme="dark"] select optgroup,
[data-theme="dark"] .form-select optgroup {
  background-color: #070d22;
  color: var(--clr-primary-300);
  font-weight: 700;
}

/* ─── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-ar);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-app);
  transition: background var(--transition-slow), color var(--transition-slow);
  overflow-x: clip;
  direction: rtl;
}

h1 {
  font-size: clamp(1.7rem, 2.3vw, 2.9rem) !important;
  line-height: 1.2;
  font-weight: 800;
}

h2 {
  font-size: clamp(1.35rem, 1.8vw, 2.2rem) !important;
  line-height: 1.25;
  font-weight: 800;
}

body.lang-en { 
  font-family: var(--font-en); 
  direction: ltr; 
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { 
  background: var(--clr-primary-400); 
  border-radius: var(--radius-full); 
}
::-webkit-scrollbar-thumb:hover { background: var(--clr-primary-500); }

/* ─── Layout Shell ───────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ─── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: var(--sidebar-width);
  background: var(--gradient-sidebar);
  backdrop-filter: blur(20px);
  border-left: 1px solid rgba(59,92,232,0.15);
  display: flex;
  flex-direction: column;
  z-index: 300;
  transition: transform var(--transition-base), width var(--transition-base);
  overflow: hidden;
}

/* Remove blur on mobile to prevent screen freezing */
@media (max-width: 768px) {
  .sidebar {
    backdrop-filter: none;
  }
}

body.lang-en .sidebar { right: auto; left: 0; border-left: none; border-right: 1px solid rgba(59,92,232,0.15); }

.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
@media (min-width: 769px) and (max-width: 1200px) {
  :root:not(.sidebar-expanded) .sidebar { width: var(--sidebar-collapsed); }
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-4);
  min-height: var(--header-height);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: relative;
  overflow: hidden;
}

.sidebar__logo::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  opacity: 0.08;
}

.sidebar__logo-icon {
  width: 40px;
  height: 40px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.sidebar__logo-text {
  flex: 1;
  overflow: hidden;
}

.sidebar__logo-title {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__logo-sub {
  font-size: var(--font-size-xs);
  color: rgba(147,170,253,0.7);
  white-space: nowrap;
}

.sidebar-collapsed .sidebar .sidebar__logo-text { display: none; }
@media (min-width: 769px) and (max-width: 1200px) {
  :root:not(.sidebar-expanded) .sidebar .sidebar__logo-text { display: none; }
}

/* Nav */
.sidebar__nav {
  flex: 1;
  padding: var(--space-4) var(--space-2) var(--space-4) var(--space-2);
  overflow-y: auto;
  overflow-x: clip;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.95);
  padding: var(--space-3) var(--space-3) var(--space-2);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-base);
}

.sidebar-collapsed .sidebar .nav-section-title { opacity: 0; }
@media (min-width: 769px) and (max-width: 1200px) {
  :root:not(.sidebar-expanded) .sidebar .nav-section-title { opacity: 0; }
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: rgba(255,255,255,0.9);
  margin-bottom: 2px;
  white-space: nowrap;
}

.nav-item:hover {
  color: white;
  background: rgba(59,92,232,0.15);
}

.nav-item.active {
  color: white;
  background: rgba(59, 92, 232, 0.35) !important;
  border-radius: var(--radius-md);
}

.nav-item.active .nav-item__icon {
  background: var(--gradient-primary) !important;
  box-shadow: 0 0 15px rgba(59, 92, 232, 0.6) !important;
  color: white !important;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  right: 6px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  background: var(--clr-primary-400);
  box-shadow: 0 0 15px var(--clr-primary-400);
  border-radius: var(--radius-full);
}

body.lang-en .nav-item.active::before { right: auto; left: 6px; }

.nav-item__icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 18px;
  flex-shrink: 0;
  transition: all var(--transition-base);
}

.nav-item.active .nav-item__icon {
  background: var(--gradient-primary);
  box-shadow: var(--shadow-purple);
  color: white;
}

.nav-item__label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  flex: 1;
  transition: opacity var(--transition-slow);
}

.sidebar-collapsed .sidebar .nav-item__label { opacity: 0; width: 0; }
@media (min-width: 769px) and (max-width: 1200px) {
  :root:not(.sidebar-expanded) .sidebar .nav-item__label { opacity: 0; width: 0; }
}

.nav-item__badge {
  background: var(--gradient-primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  transition: opacity var(--transition-slow);
}

.sidebar-collapsed .sidebar .nav-item__badge { opacity: 0; }
@media (min-width: 769px) and (max-width: 1200px) {
  :root:not(.sidebar-expanded) .sidebar .nav-item__badge { opacity: 0; }
}

/* Hide submenus ONLY when sidebar is collapsed */
.sidebar-collapsed .sidebar .nav-submenu {
  display: none;
}

/* For medium screens where sidebar is collapsed by default */
@media (min-width: 769px) and (max-width: 1200px) {
  :root:not(.sidebar-expanded) .sidebar .nav-submenu {
    display: none;
  }
}

/* Sidebar Sub-menu */
.nav-submenu {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-5px);
  transition: 
    max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-submenu.open { 
  max-height: 500px; 
  opacity: 1;
  transform: translateY(0);
}

/* Hide submenus specifically when the sidebar is NOT expanded or in mobile sidebar mode */
@media (max-width: 768px) {
  .sidebar:not(.mobile-open) .nav-submenu {
    display: none;
  }
}

.nav-subitem {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-10);
  font-size: var(--font-size-xs);
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  text-decoration: none;
}

body.lang-en .nav-subitem { padding: var(--space-2) var(--space-3) var(--space-2) var(--space-10); }

.nav-subitem:hover { color: white; background: rgba(255,255,255,0.05); }
.nav-subitem.active { 
  color: white; 
  background: rgba(255, 255, 255, 0.05); 
  font-weight: 700;
}

.nav-subitem::before {
  content: '';
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.3s;
}

.nav-subitem.active::before {
  background: var(--clr-primary-400);
  box-shadow: 0 0 10px var(--clr-primary-400);
  transform: scale(1.2);
}

/* Sidebar Footer */
.sidebar__footer {
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

/* Exit button inside footer */
.sidebar__exit-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  color: rgba(255,255,255,0.75);
  margin-bottom: var(--space-2);
  white-space: nowrap;
}

.sidebar__exit-btn:hover {
  color: white;
  background: rgba(239,68,68,0.15);
}

.sidebar__exit-btn .nav-item__icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 18px;
  flex-shrink: 0;
  transition: all var(--transition-base);
}

.sidebar__exit-btn:hover .nav-item__icon {
  background: rgba(239,68,68,0.2);
}

/* Hide labels when collapsed */
.sidebar-collapsed .sidebar .sidebar__exit-btn .nav-item__label { opacity: 0; width: 0; overflow: hidden; }
@media (min-width: 769px) and (max-width: 1200px) {
  :root:not(.sidebar-expanded) .sidebar .sidebar__exit-btn .nav-item__label { opacity: 0; width: 0; overflow: hidden; }
}

.sidebar__divider-h {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: var(--space-2) 0;
}


.sidebar__user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-base);
}

.sidebar__user:hover { background: rgba(255,255,255,0.05); }

.sidebar__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.sidebar__user-info { overflow: hidden; flex: 1; }

.sidebar__user-name {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__logout {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar__logout:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.sidebar__user-role {
  font-size: 11px;
  color: rgba(147,170,253,0.5);
  white-space: nowrap;
}

.sidebar-collapsed .sidebar .sidebar__user-info { display: none; }
@media (min-width: 769px) and (max-width: 1200px) {
  :root:not(.sidebar-expanded) .sidebar .sidebar__user-info { display: none; }
}

/* ─── Main Content ────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-right: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
  transition: margin var(--transition-slow);
}

/* RTL (Default/Arabic) */
.sidebar-collapsed .main-content,
:root.sidebar-collapsed .main-content { 
  margin-right: var(--sidebar-collapsed); 
}

@media (min-width: 769px) and (max-width: 1200px) {
  :root:not(.sidebar-expanded) .main-content { 
    margin-right: var(--sidebar-collapsed); 
  }
}

/* LTR (English) Override */
html[dir="ltr"] .main-content { 
  margin-right: 0 !important; 
  margin-left: var(--sidebar-width) !important; 
}

html[dir="ltr"].sidebar-collapsed .main-content { 
  margin-right: 0 !important; 
  margin-left: var(--sidebar-collapsed) !important; 
}

@media (min-width: 769px) and (max-width: 1200px) {
  html[dir="ltr"]:not(.sidebar-expanded) .main-content { 
    margin-right: 0 !important; 
    margin-left: var(--sidebar-collapsed) !important; 
  }
}

/* ─── Header ──────────────────────────────────────────────────── */
.header {
  height: var(--header-height);
  background: var(--bg-card);
  backdrop-filter: var(--backdrop);
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background var(--transition-slow);
}

.header__toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.header__toggle:hover { background: var(--clr-primary-500); color: white; border-color: transparent; }

/* Header Branding */
.header__branding {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-inline-start: var(--space-2);
  border-inline-start: 1px solid var(--divider);
  margin-inline-start: var(--space-2);
  transition: opacity var(--transition-base);
}

.header__branding:hover {
  opacity: 0.8;
}

.header__branding-logo {
  width: 32px;
  height: 32px;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.header__branding-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.header__branding-name {
  font-size: var(--font-size-sm);
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  letter-spacing: 0.5px;
}

@media (max-width: 600px) {
  .header__branding-name {
    display: none;
  }
  .header__branding {
    border: none;
    margin: 0;
    padding: 0;
  }
}

.header__breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.header__breadcrumb span { 
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header__breadcrumb-current { color: var(--text-primary); font-weight: 600; flex-shrink: 0; }

.header__search {
  display: none !important;
}

.header__search input {
  width: 100%;
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-10);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-input);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-family: inherit;
  outline: none;
  transition: all var(--transition-base);
}

body.lang-en .header__search input { padding: var(--space-2) var(--space-10) var(--space-2) var(--space-4); }

.header__search input:focus {
  border-color: var(--clr-primary-500);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(59,92,232,0.15);
}

.header__search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}

body.lang-en .header__search-icon { left: auto; right: var(--space-3); }

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  margin-inline-start: auto;
}

.header__btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition-base);
  position: relative;
}

.header__btn:hover { background: var(--clr-primary-500); color: white; border-color: transparent; }

.header__btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: var(--clr-danger);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lang-toggle {
  padding: 0 var(--space-3);
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--font-size-xs);
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.5px;
  transition: all var(--transition-base);
}

.lang-toggle:hover { background: var(--clr-primary-500); color: white; border-color: transparent; }

.theme-toggle {
  width: auto;
  min-width: 36px;
  height: 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-2);
  position: relative;
  transition: all var(--transition-base);
  font-size: 18px;
}

.theme-toggle:hover { background: var(--clr-primary-500); color: white; border-color: transparent; }

.theme-toggle__icon-single { 
  font-size: 18px; 
  transition: transform var(--transition-base); 
  display: inline-flex;
}

.theme-toggle__track {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-1);
}

.theme-toggle__icon { font-size: 14px; transition: opacity var(--transition-base); z-index: 1; }

.theme-toggle__thumb {
  position: absolute;
  width: 24px;
  height: 24px;
  background: var(--gradient-primary);
  border-radius: 50%;
  transition: transform var(--transition-base);
  box-shadow: var(--shadow-purple);
  inset-inline-start: 4px;
}

[data-theme="dark"] .theme-toggle__thumb { transform: translateX(-32px); }
html[dir="ltr"] [data-theme="dark"] .theme-toggle__thumb,
body.lang-en [data-theme="dark"] .theme-toggle__thumb { transform: translateX(32px); }

/* ─── Page Content ────────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: var(--space-6);
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ─── Page Header ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
  flex-wrap: wrap;
}

.page-title {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* ─── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--backdrop);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}



.card--glass {
  background: linear-gradient(135deg, rgba(59,92,232,0.08) 0%, rgba(139,53,200,0.05) 100%);
  border-color: rgba(59,92,232,0.2);
}

.card__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--divider);
}

.card__header-icon {
  width: 40px;
  height: 40px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  box-shadow: var(--shadow-purple);
  flex-shrink: 0;
}

.card__title {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--text-primary);
}

.card__body { padding: var(--space-6); }
.card__body--compact { padding: var(--space-4); }

/* ─── Permission Badge (Not Allowed) ─────────────────────────── */
.badge-not-allowed {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: rgba(239, 68, 68, 0.1);
  color: var(--clr-danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  white-space: nowrap;
  user-select: none;
  letter-spacing: 0.3px;
}

/* ─── Form Elements ───────────────────────────────────────────── */
.form-grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* ─── Custom Checkbox Design ─────────────────────────────────── */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-input);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-base);
  display: inline-grid;
  place-content: center;
  flex-shrink: 0;
  margin: 0;
}

input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  transition: transform 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46);
  background-color: white;
  /* Drawing a checkmark using clip-path */
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

input[type="checkbox"]:checked {
  background: var(--gradient-primary);
  border-color: transparent;
  box-shadow: var(--shadow-purple);
  transform: scale(1.05);
}

input[type="checkbox"]:checked::before {
  transform: scale(1);
}

input[type="checkbox"]:hover {
  border-color: var(--clr-primary-400);
  background: var(--bg-card-hover);
  box-shadow: 0 0 8px rgba(59,92,232,0.2);
}

input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,92,232,0.2);
}

/* Label styling next to checkbox */
label[for] {
  cursor: pointer;
  user-select: none;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}

.form-grid--2 { grid-template-columns: repeat(2, 1fr); }
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.form-grid--4 { grid-template-columns: repeat(4, 1fr); }

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-group--full { grid-column: 1 / -1; }

.form-label,
.info-label,
.setting-label,
.config-label,
.label {
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--text-primary); /* Unified Neutral Color */
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.form-label .required {
  color: var(--clr-danger);
  font-size: 14px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  height: 42px;
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-family: inherit;
  outline: none;
  transition: all var(--transition-base);
  -webkit-appearance: none;
  appearance: none;
}

.form-select, select.form-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237f95f4' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  background-size: 14px;
  padding-left: 36px;
  padding-right: 14px;
}

body.lang-en .form-select, body.lang-en select.form-input,
[dir="ltr"] .form-select, [dir="ltr"] select.form-input {
  background-position: right 12px center;
  padding-left: 14px;
  padding-right: 36px;
}

.form-textarea {
  height: auto;
  min-height: 80px;
  resize: vertical;
  padding: var(--space-3);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-placeholder); }

.form-input:hover,
.form-select:hover,
.form-textarea:hover { border-color: var(--clr-primary-400); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--clr-primary-500);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(59,92,232,0.15);
}

input.form-input.readonly,
input.form-input[readonly],
input.form-input:read-only,
textarea.form-input.readonly,
textarea.form-input[readonly],
textarea.form-input:read-only,
.form-input[disabled],
.form-input:disabled,
.form-select[disabled],
.form-select:disabled {
  background-color: var(--bg-surface) !important;
  cursor: not-allowed !important;
  opacity: 0.85 !important;
}

select.form-input:not(:disabled),
select.form-select:not(:disabled) {
  cursor: pointer !important;
}

/* Select Wrapper (Legacy/Generic Support) */
.select-wrapper {
  position: relative;
}

/* We prefer background-image now, but keeping this for any non-select wrappers if needed */
.select-wrapper::after {
  display: none;
}

/* Radio Group */
.radio-group {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-1) 0;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-input);
  background: var(--bg-input);
  transition: all var(--transition-base);
  user-select: none;
}

.radio-option:hover { border-color: var(--clr-primary-400); }

.radio-option input[type="radio"] { display: none; }

.radio-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.radio-option input:checked + .radio-dot {
  border-color: var(--clr-primary-500);
  background: var(--clr-primary-500);
}

.radio-dot::after {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: white;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.radio-option input:checked + .radio-dot::after { opacity: 1; }

.radio-option:has(input:checked) {
  border-color: var(--clr-primary-500);
  background: rgba(59,92,232,0.08);
  color: var(--clr-primary-400);
  font-weight: 500;
}

.radio-label { font-size: var(--font-size-sm); }

/* ─── Photo Upload ────────────────────────────────────────────── */
.photo-upload {
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.photo-preview {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border-input);
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: all var(--transition-base);
  position: relative;
}

.photo-preview:hover {
  border-color: var(--clr-primary-500);
  background: rgba(59,92,232,0.05);
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-preview__icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  color: var(--text-muted);
  font-size: 24px;
}

.photo-preview__icon span {
  font-size: 10px;
  font-weight: 500;
}

.photo-upload__btn {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: white;
  font-size: var(--font-size-xs);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow-purple);
  transition: all var(--transition-base);
}

.photo-upload__btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-glow); }

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  height: 44px; /* Increased slightly for better prominence */
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all var(--transition-slow);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  user-select: none;
  border: 1.5px solid transparent;
}

.btn i {
  font-size: 0.9rem;
  line-height: 1;
  color: inherit;
}

.btn-primary i {
  color: #ffffff !important;
}

/* Premium Motion */
.btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-purple);
  border: none;
}
.btn-primary:hover:not(:disabled) { box-shadow: var(--shadow-glow); }

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1.5px solid var(--border-color);
}
.btn-secondary:hover:not(:disabled) { 
  background: var(--bg-card-hover); 
  border-color: var(--clr-primary-400); 
  color: var(--clr-primary-500);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover:not(:disabled) { box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4); }

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}
.btn-success:hover:not(:disabled) { box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4); }

/* Sizes & Variants */
.btn-sm { height: 34px; padding: var(--space-1) var(--space-3); font-size: var(--font-size-xs); }
.btn-lg { height: 54px; padding: var(--space-3) var(--space-8); font-size: var(--font-size-base); }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: 50% !important; display: flex; align-items: center; justify-content: center; }
.btn-sm.btn-icon { width: 34px; height: 34px; }
.btn-pill { border-radius: var(--radius-full); }

/* Loading State */
.btn.loading {
  pointer-events: none;
  position: relative;
  color: transparent !important;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: calc(50% - 10px);
  left: calc(50% - 10px);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.6s linear infinite;
}

.btn-secondary.loading::after {
  border-color: rgba(59,92,232,0.1);
  border-top-color: var(--clr-primary-500);
}

/* ─── Stat Cards ──────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  backdrop-filter: var(--backdrop);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 100px; height: 100px;
  background: var(--gradient-primary);
  border-radius: 50%;
  opacity: 0.06;
  transform: translate(30%, -30%);
}



.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon--primary { background: rgba(59,92,232,0.15); color: var(--clr-primary-400); }
.stat-icon--success { background: rgba(16,185,129,0.15); color: var(--clr-success); }
.stat-icon--warning { background: rgba(245,158,11,0.15); color: var(--clr-warning); }
.stat-icon--info    { background: rgba(59,130,246,0.15);  color: var(--clr-info); }

.stat-num {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.stat-trend {
  font-size: var(--font-size-xs);
  color: var(--clr-success);
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: var(--space-1);
}

/* ─── Tables ──────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.data-table th {
  padding: var(--space-3) var(--space-4);
  text-align: right;
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--divider);
  white-space: nowrap;
}

body.lang-en .data-table th { text-align: left; }

.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--divider);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:hover { background: rgba(59, 92, 232, 0.04); }
.data-table tr:last-child td { border-bottom: none; }

.receipt-no {
  font-family: monospace;
  font-weight: 600;
  color: var(--clr-primary-400);
  background: rgba(59, 92, 232, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.amount-val {
  font-weight: 800;
  color: var(--clr-success);
}

/* ─── Badges & Tags ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.badge--primary { background: rgba(59,92,232,0.15); color: var(--clr-primary-400); }
.badge--success { background: rgba(16,185,129,0.15); color: var(--clr-success); }
.badge--warning { background: rgba(245,158,11,0.15); color: var(--clr-warning); }
.badge--danger  { background: rgba(239,68,68,0.15);  color: var(--clr-danger); }
.badge--info    { background: rgba(59,130,246,0.15);  color: var(--clr-info); }

/* ─── Avatar ──────────────────────────────────────────────────── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ─── Form Section Titles ─────────────────────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0 var(--space-4);
}

.section-divider__icon {
  width: 32px;
  height: 32px;
  background: var(--gradient-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  box-shadow: var(--shadow-purple);
  flex-shrink: 0;
}

.section-divider__title {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--text-primary);
}

.section-divider__line {
  flex: 1;
  height: 1px;
  background: var(--divider);
}

/* ─── Pagination ──────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  justify-content: center;
  padding: var(--space-4);
}

.page-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-family: inherit;
  transition: all var(--transition-base);
}

.page-btn:hover { background: var(--clr-primary-500); color: white; border-color: transparent; }
.page-btn.active { background: var(--gradient-primary); color: white; border-color: transparent; }

/* ─── Toast Notifications ─────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  left: var(--space-5);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  pointer-events: none;
}

body.lang-en .toast-container { left: auto; right: var(--space-5); }

.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.10);
  animation: toastSlideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  position: relative;
  overflow: hidden;
  pointer-events: all;
  min-width: 280px;
}

/* Colored left accent bar */
.toast::before {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 0 14px 14px 0;
}
body.lang-en .toast::before {
  right: auto;
  left: 0;
  border-radius: 14px 0 0 14px;
}

.toast--success::before { background: linear-gradient(180deg, #22c55e, #16a34a); }
.toast--error::before   { background: linear-gradient(180deg, #ef4444, #dc2626); }
.toast--warning::before { background: linear-gradient(180deg, #f59e0b, #d97706); }
.toast--info::before    { background: linear-gradient(180deg, #3b82f6, #2563eb); }

/* Icon circle */
.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex-shrink: 0;
  font-size: 18px !important;
}

.toast--success .toast-icon { background: rgba(34, 197, 94, 0.15); }
.toast--error   .toast-icon { background: rgba(239, 68, 68, 0.15); }
.toast--warning .toast-icon { background: rgba(245, 158, 11, 0.15); }
.toast--info    .toast-icon { background: rgba(59, 130, 246, 0.15); }

/* Light mode specific – stronger background so it's not washed out */
[data-theme="light"] .toast {
  background: #ffffff;
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
}

/* Slide up animation (bottom-right entry) */
@keyframes toastSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Keep old keyframes for compat */
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInLTR {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}


/* ─── Loader ──────────────────────────────────────────────────── */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--clr-primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.empty-state__icon { font-size: 48px; margin-bottom: var(--space-4); opacity: 0.5; }
.empty-state__title { font-size: var(--font-size-lg); font-weight: 600; margin-bottom: var(--space-2); }

/* ─── Tab Stepper ─────────────────────────────────────────────── */
.stepper {
  display: inline-flex !important;
  width: fit-content !important;
  max-width: 100%;
  gap: 6px;
  margin-bottom: var(--space-6);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 6px !important;
  overflow-x: auto;
  align-items: center;
  box-sizing: border-box;
}

.step-tab {
  flex: 0 1 auto;
  min-width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-base);
  white-space: nowrap;
  background: none;
  border: none;
  font-family: inherit;
}

.step-tab:hover { color: var(--clr-primary-400); background: rgba(59,92,232,0.05); }

.step-tab.active {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-purple);
}

.step-tab__num,
.step-tab i {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-tab:not(.active) .step-tab__num,
.step-tab:not(.active) i {
  background: var(--bg-table-alt);
  color: var(--text-muted);
}

/* ─── Overlay / Modal ─────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 200;
  display: none;
  animation: fadeIn var(--transition-base);
}

.overlay.active { display: block; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─── Mobile Overlay Toggle ───────────────────────────────────── */
@media (max-width: 768px) {
  /* Remove all blur effects on mobile for better performance */
  .header,
  .card,
  .stat-card,
  .toast,
  .sidebar,
  * {
    backdrop-filter: none !important;
  }
  
  /* Sidebar slides off-screen on mobile (RTL: from right) */
  .sidebar {
    transform: translateX(100%);
    width: 280px !important;
  }

  /* LTR: slide from left */
  body.lang-en .sidebar { transform: translateX(-100%); }

  /* When opened via JS toggle */
  .sidebar.mobile-open { transform: translateX(0) !important; }

  /* Main content takes full width */
  .main-content {
    margin-right: 0 !important;
    margin-left:  0 !important;
  }

  /* Overlay behind sidebar */
  .overlay { display: none; }
  .overlay.active { display: block; }

  .header__toggle { display: flex; }

  /* Stack all form grids to single column */
  .form-grid--2,
  .form-grid--3,
  .form-grid--4 { grid-template-columns: 1fr; }

  .page-content { padding: var(--space-4); }

  .stepper { gap: var(--space-1); }
  .step-tab { min-width: 80px; font-size: 10px; }
}

@media (max-width: 480px) {
  .header { padding: 0 var(--space-3); gap: var(--space-2); }
  .header__search { display: none; }
}

/* ─── Animations ──────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeInUp 0.4s ease forwards;
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.10s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.20s; }

/* ─── Utility ─────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mt-6 { margin-top: var(--space-6); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ─── Global Modal System ────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
  display: flex !important;
}

.modal-content {
  width: 100%;
  max-width: 650px;
  background: var(--bg-card);
  backdrop-filter: var(--backdrop);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: modalScaleUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--divider);
  padding-bottom: var(--space-4);
}

.modal-title {
  font-size: var(--font-size-xl);
  font-weight: 800;
  color: var(--text-primary);
  /* No icon gap or flex by default for cleaner look */
}

.modal-close {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-base);
  font-size: 16px;
  font-weight: bold;
}

.modal-close:hover {
  background: var(--clr-danger);
  color: white;
  border-color: transparent;
}

.modal-body {
  padding: var(--space-2) 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  border-top: 1px solid var(--divider);
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Modal sizing variations */
.modal-content--sm { max-width: 400px; }
.modal-content--lg { max-width: 850px; }
.modal-content--xl { max-width: 1100px; }

/* ─── Chat Drawer & UI ────────────────────────────────────────── */
.chat-drawer {
  position: fixed;
  top: 0;
  right: -380px; /* Hidden by default */
  width: 380px;
  height: 100vh;
  background: rgba(13, 21, 51, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-drawer.active {
  right: 0;
}

[dir="ltr"] .chat-drawer {
  right: auto;
  left: -380px;
  border-left: none;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

[dir="ltr"] .chat-drawer.active {
  left: 0;
}

.chat-drawer__header {
  padding: var(--space-4);
  background: var(--gradient-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-drawer__content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.chat-user-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.chat-user-item {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  transition: var(--transition-fast);
}

.chat-user-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.chat-user-item__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--clr-primary-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
}

.chat-user-item__info {
  flex: 1;
}

.chat-user-item__name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: #fff;
}

.chat-user-item__status {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
}

/* Chat Window Area */
.chat-window {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #070d22;
  display: none;
  flex-direction: column;
  z-index: 10;
}

.chat-window.active {
  display: flex;
}

.chat-messages {
  flex: 1;
  padding: var(--space-4);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.msg {
  max-width: 85%;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  position: relative;
  line-height: 1.4;
}

.msg--sent {
  align-self: flex-end;
  background: var(--clr-primary-500);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg--received {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-bottom-left-radius: 4px;
}

.msg__time {
  font-size: 9px;
  opacity: 0.6;
  margin-top: 4px;
  display: block;
}

.chat-input-area {
  padding: var(--space-3);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: var(--space-2);
  background: rgba(0, 0, 0, 0.2);
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  color: #fff;
  outline: none;
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--clr-primary-500);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
}

.chat-overlay.active {
  display: block;
}

.header__btn.chat-toggle {
  position: relative;
}

.header__btn.chat-toggle .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--clr-danger);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 10px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0d1533;
}

/* Emoji Picker */
.emoji-picker {
  position: absolute;
  bottom: 60px;
  right: 20px;
  background: rgba(13, 21, 51, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: none;
  backdrop-filter: blur(10px);
}

.emoji-picker.active {
  display: grid;
}

.emoji-item {
  font-size: 1.2rem;
  padding: 5px;
  cursor: pointer;
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-item:hover {
  transform: scale(1.3);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.btn-emoji {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.btn-emoji:hover {
  opacity: 1;
}

/* ─── Profile & Tasks Cards ─── */
.task-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.task-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.task-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.task-card__info {
  flex: 1;
}

.task-card__title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.task-card__desc {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-3);
}

.task-card__meta {
  display: flex;
  gap: var(--space-4);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.task-card__meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.task-card__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  min-width: 100px;
}

/* Performance Evaluation */
.perf-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

@media (max-width: 768px) {
  .perf-grid {
    grid-template-columns: 1fr;
  }
}

.perf-score-card, .perf-criteria-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.perf-criteria-card {
  align-items: stretch;
  justify-content: flex-start;
}

.perf-ring {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  position: relative;
}

.perf-ring::before {
  content: "";
  position: absolute;
  inset: 15px;
  background: var(--bg-card);
  border-radius: 50%;
}

.perf-ring__value {
  position: relative;
  font-size: var(--font-size-3xl);
  font-weight: 900;
  color: var(--text-primary);
  z-index: 1;
}

.crit-item {
  margin-bottom: var(--space-3);
}

.crit-item__header {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.crit-item__bar-container {
  height: 8px;
  background: var(--divider);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.crit-item__bar {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width 1s ease-out;
}




/* Table Styles */
.table-responsive { overflow-x: auto; }
.table-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  margin-top: var(--space-4);
  box-shadow: var(--shadow-sm);
}
table.data-table { 
  width: 100%; 
  border-collapse: collapse; 
  text-align: inherit;
  font-family: var(--font-ar); 
}
table.data-table th, table.data-table td { 
  padding: var(--space-4) var(--space-5); 
  text-align: start; 
  border-bottom: 1px solid var(--divider); 
  white-space: nowrap; 
}
table.data-table th { 
  background: var(--bg-table-alt);
  color: var(--text-muted); 
  font-weight: 700; 
  font-size: var(--font-size-xs); 
  text-transform: uppercase;
  letter-spacing: 0.5px; 
}
table.data-table tr {
  transition: background var(--transition-fast);
}
table.data-table tr:hover {
  background: rgba(59, 92, 232, 0.06);
}
table.data-table td { color: var(--text-primary); font-weight: 500; }

/* Exact System Input Match */
.system-styled-input {
  display: block;
  width: 100%;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: var(--font-ar);
  color: var(--text-primary);
  background-color: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  transition: all 0.2s ease-in-out;
}
select.system-styled-input {
    padding-top: 8px;
    padding-bottom: 8px;
    min-height: 46px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(139, 168, 232, 0.6)' stroke-width='3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 16px center;
    background-size: 16px;
    padding-left: 40px !important;
  }

  body.lang-en select.system-styled-input {
    background-position: right 16px center;
    padding-left: 16px !important;
    padding-right: 40px !important;
  }
.system-styled-input:focus {
  border-color: var(--color-primary, #6c5ce7) !important;
  outline: none !important;
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.2) !important;
}
.system-styled-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

/* ==========================================================================
   Unified Filter Bar Styling
   ========================================================================== */
.unified-filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-6);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: flex-end;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  position: relative;
}
/* Glassmorphism Effect for Filter Bar */
.unified-filter-bar.glass {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.unified-filter-bar .filter-group {
  display: flex;
  flex-direction: column;
  flex: 0 1 250px;
  min-width: 220px;
}
.unified-filter-bar .filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.unified-filter-bar .filter-label i {
  color: var(--color-primary);
  opacity: 0.8;
}
.unified-filter-bar .filter-actions {
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
}
.unified-filter-bar .filter-actions .btn {
  height: 42px; /* Match form inputs */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  font-weight: 600;
}
@media (max-width: 768px) {
  .unified-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .unified-filter-bar .filter-group {
    min-width: 100%;
  }
  .unified-filter-bar .filter-actions {
    margin-inline-start: 0;
    width: 100%;
    justify-content: flex-end;
  }
}

/* ─── Global Multiselect Dropdown & Scrollbar Styles ───────────────────────── */
.multiselect-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 999999 !important;
  max-height: 200px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  display: none;
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  opacity: 1 !important;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color, #6366f1) rgba(255, 255, 255, 0.05);
}

.multiselect-dropdown::-webkit-scrollbar {
  width: 6px;
}

.multiselect-dropdown::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6366f1, #4f46e5);
  border-radius: 10px;
}

.multiselect-dropdown::-webkit-scrollbar-thumb:hover {
  background: #4338ca;
}

.multiselect-dropdown::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
}

[data-theme="dark"] .multiselect-dropdown,
html[data-theme="dark"] .multiselect-dropdown {
  background: #0b1329 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75) !important;
  scrollbar-color: var(--primary-color, #6366f1) rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .multiselect-dropdown,
html[data-theme="light"] .multiselect-dropdown {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15) !important;
  scrollbar-color: var(--primary-color, #6366f1) rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .multiselect-dropdown::-webkit-scrollbar-track,
html[data-theme="light"] .multiselect-dropdown::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}


/* Added for required asterisks */
.required { color: var(--clr-danger-500, #ef4444); margin-inline-start: 4px; font-weight: bold; }

/* مسافة عامة بين العنوان والمحتوى التالي */
.section-header:not([style*="margin-bottom"]) {
  margin-bottom: var(--space-6);
}

.page-title-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.page-emoji-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 18px;
  font-size: 30px;
  line-height: 1;
  flex-shrink: 0;
  position: relative;
  animation: emojiBadgePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.page-emoji-badge:hover {
  transform: scale(1.1) rotate(-5deg);
}

.page-emoji-badge.badge-finance {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.45), 0 2px 8px rgba(0,0,0,0.3);
}

.page-emoji-badge.badge-attendance {
  background: linear-gradient(135deg, #06b6d4 0%, #6366f1 100%);
  box-shadow: 0 8px 32px rgba(6, 182, 212, 0.45), 0 2px 8px rgba(0,0,0,0.3);
}

.page-emoji-badge.badge-performance {
  background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
  box-shadow: 0 8px 32px rgba(168, 85, 247, 0.45), 0 2px 8px rgba(0,0,0,0.3);
}

.page-emoji-badge.badge-services {
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.45), 0 2px 8px rgba(0,0,0,0.3);
}

.page-emoji-badge.badge-hr {
  background: linear-gradient(135deg, #f59e0b 0%, #10b981 100%);
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.4), 0 2px 8px rgba(0,0,0,0.3);
}

.page-emoji-badge.badge-students {
  background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.45), 0 2px 8px rgba(0,0,0,0.3);
}

.page-emoji-badge.badge-general {
  background: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.45), 0 2px 8px rgba(0,0,0,0.3);
}

html[data-theme="light"] .page-emoji-badge {
  box-shadow: 0 6px 24px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.1);
}

@keyframes emojiBadgePop {
  0% { opacity: 0; transform: scale(0.5) rotate(-15deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.section-header__title {
  font-size: clamp(0.95rem, 1.5vw, 1.25rem);
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.section-header__desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: var(--space-1) 0 0 0;
  line-height: 1.6;
}

/* ==========================================================================
   System Master Unified Tab Containers & Items System (Unified Height)
   Matches general-records.html tab container standard across all pages.
   Excludes dashboards as requested (body.page-dashboard / .dash-nav).
   ========================================================================== */
:not(body.page-dashboard) .tabs-container,
:not(body.page-dashboard) .profile-tabs,
:not(body.page-dashboard) .step-tabs,
:not(body.page-dashboard) .stepper,
:not(body.page-dashboard) .page-tabs,
:not(body.page-dashboard) .tabs-wrapper {
  background: var(--bg-input);
  padding: 6px !important;
  border-radius: var(--radius-lg);
  display: inline-flex !important;
  width: fit-content !important;
  max-width: 100%;
  gap: 6px;
  margin-bottom: var(--space-6);
  border: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
  align-items: center;
  box-sizing: border-box;
}

:not(body.page-dashboard) .tabs-container::-webkit-scrollbar,
:not(body.page-dashboard) .profile-tabs::-webkit-scrollbar,
:not(body.page-dashboard) .step-tabs::-webkit-scrollbar,
:not(body.page-dashboard) .page-tabs::-webkit-scrollbar,
:not(body.page-dashboard) .tabs-wrapper::-webkit-scrollbar {
  display: none;
}

:not(body.page-dashboard) .tab-item,
:not(body.page-dashboard) .profile-tab,
:not(body.page-dashboard) .step-tab,
:not(body.page-dashboard) .page-tab {
  height: 38px !important;
  padding: 0 18px !important;
  border-radius: var(--radius-md) !important;
  cursor: pointer;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  color: var(--text-muted);
  font-weight: 700 !important;
  font-size: 13px !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  flex-shrink: 0;
  box-sizing: border-box;
  margin: 0 !important;
  line-height: 1 !important;
}

:not(body.page-dashboard) .tab-item:hover,
:not(body.page-dashboard) .profile-tab:hover,
:not(body.page-dashboard) .step-tab:hover,
:not(body.page-dashboard) .page-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

:not(body.page-dashboard) .tab-item.active,
:not(body.page-dashboard) .profile-tab.active,
:not(body.page-dashboard) .step-tab.active,
:not(body.page-dashboard) .page-tab.active {
  background: var(--gradient-primary) !important;
  color: #ffffff !important;
  box-shadow: var(--shadow-purple) !important;
}


/* ═══════════════════════════════════════════════════════════════
   Custom Premium Select Dropdown  v3
   Dark-first — Glassmorphism, Floating Panel, Zero Glitch
   ═══════════════════════════════════════════════════════════════ */
