/* ============================================================
   TOKENS — VIVID LIGHT MODE (default) & DARK MODE
   ============================================================ */
:root {
  --bg: #f8fafc;
  --bg-elev: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-input: #ffffff;

  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;
  --text-4: #94a3b8;

  --accent-primary: #0f172a;
  --accent-primary-hover: #1e293b;
  --accent-primary-text: #ffffff;
  --blue: #0f172a;
  --blue-dim: #e2e8f0;
  --blue-soft: #f1f5f9;

  --emerald: #10b981;
  --emerald-dim: #d1fae5;
  --emerald-soft: #ecfdf5;

  --amber: #f59e0b;
  --amber-dim: #fef3c7;
  --amber-soft: #fffbeb;

  --red: #ef4444;
  --red-dim: #fee2e2;
  --red-soft: #fef2f2;

  --violet: #8b5cf6;
  --violet-dim: #ede9fe;

  --cyan: #06b6d4;
  --cyan-dim: #cffafe;

  /* HOS dark panel — premium, in both modes */
  --hos-bg: #0f172a;
  --hos-bg-2: #1e293b;
  --hos-text: #f8fafc;
  --hos-text-2: #94a3b8;
  --hos-border: rgba(255, 255, 255, 0.08);
  --hos-track: #1e293b;
  --hos-track-inner: #334155;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;

  --sidebar-w: 260px;
  --topbar-h: 60px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"], .dark {
  --bg: #0b1122;
  --bg-elev: #141b2d;
  --bg-sidebar: #0b1122;
  --bg-card: #141b2d;
  --bg-hover: #182239;
  --bg-input: #141b2d;

  --border: #1f293d;
  --border-strong: #2a3854;

  --text: #f8fafc;
  --text-2: #8290a5;
  --text-3: #64748b;
  --text-4: #475569;

  --accent-primary: #f59e0b;
  --accent-primary-hover: #d97706;
  --accent-primary-text: #020617;
  --blue: #f59e0b;
  --blue-dim: rgba(245, 158, 11, 0.15);
  --blue-soft: rgba(245, 158, 11, 0.08);

  --emerald: #10b981;
  --emerald-dim: rgba(16, 185, 129, 0.15);
  --emerald-soft: rgba(16, 185, 129, 0.08);

  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.15);
  --amber-soft: rgba(245, 158, 11, 0.08);

  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.15);
  --red-soft: rgba(239, 68, 68, 0.08);

  --violet: #8b5cf6;
  --violet-dim: rgba(139, 92, 246, 0.15);

  --cyan: #06b6d4;
  --cyan-dim: rgba(6, 182, 212, 0.15);

  --hos-bg: #020617;
  --hos-bg-2: #0b1126;
  --hos-track: #1e293b;
}

html, body {
  height: 100%;
}

body, button, input, select, textarea {
  font-family: 'Readex Pro', 'Almarai', 'Tajawal', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11', 'tnum';
}

code, kbd, samp, pre, .font-mono {
  font-family: 'JetBrains Mono', 'Fira Code', 'Roboto Mono', monospace !important;
}

body {
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: var(--bg);
  color: var(--text);
}

.root {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}

/* ============================================================
   LEGACY MUI HARMONIZATION (FOR CLASSIC SCREENS)
   ============================================================ */
/* Primary Action Buttons - Harmonized Across Classic and Modern */
.MuiButton-containedPrimary {
  background: var(--accent-primary) !important;
  color: var(--accent-primary-text) !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15) !important;
}
.MuiButton-containedPrimary:hover {
  background: var(--accent-primary-hover) !important;
}
.MuiFab-primary {
  background: var(--accent-primary) !important;
  color: var(--accent-primary-text) !important;
}
.MuiFab-primary:hover {
  background: var(--accent-primary-hover) !important;
}

.MuiPaper-root {
  background-color: var(--bg-card) !important;
  color: var(--text) !important;
}

.MuiAccordion-root {
  background-color: var(--bg-card) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  margin-bottom: 10px !important;
  box-shadow: none !important;
  transition: all 0.2s var(--ease) !important;
}
.MuiAccordion-root:before {
  display: none !important;
}
.MuiAccordion-root:hover {
  border-color: var(--border-strong) !important;
}
.MuiAccordionSummary-root {
  color: var(--text) !important;
  font-family: 'Tajawal', 'Almarai', 'Cairo', 'Inter', sans-serif !important;
  font-weight: 700 !important;
  padding: 0 16px !important;
}
.MuiAccordionSummary-expandIconWrapper {
  color: var(--text-3) !important;
}
.MuiAccordionDetails-root {
  border-top: 1px solid var(--border) !important;
  padding: 16px !important;
}

.MuiTypography-root {
  font-family: 'Tajawal', 'Almarai', 'Cairo', 'Inter', -apple-system, sans-serif !important;
}

.MuiOutlinedInput-root {
  background-color: var(--bg-input) !important;
  color: var(--text) !important;
  border-radius: var(--radius-sm) !important;
  font-family: 'Tajawal', 'Almarai', 'Cairo', 'Inter', sans-serif !important;
  font-size: 13.5px !important;
}
.MuiOutlinedInput-notchedOutline {
  border-color: var(--border) !important;
  border-width: 1.5px !important;
}
.MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline {
  border-color: var(--border-strong) !important;
}
.MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline {
  border-color: var(--blue) !important;
  border-width: 1.5px !important;
  box-shadow: 0 0 0 3px var(--blue-soft) !important;
}
.MuiInputLabel-root {
  color: var(--text-2) !important;
  font-family: 'Tajawal', 'Almarai', 'Cairo', sans-serif !important;
  font-size: 13.5px !important;
}
.MuiInputLabel-root.Mui-focused {
  color: var(--blue) !important;
}

.MuiTableCell-root {
  border-bottom: 1px solid var(--border) !important;
  color: var(--text) !important;
  font-family: 'Tajawal', 'Almarai', 'Cairo', 'Inter', sans-serif !important;
  font-size: 13px !important;
  padding: 12px 16px !important;
}
.MuiTableCell-head {
  background-color: var(--bg-hover) !important;
  color: var(--text-3) !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  letter-spacing: 0.4px !important;
  text-transform: uppercase !important;
}
.MuiTableRow-root:hover {
  background-color: var(--bg-hover) !important;
}

.MuiDialog-paper {
  background-color: var(--bg-elev) !important;
  color: var(--text) !important;
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 20px 50px -15px rgba(15, 23, 42, 0.4) !important;
  font-family: 'Tajawal', 'Almarai', 'Cairo', 'Inter', sans-serif !important;
}
.MuiDialogTitle-root {
  color: var(--text) !important;
  font-family: 'Tajawal', 'Almarai', 'Cairo', 'Inter', sans-serif !important;
  border-bottom: 1px solid var(--border) !important;
  font-size: 15px !important;
  font-weight: 700 !important;
}
.MuiDialogActions-root {
  border-top: 1px solid var(--border) !important;
  padding: 12px 20px !important;
}

/* ============================================================
   SVG ICON NORMALIZATION & ESSENTIAL COMPONENT STYLES
   ============================================================ */
.stat-icon svg,
.action-btn svg,
.nav-item svg,
.btn-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  display: inline-block;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s var(--ease);
}
.stat-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: var(--border-strong);
}

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

.stat-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--blue-soft); color: var(--blue); }
.stat-icon.emerald { background: var(--emerald-soft); color: var(--emerald); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber); }
.stat-icon.red { background: var(--red-soft); color: var(--red); }

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 6px;
}

.stat-desc {
  font-size: 11px;
  font-weight: 500;
}
.stat-desc.info { color: var(--blue); }
.stat-desc.ok { color: var(--emerald); }
.stat-desc.pending { color: var(--amber); }
.stat-desc.warn { color: var(--red); }

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}
.action-btn.info {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
}
.action-btn.info:hover {
  opacity: 0.9;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  transition: all 0.2s var(--ease);
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.nav-item.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.nav-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  margin-inline-start: auto;
}
.nav-badge.warn { background: var(--amber-dim); color: var(--amber); }

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-pill.emerald { background: var(--emerald-dim); color: var(--emerald); }
.badge-pill.red { background: var(--red-dim); color: var(--red); }

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}