/* ==========================================================================
   Zain Control — UI v12  «دفتر وضوء»
   --------------------------------------------------------------------------
   منصة عربية RTL لإدارة خدمات زين. مكتوبة بالخصائص المنطقية (logical properties)
   فتنعكس بالكامل دون قواعد خاصة بالاتجاه.

   مبدأ اللون هنا: اللون يحمل معنى، لا زينة.
     البنفسجي  = هوية زين، التنقّل، الإجراء الأساسي
     الذهبي    = المال الخارج (كلفة، سعر، رصيد)
     الزمردي   = المال الداخل والنجاح
     الوردي    = الفشل والخطر
     السماوي   = عملية قيد التنفيذ في الخلفية
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. رموز التصميم
   -------------------------------------------------------------------------- */
:root {
  /* الأسطح — حبر بنفسجي متدرّج، لا أسود مسطّح */
  --void:          #0a0711;
  --ink-900:       #0a0711;
  --ink-850:       #100c1b;
  --ink-800:       #161125;
  --ink-750:       #1c1630;
  --ink-700:       #231b3b;
  --ink-600:       #2f2450;
  --ink-500:       #3d2f66;

  --surface:        #161125;
  --surface-raised: #1c1630;
  --surface-sunken: #100c1b;
  --surface-glass:  rgba(28, 22, 48, 0.78);

  /* الهوية — بنفسجي زين */
  --brand:        #9b6bff;
  --brand-bright: #c4a0ff;
  --brand-deep:   #6d3fd4;
  --brand-ink:    #17092c;
  --brand-soft:   rgba(155, 107, 255, 0.13);
  --brand-line:   rgba(155, 107, 255, 0.30);

  /* الدلالات المالية */
  --gold:  #ffb224;
  --mint:  #22d3a5;
  --rose:  #ff4d6d;
  --sky:   #4fc3f7;
  --amber: #fb923c;

  /* النص */
  --text:       #f4f0fd;
  --text-dim:   #c2b6dc;
  --text-muted: #9c8fbd;
  --text-faint: #7d719c;

  /* البنية */
  --line:        rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --line-brand:  rgba(155, 107, 255, 0.24);
  --edge-light:  rgba(255, 255, 255, 0.10);

  /* الارتفاع */
  --shadow-sm:    0 2px 8px rgba(0, 0, 0, 0.32);
  --shadow:       0 14px 36px rgba(0, 0, 0, 0.38);
  --shadow-lg:    0 32px 78px rgba(0, 0, 0, 0.52);
  --shadow-brand: 0 16px 40px rgba(109, 63, 212, 0.34);

  /* الهندسة */
  --r-xs: 9px;
  --r-sm: 13px;
  --r-md: 17px;
  --r-lg: 23px;
  --r-xl: 30px;
  --r-pill: 999px;

  /* الإيقاع */
  --gap: 18px;
  --pad: 24px;
  --rail-w: 268px;
  --rail-mini: 78px;
  --topbar-h: 74px;

  /* الخطوط — عرض (Cairo) + واجهة (IBM Plex Sans Arabic) */
  --font-display: "Cairo", "IBM Plex Sans Arabic", "SF Arabic", "Noto Sans Arabic",
    "Segoe UI", Tahoma, sans-serif;
  --font: "IBM Plex Sans Arabic", "SF Arabic", "Segoe UI", "Noto Sans Arabic",
    "Geeza Pro", Tahoma, Arial, sans-serif;
  --font-num: "Cairo", "IBM Plex Sans Arabic", "SF Mono", ui-monospace, Tahoma, sans-serif;

  --danger-nav: #f5b0bd;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* المظهر الفاتح — ورق دافئ لا أبيض ناصع، فيبقى البنفسجي مقروءًا */
:root[data-theme="light"] {
  --void:          #f3f0f9;
  --ink-900:       #f3f0f9;
  --ink-850:       #f8f6fc;
  --ink-800:       #ffffff;
  --ink-750:       #fbf9fe;
  --ink-700:       #f1ecf9;
  --ink-600:       #e4dcf3;
  --ink-500:       #d2c6ea;

  --surface:        #ffffff;
  --surface-raised: #ffffff;
  --surface-sunken: #f5f2fb;
  --surface-glass:  rgba(255, 255, 255, 0.86);

  --brand:        #7434e0;
  --brand-bright: #8b46f5;
  --brand-deep:   #5b21b6;
  --brand-ink:    #ffffff;
  --brand-soft:   rgba(116, 52, 224, 0.09);
  --brand-line:   rgba(116, 52, 224, 0.24);

  --gold:  #a06600;
  --mint:  #067a5b;
  --rose:  #d61f45;
  --sky:   #0369a1;
  --amber: #c2410c;

  --text:       #180f26;
  --text-dim:   #453760;
  --text-muted: #5e5079;
  --text-faint: #7a6d94;

  --line:        rgba(24, 15, 38, 0.10);
  --line-strong: rgba(24, 15, 38, 0.17);
  --line-brand:  rgba(116, 52, 224, 0.22);
  --edge-light:  rgba(255, 255, 255, 0.9);

  --shadow-sm:    0 2px 8px rgba(60, 40, 100, 0.08);
  --shadow:       0 14px 34px rgba(60, 40, 100, 0.11);
  --shadow-lg:    0 30px 68px rgba(60, 40, 100, 0.17);
  --shadow-brand: 0 16px 38px rgba(116, 52, 224, 0.20);

  --danger-nav: #a80f38;
}

html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

/* --------------------------------------------------------------------------
   2. التهيئة والأساس
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--ink-900);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* الأجواء: وهج بنفسجي أعلى الصفحة، وزمردي أسفلها، وحبيبات خفيفة تكسر سطحية
   السواد. النسيج المحسوس هو المخاطرة البصرية الوحيدة في هذا التصميم. */
body::before {
  content: "";
  position: fixed;
  inset-block-start: -340px;
  inset-inline-end: -200px;
  width: 760px; height: 760px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(155, 107, 255, 0.20), transparent 66%);
  filter: blur(24px);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(760px 760px at 12% 118%, rgba(34, 211, 165, 0.10), transparent 66%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.4'/%3E%3C/svg%3E");
  opacity: .5;
  mix-blend-mode: soft-light;
}
:root[data-theme="light"] body::before { background: radial-gradient(circle, rgba(116, 52, 224, .11), transparent 66%); }
:root[data-theme="light"] body::after {
  background: radial-gradient(760px 760px at 12% 118%, rgba(6, 122, 91, .08), transparent 66%);
  opacity: 1;
  mix-blend-mode: normal;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img, svg { display: block; max-width: 100%; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.28;
}
p { margin: 0; }

/* كل رقم مالي بأرقام جدولية، فتصطفّ الأعمدة كدفتر حسابات */
.num, .kpi-value, .balance strong, .cell-strong, .rank-val, .mono,
.pricelist strong, .price-input input, .progress-top strong, .pager .num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

::selection { background: rgba(155, 107, 255, 0.34); color: #fff; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--brand-bright);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

* { scrollbar-width: thin; scrollbar-color: var(--ink-600) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--ink-600); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-500); background-clip: content-box; }

/* --------------------------------------------------------------------------
   3. أدوات مساعدة
   -------------------------------------------------------------------------- */
.hidden { display: none !important; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.small { font-size: .8rem; }
.nowrap { white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-end { display: flex; align-items: center; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.split { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--gap); align-items: start; }
.split-even { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: start; }

.eyebrow {
  font-family: var(--font-display);
  font-size: .66rem; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-faint);
}

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 24px; height: 24px; }
.ic-xl { width: 30px; height: 30px; }

.t-brand { --tint: var(--brand); }
.t-mint  { --tint: var(--mint); }
.t-gold  { --tint: var(--gold); }
.t-sky   { --tint: var(--sky); }
.t-rose  { --tint: var(--rose); }
.t-amber { --tint: var(--amber); }

.spinner {
  width: 16px; height: 16px; flex: none; display: inline-block;
  border: 2px solid currentColor; border-block-start-color: transparent;
  border-radius: 50%; animation: spin .68s linear infinite; opacity: .85;
}
@keyframes spin { to { transform: rotate(360deg); } }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.dot-live { background: var(--mint); animation: pulse 2.1s var(--ease) infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 211, 165, .5); }
  70%  { box-shadow: 0 0 0 8px rgba(34, 211, 165, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 211, 165, 0); }
}

/* --------------------------------------------------------------------------
   4. هيكل التطبيق
   -------------------------------------------------------------------------- */
.app {
  min-height: 100dvh;
  margin-inline-start: var(--rail-w);
  display: flex; flex-direction: column;
  position: relative; z-index: 1;
  transition: margin-inline-start .34s var(--ease);
}

/* ---- الشريط الجانبي ---- */
.rail {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--rail-w);
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px 14px;
  background: linear-gradient(180deg, var(--ink-850), var(--ink-900) 62%);
  border-inline-end: 1px solid var(--line);
  z-index: 60;
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: width .34s var(--ease), transform .34s var(--ease);
}
/* خيط ضوئي على حافّة الشريط */
.rail::after {
  content: "";
  position: absolute;
  inset-block: 0; inset-inline-end: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--brand-line) 26%, var(--brand-line) 74%, transparent);
  pointer-events: none;
}
html[dir="rtl"] .rail { inset-inline-start: 0; }

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 20px;
  margin-block-end: 6px;
  border-block-end: 1px solid var(--line);
}
.brand-mark {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 13px;
  background: linear-gradient(140deg, var(--brand-bright), var(--brand-deep));
  color: #fff;
  font-family: var(--font-display); font-weight: 800; font-size: 1.2rem;
  box-shadow: var(--shadow-brand);
  position: relative; overflow: hidden;
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(150deg, rgba(255,255,255,.34), transparent 52%);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; overflow: hidden; }
.brand-text strong { font-family: var(--font-display); font-size: .96rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand-text small { font-size: .68rem; color: var(--text-faint); white-space: nowrap; }

/* ---- التنقّل ---- */
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-label {
  font-size: .63rem; font-weight: 700; letter-spacing: .15em; text-transform: uppercase;
  color: var(--text-faint); padding: 16px 12px 7px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  color: var(--text-dim);
  font-size: .875rem; font-weight: 500;
  position: relative;
  transition: color .18s var(--ease), background .18s var(--ease);
}
.nav-item .ic { color: var(--text-faint); transition: color .18s var(--ease), transform .28s var(--ease-spring); }
.nav-item .nav-txt { white-space: nowrap; overflow: hidden; }
.nav-item:hover { background: var(--brand-soft); color: var(--text); }
.nav-item:hover .ic { color: var(--brand-bright); transform: scale(1.08); }
.nav-item.active {
  background: linear-gradient(90deg, var(--brand-soft), transparent 88%);
  color: var(--text); font-weight: 600;
}
.nav-item.active .ic { color: var(--brand-bright); }
.nav-item.active::before {
  content: "";
  position: absolute;
  inset-block: 9px; inset-inline-start: -14px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--brand-bright), var(--brand-deep));
  box-shadow: 0 0 14px var(--brand);
}
.nav-item.danger { color: var(--danger-nav); }
.nav-item.danger:hover { background: rgba(255, 77, 109, .12); color: var(--rose); }
.nav-item.danger:hover .ic { color: var(--rose); }

/* ---- أسفل الشريط ---- */
.rail-foot { display: flex; flex-direction: column; gap: 6px; padding-block-start: 14px; border-block-start: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-sunken); border: 1px solid var(--line); }
.who .avatar {
  width: 34px; height: 34px; flex: none; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), var(--brand-deep));
  color: #fff; font-family: var(--font-display); font-weight: 700; font-size: .88rem;
}
.who-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; overflow: hidden; }
.who-text strong { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text small { font-size: .68rem; color: var(--text-faint); }

.rail-toggle {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px;
  background: none; border: 0; border-radius: var(--r-sm);
  color: var(--text-faint); font-size: .8rem; cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.rail-toggle:hover { background: var(--ink-700); color: var(--text-dim); }
.rail-toggle .ic { transition: transform .34s var(--ease); }

/* حالة الطيّ — تُطبَّق قبل أول رسم عبر html.pre-rail-mini فلا يحدث ارتجاج
   في التخطيط بين تحميل الصفحة وتشغيل جافاسكربت. */
body.rail-mini .rail,
html.pre-rail-mini .rail { width: var(--rail-mini); padding-inline: 10px; }
body.rail-mini .app,
html.pre-rail-mini .app { margin-inline-start: var(--rail-mini); }
body.rail-mini .brand,
html.pre-rail-mini .brand { justify-content: center; padding-inline: 0; }
body.rail-mini .brand-text,
body.rail-mini .nav-item .nav-txt,
body.rail-mini .who-text,
body.rail-mini .rail-toggle span,
html.pre-rail-mini .brand-text,
html.pre-rail-mini .nav-item .nav-txt,
html.pre-rail-mini .who-text,
html.pre-rail-mini .rail-toggle span { display: none; }
body.rail-mini .nav-item,
body.rail-mini .who,
body.rail-mini .rail-toggle,
html.pre-rail-mini .nav-item,
html.pre-rail-mini .who,
html.pre-rail-mini .rail-toggle { justify-content: center; padding-inline: 0; }
body.rail-mini .nav-label,
html.pre-rail-mini .nav-label { font-size: 0; padding: 14px 0 6px; }
body.rail-mini .nav-label::after,
html.pre-rail-mini .nav-label::after { content: ""; display: block; height: 1px; background: var(--line); }
body.rail-mini .rail-toggle .ic,
html.pre-rail-mini .rail-toggle .ic { transform: rotate(180deg); }

/* ---- الشريط العلوي ---- */
.topbar {
  position: sticky; inset-block-start: 0; z-index: 40;
  min-height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 12px clamp(16px, 3vw, 34px);
  background: var(--surface-glass);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-block-end: 1px solid var(--line);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.2vw, 1.32rem);
  font-weight: 700; letter-spacing: -.02em;
}
.topbar-actions { display: flex; align-items: center; gap: 9px; }

.iconbtn {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--text-dim);
  cursor: pointer;
  transition: transform .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), background .18s var(--ease);
}
.iconbtn:hover { color: var(--text); border-color: var(--brand-line); background: var(--brand-soft); transform: translateY(-1px); }
.iconbtn:active { transform: translateY(0) scale(.96); }
.iconbtn-danger:hover { color: var(--rose); border-color: rgba(255, 77, 109, .34); background: rgba(255, 77, 109, .1); }
.menu-btn { display: none; }

#themeBtn .ic-moon { display: none; }
:root[data-theme="light"] #themeBtn .ic-sun { display: none; }
:root[data-theme="light"] #themeBtn .ic-moon { display: block; }

/* ---- لوحة الصفحة ---- */
.content {
  flex: 1;
  padding: clamp(18px, 3vw, 32px) clamp(16px, 3vw, 34px) 56px;
  display: flex; flex-direction: column; gap: var(--gap);
  max-width: 1480px; width: 100%;
  margin-inline: auto;
}
/* دخول متدرّج عند تحميل الصفحة */
.content > * { animation: rise .5s var(--ease-out) backwards; }
.content > *:nth-child(1) { animation-delay: .02s; }
.content > *:nth-child(2) { animation-delay: .07s; }
.content > *:nth-child(3) { animation-delay: .12s; }
.content > *:nth-child(4) { animation-delay: .17s; }
.content > *:nth-child(n+5) { animation-delay: .21s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.scrim {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(6, 4, 12, .68);
  backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden;
  transition: opacity .28s var(--ease), visibility .28s;
}
.scrim.open { opacity: 1; visibility: visible; }

/* --------------------------------------------------------------------------
   5. البطاقات واللوحات
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
}
/* حافّة عليا تلتقط الضوء — تمنح البطاقة سُمكًا بدل مسطّح ملوّن */
.card::before {
  content: "";
  position: absolute;
  inset-block-start: 0; inset-inline: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--edge-light) 30%, var(--edge-light) 70%, transparent);
  pointer-events: none;
}
.card + .card { margin-block-start: 0; }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 18px var(--pad);
  border-block-end: 1px solid var(--line);
}
.card-head .eyebrow { margin-block-end: 3px; }
.card-head h3 { font-family: var(--font-display); font-size: 1.02rem; font-weight: 700; }
.card-body { padding: var(--pad); }
.card-body.flush { padding: 0; }
.card-foot {
  padding: 15px var(--pad);
  border-block-start: 1px solid var(--line);
  background: var(--surface-sunken);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}

.note {
  padding: 13px 15px;
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
}
.note strong { display: block; margin-block-start: 4px; font-size: .95rem; }

/* --------------------------------------------------------------------------
   6. المقدّمة
   -------------------------------------------------------------------------- */
.hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between;
  gap: 26px; flex-wrap: wrap;
  padding: clamp(24px, 3.4vw, 36px);
  border-radius: var(--r-xl);
  border: 1px solid var(--line-brand);
  background:
    radial-gradient(120% 150% at 88% -20%, rgba(155, 107, 255, .26), transparent 58%),
    linear-gradient(120deg, var(--ink-750), var(--ink-850));
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  inset-block-start: -70px; inset-inline-end: -40px;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 165, .16), transparent 68%);
  pointer-events: none;
}
.hero-copy { position: relative; z-index: 1; max-width: 62ch; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.hero-copy h2 {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3vw, 1.92rem);
  font-weight: 800; letter-spacing: -.03em; line-height: 1.24;
}
.hero-copy p { color: var(--text-dim); font-size: .9rem; line-height: 1.75; }
.hero-side { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  color: var(--brand-bright);
  font-size: .74rem; font-weight: 600;
}
.chip .ic { width: 14px; height: 14px; }
button.chip { cursor: pointer; transition: border-color .18s var(--ease), background .18s var(--ease); }
button.chip:hover { border-color: var(--brand); background: rgba(155, 107, 255, .2); }

/* لوحة الرصيد — العنصر المميّز في هذا التصميم.
   الرصيد هو القيد الذي يحكم كل عملية هنا، فيستحق أن يكون البطل. */
.balance {
  display: flex; flex-direction: column; gap: 3px;
  padding: 20px 26px;
  border-radius: var(--r-lg);
  background: linear-gradient(150deg, rgba(255, 178, 36, .16), rgba(255, 178, 36, .04));
  border: 1px solid rgba(255, 178, 36, .3);
  min-width: 240px;
  position: relative; overflow: hidden;
}
.balance span { font-size: .72rem; color: var(--text-muted); font-weight: 600; letter-spacing: .04em; }
.balance strong {
  font-family: var(--font-num);
  font-size: clamp(1.85rem, 4.2vw, 2.5rem);
  font-weight: 800; letter-spacing: -.035em;
  color: var(--gold); line-height: 1.1;
}
.balance small { font-size: .72rem; color: var(--text-faint); }
.balance .track { margin-block-start: 11px; height: 5px; background: rgba(255, 178, 36, .16); }
.balance .track > i { background: linear-gradient(90deg, var(--gold), #ffd479); }
.balance .track > i::after { display: none; }
:root[data-theme="light"] .balance { background: linear-gradient(150deg, rgba(160, 102, 0, .12), rgba(160, 102, 0, .03)); border-color: rgba(160, 102, 0, .26); }
:root[data-theme="light"] .balance strong { color: var(--gold); }

/* --------------------------------------------------------------------------
   7. مؤشّرات الأداء
   -------------------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(228px, 1fr)); gap: var(--gap); }

.kpi {
  position: relative; overflow: hidden;
  padding: 20px 20px 22px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 9px;
  transition: transform .26s var(--ease), border-color .26s var(--ease), box-shadow .26s var(--ease);
}
.kpi::before {
  content: "";
  position: absolute;
  inset-block-start: 0; inset-inline: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--tint, var(--brand)), transparent);
  opacity: .85;
}
.kpi:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--tint, var(--brand)) 38%, transparent); box-shadow: var(--shadow); }
.kpi-top { display: flex; align-items: center; gap: 10px; }
.kpi-icon {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border-radius: 11px;
  background: color-mix(in srgb, var(--tint, var(--brand)) 14%, transparent);
  color: var(--tint, var(--brand));
}
.kpi-label { font-size: .76rem; font-weight: 600; color: var(--text-muted); }
.kpi-value {
  font-family: var(--font-num);
  font-size: clamp(1.6rem, 3.2vw, 2.05rem);
  font-weight: 800; letter-spacing: -.035em; line-height: 1.06;
}
.kpi-note { display: flex; align-items: center; gap: 6px; font-size: .74rem; font-style: normal; color: var(--text-faint); }
.kpi-note .ic { width: 13px; height: 13px; }
.kpi-note.up { color: var(--mint); }
.kpi-note.down { color: var(--rose); }
.kpi-spark { position: absolute; inset-block-end: 0; inset-inline: 0; width: 100%; height: 44px; opacity: .5; pointer-events: none; }
.kpi-spark path.line { fill: none; stroke: var(--tint, var(--brand)); stroke-width: 2; vector-effect: non-scaling-stroke; }
.kpi-spark path.area { fill: color-mix(in srgb, var(--tint, var(--brand)) 18%, transparent); stroke: none; }

/* --------------------------------------------------------------------------
   8. شبكات التخطيط
   -------------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* --------------------------------------------------------------------------
   9. الأزرار
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 19px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: .86rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: transform .16s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease),
    border-color .2s var(--ease), filter .2s var(--ease);
}
.btn .ic { width: 17px; height: 17px; }
.btn:active { transform: scale(.975); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn[aria-busy="true"] { cursor: progress; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-bright), var(--brand-deep));
  color: #fff; box-shadow: var(--shadow-brand);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.09); transform: translateY(-1px); }

.btn-secondary { background: var(--surface-raised); border-color: var(--line-strong); color: var(--text-dim); }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand-line); color: var(--text); background: var(--brand-soft); }

.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--ink-700); color: var(--text); }

.btn-danger { background: rgba(255, 77, 109, .13); border-color: rgba(255, 77, 109, .34); color: var(--rose); }
.btn-danger:hover:not(:disabled) { background: var(--rose); color: #fff; border-color: var(--rose); }

.btn-light { background: #fff; color: #1a1030; border-color: transparent; box-shadow: var(--shadow); }
.btn-light:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(.97); }

.btn-sm { padding: 8px 13px; font-size: .78rem; }
.btn-lg { padding: 14px 26px; font-size: .92rem; }
.btn-block { width: 100%; }

.act {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-sunken);
  color: var(--text-muted);
  cursor: pointer;
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
}
.act .ic { width: 15px; height: 15px; }
.act:hover { color: var(--brand-bright); border-color: var(--brand-line); background: var(--brand-soft); transform: translateY(-1px); }
.act.danger:hover { color: var(--rose); border-color: rgba(255, 77, 109, .34); background: rgba(255, 77, 109, .1); }
.actions { display: flex; align-items: center; gap: 6px; }

.link { display: inline-flex; align-items: center; gap: 6px; color: var(--brand-bright); font-size: .82rem; font-weight: 600; }
.link .ic { width: 15px; height: 15px; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------------------
   10. النماذج
   -------------------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 15px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > span, .field-label { font-size: .78rem; font-weight: 600; color: var(--text-muted); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-sunken);
  color: var(--text);
  font-size: .88rem;
  transition: border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--line-brand); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-faint); }
.field input:disabled, .field select:disabled { opacity: .55; cursor: not-allowed; }
.field input[aria-invalid="true"] { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(255, 77, 109, .14); }
.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: left 18px center, left 13px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-inline-start: 34px;
}
.field-hint { font-size: .76rem; color: var(--text-faint); line-height: 1.65; }

.inp {
  display: flex; align-items: center; gap: 10px;
  padding-inline: 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-sunken);
  transition: border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
.inp > .ic { color: var(--text-faint); flex: none; }
.inp input { flex: 1; min-width: 0; padding: 12px 0; border: 0; background: transparent; font-size: .88rem; outline: none; }
.inp:hover { border-color: var(--line-brand); }
.inp:focus-within { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-soft); }
.inp:focus-within > .ic { color: var(--brand-bright); }
.inp-action { border: 0; background: none; color: var(--text-faint); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.inp-action:hover { color: var(--brand-bright); background: var(--brand-soft); }

/* رمز التحقق — أرقام كبيرة متباعدة تُقرأ وتُدخَل بسرعة */
.inp-otp { padding-inline: 8px; }
.inp-otp input, .otp-code {
  text-align: center;
  font-family: var(--font-num);
  font-size: 1.45rem; font-weight: 700;
  letter-spacing: .45em;
  padding-inline-start: .45em;  /* يوازن التباعد الأخير فيبقى النص في المنتصف */
  direction: ltr; unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}
.otp-code::placeholder { letter-spacing: .3em; font-size: 1rem; opacity: .32; }

/* أرقام الهاتف: LTR دائمًا ومتصلة، فلا تنعكس المجموعات داخل صفحة RTL */
input.phone-input, input[name="msisdn"], input[name="phone"], input[autocomplete^="tel"] {
  direction: ltr; unicode-bidi: isolate; text-align: start;
  font-variant-numeric: tabular-nums; letter-spacing: .04em;
}
.phone-value { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; letter-spacing: .03em; }

.control {
  padding: 10px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-sunken);
  color: var(--text); font-size: .82rem; cursor: pointer;
}
.control:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* خيارات الاختيار (باقات/مبالغ) */
.picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 11px; }
.pick {
  position: relative;
  display: flex; flex-direction: column; gap: 3px;
  padding: 15px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface-sunken);
  cursor: pointer;
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick b { font-size: .9rem; font-weight: 700; padding-inline-end: 26px; }
.pick small { font-size: .73rem; color: var(--text-muted); }
.pick strong { margin-block-start: 6px; font-family: var(--font-num); font-size: .92rem; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.pick:hover { border-color: var(--brand-line); transform: translateY(-2px); }
.pick:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-soft); }
.pick:has(input:focus-visible) { outline: 2px solid var(--brand-bright); outline-offset: 2px; }
.pick-check {
  position: absolute;
  inset-block-start: 14px; inset-inline-end: 14px;
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid; place-items: center;
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease-spring);
}
.pick-check .ic { width: 12px; height: 12px; opacity: 0; color: #fff; stroke-width: 2.6; transition: opacity .18s var(--ease); }
.pick:has(input:checked) .pick-check { background: var(--brand); border-color: var(--brand); transform: scale(1.08); }
.pick:has(input:checked) .pick-check .ic { opacity: 1; }

.pick-amount { align-items: flex-start; }
.pick-amount .amt { font-family: var(--font-num); font-size: 1.4rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.pick-amount .cur { font-size: .72rem; color: var(--text-faint); margin-block-start: -4px; }
.pick-amount em { margin-block-start: 7px; font-style: normal; font-size: .72rem; color: var(--text-muted); }

/* مبدّل مجزّأ */
.segmented {
  display: inline-flex; padding: 4px; gap: 3px; flex-wrap: wrap;
  border-radius: var(--r-pill);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
}
.segmented label { flex: 1; min-width: 120px; position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r-pill);
  font-size: .8rem; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span { background: linear-gradient(135deg, var(--brand-bright), var(--brand-deep)); color: #fff; box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand-bright); outline-offset: 2px; }

/* تذكّرني */
.remember { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.remember input { position: absolute; opacity: 0; pointer-events: none; }
.remember-box {
  width: 20px; height: 20px; flex: none;
  border-radius: 6px;
  border: 1.5px solid var(--line-strong);
  display: grid; place-items: center;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}
.remember-box .ic { width: 12px; height: 12px; opacity: 0; color: #fff; stroke-width: 2.8; transition: opacity .16s var(--ease); }
.remember:hover .remember-box { border-color: var(--brand-line); }
.remember input:checked + .remember-box { background: var(--brand); border-color: var(--brand); }
.remember input:checked + .remember-box .ic { opacity: 1; }
.remember input:focus-visible + .remember-box { outline: 2px solid var(--brand-bright); outline-offset: 2px; }
.remember-text { font-size: .82rem; color: var(--text-dim); }

/* خطوات العملية */
.steps { display: flex; align-items: center; gap: 8px; margin-block-end: 14px; }
.steps span {
  width: 27px; height: 27px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--surface-sunken);
  font-family: var(--font-num); font-size: .74rem; font-weight: 700;
  color: var(--text-faint);
  transition: background .24s var(--ease), color .24s var(--ease), border-color .24s var(--ease), transform .24s var(--ease-spring);
}
.steps span.on { background: var(--brand); border-color: var(--brand); color: #fff; transform: scale(1.12); box-shadow: 0 0 0 4px var(--brand-soft); }
.steps span.done { background: var(--mint); border-color: var(--mint); font-size: 0; }
.steps span.done::before { content: "✓"; font-size: .78rem; font-weight: 800; color: #05261c; }
.steps i { flex: 1; height: 2px; border-radius: 2px; background: var(--line-strong); transition: background .24s var(--ease); }
.steps span.done + i { background: var(--mint); }

.flow-copy { font-size: .8rem; color: var(--text-muted); line-height: 1.7; margin-block-end: 14px; }

.active-line {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  font-size: .81rem; color: var(--text-dim);
}
.active-line .ic { color: var(--brand-bright); width: 16px; height: 16px; }
.active-line strong { color: var(--text); font-weight: 700; }

.search { flex: 1; min-width: 190px; }
.search .inp { background: var(--surface-sunken); }
.search .inp input { padding-block: 10px; font-size: .84rem; }

/* --------------------------------------------------------------------------
   11. الجداول
   -------------------------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }

table { width: 100%; border-collapse: collapse; font-size: .85rem; }

thead th {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  padding: 13px var(--pad);
  text-align: start;
  font-size: .7rem; font-weight: 700;
  letter-spacing: .07em;
  color: var(--text-faint);
  background: var(--surface-sunken);
  border-block-end: 1px solid var(--line);
  white-space: nowrap;
}
thead th:first-child { padding-inline-start: var(--pad); }
thead th:last-child { padding-inline-end: var(--pad); }

tbody td { padding: 13px var(--pad); border-block-end: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .16s var(--ease); }
tbody tr:hover { background: var(--brand-soft); }
tbody tr:last-child td { border-block-end: 0; }

th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--brand-bright); }
th[data-sort]::after { content: "⇅"; margin-inline-start: 6px; opacity: .3; font-size: .75em; }
th[data-sort][aria-sort="ascending"]::after { content: "↑"; opacity: 1; color: var(--brand-bright); }
th[data-sort][aria-sort="descending"]::after { content: "↓"; opacity: 1; color: var(--brand-bright); }

.cell-strong { font-family: var(--font-num); font-weight: 700; font-size: .9rem; }
.cell-note {
  display: block; margin-block-start: 4px;
  font-size: .72rem; color: var(--text-faint);
  max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.num { font-family: var(--font-num); }
.mono { font-family: var(--font-num); }

.who-cell { display: inline-flex; align-items: center; gap: 10px; }
.who-cell .mono {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  color: var(--brand-bright);
  font-size: .78rem; font-weight: 700;
}
.who-cell .who-name { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.who-cell b { font-size: .85rem; font-weight: 600; }
.who-cell small { font-size: .71rem; color: var(--text-faint); }

/* الحالات الفارغة — دعوة للفعل، لا مجرد نصّ رمادي */
.empty { padding: 46px 24px !important; text-align: center; }
.empty-inner {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  color: var(--text-muted);
}
.empty-inner .ic {
  width: 38px; height: 38px; margin-block-end: 6px;
  color: var(--text-faint); opacity: .55; stroke-width: 1.4;
}
.empty-inner b { font-size: .92rem; font-weight: 700; color: var(--text-dim); }
.empty-inner span { font-size: .78rem; color: var(--text-faint); max-width: 40ch; line-height: 1.7; }

/* --------------------------------------------------------------------------
   12. الشارات والحالة
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  font-size: .72rem; font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge .ic { width: 13px; height: 13px; }
.badge-ok      { background: rgba(34, 211, 165, .13); color: var(--mint);  border-color: rgba(34, 211, 165, .3); }
.badge-bad     { background: rgba(255, 77, 109, .13); color: var(--rose);  border-color: rgba(255, 77, 109, .3); }
.badge-warn    { background: rgba(251, 146, 60, .13); color: var(--amber); border-color: rgba(251, 146, 60, .3); }
.badge-info    { background: rgba(79, 195, 247, .13); color: var(--sky);   border-color: rgba(79, 195, 247, .3); }
.badge-brand   { background: var(--brand-soft);       color: var(--brand-bright); border-color: var(--brand-line); }
.badge-neutral { background: var(--ink-700);          color: var(--text-muted);   border-color: var(--line-strong); }

/* --------------------------------------------------------------------------
   13. شريط الأدوات
   -------------------------------------------------------------------------- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 18px var(--pad);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.toolbar h2 { font-family: var(--font-display); font-size: 1.06rem; font-weight: 700; }
.toolbar p { font-size: .78rem; color: var(--text-muted); margin-block-start: 3px; }
.toolbar-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.toolbar-tools .btn { flex: none; }

/* --------------------------------------------------------------------------
   14. مُطلِق الخدمات (صفحة البائع)
   -------------------------------------------------------------------------- */
.services { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: var(--gap); }

.service {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 15px;
  padding: 20px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: start;
  cursor: pointer;
  transition: transform .26s var(--ease), border-color .26s var(--ease), box-shadow .26s var(--ease);
}
/* توهّج خفيف يتبع اللون الدلالي للخدمة */
.service::before {
  content: "";
  position: absolute;
  inset-block-start: -60px; inset-inline-end: -50px;
  width: 170px; height: 170px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--tint, var(--brand)) 26%, transparent), transparent 68%);
  opacity: .5;
  transition: opacity .3s var(--ease), transform .4s var(--ease);
  pointer-events: none;
}
.service::after {
  content: "";
  position: absolute;
  inset-block-end: 0; inset-inline: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--tint, var(--brand)), transparent);
  opacity: 0;
  transition: opacity .26s var(--ease);
}
.service:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--tint, var(--brand)) 42%, transparent); box-shadow: var(--shadow); }
.service:hover::before { opacity: .9; transform: scale(1.12); }
.service:hover::after { opacity: 1; }
.service:active { transform: translateY(-1px) scale(.99); }

.service-icon {
  width: 50px; height: 50px; flex: none;
  display: grid; place-items: center;
  border-radius: 15px;
  background: color-mix(in srgb, var(--tint, var(--brand)) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--tint, var(--brand)) 28%, transparent);
  color: var(--tint, var(--brand));
  position: relative; z-index: 1;
}
.service-copy { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; position: relative; z-index: 1; }
.service-copy b { font-family: var(--font-display); font-size: .96rem; font-weight: 700; }
.service-copy small { font-size: .76rem; color: var(--text-muted); line-height: 1.6; }
.service-go {
  flex: none; color: var(--text-faint); position: relative; z-index: 1;
  transition: transform .26s var(--ease), color .26s var(--ease);
}
.service:hover .service-go { color: var(--tint, var(--brand)); transform: translateX(4px); }
html[dir="rtl"] .service:hover .service-go { transform: translateX(-4px); }

.service-primary {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 16%, var(--surface)), var(--surface));
  border-color: var(--brand-line);
}

/* --------------------------------------------------------------------------
   15. الأسعار
   -------------------------------------------------------------------------- */
.price-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.price-card {
  padding: 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-sunken);
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color .2s var(--ease);
}
.price-card .pc-icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-bright);
  margin-block-end: 8px;
}
.price-card b { font-size: .9rem; font-weight: 700; }
.price-card small { font-size: .74rem; color: var(--text-muted); line-height: 1.6; min-height: 2.4em; }
.price-card:focus-within { border-color: var(--brand); }
.price-card .price-input { margin-block-start: 10px; }
.price-card .price-input input { font-size: 1rem; }

.price-input {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.price-input input {
  flex: 1; min-width: 0; width: 100%;
  border: 0; background: transparent; outline: none;
  font-family: var(--font-num); font-weight: 700; font-size: .95rem;
  direction: ltr; text-align: start;
}
.price-input em { font-style: normal; font-size: .74rem; color: var(--text-faint); flex: none; }
.price-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.pricelist { display: flex; flex-direction: column; }
.pricelist > div {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0;
  border-block-end: 1px dashed var(--line);
}
.pricelist > div:last-child { border-block-end: 0; padding-block-end: 0; }
.pricelist .pl-name { display: inline-flex; align-items: center; gap: 9px; font-size: .84rem; color: var(--text-dim); }
.pricelist .pl-name .ic { width: 15px; height: 15px; color: var(--text-faint); }
.pricelist strong { font-family: var(--font-num); font-size: .92rem; font-weight: 700; color: var(--gold); white-space: nowrap; }
.pricelist strong small { font-size: .68rem; font-weight: 500; color: var(--text-faint); margin-inline-start: 2px; }

/* --------------------------------------------------------------------------
   16. التقدّم
   -------------------------------------------------------------------------- */
.progress {
  margin-block-start: 18px;
  padding: 18px;
  border-radius: var(--r-md);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 12px;
}
.progress-top { display: flex; align-items: center; justify-content: space-between; font-size: .8rem; color: var(--text-muted); }
.progress-top strong { font-family: var(--font-num); font-size: 1.1rem; font-weight: 800; color: var(--brand-bright); }

.track {
  position: relative;
  height: 8px; width: 100%;
  border-radius: var(--r-pill);
  background: var(--ink-700);
  overflow: hidden;
}
.track > i {
  display: block; height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--brand-deep), var(--brand-bright));
  transition: width .5s var(--ease-out);
  position: relative;
}
/* بريق متحرّك يوضّح أن العملية ما تزال تعمل */
.track > i::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .34), transparent);
  animation: sheen 1.7s linear infinite;
}
@keyframes sheen { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.progress-stats { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: .78rem; color: var(--text-muted); }
.progress-stats b { font-family: var(--font-num); color: var(--text); font-weight: 700; }

/* --------------------------------------------------------------------------
   17. التنبيهات
   -------------------------------------------------------------------------- */
.alert {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 15px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  border-inline-start-width: 3px;
  font-size: .82rem; line-height: 1.7;
}
.alert .ic { flex: none; margin-block-start: 2px; width: 17px; height: 17px; }
.alert-ok    { background: rgba(34, 211, 165, .10); border-color: rgba(34, 211, 165, .28); border-inline-start-color: var(--mint);  color: var(--mint); }
.alert-warn  { background: rgba(251, 146, 60, .10); border-color: rgba(251, 146, 60, .28); border-inline-start-color: var(--amber); color: var(--amber); }
.alert-error { background: rgba(255, 77, 109, .10); border-color: rgba(255, 77, 109, .28); border-inline-start-color: var(--rose);  color: var(--rose); }
.alert-info  { background: rgba(79, 195, 247, .10); border-color: rgba(79, 195, 247, .28); border-inline-start-color: var(--sky);   color: var(--sky); }
.alert b { font-weight: 700; }
:root[data-theme="light"] .alert-ok    { background: rgba(6, 122, 91, .07); }
:root[data-theme="light"] .alert-warn  { background: rgba(194, 65, 12, .07); }
:root[data-theme="light"] .alert-error { background: rgba(214, 31, 69, .07); }
:root[data-theme="light"] .alert-info  { background: rgba(3, 105, 161, .07); }

/* --------------------------------------------------------------------------
   18. النوافذ المنبثقة
   -------------------------------------------------------------------------- */
body.modal-open { overflow: hidden; }

.modal {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(6, 4, 12, .74);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity .26s var(--ease), visibility .26s;
  overflow-y: auto;
}
.modal.open { opacity: 1; visibility: visible; }
.modal-card {
  position: relative;
  width: min(480px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 28px;
  border-radius: var(--r-xl);
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  transform: translateY(18px) scale(.97);
  opacity: 0;
  transition: transform .3s var(--ease-out), opacity .3s var(--ease-out);
}
.modal.open .modal-card { transform: none; opacity: 1; }
.modal-wide .modal-card { width: min(620px, 100%); }

.modal-close {
  position: absolute;
  inset-block-start: 16px; inset-inline-end: 16px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-sunken);
  color: var(--text-muted);
  cursor: pointer; z-index: 2;
  transition: color .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
}
.modal-close:hover { color: var(--rose); background: rgba(255, 77, 109, .1); transform: rotate(90deg); }

.modal-head { display: flex; align-items: center; gap: 14px; margin-block-end: 20px; padding-inline-end: 40px; }
.modal-head .modal-icon {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border-radius: 14px;
  background: color-mix(in srgb, var(--tint, var(--brand)) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--tint, var(--brand)) 30%, transparent);
  color: var(--tint, var(--brand));
}
.modal-head h3 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }

/* --------------------------------------------------------------------------
   19. التنبيهات العائمة
   -------------------------------------------------------------------------- */
.toasts {
  position: fixed;
  inset-block-end: 22px;
  inset-inline-end: 22px;
  z-index: 120;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(400px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  animation: toast-in .34s var(--ease-out);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
.toast.leaving { animation: toast-out .22s var(--ease) forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }
.toast > .ic { flex: none; margin-block-start: 2px; width: 18px; height: 18px; }
.toast p { flex: 1; font-size: .82rem; line-height: 1.65; color: var(--text-dim); }
.toast-x {
  flex: none; border: 0; background: none; color: var(--text-faint);
  cursor: pointer; padding: 3px; border-radius: 7px; display: grid; place-items: center;
}
.toast-x:hover { color: var(--text); background: var(--ink-700); }
.toast-success > .ic { color: var(--mint); }
.toast-error   > .ic { color: var(--rose); }
.toast-warning > .ic { color: var(--amber); }
.toast-info    > .ic { color: var(--sky); }

/* --------------------------------------------------------------------------
   20. المخططات
   -------------------------------------------------------------------------- */
.chart { width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 6; }
.chart .bar { fill: url(#barGrad); rx: 7; transition: opacity .18s var(--ease); }
.chart .bar:hover { opacity: .75; }
.chart .axis-text { fill: var(--text-faint); font-size: 11px; font-family: var(--font); }
.chart .line { fill: none; stroke: var(--brand-bright); stroke-width: 2.4; stroke-linejoin: round; }
.chart .area { fill: var(--brand-soft); stroke: none; }
.chart .point { fill: var(--brand-bright); }

.legend { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-block-start: 12px; font-size: .76rem; color: var(--text-muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--legend-color, var(--brand)); flex: none; }

/* الترتيب (أبرز البائعين) */
.rank { display: flex; flex-direction: column; gap: 13px; }
.rank-row { display: flex; align-items: center; gap: 11px; }
.rank-row .mono {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  color: var(--brand-bright);
  font-size: .78rem; font-weight: 700;
}
.rank-bar { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rank-bar b { font-size: .82rem; font-weight: 600; }
.rank-bar .track { height: 6px; }
.rank-bar .track > i { background: linear-gradient(90deg, var(--mint), #7bf0cf); }
.rank-bar .track > i::after { display: none; }
.rank-val { font-family: var(--font-num); font-size: .84rem; font-weight: 700; color: var(--gold); white-space: nowrap; }

/* اختصارات سريعة */
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.quick a {
  display: flex; flex-direction: column; gap: 4px;
  padding: 17px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-sunken);
  transition: transform .22s var(--ease), border-color .22s var(--ease), background .22s var(--ease);
}
.quick a:hover { transform: translateY(-3px); border-color: var(--brand-line); background: var(--brand-soft); }
.quick .ic { color: var(--brand-bright); margin-block-end: 6px; }
.quick b { font-size: .87rem; font-weight: 700; }
.quick small { font-size: .74rem; color: var(--text-muted); line-height: 1.6; }

/* --------------------------------------------------------------------------
   21. ترقيم الصفحات
   -------------------------------------------------------------------------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.pager .num { font-family: var(--font-num); font-size: .82rem; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   22. صفحة الدخول
   -------------------------------------------------------------------------- */
.login-body { min-height: 100dvh; display: block; overflow-x: hidden; }

.login-shell {
  position: relative; z-index: 1;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
}

.login-art {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: clamp(28px, 4vw, 56px);
  background:
    radial-gradient(120% 100% at 82% 0%, rgba(155, 107, 255, .3), transparent 56%),
    linear-gradient(150deg, var(--ink-800), var(--ink-900));
  border-inline-end: 1px solid var(--line);
}
.login-art::before {
  content: "";
  position: absolute;
  inset-block-end: -220px; inset-inline-start: -140px;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 165, .16), transparent 66%);
  pointer-events: none;
}
.login-copy { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 18px; align-items: flex-start; }
.login-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4.4vw, 3.05rem);
  font-weight: 800; letter-spacing: -.04em; line-height: 1.16;
}
.login-copy h1 em {
  font-style: normal;
  background: linear-gradient(120deg, var(--brand-bright), var(--mint));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.login-copy p { color: var(--text-dim); font-size: .92rem; line-height: 1.85; max-width: 46ch; }

.login-stats { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.login-stats > div {
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface-glass);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px;
}
.login-stats b { font-family: var(--font-display); font-size: 1rem; font-weight: 800; color: var(--brand-bright); }
.login-stats span { font-size: .71rem; color: var(--text-faint); line-height: 1.55; }

.login-panel { display: grid; place-items: center; padding: clamp(24px, 4vw, 48px); background: var(--ink-900); }
.login-card {
  width: min(400px, 100%);
  padding: 34px 30px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  position: relative;
}
.login-card .login-icon {
  width: 50px; height: 50px;
  display: grid; place-items: center;
  border-radius: 15px;
  background: linear-gradient(140deg, var(--brand-bright), var(--brand-deep));
  color: #fff;
  box-shadow: var(--shadow-brand);
  margin-block-end: 20px;
}
.login-card h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; margin-block: 5px 6px; }
.login-card > .muted { font-size: .82rem; line-height: 1.7; margin-block-end: 22px; }
.login-foot { margin-block-start: 22px; text-align: center; font-size: .72rem; color: var(--text-faint); }

/* --------------------------------------------------------------------------
   23. هياكل التحميل
   -------------------------------------------------------------------------- */
.skel {
  border-radius: var(--r-xs);
  background: linear-gradient(90deg, var(--ink-700) 25%, var(--ink-600) 50%, var(--ink-700) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.35s linear infinite;
  color: transparent !important;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* --------------------------------------------------------------------------
   24. الاستجابة
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  .rail {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  html[dir="rtl"] .rail { transform: translateX(100%); }
  .rail.open { transform: none; }
  .rail::after { display: none; }
  .app,
  body.rail-mini .app,
  html.pre-rail-mini .app { margin-inline-start: 0; }
  .menu-btn { display: grid; }
  .rail-toggle { display: none; }
  /* على الشاشات الصغيرة يفتح الشريط بالكامل دائمًا */
  body.rail-mini .rail,
  html.pre-rail-mini .rail { width: var(--rail-w); padding-inline: 14px; }
  body.rail-mini .brand-text,
  body.rail-mini .nav-item .nav-txt,
  body.rail-mini .who-text,
  html.pre-rail-mini .brand-text,
  html.pre-rail-mini .nav-item .nav-txt,
  html.pre-rail-mini .who-text { display: flex; }
  body.rail-mini .nav-item,
  body.rail-mini .who,
  html.pre-rail-mini .nav-item,
  html.pre-rail-mini .who { justify-content: flex-start; padding-inline: 13px; }
  body.rail-mini .brand,
  html.pre-rail-mini .brand { justify-content: flex-start; padding-inline: 10px; }
  body.rail-mini .nav-label,
  html.pre-rail-mini .nav-label { font-size: .63rem; padding: 16px 12px 7px; }
  body.rail-mini .nav-label::after,
  html.pre-rail-mini .nav-label::after { display: none; }

  .login-shell { grid-template-columns: 1fr; }
  .login-art { display: none; }
}

@media (max-width: 720px) {
  :root { --pad: 18px; --gap: 14px; }
  body { font-size: 14.5px; }
  .hero { padding: 22px; }
  .hero-side { width: 100%; }
  .balance { min-width: 0; width: 100%; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .services { grid-template-columns: 1fr; }
  .split-even { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-tools { justify-content: stretch; }
  .toolbar-tools .btn, .toolbar-tools .control { flex: 1; }
  .modal { padding: 12px; align-items: flex-end; }
  .modal-card { padding: 22px 18px; border-radius: var(--r-lg); max-height: calc(100dvh - 24px); }
  .toasts { inset-inline: 12px; inset-block-end: 12px; max-width: none; }
  thead th, tbody td { padding-inline: 14px; }
  .cell-note { max-width: 20ch; }
  .segmented { width: 100%; }
  .segmented label { min-width: 0; }
}

@media (max-width: 420px) {
  .login-stats { grid-template-columns: 1fr; }
  .login-card { padding: 26px 20px; }
  .kpis { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   25. الحركة والطباعة
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .content > * { animation: none; opacity: 1; transform: none; }
}

@media print {
  .rail, .topbar, .scrim, .toasts, .modal, .btn, .act, .actions, .quick { display: none !important; }
  .app { margin-inline-start: 0; }
  body { background: #fff; color: #000; }
  body::before, body::after { display: none; }
  .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
  .content { padding: 0; }
}

/* --------------------------------------------------------------------------
   26. صفحة الخطأ
   -------------------------------------------------------------------------- */
.error-body { min-height: 100dvh; }
.error-shell { display: grid; place-items: center; min-height: 100dvh; padding: 24px; position: relative; z-index: 1; }
.error-card { width: min(460px, 100%); text-align: center; padding: 42px 32px; }
.error-icon {
  width: 58px; height: 58px;
  display: grid; place-items: center;
  margin-inline: auto;
  border-radius: 18px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  color: var(--brand-bright);
}
.error-code {
  margin-block-start: 22px;
  font-family: var(--font-display);
  font-size: .68rem; font-weight: 700;
  letter-spacing: .2em;
  color: var(--text-faint);
}
.error-card h2 { font-size: 1.5rem; margin-block: 8px 12px; }
.error-card > .muted { font-size: .85rem; line-height: 1.85; margin-block-end: 28px; }

/* مقياس الرصيد — تلميح تحت العدّاد */
.balance-hint { margin-block-start: 7px; font-size: .71rem; color: var(--text-faint); line-height: 1.6; }
.balance-hint.is-low { color: var(--rose); font-weight: 600; }

/* شريط رأس قائمة الجدولة + حالة الإيقاف المؤقت */
.pv-sched-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 0 2px 10px;
  border-block-end: 1px dashed var(--line);
  margin-block-end: 4px;
}
.pv-sched-count { font-size: .78rem; color: var(--text-faint); }
.pv-chip-go { color: var(--mint); border-color: rgba(34, 211, 165, .32); }
.pv-chip-go:hover { background: rgba(34, 211, 165, .12); border-color: var(--mint); color: var(--mint); }
