/* IMS - Institute Management System */
/* Modern Blue + White Theme - Fully Responsive + RTL Support */

/* CSS Custom Properties (Variables) */
:root {
  /* Core Blue + White Palette */
  --primary-gradient: linear-gradient(165deg, #1d4ed8 0%, #2563eb 48%, #3b82f6 100%);
  --sidebar-gradient: linear-gradient(180deg, #1e3a8a 0%, #1d4ed8 55%, #2563eb 100%);
  --sidebar-dark: #1e3a8a;
  --sidebar-light: #2563eb;
  --primary-purple: #1d4ed8;
  --purple-light: #60a5fa;
  --purple-100: #dbeafe;
  --purple-200: #bfdbfe;
  
  /* Neutral Palette */
  --bg-primary: #f8fbff;
  --bg-secondary: #edf4ff;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --border-color: #d7e3f5;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  /* Success/Error/Warning */
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  
  /* Typography */
  --font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --text-secondary: #1f2a44;
  --text-muted: #52607a;
  --label-color: #1d4ed8;

  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;

  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.14);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.16);
  --info: #2563eb;
  --info-light: rgba(37, 99, 235, 0.14);

  --sidebar-width: 280px;
  --sidebar-collapsed: 68px;
  --sidebar-bg: linear-gradient(170deg, #1e3a8a 0%, #1d4ed8 58%, #2563eb 100%);
  --sidebar-text: #eff6ff;
  --sidebar-text-muted: rgba(239, 246, 255, 0.7);
  --sidebar-item-hover: rgba(239, 246, 255, 0.12);
  --sidebar-item-active: rgba(239, 246, 255, 0.22);
  --sidebar-card: rgba(255, 255, 255, 0.08);
  --sidebar-glow: 0 18px 38px rgba(29, 78, 216, 0.28);

  --header-height: 74px;
  --header-bg: rgba(255, 255, 255, 0.94);
  --header-border: rgba(59, 130, 246, 0.2);

  --input-height: 46px;
  --input-bg: #f8fbff;
  --input-border: rgba(37, 99, 235, 0.22);
  --input-focus: #2563eb;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  /* Breakpoints */
  --mobile-breakpoint: 768px;
  --tablet-breakpoint: 1024px;

  /* Safe Areas */
  --safe-area-inset-top: env(safe-area-inset-top, 0px);
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-inset-left: env(safe-area-inset-left, 0px);
  --safe-area-inset-right: env(safe-area-inset-right, 0px);
}

body.theme-light,
body.theme-light-bg {
  --content-bg: #f3f7ff;
  --content-surface: #e8f0ff;
  --card-bg: #ffffff;
  --card-border: #dbe7fb;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --header-bg: rgba(255, 255, 255, 0.96);
  --header-border: rgba(37, 99, 235, 0.18);
  --input-bg: #ffffff;
}

body.theme-dark {
  --content-bg: #0b1020;
  --content-surface: #0f172a;
  --card-bg: #111827;
  --card-border: #1f2937;
  --text-primary: #e2e8f0;
  --text-secondary: #cbd5f5;
  --text-muted: #94a3b8;
  --header-bg: rgba(12, 18, 34, 0.85);
  --header-border: rgba(255, 255, 255, 0.06);
  --sidebar-bg: linear-gradient(160deg, #0b1020 0%, #0f172a 55%, #1e3a8a 100%);
  --input-bg: #111827;
  --input-border: #1f2937;
  --success-light: rgba(22, 163, 74, 0.16);
  --danger-light: rgba(239, 68, 68, 0.18);
  --warning-light: rgba(245, 158, 11, 0.18);
  --info-light: rgba(37, 99, 235, 0.2);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--content-bg);
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  opacity: 0;
  animation: fadeInBody 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInBody {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Floating animated gradient background */
body::after {
  content: "";
  position: fixed;
  left: 0; top: 0; right: 0; bottom: 0;
  z-index: -2;
  pointer-events: none;
  background: radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.22) 0%, transparent 60%),
              radial-gradient(circle at 80% 70%, rgba(147, 197, 253, 0.2) 0%, transparent 60%);
  animation: floatGradient 12s ease-in-out infinite alternate;
}

@keyframes floatGradient {
  0% {
    background-position: 20% 30%, 80% 70%;
    filter: blur(0px);
  }
  50% {
    background-position: 25% 35%, 75% 65%;
    filter: blur(8px);
  }
  100% {
    background-position: 20% 30%, 80% 70%;
    filter: blur(0px);
  }
}

/* body.is-offline i { display: none !important; } - Removed as it hides critical navigation icons when local/offline */


body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(
      circle at 12% 12%,
      rgba(0, 179, 255, 0.18),
      transparent 46%
    ),
    radial-gradient(circle at 82% 18%, rgba(0, 74, 124, 0.12), transparent 44%),
    linear-gradient(
      160deg,
      rgba(243, 246, 251, 0.95) 0%,
      rgba(233, 239, 247, 0.98) 100%
    ),
    repeating-linear-gradient(
      90deg,
      rgba(10, 18, 34, 0.05) 0,
      rgba(10, 18, 34, 0.05) 1px,
      transparent 1px,
      transparent 40px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(10, 18, 34, 0.04) 0,
      rgba(10, 18, 34, 0.04) 1px,
      transparent 1px,
      transparent 40px
    );
  pointer-events: none;
  z-index: -1;
}

body.theme-dark::before {
  background:
    radial-gradient(
      circle at 12% 12%,
      rgba(0, 179, 255, 0.28),
      transparent 48%
    ),
    radial-gradient(circle at 88% 18%, rgba(0, 74, 124, 0.32), transparent 44%),
    linear-gradient(
      160deg,
      rgba(6, 10, 20, 0.98) 0%,
      rgba(8, 14, 28, 0.98) 100%
    ),
    repeating-linear-gradient(
      90deg,
      rgba(124, 149, 191, 0.08) 0,
      rgba(124, 149, 191, 0.08) 1px,
      transparent 1px,
      transparent 40px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(124, 149, 191, 0.06) 0,
      rgba(124, 149, 191, 0.06) 1px,
      transparent 1px,
      transparent 40px
    );
}

[dir="rtl"] body {
  font-family: "Noto Naskh Arabic", serif;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: var(--font-display);
  letter-spacing: 0.1px;
}

.page-title,
.card-title,
.stat-info h3,
.page-header h1 {
  font-family: var(--font-display);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  z-index: 1000;
  transition:
    width var(--transition-normal),
    transform var(--transition-normal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--sidebar-glow);
}

[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
}

.sidebar-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  min-height: var(--header-height);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.02) 100%
  );
  overflow: hidden;
  white-space: nowrap;
}

/* Sidebar mini desktop state */
@media (min-width: 1025px) {
  body.sidebar-mini .sidebar {
    width: var(--sidebar-collapsed);
  }

  body.sidebar-mini .main-content {
    margin-left: var(--sidebar-collapsed);
  }

  body.sidebar-mini [dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-collapsed);
  }

  body.sidebar-mini .sidebar-brand,
  body.sidebar-mini .sidebar-nav .nav-section,
  body.sidebar-mini .sidebar-nav span,
  body.sidebar-mini .sidebar-search input,
  body.sidebar-mini .sidebar-footer .user-info,
  body.sidebar-mini .sidebar-footer #installApp span,
  body.sidebar-mini .sidebar-scroll-controls {
    display: none !important;
  }

  body.sidebar-mini .sidebar-search {
    display: none;
  }

  body.sidebar-mini .nav-item {
    justify-content: center;
    padding: 10px;
    margin: 6px 12px;
  }

  body.sidebar-mini .nav-item i {
    margin: 0;
  }

  body.sidebar-mini .user-profile {
    justify-content: center;
  }
}


.sidebar-logo {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  flex-shrink: 0;
  box-shadow:
    0 10px 24px rgba(12, 4, 30, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.sidebar-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.sidebar-brand {
  font-weight: 700;
  font-size: 1rem;
}

.sidebar-brand small {
  display: block;
  font-weight: 500;
  font-size: 0.75rem;
  color: rgba(249, 244, 234, 0.6);
}

.sidebar-nav {
  padding: var(--spacing-md) 0 var(--spacing-lg);
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  overscroll-behavior: contain;
}

.nav-section {
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 0.7rem;
  padding: 0 var(--spacing-lg) var(--spacing-sm);
  color: var(--sidebar-text-muted);
}

.sidebar-search {
  position: relative;
  padding: 0 var(--spacing-lg) var(--spacing-md);
}

.sidebar-search input {
  width: 100%;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-text);
  padding: 0 14px 0 40px;
  font-size: 0.85rem;
}

.sidebar-search input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.sidebar-search i {
  position: absolute;
  left: calc(var(--spacing-lg) + 14px);
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
}

[dir="rtl"] .sidebar-search i {
  left: auto;
  right: calc(var(--spacing-lg) + 14px);
}

[dir="rtl"] .sidebar-search input {
  padding: 0 40px 0 14px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  margin: 6px var(--spacing-md);
  padding: 10px 14px;
  border: 1px solid transparent;
  color: var(--sidebar-text);
  text-decoration: none;
  transition:
    transform var(--transition-fast),
    background var(--transition-fast),
    border-color var(--transition-fast);
}

.nav-item i {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
}

.nav-item:hover {
  background: var(--sidebar-item-hover);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateX(2px);
}

.nav-item.active {
  background: var(--sidebar-item-active);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 10px 18px rgba(6, 24, 14, 0.25);
}

.nav-group-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px var(--spacing-md) 2px;
  padding: 8px 14px;
  border-radius: 12px;
  color: rgba(239, 246, 255, 0.82);
  font-weight: 700;
  font-size: 0.88rem;
}

.nav-group-label i {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
}

.nav-group-label.active {
  color: #ffffff;
}

.nav-parent {
  cursor: pointer;
}

.nav-parent .submenu-caret {
  margin-left: auto;
  width: auto;
  height: auto;
  background: transparent;
  border-radius: 0;
  font-size: 0.78rem;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
  opacity: 0.86;
}

.nav-parent.is-open .submenu-caret {
  transform: rotate(180deg);
}

.sidebar-submenu {
  margin: 0 var(--spacing-md);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height var(--transition-normal), opacity var(--transition-fast), margin-bottom var(--transition-fast);
  pointer-events: none;
}

.sidebar-submenu.is-open {
  max-height: 700px;
  opacity: 1;
  margin-bottom: 8px;
  pointer-events: auto;
}

.nav-subitem {
  display: flex;
  align-items: center;
  min-height: 36px;
  margin: 4px 0;
  padding: 8px 12px 8px 46px;
  border-radius: 10px;
  color: rgba(239, 246, 255, 0.92);
  text-decoration: none;
  font-size: 0.84rem;
  line-height: 1.2;
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.nav-subitem:hover {
  background: rgba(239, 246, 255, 0.13);
  color: #ffffff;
  transform: translateX(2px);
}

.nav-subitem.active {
  background: rgba(239, 246, 255, 0.22);
  color: #ffffff;
  font-weight: 600;
}

[dir="rtl"] .nav-subitem {
  padding: 8px 46px 8px 12px;
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--spacing-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dbeafe 0%, #93c5fd 100%);
  color: #1e3a8a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.75rem;
  opacity: 0.7;
}

.sidebar-scroll-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 0 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-scroll-controls.is-hidden {
  display: none;
}

.sidebar-scroll-btn,
.sidebar-scroll-handle {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: var(--sidebar-text);
  cursor: pointer;
}

.sidebar-scroll-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sidebar-scroll-handle {
  width: 48px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-scroll-grip {
  display: block;
  width: 18px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  margin: 0 auto;
}

/* Main content + header */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left var(--transition-normal);
}

.btn-primary, .btn-success, .btn-info {
  background: var(--primary-gradient);
  color: #000;
  font-weight: 700;
  border: none;
  box-shadow: 0 8px 24px rgba(250, 204, 21, 0.25);
  transition: all var(--transition-normal);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary:hover, .btn-success:hover, .btn-info:hover {
  background: var(--primary-gradient-hover);
  color: #000;
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(250, 204, 21, 0.4);
}

.btn-outline-primary {
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  font-weight: 600;
  background: transparent;
}

.btn-outline-primary:hover {
  background: var(--primary-color);
  color: #000;
}

.embed-preview .sidebar,
.embed-preview .sidebar-overlay {
  display: none;
}

.embed-preview .main-content {
  margin-left: 0;
  min-height: auto;
}

[dir="rtl"] .embed-preview .main-content {
  margin-right: 0;
}

.embed-preview .page-header {
  margin-bottom: 12px;
}

.embed-preview .main-header {
  display: none;
}

[dir="rtl"] .main-content {
  margin-left: 0;
  margin-right: var(--sidebar-width);
}

.main-header {
  position: relative;
  min-height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  box-shadow: 0 16px 34px rgba(6, 24, 44, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--spacing-lg);
  z-index: 1200;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  backdrop-filter: blur(14px);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast);
  z-index: 1100;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  flex: 1 1 auto;
  min-width: 0; /* Changed from 220px to allow more flexibility */
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--spacing-md);
  flex-shrink: 0;
}


.sidebar-toggle {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: none;
  background: var(--content-surface);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex !important; /* Ensure it's always visible */
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
  z-index: 1201; /* Above almost anything in header */
}

.sidebar-toggle:hover {
  background: var(--primary-color);
  color: #ffffff;
  border-color: transparent;
}

.sidebar-toggle-header {
  display: none !important;
}

.header-title-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.header-title-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.breadcrumb a {
  color: var(--primary-color);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.header-controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lang-selector select {
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-primary);
  padding: 0 12px;
  font-size: 0.85rem;
  cursor: pointer;
}

.header-search {
  position: relative;
  max-width: 200px;
  width: 100%;
}

.header-search input {
  width: 100%;
  height: 36px;
  padding: 0 var(--spacing-md) 0 40px;
  border: 1px solid var(--input-border);
  border-radius: 999px;
  background: var(--input-bg);
  font-size: 0.85rem;
}

.header-search input:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(0, 179, 255, 0.22);
}

.header-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

[dir="rtl"] .header-search input {
  padding: 0 40px 0 var(--spacing-md);
}

[dir="rtl"] .header-search i {
  left: auto;
  right: 14px;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  padding: 8px;
  display: none;
  max-height: 360px;
  overflow-y: auto;
  z-index: 30;
}

.search-results.active {
  display: block;
}

.search-item {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--text-primary);
  text-decoration: none;
}

.search-item:hover {
  background: rgba(0, 179, 255, 0.12);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.connection-status.online {
  background: var(--success-light);
  color: var(--success);
}

.connection-status.offline {
  background: var(--danger-light);
  color: var(--danger);
}

.sync-health {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--content-surface);
  color: var(--text-secondary);
  font-size: 0.72rem;
  white-space: nowrap;
}

.sync-health-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.sync-health.online .sync-health-state {
  background: var(--success-light);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}

.sync-health.offline .sync-health-state {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.sync-health.syncing .sync-health-state {
  background: var(--info-light);
  color: var(--info);
  border-color: rgba(96, 165, 250, 0.22);
}

.sync-health.failed .sync-health-state {
  background: #fee2e2;
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.25);
}

.sync-health-meta {
  color: var(--text-secondary);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--content-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.8rem;
}

.theme-toggle:hover {
  color: #ffffff;
  background: var(--primary-color);
  border-color: transparent;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px;
  border-radius: 999px;
  background: var(--content-surface);
  border: 1px solid var(--card-border);
}

.header-user-profile {
  padding: 2px 10px 2px 2px;
  border-radius: 999px;
  background: var(--content-bg);
  border: 1px solid var(--card-border);
  max-width: 320px;
}

.header-user-profile .user-avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.header-user-profile .user-info {
  min-width: 0;
}

.header-user-profile .user-name,
.header-user-profile .user-role {
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

[dir="rtl"] .header-user-profile {
  padding: 2px 2px 2px 10px;
}

.header-icon {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--content-bg);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
}

.header-icon:hover {
  background: var(--primary-color);
  color: #ffffff;
}

.header-icon .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.quick-actions {
  position: relative;
}

.quick-actions-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 220px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  padding: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: all var(--transition-fast);
  z-index: 20;
}

.quick-actions:focus-within .quick-actions-menu,
.quick-actions:hover .quick-actions-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.quick-actions-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin: 6px 10px 8px;
}

.quick-action-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--text-primary);
  text-decoration: none;
}

.quick-action-item:hover {
  background: rgba(0, 179, 255, 0.12);
}

.content-body {
  padding: var(--spacing-lg);
  animation: fadeInUp 0.45s ease;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.page-header h1,
.page-header .breadcrumb {
  display: none;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  margin-bottom: var(--spacing-lg);
  overflow: hidden;
  transition: box-shadow var(--transition-fast);
}

.card:hover {
  box-shadow: var(--card-shadow-hover);
}

.card-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--card-border);
  background: linear-gradient(
    120deg,
    rgba(0, 179, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.92) 100%
  );
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

body.theme-dark .card-header {
  background: linear-gradient(
    120deg,
    rgba(0, 179, 255, 0.2) 0%,
    rgba(17, 24, 39, 0.95) 100%
  );
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-body {
  padding: var(--spacing-lg);
}

.card-footer {
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--card-border);
  background: var(--content-surface);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.stat-card {
  background: linear-gradient(
    145deg,
    rgba(0, 179, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.96) 100%
  );
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  padding: var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  box-shadow: var(--card-shadow);
}

body.theme-dark .stat-card {
  background: linear-gradient(
    145deg,
    rgba(0, 179, 255, 0.22) 0%,
    rgba(17, 24, 39, 0.95) 100%
  );
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.purple {
  background: linear-gradient(135deg, #22d3ee 0%, #0284c7 100%);
  color: #ffffff;
}
.stat-icon.green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}
.stat-icon.blue {
  background: linear-gradient(135deg, #38bdf8 0%, #1d4ed8 100%);
  color: white;
}
.stat-icon.orange {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}
.stat-icon.red {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.stat-info h3 {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-info p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.form-group {
  margin-bottom: var(--spacing-md);
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--label-color) !important;
  margin-bottom: 6px;
}

label {
  color: var(--label-color) !important;
}

.form-static {
  min-height: var(--input-height);
  display: flex;
  align-items: center;
  padding: 0 var(--spacing-md);
  border: 1px dashed var(--input-border);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.02);
  color: var(--text-secondary);
  font-weight: 500;
}

body.theme-dark .form-static {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(226, 232, 240, 0.2);
  color: var(--text-secondary);
}

.form-control,
.form-select {
  width: 100%;
  height: var(--input-height);
  padding: 0 var(--spacing-md);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(0, 179, 255, 0.18);
}

textarea.form-control {
  height: auto;
  min-height: 100px;
  padding: var(--spacing-md);
  resize: vertical;
}

select.form-control,
select.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

[dir="rtl"] select.form-control,
[dir="rtl"] select.form-select {
  background-position: left 12px center;
  padding-right: var(--spacing-md);
  padding-left: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--input-height);
  padding: 0 var(--spacing-lg);
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  box-shadow: 0 12px 24px rgba(6, 24, 44, 0.12);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(0, 179, 255, 0.3),
    0 12px 24px rgba(6, 24, 44, 0.18);
}

.btn-primary {
  background: var(--primary-gradient);
  color: #000;
}

.btn-primary:hover {
  background: var(--primary-gradient-hover);
}

.btn-secondary {
  background: #e6eef9;
  color: #0f172a;
  border: 1px solid rgba(0, 74, 124, 0.12);
  box-shadow: none;
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(0, 74, 124, 0.22);
  color: var(--text-primary);
  box-shadow: none;
}

.btn-outline:hover {
  background: var(--primary-color);
  color: #fff !important;
  border-color: var(--primary-color);
}

.btn-outline-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}

.btn-outline-danger:hover {
  background: var(--danger);
  color: white !important;
}

.btn-outline-success {
  background: transparent;
  border: 1px solid var(--success);
  color: var(--success);
}

.btn-outline-success:hover {
  background: var(--success);
  color: white !important;
}

.btn-success {
  background: linear-gradient(140deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
}
.btn-danger {
  background: linear-gradient(140deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
}
.btn-warning {
  background: linear-gradient(140deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
}
.btn-info {
  background: linear-gradient(140deg, #60a5fa 0%, #2563eb 100%);
  color: #fff;
}

.btn-sm {
  height: 36px;
  padding: 0 var(--spacing-md);
  font-size: 0.85rem;
}
.btn-lg {
  height: 52px;
  padding: 0 var(--spacing-xl);
  font-size: 1rem;
}

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 14px var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--card-border);
}

.data-table th {
  background: rgba(0, 179, 255, 0.18);
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.8px;
  white-space: nowrap;
  border-bottom: 2px solid var(--primary-color);
}

body.theme-dark .data-table th {
  background: rgba(0, 179, 255, 0.25);
  color: #ffffff;
  border-bottom-color: var(--primary-color);
}

.data-table tbody tr:hover {
  background: rgba(0, 179, 255, 0.15);
  color: var(--text-primary);
}

body.theme-dark .data-table tbody tr:hover {
  background: rgba(0, 179, 255, 0.2);
  color: #ffffff;
}

.table-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.table-actions .btn {
  height: 32px;
  width: 32px;
  padding: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}
.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}
.badge-warning {
  background: var(--warning-light);
  color: #92400e;
}
.badge-info {
  background: var(--info-light);
  color: var(--info);
}

.alert {
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
}

.alert-success {
  background: var(--success-light);
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.alert-danger {
  background: var(--danger-light);
  color: #991b1b;
  border: 1px solid #fecaca;
}
.alert-warning {
  background: var(--warning-light);
  color: #92400e;
  border: 1px solid #fde68a;
}
.alert-info {
  background: var(--info-light);
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.toast-container {
  position: fixed;
  top: 80px;
  right: var(--spacing-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.toast {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: var(--spacing-md) var(--spacing-lg);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  min-width: 300px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  width: 100%;
  max-width: 520px;
}

.modal-header,
.modal-footer {
  padding: var(--spacing-md) var(--spacing-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: var(--spacing-lg);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
}

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
  padding: 14px;
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: var(--spacing-lg);
}

.chat-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 16px;
  align-items: start;
}

.chat-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  min-height: 420px;
}

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--card-border);
  background: linear-gradient(
    120deg,
    rgba(37, 99, 235, 0.12) 0%,
    rgba(0, 179, 255, 0.08) 100%
  );
  flex-wrap: wrap;
}

.attendance-scan-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.attendance-camera {
  margin-top: 12px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  max-width: 360px;
}

.attendance-camera video {
  width: 100%;
  height: auto;
  display: block;
}

/* Utilities */
.d-none {
  display: none !important;
}
.d-block {
  display: block !important;
}
.d-flex {
  display: flex !important;
}
.d-inline-flex {
  display: inline-flex !important;
}

.justify-content-start {
  justify-content: flex-start !important;
}
.justify-content-end {
  justify-content: flex-end !important;
}
.justify-content-center {
  justify-content: center !important;
}
.justify-content-between {
  justify-content: space-between !important;
}

.align-items-start {
  align-items: flex-start !important;
}
.align-items-end {
  align-items: flex-end !important;
}
.align-items-center {
  align-items: center !important;
}

.flex-wrap {
  flex-wrap: wrap !important;
}
.flex-column {
  flex-direction: column !important;
}

.gap-1 {
  gap: var(--spacing-sm) !important;
}
.gap-2 {
  gap: var(--spacing-md) !important;
}
.gap-3 {
  gap: var(--spacing-lg) !important;
}

.m-0 {
  margin: 0 !important;
}
.mt-1 {
  margin-top: var(--spacing-sm) !important;
}
.mt-2 {
  margin-top: var(--spacing-md) !important;
}
.mt-3 {
  margin-top: var(--spacing-lg) !important;
}
.mb-1 {
  margin-bottom: var(--spacing-sm) !important;
}
.mb-2 {
  margin-bottom: var(--spacing-md) !important;
}
.mb-3 {
  margin-bottom: var(--spacing-lg) !important;
}
.ml-auto {
  margin-left: auto !important;
}
.mr-auto {
  margin-right: auto !important;
}

.p-0 {
  padding: 0 !important;
}
.p-1 {
  padding: var(--spacing-sm) !important;
}
.p-2 {
  padding: var(--spacing-md) !important;
}
.p-3 {
  padding: var(--spacing-lg) !important;
}

.text-left {
  text-align: left !important;
}
.text-right {
  text-align: right !important;
}
.text-center {
  text-align: center !important;
}

.text-primary {
  color: var(--primary-color) !important;
}
.text-success {
  color: var(--success) !important;
}
.text-danger {
  color: var(--danger) !important;
}
.text-warning {
  color: var(--warning) !important;
}
.text-muted {
  color: var(--text-muted) !important;
}

.font-weight-bold {
  font-weight: 700 !important;
}
.font-weight-semibold {
  font-weight: 600 !important;
}

.w-100 {
  width: 100% !important;
}
.h-100 {
  height: 100% !important;
}

/* Visibility Utilities */
.form-section-highlight {
  background: rgba(0, 179, 255, 0.04);
  border: 1px solid rgba(0, 179, 255, 0.12);
  border-radius: 12px;
  padding: 16px;
}

body.theme-dark .form-section-highlight {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

/* File Input Visibility */
input[type="file"].form-control {
  padding-top: 8px;
  height: auto;
  min-height: 48px;
}

body.theme-dark input[type="file"]::file-selector-button {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Super admin dashboard */
.super-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.super-admin-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.super-admin-stats {
  margin-top: var(--spacing-md);
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--content-surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  border-radius: var(--radius-sm);
  transition: width var(--transition-normal);
}

.onboarding-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.org-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.super-admin-org-lists {
  margin-top: var(--spacing-lg);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-lg);
}

.super-admin-org-lists .card {
  height: 100%;
}

.super-admin-org-lists .table-container {
  max-height: 320px;
  overflow-y: auto;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .content-body {
    animation: none;
  }
}

/* Responsive */
@media (max-width: 1024px) {
  .header-controls-row {
    width: 100%;
    gap: 8px;
  }
  .header-search {
    max-width: 220px;
  }
  .chat-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  /* Mobile Header Adjustments */
  .main-header {
    height: auto;
    min-height: 60px;
    padding: var(--spacing-xs) var(--spacing-md);
    position: sticky;
    top: 0;
  }

  /* Sidebar Drawer Logic */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
    width: 280px; /* Slightly narrower for mobile */
    z-index: 1200; /* Above overlay */
  }

  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
  }

  /* Sidebar Overlay */
  .sidebar-overlay {
    display: block; /* Ensure it's capable of being shown */
  }

  /* Main Content Adjustments */
  .main-content {
    margin-left: 0 !important; /* Force override */
    margin-right: 0 !important;
    width: 100%;
    padding-top: 0;
  }

  /* Header Elements */
  .header-left {
    width: auto;
    min-width: 0;
    gap: 10px;
  }

  .header-controls-row {
    width: auto; /* Don't force full width if not needed */
    justify-content: flex-end;
  }

  .header-search {
    display: none; /* Hide global search on mobile */
  }

  .header-icon {
    width: 36px;
    height: 36px;
  }

  .theme-toggle-text {
    display: none;
  }

  /* User Profile Compact */
  .user-info {
    display: none;
  }

  .user-profile {
    gap: 0;
    padding: 0;
    background: transparent;
  }

  .user-avatar {
    width: 32px;
    height: 32px;
  }
}
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
    width: 280px;
    z-index: 1200;
  }

  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--sidebar-glow);
  }

  .main-content {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100%;
  }

  .header-title-block {
    display: none;
  }

  .header-left {
    min-width: auto;
    gap: 12px;
  }
}

/* Super admin dashboard */
.super-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.super-admin-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.super-admin-stats {
  margin-top: var(--spacing-md);
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--content-surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  border-radius: var(--radius-sm);
  transition: width var(--transition-normal);
}

.onboarding-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

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

.super-admin-org-lists {
  margin-top: var(--spacing-lg);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-lg);
}

.super-admin-org-lists .card {
  height: 100%;
}

.super-admin-org-lists .table-container {
  max-height: 320px;
  overflow-y: auto;
}

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

@media (prefers-reduced-motion: reduce) {
  .content-body {
    animation: none;
  }
}

/* Responsive */
@media (max-width: 1024px) {
  .header-controls-row {
    width: 100%;
    gap: 8px;
  }
  .header-search {
    max-width: 220px;
  }
  .chat-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  /* Mobile Header Adjustments */
  .main-header {
    height: auto;
    min-height: 64px;
    padding: 0 var(--spacing-md);
    position: sticky;
    top: 0;
    flex-wrap: nowrap; /* Prevent wrapping on main header to keep height stable */
    gap: 8px;
  }

  /* Hide complex/redundant elements on mobile */
  .lang-selector,
  .connection-status span,
  .sync-health,
  .header-title-block,
  .theme-toggle-text,
  .user-info {
    display: none !important;
  }

  .header-left {
    flex: 0 0 auto;
    gap: 10px;
  }

  .header-right {
    flex: 1 1 auto;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
  }

  /* Optimize search on mobile */
  .header-search {
    margin-right: auto;
    width: auto;
  }

  .header-search input {
    width: 0;
    padding: 0;
    border: none;
    transition: width 0.3s ease;
  }

  .header-search:focus-within input {
    width: 140px;
    padding: 0 10px 0 35px;
    border: 1px solid var(--input-border);
  }

  .header-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 10px;
  }

  /* Sidebar Drawer Logic */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
    width: 280px;
    z-index: 1200;
  }

  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
  }

  /* Sidebar Overlay */
  .sidebar-overlay {
    background: rgba(15, 23, 42, 0.5);
  }

  /* Main Content Adjustments */
  .main-content {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100%;
    padding: 0;
  }

  .content-body {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .main-header {
    padding: 0 8px;
    gap: 4px;
  }

  .header-right {
    gap: 4px;
  }

  /* Hide even more on ultra-mobile */
  .connection-status,
  .header-actions #installApp,
  .header-actions .quick-actions {
    display: none !important;
  }

  .profile-actions-trigger {
    padding: 0;
    border: none;
  }

  .user-avatar {
    width: 34px;
    height: 34px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .header-controls-row {
    gap: 6px;
  }
  .lang-selector select,
  .theme-toggle {
    width: 100%;
  }
}
/* Responsive Dashboard Layout */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
    width: 280px;
    z-index: 1200;
  }

  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--sidebar-glow);
  }

  .main-content {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100%;
  }

  .header-title-block {
    display: none;
  }

  .header-left {
    min-width: auto;
    gap: 12px;
  }
  
  .sidebar-toggle {
    display: flex !important;
  }
}

@media (max-width: 768px) {
  /* Tablet: Compact Header */
  :root {
    --header-height: 60px;
    --spacing-lg: 16px;
  }

  .main-header {
    padding: 0 var(--spacing-md);
  }

  /* Global Search Hide */
  .header-search {
    display: none;
  }

  /* Compact Language Selector */
  .lang-selector select {
    width: auto;
    min-width: 0;
    padding: 0 10px;
    background-image: none;
    text-align: center;
    text-align-last: center;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .form-group {
    margin-bottom: var(--spacing-sm);
  }

  /* Larger touch targets for inputs */
  .form-control,
  .form-select,
  .btn {
    min-height: 44px;
    font-size: 16px;
  }

  /* Wizard Steps Vertical or Compressed */
  .wizard-steps {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .wizard-step {
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
  }

  .wizard-step::after {
    display: none;
  }

  .connection-status {
    display: none;
  }

  .sync-health {
    gap: 6px;
    padding: 6px 8px;
    font-size: 0.66rem;
}

  .sync-health-meta {
    display: none;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .content-body {
    padding: 10px 8px;
  }

  .chart-container {
    height: 220px;
  }

  .table-container .data-table,
  .table-responsive .data-table,
  .data-table {
    min-width: 560px;
  }
}

/* ========================================
   Luxury UI/UX Redesign Override
   ======================================== */

:root {
  --lux-ink: #e8edf8;
  --lux-ink-muted: #9ea8be;
  --lux-gold: #d4b06a;
  --lux-gold-soft: rgba(212, 176, 106, 0.2);
  --lux-panel: rgba(10, 24, 42, 0.74);
  --lux-panel-strong: rgba(11, 18, 34, 0.9);
  --lux-border: rgba(255, 255, 255, 0.16);
  --lux-shadow: 0 24px 60px rgba(3, 8, 20, 0.48);
}

body {
  background:
    radial-gradient(circle at 10% 8%, rgba(212, 176, 106, 0.2), transparent 40%),
    radial-gradient(circle at 88% 2%, rgba(37, 99, 235, 0.22), transparent 36%),
    linear-gradient(155deg, #070d1b 0%, #0c162c 48%, #101e3d 100%);
  color: var(--lux-ink);
}

body::before {
  background:
    radial-gradient(circle at 20% 18%, rgba(212, 176, 106, 0.22), transparent 46%),
    radial-gradient(circle at 82% 12%, rgba(59, 130, 246, 0.24), transparent 42%),
    linear-gradient(160deg, rgba(5, 10, 20, 0.84), rgba(10, 18, 34, 0.92));
  opacity: 1;
}

.sidebar {
  background:
    linear-gradient(170deg, rgba(5, 10, 20, 0.98) 0%, rgba(9, 20, 40, 0.96) 56%, rgba(12, 40, 78, 0.9) 100%),
    radial-gradient(circle at 18% 14%, rgba(212, 176, 106, 0.2), transparent 42%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.main-header {
  position: sticky;
  top: 0;
  background: rgba(7, 14, 28, 0.72);
  border-bottom: 1px solid var(--lux-border);
  box-shadow: 0 16px 42px rgba(2, 8, 24, 0.48);
  backdrop-filter: blur(16px);
}

.card,
.chat-panel,
.modal,
.chart-container,
.table-mobile-cards tr {
  background: linear-gradient(160deg, rgba(16, 24, 42, 0.86) 0%, rgba(11, 18, 34, 0.9) 100%);
  border: 1px solid var(--lux-border);
  box-shadow: var(--lux-shadow);
  backdrop-filter: blur(14px);
}

.card-header,
.modal-header,
.modal-footer,
.card-footer,
.chat-panel-header {
  background: linear-gradient(145deg, rgba(212, 176, 106, 0.14), rgba(255, 255, 255, 0.02));
  border-color: var(--lux-border);
}

.card-title,
.stat-info h3,
.page-title,
.page-header h1 {
  color: #f8fbff;
}

.form-control,
.form-select,
.lang-selector select,
.header-search input,
.sidebar-search input,
textarea.form-control {
  background: rgba(7, 14, 28, 0.65);
  border-color: rgba(255, 255, 255, 0.2);
  color: #f8fbff;
}

.form-control::placeholder,
.header-search input::placeholder,
.sidebar-search input::placeholder {
  color: var(--lux-ink-muted);
}

.form-control:focus,
.form-select:focus,
.header-search input:focus,
.sidebar-search input:focus {
  border-color: var(--lux-gold);
  box-shadow: 0 0 0 3px rgba(212, 176, 106, 0.2);
}

.btn {
  border-radius: 14px;
  border: 1px solid transparent;
  letter-spacing: 0.2px;
}

.btn-primary {
  background: linear-gradient(140deg, #d4b06a 0%, #c08b2f 100%);
  color: #111827;
  box-shadow: 0 14px 28px rgba(192, 139, 47, 0.34);
}

.btn-primary:hover {
  background: linear-gradient(140deg, #e0c58b 0%, #c9963e 100%);
}

.btn-outline,
.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.24);
  color: #f8fbff;
}

.btn-outline:hover,
.btn-secondary:hover {
  background: rgba(212, 176, 106, 0.14);
  border-color: rgba(212, 176, 106, 0.55);
}

.data-table th {
  background: linear-gradient(145deg, rgba(212, 176, 106, 0.2), rgba(255, 255, 255, 0.03));
  color: #f8fbff;
  border-bottom-color: var(--lux-border);
}

.data-table td {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.data-table tbody tr:hover {
  background: rgba(0, 179, 255, 0.15);
  color: var(--text-primary);
}

body.theme-dark .data-table tbody tr:hover {
  background: rgba(0, 179, 255, 0.2);
  color: #ffffff;
}

.table-container {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
}

.stat-card {
  background: linear-gradient(145deg, rgba(212, 176, 106, 0.14), rgba(21, 32, 58, 0.78));
  border: 1px solid var(--lux-border);
}

.badge-success,
.badge-danger,
.badge-warning,
.badge-info,
.alert-success,
.alert-danger,
.alert-warning,
.alert-info {
  border-color: rgba(255, 255, 255, 0.18);
}

.alert {
  background: rgba(13, 22, 40, 0.76);
  color: #f8fbff;
}

.user-avatar,
.sidebar-logo {
  background: linear-gradient(145deg, rgba(212, 176, 106, 0.28), rgba(255, 255, 255, 0.12));
  color: #fffdf9;
}

.app-footer {
  color: var(--lux-ink-muted);
}

/* Responsive polish */
@media (min-width: 1200px) {
  .content-body {
    padding-inline: clamp(24px, 3vw, 42px);
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

@media (max-width: 1024px) {
  .main-header {
    padding: 10px 14px;
  }

  .card,
  .chat-panel,
  .modal {
    border-radius: 18px;
  }

  .header-controls-row {
    width: 100%;
    justify-content: flex-end;
    gap: 8px;
  }

  .sidebar-toggle-header {
    display: flex !important;
  }
}

@media (max-width: 768px) {
  .main-header {
    min-height: 62px;
    gap: 6px;
    padding: 8px 10px;
  }

  .content-body {
    padding: 10px;
  }

  .card,
  .chat-panel,
  .stat-card,
  .modal {
    border-radius: 14px;
  }

  .card-header,
  .card-body,
  .card-footer,
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 12px;
  }

  .btn,
  .form-control,
  .form-select,
  .lang-selector select,
  .theme-toggle {
    min-height: 44px;
  }

  .table-container .data-table,
  .table-responsive .data-table,
  .data-table {
    min-width: 560px;
  }
}

@media (max-width: 540px) {
  .sidebar {
    width: min(86vw, 300px);
  }

  .header-actions {
    gap: 4px;
  }

  .header-icon,
  .sidebar-toggle {
    width: 44px; /* Increased for better mobile touch */
    height: 44px;
    font-size: 1.1rem;
  }

  .table-container .data-table,
  .table-responsive .data-table,
  .data-table {
    min-width: 520px;
  }
}

/* 
=============================================
   MODERN CSS3 ANIMATONS & ENHANCEMENTS
=============================================
*/

/* 1. Keyframes Definitions */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translate3d(0, -20px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translate3d(20px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0px); }
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(0, 179, 255, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(0, 179, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 179, 255, 0); }
}

@keyframes ripple {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(4); opacity: 0; }
}

/* 2. Global Entry Animations */

/* Animate main content area on load */
.main-content {
    animation: fadeIn 0.6s ease-out forwards;
}

/* Animate cards sequentially */
.card {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
    animation: fadeInUp 0.6s ease-out forwards;
    /* Optimizing performance */
    will-change: transform, box-shadow;
}

/* Stagger animation for cards if they are siblings */
.row > div:nth-child(1) .card { animation-delay: 0.1s; }
.row > div:nth-child(2) .card { animation-delay: 0.2s; }
.row > div:nth-child(3) .card { animation-delay: 0.3s; }
.row > div:nth-child(4) .card { animation-delay: 0.4s; }

/* 3. Component Enhancements */

/* Cards Hover Effect - Lift & Shadow */
.card:hover:not(.no-hover) {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow-hover);
    border-color: rgba(0, 179, 255, 0.3);
}

/* Buttons - Modern feel */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 1;
}

.btn:active {
    transform: scale(0.96);
}

/* Primary Button Glow on Hover */
.btn-primary:hover {
    box-shadow: 0 8px 15px rgba(0, 179, 255, 0.3);
    transform: translateY(-2px);
}

/* Form Inputs - Focus Animation */
.form-control, .form-select {
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 179, 255, 0.15);
}

/* Table Rows - Hover Highlight */
.table tbody tr {
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(0, 179, 255, 0.15);
    color: var(--text-primary);
}

body.theme-dark .table tbody tr:hover {
    background-color: rgba(0, 179, 255, 0.2);
    color: #ffffff;
}

/* Sidebar Navigation Items - Slide In */
.sidebar .nav-item {
    transition: all 0.2s ease;
}

.sidebar .nav-item:hover {
    padding-left: 20px; /* Slide text right on hover */
}

.sidebar .nav-item.active {
    animation: slideInRight 0.4s ease-out;
}

/* Modals - Smooth Entry */
.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
    transform: scale(0.9);
}

.modal.show .modal-dialog {
    transform: scale(1);
    animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Dropdowns - Smooth list open */
.dropdown-menu {
    animation: scaleIn 0.2s ease-out forwards;
    transform-origin: top right;
}

/* Dashboard Stats Cards - Floating Icon */
.stat-card .icon-box i {
    transition: transform 0.3s ease;
}

.stat-card:hover .icon-box i {
    transform: scale(1.2) rotate(5deg);
}

/* Links - Underline expansion */
a.link-animate {
    position: relative;
    text-decoration: none;
}

a.link-animate::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

a.link-animate:hover::after {
    width: 100%;
}

/* Badge - Pulse for notifications/active items */
.badge.badge-pulse {
    animation: pulse-glow 2s infinite;
}

/* Loading Skeleton Animation */
@keyframes skeleton-loading {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
    background-color: #eee;
    background-image: linear-gradient(
        90deg,
        #eee,
        #f5f5f5,
        #eee
    );
    background-size: 200px 100%;
    background-repeat: no-repeat;
    animation: skeleton-loading 1.5s infinite;
}

/* Toast Notifications - Slide In */
.toast-container .toast {
    animation: slideInRight 0.4s ease-out forwards;
}

/* Page Header Title */
.page-header h1 {
    animation: fadeInDown 0.5s ease-out;
}

/* Login/Auth Pages Specific */
.login-card {
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Fix for reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01s !important;
        scroll-behavior: auto !important;
    }
}

/* ========================================
   Final Responsive Stability Overrides
   ======================================== */

@media (max-width: 992px) {
  .content-body {
    padding: 14px;
  }

  .page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .page-actions .btn,
  .page-actions button.btn {
    flex: 1 1 220px;
    min-width: 0;
  }

  .table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 768px) {
  .content-body {
    padding: 12px 10px;
  }

  .page-actions .btn,
  .page-actions button.btn,
  .form-actions .btn,
  .form-actions button.btn {
    width: 100%;
    flex: 1 1 100%;
  }

  .form-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .toast-container {
    left: 10px;
    right: 10px;
    top: 68px;
  }

  .toast {
    min-width: 0;
    width: 100%;
  }

  .modal {
    max-width: calc(100vw - 20px);
  }

  .card-title {
    word-break: break-word;
  }
}

@media (max-width: 480px) {
  .content-body {
    padding: 10px 8px;
  }

  .alert {
    padding: 10px;
    gap: 8px;
  }

  .card-header,
  .card-body,
  .card-footer {
    padding: 10px;
  }
}

/* Expiry Notice Banner */
.expiry-notice {
    padding: 10px 15px;
    margin-bottom: 0;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 1001;
}

.expiry-notice i {
    font-size: 1.1rem;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border-bottom: 1px solid #bfdbfe;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border-bottom: 1px solid #fde68a;
}

.alert-danger {
    background-color: #fee2e2;
    color: #b91c1c;
    border-bottom: 1px solid #fecaca;
}

.theme-dark-bg .alert-info {
    background-color: rgba(30, 64, 175, 0.2);
    color: #60a5fa;
    border-bottom-color: rgba(30, 64, 175, 0.3);
}

.theme-dark-bg .alert-warning {
    background-color: rgba(146, 64, 14, 0.2);
    color: #fbbf24;
    border-bottom-color: rgba(146, 64, 14, 0.3);
}

.theme-dark-bg .alert-danger {
    background-color: rgba(185, 28, 28, 0.2);
    color: #f87171;
    border-bottom-color: rgba(185, 28, 28, 0.3);
}

/* GLOBAL PREMIUM YELLOW OVERRIDE */
.btn-primary, .btn-success, .btn-info, .btn-warning, .btn-primary.btn-sm, .btn-success.btn-sm, .btn-info.btn-sm, .btn-warning.btn-sm {
  background: var(--primary-gradient) !important;
  color: #000 !important;
  border: none !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 15px rgba(250, 204, 21, 0.4) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  transition: all 0.3s ease !important;
}

.btn-primary:hover, .btn-success:hover, .btn-info:hover, .btn-warning:hover {
  background: var(--primary-gradient-hover) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 25px rgba(250, 204, 21, 0.5) !important;
  color: #000 !important;
}

/* GLOBAL LIGHT SURFACE OVERRIDE: remove pure white cards/textboxes */
body.theme-light .card,
body.theme-light-bg .card,
body.theme-light .modal,
body.theme-light-bg .modal,
body.theme-light .chat-panel,
body.theme-light-bg .chat-panel,
body.theme-light .table-mobile-cards tr,
body.theme-light-bg .table-mobile-cards tr,
body.theme-light .data-table td,
body.theme-light-bg .data-table td,
body.theme-light .data-table th,
body.theme-light-bg .data-table th {
  background-color: var(--card-bg) !important;
}

body.theme-light .form-control,
body.theme-light-bg .form-control,
body.theme-light .form-select,
body.theme-light-bg .form-select,
body.theme-light textarea.form-control,
body.theme-light-bg textarea.form-control,
body.theme-light .form-static,
body.theme-light-bg .form-static {
  background-color: var(--input-bg) !important;
  color: var(--text-primary) !important;
}

body.theme-light [style*="background: #fff"],
body.theme-light-bg [style*="background: #fff"],
body.theme-light [style*="background:#fff"],
body.theme-light-bg [style*="background:#fff"],
body.theme-light [style*="background: #ffffff"],
body.theme-light-bg [style*="background: #ffffff"],
body.theme-light [style*="background:#ffffff"],
body.theme-light-bg [style*="background:#ffffff"],
body.theme-light [style*="background: #f9fafb"],
body.theme-light-bg [style*="background: #f9fafb"],
body.theme-light [style*="background:#f9fafb"],
body.theme-light-bg [style*="background:#f9fafb"],
body.theme-light [style*="background-color: #fff"],
body.theme-light-bg [style*="background-color: #fff"],
body.theme-light [style*="background-color:#fff"],
body.theme-light-bg [style*="background-color:#fff"],
body.theme-light [style*="background-color: #ffffff"],
body.theme-light-bg [style*="background-color: #ffffff"],
body.theme-light [style*="background-color:#ffffff"],
body.theme-light-bg [style*="background-color:#ffffff"],
body.theme-light [style*="background-color: #f9fafb"],
body.theme-light-bg [style*="background-color: #f9fafb"],
body.theme-light [style*="background-color:#f9fafb"],
body.theme-light-bg [style*="background-color:#f9fafb"] {
  background: var(--input-bg) !important;
  color: var(--text-primary) !important;
}

body.theme-light [style*="background: #fff"] *,
body.theme-light-bg [style*="background: #fff"] *,
body.theme-light [style*="background:#fff"] *,
body.theme-light-bg [style*="background:#fff"] *,
body.theme-light [style*="background: #ffffff"] *,
body.theme-light-bg [style*="background: #ffffff"] *,
body.theme-light [style*="background:#ffffff"] *,
body.theme-light-bg [style*="background:#ffffff"] *,
body.theme-light [style*="background: #f9fafb"] *,
body.theme-light-bg [style*="background: #f9fafb"] *,
body.theme-light [style*="background:#f9fafb"] *,
body.theme-light-bg [style*="background:#f9fafb"] * {
  color: inherit !important;
}

/* PRINT STYLES - A4 Optimized */
@media print {
  @page {
    size: A4;
    margin: 15mm;
  }
  body {
    background: white !important;
    color: black !important;
    font-size: 12pt !important;
  }
  .sidebar, .topbar, .btn:not(.print-visible), .card-header .card-actions, .breadcrumb, .form-row, .alert, .footer {
    display: none !important;
  }
  .main-content {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
    margin-bottom: 20px !important;
  }
  .card-body {
    padding: 0 !important;
  }
  .data-table {
    width: 100% !important;
    border-collapse: collapse !important;
  }
  .data-table th, .data-table td {
    border: 1px solid #ddd !important;
    padding: 8px !important;
    font-size: 10pt !important;
    color: black !important;
  }
  .stat-card {
    border: 1px solid #eee !important;
    padding: 10px !important;
    margin-bottom: 10px !important;
  }
  .print-header {
    display: block !important;
    text-align: center !important;
    margin-bottom: 30px !important;
  }
  .print-header h2 {
    margin: 0;
    color: #000;
  }
  .print-footer {
    display: flex !important;
    justify-content: space-between !important;
    margin-top: 50px !important;
    border-top: 1px solid #eee !important;
    padding-top: 20px !important;
  }
  .signature-box {
    text-align: center !important;
    width: 200px !important;
  }
  .signature-line {
    border-top: 1px solid #000 !important;
    margin-top: 40px !important;
    padding-top: 5px !important;
  }
}

/* ========================================
   Reference Theme: Blue Sidebar + White App
   ======================================== */

body,
body.theme-light,
body.theme-light-bg {
  background: linear-gradient(140deg, #89dbe8 0%, #9de4ef 50%, #93deea 100%) !important;
  color: #0f2544 !important;
}

body::before,
body::after {
  display: none !important;
}

.sidebar {
  background: linear-gradient(180deg, #0b3a8f 0%, #0f4bb8 55%, #1560d6 100%) !important;
  box-shadow: 0 18px 40px rgba(10, 57, 140, 0.35) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.sidebar-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.18) !important;
  background: rgba(255, 255, 255, 0.06) !important;
}

.sidebar-logo {
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.94) !important;
  color: #0f4bb8 !important;
  box-shadow: 0 10px 20px rgba(2, 20, 56, 0.3) !important;
}

.sidebar-brand,
.sidebar-brand small,
.nav-section,
.nav-item,
.sidebar .user-name,
.sidebar .user-role {
  color: #f3f8ff !important;
}

.nav-item {
  border-radius: 12px !important;
  border: 1px solid transparent !important;
}

.nav-item i {
  background: rgba(255, 255, 255, 0.14) !important;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  transform: translateX(0) !important;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.2) !important;
  border-color: rgba(255, 255, 255, 0.26) !important;
  box-shadow: none !important;
}

.main-content {
  background: transparent !important;
}

.main-header {
  background: rgba(255, 255, 255, 0.94) !important;
  border-bottom: 1px solid #dce8f7 !important;
  box-shadow: 0 8px 24px rgba(17, 64, 143, 0.08) !important;
  backdrop-filter: blur(8px) !important;
}

.header-title,
.page-title,
.card-title,
.header-icon,
.breadcrumb,
.breadcrumb a,
.topbar-title {
  color: #10305d !important;
}

label,
.form-label {
  color: #1b4f88 !important;
}

.header-icon,
.sidebar-toggle {
  background: #edf4ff !important;
  border: 1px solid #d3e3f8 !important;
  color: #19457d !important;
}

.content-body {
  padding: 18px !important;
  background: #f5f9ff !important;
}

.card,
.stat-card,
.chat-panel,
.modal,
.table-container,
.chart-container {
  background: #ffffff !important;
  border: 1px solid #dde8f7 !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 26px rgba(18, 74, 162, 0.1) !important;
}

.card-header,
.card-footer,
.modal-header,
.modal-footer,
.chat-panel-header {
  background: #f7fbff !important;
  border-color: #e2ebf8 !important;
}

.form-control,
.form-select,
textarea.form-control,
.lang-selector select,
.header-search input {
  background: #ffffff !important;
  border: 1px solid #cfdff4 !important;
  color: #0f2544 !important;
  border-radius: 12px !important;
}

.form-control:focus,
.form-select:focus,
.header-search input:focus {
  border-color: #2d74d6 !important;
  box-shadow: 0 0 0 3px rgba(45, 116, 214, 0.16) !important;
}

.btn {
  text-transform: none !important;
  letter-spacing: normal !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}

.btn-primary,
.btn-info,
.btn-success,
.btn-warning {
  background: linear-gradient(140deg, #2d74d6 0%, #2260bf 100%) !important;
  color: #ffffff !important;
  border: 1px solid #2258ad !important;
}

.btn-primary:hover,
.btn-info:hover,
.btn-success:hover,
.btn-warning:hover {
  background: linear-gradient(140deg, #3b84ea 0%, #2a68c8 100%) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 8px 20px rgba(45, 116, 214, 0.24) !important;
}

.btn-secondary,
.btn-outline {
  background: #ffffff !important;
  color: #18457f !important;
  border: 1px solid #c7d9f2 !important;
}

.btn-secondary:hover,
.btn-outline:hover {
  background: #eef5ff !important;
  color: #123a6f !important;
}

.data-table th {
  background: #edf4ff !important;
  color: #123a6f !important;
  border-bottom: 1px solid #d4e4f9 !important;
}

.data-table td {
  background: #ffffff !important;
  color: #1e3555 !important;
  border-bottom: 1px solid #e8f0fb !important;
}

.data-table tbody tr:hover {
  background: #f5f9ff !important;
}

.badge {
  border-radius: 999px !important;
}

@media (max-width: 1024px) {
  .sidebar {
    box-shadow: 0 20px 42px rgba(8, 52, 130, 0.38) !important;
  }

  .content-body {
    padding: 12px !important;
  }
}

/* Global Responsive Refinements (Desktop + Tablet) */
@media (min-width: 1400px) {
  .content-body {
    max-width: 1920px !important;
    margin: 0 auto !important;
    padding: 24px 30px !important;
  }

  .page-header {
    align-items: flex-start !important;
    gap: 14px !important;
  }

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

@media (min-width: 769px) and (max-width: 1280px) {
  .content-body {
    padding: 16px !important;
  }

  .form-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  .page-actions {
    width: 100% !important;
    justify-content: flex-start !important;
    gap: 8px !important;
  }
}

@media (max-width: 1024px) {
  .table-container,
  .table-responsive {
    overflow-x: visible !important;
  }

  .table-container .data-table,
  .table-responsive .data-table,
  .data-table {
    min-width: 100% !important;
    width: 100% !important;
    table-layout: fixed;
  }

  .data-table th,
  .data-table td {
    white-space: normal !important;
    word-break: break-word;
  }
}
