/* صفقات — ألوان الهوية: كحلي #1D2766، أصفر #FFCB1F، كحلي داكن #131A4A، أبيض.
   الكحلي هو اللون الأساسي. الأصفر للتمييز فقط. */

:root {
  --star: #D69E00;
  --navy: #1D2766;
  --yellow: #FFCB1F;
  --deep: #131A4A;

  --bg: #F5F6FA;
  --surface: #FFFFFF;
  --field: #FFFFFF;
  --ink: #171F55;
  --muted: #5C6387;
  --line: #E1E4EF;
  --line-strong: #BCC1DA;
  --action: #1D2766;
  --action-ink: #FFFFFF;
  --focus: #1D2766;
  --danger: #B42318;
  --good: #116B45;
  --bar-cost: #1D2766;
  --tint: #ECEEF7;

  --r-sm: 10px;
  --r-md: 12px;
  --r-lg: 18px;

  --side-w: 256px;
  --bar-h: 60px;
  --tabs-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1033; --surface: #131A4A; --field: #0B1033; --ink: #FFFFFF; --muted: #A6ADD3;
    --line: #262F6E; --line-strong: #434D94; --action: #FFFFFF; --action-ink: #1D2766;
    --focus: #FFCB1F; --danger: #FF9D93; --good: #7EE0B0; --bar-cost: #8C9AE8; --tint: #1D2766; --star: #FFCB1F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1033; --surface: #131A4A; --field: #0B1033; --ink: #FFFFFF; --muted: #A6ADD3;
  --line: #262F6E; --line-strong: #434D94; --action: #FFFFFF; --action-ink: #1D2766;
  --focus: #FFCB1F; --danger: #FF9D93; --good: #7EE0B0; --bar-cost: #8C9AE8; --tint: #1D2766; --star: #FFCB1F;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Tajawal", Tahoma, "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p, dl, dd, ul, ol, fieldset, legend { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
ul, ol { list-style: none; }
a { color: inherit; }
img { display: block; max-width: 100%; }

.sprite { position: absolute; }
.ic { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; direction: ltr; unicode-bidi: isolate; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- الهيكل ---------- */

.chrome {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 14px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { grid-column: 2; grid-row: 1; display: block; }
.brand img { height: 30px; width: auto; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
:root[data-theme="dark"] .logo-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-dark { display: block; }
  :root:not([data-theme="light"]) .logo-light { display: none; }
}
.prefs { display: contents; }
.pref {
  grid-row: 1; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: transparent;
  font-size: .85rem; font-weight: 700; line-height: 1; color: var(--ink);
}
#lang-btn { grid-column: 1; justify-self: start; }
#theme-btn { grid-column: 3; justify-self: end; }
.pref-icon { width: 38px; padding: 0; display: grid; place-items: center; }
.ic-sun { display: none; }
:root[data-theme="dark"] .ic-sun { display: block; }
:root[data-theme="dark"] .ic-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ic-sun { display: block; }
  :root:not([data-theme="light"]) .ic-moon { display: none; }
}

.nav {
  position: fixed; z-index: 10; inset-inline: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px;
  height: var(--tabs-h); padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: 0 6px 24px rgba(19, 26, 74, .12);
}
.nav a {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border-radius: 16px;
  text-decoration: none; color: var(--muted); font-size: .78rem; font-weight: 500; line-height: 1.4;
}
.nav a .ic { width: 22px; height: 22px; }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 800; background: var(--tint); }
body[data-side="shop"] .nav a[data-side="admin"], body[data-side="admin"] .nav a[data-side="shop"] { display: none; }
.nav a.desk-only { display: none; }
.count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  display: inline-grid; place-items: center;
  background: var(--yellow); color: #1D2766; font-size: .75rem; font-weight: 800; line-height: 1;
}
.nav .count { position: absolute; top: 4px; inset-inline-end: 18%; }

.main { padding: 18px 16px calc(var(--tabs-h) + 40px + env(safe-area-inset-bottom, 0px)); }
.view { max-width: 600px; margin-inline: auto; }
.view.wide { max-width: 1000px; }

h1 { font-size: 1.7rem; font-weight: 800; line-height: 1.35; margin-bottom: 18px; }

.foot { max-width: 1000px; margin: 40px auto 0; padding-top: 16px; border-top: 1px solid var(--line); }
.foot a { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; font-weight: 500; text-decoration: none; }
.foot a:hover { color: var(--ink); }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
  .chrome {
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; align-items: stretch;
    padding: 28px 16px 18px;
    border-bottom: 0; border-inline-end: 1px solid var(--line);
  }
  .brand { padding-inline: 10px; margin-bottom: 30px; }
  .brand img { height: 38px; }
  .nav {
    position: static; display: flex; flex-direction: column; gap: 4px;
    height: auto; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
  }
  .nav a {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    height: 46px; padding-inline: 14px; border-radius: var(--r-md); font-size: 1rem;
  }
  .nav a:hover { color: var(--ink); }
  .nav a.desk-only { display: flex; }
  .nav a.mob-only { display: none; }
  body[data-side="shop"] .nav a[data-side="admin"], body[data-side="admin"] .nav a[data-side="shop"] { display: none; }
  .nav .count { position: static; margin-inline-start: auto; }
  .prefs { display: flex; gap: 8px; margin-top: auto; padding-inline: 4px; }
  #lang-btn { flex: 1; }
  .main { padding: 44px 48px 40px; }
  .view, .foot { margin-inline: 0; }
  h1 { font-size: 2rem; margin-bottom: 26px; }
}

/* ---------- الأزرار والحقول ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 24px;
  border: 1.5px solid transparent; border-radius: var(--r-md);
  font-weight: 700; line-height: 1.2; text-decoration: none;
}
.btn-primary { background: var(--action); color: var(--action-ink); }
.btn-quiet { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn:disabled { opacity: .55; cursor: default; }

.link {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 10px; padding: 6px 0; border: 0; background: none;
  font-weight: 700; font-size: .92rem; color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 5px;
}

.field { display: grid; gap: 6px; min-width: 0; }
.field + .field, .field + .pair, .pair + .btn, .field + .btn, .field + .choices, .pair + .more-f, .more-f + .switch, .switch + .btn, .field + .wide-btn { margin-top: 16px; }
.field-l { display: flex; align-items: center; gap: 4px; min-height: 28px; }
.field label { font-size: .95rem; font-weight: 700; line-height: 1.5; }
.opt { margin-inline-start: 6px; font-size: .82rem; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; height: 50px; padding: 0 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-md); background: var(--field);
  text-align: start;
}
.field input[dir="ltr"] { text-align: end; }
html[dir="ltr"] .field input[dir="ltr"] { text-align: start; }
.field input::placeholder { color: var(--muted); opacity: .7; }
.field textarea { height: auto; padding: 10px 14px; line-height: 1.7; resize: vertical; }
.field select { appearance: none; -webkit-appearance: none; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.amount { position: relative; }
html[dir="rtl"] .amount input { padding-left: 56px; padding-right: 14px; }
html[dir="ltr"] .amount input { padding-left: 14px; padding-right: 56px; }
.unit {
  position: absolute; inset-block: 0; display: flex; align-items: center;
  font-size: .85rem; color: var(--muted); pointer-events: none;
}
html[dir="rtl"] .unit { left: 14px; }
html[dir="ltr"] .unit { right: 14px; }

.info {
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--muted);
}
.info .ic { width: 18px; height: 18px; }
.info[aria-expanded="true"] { color: var(--ink); }
.tip {
  padding: 8px 12px; border-inline-start: 3px solid var(--yellow); border-radius: 4px;
  background: var(--tint); font-size: .88rem; line-height: 1.7; color: var(--ink);
}
.msg { font-size: .84rem; line-height: 1.6; color: var(--danger); }
.msg:empty { display: none; }
.field.is-bad input, .field.is-bad textarea { border-color: var(--danger); }
.field.is-bad input:focus { outline-color: var(--danger); }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.pair .field + .field { margin-top: 0; }

.choices legend { font-size: .95rem; font-weight: 700; line-height: 1.5; margin-bottom: 8px; }
.choice {
  display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-md); cursor: pointer;
}
.choice + .choice { margin-top: 8px; }
.choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--action); flex: none; }
.choice b { margin-inline-start: auto; font-weight: 700; white-space: nowrap; }
.choice:has(input:checked) { border-color: var(--action); background: var(--tint); }

/* ---------- صفحة الإضافة ---------- */

.step { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 14px; padding-bottom: 26px; }
.step:last-child { padding-bottom: 0; }
.step::before {
  content: ""; position: absolute; top: 36px; bottom: 6px; width: 1px; background: var(--line);
  inset-inline-start: 14.5px;
}
.step:last-child::before { display: none; }
.step-n {
  display: grid; place-items: center; width: 30px; height: 30px;
  border: 1.5px solid var(--line-strong); border-radius: 50%;
  font-size: .9rem; line-height: 1; color: var(--muted);
}
.step-n b { font-weight: 700; }
.step-n .ic { display: none; width: 16px; height: 16px; stroke-width: 2.4; }
.step-t { display: flex; align-items: center; gap: 4px; font-size: 1.05rem; font-weight: 700; line-height: 30px; color: var(--muted); }
.step:not(.is-on):not(.is-done) .step-t .info { display: none; }
.step-b { grid-column: 2; margin-top: 12px; }
.step.is-on .step-n { background: var(--action); border-color: var(--action); color: var(--action-ink); }
.step.is-on .step-t, .step.is-done .step-t { color: var(--ink); }
.step.is-done .step-n { border-color: var(--ink); color: var(--ink); }
.step.is-done .step-n b { display: none; }
.step.is-done .step-n .ic { display: block; }
.step-b .btn { width: 100%; }

.shot {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  width: 100%; aspect-ratio: 4 / 3; padding: 0; overflow: hidden;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface);
  font-weight: 700; color: var(--ink);
}
.shot .ic { width: 34px; height: 34px; stroke-width: 1.4; color: var(--muted); }
.shot.has-photo { border-style: solid; border-color: var(--line); cursor: default; }
.shot img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- الإجماليات ---------- */

.ledger { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.totals { display: grid; grid-template-columns: 1fr 1fr; }
.total { padding: 16px 18px 14px; min-width: 0; }
.total:first-child {
  grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding-block: 12px; border-bottom: 1px solid var(--line);
}
.total:nth-child(3) { border-inline-start: 1px solid var(--line); }
.total dt { display: flex; align-items: center; gap: 2px; min-height: 28px; font-size: .86rem; font-weight: 500; line-height: 1.5; color: var(--muted); }
.total dd { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.total:first-child dd { margin-top: 0; }
.total .num { font-size: 1.5rem; font-weight: 800; line-height: 1.3; }
.total:first-child .num { font-size: 1.25rem; }
.cur { font-size: .8rem; font-weight: 500; color: var(--muted); }
.ledger-tip { padding: 0 18px; }
.ledger-tip .tip { margin-bottom: 16px; }

.split { padding: 14px 18px 16px; border-top: 1px solid var(--line); }
.split-bar { height: 10px; border-radius: 5px; background: var(--yellow); overflow: hidden; }
.split-bar i { display: block; height: 100%; background: var(--bar-cost); }
html[dir="rtl"] .split-bar i { border-left: 2px solid var(--surface); }
html[dir="ltr"] .split-bar i { border-right: 2px solid var(--surface); }
.split-key { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 10px; font-size: .86rem; line-height: 1.6; color: var(--muted); }
.split-key > span { display: inline-flex; align-items: baseline; gap: 6px; }
.split-key b { color: var(--ink); font-weight: 700; }
.sw { width: 10px; height: 10px; border-radius: 3px; align-self: center; flex: none; }
.sw-cost { background: var(--bar-cost); }
.sw-margin { background: var(--yellow); }

/* ---------- القوائم ---------- */

.list-head { display: flex; align-items: baseline; justify-content: space-between; margin: 30px 2px 10px; }
.list-head h2 { font-size: 1.15rem; font-weight: 800; }
.list-head span { font-size: .88rem; color: var(--muted); }

.cols { display: none; }
.items { border-top: 1px solid var(--line); }
.item {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; column-gap: 14px; row-gap: 12px; align-items: center;
  padding: 14px 2px; border-bottom: 1px solid var(--line);
}
.thumb { width: 64px; height: 64px; border-radius: var(--r-md); object-fit: cover; background: var(--tint); }
a.thumb-link { display: block; border-radius: var(--r-md); }
.i-name { min-width: 0; }
.i-name strong, .i-name a { display: block; font-size: 1.02rem; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; text-decoration: none; }
.i-name a:hover { text-decoration: underline; text-underline-offset: 4px; }
.i-name span { display: block; font-size: .82rem; color: var(--muted); line-height: 1.5; }
.i-acts { display: flex; align-items: center; gap: 8px; }
.i-nums { grid-column: 1 / -1; display: grid; grid-template-columns: 64px 1fr 1fr; column-gap: 14px; }
.i-cell { min-width: 0; }
.i-cell small { display: block; font-size: .76rem; line-height: 1.5; color: var(--muted); }
.i-cell .num { font-weight: 700; font-size: .98rem; }
.i-cell .cur { margin-inline-start: 4px; }
.i-cell.is-good .num { color: var(--good); }
.i-cell.is-bad .num { color: var(--danger); }
.state { font-size: .88rem; font-weight: 700; line-height: 1.5; }
.state.is-loss { color: var(--danger); }
.state.is-ok { color: var(--good); }

.act {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 13px;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); background: transparent;
  font-size: .88rem; font-weight: 700; color: var(--ink); white-space: nowrap;
}
.act .ic { width: 16px; height: 16px; stroke-width: 2.1; }
.act:hover { border-color: var(--ink); }
.act-icon { width: 40px; padding: 0; justify-content: center; }
.act-icon .ic { width: 18px; height: 18px; stroke-width: 1.8; }

/* المرتجعات: الأزرار في سطر مستقل على الجوال */
.items-ret .item { grid-template-columns: 64px minmax(0, 1fr); }
.items-ret .i-acts { grid-column: 1 / -1; order: 5; }

.empty { display: grid; justify-items: start; gap: 14px; padding: 26px 2px; border-top: 1px solid var(--line); color: var(--muted); }
.note { margin-top: 16px; font-size: .84rem; color: var(--muted); }

@media (min-width: 900px) {
  .totals { grid-template-columns: 1fr 1.3fr 1.3fr; }
  .total, .total:first-child { display: block; grid-column: auto; padding: 20px 24px 18px; border-bottom: 0; }
  .total + .total { border-inline-start: 1px solid var(--line); }
  .total:first-child dd { margin-top: 2px; }
  .total .num, .total:first-child .num { font-size: 2rem; }
  .split { padding: 16px 24px 18px; }
  .ledger-tip { padding: 0 24px; }

  .cols-inv, .items-inv .item { grid-template-columns: 56px minmax(0, 1fr) 80px 140px 140px 170px; }
  .cols-sales, .items-sales .item { grid-template-columns: 56px minmax(0, 1fr) 80px 140px 140px 120px; }
  .cols-ret, .items-ret .item { grid-template-columns: 56px minmax(0, 1fr) 80px 140px 170px 230px; }
  .cols, .item { column-gap: 20px; }
  .cols { display: grid; padding: 0 8px 8px; font-size: .82rem; color: var(--muted); }
  .item { padding: 12px 8px; row-gap: 0; }
  .thumb { width: 56px; height: 56px; }
  .i-nums { display: contents; }
  .i-cell small { display: none; }
  .i-acts, .items-ret .i-acts { order: 9; grid-column: auto; justify-content: flex-end; }
}

/* ---------- صفحة المنتج ---------- */

.back { display: inline-block; margin-bottom: 16px; font-size: .92rem; font-weight: 700; color: var(--muted); text-underline-offset: 5px; }
.prod-photo { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--r-lg); background: var(--tint); margin-bottom: 18px; }
#prod-name { margin-bottom: 6px; }
.prod-price { display: flex; align-items: baseline; gap: 8px; }
.prod-price .num { font-size: 2rem; font-weight: 800; line-height: 1.3; }
.prod-price .cur { font-size: 1rem; }
.prod-stock { margin: 4px 0 20px; font-size: .92rem; font-weight: 700; color: var(--muted); }
.prod-stock.is-in { color: var(--good); }
#prod-share { width: 100%; }

/* ---------- النوافذ والتنبيه ---------- */

dialog {
  width: min(92vw, 430px); padding: 24px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink);
}
dialog::backdrop { background: rgba(8, 12, 40, .62); }
dialog h2 { font-size: 1.35rem; font-weight: 800; line-height: 1.4; }
.dlg-sub { margin: 2px 0 18px; color: var(--muted); font-size: .95rem; overflow-wrap: anywhere; }
.dlg-sub:empty { margin-bottom: 14px; }
.actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 22px; }
.actions > :only-child { grid-column: 1 / -1; }

.toast {
  position: fixed; z-index: 30; inset-inline: 16px; bottom: calc(var(--tabs-h) + 14px + env(safe-area-inset-bottom, 0px));
  max-width: 420px; margin-inline: auto;
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-radius: var(--r-md); background: var(--ink); color: var(--bg); font-weight: 700; font-size: .95rem;
}
@media (min-width: 900px) { .toast { bottom: 28px; inset-inline: calc(var(--side-w) + 48px) auto; margin: 0; } }

@media (prefers-reduced-motion: no-preference) {
  .step-b:not([hidden]) { animation: reveal .2s ease-out; }
  @keyframes reveal { from { opacity: 0; transform: translateY(4px); } }
}

/* ================= إضافات صفحة الإضافة ================= */

.strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.strip .ph { position: relative; width: 64px; height: 64px; }
.strip .ph img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--r-sm); }
.strip .ph button {
  position: absolute; top: -6px; inset-inline-end: -6px; width: 24px; height: 24px; padding: 0;
  display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink);
}
.strip .ph button .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.strip .addph {
  width: 64px; height: 64px; display: grid; place-items: center; padding: 0;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-sm); background: transparent; color: var(--muted);
}
.more-f { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.more-f summary { padding: 12px 0; font-weight: 700; font-size: .95rem; cursor: pointer; }
.more-f[open] { padding-bottom: 16px; }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: .98rem; cursor: pointer; }
.switch input { width: 20px; height: 20px; margin: 0; accent-color: var(--action); }
.wide-btn { width: 100%; }

/* ================= واجهة المتجر ================= */

.search {
  display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 26px; color: var(--muted);
}
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search input::placeholder { color: var(--muted); }
.search:focus-within { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 1px; }

.remind {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px 16px;
  border: 1px solid var(--line); border-inline-start: 4px solid var(--yellow); border-radius: var(--r-md); background: var(--surface);
  font-weight: 700; font-size: .95rem;
}

.banners { display: flex; gap: 12px; margin-top: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: var(--r-lg); }
.banners::-webkit-scrollbar { display: none; }
.banner {
  position: relative; flex: 0 0 100%; scroll-snap-align: start; overflow: hidden;
  min-height: 170px; border-radius: var(--r-lg); background: #1D2766; color: #fff;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 22px;
}
.banner > img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner.has-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(13, 18, 53, .82), rgba(13, 18, 53, 0) 62%); }
.banner h2, .banner p { position: relative; z-index: 1; }
.banner h2 { font-size: 1.45rem; font-weight: 800; line-height: 1.4; }
.banner p { margin-top: 4px; color: #D8DCF3; font-size: .98rem; }
.banner .mark { position: absolute; top: 20px; inset-inline-end: 22px; width: 62px; height: auto; }

.chips { display: flex; gap: 8px; margin-top: 16px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 42px; padding: 0 18px; border: 1px solid var(--line); border-radius: 21px;
  background: var(--surface); color: var(--ink); font-weight: 700; font-size: .92rem; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--action); border-color: var(--action); color: var(--action-ink); }

.brandrow { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.brandrow::-webkit-scrollbar { display: none; }
.brand-c {
  flex: none; min-width: 132px; padding: 12px 16px; text-align: start;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink);
}
.brand-c strong { display: block; font-weight: 800; line-height: 1.5; }
.brand-c span { display: block; font-size: .82rem; color: var(--muted); line-height: 1.5; }
.brand-c[aria-pressed="true"] { border-color: var(--action); background: var(--tint); }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.card-media { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--tint); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-b { display: flex; flex-direction: column; gap: 2px; flex: 1; padding: 12px 12px 14px; }
.card-name { font-weight: 700; line-height: 1.5; text-decoration: none; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 3em; }
.card-meta { font-size: .82rem; color: var(--muted); line-height: 1.5; min-height: 1.5em; }
.card .price { margin-top: 6px; }
.card .btn { margin-top: 10px; min-height: 44px; padding: 0 12px; width: 100%; font-size: .95rem; }
.card-sold { margin-top: 10px; min-height: 44px; display: grid; place-items: center; font-weight: 700; font-size: .9rem; color: var(--muted); }

.price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 6px; }
.price .num { font-size: 1.2rem; font-weight: 800; line-height: 1.3; }
.price s { font-size: .85rem; font-weight: 500; color: var(--muted); }
.price-lg .num { font-size: 2rem; }
.price-lg .cur { font-size: 1rem; }
.price-lg s.num { font-size: 1.05rem; font-weight: 500; }
.save { padding: 2px 8px; border-radius: 8px; background: var(--yellow); color: #1D2766; font-size: .78rem; font-weight: 800; line-height: 1.6; white-space: nowrap; }
.card-media .save { position: absolute; top: 10px; inset-inline-start: 10px; }
.last { color: var(--danger); font-weight: 700; }

/* ختم تم البيع */
.stamp { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(13, 18, 53, .5); pointer-events: none; }
.stamp span {
  transform: rotate(-12deg); padding: 6px 18px 4px; border-radius: 10px;
  background: var(--yellow); color: #1D2766; font-size: 1.15rem; font-weight: 800; line-height: 1.5; white-space: nowrap;
  box-shadow: 0 0 0 3px #1D2766, 0 0 0 6px var(--yellow);
}
.gal-wrap .stamp span { font-size: 1.7rem; padding: 8px 26px 6px; }

/* صفحة المنتج */
.gal-wrap { position: relative; border-radius: var(--r-lg); overflow: hidden; background: var(--tint); }
.gal { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gal::-webkit-scrollbar { display: none; }
.gal img { flex: 0 0 100%; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; scroll-snap-align: start; }
.dots { position: absolute; bottom: 10px; inset-inline: 0; display: flex; justify-content: center; gap: 6px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .55); box-shadow: 0 0 0 1px rgba(13, 18, 53, .25); }
.dots i.on { background: #fff; width: 18px; border-radius: 4px; }
.prod-info { margin-top: 18px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 4px; font-size: .9rem; font-weight: 700; color: var(--muted); }
#prod-name { margin-bottom: 4px; }
.prod-desc { margin-top: 12px; white-space: pre-line; overflow-wrap: anywhere; }
.prod-acts { display: grid; gap: 10px; margin-top: 20px; }
.prod-links { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-top: 8px; }
.prod-links .link { text-decoration: none; }

.mine { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.mine + .mine { margin-top: 10px; }
.mine-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-weight: 700; }
.mine p { margin-top: 6px; font-size: .92rem; color: var(--muted); overflow-wrap: anywhere; }
.mine .i-acts { margin-top: 12px; flex-wrap: wrap; }

@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
  .banner { min-height: 220px; padding: 30px; }
  .banner h2 { font-size: 1.9rem; }
  .prod { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 36px; align-items: start; }
  .prod-info { margin-top: 0; }
  .prod-acts { grid-template-columns: 1fr 1fr; }
}

/* ================= صفوف عامة (العروض، التقييمات، الإعلانات) ================= */

.rows { border-top: 1px solid var(--line); margin-top: 6px; }
.rc { display: grid; grid-template-columns: 56px minmax(0, 1fr); column-gap: 14px; padding: 16px 2px; border-bottom: 1px solid var(--line); }
.rc .thumb { width: 56px; height: 56px; }
.rc-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rc-h strong { font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.rc-h a { text-decoration: none; }
.rc-sub { font-size: .84rem; color: var(--muted); line-height: 1.6; }
.rc-note { margin-top: 6px; font-size: .92rem; overflow-wrap: anywhere; }
.rc-nums { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 8px; }
.rc .i-acts { margin-top: 12px; flex-wrap: wrap; }
.rc .i-cell small { display: block; }
.state.is-wait { color: var(--muted); }
a.act { text-decoration: none; }
.act-solid { background: var(--action); border-color: var(--action); color: var(--action-ink); }
.act-solid:hover { border-color: var(--action); }
.act[aria-pressed="true"] { background: var(--tint); border-color: var(--ink); }
.rc.ad { grid-template-columns: minmax(0, 1fr); }
.ad-img { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; border-radius: var(--r-md); margin-bottom: 10px; }

.menu { border-top: 1px solid var(--line); }
.menu a { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 0 4px; border-bottom: 1px solid var(--line); text-decoration: none; font-weight: 700; }
.menu a .count { margin-inline-start: auto; }

/* ================= النجوم والتقييمات ================= */

.stars { display: inline-flex; gap: 2px; color: var(--line-strong); vertical-align: middle; direction: ltr; }
.stars .ic { width: 16px; height: 16px; stroke-width: 1.5; }
.stars .ic.on { color: var(--star); fill: currentColor; }
.rating { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); }
.rating-lg { margin-bottom: 10px; font-size: 1.05rem; }
.rating-lg .stars .ic { width: 20px; height: 20px; }
.rating:empty { display: none; }
.revs { display: grid; gap: 10px; }
.rev { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.rev-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; font-size: .95rem; }
.rev p { margin-top: 6px; overflow-wrap: anywhere; }
.rev small { display: block; margin-top: 4px; color: var(--muted); font-size: .8rem; }
@media (min-width: 900px) { .revs { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }

.rate-item { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.starpick { display: flex; gap: 6px; direction: ltr; justify-content: flex-end; margin-bottom: 6px; }
html[dir="ltr"] .starpick { justify-content: flex-start; }
.starpick button { width: 52px; height: 52px; padding: 0; display: grid; place-items: center; border: 0; border-radius: var(--r-md); background: transparent; color: var(--line-strong); }
.starpick button .ic { width: 36px; height: 36px; stroke-width: 1.4; }
.starpick button.on { color: var(--star); }
.starpick button.on .ic { fill: currentColor; }
#rate-form .field { margin-top: 14px; }

/* =====================================================================
   روح الهوية: شريط علوي كحلي دائماً، الأصفر للأزرار الرئيسية والعلامات،
   وبحث أبيض في الوضعين.
   ===================================================================== */

:root { --chrome: #1D2766; --cta: #FFCB1F; --cta-ink: #1D2766; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --chrome: #131A4A; --action: #FFCB1F; --action-ink: #1D2766; --surface: #171F5A; --line: #2B3580; --line-strong: #4A56A3; --tint: #232D78; --field: #0F1540; }
}
:root[data-theme="dark"] { --chrome: #131A4A; --action: #FFCB1F; --action-ink: #1D2766; --surface: #171F5A; --line: #2B3580; --line-strong: #4A56A3; --tint: #232D78; --field: #0F1540; }

/* الشريط العلوي والقائمة الجانبية */
.chrome { background: var(--chrome); border-bottom: 3px solid var(--yellow); color: #fff; }
.logo-light { display: none !important; }
.logo-dark { display: block !important; }
.pref { border-color: rgba(255, 255, 255, .28); color: #fff; }
.pref:hover { border-color: #fff; }

.nav a { color: var(--muted); }
.nav a[aria-current="page"] { background: var(--cta); color: var(--cta-ink); }
.count { box-shadow: 0 0 0 2px var(--surface); }
.nav a[aria-current="page"] .count { background: #1D2766; color: #FFCB1F; box-shadow: none; }

@media (min-width: 900px) {
  .chrome { border-bottom: 0; border-inline-end: 0; }
  .nav a { color: #C9CFF2; }
  .nav a:hover { color: #fff; }
  .nav a[aria-current="page"] { background: var(--cta); color: var(--cta-ink); }
  .nav .count { box-shadow: none; }
}

/* رجوع، والعودة إلى المتجر */
.crumbs { display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 1000px; margin: 0 auto; }
.crumbs:has(.pill:not([hidden])) { margin-bottom: 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px 0 12px;
  border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink);
  font-weight: 700; font-size: .9rem; line-height: 1; text-decoration: none;
}
html[dir="rtl"] .pill { padding: 0 12px 0 16px; }
.pill .ic { width: 18px; height: 18px; stroke-width: 2.2; }
html[dir="rtl"] #back .ic { transform: scaleX(-1); }
.pill-cta { margin-inline-start: auto; border-color: var(--cta); background: var(--cta); color: var(--cta-ink); }
@media (min-width: 900px) { .crumbs { margin-inline: 0; } #to-shop { display: none; } }

/* البحث: أبيض في الوضعين */
.search { background: #fff; border-color: #D5D9EA; color: #5C6387; box-shadow: 0 2px 10px rgba(19, 26, 74, .07); }
.search input { color: #171F55; }
.search input::placeholder { color: #7A82A6; }
.search:focus-within { border-color: var(--yellow); outline-color: var(--yellow); }

/* علامة العناوين */
.view > h1::before, .list-head h2::before {
  content: ""; display: inline-block; width: 6px; height: .85em; margin-inline-end: 10px;
  border-radius: 3px; background: var(--yellow); vertical-align: -.06em;
}
.ledger { border-top: 4px solid var(--yellow); }

/* الأزرار الرئيسية للشراء */
.btn-cta { background: var(--cta); color: var(--cta-ink); }
.chip[aria-pressed="true"] { background: var(--cta); border-color: var(--cta); color: var(--cta-ink); }
.brand-c[aria-pressed="true"] { border-color: var(--yellow); box-shadow: inset 0 0 0 1px var(--yellow); }
.hint { margin: -8px 0 16px; font-size: .9rem; color: var(--muted); }

/* البطاقات الإعلانية: نسبة ثابتة 2:1 */
.banners { margin-top: 16px; }
.banner { aspect-ratio: 2 / 1; min-height: 0; text-decoration: none; color: #fff; }
.banner.has-img::after { display: none; }
.banner.has-title::after { display: block; }
.banner.def::before {
  content: ""; position: absolute; width: 58%; aspect-ratio: 1; border-radius: 50%; background: var(--yellow);
  inset-inline-end: -20%; bottom: -62%;
}
.banner.def::after {
  content: ""; position: absolute; width: 58%; aspect-ratio: 1; border-radius: 50%; border: 2px solid rgba(255, 203, 31, .45);
  inset-inline-end: -14%; bottom: -52%;
}
.banner .go {
  position: relative; z-index: 1; align-self: flex-start; margin-top: 12px; height: 40px; padding: 0 18px;
  border: 0; border-radius: 20px; background: var(--yellow); color: #1D2766; font-weight: 800; font-size: .92rem;
}
.bdots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.bdots i { width: 7px; height: 7px; border-radius: 4px; background: var(--line-strong); }
.bdots i.on { width: 20px; background: var(--yellow); }
@media (min-width: 900px) {
  .banner { flex: 0 0 min(100%, 560px); min-height: 0; padding: 26px; }
  .banners.single .banner { flex-basis: min(100%, 640px); }
}

/* عدّاد الكمية */
.card .btn-cta { margin-top: 10px; min-height: 44px; }
.qty {
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; height: 44px;
  border-radius: var(--r-md); background: var(--cta); color: var(--cta-ink);
}
.card .qty { margin-top: 10px; }
.qty button { height: 44px; padding: 0; display: grid; place-items: center; border: 0; background: transparent; color: inherit; }
.qty button .ic { width: 18px; height: 18px; stroke-width: 2.4; }
.qty button:disabled { opacity: .35; }
.qty b { text-align: center; font-weight: 800; font-size: 1.05rem; }
#prod-cart .qty { height: 50px; }
.rc .qty { width: 150px; }

/* شريط السلة الطويل */
.cartbar {
  position: fixed; z-index: 9; inset-inline: 12px; bottom: calc(var(--tabs-h) + 20px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 18px 0 16px;
  border-radius: 18px; background: var(--cta); color: var(--cta-ink);
  font-weight: 800; text-decoration: none; box-shadow: 0 8px 24px rgba(13, 18, 53, .28);
}
.cartbar .n { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 15px; display: grid; place-items: center; background: #1D2766; color: #FFCB1F; font-size: .95rem; }
.cartbar .tot { margin-inline-start: auto; font-size: 1.05rem; }
body.has-cartbar .main { padding-bottom: calc(var(--tabs-h) + 110px + env(safe-area-inset-bottom, 0px)); }
.cart-sum { margin-top: 18px; }
.cart-total { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; font-weight: 700; }
.cart-total b .num { font-size: 1.6rem; font-weight: 800; }
.cart-sum .link { margin-top: 12px; text-decoration: none; color: var(--muted); }
.line-total { white-space: nowrap; font-weight: 800; }
.line-total .cur { margin-inline-start: 4px; }
@media (min-width: 900px) {
  .cartbar { inset-inline: auto 48px; bottom: 28px; width: 360px; }
  body.has-cartbar .main { padding-bottom: 110px; }
}

/* التنبيه أعلى الصفحة في الجوال حتى لا يغطيه شريط السلة */
@media (max-width: 899px) {
  .toast { bottom: auto; top: calc(var(--bar-h) + 14px + env(safe-area-inset-top, 0px)); }
}

/* نافذة الإعلان */
dialog { max-height: calc(100dvh - 32px); overflow-y: auto; }
#addlg h2 { margin-bottom: 14px; }
.adpick {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  width: 100%; aspect-ratio: 2 / 1; padding: 0; overflow: hidden;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); background: var(--field); color: var(--ink); font-weight: 700;
}
.adpick .ic { width: 30px; height: 30px; stroke-width: 1.4; color: var(--muted); }
.adpick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.adpick-l { position: absolute; bottom: 8px; inset-inline-start: 8px; padding: 4px 10px; border-radius: 8px; background: rgba(13, 18, 53, .78); color: #fff; font-size: .82rem; }
.field.is-bad .adpick { border-color: var(--danger); }
.field input[type="date"] { text-align: start; }
.ad-img { aspect-ratio: 2 / 1; }
.rc.ad .rc-sub { overflow-wrap: anywhere; }

/* تعديلات بعد المراجعة */
.banner.def h2, .banner.def p { max-width: 74%; }
.banner.def { justify-content: center; }
.qty { direction: ltr; }
.pair > .field { min-width: 0; }
.field input[type="date"] { min-width: 0; padding: 0 10px; font-size: .9rem; -webkit-appearance: none; appearance: none; }
.pair + .field, .field + .switch { margin-top: 16px; }

/* =====================================================================
   التوصيل المجاني، شريط الشراء، صفقة اليوم، الصفوف الأفقية، سحب الإعلانات
   ===================================================================== */

/* حاوية أسفل الصفحة: الشريط الزجاجي ثم شريط السلة */
.dock { position: fixed; z-index: 9; inset-inline: 12px; bottom: calc(var(--tabs-h) + 20px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; }
.dock .cartbar { position: static; inset: auto; width: auto; }
.goal {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, .55); border-radius: 16px;
  background: rgba(255, 255, 255, .72); -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  color: #171F55; font-size: .9rem; font-weight: 700; line-height: 1.5; box-shadow: 0 6px 20px rgba(13, 18, 53, .16);
}
:root[data-theme="dark"] .goal { background: rgba(35, 45, 120, .72); border-color: rgba(255, 255, 255, .16); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .goal { background: rgba(35, 45, 120, .72); border-color: rgba(255, 255, 255, .16); color: #fff; } }
.ring { width: 34px; height: 34px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.2; }
.ring-bg { stroke: rgba(29, 39, 102, .16); }
:root[data-theme="dark"] .ring-bg { stroke: rgba(255, 255, 255, .2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ring-bg { stroke: rgba(255, 255, 255, .2); } }
.ring-fg { stroke: var(--yellow); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .5s ease; }
.ring-ic { transform: rotate(90deg); transform-origin: 18px 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.goal.is-done { color: var(--good); }
.goal.is-done .ring-fg { stroke: var(--good); }
body.has-cartbar.has-goal .main { padding-bottom: calc(var(--tabs-h) + 166px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 900px) {
  .dock { inset-inline: auto 48px; bottom: 28px; width: 380px; }
  body.has-cartbar.has-goal .main { padding-bottom: 170px; }
}

/* شريط الشراء في صفحة المنتج */
.buybar {
  position: fixed; z-index: 9; inset-inline: 12px; bottom: calc(var(--tabs-h) + 20px + env(safe-area-inset-bottom, 0px));
  display: grid; grid-template-columns: 132px 1fr; gap: 10px; padding: 8px;
  border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 8px 24px rgba(13, 18, 53, .22);
}
.buybar .qty { height: 52px; background: var(--tint); color: var(--ink); }
.buybar .qty button { height: 52px; }
.buybar .btn { min-height: 52px; padding: 0 16px; justify-content: space-between; border-radius: 14px; }
.buybar .tot { font-size: 1.02rem; }
body.has-buybar .main { padding-bottom: calc(var(--tabs-h) + 120px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 900px) { .buybar { inset-inline: auto 48px; bottom: 28px; width: 420px; } body.has-buybar .main { padding-bottom: 120px; } }

/* سطور السلة */
.cart-line { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-weight: 500; }
.cart-line b { color: var(--ink); font-weight: 700; }
.cart-saved { margin: -2px 0 10px; color: var(--good); font-weight: 700; font-size: .92rem; }
.cart-total { padding-top: 12px; border-top: 1px solid var(--line); }

/* صفقة اليوم */
.deal { margin-top: 18px; border: 2px solid var(--yellow); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.deal-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; background: var(--yellow); color: #1D2766; }
.deal-h h2 { font-size: 1.1rem; font-weight: 800; }
.deal-h h2::before { display: none; }
.deal-clock { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 14px; background: #1D2766; color: #FFCB1F; font-size: .98rem; }
.deal-clock .ic { width: 16px; height: 16px; stroke-width: 2; }
.deal-b { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 14px; padding: 14px; }
.deal-media { display: block; aspect-ratio: 1 / 1; border-radius: var(--r-md); overflow: hidden; background: var(--tint); }
.deal-media img { width: 100%; height: 100%; object-fit: cover; }
.deal-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.deal-info .card-name { min-height: 0; }
.deal-bar { height: 8px; margin-top: 6px; border-radius: 4px; background: var(--tint); overflow: hidden; }
.deal-bar i { display: block; height: 100%; min-width: 4px; background: var(--yellow); border-radius: 4px; }
.deal-stock { font-size: .82rem; font-weight: 700; color: var(--muted); min-height: 1.4em; }
.deal-info .btn, .deal-info .qty { margin-top: auto; min-height: 44px; }
@media (min-width: 900px) { .deal { max-width: 640px; } .deal-b { grid-template-columns: 160px minmax(0, 1fr); } }

/* صفوف أفقية من البطاقات */
.hrow { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; padding-bottom: 4px; }
.hrow::-webkit-scrollbar { display: none; }
.hrow .card { flex: 0 0 164px; scroll-snap-align: start; }
@media (min-width: 900px) { .hrow .card { flex-basis: 200px; } }

/* الترتيب وعدد النتائج والتقييم على البطاقة */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sort select {
  height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 19px; background: var(--surface); color: var(--ink);
  font-size: .86rem; font-weight: 700; appearance: none; -webkit-appearance: none;
}
.list-head { align-items: center; }
.list-count { margin: -4px 2px 10px; font-size: .86rem; color: var(--muted); }
.list-count:empty { display: none; }
#more-btn { margin-top: 14px; }
.card-rate { display: inline-flex; align-items: center; gap: 4px; font-size: .82rem; font-weight: 700; line-height: 1.5; }
.card-rate .ic { width: 14px; height: 14px; color: var(--star); fill: currentColor; stroke-width: 1.4; }
.sec-t { margin: 30px 0 12px; font-size: 1.15rem; font-weight: 800; }
.sec-t::before { content: ""; display: inline-block; width: 6px; height: .85em; margin-inline-end: 10px; border-radius: 3px; background: var(--yellow); vertical-align: -.06em; }
.view > h1 + .sec-t { margin-top: 6px; }
.photo-hint { margin: 10px 0 0; font-size: .84rem; }

/* سحب بطاقة الإعلان: أرشفة وحذف */
.swipe { border-bottom: 1px solid var(--line); }
.swipe-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.swipe-track::-webkit-scrollbar { display: none; }
.swipe-main { flex: 0 0 100%; scroll-snap-align: start; border-bottom: 0; }
.swipe-acts { flex: none; display: flex; align-items: stretch; gap: 0; scroll-snap-align: end; padding-block: 16px; }
.sw-btn { width: 86px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 0; color: #fff; font-weight: 800; font-size: .88rem; }
.sw-btn .ic { width: 22px; height: 22px; }
.sw-archive { background: #E07B00; }
.sw-delete { background: #C62828; }
.swipe-acts .sw-btn:first-child { border-start-start-radius: var(--r-md); border-end-start-radius: var(--r-md); }
.swipe-acts .sw-btn:last-child { border-start-end-radius: var(--r-md); border-end-end-radius: var(--r-md); }
.act-warn { border-color: #E07B00; color: #B86200; }
.act-danger { border-color: var(--danger); color: var(--danger); }
:root[data-theme="dark"] .act-warn { color: #FFB04D; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .act-warn { color: #FFB04D; } }

/* تعديلات بعد المراجعة */
.buybar { grid-template-columns: 112px 1fr; }
.buybar .btn { white-space: nowrap; font-size: .95rem; gap: 10px; padding: 0 14px; }
.buybar .tot { white-space: nowrap; }
.swipe-hint { margin: 14px 0 6px; }

/* سحب صف المنتج في المخزون */
.items .swipe-main.item { border-bottom: 0; }
.items .swipe-acts { padding-block: 12px; }
.desk-act { display: none; }
@media (min-width: 900px) {
  .desk-act { display: inline-flex; }
  .cols-inv, .items-inv .item { grid-template-columns: 56px minmax(0, 1fr) 80px 130px 130px 270px; }
}

/* فيديو المنتج */
#vid-box .link { margin-top: 12px; text-decoration: none; }
.vid-prev { display: grid; gap: 10px; margin-top: 12px; justify-items: start; }
.vid-prev video { width: 100%; max-height: 260px; border-radius: var(--r-md); background: #000; }
.gal video { flex: 0 0 100%; width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #000; scroll-snap-align: start; }

/* الوصف تحت الصور في الإضافة وفي صفحة المنتج */
.desc-f { margin-top: 16px; }
.prod-info .sec-t { margin: 22px 0 6px; font-size: 1.05rem; }
.prod-desc { margin-top: 0; }

/* المخزون: الأزرار في سطر مستقل على الجوال لتتسع للتعديل */
.items-inv .item { grid-template-columns: 64px minmax(0, 1fr); }
.items-inv .i-acts { grid-column: 1 / -1; order: 5; flex-wrap: wrap; }
@media (min-width: 900px) {
  .cols-inv, .items-inv .item { grid-template-columns: 56px minmax(0, 1fr) 70px 120px 120px 380px; }
  .items-inv .i-acts { grid-column: auto; order: 9; flex-wrap: nowrap; justify-content: flex-end; }
}

/* ================= كتالوج المنتجات ================= */
.cat-tools { display: grid; gap: 10px; margin-top: 22px; }
.cat-tools .btn { width: 100%; }
#inv-tabs { margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 8px; }
.chip b { font-weight: 700; font-size: .84rem; opacity: .7; }
.i-name .st { display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; margin-top: 2px; }
.st i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.st b { font-weight: 700; }
.st-on i { background: var(--good); } .st-on b { color: var(--good); }
.st-out i { background: var(--danger); } .st-out b { color: var(--danger); }
.stock {
  display: inline-grid; grid-template-columns: 38px 50px 38px; align-items: stretch; height: 42px; overflow: hidden;
  border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); direction: ltr;
}
.stock button { display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--ink); }
.stock button .ic { width: 16px; height: 16px; stroke-width: 2.4; }
.stock button:disabled { opacity: .3; }
.stock input {
  width: 100%; min-width: 0; padding: 0; border: 0; border-inline: 1px solid var(--line); border-radius: 0; outline: 0;
  background: transparent; color: var(--ink); text-align: center; font: inherit; font-weight: 800; font-size: 1rem;
}
.stock:focus-within { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 1px; }
.stock.is-out { border-color: var(--danger); }
.stock.is-out input { color: var(--danger); }
.stock.is-bad { border-color: var(--danger); outline: 2px solid var(--danger); outline-offset: 1px; }
.items-inv .i-nums { grid-template-columns: auto 1fr 1fr; align-items: end; column-gap: 18px; }
.items-inv .i-stock small { margin-bottom: 4px; }
@media (min-width: 900px) {
  .cat-tools { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .cat-tools .btn { width: auto; }
  /* على الشاشة الكبيرة: الأزرار في سطر ثانٍ حتى يبقى للاسم مساحته */
  .cols-inv, .items-inv .item { grid-template-columns: 56px minmax(0, 1fr) 130px 130px 130px; }
  .cols-inv span:last-child { display: none; }
  .items-inv .item { row-gap: 10px; }
  .items-inv .i-acts { grid-column: 1 / -1; order: 9; flex-wrap: nowrap; justify-content: flex-end; }
  .items-inv .i-stock small { display: none; }
  #inv-swipe { display: none; }
}

@media (min-width: 900px) { .cols-inv { margin-top: 18px; } }

/* ================= الحساب وتسجيل الدخول ================= */
.pref.acct { grid-column: 3; justify-self: end; width: 38px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
.acct .av { display: grid; place-items: center; font-size: .82rem; font-weight: 800; line-height: 1; }
.acct .av .ic { width: 18px; height: 18px; }
.acct.is-in { background: var(--yellow); border-color: var(--yellow); color: #1D2766; }
.acct-name { display: none; }
#theme-btn { margin-inline-end: 46px; }
.acct-pop {
  position: fixed; z-index: 40; top: calc(var(--bar-h) + env(safe-area-inset-top, 0px) + 8px); inset-inline-end: 12px;
  width: min(280px, calc(100vw - 24px)); padding: 8px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 14px 40px rgba(8, 12, 40, .28);
}
.acct-h { display: grid; gap: 2px; padding: 10px 12px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.acct-h strong { font-weight: 800; line-height: 1.5; overflow-wrap: anywhere; }
.acct-h span { font-size: .84rem; color: var(--muted); overflow-wrap: anywhere; }
.acct-h .role { justify-self: start; margin-top: 4px; padding: 2px 10px; border-radius: 10px; background: var(--tint); color: var(--ink); font-weight: 700; font-size: .78rem; }
.acct-pop a, .acct-pop button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 0 12px;
  border: 0; border-radius: var(--r-md); background: transparent; color: var(--ink); font: inherit; font-weight: 700; text-decoration: none; text-align: start;
}
.acct-pop a:hover, .acct-pop button:hover { background: var(--tint); }
.acct-pop .ic { width: 19px; height: 19px; }
#acct-out { margin-top: 6px; padding-top: 2px; border-top: 1px solid var(--line); border-radius: 0 0 var(--r-md) var(--r-md); color: var(--danger); }
.scope {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; min-width: 0;
  border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface); color: var(--ink);
}
.scope .ic { flex: none; width: 17px; height: 17px; }
.scope select { min-width: 0; max-width: 150px; height: 100%; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; font-weight: 700; font-size: .9rem; }
.crumbs:has(.scope:not([hidden])) { margin-bottom: 14px; }
.passbox { position: relative; }
.passbox input { width: 100%; }
html[dir="rtl"] .passbox input { padding-left: 48px; }
html[dir="ltr"] .passbox input { padding-right: 48px; }
.peek { position: absolute; top: 50%; inset-inline-end: 4px; transform: translateY(-50%); width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--muted); }
.peek .ic { width: 20px; height: 20px; }
.login-hint { margin: -8px 0 20px; }
#login-form { max-width: 440px; }
#login-form .link { margin-top: 16px; text-decoration: none; }
.lock-hint { margin: -6px 0 16px; color: var(--danger); font-weight: 700; }
.field input:disabled { opacity: .55; }
.perms { margin: 18px 0 0; padding: 0; border: 0; min-width: 0; }
.perms legend { padding: 0; font-weight: 700; font-size: .95rem; }
.perms .switch { margin-top: 12px; font-weight: 500; }
.perms + .switch { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.field + .perms { margin-top: 18px; }
.people { margin-top: 18px; }
.rc.person { grid-template-columns: 44px minmax(0, 1fr); }
.person .av { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--tint); color: var(--ink); font-weight: 800; }
.person.is-off .av, .person.is-off .rc-h strong { opacity: .55; }
.person .rc-h { align-items: center; }
.person .rc-note { color: var(--muted); font-size: .88rem; }

/* ================= السلة: تحديد ما يُطلب ================= */
.h-n { font-size: .6em; font-weight: 700; color: var(--muted); }
.pick {
  position: relative; flex: none; width: 26px; height: 26px; padding: 0; display: grid; place-items: center;
  border: 2px solid var(--line-strong); border-radius: 50%; background: transparent; color: transparent;
}
.pick::after { content: ""; position: absolute; inset: -10px; }
.pick .ic { width: 14px; height: 14px; stroke-width: 3; }
.pick[aria-checked="true"] { background: var(--cta); border-color: var(--cta); color: var(--cta-ink); }
.cart-tools { display: flex; align-items: center; gap: 12px; padding: 4px 2px 12px; }
.cart-all-t { flex: 1; min-width: 0; }
.cart-all-t span { margin-inline-start: 6px; font-size: .86rem; color: var(--muted); }
#cart-del-sel { margin: 0; text-decoration: none; color: var(--danger); font-size: .9rem; }
#cart-del-sel:disabled { opacity: .4; }
.rc.cart-rc { grid-template-columns: 26px 72px minmax(0, 1fr); column-gap: 12px; align-items: start; }
.cart-rc > .pick { margin-top: 23px; }
.cart-thumb { position: relative; display: block; border-radius: var(--r-md); overflow: hidden; }
.cart-rc .thumb { display: block; width: 72px; height: 72px; }
.cart-thumb .left { position: absolute; inset-inline: 0; bottom: 0; padding: 3px 2px; background: rgba(19, 26, 74, .8); color: #fff; font-size: .68rem; font-weight: 700; line-height: 1.3; text-align: center; }
.cart-rc.is-off .cart-thumb, .cart-rc.is-off .rc-h, .cart-rc.is-off .rc-sub { opacity: .5; }
.rc-sub s { margin-inline: 4px; }
.save-t { margin-inline-start: 4px; color: var(--good); font-weight: 700; white-space: nowrap; }
.cart-goal { margin-bottom: 16px; padding: 12px 14px; border-radius: var(--r-md); background: var(--tint); }
.cart-goal p { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .92rem; line-height: 1.5; }
.cart-goal .ic { flex: none; width: 20px; height: 20px; }
.cart-goal-bar { height: 6px; margin-top: 10px; border-radius: 3px; background: var(--line-strong); overflow: hidden; }
.cart-goal-bar i { display: block; height: 100%; border-radius: 3px; background: var(--yellow); transition: width .3s ease-out; }
.cart-goal.is-done p { color: var(--good); }
.cart-save b { color: var(--good); }
.btn.is-off { opacity: .5; pointer-events: none; }
.cart-hint { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: .88rem; color: var(--muted); }
.cart-hint .ic { flex: none; width: 16px; height: 16px; }
.cart-hint.is-warn { color: var(--danger); font-weight: 700; }
.card-seller { display: block; font-size: .78rem; color: var(--muted); line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (min-width: 900px) {
  #theme-btn { margin-inline-end: 0; }
  .prefs { flex-wrap: wrap; }
  .pref.acct { order: -1; flex: 1 0 100%; width: auto; height: 48px; padding: 0 10px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: flex-start; gap: 10px; }
  .acct.is-in { background: transparent; border-color: rgba(255, 255, 255, .28); color: #fff; }
  .acct .av { flex: none; width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .14); }
  .acct.is-in .av { background: var(--yellow); color: #1D2766; }
  .acct-name { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
  .acct-pop { top: auto; bottom: 128px; inset-inline: 16px auto; width: calc(var(--side-w) - 32px); }
}

.person > .i-acts { grid-column: 1 / -1; margin-top: 12px; flex-wrap: wrap; }

.cart-gos { display: grid; gap: 10px; }
.cart-gos .btn { justify-content: flex-start; gap: 10px; text-align: start; }
.cart-gos .btn .tot { margin-inline-start: auto; white-space: nowrap; font-weight: 800; }

/* ================= الطلبات ================= */
.ord-cards { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }
.ord-card { display: grid; gap: 4px; align-content: start; padding: 14px 16px; text-align: start; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); font: inherit; }
.ord-card small { font-size: .82rem; color: var(--muted); line-height: 1.5; }
.ord-card b { font-size: 1.45rem; font-weight: 800; line-height: 1.3; }
.ord-card b .cur { font-size: .8rem; }
.ord-card > span { font-size: .82rem; color: var(--muted); }
.ord-card.is-new { border-color: var(--yellow); box-shadow: inset 0 3px 0 var(--yellow); }
.ord-card.is-due { border-color: var(--danger); box-shadow: inset 0 3px 0 var(--danger); }
.ord-card.is-due b { color: var(--danger); }
.ord .rc-note { margin-top: 4px; }
.ord .i-acts { margin-top: 12px; flex-wrap: wrap; }
.ord-due { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding: 8px 12px; border-radius: var(--r-md); background: var(--tint); color: var(--danger); font-weight: 700; font-size: .9rem; }
.ord-due .ic { flex: none; width: 17px; height: 17px; }
.ord-link { display: block; text-decoration: none; }
.track { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin: 6px 0 18px; padding: 0; list-style: none; }
.track li { position: relative; display: grid; justify-items: center; gap: 8px; text-align: center; font-size: .78rem; font-weight: 700; line-height: 1.4; color: var(--muted); }
.track li::before { content: ""; position: absolute; top: 13px; inset-inline: -50% 50%; height: 3px; background: var(--line-strong); }
.track li:first-child::before { display: none; }
.track li i { position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--bg, var(--surface)); color: transparent; }
.track li i .ic { width: 14px; height: 14px; stroke-width: 3; }
.track li.is-done, .track li.is-on { color: var(--ink); }
.track li.is-done::before, .track li.is-on::before { background: var(--yellow); }
.track li.is-done i, .track li.is-on i { border-color: var(--yellow); background: var(--yellow); color: #1D2766; }
.ord-note { margin-bottom: 16px; padding: 12px 14px; border-radius: var(--r-md); background: var(--tint); font-weight: 700; line-height: 1.7; }
.ord-note.is-bad { color: var(--danger); }
.ship-box { margin-bottom: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.ship-box a { display: block; margin-top: 8px; }
.ship-box img { display: block; width: 100%; max-height: 360px; object-fit: contain; border-radius: var(--r-md); background: var(--tint); }
#ord-wa { margin-top: 6px; }
.co-num { margin-bottom: 14px; font-size: 1.05rem; }
.co-num b { font-size: 1.3rem; font-weight: 800; margin-inline-start: 6px; }
.co-hint { margin-top: 12px; }
#u-del-f { margin-top: 16px; }
#u-del-f + .perms[hidden] + .switch, #u-del-f + .switch { margin-top: 16px; }
