/* أصالة المنتجات الأصلية: الهوية المشتركة للوحات وصفحة التحقق */
:root {
  --ground: #F6F5F1;
  --surface: #FFFFFF;
  --ink: #15211C;
  --muted: #5B6660;
  --line: #E3E1DA;
  --line-soft: #EEECE6;
  --field: #FBFAF7;
  --field-line: #CFCBBF;
  --green: #0E6B4E;
  --green-ink: #0A5A41;
  --green-tint: #E6F2ED;
  --forest: #0F2A21;
  --forest-2: #1C4436;
  --forest-ink: #D5E2DC;
  --forest-muted: #B9CBC3;
  --gold: #D9B45A;
  --gold-ink: #2A1E00;
  --amber-tint: #FFF4E0;
  --amber-line: #F0D29A;
  --amber-ink: #6B4100;
  --red: #B42318;
  --red-tint: #FDECEA;
  --red-line: #F3B8B1;
  --red-ink: #8C1A12;
  --radius: 14px;
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  color: var(--ink);
  background: var(--ground);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); line-height: 1.5; }
a { color: var(--green); }
a:hover { color: #0A4F3A; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 28px; }
h2 { font-size: 18px; }
[hidden] { display: none !important; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* أزرار وحقول */
.btn { min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--field-line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: #0A5A41; color: #fff; }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn-amber { background: #8A5300; border-color: #8A5300; color: #fff; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
.field input, .field select, .field textarea { min-height: 44px; padding: 0 12px; border: 1px solid var(--field-line); border-radius: 10px; font: inherit; font-weight: 400; background: var(--field); color: var(--ink); }
.field textarea { padding: 10px 12px; min-height: 80px; }
.field input:focus, .field select:focus, .field textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid #8FC7B2; outline-offset: 1px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--green); flex: none; }

/* بطاقات وجداول */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 24px; }
.row > * { flex: 1 1 320px; }
.row > .wide { flex: 2 1 480px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi .label { font-size: 14px; color: var(--muted); }
.kpi .value { font-size: 30px; font-weight: 700; letter-spacing: -.5px; }
.kpi .note { font-size: 13px; color: var(--muted); }
.good { color: var(--green-ink) !important; }
.bad { color: var(--red) !important; }
.table-wrap { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: right; }
th { padding: 10px 12px; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: var(--line-soft); color: #4A544F; }
.pill.ok { background: var(--green-tint); color: var(--green-ink); }
.pill.warn { background: var(--amber-tint); color: var(--amber-ink); }
.pill.err { background: var(--red-tint); color: var(--red-ink); }
.empty { color: var(--muted); font-size: 14px; padding: 12px 0; }

/* تنبيهات */
.alert { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; border-radius: var(--radius); padding: 16px 20px; border: 1px solid; }
.alert > div { flex: 1 1 280px; }
.alert.warn { background: var(--amber-tint); border-color: var(--amber-line); color: var(--amber-ink); }
.alert.err { background: var(--red-tint); border-color: var(--red-line); color: var(--red-ink); }
.alert.info { background: var(--green-tint); border-color: #BFDCCF; color: var(--green-ink); }
.toast { position: fixed; inset-inline: 16px; bottom: 16px; max-width: 480px; margin-inline: auto; background: var(--forest); color: #fff; padding: 14px 18px; border-radius: 12px; font-weight: 500; z-index: 50; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.toast.err { background: var(--red-ink); }

/* رسوم بسيطة */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 200px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.bars .bar { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; min-width: 0; }
.bars .bar span { font-size: 11px; color: var(--muted); }
.bars .bar i { display: block; width: 100%; max-width: 36px; background: #A9CFC1; border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bars .bar.today i { background: var(--green); }
.hbar { display: flex; flex-direction: column; gap: 6px; }
.hbar .top { display: flex; justify-content: space-between; font-size: 14px; }
.hbar .track { height: 8px; border-radius: 999px; background: var(--line-soft); }
.hbar .fill { height: 100%; background: var(--green); border-radius: 999px; }

/* هيكل اللوحة */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; align-items: stretch; }
.side { flex: 1 1 240px; max-width: 260px; min-width: 220px; background: var(--forest); color: #fff; padding: 28px 20px; display: flex; flex-direction: column; gap: 28px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand b { font-size: 22px; display: block; }
.brand small { font-size: 12px; color: var(--forest-muted); }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav button { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 0; background: transparent; color: var(--forest-ink); font: inherit; font-size: 15px; text-align: start; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.side nav button[aria-current="page"] { background: var(--forest-2); color: #fff; font-weight: 600; }
.side nav button .badge { font-size: 12px; color: #F3C969; }
.side .foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--forest-muted); }
.side .foot button { background: none; border: 1px solid var(--forest-2); color: var(--forest-ink); min-height: 40px; border-radius: 10px; font: inherit; cursor: pointer; }
.main { flex: 999 1 560px; min-width: 0; padding: 32px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* البطاقة الداكنة للمخزون */
.hero { background: var(--forest); color: #fff; border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.hero .big { font-size: 44px; font-weight: 700; letter-spacing: -1px; }
.hero .big small { font-size: 18px; font-weight: 500; color: var(--forest-muted); }
.hero .meter { height: 12px; border-radius: 999px; background: var(--forest-2); overflow: hidden; }
.hero .meter i { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.hero .muted { color: var(--forest-ink); }

/* مفتاح التشغيل */
.switch { width: 56px; height: 32px; border-radius: 999px; border: 0; padding: 3px; background: #B5B1A6; cursor: pointer; display: flex; justify-content: flex-end; flex: none; }
.switch[aria-checked="true"] { background: var(--green); justify-content: flex-start; }
.switch span { width: 26px; height: 26px; border-radius: 999px; background: #fff; display: block; }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px)); color: var(--ink); }
dialog::backdrop { background: rgba(15, 42, 33, .45); }
dialog form { padding: 24px; display: flex; flex-direction: column; gap: 14px; }

@media (max-width: 720px) {
  .side { max-width: none; flex-basis: 100%; padding: 16px; gap: 12px; }
  .side nav { flex-direction: row; overflow-x: auto; }
  .side nav button { white-space: nowrap; }
  .side .foot { flex-direction: row; align-items: center; margin-top: 0; }
  .main { padding: 16px; }
  .hero .big { font-size: 34px; }
}
.btn-sm { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); background: var(--ground); flex: none; }
.thumb-empty { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; }
.tips { display: flex; flex-direction: column; gap: 10px; }
.tip { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.6; border: 1px solid var(--line); background: var(--ground); }
.tip::before { content: "💡"; }
.tip.warn { background: var(--amber-tint); border-color: var(--amber-line); color: var(--amber-ink); } .tip.warn::before { content: "⚠️"; }
.tip.err { background: var(--red-tint); border-color: var(--red-line); color: var(--red-ink); } .tip.err::before { content: "🚨"; }
.tip.good { background: var(--green-tint); border-color: #BFDCCF; color: var(--green-ink); } .tip.good::before { content: "✅"; }
.tip.info { background: #FFFBEF; border-color: #EBD9A6; color: #5A4300; }
.chat-card { min-height: 420px; }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; padding: 4px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 15px; line-height: 1.7; white-space: pre-wrap; }
.msg.me { align-self: flex-start; background: var(--forest); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-end; background: var(--ground); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.typing { color: var(--muted); }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-suggest button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--green-ink); }
.chat-suggest button:hover { border-color: var(--green); }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; min-width: 0; min-height: 46px; padding: 0 14px; border: 1px solid var(--field-line); border-radius: 12px; font: inherit; background: var(--field); }
.flag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--red-tint); color: var(--red-ink); margin: 2px; }
.winners { display: flex; flex-direction: column; gap: 8px; }
.winner { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: #FFF8E6; border: 1px solid #F0D99A; }
.winner b.rank { width: 30px; height: 30px; border-radius: 50%; background: var(--gold); color: var(--gold-ink); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.risk { height: 8px; border-radius: 4px; background: var(--line-soft); overflow: hidden; min-width: 80px; }
.risk i { display: block; height: 100%; background: linear-gradient(90deg, #F0B429, var(--red)); }

/* النقاط والكاش باك */
.mode-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mode-pick label { cursor: pointer; }
.mode-pick input { position: absolute; opacity: 0; }
.mode-pick span { display: flex; flex-direction: column; gap: 4px; border: 2px solid var(--line); border-radius: 14px; padding: 14px; height: 100%; }
.mode-pick small { color: var(--muted); }
.mode-pick input:checked + span { border-color: var(--gold); background: #FFFBEF; }
.mode-pick input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
.stars-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.stars-row .bar { flex: 1; height: 8px; background: var(--ground); border-radius: 8px; overflow: hidden; }
.stars-row .bar i { display: block; height: 100%; background: var(--gold); }
.comment { border-top: 1px solid var(--line-soft); padding: 10px 0; display: flex; flex-direction: column; gap: 4px; }
.gold-stars { color: var(--gold); letter-spacing: 2px; }
@media (max-width: 560px) { .mode-pick { grid-template-columns: minmax(0, 1fr); } }

/* اللوحة الأم: قسم المتاجر */
.dlg-body { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.dlg-body input { min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; font: inherit; }
.ad-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line-soft); margin: -4px 0 14px; overflow-x: auto; }
.ad-tabs button { border: 0; background: none; font: inherit; font-weight: 600; padding: 10px 14px; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.ad-tabs button[aria-selected="true"] { color: var(--green); border-bottom-color: var(--green); }
.ad-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.ad-filter input[type=search], .ad-filter select { min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; font: inherit; background: var(--surface, #fff); }
.ad-filter input[type=search] { flex: 1 1 220px; min-width: 0; }
.ad-filter .check { align-items: center; }
.ad-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.ad-item { border: 1px solid var(--line-soft); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; background: var(--surface, #fff); }
.ad-item.off { border-color: #e4a3a3; background: #fff7f7; }
.ad-item .media { aspect-ratio: 1; background: var(--ground); display: flex; align-items: center; justify-content: center; font-size: 34px; position: relative; }
.ad-item.reel .media { aspect-ratio: 9 / 12; }
.ad-item .media img, .ad-item .media video { width: 100%; height: 100%; object-fit: cover; }
.ad-item .media .pill { position: absolute; top: 8px; inset-inline-start: 8px; }
.ad-item .info { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.ad-item .info b { line-height: 1.35; }
.ad-item .actions { margin-top: auto; }
.ad-cm { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.ad-cm > div { flex: 1; min-width: 0; }
.ad-cm p { margin: 4px 0 0; word-break: break-word; }
.ad-cm .reply { margin-top: 6px; padding: 6px 10px; border-radius: 10px; background: var(--ground); font-size: 13px; }
.is-staff .owner-only { display: none !important; }
/* إشعارات اللوحة الأم */
.ad-push { align-items: start; }
.ad-push .stack { display: flex; flex-direction: column; gap: 14px; }
.ad-phone { background: linear-gradient(160deg, #1d2b25, #0b1511); border-radius: 28px; padding: 28px 16px 40px; min-height: 220px; }
.ad-notif { background: rgba(255,255,255,.94); color: #15211C; border-radius: 18px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 4px; }
.ad-notif-h { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #5B6660; }
.ad-notif-h img { border-radius: 5px; }
.ad-notif p { margin: 0; font-size: 14px; color: #33403A; }
.ad-notif-img { margin-top: 8px; border-radius: 12px; max-height: 160px; width: 100%; object-fit: cover; }
.ad-prog { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.ad-prog i { display: block; height: 100%; background: var(--green); transition: width .3s; }
