/* ==========================================================================
   إرتواء الندى — Design System
   Extracted 1:1 from the approved PDF designs.
   ========================================================================== */

/* --------------------------------------------------------------- 1. Tokens */
:root {
  /* Brand */
  --navy-900: #001E40;
  --navy-800: #002B52;
  --navy-700: #003366;
  --navy-600: #0A3D73;

  --blue-700: #005CBA;
  --blue-600: #0066CC;
  --blue-500: #1479E0;
  --blue-400: #5095FE;
  --blue-100: #D5E3FF;
  --blue-050: #DBEAFE;

  --cyan-600: #00A8AB;
  --cyan-500: #00CED1;
  --cyan-200: #9BEDEF;
  --cyan-100: #CCF5F6;
  --cyan-050: #CCEEFF;

  /* Neutrals */
  --bg:        #F7F9FB;
  --bg-tint:   #EFF7FB;
  --surface:   #FFFFFF;
  --surface-2: #F2F4F6;
  --surface-3: #ECEEF0;
  --border:    #E0E3E5;
  --border-2:  #C3C6D1;

  --text:      #191C1E;
  --text-2:    #43474F;
  --text-3:    #737780;
  --text-inv:  #FFFFFF;

  /* Status */
  --green-600: #16A34A;
  --green-050: #DCFCE7;
  --red-600:   #E11D48;
  --red-050:   #FFE4E9;
  --amber-600: #D97706;
  --amber-050: #FEF3C7;

  /* Typography */
  --font-ar: "Alexandria", "Tajawal", "Cairo", "Segoe UI", system-ui, sans-serif;
  --font-en: "Plus Jakarta Sans", "Alexandria", "Segoe UI", system-ui, sans-serif;

  /* Radii */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-2xl: 22px;
  --r-pill: 999px;

  /* Elevation */
  --sh-xs: 0 1px 2px rgba(16, 30, 54, .04);
  --sh-sm: 0 1px 3px rgba(16, 30, 54, .06), 0 1px 2px rgba(16, 30, 54, .04);
  --sh-md: 0 4px 16px rgba(16, 30, 54, .06);
  --sh-lg: 0 10px 32px rgba(16, 30, 54, .08);
  --sh-navy: 0 14px 34px rgba(0, 30, 64, .22);

  /* Layout */
  --container: 1156px;
  --gutter: 22px;
  --header-h: 74px;

  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ---------------------------------------------------------------- 2. Reset */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ar);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body[dir="ltr"] { font-family: var(--font-en); }

h1, h2, h3, h4, h5, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }

:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--cyan-200); color: var(--navy-900); }

/* Latin runs (numbers, IDs, emails) keep the Latin face inside Arabic copy and
   are bidi-isolated so "#ORD-9921" / "+12%" never get their sign or hash
   flipped to the wrong end of the string. */
.lat, .num {
  font-family: var(--font-en);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
}

/* --------------------------------------------------------------- 3. Layout */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.page { padding-block: 34px 64px; }

.stack   { display: flex; flex-direction: column; }
.row     { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.grow    { flex: 1 1 auto; min-width: 0; }

.gap-4  { gap: 4px; }  .gap-6  { gap: 6px; }  .gap-8  { gap: 8px; }
.gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.gap-20 { gap: 20px; } .gap-24 { gap: 24px; }

.mt-8  { margin-top: 8px; }  .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; } .mt-28 { margin-top: 28px; }
.mt-32 { margin-top: 32px; } .mt-40 { margin-top: 40px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Asymmetric splits used across the dashboards */
.split-wide-start { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; }
.split-wide-end   { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 20px; }

/* --------------------------------------------------------- 4. Typography */
.h-page {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.01em;
  color: var(--navy-900);
}
.h-section { font-size: 24px; font-weight: 700; color: var(--navy-900); line-height: 1.35; }
.h-panel   { font-size: 20px; font-weight: 700; color: var(--navy-700); line-height: 1.4; }
.h-card    { font-size: 16px; font-weight: 700; color: var(--navy-900); }

.sub       { font-size: 14px; color: var(--text-2); }
.sub-sm    { font-size: 12px; color: var(--text-3); }
.muted     { color: var(--text-3); }
.strong    { font-weight: 700; }

.link {
  color: var(--blue-600);
  font-weight: 600;
  transition: color .16s var(--ease);
}
.link:hover { color: var(--blue-700); text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------- 5. Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 26px;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-ar);
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--navy-700);
  white-space: nowrap;
}
body[dir="ltr"] .brand { font-family: var(--font-en); font-size: 25px; }

.brand-tag {
  font-family: var(--font-ar);
  font-size: 11px;
  font-weight: 600;
  color: var(--cyan-600);
  background: var(--cyan-100);
  border-radius: var(--r-pill);
  padding: 3px 10px;
  letter-spacing: 0;
}

/* ---------------------------------------------------- Brand lockup (logo) --
   الملفات الأصلية مربعة وحول الشعار هامش شفاف واسع، والشعار نفسه (القطرة فوق
   الاسم) مرصوص رأسياً. `.brand-logo` تقصّ هذا الهامش حتى يظهر الشعار **كاملاً**
   بحجم مقروء داخل الهيدر بدل أن ينكمش داخل المربع.
   حدود المحتوى داخل المربع: أفقياً 9%–90% ورأسياً 15%–78%.                  */
.brand-logo {
  --logo-h: 54px;
  --logo-full: calc(var(--logo-h) / .63); /* ارتفاع الصورة الكامل بعد القص */
  position: relative;
  flex: none;
  display: block;
  height: var(--logo-h);
  width: calc(var(--logo-h) * 1.286);
  overflow: hidden;
}
.brand-logo img {
  position: absolute;
  top: calc(var(--logo-full) * -.15);
  left: calc(var(--logo-full) * -.09);
  height: var(--logo-full);
  width: var(--logo-full);
  max-width: none;
}
/* اسم المنصة مكتوب داخل الشعار نفسه — يُخفى بصرياً ويبقى لقارئ الشاشة */
.brand .brand-name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 30px;
  margin-inline: auto;
}
.main-nav a {
  position: relative;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  padding-block: 6px;
  white-space: nowrap;
  transition: color .16s var(--ease);
}
/* الروابط لا تنكسر على سطرين — تضيق المسافات بينها بدلاً من ذلك */
.main-nav .nav-drop-trigger { white-space: nowrap; }
.main-nav a:hover { color: var(--navy-700); }
.main-nav a.is-active { color: var(--blue-600); }
.main-nav a.is-active::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--blue-600);
}

.header-actions { display: flex; align-items: center; gap: 14px; }

/* ----------------------------------------------- Portal switcher (nav) --- */
.portal-nav { position: relative; }

.portal-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding-inline: 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-700);
  white-space: nowrap;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.portal-trigger:hover { background: var(--surface-2); border-color: var(--border-2); }
.portal-trigger svg { flex: none; width: 17px; height: 17px; }
.portal-trigger .caret { flex: none; width: 15px; height: 15px; color: var(--text-3); transition: transform .2s var(--ease); }
.portal-nav.is-open .portal-trigger { background: var(--surface-2); border-color: var(--blue-400); }
.portal-nav.is-open .caret { transform: rotate(180deg); }

.portal-menu {
  position: absolute;
  top: calc(100% + 12px);
  inset-inline-start: 0;
  z-index: 90;
  width: 306px;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .18s var(--ease), transform .18s var(--ease), visibility .18s;
}
.portal-nav.is-open .portal-menu { opacity: 1; visibility: visible; transform: none; }

.portal-menu h5 {
  padding: 10px 12px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text-3);
  text-transform: uppercase;
}
.portal-menu h5 + h5 { margin-top: 6px; border-top: 1px solid var(--border); padding-top: 14px; }

.portal-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  transition: background .14s var(--ease);
}
.portal-menu a:hover { background: var(--surface-2); }
.portal-menu a.is-active { background: var(--cyan-050); }

.portal-menu .ico {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--navy-700);
}
.portal-menu a.is-active .ico { background: var(--blue-600); color: #fff; }
.portal-menu .ico svg { width: 19px; height: 19px; }
.portal-menu .t { font-size: 13.5px; font-weight: 700; color: var(--navy-900); line-height: 1.45; }
.portal-menu .s { font-size: 11.5px; color: var(--text-3); }

/* Account menu — same shell, anchored to the opposite edge */
.portal-menu.is-end { inset-inline-start: auto; inset-inline-end: 0; width: 250px; }
.portal-menu .menu-head {
  padding: 12px;
  margin-bottom: 6px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.portal-menu .menu-head .n { font-size: 13.5px; font-weight: 700; color: var(--navy-900); }
.portal-menu .menu-head .r { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.portal-menu .menu-sep { height: 1px; margin: 6px 4px; background: var(--border); }
.portal-menu a.is-danger { color: var(--red-600); }
.portal-menu a.is-danger .ico { background: var(--red-050); color: var(--red-600); }
.portal-menu a.is-danger .t { color: var(--red-600); }

.avatar-trigger {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding-inline: 6px 12px;
  border-radius: var(--r-pill);
  transition: background .16s var(--ease);
}
.avatar-trigger:hover { background: var(--surface-2); }
.avatar-trigger .avatar { width: 30px; height: 30px; font-size: 11.5px; }
.avatar-trigger .who { font-size: 13px; font-weight: 700; color: var(--navy-900); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-trigger svg { width: 15px; height: 15px; color: var(--text-3); transition: transform .2s var(--ease); }
.js-dropdown.is-open .avatar-trigger svg { transform: rotate(180deg); }

@media (max-width: 720px) {
  .avatar-trigger .who { display: none; }
  .portal-trigger span { display: none; }
  .portal-trigger { padding-inline: 10px; }
}

.lang-toggle {
  font-family: var(--font-en);
  font-size: 14px;
  font-weight: 700;
  color: var(--navy-700);
  padding: 6px 4px;
  transition: color .16s var(--ease);
}
.lang-toggle:hover { color: var(--blue-600); }

.header-divider {
  width: 1px;
  height: 26px;
  background: var(--border);
}

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  color: var(--navy-700);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }

.icon-btn .dot {
  position: absolute;
  top: 7px;
  inset-inline-end: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red-600);
  border: 1.5px solid #fff;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  min-width: 230px;
  padding-inline: 14px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.header-search:focus-within { background: #fff; border-color: var(--blue-400); }
.header-search svg { width: 17px; height: 17px; color: var(--text-3); flex: none; }
.header-search input {
  border: 0;
  background: none;
  outline: none;
  width: 100%;
  font-size: 13.5px;
}
.header-search input::placeholder { color: var(--text-3); }

/* -------------------------------------------------------------- 6. Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 44px;
  padding-inline: 22px;
  border-radius: var(--r-md);
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .18s var(--ease), color .18s var(--ease),
              border-color .18s var(--ease), box-shadow .18s var(--ease),
              transform .18s var(--ease);
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--blue-600); color: #fff; box-shadow: 0 6px 16px rgba(0, 102, 204, .22); }
.btn-primary:hover { background: var(--blue-700); }

.btn-navy { background: var(--navy-700); color: #fff; box-shadow: 0 6px 16px rgba(0, 51, 102, .2); }
.btn-navy:hover { background: var(--navy-800); }

.btn-teal { background: var(--cyan-500); color: var(--navy-900); box-shadow: 0 6px 16px rgba(0, 206, 209, .28); }
.btn-teal:hover { background: var(--cyan-600); color: #fff; }

.btn-ghost { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--navy-700); }

.btn-outline { background: transparent; color: var(--blue-600); border-color: var(--blue-600); }
.btn-outline:hover { background: var(--blue-600); color: #fff; }

.btn-danger { background: var(--red-600); color: #fff; box-shadow: 0 6px 16px rgba(225, 29, 72, .22); }
.btn-danger:hover { background: #BE123C; }

.btn-danger-soft { background: transparent; color: var(--red-600); border-color: var(--red-600); }
.btn-danger-soft:hover { background: var(--red-600); color: #fff; }

.btn-success { background: var(--green-600); color: #fff; box-shadow: 0 6px 16px rgba(22, 163, 74, .22); }
.btn-success:hover { background: #15803D; }

.btn-white { background: #fff; color: var(--navy-700); box-shadow: var(--sh-md); }
.btn-white:hover { background: var(--surface-2); }

.btn-sm { height: 36px; padding-inline: 15px; font-size: 13px; border-radius: var(--r-sm); }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { height: 50px; padding-inline: 28px; font-size: 15.5px; }
.btn-block { width: 100%; }

/* Square icon-only action button */
.btn-square {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.btn-square:hover { background: var(--surface-2); color: var(--navy-700); }
.btn-square svg { width: 19px; height: 19px; }
.btn-square.is-blue { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.btn-square.is-blue:hover { background: var(--blue-700); }
.btn-square.is-muted { background: var(--surface-2); border-color: transparent; }

/* Floating action button */
.fab {
  position: fixed;
  inset-inline-start: 30px;
  bottom: 30px;
  z-index: 50;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--cyan-500);
  color: var(--navy-900);
  box-shadow: 0 12px 28px rgba(0, 206, 209, .4);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.fab:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 16px 34px rgba(0, 206, 209, .5); }
.fab svg { width: 26px; height: 26px; }

/* ---------------------------------------------------------------- 7. Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-sm);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 22px 26px;
}
.panel-head + .panel-body { padding-top: 0; }
.panel-body { padding: 22px 26px; }
.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 26px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* Panel with a solid navy title bar (admin ratio panel) */
.panel-navy-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 26px;
  background: var(--navy-700);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}
.panel-navy-head svg { width: 22px; height: 22px; color: var(--cyan-500); }

/* -------------------------------------------------------------- 8. KPI card */
.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 176px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }

.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.kpi-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: var(--r-lg);
  background: var(--cyan-050);
  color: var(--blue-600);
}
.kpi-icon svg { width: 24px; height: 24px; }
.kpi-icon.is-teal  { background: var(--cyan-100); color: var(--cyan-600); }
.kpi-icon.is-blue  { background: var(--blue-050); color: var(--blue-600); }
.kpi-icon.is-muted { background: var(--surface-2); color: var(--navy-700); }
.kpi-icon.is-glass { background: rgba(255, 255, 255, .12); color: #fff; }

.kpi-label { font-size: 14px; color: var(--text-2); }
.kpi-value {
  font-family: var(--font-en);
  font-size: 40px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.02em;
  color: var(--navy-900);
  font-variant-numeric: tabular-nums;
}
.kpi-value .unit {
  font-family: var(--font-ar);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  margin-inline-start: 6px;
  letter-spacing: 0;
}
.kpi-foot { margin-top: auto; }

/* Dark KPI variant */
.kpi.is-dark {
  background: var(--navy-900);
  border-color: var(--navy-900);
  box-shadow: var(--sh-navy);
}
.kpi.is-dark .kpi-label { color: rgba(255, 255, 255, .72); }
.kpi.is-dark .kpi-value { color: #fff; }
.kpi.is-dark .kpi-value .unit { color: rgba(255, 255, 255, .8); }
.kpi.is-dark .sub, .kpi.is-dark .sub-sm { color: rgba(255, 255, 255, .68); }

/* Muted / tinted variants */
.kpi.is-muted { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.kpi.is-tint  { background: var(--bg-tint); border-color: transparent; box-shadow: none; }

/* Trend chip */
.trend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-en);
  font-size: 13px;
  font-weight: 700;
  color: var(--green-600);
}
.trend svg { width: 16px; height: 16px; }
.trend .txt { font-family: var(--font-ar); font-weight: 600; color: var(--text-3); }
.trend.is-teal { color: var(--cyan-600); }
.trend.is-down { color: var(--red-600); }

/* ------------------------------------------------------------- 9. Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.badge::before { content: none; }
.badge.has-dot::before {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-success { background: var(--green-050); color: #15803D; }
.badge-teal    { background: var(--cyan-100);  color: var(--cyan-600); }
.badge-info    { background: var(--blue-050);  color: var(--blue-600); }
.badge-sky     { background: var(--cyan-050);  color: var(--blue-600); }
.badge-danger  { background: var(--red-050);   color: var(--red-600); }
.badge-warn    { background: var(--amber-050); color: var(--amber-600); }
.badge-neutral { background: var(--surface-3); color: var(--text-2); }
.badge-navy    { background: var(--navy-700);  color: #fff; }
.badge-outline-teal {
  background: rgba(0, 206, 209, .12);
  color: var(--cyan-500);
  border: 1px solid rgba(0, 206, 209, .45);
}

/* ------------------------------------------------------------- 10. Tables */
/* Horizontal scroll with edge shadows that appear only when there is more
   table to the side — `local` gradients mask them once you reach an end. */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  background:
    linear-gradient(to right, var(--surface) 40%, rgba(255, 255, 255, 0)) left center,
    linear-gradient(to left,  var(--surface) 40%, rgba(255, 255, 255, 0)) right center,
    radial-gradient(farthest-side at 0 50%,   rgba(16, 30, 54, .13), transparent) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(16, 30, 54, .13), transparent) right center;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 13px 100%, 13px 100%;
  background-attachment: local, local, scroll, scroll;
}

.data-table { min-width: 720px; font-size: 13.5px; }

/* For tables that live inside a narrow column */
.data-table.is-dense { min-width: 600px; font-size: 13px; }
.data-table.is-dense thead th { padding: 13px 10px; font-size: 12.5px; }
.data-table.is-dense tbody td { padding: 13px 10px; }
.data-table.is-dense thead th:first-child,
.data-table.is-dense tbody td:first-child { padding-inline-start: 18px; }
.data-table.is-dense thead th:last-child,
.data-table.is-dense tbody td:last-child { padding-inline-end: 18px; }
.data-table.is-dense .badge { padding: 4px 10px; font-size: 11.5px; }
.data-table.is-dense .svc-chip { padding: 4px 9px 4px 7px; font-size: 11px; }
.data-table.is-dense .svc-chip svg { width: 13px; height: 13px; }
.data-table thead th {
  padding: 15px 18px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  text-align: start;
  white-space: nowrap;
}
.data-table thead th:first-child { padding-inline-start: 26px; }
.data-table thead th:last-child  { padding-inline-end: 26px; }

.data-table tbody td {
  padding: 16px 18px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}
.data-table tbody td:first-child { padding-inline-start: 26px; }
.data-table tbody td:last-child  { padding-inline-end: 26px; }
.data-table tbody tr { transition: background .16s var(--ease); }
.data-table tbody tr:hover { background: #FAFCFE; }
.data-table tbody tr.is-highlight { background: #EFF7FF; }
.data-table tbody tr.is-highlight:hover { background: #E7F2FF; }

.cell-id {
  display: inline-block;
  font-family: var(--font-en);
  font-size: 14px;
  font-weight: 800;
  color: var(--navy-900);
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: isolate;
}
.cell-strong { font-weight: 700; color: var(--navy-900); }
.cell-money  { font-family: var(--font-en); font-weight: 700; color: var(--navy-900); white-space: nowrap; }
.cell-money .cur { font-family: var(--font-ar); font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.cell-accent { color: var(--blue-600); }
.cell-teal   { color: var(--cyan-600); }
.cell-note   { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }

.row-actions { display: flex; align-items: center; gap: 8px; }
.row-action {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.row-action:hover { background: var(--surface-2); color: var(--blue-600); }
.row-action svg { width: 19px; height: 19px; }

/* --------------------------------------------------------- 11. Pagination */
.pagination { display: flex; align-items: center; gap: 8px; }
.pagination button {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding-inline: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-family: var(--font-en);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
  transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.pagination button:hover { border-color: var(--blue-400); color: var(--blue-600); }
.pagination button.is-active { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.pagination button svg { width: 17px; height: 17px; }

/* -------------------------------------------------------------- 12. Forms */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--text-2); }

.input, .select, .textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 16px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .16s var(--ease), background .16s var(--ease), box-shadow .16s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  background: #fff;
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(80, 149, 254, .15);
}
.textarea { min-height: 150px; resize: vertical; line-height: 1.7; }

.select {
  appearance: none;
  padding-inline-end: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2343474F' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 17px;
  background-position: left 15px center;
  cursor: pointer;
}
body[dir="ltr"] .select { background-position: right 15px center; }

/* Outlined form variant (contact page) */
.input.is-outline, .select.is-outline, .textarea.is-outline {
  background: var(--surface);
  border-color: var(--border);
}

/* Toggle switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: relative;
  width: 46px;
  height: 26px;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--border-2);
  transition: background .2s var(--ease);
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .2s var(--ease);
}
.switch input:checked + .track { background: var(--blue-600); }
.switch input:checked + .track::after { transform: translateX(20px); }
body[dir="rtl"] .switch input:checked + .track::after { transform: translateX(-20px); }
.switch .switch-label { font-size: 13px; font-weight: 600; color: var(--text-3); }
.switch input:checked ~ .switch-label { color: var(--blue-600); }

/* Segmented control */
.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--r-md);
}
.segmented button,
.segmented a {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease), box-shadow .16s var(--ease);
}
.segmented button:hover,
.segmented a:hover { color: var(--navy-700); }
.segmented button.is-active,
.segmented a.is-active { background: #fff; color: var(--navy-900); box-shadow: var(--sh-xs); }

/* Ratio input (admin) */
.ratio-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.ratio-row + .ratio-row { margin-top: 12px; }
.ratio-row > span { font-size: 13px; color: var(--text-2); }
.ratio-input {
  width: 96px;
  height: 44px;
  flex: none;
  padding-inline: 14px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-en);
  font-size: 16px;
  font-weight: 700;
  color: var(--navy-900);
  outline: none;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.ratio-input:focus { border-color: var(--blue-400); box-shadow: 0 0 0 3px rgba(80, 149, 254, .15); }

/* ------------------------------------------------------------ 13. Progress */
.progress {
  position: relative;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue-600);
  transition: width .5s var(--ease);
}
.progress.is-teal > span { background: var(--cyan-500); }
.progress.is-thin { height: 5px; }
.progress.on-dark { background: rgba(255, 255, 255, .18); }

/* ------------------------------------------------------------- 14. Avatars */
.avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--navy-700);
  font-family: var(--font-en);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .02em;
  direction: ltr;
  unicode-bidi: isolate;
}
.avatar.is-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.is-blue { background: var(--blue-050); color: var(--blue-600); }
.avatar.is-teal { background: var(--cyan-500); color: #fff; }

.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar { border: 2px solid #fff; }
.avatar-stack .avatar + .avatar { margin-inline-start: -10px; }
.avatar-stack .more {
  background: var(--cyan-100);
  color: var(--cyan-600);
  font-size: 11.5px;
}

/* ------------------------------------------------------------- 14b. Alerts */
.alert-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.7;
  border: 1px solid transparent;
}
.alert + .alert { margin-top: 10px; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.alert.is-success { background: var(--green-050); color: #15803D; border-color: #BBF7D0; }
.alert.is-error   { background: var(--red-050);   color: var(--red-600); border-color: #FECDD3; }
.alert.is-info    { background: var(--cyan-050);  color: var(--blue-600); border-color: #B8E2FF; }
.alert.is-warn    { background: var(--amber-050); color: var(--amber-600); border-color: #FDE68A; }

/* Field-level validation message */
.field-error { font-size: 12.5px; font-weight: 600; color: var(--red-600); }
.input.has-error, .select.has-error, .textarea.has-error {
  border-color: var(--red-600);
  background: var(--red-050);
}

/* Empty-state row inside a panel */
.empty-state {
  padding: 46px 24px;
  text-align: center;
  color: var(--text-3);
}
.empty-state svg { width: 38px; height: 38px; margin: 0 auto 14px; color: var(--border-2); }
.empty-state p { font-size: 14px; }

/* --------------------------------------------------------------- 15. Misc */
.divider { height: 1px; background: var(--border); border: 0; }
.divider-soft { height: 1px; background: rgba(255, 255, 255, .14); border: 0; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding-inline: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  box-shadow: var(--sh-xs);
}
.chip svg { width: 17px; height: 17px; color: var(--text-3); }

.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 700;
}
.tag-pill.is-teal { background: var(--cyan-100); color: var(--cyan-600); }
.tag-pill.is-blue { background: var(--blue-050); color: var(--blue-600); }

/* --------------------------------------------------------------- 16. Footer */
.site-footer {
  background: var(--navy-900);
  color: rgba(255, 255, 255, .78);
  padding-block: 56px 0;
  margin-top: 20px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr .9fr .9fr .8fr 1.1fr;
  gap: 34px;
  padding-bottom: 44px;
}
.footer-brand {
  font-family: var(--font-ar);
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--cyan-500);
  margin-bottom: 16px;
}
body[dir="ltr"] .footer-brand { font-family: var(--font-en); font-size: 25px; }
.footer-about { font-size: 13.5px; line-height: 1.85; color: rgba(255, 255, 255, .72); max-width: 40ch; }

.footer-col h4 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 18px;
}
.footer-col li + li { margin-top: 11px; }
.footer-col a, .footer-col p {
  font-size: 13.5px;
  color: rgba(255, 255, 255, .72);
  transition: color .16s var(--ease);
}
.footer-col a:hover { color: var(--cyan-500); }
.footer-col a.is-active { color: var(--cyan-500); font-weight: 700; }

.footer-socials { display: flex; gap: 12px; margin-top: 18px; }
.footer-socials a {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: var(--cyan-500);
  transition: background .18s var(--ease), transform .18s var(--ease);
}
.footer-socials a:hover { background: rgba(0, 206, 209, .22); transform: translateY(-2px); }
.footer-socials svg { width: 19px; height: 19px; }

.footer-newsletter {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, .07);
  border-radius: var(--r-lg);
  margin-top: 16px;
}
.footer-newsletter input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  padding-inline: 10px;
  font-size: 13.5px;
  color: #fff;
}
.footer-newsletter input::placeholder { color: rgba(255, 255, 255, .5); }
.footer-newsletter button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: var(--r-md);
  background: var(--cyan-500);
  color: var(--navy-900);
  transition: background .18s var(--ease);
}
.footer-newsletter button:hover { background: var(--cyan-600); color: #fff; }
.footer-newsletter svg { width: 19px; height: 19px; }
body[dir="rtl"] .footer-newsletter svg { transform: scaleX(-1); }

.footer-figure {
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
}
.footer-figure img { width: 100%; height: 168px; object-fit: cover; opacity: .55; }
.footer-figure figcaption {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 14px 16px;
  font-size: 12.5px;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 30, 64, .92), rgba(0, 30, 64, 0));
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding-block: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  flex-wrap: wrap;
}
.footer-bottom p {
  font-family: var(--font-en);
  font-size: 13px;
  color: rgba(255, 255, 255, .66);
  direction: ltr;
  unicode-bidi: isolate;
}
.footer-bottom nav { display: flex; gap: 22px; }
.footer-bottom nav a { font-size: 12.5px; color: rgba(255, 255, 255, .6); }
.footer-bottom nav a:hover { color: var(--cyan-500); }
.footer-bottom.has-links { justify-content: space-between; }

/* --------------------------------------------------------- 17. Responsive */
@media (max-width: 1440px) {
  .main-nav { gap: 20px; }
}

@media (max-width: 1180px) {
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; gap: 34px; }
  .main-nav { gap: 14px; }
  .main-nav a, .main-nav .nav-drop-trigger { font-size: 14px; }
}

@media (max-width: 1080px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 34px; }
  .site-header .container { gap: 12px; }
  .header-actions { gap: 6px; }
  .main-nav { gap: 9px; }
  .brand-logo { --logo-h: 46px; }
  .main-nav a, .main-nav .nav-drop-trigger { font-size: 13.5px; }
}

@media (max-width: 980px) {
  :root { --header-h: 66px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-wide-start, .split-wide-end { grid-template-columns: minmax(0, 1fr); }
  .main-nav { display: none; }
  .h-page { font-size: 27px; }
}

@media (max-width: 720px) {
  :root { --gutter: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: 1fr; }
  .page { padding-block: 24px 44px; }
  .h-page { font-size: 24px; }
  .h-section { font-size: 20px; }
  .h-panel { font-size: 17px; }
  .kpi-value { font-size: 33px; }
  .panel-head, .panel-body { padding: 18px; }
  .header-search { display: none; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
