:root{
  --uae-green:#0b7a3e;
  --uae-red:#c53b3b;
  --uae-black:#0b1220;

  /* Light */
  --bg:#f4f6f9;
  --surface:#ffffff;
  --card:#ffffff;

  --text:#0f172a;
  --muted: rgba(15,23,42,.62);

  --border: rgba(15,23,42,.10);
  --shadow: 0 10px 25px rgba(2,6,23,.10);

  --radius: 14px;
  --navbar-h: 64px;
  --subnav-h: 54px;
}

/* Dark Theme */
html[data-theme="dark"]{
  color-scheme: dark;

  --bg:#0b1220;
  --surface:#0f172a;
  --card:#0f172a;

  --text:#e5e7eb;
  --muted: rgba(229,231,235,.68);

  --border: rgba(255,255,255,.10);
  --shadow: 0 18px 35px rgba(0,0,0,.35);
}

/* Base */
*{ box-sizing: border-box; }
.uae-admin{
  background: var(--bg);
  color: var(--text);
}

/* Make bootstrap components follow theme better */
html[data-theme="dark"] body{
  background: var(--bg);
  color: var(--text);
}

a{ color: inherit; }
a:hover{ color: inherit; }

/* TOPBAR */
.uae-navbar{
  position: sticky;
  top: 0;
  z-index: 1050;
  height: var(--navbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(2,6,23,.06);
}

/* Brand */
.uae-brand{
  text-decoration: none;
  color: var(--text);
}
.uae-brand:hover{ color: var(--text); }

.uae-logo-dot{
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--uae-red);
  box-shadow: 0 0 0 6px rgba(197,59,59,.14);
}

.fw-black{ font-weight: 900; }

.uae-page-meta{
  line-height: 1.1;
}
.uae-subtitle{
  font-size: .82rem;
  color: var(--muted);
}
.uae-title{
  font-weight: 900;
  font-size: 1.15rem;
}

/* ICON BUTTONS */
.uae-iconbtn{
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display:flex;
  align-items:center;
  justify-content:center;
  transition: .15s ease;
}
.uae-iconbtn:hover{
  background: rgba(11,122,62,.08);
  border-color: rgba(11,122,62,.22);
}
.uae-iconbtn:active{ transform: translateY(1px); }

/* Small badge */
.uae-pill-badge{
  position:absolute;
  top: -6px;
  inset-inline-end: -6px;
  background: var(--uae-red);
  color: #fff;
  font-size: .72rem;
  padding: 2px 6px;
  border-radius: 999px;
  border: 2px solid var(--surface);
}

/* USER BUTTON */
.uae-userbtn{
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(11,122,62,.22);
  background: rgba(11,122,62,.08);
  color: var(--text);
  font-weight: 900;
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 0 12px;
  transition: .15s ease;
}
.uae-userbtn:hover{ background: rgba(11,122,62,.12); }
.uae-userbtn:active{ transform: translateY(1px); }

html[data-theme="dark"] .uae-userbtn{
  background: rgba(11,122,62,.14);
  border-color: rgba(11,122,62,.28);
}

.uae-avatar{
  width: 28px; height: 28px;
  border-radius: 10px;
  background: rgba(11,122,62,.18);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
}

/* DROPDOWN */
.uae-dropdown{
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--surface);
  z-index: 2000;
  overflow: hidden;
}
.uae-dropdown .dropdown-item{
  color: var(--text);
  font-weight: 600;
}
.uae-dropdown .dropdown-item:hover{
  background: rgba(11,122,62,.10);
}
.uae-dropdown .dropdown-divider{
  border-top: 1px solid var(--border);
}

/* HORIZONTAL MENU */
.uae-subnav{
  position: sticky;
  top: var(--navbar-h);
  z-index: 1040;
  height: var(--subnav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.uae-subnav-scroll{
  height: var(--subnav-h);
  display:flex;
  align-items:center;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding: 0 4px;
}

/* scroll bar style */
.uae-subnav-scroll::-webkit-scrollbar{ height: 6px; }
.uae-subnav-scroll::-webkit-scrollbar-thumb{
  background: rgba(15,23,42,.12);
  border-radius: 999px;
}
html[data-theme="dark"] .uae-subnav-scroll::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.14);
}

.uae-subnav-link{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  text-decoration:none;
  color: rgba(15,23,42,.78);
  border: 1px solid transparent;
  font-weight: 800;
  transition: .15s ease;
}
html[data-theme="dark"] .uae-subnav-link{
  color: rgba(229,231,235,.80);
}

.uae-subnav-link i{
  font-size: 1.05rem;
  opacity: .9;
}

.uae-subnav-link:hover{
  background: rgba(11,122,62,.08);
  border-color: rgba(11,122,62,.22);
  color: var(--text);
}

.uae-subnav-link.active{
  background: rgba(11,122,62,.14);
  border-color: rgba(11,122,62,.26);
  color: var(--text);
  box-shadow: 0 10px 16px rgba(11,122,62,.10);
}

.uae-subnav-link.disabled{
  opacity: .45;
  pointer-events: none;
}

.uae-subnav-sep{
  width: 1px;
  height: 22px;
  background: rgba(15,23,42,.10);
  margin: 0 2px;
}
html[data-theme="dark"] .uae-subnav-sep{
  background: rgba(255,255,255,.12);
}

/* CONTENT */
.uae-content{
  padding: 18px;
  margin-top: 12px;
}

/* CARDS */
.kpi-card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 18px rgba(2,6,23,.06);
}

/* ALERT */
.uae-alert{
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 18px rgba(2,6,23,.06);
}

/* TABLE polish */
.table{
  color: var(--text);
}
.table thead th{
  color: rgba(15,23,42,.70);
  font-weight: 800;
}
html[data-theme="dark"] .table thead th{
  color: rgba(229,231,235,.70);
}
.table td, .table th{
  border-color: var(--border) !important;
}

/* Forms polish */
.form-control, .form-select{
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
}
.form-control::placeholder{
  color: rgba(15,23,42,.45);
}
html[data-theme="dark"] .form-control::placeholder{
  color: rgba(229,231,235,.45);
}
.form-control:focus, .form-select:focus{
  border-color: rgba(11,122,62,.38);
  box-shadow: 0 0 0 .25rem rgba(11,122,62,.12);
}

/* Buttons */
.btn-primary{
  background: var(--uae-green);
  border-color: var(--uae-green);
}
.btn-primary:hover{
  filter: brightness(.95);
}
.btn-outline-secondary{
  border-color: var(--border);
  color: var(--text);
}
.btn-outline-secondary:hover{
  background: rgba(15,23,42,.06);
  border-color: var(--border);
}
html[data-theme="dark"] .btn-outline-secondary:hover{
  background: rgba(255,255,255,.06);
}

/* Pagination */
.pagination .page-link{
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}
.pagination .page-link:hover{
  background: rgba(11,122,62,.08);
}
.pagination .page-item.active .page-link{
  background: rgba(11,122,62,.18);
  border-color: rgba(11,122,62,.35);
  color: var(--text);
}

/* Small helpers */
.text-muted{
  color: var(--muted) !important;
}



/* =========================
   Dark mode - Tables Fix
   ========================= */

/* خلي كل خلايا الجدول شفافة حتى يبان لون الكارد */
html[data-theme="dark"] .table > :not(caption) > * > *{
  background-color: transparent !important;
  color: var(--text) !important;
  box-shadow: none !important;
}

/* ضبط متغيرات Bootstrap للجداول بالدارك */
html[data-theme="dark"] .table{
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg: rgba(255,255,255,.04);
  --bs-table-striped-color: var(--text);
  --bs-table-hover-bg: rgba(11,122,62,.10);
  --bs-table-hover-color: var(--text);
}

/* رأس الجدول */
html[data-theme="dark"] .table thead th{
  background: rgba(255,255,255,.03) !important;
  color: rgba(229,231,235,.85) !important;
  border-color: var(--border) !important;
}

/* خطوط الجدول */
html[data-theme="dark"] .table td,
html[data-theme="dark"] .table th{
  border-color: var(--border) !important;
}

/* striped / hover */
html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > *{
  background-color: rgba(255,255,255,.03) !important;
}
html[data-theme="dark"] .table-hover > tbody > tr:hover > *{
  background-color: rgba(11,122,62,.10) !important;
}

/* إذا في صفحات مستخدمة table-light أو bg-white */
html[data-theme="dark"] .table-light{
  --bs-table-bg: transparent !important;
  --bs-table-color: var(--text) !important;
}
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-light{
  background-color: transparent !important;
}

/* تحسين table-responsive (أحياناً بيبين أبيض) */
html[data-theme="dark"] .table-responsive{
  background: transparent !important;
}

/* Badges أفضل بالدارك */
html[data-theme="dark"] .badge.text-bg-warning{ color: #111827 !important; }
html[data-theme="dark"] .badge.text-bg-success{ color: #ffffff !important; }
html[data-theme="dark"] .badge.text-bg-danger{ color: #ffffff !important; }
