/* =========================================================
   RadKa — نظام التصميم
   مشتق من شعار RadKa: مثلثات حادة، شفرات مائلة، أبيض على حبر داكن.
   الترتيب: الرموز ← الأساسيات ← المكوّنات ← الهيكل ← الشاشات ← الاستجابة
   ========================================================= */

:root {
  color-scheme: dark;

  /* الأسطح (حبر مائل للأزرق قليلًا حتى لا يتعب العين مثل الأسود الصرف) */
  --bg: #0c0e12;
  --bg-2: #10131a;
  --surface: #141821;
  --surface-2: #1a1f2a;
  --surface-3: #232937;

  /* الخطوط الفاصلة (بلون الشفرة الباردة، شفافة) */
  --line: rgba(190, 204, 255, 0.10);
  --line-2: rgba(190, 204, 255, 0.18);

  /* النص: أبيض الشعار مخفَّفًا */
  --text: #e9ecf4;
  --text-2: #a9b0c0;
  --text-3: #727a8c;

  /* لمعة الشعار (الوحيدة) */
  --glint: #c3cff5;
  --glint-2: #93a7f2;
  --glint-soft: rgba(147, 167, 242, 0.14);

  /* الحالات */
  --ok: #67d3a4;
  --ok-soft: rgba(103, 211, 164, 0.14);
  --wait: #ebbb62;
  --wait-soft: rgba(235, 187, 98, 0.14);
  --bad: #ff7f76;
  --bad-soft: rgba(255, 127, 118, 0.14);

  /* استدعاءات الأسماء القديمة (تستخدمها أنماط داخلية في القوالب) */
  --ink: var(--text);
  --ink-soft: var(--text-2);
  --paper: var(--bg-2);
  --paper-raised: var(--surface);
  --palm: var(--glint-2);
  --palm-deep: var(--glint);
  --palm-tint: var(--glint-soft);
  --gold: var(--wait);
  --gold-tint: var(--wait-soft);
  --ok-tint: var(--ok-soft);
  --wait-tint: var(--wait-soft);
  --bad-tint: var(--bad-soft);

  /* الأنصاف: كل مستوى له نصف قطر مختلف حسب أهميته */
  --radius-s: 10px;
  --radius-m: 14px;
  --radius-l: 22px;

  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.75);

  --font-body: "Readex Pro", system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
  --font-display: var(--font-body);
  --font-head: "Reem Kufi", "Readex Pro", system-ui, sans-serif;
  --font-brand: "Outfit", "Readex Pro", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(0.22, 0.9, 0.3, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ---------------------------------------------------------
   الأساسيات
   --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(190, 204, 255, 0.22) transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* خلفية محيطية: توهّج بارد خافت + حبيبات ورقية (تمنع مظهر التدرّج المسطّح) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 88% -8%, rgba(147, 167, 242, 0.10), transparent 62%),
    radial-gradient(700px 480px at -6% 108%, rgba(147, 167, 242, 0.06), transparent 60%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.075'/></svg>");
}

body.no-scroll { overflow: hidden; }

a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

::selection { background: var(--glint-2); color: #0c0e12; }

:focus-visible {
  outline: 2px solid var(--glint);
  outline-offset: 2px;
  border-radius: 6px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(190, 204, 255, 0.16);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(190, 204, 255, 0.3); background-clip: content-box; border: 3px solid transparent; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: 0; }
p { margin: 0; }

.hidden { display: none !important; }
.hidden-block { display: none; }
.ltr { direction: ltr; unicode-bidi: plaintext; text-align: right; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-2); }
.sub { color: var(--text-2); font-size: 13px; line-height: 1.6; }

/* ---------------------------------------------------------
   الشعار والاسم
   --------------------------------------------------------- */
.rk-mark { display: block; height: auto; color: var(--text); }
.rk-mark path { fill: currentColor; }

.wordmark {
  font-family: var(--font-brand);
  font-weight: 300;
  letter-spacing: 0.34em;
  margin-inline-end: -0.34em;
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
  line-height: 1;
}

.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-lockup .rk-mark { width: 54px; flex: none; }
.brand-lockup .text { min-width: 0; }
.brand-lockup .wordmark { font-size: 19px; }
.brand-lockup .text p { margin-top: 6px; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* رسم الشعار (يُرسم بالخط ثم يمتلئ) — اللحظة المميزة عند بدء الجلسة */
.rk-draw path {
  fill: transparent;
  stroke: var(--text);
  stroke-width: 3;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: rkDraw 0.9s cubic-bezier(0.6, 0, 0.2, 1) 0.1s forwards, rkFill 0.45s ease 0.8s forwards;
}
@keyframes rkDraw { to { stroke-dashoffset: 0; } }
@keyframes rkFill { to { fill: var(--text); stroke-width: 0; } }

#splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 26px;
  background: var(--bg);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  transition: clip-path 0.75s cubic-bezier(0.75, 0, 0.2, 1);
}
#splash .rk-mark { width: min(56vw, 300px); }
#splash .wordmark {
  font-size: 15px;
  color: var(--text-2);
  opacity: 0;
  animation: fadeUp 0.5s var(--ease) 0.8s forwards;
}
#splash.out { clip-path: polygon(100% 0, 100% 0, 100% 100%, 100% 100%); }
html.no-splash #splash { display: none; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------
   الأزرار
   --------------------------------------------------------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: 600 14px/1 var(--font-body);
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s;
  user-select: none;
  -webkit-user-select: none;
}
.btn i { font-size: 1.2em; line-height: 1; pointer-events: none; flex: none; }
.btn > * { pointer-events: none; }
.btn:active { transform: scale(0.975); }
.btn:disabled, .btn.is-disabled { opacity: 0.45; cursor: not-allowed; }
.btn-block { width: 100%; }

/* الأساسي: أبيض الشعار — مع "شفرة" ضوء تمرّ عبره عند التمرير (تتكرّر شكل الشفرة في الشعار) */
.btn-primary {
  background: #eceef4;
  color: #0c0e12;
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 10px 30px -14px rgba(195, 207, 245, 0.55);
}
.btn-primary::after {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  width: 34%;
  right: -50%;
  transform: skewX(-24deg);
  background: linear-gradient(90deg, transparent, rgba(147, 167, 242, 0.55), transparent);
  z-index: -1;
  transition: none;
}
@media (hover: hover) {
  .btn-primary:hover { background: #fff; }
  .btn-primary:hover::after { right: 130%; transition: right 0.7s cubic-bezier(0.4, 0, 0.2, 1); }
  .btn-outline:hover { border-color: var(--glint-2); background: var(--glint-soft); color: var(--glint); }
  .btn-ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
  .btn-ok:hover { background: rgba(103, 211, 164, 0.24); }
  .btn-bad:hover { background: rgba(255, 127, 118, 0.24); }
  .btn-wait:hover { background: rgba(235, 187, 98, 0.24); }
}

.btn-outline { border-color: var(--line-2); color: var(--text); }
.btn-ghost { color: var(--text-2); }
.btn-ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(103, 211, 164, 0.28); }
.btn-wait, .btn-gold { background: var(--wait-soft); color: var(--wait); border-color: rgba(235, 187, 98, 0.3); }
.btn-bad { background: var(--bad-soft); color: var(--bad); border-color: rgba(255, 127, 118, 0.3); }

.btn-sm { min-height: 38px; padding: 0 14px; font-size: 13px; border-radius: 10px; gap: 6px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 22px;
  padding: 0;
  transition: background 0.2s, border-color 0.2s, transform 0.12s;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn i { pointer-events: none; }
@media (hover: hover) { .icon-btn:hover { background: var(--glint-soft); border-color: var(--line-2); } }

/* ---------------------------------------------------------
   الحقول
   --------------------------------------------------------- */
.field { margin-bottom: 16px; min-width: 0; }
.field label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 500; color: var(--text-2); }

.field input, .field select, .field textarea, .input,
.form-grid textarea, .form-grid select {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  font: 400 15px/1.5 var(--font-body);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
}
.field textarea, .form-grid textarea { min-height: 96px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder, .input::placeholder { color: var(--text-3); font-family: var(--font-body); }

.field input:focus, .field select:focus, .field textarea:focus, .input:focus,
.form-grid textarea:focus, .form-grid select:focus {
  outline: none;
  border-color: var(--glint-2);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px rgba(147, 167, 242, 0.2);
}
.field input.err, .field select.err, .field textarea.err { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.field input:disabled, .field select:disabled, .field textarea:disabled { opacity: 0.6; cursor: not-allowed; }

.field select, .form-grid select, select.input {
  padding-inline-end: 40px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a9b0c0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: left 14px center;
  cursor: pointer;
}
.field select option, select.input option { background: var(--surface-2); color: var(--text); }

/* أرقام وكلمات المرور: اتجاه لاتيني مع محاذاة يمين */
.field input[type="tel"], .field input[type="password"], .field input[type="number"], .field input[type="email"],
.field input[type="date"], .field input.ltr {
  direction: ltr;
  text-align: right;
  unicode-bidi: plaintext;
}
.field input[type="tel"]::placeholder, .field input[type="password"]::placeholder { direction: ltr; }

.field input[type="file"] { padding: 8px; min-height: 0; cursor: pointer; }
.field input[type="file"]::file-selector-button {
  margin-inline-end: 12px;
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text);
  font: 500 13px var(--font-body);
  cursor: pointer;
}
.field input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.8); cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--glint-2); width: 18px; height: 18px; }

.field-error { display: none; margin-top: 7px; color: var(--bad); font-size: 12.5px; font-weight: 500; line-height: 1.6; }
.field-error.show { display: block; }

/* إظهار/إخفاء كلمة المرور */
.pw-wrap { position: relative; }
.pw-wrap input { padding-inline-end: 50px; }
.pw-toggle {
  position: absolute;
  inset-inline-end: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-3);
  font-size: 19px;
}
.pw-toggle:hover { color: var(--text); }
.pw-toggle i { pointer-events: none; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 14px;
}
.form-grid .field { margin-bottom: 0; }

.checkbox-row { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }

/* مفتاح التبديل */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .slider {
  position: absolute;
  inset: 0;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  transition: background 0.25s, border-color 0.25s;
}
.switch .slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  right: 3px;
  top: 3px;
  background: var(--text-2);
  border-radius: 50%;
  transition: transform 0.28s var(--ease), background 0.25s;
}
.switch input:checked + .slider { background: var(--ok-soft); border-color: rgba(103, 211, 164, 0.5); }
.switch input:checked + .slider::before { transform: translateX(-20px); background: var(--ok); }
.switch input:focus-visible + .slider { outline: 2px solid var(--glint); outline-offset: 2px; }
.switch input:disabled + .slider { opacity: 0.5; }
.switch-label-row { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; cursor: pointer; }

/* ---------------------------------------------------------
   الشارات والفراغات والإشعارات
   --------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.wait { background: var(--wait-soft); color: var(--wait); border-color: rgba(235, 187, 98, 0.2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(103, 211, 164, 0.2); }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: rgba(255, 127, 118, 0.2); }

.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.status-dot.active { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.status-dot.suspended { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }

.empty-state { text-align: center; padding: 44px 20px; color: var(--text-2); grid-column: 1 / -1; }
.empty-state .glyph {
  width: 60px;
  height: 60px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-3);
  font-size: 28px;
}
.empty-state p { font-size: 14px; }

.login-alert {
  display: none;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bad-soft);
  border: 1px solid rgba(255, 127, 118, 0.3);
  color: #ffb1ab;
  font-size: 13.5px;
  line-height: 1.7;
}
.login-alert.show { display: flex; }
.login-alert::before {
  content: "!";
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.login-alert a { text-decoration: underline; font-weight: 700; color: inherit; }

.warn-box {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bad-soft);
  border: 1px solid rgba(255, 127, 118, 0.35);
  color: #ffb9b3;
  font-size: 13.5px;
  line-height: 1.8;
}

/* توست */
.toast-host {
  position: fixed;
  z-index: 400;
  inset-inline: 0;
  bottom: calc(var(--safe-b) + 22px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(94vw, 480px);
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(30, 35, 48, 0.94);
  border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.6;
  box-shadow: 0 18px 44px -14px rgba(0, 0, 0, 0.8);
  animation: toastIn 0.32s cubic-bezier(0.2, 1.1, 0.3, 1);
}
.toast i { font-size: 19px; flex: none; color: var(--glint); }
.toast.ok i { color: var(--ok); }
.toast.bad i { color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(8px); transition: 0.25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }

/* هياكل تحميل: أي شبكة فارغة تلمع حتى تصل البيانات */
.stat-grid:empty, .card-grid:empty {
  min-height: 96px;
  border-radius: 14px;
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 45%, var(--surface) 60%);
  background-size: 300% 100%;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------------------------------------------------------
   اللوحات والبطاقات
   --------------------------------------------------------- */
.panel {
  position: relative;
  padding: 22px;
  margin-bottom: 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0)) , var(--surface);
  border: 1px solid var(--line);
}
/* شفرة الشعار: خط مائل صغير على حافة كل لوحة رئيسية */
.panel::before {
  content: "";
  position: absolute;
  top: -1px;
  inset-inline-start: 22px;
  width: 38px;
  height: 2px;
  background: var(--glint);
  transform: skewX(-40deg);
  opacity: 0.8;
}
.panel .panel { background: var(--surface-2); }
.panel .panel::before { display: none; }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-head h3 { font-size: 16px; font-weight: 600; }
.panel-head .sub { margin-top: 3px; }

.form-grid + .btn, .panel > .btn { margin-top: 16px; }
.panel > .btn:first-child { margin-top: 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.search-input {
  width: min(100%, 280px);
  min-height: 42px;
  padding: 0 14px 0 14px;
  border-radius: 11px;
  border: 1px solid var(--line-2);
  background: var(--surface-2) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23727a8c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>") no-repeat left 14px center;
  padding-inline-end: 40px;
  color: var(--text);
  font: 400 14px var(--font-body);
}
.search-input:focus { outline: none; border-color: var(--glint-2); box-shadow: 0 0 0 3px rgba(147, 167, 242, 0.2); }
.search-input::placeholder { color: var(--text-3); }

/* إحصائيات */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 178px), 1fr)); gap: 12px; margin-bottom: 22px; }
.stat-grid.stat-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1400px) { .stat-grid.stat-grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.stat-card {
  position: relative;
  min-width: 0;
  padding: 16px 16px 15px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
}
.stat-card::before, .store-card::before, .channel-card::after {
  pointer-events: none;
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 0%), rgba(147, 167, 242, 0.13), transparent 65%);
  opacity: 0;
  transition: opacity 0.3s;
}
@media (hover: hover) { .stat-card:hover::before { opacity: 1; } }
.stat-card .stat-ic { position: absolute; top: 14px; inset-inline-end: 14px; font-size: 20px; color: var(--text-3); }
.stat-card .num { font: 600 30px/1.1 var(--font-body); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; padding-inline-end: 30px; }
.stat-card .lbl { margin-top: 8px; font-size: 12.5px; color: var(--text-2); font-weight: 400; }
.stat-card.ok .stat-ic { color: var(--ok); }
.stat-card.wait .stat-ic { color: var(--wait); }
.stat-card.bad .stat-ic { color: var(--bad); }
.stat-card.palm .stat-ic { color: var(--glint-2); }
.stat-card.ok::after, .stat-card.wait::after, .stat-card.bad::after, .stat-card.palm::after {
  content: "";
  position: absolute;
  bottom: 0;
  inset-inline-start: 16px;
  width: 30px;
  height: 2px;
  transform: skewX(-40deg);
  background: currentColor;
}
.stat-card.ok { color: var(--ok); } .stat-card.wait { color: var(--wait); }
.stat-card.bad { color: var(--bad); } .stat-card.palm { color: var(--glint-2); }
.stat-card > .num, .stat-card > .lbl { color: var(--text); }
.stat-card > .lbl { color: var(--text-2); }

/* بطاقات المتاجر / المنتجات */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 14px; }
.store-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
  transition: border-color 0.25s, transform 0.25s var(--ease);
}
.store-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 0%), rgba(147, 167, 242, 0.12), transparent 65%);
  opacity: 0;
  transition: opacity 0.3s;
}
@media (hover: hover) { .store-card:hover { border-color: var(--line-2); } .store-card:hover::before { opacity: 1; } }
.store-card .top { display: flex; align-items: center; gap: 12px; }
.store-card .ttl { flex: 1; min-width: 0; }
.store-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 2px; overflow-wrap: anywhere; }
.store-card .meta { font-size: 12.5px; color: var(--text-3); direction: ltr; unicode-bidi: plaintext; text-align: right; }
.store-card .stat-line { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-2); margin: 0; }
.store-card .stat-line b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.store-card .actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; flex-wrap: wrap; }
.store-card .actions .btn { flex: 1 1 auto; }

.avatar {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--glint);
  font: 600 16px var(--font-body);
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 36px; height: 36px; border-radius: 11px; font-size: 14px; }

.mini-product {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.mini-product .info { min-width: 0; flex: 1; }
.mini-product .info b { display: block; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.mini-product .info span { font-size: 12.5px; color: var(--text-2); }

/* صفوف اختيار صفحة فيسبوك */
.page-pick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  text-align: right;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
}
.page-pick-row:hover { border-color: var(--glint-2); background: var(--glint-soft); }
.page-pick-row:disabled { opacity: 0.55; cursor: default; }
.page-pick-row img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--line); }
.page-pick-row .ph-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--glint-soft); color: var(--glint); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.page-pick-row .info { flex: 1; min-width: 0; }
.page-pick-row .info b { display: block; font-size: 14px; }
.page-pick-row .info span { font-size: 12px; color: var(--text-2); }

/* ---------------------------------------------------------
   التبويبات الفرعية (فلاتر)
   --------------------------------------------------------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; max-width: 100%; }
.tab-btn {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text-2);
  font: 500 13px var(--font-body);
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.12s;
}
.tab-btn:active { transform: scale(0.96); }
@media (hover: hover) { .tab-btn:hover { color: var(--text); border-color: var(--glint-2); } }
.tab-btn.active { background: #eceef4; border-color: transparent; color: #0c0e12; font-weight: 600; }

/* ---------------------------------------------------------
   الجداول (تتحول لبطاقات على الهاتف — انظر قسم الاستجابة)
   --------------------------------------------------------- */
.table-wrap { overflow: auto; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; min-width: 680px; }
table.tbl-wide { min-width: 1120px; }
thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 12px 14px;
  background: var(--surface-2);
  color: var(--text-2);
  text-align: right;
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
tbody td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
@media (hover: hover) { tbody tr:hover td { background: rgba(147, 167, 242, 0.04); } }
table.tbl-wide td:nth-child(1) { min-width: 140px; }
table.tbl-wide td:nth-child(2), table.tbl-wide td:nth-child(4), table.tbl-wide td:nth-child(8), table.tbl-wide td:nth-child(9) { min-width: 120px; }
td.row-actions, .row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
td.row-actions { display: table-cell; }
td.row-actions .btn { margin: 2px 3px 2px 0; }

/* ---------------------------------------------------------
   النوافذ المنبثقة (نافذة على الحاسوب، ورقة سفلية على الهاتف)
   --------------------------------------------------------- */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: max(28px, var(--safe-t)) 16px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(5, 6, 9, 0.66);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.modal-backdrop.show { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: auto;
  padding: 24px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  animation: modalIn 0.34s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.modal-head h3 { font-size: 18px; font-weight: 600; }
.modal-close {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 18px;
  padding: 0;
}
.modal-close:hover { color: var(--text); border-color: var(--line-2); }
.modal-close i { pointer-events: none; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.modal hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

/* ---------------------------------------------------------
   بطاقات القنوات
   --------------------------------------------------------- */
.channel-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; margin-bottom: 20px; }
.channel-card {
  --ch: var(--glint);
  --ch-soft: var(--glint-soft);
  --ch-line: var(--line-2);
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px 18px 18px;
  text-align: center;
  border-radius: 18px;
  background: radial-gradient(160px 110px at 50% 0, var(--ch-soft), transparent 75%), var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.channel-card.wa { --ch: #57e58f; --ch-soft: rgba(87, 229, 143, 0.12); --ch-line: rgba(87, 229, 143, 0.3); }
.channel-card.messenger { --ch: #66b0ff; --ch-soft: rgba(102, 176, 255, 0.12); --ch-line: rgba(102, 176, 255, 0.3); }
.channel-card.instagram { --ch: #ff86b0; --ch-soft: rgba(255, 134, 176, 0.12); --ch-line: rgba(255, 134, 176, 0.3); }
.channel-card.telegram { --ch: #62cdf5; --ch-soft: rgba(98, 205, 245, 0.12); --ch-line: rgba(98, 205, 245, 0.3); }
.channel-card.tiktok { --ch: #dfe6f5; --ch-soft: rgba(223, 230, 245, 0.09); --ch-line: rgba(223, 230, 245, 0.26); }

.channel-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  font-size: 29px;
  color: var(--ch);
  background: var(--ch-soft);
  border: 1px solid var(--ch-line);
}
.channel-name { font-weight: 600; font-size: 16px; margin-bottom: 8px; }
.channel-card .sub { margin-top: 8px; font-size: 12px; color: var(--text-3); }
.channel-card .btn { width: 100%; }
.channel-card .btn + .btn { margin-top: 8px; }

.channel-card.channel-closed > * { filter: grayscale(1); opacity: 0.4; }
.channel-card.channel-closed::after {
  content: "مغلقة حاليًا";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 3;
  background: repeating-linear-gradient(135deg, rgba(8, 9, 12, 0.5) 0 10px, rgba(8, 9, 12, 0.66) 10px 20px);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.channel-status-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 14px; font-size: 12.5px; color: var(--text-2); }
.channel-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.channel-status-row.connected .channel-status-dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.channel-status-row.pending .channel-status-dot { background: var(--wait); box-shadow: 0 0 0 4px var(--wait-soft); animation: blink 1.4s infinite; }
.channel-status-row.disconnected .channel-status-dot { background: var(--bad); }
@keyframes blink { 50% { opacity: 0.35; } }
.channel-external-name { margin: -4px 0 12px; font-size: 12.5px; color: var(--text-2); direction: ltr; overflow-wrap: anywhere; }
.channel-ai-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 2px 2px;
  border-top: 1px dashed var(--line-2);
  font-size: 13px;
  color: var(--text-2);
}

/* ---------------------------------------------------------
   بطاقة الاشتراك (لوحة التاجر)
   --------------------------------------------------------- */
.sub-plan-badge {
  position: relative;
  max-width: 380px;
  padding: 26px 24px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  isolation: isolate;
}
.sub-plan-badge::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset-block: -30% -30%;
  inset-inline-end: -18%;
  width: 62%;
  background: var(--plan-tint, var(--glint-soft));
  transform: skewX(-24deg);
}
.sub-badge-free  { --plan-tint: rgba(169, 176, 192, 0.10); --plan: var(--text-2); }
.sub-badge-month { --plan-tint: rgba(147, 167, 242, 0.16); --plan: var(--glint); }
.sub-badge-year  { --plan-tint: rgba(235, 187, 98, 0.16); --plan: var(--wait); }
.sub-badge-icon { font-size: 30px; color: var(--plan); margin-bottom: 10px; }
.sub-badge-label { font: 600 26px/1.2 var(--font-head); margin-bottom: 8px; }
.sub-badge-price { font-size: 18px; font-weight: 600; color: var(--plan); margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.sub-badge-dates { font-size: 13px; color: var(--text-2); line-height: 2; }

/* روابط الإعدادات */
.settings-links-list { display: flex; flex-direction: column; gap: 8px; }
.settings-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 50px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.2s, background 0.2s;
}
.settings-link-item:hover { border-color: var(--glint-2); background: var(--glint-soft); }
.settings-link-item .arrow { color: var(--text-3); font-size: 18px; }
.panel.danger { border-color: rgba(255, 127, 118, 0.4); }
.panel.danger::before { background: var(--bad); }

/* بانر الإعلان */
.announce-banner { display: flex; gap: 14px; align-items: flex-start; border-inline-start: 3px solid var(--wait); }
.announce-banner > i { font-size: 22px; color: var(--wait); margin-top: 2px; }
.announce-banner b { display: block; margin-bottom: 4px; font-weight: 600; }
.announce-banner span { font-size: 13.5px; color: var(--text-2); }

/* شريط تقدّم */
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--glint-2), var(--glint)); transition: width 0.3s ease; }

/* شارة "مباشر" */
.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}
.live-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 2.6s infinite; }
.live-chip.blip i { animation: blip 0.7s ease-out; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(103, 211, 164, 0.55); } 70% { box-shadow: 0 0 0 8px rgba(103, 211, 164, 0); } 100% { box-shadow: 0 0 0 0 rgba(103, 211, 164, 0); } }
@keyframes blip { 0% { transform: scale(1); background: var(--glint); } 40% { transform: scale(2.1); } 100% { transform: scale(1); } }

/* ---------------------------------------------------------
   شاشات الدخول / التسجيل / الاشتراك
   --------------------------------------------------------- */
.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: block; }

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(440px, 46%) minmax(0, 1fr);
}
.auth-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(32px, var(--safe-t)) 28px max(32px, var(--safe-b));
  min-width: 0;
}
.auth-card { width: 100%; max-width: 440px; }
.auth-card.wide { max-width: 520px; }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 34px; }
.auth-brand .rk-mark { width: 54px; }
.auth-brand .wordmark { font-size: 21px; }
.auth-title { font: 600 clamp(26px, 5vw, 34px)/1.25 var(--font-head); margin-bottom: 8px; }
.auth-lead { color: var(--text-2); font-size: 14.5px; margin-bottom: 26px; }
.auth-foot { margin-top: 24px; text-align: center; font-size: 13px; color: var(--text-3); line-height: 2; }
.auth-foot a, .link { color: var(--glint); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(195, 207, 245, 0.35); }
.auth-foot a:hover, .link:hover { text-decoration-color: var(--glint); }

.auth-art {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 34px;
  padding: 56px clamp(40px, 6vw, 96px);
  overflow: hidden;
  background: linear-gradient(160deg, var(--bg-2), var(--bg));
  border-inline-end: 1px solid var(--line);
}
.auth-art::before {
  content: "";
  position: absolute;
  inset: -30%;
  background: repeating-linear-gradient(112deg, transparent 0 74px, rgba(147, 167, 242, 0.045) 74px 75px);
  pointer-events: none;
}
.auth-art .rk-mark { position: relative; width: min(100%, 460px); }
.auth-art .rk-mark path { stroke-width: 2.2; }
.auth-art .art-copy { position: relative; max-width: 460px; }
.auth-art h2 { font: 600 clamp(26px, 3vw, 38px)/1.35 var(--font-head); margin-bottom: 14px; }
.auth-art p { color: var(--text-2); font-size: 15px; }
.art-channels { position: relative; display: flex; gap: 10px; flex-wrap: wrap; }
.art-channels span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.03);
  font-size: 22px;
  color: var(--text-2);
}

/* صندوق رمز التحقق وقوائم الموافقة */
.otp-box { padding: 16px; margin-bottom: 18px; border-radius: 14px; background: var(--glint-soft); border: 1px solid rgba(147, 167, 242, 0.28); }
.otp-box p { margin: 0 0 12px; font-size: 13.5px; color: var(--text-2); line-height: 1.8; }
.otp-box p b { color: var(--text); direction: ltr; unicode-bidi: isolate; }
.otp-row { display: flex; gap: 8px; }
.otp-row input { flex: 1; min-width: 0; text-align: center; letter-spacing: 6px; font-size: 20px; font-variant-numeric: tabular-nums; }
.otp-row .btn { flex: none; }
.otp-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 13px; }
.otp-timer { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.otp-resend { background: none; border: none; color: var(--glint); font-weight: 600; padding: 6px 0; font-size: 13px; }
.otp-resend:disabled { color: var(--text-3); cursor: not-allowed; }

.agree-block { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.agree-row { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--text-2); cursor: pointer; line-height: 1.7; }
.agree-row input { margin-top: 3px; flex: none; }
.agree-row a { color: var(--glint); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.success-block { text-align: center; padding: 8px 0; }
.success-block h2 { margin: 0 0 10px; font: 600 24px var(--font-head); }
.success-block p { margin: 0 0 22px; color: var(--text-2); font-size: 14px; line-height: 1.9; }
.glyph-ok, .glyph-wait {
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: var(--ok-soft);
  border: 1px solid rgba(103, 211, 164, 0.32);
  color: var(--ok);
  font-size: 32px;
}
.glyph-wait, .success-block.pending .glyph-ok { background: var(--wait-soft); border-color: rgba(235, 187, 98, 0.32); color: var(--wait); }

/* الاشتراك */
.section-title { margin: 26px 0 14px; padding-top: 18px; border-top: 1px dashed var(--line-2); font-size: 14px; font-weight: 600; }
.section-title:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.plan-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.plan-card {
  position: relative;
  padding: 16px 12px;
  text-align: center;
  border-radius: 14px;
  border: 1.5px solid var(--line-2);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.12s;
}
.plan-card:active { transform: scale(0.97); }
.plan-card.active { border-color: var(--glint); background: var(--glint-soft); }
.plan-card.active::after {
  content: "";
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--glint);
  box-shadow: 0 0 0 4px rgba(195, 207, 245, 0.16);
}
.plan-card .label { font-weight: 600; font-size: 14px; margin-bottom: 6px; color: var(--text-2); }
.plan-card .price { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.discount-row { display: flex; gap: 8px; }
.discount-row input { flex: 1; min-width: 0; }
.discount-row .btn { flex: none; }
.discount-msg { min-height: 20px; margin-top: 8px; font-size: 13px; font-weight: 500; }
.discount-msg.ok { color: var(--ok); }
.discount-msg.bad { color: var(--bad); }
.total-box { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; padding: 16px 18px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2); }
.total-box .lbl { font-size: 13.5px; color: var(--text-2); }
.total-box .val { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--glint); }
.pay-methods, .provider-methods { display: flex; gap: 10px; margin-bottom: 14px; }
.pay-method, .provider-method {
  flex: 1;
  min-height: 52px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 12px;
  border: 1.5px solid var(--line-2);
  background: var(--surface-2);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.pay-method.active, .provider-method.active { border-color: var(--glint); background: var(--glint-soft); }
.pay-method.disabled, .provider-method.disabled { opacity: 0.4; cursor: not-allowed; }
.pay-method small { display: block; margin-top: 2px; font-weight: 400; color: var(--text-3); font-size: 11px; }
.transfer-box { margin-bottom: 20px; padding: 18px; text-align: center; border-radius: 14px; border: 1px dashed var(--line-2); background: rgba(255, 255, 255, 0.015); }
.transfer-box img.qr { width: min(100%, 190px); height: auto; aspect-ratio: 1; object-fit: contain; margin-bottom: 14px; padding: 8px; border-radius: 14px; background: #fff; }
.transfer-box img.qr[src=""], .transfer-box img.qr:not([src]) { display: none; }
.wallet-copy-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.wallet-copy-row .num { font-weight: 700; font-size: 17px; letter-spacing: 0.03em; font-variant-numeric: tabular-nums; direction: ltr; }
.transfer-box .note { margin-top: 12px; font-size: 12.5px; color: var(--text-2); }

/* ---------------------------------------------------------
   هيكل التطبيق (بعد الدخول)
   --------------------------------------------------------- */
.app-shell { display: grid; grid-template-columns: 276px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px 14px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, rgba(20, 24, 33, 0.9), rgba(13, 15, 20, 0.94));
  border-inline-end: 1px solid var(--line);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.sidebar .brand-lockup { padding: 4px 8px 22px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.sidebar-close { display: none; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-2);
  font: 500 14px var(--font-body);
  text-align: right;
  transition: background 0.2s, color 0.2s;
}
.nav-item .ic { display: grid; place-items: center; width: 22px; font-size: 20px; flex: none; pointer-events: none; }
.nav-item .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
@media (hover: hover) { .nav-item:hover { background: rgba(255, 255, 255, 0.045); color: var(--text); } }
.nav-item.active { color: var(--text); background: linear-gradient(to left, rgba(147, 167, 242, 0.16), rgba(147, 167, 242, 0.02)); }
.nav-item.active .ic { color: var(--glint); }
.nav-item.active::before {
  content: "";
  position: absolute;
  inset-inline-start: -14px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  background: var(--glint);
  clip-path: polygon(0 0, 100% 14%, 100% 86%, 0 100%);
  box-shadow: 0 0 16px rgba(147, 167, 242, 0.7);
}
.nav-item .notif-dot {
  display: none;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 0 3px var(--bad-soft);
  animation: pulseBad 2.4s infinite;
  pointer-events: none;
}
.nav-item.has-notif .notif-dot { display: block; }
@keyframes pulseBad { 0%, 100% { box-shadow: 0 0 0 3px rgba(255, 127, 118, 0.18); } 50% { box-shadow: 0 0 0 6px rgba(255, 127, 118, 0.05); } }

.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 12px; padding: 4px 6px 12px; min-width: 0; }
.who .avatar { width: 40px; height: 40px; }
.who .who-text { min-width: 0; font-size: 12px; color: var(--text-3); line-height: 1.5; }
.who .who-text b { display: block; color: var(--text); font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .btn-ghost { width: 100%; justify-content: flex-start; }

.main { width: 100%; min-width: 0; max-width: 1280px; margin-inline: auto; padding: 30px clamp(18px, 3.2vw, 44px) 90px; }

.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.topbar h2 { font: 600 clamp(24px, 3.6vw, 32px)/1.25 var(--font-head); }
.topbar .sub { margin-top: 8px; max-width: 62ch; }
.greeting { margin-bottom: 4px; font-size: 13px; color: var(--glint); font-weight: 500; }

.tab-panel { animation: panelIn 0.28s var(--ease); }
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* شريط التطبيق العلوي للهاتف */
.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  align-items: center;
  gap: 12px;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  background: rgba(12, 14, 18, 0.82);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.mobile-topbar .brand-lockup { flex: 1; gap: 10px; }
.mobile-topbar .rk-mark { width: 38px; }
.mobile-topbar .wordmark { font-size: 16px; }
.mobile-topbar .role-tag { font-size: 11.5px; color: var(--text-3); margin-top: 5px; display: block; }

/* التنقل السفلي (هاتف) */
.bottom-nav {
  display: none;
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 60;
  padding: 8px 8px calc(8px + var(--safe-b));
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  background: rgba(14, 16, 22, 0.88);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid var(--line);
}
.bn-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 54px;
  padding: 4px 2px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text-3);
  font: 500 10.5px/1.15 var(--font-body);
  transition: color 0.2s, background 0.2s, transform 0.12s;
}
.bn-item:active { transform: scale(0.94); }
.bn-item i { font-size: 23px; pointer-events: none; transition: transform 0.3s var(--ease); }
.bn-item span { pointer-events: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bn-item.active { color: var(--text); background: var(--glint-soft); }
.bn-item.active i { color: var(--glint); transform: translateY(-1px); }
.bn-item.active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 22px;
  height: 2px;
  background: var(--glint);
  transform: skewX(-40deg);
  box-shadow: 0 0 10px rgba(195, 207, 245, 0.8);
}
.bn-item .bn-dot { display: none; position: absolute; top: 8px; inset-inline-end: calc(50% - 20px); width: 8px; height: 8px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--bg); }
.bn-item.has-notif .bn-dot { display: block; }

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 85;
  background: rgba(4, 5, 8, 0.62);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s;
}
.sidebar-scrim.show { display: block; opacity: 1; }

/* ---------------------------------------------------------
   الطباعة (ورقة بيضاء دائمًا)
   --------------------------------------------------------- */
.print-area { display: none; }
@media print {
  html, body { background: #fff !important; color: #000 !important; }
  body::before, #splash { display: none !important; }
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; color: #000; }
  .print-area { display: block; position: absolute; top: 0; right: 0; left: 0; padding: 20px; background: #fff; }
  .print-table { width: 100%; border-collapse: collapse; min-width: 0; }
  .print-table th, .print-table td { border: 1px solid #333; padding: 8px; font-size: 12px; text-align: right; background: #fff; position: static; display: table-cell; }
  .print-labels { display: flex; flex-wrap: wrap; gap: 10px; }
  .print-label { width: 300px; border: 2px solid #222; border-radius: 10px; padding: 14px; page-break-inside: avoid; margin-bottom: 10px; }
  .print-label h4 { margin: 0 0 8px; font-size: 15px; border-bottom: 1px solid #999; padding-bottom: 6px; }
  .print-label p { margin: 3px 0; font-size: 12.5px; }
}

/* ---------------------------------------------------------
   الاستجابة — الحاسوب اللوحي ثم الهاتف
   --------------------------------------------------------- */
@media (max-width: 1100px) {
  .auth-shell { grid-template-columns: minmax(400px, 52%) minmax(0, 1fr); }
  .auth-art { padding-inline: 40px; }
}

@media (max-width: 960px) {
  .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .auth-panel { justify-content: flex-start; padding-top: max(44px, calc(var(--safe-t) + 8vh)); }
  .auth-brand { margin-bottom: 28px; }

  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .mobile-topbar { display: flex; }
  .bottom-nav { display: grid; }
  body.kb-open .bottom-nav { display: none; }
  body.kb-open .main { padding-bottom: 40px; }

  /* الشريط الجانبي = درج جانبي حقيقي: يبدأ من الحافة اليمنى ويخفى تمامًا (يُصلح ظهور الجزء المقصوص) */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    left: auto;
    z-index: 90;
    align-self: auto;
    width: min(86vw, 330px);
    height: auto;
    padding-top: calc(20px + var(--safe-t));
    padding-bottom: calc(16px + var(--safe-b));
    background: linear-gradient(180deg, #171b25, #0f1219);
    border-inline-end: 0;
    border-inline-start: 1px solid var(--line-2);
    box-shadow: -30px 0 80px -20px rgba(0, 0, 0, 0.8);
    transform: translateX(104%);
    visibility: hidden;
    transition: transform 0.34s var(--ease), visibility 0s linear 0.34s;
  }
  .sidebar.open { transform: none; visibility: visible; transition: transform 0.34s var(--ease); }
  .sidebar .brand-lockup { position: relative; padding-inline-end: 52px; }
  .sidebar-close { display: grid; position: absolute; top: 2px; inset-inline-end: 0; width: 40px; height: 40px; font-size: 20px; }
  .nav-item { min-height: 50px; font-size: 15px; }
  .nav-item.active::before { inset-inline-start: -14px; }

  .main { padding: 20px 16px calc(96px + var(--safe-b)); }
  .topbar { margin-bottom: 20px; }
  .topbar .live-chip { display: none; }
  .toast-host { bottom: calc(var(--safe-b) + 84px); }
  body:not(.has-bn) .toast-host { bottom: calc(var(--safe-b) + 22px); }
}

@media (max-width: 760px) {
  .stat-grid.stat-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* الجداول تتحول إلى بطاقات: كل صف بطاقة، وكل خلية باسمها */
  .table-wrap { border: 0; background: none; overflow: visible; }
  table, table.tbl-wide { display: block; min-width: 0; font-size: 14px; }
  thead { display: none; }
  tbody { display: grid; gap: 12px; }
  tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    padding: 16px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
  }
  tbody td, td.row-actions { display: block; min-width: 0; padding: 0; border: 0; background: none !important; overflow-wrap: anywhere; max-width: none !important; }
  tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: 11.5px;
    color: var(--text-3);
    font-weight: 400;
  }
  tbody td:first-child { grid-column: 1 / -1; font-size: 15.5px; font-weight: 600; }
  tbody td:first-child::before { display: none; }
  tbody td[colspan] { grid-column: 1 / -1; text-align: center; padding: 20px 8px; }
  tbody td[colspan]::before { display: none; }
  td.row-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
  tbody td.row-actions::before { display: none; }
  td.row-actions .btn { flex: 1 1 auto; margin: 0; min-height: 42px; }

  .plan-cards { gap: 8px; }
  .stat-card .num { font-size: 26px; }
}

@media (max-width: 640px) {
  /* شبكات النماذج بأعمدة مضمنة تصبح عمودًا واحدًا */
  .form-grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .form-grid [style*="grid-column"] { grid-column: auto !important; }
  .panel-head input.search-input, .panel-head .search-input { width: 100%; min-width: 0 !important; }
  .panel-head > .tabs { width: 100%; }
  .panel { padding: 18px 16px; border-radius: 16px; }
  .panel-head { margin-bottom: 16px; }
  .btn-mob-block { width: 100%; }

  /* بطاقة القناة على الهاتف: أيقونة + اسم + حالة في صف واحد، والباقي تحتها */
  .channel-card { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; align-items: center; padding: 16px; text-align: right; }
  .channel-card > * { grid-column: 1 / -1; }
  .channel-card > .channel-icon { grid-column: 1; grid-row: 1 / span 2; width: 52px; height: 52px; margin: 0 0 14px; font-size: 26px; border-radius: 15px; align-self: start; }
  .channel-card > .channel-name { grid-column: 2; grid-row: 1; margin: 0; align-self: end; }
  .channel-card > .channel-status-row { grid-column: 2; grid-row: 2; justify-content: flex-start; margin: 4px 0 14px; align-self: start; }
  .channel-card > .channel-external-name { margin: 0 0 12px; }
  .store-card .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .topbar > .btn { width: 100%; }

  /* التبويبات الفرعية تمرَّر أفقيًا بدل أن تلتف على أسطر */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin-inline: -2px; padding-inline: 2px; }
  .tabs::-webkit-scrollbar { display: none; }

  /* النوافذ المنبثقة تصبح ورقة سفلية */
  .modal-backdrop { align-items: flex-end; padding: 0; overflow: hidden; }
  .modal-backdrop.show { animation: fadeIn 0.2s ease; }
  .modal {
    max-width: none !important;
    max-height: calc(100dvh - 16px - var(--safe-t));
    margin: 0;
    padding: 0 18px 0;
    border-radius: 24px 24px 0 0;
    border-bottom: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    animation: sheetIn 0.38s var(--ease);
  }
  .modal::before { content: ""; display: block; width: 42px; height: 4px; margin: 12px auto 12px; border-radius: 4px; background: var(--line-2); }
  .modal-head { position: sticky; top: 0; z-index: 2; margin: 0 -18px 16px; padding: 4px 18px 12px; background: var(--surface); }
  .modal:not(:has(.modal-foot)) { padding-bottom: calc(22px + var(--safe-b)); }
  .modal-foot { position: sticky; bottom: 0; z-index: 2; margin: 22px -18px 0; padding: 14px 18px calc(14px + var(--safe-b)); background: linear-gradient(180deg, rgba(20, 24, 33, 0.75), var(--surface) 40%); border-top: 1px solid var(--line); }
  .modal-foot .btn { flex: 1; }
  @keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }

  .otp-row { flex-wrap: wrap; }
  .otp-row input { flex: 1 1 100%; }
  .otp-row .btn { flex: 1 1 100%; }
  .wallet-copy-row { flex-direction: column; }
}

@media (max-width: 480px) {
  body { font-size: 14.5px; }
  .auth-panel { padding-inline: 18px; }
  .main { padding-inline: 14px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 13px 13px; }
  .stat-card .num { font-size: 24px; padding-inline-end: 22px; }
  .stat-card .stat-ic { font-size: 18px; inset-inline-end: 11px; top: 12px; }
  .stat-card .lbl { font-size: 12px; }
  .card-grid, .channel-cards { grid-template-columns: 1fr; }
  .topbar h2 { font-size: 24px; }
  .discount-row { flex-direction: column; }
  .discount-row .btn { width: 100%; }
  .plan-card .price { font-size: 15px; }
  .pay-methods, .provider-methods { flex-direction: column; }
  .sub-plan-badge { max-width: none; }
}

@media (max-width: 360px) {
  .stat-grid { grid-template-columns: 1fr; }
  .bn-item { font-size: 10px; }
  .bn-item i { font-size: 21px; }
}

/* الشاشات اللمسية: أهداف لمس أكبر، وحقول 16px حتى لا يكبّر آيفون الصفحة تلقائيًا */
@media (pointer: coarse) {
  .btn-sm { min-height: 42px; }
  .tab-btn { min-height: 42px; }
  .field input, .field select, .field textarea, .input, .search-input, .form-grid textarea, .form-grid select { font-size: 16px; }
  .switch { width: 50px; height: 28px; }
  .switch .slider::before { width: 20px; height: 20px; }
  .switch input:checked + .slider::before { transform: translateX(-22px); }
}

/* الشاشات الأفقية القصيرة: تنقّل سفلي أخف */
@media (max-height: 480px) and (max-width: 960px) {
  .bn-item { min-height: 44px; flex-direction: row; gap: 8px; font-size: 12px; }
  .bn-item i { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .rk-draw path { stroke-dashoffset: 0; fill: var(--text); stroke-width: 0; }
  #splash { display: none; }
}

/* ---------------------------------------------------------
   إضافات صفحات التسجيل والاشتراك
   --------------------------------------------------------- */
.auth-shell.solo { grid-template-columns: minmax(0, 1fr); }
.auth-brand { color: var(--text); }
.country-field { position: relative; }
.country-field input { padding-inline-end: 60px; }
.country-field img { position: absolute; inset-inline-end: 16px; top: 50%; transform: translateY(-50%); border-radius: 3px; box-shadow: 0 0 0 1px var(--line-2); }
.pw-rules { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pw-rules span { padding: 3px 11px; border-radius: 99px; border: 1px solid var(--line-2); font-size: 11.5px; color: var(--text-3); transition: color 0.2s, border-color 0.2s, background 0.2s; }
.pw-rules span.ok { color: var(--ok); border-color: rgba(103, 211, 164, 0.4); background: var(--ok-soft); }
.art-list { position: relative; list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 16px; }
.art-list li { display: flex; gap: 14px; align-items: center; color: var(--text-2); font-size: 15px; line-height: 1.6; }
.art-list i { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.03); font-size: 20px; color: var(--glint); }
html:has(#splash):not(.no-splash) .auth-art .rk-draw path { animation-delay: 1.8s, 2.5s; }

/* خانات الاختيار المخصّصة (بديل عن مظهر المتصفح الرمادي) */
.agree-row input[type="checkbox"], .checkbox-row input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-content: center;
  border-radius: 7px;
  border: 1.5px solid var(--line-2);
  background: var(--surface-2);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.12s;
}
.agree-row input[type="checkbox"]:active, .checkbox-row input[type="checkbox"]:active { transform: scale(0.9); }
.agree-row input[type="checkbox"]:checked, .checkbox-row input[type="checkbox"]:checked { background: #eceef4; border-color: transparent; }
.agree-row input[type="checkbox"]:checked::after, .checkbox-row input[type="checkbox"]:checked::after {
  content: "";
  width: 11px;
  height: 6px;
  margin-top: -2px;
  border-inline-start: 2.4px solid #0c0e12;
  border-bottom: 2.4px solid #0c0e12;
  transform: rotate(-45deg);
}

/* الشعار الأصلي RADKA_LOGO.jpg: الأسود يذوب في خلفية الصفحة بدل أن يظهر كمربع */
.logo-jpg { display: block; mix-blend-mode: screen; width: 150px; height: 150px; object-fit: contain; margin-inline-start: -14px; }
.doc-head .logo-jpg { width: 170px; height: 170px; margin: -24px 0 -6px -18px; }
.foot-brand .logo-jpg { margin-top: -20px; margin-bottom: -22px; }
