: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; }

/* =====================================================================
   بانا | BANA — ستايلات وخطوط المتجر
   الستايل: html[data-skin=ivory|olive|plum|pink|peach]   الخط: html[data-font=classic|alexandria|readex|plex|tajawal|kufi|naskh]
   المعتمد بييجي من settings.store_style و settings.store_font، والمعاينة للمدير (أو على الجهاز بوضع المعاينة).
   الخطوط مستضافة مع الموقع (fonts/)، وبيتحمّل بس الخط المستعمل.
   ===================================================================== */
@font-face { font-family: "Bana Alexandria"; src: url("fonts/alexandria.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Bana Readex"; src: url("fonts/readex.woff2") format("woff2"); font-weight: 160 700; font-display: swap; }
@font-face { font-family: "Bana Kufi"; src: url("fonts/kufi.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Bana Naskh"; src: url("fonts/naskh.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Bana Plex"; src: url("fonts/plex-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Bana Plex"; src: url("fonts/plex-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Bana Plex"; src: url("fonts/plex-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Bana Plex"; src: url("fonts/plex-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Bana Tajawal"; src: url("fonts/tajawal-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Bana Tajawal"; src: url("fonts/tajawal-Medium.woff2") format("woff2"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "Bana Tajawal"; src: url("fonts/tajawal-Bold.woff2") format("woff2"); font-weight: 700 800; font-display: swap; }
@font-face { font-family: "Bana Serif"; src: url("fonts/cormorant.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }

/* ---------- الخطوط ---------- */
:root { --fallback: -apple-system, "SF Arabic", "Segoe UI", Tahoma, sans-serif; --fb: "Bana Plex", var(--fallback); --fh: "Bana Naskh", "Bana Plex", serif; --fw: "Bana Serif", Georgia, serif; --fh-w: 700; --body-w: 400; --wm-ar: 2.1rem; }
:root[data-font=classic]    { --fh: "Bana Naskh", serif; --fb: "Bana Plex", var(--fallback); --fw: "Bana Serif", Georgia, serif; --fh-w: 700; }
:root[data-font=alexandria] { --fh: "Bana Alexandria", var(--fallback); --fb: "Bana Alexandria", var(--fallback); --fw: "Bana Alexandria", var(--fallback); --fh-w: 600; --body-w: 300; --wm-ar: 1.9rem; }
:root[data-font=readex]     { --fh: "Bana Readex", var(--fallback); --fb: "Bana Readex", var(--fallback); --fw: "Bana Readex", var(--fallback); --fh-w: 600; --body-w: 300; --wm-ar: 1.95rem; }
:root[data-font=plex]       { --fh: "Bana Plex", var(--fallback); --fb: "Bana Plex", var(--fallback); --fw: "Bana Plex", var(--fallback); --fh-w: 700; }
:root[data-font=tajawal]    { --fh: "Bana Tajawal", var(--fallback); --fb: "Bana Tajawal", var(--fallback); --fw: "Bana Tajawal", var(--fallback); --fh-w: 800; --wm-ar: 2.2rem; }
:root[data-font=kufi]       { --fh: "Bana Kufi", var(--fallback); --fb: "Bana Kufi", var(--fallback); --fw: "Bana Kufi", var(--fallback); --fh-w: 600; --wm-ar: 1.8rem; }
:root[data-font=naskh]      { --fh: "Bana Naskh", serif; --fb: "Bana Naskh", serif; --fw: "Bana Naskh", serif; --fh-w: 700; --wm-ar: 2.2rem; }

/* ---------- الستايلات (ألوان ملف bana-fonts) ---------- */
:root, :root[data-skin=ivory] {
  --bg: #fdf9f7; --card: #ffffff; --text: #532f30; --muted: #8f6f6c; --line: #e9d1cc; --primary: #ae7875; --primary-2: #8f5d5b; --primary-soft: #f8ece9;
  --on-primary: #fff; --head-bg: #fefbfa; --hero: url("banners/bana-gift-ivory.svg"); color-scheme: light;
}
:root[data-skin=olive] {
  --bg: #fbf9f5; --card: #ffffff; --text: #302d20; --muted: #7b7560; --line: #e5d5c0; --primary: #6c6342; --primary-2: #545033; --primary-soft: #f3efe5;
  --on-primary: #fff; --head-bg: #fdfcf9; --hero: url("banners/bana-gift-olive.svg"); color-scheme: light;
}
:root[data-skin=plum] {
  --bg: #fcf8f8; --card: #ffffff; --text: #42152d; --muted: #8a6874; --line: #e7d4d0; --primary: #622f45; --primary-2: #4a2134; --primary-soft: #f6eced;
  --on-primary: #fff; --head-bg: #fefbfb; --hero: url("banners/bana-gift-plum.svg"); color-scheme: light;
}
:root[data-skin=pink] {
  --bg: #fff8fa; --card: #ffffff; --text: #4a2433; --muted: #9a6f80; --line: #f6dbe5; --primary: #c95f86; --primary-2: #a94a6d; --primary-soft: #fdebf1;
  --on-primary: #fff; --head-bg: #ffffff; --hero: url("banners/bana-gift-pink.svg"); color-scheme: light;
}
:root[data-skin=peach] {
  --bg: #fdf8ef; --card: #ffffff; --text: #5a3a2e; --muted: #9b7d70; --line: #efe0cc; --primary: #cf7a5e; --primary-2: #b4624a; --primary-soft: #fdeee5;
  --on-primary: #fff; --head-bg: #fffbf4; --hero: url("banners/bana-gift-peach.svg"); color-scheme: light;
}
/* الفيونكة بلون اللوجو: المطفي بفيونكة #b4842b، واللامع بفيونكة ذهبية لامعة */
:root[data-skin=ivory][data-logo=flat] { --hero: url("banners/bana-gift-ivory-flat.svg"); }
:root[data-skin=olive][data-logo=flat] { --hero: url("banners/bana-gift-olive-flat.svg"); }
:root[data-skin=plum][data-logo=flat] { --hero: url("banners/bana-gift-plum-flat.svg"); }
:root[data-skin=pink][data-logo=flat] { --hero: url("banners/bana-gift-pink-flat.svg"); }
:root[data-skin=peach][data-logo=flat] { --hero: url("banners/bana-gift-peach-flat.svg"); }
:root { --radius: 18px; --card-radius: 16px; --btn-radius: 10px; --shadow: 0 1px 2px rgba(60, 30, 30, .04), 0 6px 18px rgba(60, 30, 30, .06); --danger: #b4443a; }
.themebtn { display: none !important; }

/* ---------- تطبيق عام ---------- */
body { font-family: var(--fb); font-weight: var(--body-w); line-height: 1.6; -webkit-font-smoothing: antialiased; }
b, strong { font-weight: 600; }
h1, h2, .hsec h2, .auth-hero h1 { font-family: var(--fh); font-weight: var(--fh-w); letter-spacing: 0; }
.pname, .pprice, .btn, input, select, textarea, .chip, .tabbar, .cartbar, .big { font-family: var(--fb); }
.pname { font-weight: 500; line-height: 1.5; color: var(--text); }
.pprice { font-weight: 600; color: var(--primary); }
.card { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--card-radius); box-shadow: var(--shadow); }
.btn { background: var(--primary); color: var(--on-primary); font-weight: 600; border-radius: var(--btn-radius); box-shadow: none; }
.btn:active { background: var(--primary-2); }
.btn.secondary { background: var(--primary-soft); color: var(--primary); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: transparent; }
input, select, textarea { border-color: var(--line); background: var(--card); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.hscroll .chip { border-radius: 999px; min-height: 38px; padding: 6px 15px; flex-direction: row; gap: 6px; font-size: .88rem; font-weight: 500; background: var(--card); border-color: var(--line); }
.chip.on { outline: none; border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
.chip.opt.on { background: var(--primary-soft); color: var(--text); border-color: var(--primary); outline: none; }
.tag { background: var(--primary); color: var(--on-primary); font-weight: 500; }
.pill.warn { background: var(--primary-soft); color: var(--text); } .pill.info { background: var(--primary-soft); color: var(--text); }
.banner { background: var(--primary-soft); color: var(--text); border: 1px solid var(--line); }
.linkbtn, a { color: var(--primary); }
.pimg { background: var(--primary-soft); }
.favbtn { color: var(--primary); display: inline-grid; place-items: center; }
.heart { background: color-mix(in srgb, var(--card) 92%, transparent); color: var(--primary); }
.stepper button { background: var(--primary-soft); color: var(--text); }
.qprice { color: var(--primary); font-weight: 600; }
.foot { border-top: 1px solid var(--line); }

/* ---------- الهيدر: «بانا» و BANA تحته ---------- */
.topbar { background: var(--head-bg); margin: -12px -14px 14px; padding: 16px 14px 12px; border-bottom: 1px solid var(--line); position: relative; }
.brand.wordmark { display: flex; flex-direction: column; align-items: center; gap: 0; line-height: 1; margin: 0; color: var(--primary); }
.wm-ar { font-family: var(--fh); font-weight: var(--fh-w); font-size: var(--wm-ar); line-height: 1.15; }
.wm-en { font-family: var(--fw); font-size: .72rem; font-weight: 500; letter-spacing: .38em; margin-top: 2px; padding-inline-start: .38em; color: var(--muted); direction: ltr; }
:root[data-font=classic] .wm-en { font-size: .86rem; font-weight: 600; letter-spacing: .32em; }
/* اللوجو الذهبي (مفرّغ) بنص الهيدر */
.brand.brandmark { display: flex; flex-direction: column; align-items: center; margin: 0; line-height: 1; }
.brand-logo { display: block; aspect-ratio: 1; width: 136px; height: auto; margin: -8px auto -6px; filter: drop-shadow(0 2px 6px rgba(120, 90, 40, .14)); }
.brand-sub { font-family: var(--fh); font-weight: var(--fh-w); font-size: .8rem; color: var(--muted); margin-top: 2px; }
@media (min-width: 700px) { .brand-logo { width: 168px; } .brand-sub { font-size: .9rem; } }
html.is-admin .brand-logo { width: 92px; margin: -6px 0 -4px; } html.is-admin .brand.brandmark { align-items: flex-start; } html.is-admin .brand-sub { display: none; }
html:not(.is-admin) .topbar { justify-content: center; }
html:not(.is-admin) .topbar > .row { position: absolute; inset-inline-end: 14px; top: 50%; transform: translateY(-50%); }

/* ---------- البانر: هدية بشريط بلون الستايل ---------- */
.hero { background: var(--primary-soft); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.hero img[src*="bana-gift-"] { content: var(--hero); }
.hero span { position: static; display: block; background: var(--card); color: var(--text); font-family: var(--fh); font-weight: var(--fh-w); text-align: center; padding: 12px 14px; border-top: 1px solid var(--line); }

/* ---------- شريط التنقّل والسلة ---------- */
.tabbar { background: color-mix(in srgb, var(--head-bg) 94%, transparent); border-top: 1px solid var(--line); }
.tabbar a { color: var(--muted); }
.tabbar a .ti { filter: none; opacity: 1; display: grid; place-items: center; height: 26px; }
.tabbar a .ti svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--primary); font-weight: 600; }
.tabbar a.on .ti svg { stroke-width: 2; }
.tabbar a.fab .fab-plus { background: var(--primary); color: var(--on-primary); }
.cartbar { background: var(--primary); color: var(--on-primary); border-radius: var(--card-radius); }
.cartbar .num { color: inherit; }

/* ---------- كلاسيكي ناعم: فواصل رفيعة ومساحات مريحة ---------- */
:root[data-font=classic] .hsec > .row.between { flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 2px; }
:root[data-font=classic] .hsec > .row.between h2 { display: flex; align-items: center; gap: 14px; margin: 0; font-size: 1.2rem; }
:root[data-font=classic] .hsec > .row.between h2::before, :root[data-font=classic] .hsec > .row.between h2::after { content: ""; width: 44px; height: 1px; background: var(--primary); opacity: .45; }
:root[data-font=classic] .hsec > .row.between h2 .small { display: none; }
:root[data-font=classic] .hsec > .row.between .linkbtn { font-size: .78rem; opacity: .85; }
:root[data-font=classic] .pcard .pimg { margin: 8px 8px 0; border-radius: calc(var(--card-radius) - 6px); overflow: hidden; }
:root[data-font=classic] .pcard .pbody { padding: 12px 12px 14px; }
:root[data-font=classic] .hero { padding: 8px 8px 0; }
:root[data-font=classic] .hero img { border-radius: calc(var(--radius) - 6px); }

/* ---------- صفحة «ستايل وخط المتجر» ---------- */
.stylegrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.stylecard.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.st-thumb { border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; border: 1px solid var(--line); background: var(--primary-soft); }
.st-thumb { position: relative; }
.st-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-btn { position: absolute; inset-inline-start: 10px; bottom: 10px; color: #fff; font-size: .75rem; font-weight: 600; padding: 5px 12px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.st-dots { display: flex; gap: 5px; margin-top: 8px; } .st-dots i { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .12); }
.fontgrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.fontcard { padding: 12px; } .fontcard.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.fc-sample { text-align: center; padding: 8px 0 10px; } .fc-sample .fc-ar { font-size: 1.9rem; line-height: 1.2; color: var(--primary); } .fc-sample .fc-en { font-size: .7rem; letter-spacing: .3em; color: var(--muted); }
.fc-sample p { margin: 4px 0 0; font-size: .9rem; }
.badge-new { font-size: .7rem; background: var(--primary); color: var(--on-primary); padding: 1px 8px; border-radius: 99px; margin-inline-start: 6px; }

/* ---------- شريط معاينة المدير ---------- */
#pvbar { position: fixed; z-index: 60; inset-inline: 8px; top: calc(env(safe-area-inset-top, 0px) + 8px); display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 16px; background: #2b2220; color: #f6ece6; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-family: "Bana Plex", var(--fallback); font-size: .82rem; }
#pvbar .pv-t { display: grid; flex: 1 1 160px; line-height: 1.35; } #pvbar .pv-t span { opacity: .75; font-size: .75rem; }
#pvbar .pv-b { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#pvbar button { min-height: 32px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .2); background: transparent; color: inherit; padding: 4px 10px; font: inherit; cursor: pointer; }
#pvbar .pv-on { background: #f6ece6; color: #2b2220; font-weight: 600; }
body.has-pvbar main { padding-top: 84px; }
@media (max-width: 700px) { #pvbar .pv-w { display: none; } }
html[data-pv-mobile] body { max-width: 420px; margin: 0 auto; min-height: 100vh; box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(0, 0, 0, .18); }
html[data-pv-mobile] { background: #d9d0c8; }
html[data-pv-mobile] .tabbar { max-width: 420px; margin-inline: auto; inset-inline: 0; }
html[data-pv-mobile] .cartbar { inset-inline: 10px; max-width: 400px; margin-inline: auto; }
html[data-pv-mobile] .wafab { inset-inline-end: calc(50% - 196px); }
html[data-pv-mobile] .pdetail { display: block; }
