:root {
  --bg: #faf7f1;
  --card: #ffffff;
  --text: #1c2526;
  --muted: #6b7778;
  --line: #e4e9ea;
  --primary: #8a6a1f;
  --primary-soft: #f6eedb;
  --expense: #c2410c;
  --income: #15803d;
  --danger: #dc2626;
  --warn: #b45309;
  --radius: 16px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #0f1415; --card: #1a2224; --text: #e8eeee; --muted: #93a2a3; --line: #2a3537;
    --primary: #e0bd6a; --primary-soft: #3a2f17; --expense: #fb923c; --income: #4ade80; --danger: #f87171;
  }
}
:root[data-theme=dark] {
    --bg: #0f1415; --card: #1a2224; --text: #e8eeee; --muted: #93a2a3; --line: #2a3537;
    --primary: #e0bd6a; --primary-soft: #3a2f17; --expense: #fb923c; --income: #4ade80; --danger: #f87171;
  }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Arabic", "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
  font-size: 16px; line-height: 1.5;
  padding-top: var(--safe-t);
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
}
main { max-width: 640px; margin: 0 auto; padding: 12px 14px; }
h1 { font-size: 1.35rem; margin: 6px 0 12px; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
a { color: var(--primary); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.hidden, [hidden] { display: none !important; }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.05); border: 1px solid var(--line); }
.card + .card, .card + .grid2, .grid2 + .card, .banner + .card, .card + details, details + .card { margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.stat .label { font-size: .85rem; color: var(--muted); }
.stat .value { font-size: 1.35rem; font-weight: 700; }
.big { font-size: 2rem; font-weight: 800; }
.pos { color: var(--income); } .neg { color: var(--danger); } .exp { color: var(--expense); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 12px; }
.topbar h1 { margin: 0; font-size: 1.2rem; }
.monthnav { display: flex; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.monthnav button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; font-size: 1.2rem; color: var(--text); }
.monthnav button:active { background: var(--primary-soft); }
.monthnav .ml { min-width: 108px; text-align: center; font-weight: 600; font-size: .95rem; }

.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.bar.over > i { background: var(--danger); }
.bar.thin { height: 6px; margin-top: 6px; }

.cat-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.cat-row:last-child { border-bottom: 0; padding-bottom: 0; }
.ico { width: 38px; height: 38px; border-radius: 12px; background: var(--primary-soft); display: grid; place-items: center; font-size: 1.2rem; flex: none; }

details.explain { background: var(--primary-soft); border-radius: var(--radius); padding: 12px 14px; font-size: .92rem; }
details.explain summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.banner { background: #fff7ed; color: #7c2d12; border: 1px solid #fed7aa; border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .banner { background: #3a2412; color: #fed7aa; border-color: #7c2d12; }
}
:root[data-theme=dark] .banner { background: #3a2412; color: #fed7aa; border-color: #7c2d12; }


/* أزرار وحقول */
button, .btn { font: inherit; cursor: pointer; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 600; background: var(--primary); color: #fff; text-decoration: none; min-height: 46px; }
.btn.secondary { background: var(--primary-soft); color: var(--primary); }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.block { width: 100%; }
.btn.sm { padding: 6px 12px; min-height: 36px; font-size: .9rem; border-radius: 10px; }
.btn:disabled { opacity: .55; }
label { display: block; font-size: .88rem; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  font: inherit; font-size: 16px; width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); min-height: 46px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }
input[type=date] { -webkit-appearance: none; appearance: none; text-align: right; }
.field + .field { margin-top: 12px; }
.err { color: var(--danger); font-size: .9rem; margin-top: 8px; min-height: 1em; }

.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; border-radius: 9px; padding: 10px; background: transparent; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg button.on[data-type=expense] { color: var(--expense); }
.seg button.on[data-type=income] { color: var(--income); }

.amount-wrap { position: relative; }
.amount-wrap input { font-size: 2.2rem; font-weight: 800; text-align: center; padding: 14px 60px; direction: ltr; }
.amount-wrap .cur { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }

.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .8rem; color: var(--text); min-height: 64px; }
.chip .e { font-size: 1.4rem; }
.chip.on { border-color: var(--primary); background: var(--primary-soft); outline: 2px solid var(--primary); }

.sticky-save { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b) + 30px); margin-top: 16px; z-index: 5; }

/* السجل */
.filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.filters select { padding: 8px; min-height: 40px; font-size: 14px; }
.day-h { font-size: .85rem; color: var(--muted); margin: 14px 4px 6px; font-weight: 600; }
.tx { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; width: 100%; text-align: right; color: var(--text); }
.tx + .tx { margin-top: 6px; }
.tx .t1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .t2 { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .amt { font-weight: 700; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.pill { font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.warn { background: #ffedd5; color: #9a3412; }

/* شريط التبويبات */
.tabbar {
  position: fixed; inset: auto 0 0 0; height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; z-index: 20;
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: .7rem; color: var(--muted); text-decoration: none; height: 100%; }
.tabbar a .ti { font-size: 1.25rem; filter: grayscale(1); opacity: .7; }
.tabbar a.on { color: var(--primary); font-weight: 700; }
.tabbar a.on .ti { filter: none; opacity: 1; }
.tabbar a.fab { color: var(--primary); font-weight: 700; }
.fab-plus { width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 2.1rem; line-height: 1; margin-top: -26px; box-shadow: 0 6px 16px rgba(138,106,31,.4); border: 4px solid var(--bg); }

/* نافذة الحوار */
dialog { border: 0; border-radius: 20px; padding: 0; width: min(92vw, 440px); background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog form { padding: 18px; max-height: 85vh; overflow: auto; }
.dlg-actions { display: flex; gap: 8px; margin-top: 16px; }
.dlg-actions .btn { flex: 1; }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-pick button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 1.2rem; }
.emoji-pick button.on { outline: 2px solid var(--primary); background: var(--primary-soft); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-b) + 20px); background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 50; font-size: .95rem; max-width: 90vw; text-align: center; }
.toast.error { background: var(--danger); }

.splash { display: grid; place-items: center; min-height: 60vh; color: var(--muted); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--primary); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-hero { text-align: center; margin: 28px 0 18px; }
.auth-hero .logo { width: 76px; height: 76px; border-radius: 20px; }
.auth-hero h1 { margin: 10px 0 4px; font-size: 1.6rem; }
.linkbtn { background: none; border: 0; color: var(--primary); padding: 6px; font-weight: 600; }

/* ---------- جملة: الكتالوج والطلبات ---------- */
input[type=search] { width: 100%; }
.hscroll { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 4px; scrollbar-width: none; margin: 0 -14px; padding-inline: 14px; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll .chip { flex: 0 0 auto; white-space: nowrap; flex-direction: row; gap: 6px; padding: 8px 14px; min-height: 40px; border-radius: 999px; font-size: .9rem; }
.hscroll .chip .e { font-size: 1.05rem; }
#sizes .chip, #colors .chip { min-height: 44px; justify-content: center; font-size: .95rem; font-weight: 600; }
.pgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
@media (min-width: 560px) { .pgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; color: inherit; text-decoration: none; display: flex; flex-direction: column; }
.pcard:active { transform: scale(.98); }
.pimg { position: relative; aspect-ratio: 3 / 4; background: var(--line); }
.pimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pbody { padding: 8px 10px 10px; }
.pname { font-weight: 600; font-size: .92rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pprice { margin-top: 4px; font-weight: 700; color: var(--primary); }
.tag { position: absolute; top: 8px; inset-inline-start: 8px; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #f59e0b; color: #fff; }
.tag.off { background: #6b7280; inset-inline-start: auto; inset-inline-end: 8px; }
.tag.static { position: static; }
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--radius); background: var(--line); scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery img { flex: 0 0 100%; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; scroll-snap-align: center; }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--primary); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.stepper button { width: 48px; height: 48px; border: 0; background: var(--primary-soft); color: var(--primary); font-size: 1.4rem; font-weight: 700; }
.stepper input { width: 72px; text-align: center; border: 0; border-radius: 0; font-size: 1.15rem; font-weight: 700; min-height: 48px; }
.stepper.sm button { width: 34px; height: 34px; font-size: 1.1rem; }
.stepper.sm span { min-width: 36px; text-align: center; font-weight: 700; }
.cline { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cline:last-of-type { border-bottom: 0; }
.cline img { width: 64px; height: 84px; object-fit: cover; border-radius: 10px; background: var(--line); flex: 0 0 auto; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 84px; height: 110px; border-radius: 10px; overflow: hidden; background: var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .x, .thumb .cover { position: absolute; top: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: .8rem; padding: 0; min-height: 0; }
.thumb .x { inset-inline-end: 4px; } .thumb .cover { inset-inline-start: 4px; }
.thumb .tag { top: auto; bottom: 4px; }
.badge { position: absolute; top: 6px; inset-inline-start: calc(50% + 6px); background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; font-style: normal; }
.tabbar a { position: relative; }
.tabbar { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.pill.info { background: #dbeafe; color: #1e40af; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .pill.info { background: #1e3a5f; color: #bfdbfe; }
}
:root[data-theme=dark] .pill.info { background: #1e3a5f; color: #bfdbfe; }

.statusbtns { display: flex; flex-wrap: wrap; gap: 6px; }
a.tx { color: inherit; text-decoration: none; }
#unitseg { grid-template-columns: repeat(3, 1fr); display: grid; }

.pwbox { position: relative; }
.pwbox input { padding-left: 48px; }
.pwbox .eye { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; font-size: 1.2rem; min-height: 0; width: 40px; height: 40px; padding: 0; }

/* الإضافة الجماعية */
.bgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 560px) { .bgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.bitem { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--line); border: 3px solid transparent; cursor: pointer; }
.bitem.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.bimgs { width: 100%; height: 100%; display: grid; gap: 2px; }
.bimgs.n2 { grid-template-columns: 1fr 1fr; } .bimgs.n3, .bimgs.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.bimgs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bnum { position: absolute; bottom: 6px; inset-inline-start: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: .75rem; font-weight: 700; border-radius: 99px; padding: 1px 8px; }
.bitem .tag { top: 6px; }
.bx, .bsplit { position: absolute; border: 0; background: rgba(0,0,0,.6); color: #fff; border-radius: 99px; min-height: 0; font-size: .75rem; padding: 3px 8px; }
.bx { top: 6px; inset-inline-end: 6px; width: 26px; height: 26px; padding: 0; }
.bsplit { bottom: 6px; inset-inline-end: 6px; }
.bitem.on::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.2rem; color: #fff; background: rgba(138,106,31,.35); pointer-events: none; }
.small-gal img { aspect-ratio: 1 / 1; max-height: 46vh; object-fit: contain; background: var(--card); }
a.banner { display: flex; align-items: center; gap: 10px; }

/* العروض وخصم الكمية */
.tag.hot { background: #dc2626; top: auto; bottom: 8px; inset-inline-start: 8px; font-size: .78rem; }
.chip.hot { border-color: #fca5a5; color: #b91c1c; }
.chip.hot.on { background: #fee2e2; outline-color: #dc2626; border-color: #dc2626; }
.offerline { display: inline-block; background: #fee2e2; color: #b91c1c; font-weight: 700; font-size: .85rem; border-radius: 99px; padding: 3px 12px; margin-top: 8px; }
.hotbanner { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.qtybox { margin-top: 10px; background: var(--primary-soft); border-radius: 12px; padding: 10px 12px; font-size: .88rem; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.qtybox span { background: var(--card); border-radius: 99px; padding: 2px 10px; }
.nudge { margin-top: 6px; background: #ecfdf5; color: #065f46; border-radius: 10px; padding: 6px 10px; font-weight: 600; }
.nudgebar { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; margin-bottom: 10px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .offerline, :root:not([data-theme=light]) .chip.hot.on { background: #3b1414; color: #fca5a5; }
  :root:not([data-theme=light]) .hotbanner { background: #2a1414; color: #fecaca; border-color: #5b1d1d; }
  :root:not([data-theme=light]) .nudge, :root:not([data-theme=light]) .nudgebar { background: #0f2e25; color: #a7f3d0; border-color: #14532d; }
}
:root[data-theme=dark] .offerline, :root[data-theme=dark] .chip.hot.on { background: #3b1414; color: #fca5a5; }
:root[data-theme=dark] .hotbanner { background: #2a1414; color: #fecaca; border-color: #5b1d1d; }
:root[data-theme=dark] .nudge, :root[data-theme=dark] .nudgebar { background: #0f2e25; color: #a7f3d0; border-color: #14532d; }


/* ===== ميزات المتجر ===== */
.hsec { margin-top: 16px; }
.hsec h2 { margin: 0; font-size: 1.05rem; }
.hsec h2.hot { color: #b91c1c; }
.hrow { display: flex; gap: 10px; overflow-x: auto; padding: 8px 2px 4px; margin: 0 -14px; padding-inline: 14px; scroll-snap-type: x proximity; scrollbar-width: none; }
.hrow::-webkit-scrollbar { display: none; }
.hrow .pcard { flex: 0 0 150px; scroll-snap-align: start; }
@media (min-width: 560px) { .hrow .pcard { flex-basis: 180px; } }
.hero { display: block; position: relative; width: 100%; margin-top: 12px; border: 0; padding: 0; border-radius: var(--radius); overflow: hidden; background: var(--line); cursor: pointer; min-height: 0; }
.hero img { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; display: block; }
.hero span { position: absolute; inset: auto 0 0 0; padding: 14px 16px; background: linear-gradient(transparent, rgba(0,0,0,.65)); color: #fff; font-weight: 800; font-size: 1.15rem; text-align: right; }
.crumbs { margin: 10px 0 8px; color: var(--muted); }
.crumbs a { color: var(--primary); text-decoration: none; }
.subchips { padding-top: 4px; }
.subchips .chip { font-size: .82rem; min-height: 34px; padding: 4px 12px; }
.heart { position: absolute; top: 6px; inset-inline-end: 6px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); font-size: 1.1rem; display: grid; place-items: center; padding: 0; min-height: 0; color: #dc2626; box-shadow: 0 1px 4px rgba(0,0,0,.15); z-index: 2; }
.heart.big { width: 44px; height: 44px; font-size: 1.4rem; top: 10px; inset-inline-end: 10px; }
.pimg .tag.off { inset-inline-end: 46px; }
.gwrap { position: relative; }
.gallery video { flex: 0 0 100%; width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: #000; scroll-snap-align: center; }
.favbtn { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); text-decoration: none; font-size: 1.15rem; }
.favbtn .badge { top: -4px; inset-inline-start: auto; inset-inline-end: -6px; }
.swrow { display: flex; gap: 4px; margin-top: 4px; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); vertical-align: middle; flex: 0 0 auto; }
.sw.mix { background: conic-gradient(#ef4444, #f59e0b, #22c55e, #3b82f6, #a855f7, #ef4444); }
.sw.out { opacity: .3; }
.chip.opt { flex-direction: row; gap: 6px; justify-content: center; min-height: 44px; }
.chip.opt .sw { width: 18px; height: 18px; }
.chip.opt.out { opacity: .5; text-decoration: line-through; cursor: not-allowed; background: var(--bg); }
.chip.opt small { font-size: .65rem; color: var(--danger); text-decoration: none; }
.chips.unav .chip.opt.out { opacity: 1; cursor: pointer; border-color: var(--danger); }
.cname { display: inline-flex; align-items: center; gap: 4px; margin-inline-end: 8px; }
.cname.out { opacity: .45; text-decoration: line-through; }
.sharerow { margin-top: 10px; }
.qrbox { background: #fff; padding: 12px; border-radius: 12px; width: 240px; margin: 0 auto; }
.qrbox svg { width: 100%; height: auto; display: block; }
.vidprev video { width: 100%; max-height: 220px; border-radius: 12px; background: #000; }
.vidprev { display: grid; gap: 6px; }
.list-item.subcat { padding-inline-start: 22px; }
.steps { line-height: 2; padding-inline-start: 20px; }
.foot { margin-top: 26px; padding: 18px 0 8px; border-top: 1px solid var(--line); text-align: center; display: grid; gap: 10px; justify-items: center; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: .85rem; }
.foot-links a, .foot-soc a { color: var(--primary); text-decoration: none; }
.foot-soc { display: flex; gap: 14px; font-weight: 600; font-size: .9rem; }
.wafab { position: fixed; z-index: 15; inset-inline-end: 14px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); width: 54px; height: 54px; border-radius: 50%; background: #25d366; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.wafab[hidden] { display: none; }
.wsbtn { white-space: nowrap; flex: none; }
/* 📊 الإحصائيات */
.seg.seg3 { grid-template-columns: 1fr 1fr 1fr; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.kpi > b { display: block; font-size: 1.45rem; margin: 2px 0; }
.dtable { display: grid; gap: 2px; }
.dhead, .drow { display: grid; grid-template-columns: 1.2fr 1.5fr .9fr .9fr 1.1fr; gap: 6px; align-items: center; padding: 6px 0; }
.drow { border-top: 1px solid var(--line); font-size: .92rem; }
.dbar { position: relative; display: flex; align-items: center; min-height: 22px; }
.dbar i { position: absolute; inset-inline-start: 0; top: 3px; bottom: 3px; background: color-mix(in srgb, var(--primary) 30%, transparent); border-radius: 6px; min-width: 2px; }
.dbar b { position: relative; padding-inline-start: 6px; }
.rank { width: 22px; text-align: center; font-weight: 700; color: var(--muted); flex: none; }
.sthumb { width: 44px; height: 54px; object-fit: cover; border-radius: 8px; background: var(--line); flex: none; }
.soldtxt { color: #c2410c; font-weight: 700; }
.pcard .soldtxt { margin-top: 2px; font-size: .78rem; }
/* البانر فيديو */
.hero video { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; display: block; pointer-events: none; }
/* الترتيب والفلترة */
.fbar { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; flex-wrap: wrap; }
.sortsel { display: flex; align-items: center; gap: 4px; font-weight: 700; color: var(--muted); }
.sortsel select { width: auto; min-height: 36px; padding: 4px 10px; font-weight: 700; }
.fpanel { display: grid; gap: 12px; margin-top: 8px; }
.fpanel .chips { margin-top: 4px; }
.fpanel .row input { flex: 1; }
.list-item.dim { opacity: .55; }
.fpanel .chips { display: flex; flex-wrap: wrap; gap: 6px; grid-template-columns: none; }
.fpanel .chip { min-height: 34px; height: auto; padding: 4px 14px; width: auto; flex: none; font-size: .9rem; }
.fpanel .chip { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; }

/* ===== شاشات كبيرة (لابتوب وكمبيوتر): نستغل عرض الشاشة ===== */
@media (min-width: 900px) {
  main { max-width: 1280px; padding: 18px 32px 120px; }
  .pgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .hrow { margin: 0; padding-inline: 2px; gap: 14px; }
  .hrow .pcard { flex-basis: 210px; }
  .hero { margin-top: 16px; }
  .hero img, .hero video { aspect-ratio: 16 / 6; }
  .hero span { font-size: 1.6rem; padding: 22px 28px; }
  #q { max-width: 560px; }
  .topbar h1 { font-size: 1.6rem; }
  /* شريط التبويبات: عائم بالنص بدل ما يغطي عرض الشاشة كله */
  .tabbar { left: 50%; right: auto; transform: translateX(-50%); width: min(620px, 92vw); bottom: 12px; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 8px 30px rgba(0,0,0,.12); }
  .wafab { bottom: 24px; inset-inline-end: 24px; width: 60px; height: 60px; }
  .toast { bottom: 100px; }
  /* صفحة المنتج: الصور يمين والتفاصيل يسار */
  .pdetail { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 28px; align-items: start; margin-top: 10px; }
  .pinfo > .card:first-child { margin-top: 0 !important; }
  /* السلة: المنتجات يمين، والبيانات والمجموع يسار */
  .cartgrid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
  /* الإعدادات: عمودين من الكروت */
  body[data-view="settings"] #app { columns: 2; column-gap: 18px; }
  body[data-view="settings"] #app > * { break-inside: avoid; }
  body[data-view="settings"] #app > h1, body[data-view="settings"] #app > .topbar { column-span: all; }
  /* الإحصائيات */
  .kpis { grid-template-columns: repeat(4, 1fr); }
  body[data-view="stats"] #sbody { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; align-items: start; }
  body[data-view="stats"] #sbody > .kpis, body[data-view="stats"] #sbody > .card:nth-child(2) { grid-column: 1 / -1; }
  /* القوائم والنماذج: عرض مريح للقراءة */
  body[data-view="orders"] #app, body[data-view="order"] #app, body[data-view="customers"] #app, body[data-view="me"] #app,
  body[data-view="new"] #app, body[data-view="edit"] #app, body[data-view="policy"] #app, body[data-view="login"] #app { max-width: 860px; margin: 0 auto; }
}
@media (min-width: 1200px) {
  .pgrid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .hrow .pcard { flex-basis: 230px; }
}
.impimg { width: 88px; height: 118px; object-fit: cover; border-radius: 10px; flex: none; background: var(--line); }
.improw.dim { opacity: .55; }
.warnline { color: #b45309; }
@media (min-width: 900px) { body[data-view="import"] #app { columns: 2; column-gap: 18px; } body[data-view="import"] #app > * { break-inside: avoid; } body[data-view="import"] #app > .topbar, body[data-view="import"] #app > .card:nth-child(2) { column-span: all; } }
.postprev { margin-top: 8px; background: var(--line); border-radius: 12px; min-height: 160px; display: grid; place-items: center; overflow: hidden; }
.postprev img { width: 100%; max-height: 52vh; object-fit: contain; display: block; }
/* تتبّع الطلب */
.tsteps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 14px; position: relative; }
.tstep { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--muted); position: relative; }
.tstep::before { content: ''; position: absolute; top: 19px; inset-inline-start: 50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.tstep:last-child::before { display: none; }
.tstep.done::before { background: var(--primary); }
.tdot { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--line); font-size: 1.1rem; position: relative; z-index: 1; }
.tstep.done .tdot { background: var(--primary-soft); border: 2px solid var(--primary); }
.tstep.now .tdot { background: var(--primary); box-shadow: 0 0 0 5px var(--primary-soft); }
.tstep.now { color: var(--text); font-weight: 700; }

/* ===== v22: Retail First ===== */
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brandlogo { width: 36px; height: 36px; border-radius: 50%; flex: none; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
/* شريط السلة الثابت */
.cartbar { position: fixed; z-index: 18; inset-inline: 10px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px); display: flex; align-items: center; gap: 10px;
  background: var(--primary); color: #fff; text-decoration: none; padding: 12px 16px; border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: .95rem; min-height: 52px; }
.cartbar[hidden] { display: none; }
.cartbar .num { color: #fff; }
.cb-count { background: rgba(255,255,255,.2); padding: 4px 10px; border-radius: 999px; font-weight: 700; }
body.has-cartbar main { padding-bottom: 150px; }
body.has-cartbar .wafab { bottom: calc(var(--tabbar-h) + var(--safe-b) + 76px); }
/* صفحة نجاح الطلب */
.card.success { text-align: center; border: 2px solid var(--primary); background: var(--primary-soft); }
.big-ico { font-size: 3rem; line-height: 1; }
.ordno { font-size: 1.3rem; }
.delinfo { line-height: 1.8; }
.tsbox { min-height: 65px; display: flex; justify-content: center; }
/* شريط الموافقة على أدوات القياس (مش نافذة منبثقة) */
.consent { position: fixed; z-index: 40; inset-inline: 10px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px); display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
/* هيكل التحميل */
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skel-top, .skel-bar, .skel-card > div, .skel-card > i { background: linear-gradient(90deg, var(--line) 25%, color-mix(in srgb, var(--line) 40%, transparent) 50%, var(--line) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: 12px; }
.skel-top { height: 34px; width: 55%; margin: 6px 0 14px; }
.skel-bar { height: 46px; margin-bottom: 12px; }
.skel-card { background: var(--card); border-radius: 14px; padding: 8px; border: 1px solid var(--line); }
.skel-card > div { aspect-ratio: 3 / 4; }
.skel-card > i { display: block; height: 12px; margin-top: 8px; width: 80%; }
.skel-card > i + i { width: 50%; }
@media (prefers-reduced-motion: reduce) { .skel-top, .skel-bar, .skel-card > div, .skel-card > i { animation: none; } }
@media (min-width: 900px) { .cartbar, .consent { inset-inline: auto; left: 50%; transform: translateX(-50%); width: min(620px, 92vw); bottom: 92px; } }
.skel-title { font-size: 1.2rem; margin: 6px 0 14px; color: var(--muted); }

/* زر الوضع الداكن/الفاتح (فوق بالزاوية) */
.themebtn { position: fixed; z-index: 30; top: calc(var(--safe-t) + 10px); inset-inline-end: 12px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); color: var(--text); display: grid; place-items: center; font-size: 1.15rem; box-shadow: 0 2px 8px rgba(0,0,0,.12); cursor: pointer; padding: 0; min-height: 0; }
main > .topbar:first-child, main > h1:first-child, main > .row:first-child, main > .skel-title:first-child { padding-inline-end: 48px; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 1.4rem; font-weight: 800; flex: none; }

/* ===== v23: عارض الصور (تكبير) + المجهر + مصغّرات المعرض ===== */
.gwrap .zoombtn { position: absolute; bottom: 10px; inset-inline-start: 10px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 1.1rem; cursor: zoom-in; display: grid; place-items: center; backdrop-filter: blur(4px); }
.gallery img[data-zi] { cursor: zoom-in; }
.mlens { position: absolute; width: 180px; height: 180px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 6px 24px rgba(0,0,0,.35); pointer-events: none; background-repeat: no-repeat; background-color: #fff; z-index: 3; }
.gthumbs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 2px 2px; scrollbar-width: none; }
.gthumbs::-webkit-scrollbar { display: none; }
.gthumbs button { flex: 0 0 54px; height: 70px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: var(--line); cursor: pointer; display: grid; place-items: center; font-size: 1.2rem; color: var(--ink, #222); }
.gthumbs button.on { border-color: var(--primary); }
.gthumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
body.noscroll { overflow: hidden; }
.zoomv { position: fixed; inset: 0; z-index: 1000; background: #000; color: #fff; display: flex; flex-direction: column; touch-action: none; user-select: none; -webkit-user-select: none; }
.zv-top { display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px; background: linear-gradient(#000c, #0000); position: absolute; inset-inline: 0; top: 0; z-index: 2; }
.zv-title { flex: 1; font-size: .9rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zv-count { font-size: .85rem; opacity: .85; min-width: 3em; }
.zv-x { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 1.2rem; cursor: pointer; }
.zv-stage { flex: 1; display: grid; place-items: center; overflow: hidden; }
.zv-stage img { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; transform-origin: center; will-change: transform; }
.zoomv.zoomed .zv-stage img { cursor: grab; }
.zv-stage video { max-width: 100%; max-height: 100%; }
.zv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 1.8rem; line-height: 1; cursor: pointer; z-index: 2; }
.zv-prev { inset-inline-start: 10px; } .zv-next { inset-inline-end: 10px; }
.zoomv.zoomed .zv-nav, .zoomv.zoomed .zv-hint { opacity: 0; pointer-events: none; }
.zv-hint { position: absolute; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); inset-inline: 0; text-align: center; font-size: .9rem; opacity: .9; transition: opacity .6s; pointer-events: none; }
.zv-hint.gone { opacity: 0; }
@media (hover: none) { .zv-nav { display: none; } }

/* ===== عدّاد الافتتاح ===== */
.lcd { margin: 12px 0; padding: 16px 14px; border-radius: var(--radius); text-align: center; color: #f7e3a6; background: radial-gradient(ellipse at 50% 30%, #1f2a44 0%, #0f1526 60%, #06080e 100%); box-shadow: 0 8px 24px rgba(0,0,0,.18), inset 0 0 0 1px rgba(233,196,106,.35); }
.lcd-t { font-weight: 800; font-size: 1.15rem; }
.lcd-n { display: flex; justify-content: center; gap: 10px; margin: 12px 0 8px; direction: rtl; }
.lcd-n span { min-width: 64px; padding: 8px 4px; border-radius: 12px; background: rgba(233,196,106,.1); border: 1px solid rgba(233,196,106,.45); display: flex; flex-direction: column; align-items: center; }
.lcd-n b { font-size: 1.9rem; line-height: 1.1; font-variant-numeric: tabular-nums; background: linear-gradient(180deg,#fff1c4,#e9c46a 50%,#b8892e); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lcd-n i { font-style: normal; font-size: .78rem; color: #e8dcc4; }
.lcd-s { font-size: .9rem; color: #e8dcc4; }
.lcd.done .lcd-t { font-size: 1.3rem; }
.lcd-w { font-size: .95rem; font-weight: 700; color: #fff; margin-top: 6px; }
.lcd-go { margin-top: 10px; min-height: 42px; background: linear-gradient(180deg,#f7e3a6,#d4a94a); color: #1a1410; border: 0; font-weight: 800; }
.lcd.done .lcd-go { margin-top: 8px; }
.lockbox { text-align: center; padding: 10px; border-radius: 12px; background: var(--line); }
@media (max-width: 600px) {
  .lcd { padding: 12px 10px; margin: 10px 0 8px; }
  .lcd-t { font-size: 1.05rem; }
  .lcd-w { font-size: .85rem; }
  .lcd-n { gap: 8px; margin: 8px 0 4px; }
  .lcd-n span { min-width: 56px; padding: 5px 2px; }
  .lcd-n b { font-size: 1.5rem; }
  .lcd-go { width: 100%; }
  .hero { margin-top: 8px; }
  .hero img, .hero video { aspect-ratio: 16 / 6; }
  .hero span { font-size: .95rem; padding: 8px 12px; line-height: 1.4; }
}
@media (max-width: 600px) {
  .lcd { padding: 10px 10px; }
  .lcd-t { font-size: 1rem; }
  .lcd-w { margin-top: 3px; }
  .lcd-n { margin: 6px 0 2px; }
  .lcd-n span { padding: 3px 2px; min-width: 52px; }
  .lcd-n b { font-size: 1.35rem; }
  .lcd-n i { font-size: .7rem; }
  .lcd-go { margin-top: 8px; min-height: 36px; padding: 6px 12px; font-size: .95rem; }
}

/* ===== البانرات المتقلّبة ===== */
.bslider { position: relative; margin-top: 12px; touch-action: pan-y; }
.bslider .bview { overflow: hidden; border-radius: var(--radius); }
.btrack { display: flex; will-change: transform; }
.btrack .bslide { flex: 0 0 100%; margin: 0; border-radius: 0; }
.bdots { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }
.bdots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); cursor: pointer; transition: width .3s; }
.bdots i.on { width: 20px; border-radius: 4px; background: var(--primary); }
.bnrow { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.bnthumb { width: 132px; flex: 0 0 132px; }
.bnthumb img, .bnthumb video { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; border-radius: 8px; display: block; }
@media (max-width: 600px) { .bslider { margin-top: 8px; } .bnthumb { width: 104px; flex-basis: 104px; } }
.bslider img, .bslider video { -webkit-user-drag: none; user-select: none; pointer-events: none; }
.bslider { user-select: none; -webkit-user-select: none; }
.btn.fbbtn { background: #1877f2; color: #fff; border-color: #1877f2; }

/* ===== 📘 استيراد من فيسبوك ===== */
.fbgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 10px; }
.fbcard { position: relative; padding: 8px; margin: 0; cursor: pointer; display: flex; flex-direction: column; gap: 6px; border: 2px solid transparent; }
.fbcard.on { border-color: var(--primary); }
.fbcard.off { opacity: .55; cursor: default; }
.fbthumbs { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; border-radius: 10px; overflow: hidden; background: var(--line); min-height: 90px; }
.fbthumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.fbthumbs img:only-child { grid-column: 1 / -1; aspect-ratio: 4 / 3; }
.fbcount { position: absolute; bottom: 6px; inset-inline-start: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: .75rem; padding: 2px 8px; border-radius: 999px; }
.fbtext { white-space: pre-line; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.fbchk { position: absolute; top: 12px; inset-inline-end: 12px; width: 24px !important; height: 24px; min-height: 0 !important; }
.fbassign { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 8px 0; }
.fbph { display: flex; flex-direction: column; gap: 4px; }
.fbph img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.fbph.out img { opacity: .3; filter: grayscale(1); }
.fbph select { font-size: .8rem; min-height: 34px; padding: 4px; }
.fbprod { border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.sugg { font-size: .72rem; color: #8a6a1f; background: #fff4d6; border-radius: 6px; padding: 0 6px; font-weight: 600; }

/* ===== 🤖 مساعد المتجر ===== */
.btn.aibtn { background: linear-gradient(90deg,#6d28d9,#2563eb); color: #fff; border: 0; }
.tag.aitag { inset-inline-start: auto; inset-inline-end: 4px; top: 4px; background: #6d28d9; color: #fff; }
.aiv { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.45); display: flex; justify-content: center; align-items: flex-end; }
.aiv-in { background: var(--card, #fff); width: 100%; max-width: 720px; max-height: 94vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 14px 14px 0; }
@media (min-width: 760px) { .aiv { align-items: center; } .aiv-in { border-radius: 18px; } }
.aiv-foot { position: sticky; bottom: 0; background: var(--card, #fff); padding: 10px 0 calc(env(safe-area-inset-bottom, 0px) + 10px); border-top: 1px solid var(--line); margin-top: 10px; }
.airow { padding: 8px 0; border-bottom: 1px solid var(--line); }
.airow.empty { opacity: .65; }
.airow input:not([type=checkbox]), .airow textarea, .airow select { margin-top: 4px; }
.aipair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.aipair figure { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.aipair img { width: 100%; aspect-ratio: 4 / 5; object-fit: contain; background: var(--line); border-radius: 8px; }
.aipair canvas { width: 100%; height: auto; aspect-ratio: 4 / 5; border-radius: 8px; box-shadow: 0 0 0 1px var(--line); cursor: grab; }
.seg.sm button { padding: 4px 10px; font-size: .8rem; min-height: 32px; }

/* ===== 📦 المخزون ===== */
.stockcard { padding: 12px; }
.stockgrid { display: grid; gap: 6px; align-items: center; }
.stockgrid input { min-height: 40px; text-align: center; padding: 6px; }
.stockline { margin-top: 6px; min-height: 1.2em; }
.pcard .tag.soldout, .tag.soldout { background: #6b7280; color: #fff; }
.tagline { color: var(--muted); margin: 2px 0 4px; font-size: .95rem; }

/* ===== 🎬 من فيديو ===== */
.vidjob { align-items: center; gap: 10px; }
.vidthumbs { display: flex; gap: 3px; flex-shrink: 0; }
.vidthumbs img { width: 34px; height: 42px; object-fit: cover; border-radius: 6px; background: var(--line); }
.fbcard .vidbadge { position: absolute; inset-inline-start: 6px; bottom: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: .72rem; padding: 2px 8px; border-radius: 999px; }
.wshide { display: none !important; }

/* ===== 📏 المقاسات ===== */
.szchips .szopt { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.15; min-width: 64px; padding-top: 6px; padding-bottom: 6px; }
.szchips .szopt .szn { font-size: .68rem; color: var(--muted); font-weight: 500; margin-top: 2px; }
.szchips .szopt.on .szn { color: inherit; opacity: .85; }
.szchips .szo { font-size: .7rem; opacity: .7; }
.szpick { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-top: 6px; }
.szpick .chips { max-height: 260px; overflow: auto; }
.szpick .szc { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.15; min-width: 58px; }
.szpick .szc small { font-size: .66rem; opacity: .75; font-weight: 500; }
.szpick .szc.extra { border-style: dashed; }
.sztable { width: 100%; border-collapse: collapse; font-size: .92rem; }
.sztable th, .sztable td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: start; }
.szedit input { min-height: 36px; padding: 4px 8px; }
.szedit .szrow { display: grid; grid-template-columns: 70px 1fr 1fr auto; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.szedit .szrow.hid { opacity: .5; }

/* =====================================================================
   🔤 نظام الخطوط لواجهة المتجر (v27) — هادي وواضح، عربي RTL
   • IBM Plex Sans Arabic: الأساسي  • Tajawal 700: العناوين الرئيسية والبانرات بس  • Inter: الإنجليزي والأرقام اللاتينية
   • بيشتغل بس لما يكون body.typo (للزبون/الزائر، ولوحة الإدارة ما بتتغيّر). الخطوط ما بتنزل إلا لما تنستعمل
   ===================================================================== */
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/plex-ar-400.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/plex-ar-500.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/plex-ar-600.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/plex-ar-700.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/inter-400.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/inter-500.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/inter-600.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/inter-700.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Tajawal'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/tajawal-ar-700.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'Tajawal'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/tajawal-lat-700.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }

body.typo {
  /* الأحجام (متجاوبة: موبايل ← كمبيوتر) */
  --t-xs: .8125rem;                                   /* 13px: أصغر حجم (شارات، ملاحظات) */
  --t-sm: .875rem;                                    /* 14px: نصوص مساعدة، فلاتر */
  --t-base: 1rem;                                     /* 16px: النص الأساسي */
  --t-md: 1.0625rem;                                  /* 17px */
  --t-name: clamp(.9375rem, .9rem + .15vw, 1rem);      /* اسم المنتج بالبطاقة */
  --t-price: clamp(1rem, .95rem + .25vw, 1.125rem);   /* سعر البطاقة */
  --t-price-lg: clamp(1.5rem, 1.3rem + .9vw, 1.875rem);/* سعر صفحة المنتج */
  --t-h2: clamp(1.125rem, 1rem + .5vw, 1.375rem);     /* عناوين الأقسام */
  --t-h1: clamp(1.375rem, 1.15rem + 1vw, 1.875rem);   /* العنوان الرئيسي */
  --f-body: 'Inter', 'IBM Plex Sans Arabic', -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --f-head: 'Tajawal', 'IBM Plex Sans Arabic', 'Inter', -apple-system, 'Segoe UI', Tahoma, sans-serif;
  font-family: var(--f-body); font-size: var(--t-base); font-weight: 400; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-feature-settings: 'tnum' 1;
}
body.typo :where(input, select, textarea, button, .btn) { font-family: var(--f-body); }
/* العناوين الرئيسية والبانرات: Tajawal Bold */
body.typo h1, body.typo .hsec h2, body.typo .lcd-t, body.typo .hero span, body.typo .auth-hero h1 { font-family: var(--f-head); font-weight: 700; line-height: 1.35; letter-spacing: 0; }
body.typo h1 { font-size: var(--t-h1); }
body.typo .topbar h1 { font-size: var(--t-h1); }
body.typo .hsec h2 { font-size: var(--t-h2); }
body.typo h2 { font-size: var(--t-h2); font-weight: 600; line-height: 1.4; }
body.typo h3 { font-size: var(--t-md); font-weight: 600; line-height: 1.45; }
body.typo p, body.typo .fbtext, body.typo .tagline, body.typo .foot, body.typo details { line-height: 1.7; }
body.typo .small, body.typo label { font-size: var(--t-sm); line-height: 1.55; }
body.typo label { font-weight: 500; }
/* بطاقة المنتج */
body.typo .pname { font-size: var(--t-name); font-weight: 500; line-height: 1.5; }
body.typo .pprice { font-size: var(--t-price); font-weight: 600; line-height: 1.4; }
body.typo .pprice .small { font-weight: 400; }
body.typo .pprice s { font-weight: 400; }
body.typo .soldtxt { font-size: var(--t-xs); font-weight: 500; }
body.typo .tag { font-size: var(--t-xs); font-weight: 600; line-height: 1.4; }
/* صفحة المنتج */
body.typo .pinfo .big { font-size: var(--t-price-lg) !important; font-weight: 700; line-height: 1.25; }
body.typo .pinfo .big .small { font-size: var(--t-sm) !important; font-weight: 400; }
body.typo .tagline { font-size: var(--t-base); color: var(--muted); }
body.typo .offerline { font-size: var(--t-sm); font-weight: 600; }
body.typo #sizes .chip, body.typo #colors .chip { font-size: var(--t-base); font-weight: 500; }
body.typo .szchips .szopt .szn { font-size: var(--t-xs); font-weight: 400; }
body.typo .stepper input { font-size: var(--t-md); font-weight: 600; }
/* الأزرار والتصنيفات والفلاتر */
body.typo .btn { font-weight: 600; letter-spacing: 0; }
body.typo .btn.sm { font-size: var(--t-sm); }
body.typo .hscroll .chip { font-size: var(--t-sm); font-weight: 500; }
body.typo .hscroll .chip.on { font-weight: 600; }
body.typo .fbar, body.typo .fpanel, body.typo .sortsel { font-size: var(--t-sm); }
body.typo .fpanel .chip { font-size: var(--t-sm); font-weight: 500; }
body.typo .tabbar a { font-size: .75rem; font-weight: 500; }        /* 12px: شريط التبويب بس */
body.typo .cartbar { font-size: var(--t-base); font-weight: 500; }
body.typo .cartbar b { font-weight: 700; }
/* الأوزان الثقيلة (800) بتنزل لـ 700 بواجهة المتجر */
body.typo .big, body.typo .lcd-t, body.typo .amount-wrap input { font-weight: 700; }
body.typo .lcd-n b, body.typo .lcd-n span b { font-family: 'Inter', var(--f-body); font-weight: 700; }
@media (min-width: 900px) { body.typo { line-height: 1.65; } }
.typobadge { position: fixed; z-index: 60; bottom: calc(var(--tabbar-h) + var(--safe-b) + 74px); inset-inline-start: 12px; background: #1f2937; color: #fff; font-size: .8rem; padding: 6px 14px; border-radius: 999px; text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
body.typo .szchips .szopt .szn, body.typo .szpick .szc small { white-space: nowrap; }
body.typo .szchips .szopt { min-width: 76px; }


/* =====================================================================
   ABU TAIMA v28 — CLEAN RETAIL / CUSTOMER STOREFRONT ONLY
   Toggle in app.js: retail-v28 only for public retail visitors.
   Keeps admin/wholesale screens, business rules and data unchanged.
   ===================================================================== */
body.retail-v28 {
  --bg: #ffffff;
  --card: #ffffff;
  --text: #242424;
  --muted: #666666;
  --line: #e5e5e5;
  --primary: #242424;
  --primary-soft: #f3f3f3;
  --danger: #c62828;
  --radius: 10px;
  background: #fff;
  color: var(--text);
  min-height: 100vh;
}
/* Keep the chosen white retail interface readable even when the phone uses dark mode. */
body.retail-v28 :where(.card) {
  box-shadow: none;
  border-color: var(--line);
  border-radius: 10px;
}
body.retail-v28 :where(.btn) { border-radius: 8px; }
body.retail-v28 .btn.secondary { background: #f3f3f3; color: #242424; }
body.retail-v28 .btn.ghost { background: #fff; color: #242424; }
body.retail-v28 :where(input,select,textarea) { border-radius: 8px; }
body.retail-v28 :where(input,select,textarea):focus-visible,
body.retail-v28 :where(button,a):focus-visible { outline: 2px solid #242424; outline-offset: 3px; }
body.retail-v28 .topbar { padding: 8px 0 13px; border-bottom: 1px solid #ededed; }
body.retail-v28 .topbar h1 { color: #242424; }
body.retail-v28 .hscroll {
  background: #f3f3f3;
  padding-top: 11px;
  padding-bottom: 11px;
  margin-top: 6px;
  margin-bottom: 12px;
  gap: 8px;
}
body.retail-v28 .hscroll .chip,
body.retail-v28 .subchips .chip { border-radius: 7px; }
body.retail-v28 .hscroll .chip.on { background: #242424; color: #fff; border-color: #242424; }
body.retail-v28 .pgrid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px 11px; margin-top: 16px; }
body.retail-v28 .pcard {
  border: 0;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
  box-shadow: none;
  transition: none;
}
body.retail-v28 .pcard:active { transform: none; }
body.retail-v28 .pimg { aspect-ratio: 4/5; background: #f6f6f6; border-radius: 7px; overflow: hidden; }
body.retail-v28 .pimg img { width:100%;height:100%;object-fit:cover; }
body.retail-v28 .pbody { padding: 9px 1px 12px; }
body.retail-v28 .pname { color: #242424; font-weight: 500; line-height: 1.55; }
body.retail-v28 .pprice { color: #242424; font-weight: 600; margin-top: 5px; }
body.retail-v28 .pprice s { color: #777; font-weight: 400; }
body.retail-v28 .tag { background: #c62828; color: #fff; border-radius: 5px; font-size: .75rem; }   /* v30: كان .72rem = 11.52px، رفعناه لـ 12px (الحد الأدنى المعتمد بـ v27) */
body.retail-v28 .tag.off { background: #646464; }
body.retail-v28 .heart { background: rgba(255,255,255,.96); color: #333; box-shadow: none; border: 1px solid rgba(0,0,0,.10); }
body.retail-v28 .heart[aria-pressed=true] { color: #c62828; }
body.retail-v28 .hsec { margin-top: 26px; }
body.retail-v28 .hsec h2 { color: #242424; }
body.retail-v28 .hrow { gap: 13px; }
body.retail-v28 .hrow .pcard { flex-basis: 155px; }
body.retail-v28 .hero { border-radius: 8px; }
body.retail-v28 .hero span { font-weight: 700; }
body.retail-v28 .crumbs a,body.retail-v28 .foot-links a,body.retail-v28 .foot-soc a { color: #242424; }
body.retail-v28 .fbar { margin-top: 18px; }
body.retail-v28 .fpanel { background: #fafafa; border-radius: 8px; padding: 12px; }
body.retail-v28 .sortsel select { border-color: #dedede; background: #fff; font-weight: 500; }
body.retail-v28 .gallery { border-radius: 8px; background: #f6f6f6; }
body.retail-v28 .tabbar { background: rgba(255,255,255,.97); border-color: #e5e5e5; box-shadow: none; }
body.retail-v28 .tabbar a.on { color: #242424; }
body.retail-v28 .cartbar { background: #242424; color: #fff; }
body.retail-v28 .pill:not(.ok):not(.warn):not(.info) { background: #f3f3f3; color: #242424; }
body.retail-v28 .soldtxt { color: #c62828; }
@media (min-width: 560px) {
  body.retail-v28 .pgrid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px 14px; }
  body.retail-v28 .hrow .pcard { flex-basis: 185px; }
}
@media (min-width: 900px) {
  body.retail-v28 main { max-width: 1440px; margin: 0 auto; padding: 20px 36px 120px; }
  body.retail-v28 .pgrid { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 25px 16px; }
  body.retail-v28 .hrow .pcard { flex-basis: 220px; }
  body.retail-v28 .topbar { padding-bottom: 18px; }
  body.retail-v28 .hscroll { border-radius: 6px; }
}
@media (min-width: 1200px) {
  body.retail-v28 .pgrid { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 27px 19px; }
}
@media (prefers-reduced-motion: reduce) {
  body.retail-v28 .pcard { transition: none; }
}


/* =====================================================================
   ABU TAIMA v30 — واجهة تسوق بأسلوب REDTAG
   - زر سلة سريع على صورة كل منتج (نصّه راكب على حافة الصورة)
   - شبكة من حافة الشاشة لحافتها، بفاصل رفيع وصور بدون تدوير (جوال)
   - صفحة منتج: صورة بعرض الشاشة، أزرار عائمة، لوح أبيض فوق الصورة، زر سلة ثابت، بدون شريط تبويبات
   - سلة فاضية بزر «ابدأ التسوق»
   ===================================================================== */
.qadd { position: absolute; bottom: 8px; inset-inline-end: 8px; z-index: 3; width: 36px; height: 36px; min-height: 0; padding: 0; border: 0; border-radius: 50%;
  background: #fff; color: #242424; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.16); cursor: pointer; }
.qadd:active { transform: scale(.92); }
.cartbtn svg { width: 21px; height: 21px; color: #242424; }

body.retail-v28 .pcard { overflow: visible; }
body.retail-v28 .pimg .qadd { bottom: -18px; }
body.retail-v28 .pbody { padding-top: 22px; }
body.retail-v28 .pname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #555; font-weight: 400; }
body.retail-v28 .pprice { font-weight: 700; }
body.retail-v28 .pprice:has(s) { color: #b3261e; }
body.retail-v28 .pimg .heart { width: 32px; height: 32px; font-size: .95rem; background: rgba(243,241,236,.92); border: 0; box-shadow: none; color: #242424; }
@media (max-width: 899px) {
  body.retail-v28 .pgrid { margin-inline: -14px; gap: 20px 2px; }
  body.retail-v28 .pgrid .pcard, body.retail-v28 .pgrid .pimg { border-radius: 0; }
  body.retail-v28 .pgrid .pimg { overflow: visible; background: #f3f1ec; }
  body.retail-v28 .pgrid .pbody { padding-inline: 12px; }
}

/* صفحة المنتج */
.gfloat { display: none; }
body.retail-v28 .gfloat { display: flex; position: absolute; top: 12px; inset-inline: 12px; z-index: 4; gap: 10px; pointer-events: none; }
.gfb { pointer-events: auto; position: relative; width: 44px; height: 44px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: #fff; color: #242424;
  display: grid; place-items: center; box-shadow: 0 1px 6px rgba(0,0,0,.12); text-decoration: none; cursor: pointer; }
.gfb .badge { position: absolute; top: -2px; inset-inline-end: -2px; }
body.retail-v28 .szchips .chip.out span:first-child, body.retail-v28 #colors .chip.out { text-decoration: line-through; }
body.retail-v28 .chip.opt { border-radius: 12px; min-height: 46px; padding: 8px 18px; background: #fff; border: 1px solid #e3e1dc; color: #242424; }
body.retail-v28 .chip.opt.on { border: 1.5px solid #242424; background: #fff; color: #242424; font-weight: 600; }
body.retail-v28 .chip.opt.out { background: #f3f2ef; color: #aaa; border-color: #eceae5; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

@media (max-width: 899px) {
  body.retail-v28.pdp main { padding-top: 0; padding-bottom: calc(110px + var(--safe-b)); }
  body.retail-v28.pdp main > .row:first-child { display: none; }      /* مسار الأقسام */
  body.retail-v28.pdp .pmedia { position: relative; }
  body.retail-v28.pdp .gwrap { margin-inline: -14px; }
  body.retail-v28.pdp .gallery { border-radius: 0; background: #f3f1ec; }
  body.retail-v28.pdp .gallery img, body.retail-v28.pdp .gallery video { aspect-ratio: 4 / 5; }
  body.retail-v28.pdp .gthumbs { display: none; }
  body.retail-v28.pdp .dots { position: absolute; z-index: 3; inset-inline: 0; top: calc(min(100vw, 640px) * 1.25 - 46px); margin: 0; gap: 5px; pointer-events: none; }
  body.retail-v28.pdp .dots i { width: 18px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.55); }
  body.retail-v28.pdp .dots i.on { width: 24px; background: #fff; }
  body.retail-v28.pdp .gwrap .heart.big { top: auto; bottom: 30px; inset-inline-end: 12px; background: #fff; color: #242424; }
  body.retail-v28.pdp .gwrap .zoombtn { bottom: 30px; }
  body.retail-v28.pdp .pinfo > .card:first-child { margin-top: -18px !important; position: relative; z-index: 3; border: 0; border-radius: 18px 18px 0 0; box-shadow: none; padding-top: 18px; }
  body.retail-v28.pdp .pinfo > .card { border-inline: 0; border-radius: 0; margin-inline: -14px; padding-inline: 16px; }
  body.retail-v28.pdp .tabbar { display: none; }
  body.retail-v28.pdp:has(#add)::after { content: ''; position: fixed; z-index: 29; inset-inline: 0; bottom: 0; height: calc(80px + var(--safe-b)); background: #fff; border-top: 1px solid #eee; }
  body.retail-v28.pdp #add { position: fixed; z-index: 30; inset-inline: 16px; bottom: calc(12px + var(--safe-b)); width: auto; min-height: 56px !important; border-radius: 999px;
    background: #23262b; color: #fff; font-size: 1.1rem !important; font-weight: 600; border: 0; box-shadow: none; }
}

/* لوحة الإضافة السريعة */
.qsheet { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; justify-content: flex-end; }
.qs-back { position: absolute; inset: 0; background: rgba(0,0,0,.42); animation: qsfade .2s; }
.qs-panel { position: relative; width: 100%; max-width: 640px; margin: 0 auto; max-height: 85vh; overflow: auto; background: #fff; color: #242424;
  border-radius: 20px 20px 0 0; padding: 10px 16px calc(18px + var(--safe-b)); animation: qsup .22s ease-out; }
.qs-grab { width: 40px; height: 4px; border-radius: 2px; background: #ddd; margin: 0 auto 12px; }
.qs-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.qs-head img { width: 64px; height: 80px; object-fit: cover; border-radius: 8px; background: #f3f1ec; flex: none; }
.qs-name { line-height: 1.5; }
.qs-price { font-weight: 700; margin-top: 2px; }
.qs-price:has(s) { color: #b3261e; }
.qs-price s { color: #888; font-weight: 400; font-size: .85em; }
.qs-x { width: 36px; height: 36px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: #f3f3f3; color: #242424; font-size: 1.3rem; flex: none; }
.qs-lbl { display: block; margin: 6px 0 8px; }
.qs-guide { color: #242424; text-decoration: underline; }
.qsheet .chip.opt { border-radius: 12px; min-height: 46px; padding: 8px 16px; background: #fff; border: 1px solid #e3e1dc; color: #242424; }
.qsheet .chip.opt.on { border: 1.5px solid #242424; font-weight: 600; }
.qsheet .chip.opt.out { background: #f3f2ef; color: #aaa; text-decoration: line-through; }
.qs-add { margin-top: 14px; min-height: 54px; border-radius: 999px; background: #23262b; color: #fff; font-size: 1.05rem; font-weight: 600; border: 0; }
.qs-more { display: block; text-align: center; margin-top: 12px; color: #555; font-size: .9rem; }
body.qs-open { overflow: hidden; }
@keyframes qsup { from { transform: translateY(100%); } to { transform: none; } }
@keyframes qsfade { from { opacity: 0; } to { opacity: 1; } }

/* السلة الفاضية */
.emptycart { text-align: center; padding: 56px 20px 40px; }
.emptycart .ec-ico { width: 96px; height: 96px; border-radius: 50%; background: #f3f1ec; display: grid; place-items: center; margin: 0 auto 18px; color: #242424; }
.emptycart .ec-ico svg { width: 44px; height: 44px; }
.emptycart h2 { margin: 0 0 6px; }
.ec-btn { display: inline-flex; align-items: center; justify-content: center; margin-top: 20px; min-height: 52px; padding: 0 56px; border-radius: 999px; background: #23262b; color: #fff; font-weight: 600; text-decoration: none; }
@media (prefers-reduced-motion: reduce) { .qs-panel, .qs-back, .shake { animation: none; } }
/* v30: بطاقات الصفوف الأفقية كمان بنفس الأسلوب، والزر السريع ما بينقص */
body.retail-v28 .pimg { border-radius: 0; overflow: visible; }
body.retail-v28 .pcard { border-radius: 0; }
body.retail-v28 .hrow .pimg { background: #f3f1ec; }
/* زر الوضع الداكن بيتخبّى بصفحة المنتج (مكانه للسلة العائمة) */
body.retail-v28.pdp .themebtn { display: none; }
/* v30: أيقونات خطية لشريط التبويبات (زبون/زائر)، والأزرار الأساسية حبّة كاملة */
.tabbar .ti.ico { filter: none; opacity: 1; display: grid; place-items: center; height: 26px; }
.tabbar .ti.ico svg { width: 24px; height: 24px; }
body.retail-v28 .tabbar a { color: #8a8a8a; }
body.retail-v28 .tabbar a.on { color: #242424; font-weight: 700; }
body .emptycart .ec-btn, body .qsheet .qs-add { border-radius: 999px; }
body.retail-v28 .pinfo .big:has(s) { color: #b3261e; }
body.retail-v28.pdp .toast { bottom: calc(96px + var(--safe-b)); }
.tabbar .ti.ico { background: none !important; box-shadow: none !important; }
/* v30.1: فواصل مقاسة من REDTAG (لقطة 1320px = 440pt @3x)
   - شبكة المنتجات: فاصل 1pt بين العمودين
   - الصفوف الأفقية: فاصل 1pt، بداية 10pt من الحافة، البطاقة 40% من عرض الشاشة (176pt على 440) عشان تبين الثانية مقطوعة
   - شارة السلة: دائرة غامقة بحلقة بيضاء */
@media (max-width: 899px) {
  body.retail-v28 .pgrid { gap: 20px 1px; }
  body.retail-v28 .hrow { gap: 1px; margin-inline: -14px; padding-inline: 10px 0; scroll-padding-inline: 10px; }
  body.retail-v28 .hrow .pcard { flex: 0 0 40vw; max-width: 260px; }
}
body.retail-v28 #b-cart, body.retail-v28 #b-cart2, body.retail-v28 #b-cart3 { background: #242424; color: #fff; border: 2px solid #fff; min-width: 20px; height: 20px; border-radius: 10px; font-size: .68rem; }
/* v30.1: إصلاح عرض البطاقات بالصفوف الأفقية
   السبب (مثبت بلقطة الموقع الحي): رقم موديل طويل بدون مسافات (ABT-NOV21-FB-825273599) كان يكبّر البطاقة
   لأن عنصر flex ما بيصغر عن أطول كلمة فيه، فصارت البطاقات بعروض وارتفاعات مختلفة */
.pcard, .pbody { min-width: 0; }
.pcard .pcode { overflow-wrap: anywhere; }
body.retail-v28 .pcard .pcode { display: none; }   /* زي REDTAG: رقم الموديل بصفحة المنتج بس */
body.retail-v28 .pbody { overflow: hidden; }

/* =====================================================================
   v31 (ديمو) — بحث فوري + إضافة سريعة محسّنة
   ===================================================================== */
.swrap { position: relative; }
.swrap #q { padding-inline-end: 40px; }
.sclear { position: absolute; top: 50%; inset-inline-end: 8px; transform: translateY(-50%); width: 28px; height: 28px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: #ececec; color: #242424; font-size: 1.1rem; display: grid; place-items: center; }
#sdrop { position: absolute; z-index: 40; inset-inline: 0; top: calc(100% + 6px); background: #fff; color: #242424; border: 1px solid #e5e5e5; border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.14); overflow: hidden; max-height: 70vh; overflow-y: auto; }
#sdrop[hidden] { display: none; }
#sdrop .ri { display: flex; gap: 10px; align-items: center; padding: 8px 10px; text-decoration: none; color: inherit; border-bottom: 1px solid #f1f1f1; }
#sdrop .ri:active, #sdrop .ri:hover { background: #f7f7f5; }
#sdrop .ri img { width: 46px; height: 58px; object-fit: cover; background: #f3f1ec; flex: none; }
#sdrop .rn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sdrop .rn mark { background: #fde68a; color: inherit; border-radius: 3px; padding: 0 1px; }
#sdrop .rp { font-size: .9rem; }
#sdrop .rp s { font-size: .8rem; }
#sdrop .sall { display: block; width: 100%; min-height: 46px; border: 0; background: #f7f7f5; color: #242424; font-weight: 700; font-size: .95rem; }
#sdrop .none { padding: 14px; color: #666; font-size: .92rem; }
.sres { margin: 8px 2px 0; }

.qadd.in { background: #242424; color: #fff; }
.qadd .qn { position: absolute; top: -5px; inset-inline-start: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #b3261e; color: #fff; font-size: .65rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; font-style: normal; }
.qs-val { font-weight: 400; color: #555; }
.qs-off { color: #b3261e; margin-top: 2px; }
.qs-low { color: #b3261e; font-weight: 700; }
.qs-qrow { margin-top: 12px; }
.qs-qrow .stepper { max-width: 150px; }
.qs-sum { margin-top: 12px; padding: 10px 12px; background: #f7f7f5; border-radius: 12px; display: grid; gap: 4px; }
.qsheet .chip.opt small { display: block; font-size: .7rem; color: #b3261e; text-decoration: none; }
#ctoast { position: fixed; z-index: 70; inset-inline: 12px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); max-width: 560px; margin: 0 auto; display: flex; gap: 10px; align-items: center; justify-content: space-between;
  background: #23262b; color: #fff; padding: 12px 14px; border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); transform: translateY(150%); opacity: 0; transition: transform .25s, opacity .25s; pointer-events: none; }
#ctoast.on { transform: none; opacity: 1; pointer-events: auto; }
#ctoast a { color: #fff; font-weight: 700; text-decoration: underline; white-space: nowrap; }
body.pdp #ctoast { bottom: calc(96px + var(--safe-b)); }
.bump { animation: bump .45s; }
@keyframes bump { 30% { transform: scale(1.35); } 60% { transform: scale(.9); } }
@media (prefers-reduced-motion: reduce) { #ctoast { transition: none; } .bump { animation: none; } }
/* v31: زر الوضع الداكن مخفي بشاشات التسوق (التصميم الأبيض ثابت من v28، والزر كان يغطي أيقونة السلة) + منع سحب أفقي */
body.retail-v28 .themebtn { display: none; }
body { overflow-x: clip; }

/* v31b — «تسوّق حسب القسم» بأسلوب REDTAG (مقاس من لقطة 440pt: خلفية #D9D9D9، هامش وفاصل 4pt، 3 بالصف) */
.shopby h2 { margin-bottom: 8px; }
.sbgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; background: #d9d9d9; margin-inline: -14px; }
.sbtile { display: flex; flex-direction: column; min-height: 0; padding: 0; border: 0; border-radius: 0; background: #fff; color: #242424; text-align: start; cursor: pointer; font: inherit; }
.sbtile:active { opacity: .85; }
.sbimg { display: block; aspect-ratio: 20 / 21; overflow: hidden; background: #f3f1ec; }
.sbimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sbcap { display: grid; gap: 1px; padding: 8px 10px 10px; min-width: 0; }
.sbcap b { font-weight: 500; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sboff { color: #b3261e; font-weight: 800; font-size: .85rem; }
.sbnew { color: #242424; font-weight: 700; font-size: .82rem; }
.sbsub { color: #777; font-size: .8rem; }
@media (min-width: 900px) { .sbgrid { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-inline: 0; } }
.pkadmin .list-item { padding-block: 6px; }

/* ===== v33 ===== */
/* شعار وقت التحميل (بيختفي لحاله بعد 6 ثواني لو صار أي إشكال) */
#splash { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: #f6f0e4; transition: opacity .45s ease, visibility .45s; animation: spOut .45s 6s forwards; }
#splash img { width: min(52vw, 220px); height: auto; border-radius: 50%; animation: spIn .7s ease-out both, spPulse 1.8s ease-in-out .7s infinite; }
#splash.out { opacity: 0; visibility: hidden; }
@keyframes spIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
@keyframes spPulse { 50% { transform: scale(1.04); } }
@keyframes spOut { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { #splash img { animation: none; } }
/* نافذة «انضاف للسلة» (نفس شكل لوحة الإضافة السريعة) */
.addsheet { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; justify-content: flex-end; }
.addsheet .as-top { margin: 2px 0 12px; font-size: 1.05rem; }
.addsheet .btn.block { margin-top: 8px; text-decoration: none; display: flex; align-items: center; justify-content: center; }
.addsheet .as-cont { background: #fff; color: #242424; border: 1px solid #242424; }
/* بانر بصورة: نفس طول بانر أبو طعيمة (16:7، وعلى الجوال 16:6)، بس الصورة كاملة بدون قص (الكلام جوّا الصورة)، والفراغ بيتعبّى بنفس الصورة مغبّشة */
.hero.bslide:not(.bvid) { isolation: isolate; background: #f3efe8; }
.hero.bslide:not(.bvid)::before { content: ""; position: absolute; inset: -24px; background: var(--bgi) center / cover no-repeat; filter: blur(20px) saturate(1.1); opacity: .85; z-index: -1; }
.hero.bslide:not(.bvid) img { position: relative; object-fit: contain; }

/* ===== v38: مشاركة على فيسبوك ===== */
.shpick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.shimg { padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: #f3efe8; cursor: pointer; min-height: 0; display: block; }
.shimg img { width: 100%; aspect-ratio: 1200 / 630; object-fit: contain; display: block; }
.shimg.on { border-color: #242424; }
.shprev { border: 1px solid #e3e3e3; border-radius: 10px; overflow: hidden; background: #f0f2f5; }
.shprev img { width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; display: block; }
.shprev div, .shprev b { padding: 4px 10px; display: block; } .shprev b { padding-bottom: 10px; }

/* ===== v39: اختيار عدة صور ===== */
.shpick.prods { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.shpick.prods .shimg img { aspect-ratio: 1; object-fit: cover; }
.shimg { position: relative; }
.shimg .shn { position: absolute; top: 6px; inset-inline-start: 6px; min-width: 24px; height: 24px; border-radius: 12px; background: #242424; color: #fff; font: 700 13px/24px system-ui; font-style: normal; text-align: center; display: none; }
.shimg.on .shn { display: block; }

/* ===== v41: متابعة بفيسبوك ===== */
.fbbtn { background: #1877f2 !important; color: #fff !important; display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; font-weight: 700; min-height: 50px; }
.ordiv { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: #8a8a8a; font-size: .9rem; }
.ordiv::before, .ordiv::after { content: ""; flex: 1; border-top: 1px solid #e6e6e6; }

/* v42 */
.hello { margin: 2px 2px 10px; font-size: .95rem; color: var(--muted, #6b6b6b); }
.hello b { color: var(--text, #222); }
.fbcart { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid #eee; }
#idhint { margin-top: 4px; }
