/* =========================================================
   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); }
.announce-banner > div { min-width: 0; flex: 1; }
.announce-banner-close { flex-shrink: 0; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.announce-banner-close:hover { background: var(--surface-3); color: var(--text); }
.announce-banner-close i { font-size: 17px; }

/* شريط تقدّم */
.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; }

/* ---------------------------------------------------------
   الطباعة — واجهة التخصيص والمعاينة (داخل لوحة المتجر)
   --------------------------------------------------------- */
.pr-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 18px; align-items: start; }
.pr-main, .pr-side { min-width: 0; }
.pr-side { position: sticky; top: 18px; }
.pr-side .panel { margin-bottom: 0; }

.pr-group { padding: 18px 0; border-top: 1px solid var(--line); }
.pr-group:first-of-type { border-top: 0; padding-top: 4px; }
.pr-group:last-child { padding-bottom: 0; }
.pr-group-title { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.pr-group-title i { font-size: 17px; color: var(--glint-2); }

.pr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pr-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  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;
}
.pr-chip > i { font-size: 16px; line-height: 1; pointer-events: none; }
.pr-chip > span { pointer-events: none; }
.pr-chip .pr-ck { width: 0; opacity: 0; font-size: 14px; transition: opacity 0.2s, width 0.2s; }
.pr-chip:active { transform: scale(0.96); }
@media (hover: hover) { .pr-chip:hover { color: var(--text); border-color: var(--glint-2); } }
.pr-chip[aria-pressed="true"] { background: var(--glint-soft); border-color: var(--glint-2); color: var(--glint); }
.pr-chip[aria-pressed="true"] .pr-ck { width: 14px; opacity: 1; }

.pr-seg { display: inline-flex; flex-wrap: wrap; gap: 3px; max-width: 100%; padding: 3px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); }
.pr-seg button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font: 500 13px var(--font-body);
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
@media (hover: hover) { .pr-seg button:hover { color: var(--text); } }
.pr-seg button.on { background: #eceef4; color: #0c0e12; font-weight: 600; }

.pr-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 14px; margin-top: 14px; }
.pr-opts .field { margin-bottom: 0; }
.pr-dims { display: flex; align-items: center; gap: 10px; }
.pr-dims input { flex: 1; min-width: 0; }
.pr-dims span { color: var(--text-3); }
.pr-hint { margin-top: 8px; font-size: 12.5px; color: var(--text-3); line-height: 1.7; }
#tab-s-print[data-pmode="table"] [data-for="labels"] { display: none; }

.pr-preview-panel .panel-head { margin-bottom: 14px; }
.pr-stage {
  display: flex;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: repeating-linear-gradient(135deg, rgba(190, 204, 255, 0.04) 0 10px, transparent 10px 20px), var(--bg-2);
}
.pr-stage-inner { position: relative; flex: none; }
.pr-scaler { position: absolute; top: 0; left: 0; transform-origin: 0 0; box-shadow: 0 14px 34px -12px rgba(0, 0, 0, 0.7); }
.pr-warn { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--wait-soft); color: var(--wait); font-size: 12.5px; line-height: 1.7; }
.pr-warn i { font-size: 16px; margin-top: 3px; flex: none; }
.pr-preview-note { margin: 12px 0 16px; font-size: 12.5px; color: var(--text-3); }
.pr-tip { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; font-size: 12.5px; line-height: 1.7; color: var(--text-3); }
.pr-tip i { font-size: 15px; margin-top: 3px; color: var(--glint-2); flex: none; }

@media (max-width: 1100px) {
  .pr-layout { grid-template-columns: minmax(0, 1fr); }
  .pr-side { position: static; }
}
@media (max-width: 640px) {
  .pr-chip { min-height: 42px; }
  .pr-seg { display: flex; width: 100%; }
  .pr-seg button { flex: 1 1 auto; padding: 0 10px; }
}

/* ---------------------------------------------------------
   الملصق: ورقة بيضاء، مربع بحدود حادة، شعار أسود
   كل ملصق = صفحة مستقلة بحجم الملصق نفسه (يُحدَّد @page من app.js وقت الطباعة)
   --------------------------------------------------------- */
.print-area { display: none; }
.print-area.measuring { display: block; position: fixed; left: -20000px; top: 0; visibility: hidden; pointer-events: none; }

.pl-sheet {
  box-sizing: border-box;
  padding: 2mm;
  overflow: hidden;
  background: #fff;
  color: #000;
  direction: rtl;
  text-align: right;
  font-family: "Readex Pro", system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
  line-height: 1.35;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.pl-sheet *, .pl-sheet *::before, .pl-sheet *::after { box-sizing: border-box; color: #000; }
.pl-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: var(--bw, 0.6mm) solid #000;
  border-radius: 0;
  background: #fff;
  font-size: calc(var(--fs, 10.5pt) * var(--fit, 1));
}

/* الترويسة: اسم المتجر + رقم الطلب */
.pl-head { display: flex; align-items: stretch; flex: none; border-bottom: var(--bw, 0.6mm) solid #000; }
.pl-store {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.5em 0.75em;
  font: 700 1.45em/1.25 "Reem Kufi", "Readex Pro", system-ui, sans-serif;
  overflow-wrap: anywhere;
}
.pl-no {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 5.4em;
  padding: 0.3em 0.7em;
  border-inline-start: var(--bw, 0.6mm) solid #000;
  line-height: 1.1;
  text-align: center;
}
.pl-no small { font-size: 0.62em; font-weight: 500; }
.pl-no b { direction: ltr; font: 700 1.75em/1.1 "Outfit", "Readex Pro", system-ui, sans-serif; letter-spacing: 0.01em; }
.pl-head.solo .pl-no { flex: 1 1 auto; flex-direction: row; gap: 0.7em; border-inline-start: 0; }

/* الجسم: صفوف موزّعة بالتساوي، يفصل بينها خط رفيع حاد */
.pl-body { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow: hidden; }
.pl-row { display: flex; flex: 1 1 auto; align-items: stretch; border-bottom: 0.2mm solid #000; }
.pl-row:last-child { border-bottom: 0; }
.pl-cell { display: flex; flex: 1 1 0; align-items: center; min-width: 0; padding: 0.3em 0.75em; }
.pl-row.pair .pl-cell + .pl-cell { border-inline-start: 0.2mm solid #000; }
.pl-in { display: flex; align-items: baseline; gap: 0.7em; width: 100%; }
.pl-k { flex: 0 0 auto; width: 5.2em; font-size: 0.78em; font-weight: 500; }
.pl-row.pair .pl-k { width: auto; }
.pl-v { flex: 1 1 auto; min-width: 0; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.pl-v.num { font-variant-numeric: tabular-nums; }
.pl-disc { display: block; font-size: 0.78em; font-weight: 500; line-height: 1.3; }
.pl-empty { padding: 1em; font-size: 0.85em; text-align: center; }

/* التذييل: ملاحظة اختيارية + شعار RadKa (أسود على أبيض) */
.pl-foot { display: flex; flex: none; align-items: center; gap: 0.8em; padding: 0.4em 0.75em; border-top: var(--bw, 0.6mm) solid #000; }
.pl-foot.logo-only { justify-content: center; }
.pl-note { flex: 1 1 auto; min-width: 0; font-size: 0.82em; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.pl-logo { display: flex; flex: none; align-items: center; gap: 0.6em; direction: ltr; }
.pl-logo svg { display: block; width: auto; max-width: none; height: 2.1em; }
.pl-logo svg path { fill: #000; }
.pl-logo span { margin-right: -0.4em; font: 300 0.95em/1 "Outfit", "Readex Pro", system-ui, sans-serif; letter-spacing: 0.4em; }

/* وضع الجدول (A4) */
.pd-doc {
  box-sizing: border-box;
  background: #fff;
  color: #000;
  direction: rtl;
  text-align: right;
  font-family: "Readex Pro", system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
  font-size: var(--tfs, 10pt);
  line-height: 1.5;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.pd-doc *, .pd-doc *::before, .pd-doc *::after { box-sizing: border-box; color: #000; }
.pr-scaler .pd-doc { padding: 12mm; }
.pd-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 0.6mm solid #000; }
.pd-head h2 { font: 700 1.7em/1.3 "Reem Kufi", "Readex Pro", system-ui, sans-serif; }
.pd-head p { margin-top: 2px; font-size: 0.85em; }
.pd-head .pl-logo { flex: none; }
.pd-head .pl-logo svg { height: 2.8em; }
.pd-doc .pd-table { display: table !important; width: 100%; min-width: 0 !important; border-collapse: collapse; font-size: 1em; }
.pd-doc .pd-table thead { display: table-header-group !important; }
.pd-doc .pd-table tbody { display: table-row-group !important; }
.pd-doc .pd-table tr { display: table-row !important; padding: 0; border: 0; background: none; break-inside: avoid; page-break-inside: avoid; }
.pd-doc .pd-table th, .pd-doc .pd-table td {
  display: table-cell !important;
  position: static;
  padding: 0.45em 0.6em;
  border: 0.25mm solid #000;
  background: #fff !important;
  font-size: 1em;
  font-weight: 400;
  text-align: right;
  white-space: normal;
  vertical-align: middle;
  overflow-wrap: anywhere;
}
.pd-doc .pd-table th { background: #ececec !important; font-weight: 700; font-size: 0.92em; white-space: nowrap; }
.pd-doc .pd-table td::before { content: none !important; display: none !important; }
.pd-doc .pd-table td.nw { white-space: nowrap; }
.pd-doc .pd-table td.n, .pd-doc .pd-table th.n { width: 1%; white-space: nowrap; text-align: center; }
.pd-foot { margin-top: 10px; font-size: 0.85em; }

@media print {
  html, body { height: auto !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; background: #fff !important; color: #000 !important; }
  body::before { display: none !important; }
  /* لا نستخدم visibility:hidden لأنه يُبقي المساحة فتظهر صفحات فارغة؛ نُخفي كل شيء عدا منطقة الطباعة */
  body > *:not(.print-area) { display: none !important; }
  .print-area, .print-area.measuring { display: block !important; position: static !important; left: auto !important; visibility: visible !important; width: auto; margin: 0; padding: 0; background: #fff; }
  .print-labels { display: block; }
  .pl-sheet { margin: 0; break-inside: avoid; page-break-inside: avoid; }
  .pl-sheet:not(:last-child) { break-after: page; page-break-after: always; }
}

/* ---------------------------------------------------------
   الاستجابة — الحاسوب اللوحي ثم الهاتف
   --------------------------------------------------------- */
@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%); width: 22px; height: 22px; object-fit: cover; border-radius: 50%; box-shadow: 0 0 0 1px var(--line-2), 0 2px 6px rgba(0, 0, 0, 0.35); filter: saturate(0.88) brightness(0.96); }
.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; }

/* =========================================================
   صفحة/تبويب "مساعدة" — كتلة شرح (عنوان + نص) تتبعها صورة، تتكرر بالتناوب
   تُستخدم بلوحة التاجر (تبويب s-help) وبصفحة help.html العامة. أضِف كتل
   جديدة بنسخ ولصق ".help-block" كاملة — لا حاجة لأي تعديل بلوحة الأدمن أو
   بقاعدة البيانات، كل المحتوى ثابت داخل HTML مباشرة.
   ========================================================= */
.help-intro { max-width: 640px; margin: 0 0 28px; color: var(--ink-soft); font-size: 15px; line-height: 1.9; }
.help-block { display: grid; gap: 18px; padding: 26px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.help-block-num { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 10px; border-radius: 999px; background: var(--glint-soft); color: var(--glint); font: 600 13px var(--font-brand); margin-bottom: 4px; }
.help-block h3 { font: 600 18px/1.4 var(--font-head); margin: 0 0 4px; color: var(--text); }
.help-block p { margin: 0; color: var(--ink-soft); font-size: 14.5px; line-height: 1.9; }
.help-block p + p { margin-top: 10px; }
.help-block ul { margin: 8px 0 0; padding-inline-start: 20px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.9; }
.help-block li { margin-bottom: 6px; }
.help-media { border-radius: var(--radius-m); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.help-media img { display: block; width: 100%; height: auto; }
.help-media figcaption { padding: 10px 14px; font-size: 12.5px; color: var(--ink-soft); border-top: 1px solid var(--line); text-align: center; }
.help-media.placeholder { display: grid; place-items: center; gap: 8px; min-height: 160px; color: var(--text-3); font-size: 13px; }
.help-media.placeholder i { font-size: 30px; color: var(--glint-2); }
@media (min-width: 720px) {
  .help-block.with-media { grid-template-columns: 1.15fr 1fr; align-items: center; }
  .help-block.with-media.media-first { grid-template-columns: 1fr 1.15fr; }
  .help-block.with-media.media-first .help-media { order: -1; }
}

/* =========================================================
   ميزة «أجلب منتجاتك» (Beta) — لوحة التاجر + تحكم الأدمن
   كل الألوان والحركات من نفس متغيّرات النظام (لا ألوان جديدة إلا ألوان المنصات)
   ========================================================= */
@keyframes rkSpin { to { transform: rotate(360deg); } }
@keyframes impSlide { from { transform: translateX(120%); } to { transform: translateX(-300%); } }
@keyframes impPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(147, 167, 242, 0.45); } 50% { box-shadow: 0 0 0 6px rgba(147, 167, 242, 0); } }
@keyframes impNew { 0% { box-shadow: 0 0 0 0 rgba(147, 167, 242, 0.55); } 100% { box-shadow: 0 0 0 16px rgba(147, 167, 242, 0); } }

/* الزر بجانب «أضف منتج» */
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#btn-import-products[hidden], .beta-tag[hidden] { display: none !important; }
#btn-import-products { border-color: rgba(147, 167, 242, 0.42); color: var(--glint); }
#btn-import-products i { transition: transform 0.4s var(--ease); }
@media (hover: hover) { #btn-import-products:hover i { transform: rotate(16deg) scale(1.12); } }
#btn-import-products.is-dev { border-style: dashed; border-color: var(--line-2); color: var(--text-2); }
#btn-import-products.is-running { border-color: rgba(103, 211, 164, 0.42); background: var(--ok-soft); color: var(--ok); }
#btn-import-products.is-running i { animation: rkSpin 1s linear infinite; }

/* شارة Beta */
.beta-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--glint-soft);
  border: 1px solid rgba(147, 167, 242, 0.34);
  color: var(--glint);
  font: 600 10.5px/1 var(--font-body);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.beta-tag.dev { background: var(--wait-soft); border-color: rgba(235, 187, 98, 0.32); color: var(--wait); letter-spacing: 0; text-transform: none; }
.imp-modal .modal-head h3 { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.imp-modal .modal-head h3 > i { color: var(--glint); }

/* شاشات النافذة: تنزلق بلطف عند كل تبديل */
.imp-view { animation: fadeUp 0.32s var(--ease); }
.imp-lead { margin: 0 0 14px; color: var(--text-2); font-size: 14px; line-height: 1.9; }
.imp-hint { margin-top: 8px; font-size: 12.5px; line-height: 1.8; color: var(--text-3); }
.imp-foot-note { font-size: 12.5px; line-height: 1.8; color: var(--text-3); }
.imp-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--wait-soft);
  border: 1px solid rgba(235, 187, 98, 0.26);
  font-size: 13px;
  line-height: 1.8;
}
.imp-note i { flex: none; margin-top: 2px; font-size: 18px; color: var(--wait); }
.imp-note b { color: var(--wait); font-weight: 600; }

/* اختيار المنصة */
.imp-platforms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.imp-platform {
  --ch: var(--glint);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  padding: 14px;
  text-align: right;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.12s;
  animation: fadeUp 0.4s var(--ease) both;
}
.imp-platform:nth-child(2) { animation-delay: 0.04s; }
.imp-platform:nth-child(3) { animation-delay: 0.08s; }
.imp-platform:nth-child(4) { animation-delay: 0.12s; }
.imp-platform > * { pointer-events: none; }
.imp-platform i { margin-bottom: 6px; font-size: 26px; color: var(--ch); transition: transform 0.3s var(--ease); }
.imp-platform b { font-size: 14px; font-weight: 600; }
.imp-platform span { font-size: 12px; color: var(--text-3); line-height: 1.6; }
.imp-platform:active { transform: scale(0.98); }
.imp-platform:focus-visible { outline: 2px solid var(--glint); outline-offset: 2px; }
@media (hover: hover) {
  .imp-platform:not(.is-soon):hover { border-color: var(--ch); }
  .imp-platform:not(.is-soon):hover i { transform: scale(1.12); }
}
/* دائرة الاختيار (بنفس أسلوب خانات الاختيار المخصّصة بالنظام) */
.imp-platform::after {
  content: "";
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  transition: background 0.2s, border-color 0.2s;
}
.imp-platform::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 16.5px;
  inset-inline-end: 17px;
  width: 8px;
  height: 4.5px;
  border-left: 2px solid #0c0e12; /* حدود فيزيائية (وليست inline) حتى تبقى علامة ✓ سليمة في RTL */
  border-bottom: 2px solid #0c0e12;
  transform: rotate(-45deg) scale(0);
  transition: transform 0.22s var(--ease);
}
.imp-platform[aria-checked="true"] {
  border-color: var(--ch);
  background: var(--glint-soft);
  background: color-mix(in srgb, var(--ch) 10%, var(--surface-2));
  box-shadow: 0 0 0 3px rgba(147, 167, 242, 0.14);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ch) 20%, transparent);
}
.imp-platform[aria-checked="true"]::after { background: var(--ch); border-color: transparent; }
.imp-platform[aria-checked="true"]::before { transform: rotate(-45deg) scale(1); }
.imp-platform.is-soon { cursor: not-allowed; opacity: 0.6; }
.imp-platform.is-soon::after, .imp-platform.is-soon::before { display: none; }
.imp-platform.is-soon i { color: var(--text-3); }
.imp-platform.is-soon span { color: var(--wait); }

.imp-handle { margin-bottom: 14px; animation: fadeUp 0.3s var(--ease); }
.imp-handle .imp-hint { margin-top: 8px; }

.imp-flow { list-style: none; margin: 0 0 12px; padding: 12px 14px; display: grid; gap: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.imp-flow li { display: flex; align-items: center; gap: 10px; font-size: 13px; line-height: 1.7; color: var(--text-2); }
.imp-flow li i { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--glint-soft); color: var(--glint); font-size: 16px; }

/* تقدّم الجلب */
.imp-run-head, .imp-result-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.imp-run-head b, .imp-result-head b { display: block; margin-bottom: 2px; font-size: 16px; font-weight: 600; }
.imp-run-head > div > span, .imp-result-head > div > span { font-size: 13px; line-height: 1.7; color: var(--text-2); }
.imp-run-ic, .imp-result-ic {
  flex: none;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--glint-soft);
  border: 1px solid rgba(147, 167, 242, 0.3);
  color: var(--glint);
  font-size: 24px;
}
.imp-run-ic i { animation: rkSpin 1.1s linear infinite; }
.imp-result-ic.ok { background: var(--ok-soft); border-color: rgba(103, 211, 164, 0.3); color: var(--ok); }
.imp-result-ic.wait { background: var(--wait-soft); border-color: rgba(235, 187, 98, 0.3); color: var(--wait); }
.imp-result-ic.bad { background: var(--bad-soft); border-color: rgba(255, 127, 118, 0.3); color: var(--bad); }

.imp-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.imp-steps li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  opacity: 0.55;
  transition: opacity 0.3s, border-color 0.3s, background 0.3s;
}
.imp-steps li > i { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); color: var(--text-3); font-size: 18px; transition: background 0.3s, color 0.3s; }
.imp-steps li b { display: block; font-size: 13.5px; font-weight: 600; }
.imp-steps li div span { font-size: 12px; line-height: 1.6; color: var(--text-3); }
.imp-steps li em { font-style: normal; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.imp-steps li.is-active { opacity: 1; border-color: rgba(147, 167, 242, 0.45); background: var(--glint-soft); }
.imp-steps li.is-active > i { background: var(--glint-soft); color: var(--glint); animation: impPulse 1.6s ease-in-out infinite; }
.imp-steps li.is-done { opacity: 1; }
.imp-steps li.is-done > i { background: var(--ok-soft); color: var(--ok); }
.imp-progress { margin: 16px 0 12px; position: relative; }
.imp-progress.is-indeterminate > div { width: 38% !important; transition: none; animation: impSlide 1.5s ease-in-out infinite; }
.imp-live { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.imp-chip { display: inline-flex; align-items: center; gap: 7px; padding: 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; }
.imp-chip b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.imp-chip.ok { color: var(--ok); border-color: rgba(103, 211, 164, 0.3); background: var(--ok-soft); }
.imp-chip.ok b { color: inherit; }

.imp-stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 108px), 1fr)); margin-bottom: 14px; }
.imp-dev { padding-block: 26px 14px; }

/* بطاقة المنتج: مصدر الاستيراد + إبراز المنتجات الجديدة + الكمية غير المحددة */
.store-card.is-new { border-color: rgba(147, 167, 242, 0.5); }
.store-card.is-new.pulse { animation: impNew 2.2s ease-out 2; }
.imp-spin { animation: rkSpin 1s linear infinite; }
.src-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--glint-soft); border: 1px solid rgba(147, 167, 242, 0.26); color: var(--glint); font-size: 11.5px; font-weight: 500; line-height: 1.6; white-space: nowrap; }
.src-chip i { font-size: 13px; }
.src-chip.new { background: var(--ok-soft); border-color: rgba(103, 211, 164, 0.3); color: var(--ok); }
.badge.neutral { background: rgba(169, 176, 192, 0.12); color: var(--text-2); border-color: var(--line-2); }
.prod-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

@media (max-width: 640px) {
  .imp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-actions { width: 100%; }
  .topbar-actions .btn { flex: 1 1 0; min-width: max-content; }
}
@media (max-width: 400px) {
  .imp-platforms { gap: 8px; }
  .imp-platform { padding: 12px; }
}

/* ---------------------------------------------------------
   إعلانات الصور (البنرات): سلايد فوق طلبات الزبائن + إدارتها بلوحة الأدمن
   النسبة الثابتة 156:50 (= 3.12:1) هي نسبة الصورة المرجعية. الصور تُقصّ بها قبل الرفع، وobject-fit: cover
   يضمن ألا تتشوّه على أي شاشة؛ يتغير الحجم فقط مع عرض الشاشة والنسبة ثابتة.
   --------------------------------------------------------- */
#store-ad-slot { margin-bottom: 22px; }

.ad-slider { position: relative; max-width: 1060px; margin-inline: auto; }
.ad-viewport {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0);            /* يجبر Safari على احترام تدوير الزوايا مع الشرائح المتحركة */
  aspect-ratio: 156 / 50;
  border-radius: var(--radius-m);
  border: 1px solid var(--line);
  background: var(--surface-2);
  box-shadow: 0 22px 44px -30px rgba(0, 0, 0, 0.85);
  touch-action: pan-y;                 /* التمرير العمودي للصفحة يبقى طبيعيًا، والأفقي لسحب الإعلانات */
  user-select: none;
  -webkit-user-select: none;
}
@media (hover: hover) and (pointer: fine) { .ad-viewport.can-drag { cursor: grab; } .ad-slider.is-dragging .ad-viewport { cursor: grabbing; } }

.ad-slide {
  position: absolute;
  inset: 0;
  display: block;
  color: inherit;
  text-decoration: none;
  transition: transform 0.55s var(--ease);
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}
.ad-slider.is-dragging .ad-slide { transition: none; }
.ad-slide { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }
.ad-slide:focus-visible { outline: 2px solid var(--glint); outline-offset: -4px; }
.ad-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;                /* النقر يصل للرابط، ولا يبدأ سحب الصورة الأصلي للمتصفح */
  -webkit-user-drag: none;
}
.ad-img.is-loaded { opacity: 1; }

.ad-nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  z-index: 2;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 12, 18, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 19px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
}
.ad-nav i { pointer-events: none; }
.ad-nav.ad-prev { inset-inline-start: 10px; }
.ad-nav.ad-next { inset-inline-end: 10px; }
.ad-slider:hover .ad-nav, .ad-slider:focus-within .ad-nav { opacity: 1; }
.ad-nav:hover { background: rgba(10, 12, 18, 0.8); }
.ad-nav:focus-visible { outline: 2px solid var(--glint); outline-offset: 2px; }
@media (hover: none) { .ad-nav { display: none; } }   /* على اللمس: السحب بالإصبع + النقاط */

.ad-dots {
  position: absolute;
  z-index: 2;
  bottom: 9px;
  left: 50%;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.ad-dot {
  width: 20px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.ad-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  transition: width 0.3s var(--ease), background 0.3s ease;
}
.ad-dot[aria-current="true"]::before { width: 18px; background: #fff; }
.ad-dot:focus-visible { outline: 2px solid var(--glint); outline-offset: -2px; border-radius: 6px; }

@media (max-width: 640px) {
  #store-ad-slot { margin-bottom: 16px; }
  .ad-viewport { border-radius: 12px; }
  .ad-dots { bottom: 5px; }
  .ad-dot { width: 17px; height: 18px; }
  .ad-dot[aria-current="true"]::before { width: 14px; }
}

/* ----- لوحة الأدمن: إدارة إعلانات الصور ----- */
.ad-count-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  font: 600 13px var(--font-body);
  font-variant-numeric: tabular-nums;
  direction: ltr;
}
.ad-count-chip.is-full { color: var(--wait); border-color: rgba(235, 187, 98, 0.3); background: var(--wait-soft); }

.ad-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--wait-soft);
  border: 1px solid rgba(235, 187, 98, 0.3);
  font-size: 13.5px;
  line-height: 1.8;
}
.ad-notice > i { flex: none; margin-top: 3px; font-size: 20px; color: var(--wait); }
.ad-notice > div { min-width: 0; }
.ad-notice.hidden { display: none; }

.ad-drop { display: block; cursor: pointer; }
.ad-preview {
  position: relative;
  display: grid;
  place-items: center;
  max-width: 760px;
  min-height: 132px;
  overflow: hidden;
  border-radius: var(--radius-m);
  border: 1.5px dashed var(--line-2);
  background: var(--surface-2);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.ad-preview.has-img { min-height: 0; aspect-ratio: 156 / 50; border-style: solid; }   /* معاينة بنفس نسبة العرض الحقيقية تمامًا */
.ad-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ad-preview img[hidden] { display: none; }
@media (hover: hover) { .ad-drop:hover .ad-preview { border-color: var(--glint-2); background: var(--glint-soft); } }
.ad-drop.is-over .ad-preview { border-color: var(--glint-2); background: var(--glint-soft); }
.ad-drop:focus-within .ad-preview { border-color: var(--glint-2); }

.ad-preview-empty { display: grid; justify-items: center; gap: 6px; padding: 18px; text-align: center; color: var(--text-2); }
.ad-preview-empty i { font-size: 30px; color: var(--glint-2); }
.ad-preview-empty b { font-size: 14px; font-weight: 600; color: var(--text); }
.ad-preview-empty span { font-size: 12.5px; }
.ad-preview.has-img .ad-preview-empty { display: none; }

.ad-crop-info { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 760px; margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.ad-crop-info.hidden { display: none; }
.ad-fields { margin-top: 16px; max-width: 760px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.ad-fields .hidden { display: none !important; }
.field input[type="datetime-local"] { direction: ltr; text-align: right; }
.field input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(0.8); cursor: pointer; }

.ad-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.ad-row:first-child { padding-top: 0; border-top: 0; }
.ad-row:last-child { padding-bottom: 0; }
.ad-thumb { flex: none; width: min(36%, 232px); aspect-ratio: 156 / 50; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.ad-info { flex: 1; min-width: 0; display: grid; gap: 7px; }
.ad-url { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: right; font-size: 13px; color: var(--glint); text-decoration: none; }
.ad-url.none { direction: rtl; color: var(--text-3); }
a.ad-url:hover { text-decoration: underline; }
.ad-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--text-2); }
.ad-meta i { margin-inline-end: 4px; vertical-align: -2px; }
@media (max-width: 560px) {
  .ad-row { flex-wrap: wrap; gap: 12px; }
  .ad-thumb { width: 100%; }
  .ad-preview-empty span { display: none; }
  .ad-preview-empty b { font-size: 13px; }
}
