/* ============ الرموز ============ */
:root {
  --ink: #101B33; --slate: #58627A; --paper: #F4F6FA; --surface: #FFFFFF; --line: #DDE2EC; --mist: #EAEEF5;
  --cobalt: #2F4BDB; --cobalt-tint: #E7EBFF;
  --amber: #9A5A00; --amber-tint: #FDEFC7;
  --violet: #6130C9; --violet-tint: #EEE8FD;
  --green: #14783A; --green-tint: #DAF3E2;
  --red: #B3261E; --red-tint: #FCE4E2;
  --slate-tint: #E8ECF3;
  --wa: #1A9F52;
  --accent: var(--cobalt); --on-accent: #fff; --accent-tint: #E7EBFF;
  --r-s: 8px; --r-m: 14px; --r-l: 22px;
  --font: "IBM Plex Sans Arabic", system-ui, "Segoe UI", Tahoma, sans-serif;
  --shadow: 0 1px 2px rgb(16 27 51 / .06), 0 8px 24px -12px rgb(16 27 51 / .18);
  color-scheme: light dark;
}
@supports (color: color-mix(in srgb, red, blue)) {
  :root { --accent-tint: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E9EEF9; --slate: #9AA6BE; --paper: #0C1220; --surface: #141C2E; --line: #27324A; --mist: #1B2438;
    --cobalt: #7D93FF; --cobalt-tint: #1E2A5C;
    --amber: #F2B54B; --amber-tint: #3A2A0A;
    --violet: #B79BFF; --violet-tint: #2A1D55;
    --green: #5BD58B; --green-tint: #11331F;
    --red: #FF8A80; --red-tint: #3D1815;
    --slate-tint: #222C42;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -12px rgb(0 0 0 / .6);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font);
  font-size: 16px; line-height: 1.6; -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { line-height: 1.3; font-weight: 700; }
a { color: inherit; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.ic { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.2em; }
.muted { color: var(--slate); }
.small { font-size: .85rem; }
.num { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.row { display: flex; align-items: center; gap: 10px; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.row-wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ============ أزرار ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1.5px solid transparent;
  font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s; background: var(--mist); color: var(--ink);
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn[aria-busy="true"] { pointer-events: none; opacity: .75; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: var(--mist); }
.btn-soft { background: var(--accent-tint); color: var(--accent); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-soft { background: var(--red-tint); color: var(--red); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .85rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 36px; }
.btn-lg { min-height: 52px; font-size: 1.05rem; padding: 0 26px; border-radius: 14px; }

/* ============ حقول ============ */
.field { display: grid; gap: 6px; }
.field > span { font-size: .88rem; font-weight: 600; }
.field > span small { font-weight: 400; color: var(--slate); }
.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface); outline: none;
}
textarea.input { min-height: 84px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.input[aria-invalid="true"] { border-color: var(--red); background: var(--red-tint); }
.hint { font-size: .8rem; color: var(--slate); }
.err { font-size: .82rem; color: var(--red); min-height: 1em; }
.input-group { display: flex; align-items: stretch; direction: ltr; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.input-group:focus-within { border-color: var(--accent); }
.input-group > .pre { padding: 0 12px; display: grid; place-items: center; background: var(--mist); color: var(--slate); font-size: .85rem; white-space: nowrap; }
.input-group > .input { border: 0; border-radius: 0; box-shadow: none; text-align: left; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .two.keep { grid-template-columns: 1fr 1fr; } .two:not(.keep) { grid-template-columns: 1fr; } }

.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgb(0 0 0 / .3); }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(-18px); }
.switch input:focus-visible + i { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ============ شارات وفلاتر ============ */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--slate-tint); color: var(--slate); white-space: nowrap; }
.tone-amber { background: var(--amber-tint); color: var(--amber); }
.tone-cobalt { background: var(--cobalt-tint); color: var(--cobalt); }
.tone-violet { background: var(--violet-tint); color: var(--violet); }
.tone-green { background: var(--green-tint); color: var(--green); }
.tone-red { background: var(--red-tint); color: var(--red); }
.tone-slate { background: var(--slate-tint); color: var(--slate); }

/* أزرار التصنيفات والفلاتر: خفيفة بصرياً، لكن منطقة اللمس أوسع من شكلها (حوالي 40px) */
.pills { display: flex; gap: 6px; overflow-x: auto; padding: 5px 0; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--slate); cursor: pointer; font-size: .8rem; font-weight: 500; line-height: 1.2; transition: background-color .15s, color .15s, border-color .15s; }
.pill::after { content: ""; position: absolute; inset: -6px -4px; }
.pill:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 28%, var(--line)); }
.pill[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 600; }
.pill b { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; font-size: .7rem; font-weight: 600; line-height: 1; background: color-mix(in srgb, currentColor 14%, transparent); }

/* ============ نوافذ ============ */
dialog.sheet { border: 0; padding: 0; background: var(--surface); color: var(--ink); width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; margin: auto auto 0; border-radius: var(--r-l) var(--r-l) 0 0; overflow: hidden; box-shadow: 0 -10px 40px rgb(0 0 0 / .25); }
dialog.sheet[open] { animation: sheet-in .22s ease-out; display: flex; flex-direction: column; }
dialog.sheet::backdrop { background: rgb(10 16 32 / .55); backdrop-filter: blur(2px); }
.sheet-body { padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
.sheet-title { font-size: 1.15rem; margin-bottom: 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sheet-head .sheet-title { margin: 0; }
@media (min-width: 640px) {
  dialog.sheet { margin: auto; border-radius: var(--r-l); }
  dialog.sheet-sm { max-width: 400px; }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
body:has(dialog[open]) { overflow: hidden; }

.toast-host { position: fixed; inset-inline: 0; bottom: calc(86px + env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 8px; z-index: 9999; pointer-events: none; padding: 0 16px; }
.toast { background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 12px; font-size: .92rem; font-weight: 500; box-shadow: var(--shadow); animation: sheet-in .2s ease-out; max-width: 460px; }
.toast.bad { background: var(--red); color: #fff; }
.toast.good { background: var(--green); color: #fff; }

.skeleton { background: linear-gradient(90deg, var(--mist) 25%, var(--line) 37%, var(--mist) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-m); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.center-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.notice { max-width: 460px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 28px; display: grid; gap: 10px; text-align: center; }
.notice code { background: var(--mist); padding: 2px 8px; border-radius: 6px; font-size: .85em; }
.empty { text-align: center; padding: 44px 20px; display: grid; gap: 10px; justify-items: center; color: var(--slate); }
.empty h3 { color: var(--ink); font-size: 1.1rem; }
.empty .ic { width: 42px; height: 42px; opacity: .55; }

/* ============ تذكرة الطلب + المتتبّع (العنصر المميز) ============ */
.ticket { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.t-head { padding: 14px 16px 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.t-code { font-weight: 700; letter-spacing: .06em; font-size: 1.02rem; direction: ltr; }
.t-time { margin-inline-start: auto; font-size: .8rem; color: var(--slate); }
.t-cut { height: 16px; position: relative; margin: 0 -1px;
  background:
    radial-gradient(circle at 0 50%, var(--paper) 0 7px, var(--line) 7px 8.5px, transparent 8.5px) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 50%, var(--paper) 0 7px, var(--line) 7px 8.5px, transparent 8.5px) right / 51% 100% no-repeat; }
.t-cut::before { content: ""; position: absolute; inset-inline: 14px; top: 50%; border-top: 2px dashed var(--line); }
.t-body { padding: 10px 16px 14px; display: grid; gap: 10px; }
.t-foot { padding: 0 16px 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.t-cust { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.t-cust b { font-size: 1.02rem; }
.t-total { margin-inline-start: auto; font-weight: 700; font-size: 1.1rem; }
.t-items { font-size: .9rem; }
.t-items summary { cursor: pointer; color: var(--slate); padding: 4px 0; }
.t-items ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.t-items li { display: flex; justify-content: space-between; gap: 10px; }
.t-warn { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--red-tint); color: var(--red); font-size: .85rem; font-weight: 600; }
.t-warn .btn { margin-inline-start: auto; }
.t-warn.amber { background: var(--amber-tint); color: var(--amber); }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; padding: 0; list-style: none; }
.steps li { position: relative; text-align: center; font-size: .72rem; color: var(--slate); }
.steps li::before { content: ""; display: block; width: 14px; height: 14px; border-radius: 50%; margin: 0 auto 6px; background: var(--surface); border: 2px solid var(--line); position: relative; z-index: 1; }
.steps li::after { content: ""; position: absolute; top: 6px; inset-inline-start: 50%; width: 100%; height: 2px; background: var(--line); }
.steps li:last-child::after { display: none; }
.steps li.done::before, .steps li.now::before { background: var(--accent); border-color: var(--accent); }
.steps li.done::after { background: var(--accent); }
.steps li.now { color: var(--ink); font-weight: 700; }
.steps li.now::before { box-shadow: 0 0 0 4px var(--accent-tint); }

/* ============ لوحة التحكم ============ */
.shell { min-height: 100dvh; }
.rail { display: none; }
.main { min-width: 0; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo-s { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; background: var(--accent-tint); display: grid; place-items: center; font-weight: 700; color: var(--accent); flex: none; overflow: hidden; }
.logo-s img { width: 100%; height: 100%; object-fit: cover; }
.topbar .name { font-weight: 700; line-height: 1.2; }
.topbar .sub { font-size: .78rem; color: var(--slate); }
.page { max-width: 880px; margin: 0 auto; padding: 16px 16px 24px; display: grid; gap: 14px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.page-head h1 { font-size: 1.35rem; }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; font-size: .92rem; font-weight: 600; background: var(--amber-tint); color: var(--amber); }
.banner.bad { background: var(--red-tint); color: var(--red); }
.banner .btn { margin-inline-start: auto; }

.tabbar { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: grid; justify-items: center; gap: 2px; padding: 8px 2px 7px; text-decoration: none; font-size: .7rem; font-weight: 600; color: var(--slate); position: relative; }
.tabbar a .ic { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 4px 4px; background: var(--accent); }
.badge { position: absolute; top: 4px; inset-inline-start: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--red); color: #fff; font-size: .68rem; display: grid; place-items: center; font-weight: 700; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 240px 1fr; }
  .rail { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh; padding: 20px 14px; background: var(--surface); border-inline-end: 1px solid var(--line); }
  .rail-brand { font-weight: 700; font-size: 1.15rem; padding: 6px 12px 18px; }
  .rail a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; text-decoration: none; font-weight: 600; color: var(--slate); position: relative; }
  .rail a:hover { background: var(--mist); }
  .rail a[aria-current="page"] { background: var(--accent-tint); color: var(--accent); }
  .rail .badge { position: static; margin-inline-start: auto; }
  .rail .spacer { flex: 1; }
  .tabbar { display: none; }
  .tb-out { display: none; }
  .main { padding-bottom: 24px; }
  .toast-host { bottom: 24px; }
  .page { padding-top: 24px; }
}

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; display: grid; gap: 2px; }
.stat b { font-size: 1.35rem; line-height: 1.2; }
.stat span { font-size: .78rem; color: var(--slate); }
.stat small { font-size: .72rem; color: var(--slate); }
@media (max-width: 420px) { .stat b { font-size: 1.1rem; } }

.list { display: grid; gap: 12px; }
.rows { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.rows > * + * { border-top: 1px solid var(--line); }
.row-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.row-item .title { font-weight: 600; line-height: 1.35; }
.row-item .meta { font-size: .82rem; color: var(--slate); }
.thumb { width: 54px; height: 54px; border-radius: 12px; background: var(--mist); object-fit: contain; flex: none; display: grid; place-items: center; color: var(--slate); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-tint); color: var(--accent); font-weight: 700; flex: none; }

.searchbox { position: relative; }
.searchbox .ic { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--slate); }
.searchbox .input { padding-inline-start: 42px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 16px; display: grid; gap: 14px; }
.card > h2 { font-size: 1.02rem; }
.linkbar { display: flex; align-items: center; gap: 8px; background: var(--accent-tint); border-radius: var(--r-m); padding: 10px 12px; }
.linkbar .url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; direction: ltr; text-align: left; color: var(--accent); }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.logo-pick { display: flex; align-items: center; gap: 14px; }
.logo-pick .prev { width: 72px; height: 72px; border-radius: 18px; background: var(--mist); display: grid; place-items: center; overflow: hidden; color: var(--slate); font-weight: 700; font-size: 1.4rem; }
.logo-pick .prev img { width: 100%; height: 100%; object-fit: cover; }
.zone-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 8px; align-items: end; }
@media (max-width: 520px) { .zone-row { grid-template-columns: 1fr 1fr; } .zone-row .field:first-child { grid-column: 1 / -1; } }

.plans { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.plan { border: 2px solid var(--line); border-radius: var(--r-m); padding: 16px; display: grid; gap: 4px; cursor: pointer; background: var(--surface); text-align: start; }
.plan[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-tint); }
.plan b { font-size: 1.5rem; }
.plan .save { font-size: .78rem; font-weight: 700; color: var(--green); }

/* مُعالج الإعداد */
.wiz { max-width: 520px; margin: 0 auto; padding: 24px 18px 40px; display: grid; gap: 18px; }
.dots { display: flex; gap: 6px; }
.dots i { flex: 1; height: 5px; border-radius: 9px; background: var(--line); }
.dots i.on { background: var(--accent); }

/* ============ كتالوج المتجر العام ============ */
.st-head { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.st-top { max-width: 1100px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 12px; }
.st-top .logo-s { width: 40px; height: 40px; border-radius: 12px; }
.st-top h1 { font-size: 1.1rem; line-height: 1.2; }
.st-tools { max-width: 1100px; margin: 0 auto; padding: 0 16px 10px; display: grid; gap: 8px; }
.st-wrap { max-width: 1100px; margin: 0 auto; padding: 14px 16px 120px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; } }
.pc { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); }
/* صندوق الصورة ثابت النسبة: الصور الطولية (علب الأدوية مثلاً) لا تمدّد البطاقة، وتُعرض كاملة داخل الصندوق */
.pc .ph { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #fff; }
.pc .ph img { position: absolute; inset: 0; width: 100%; height: 100%; padding: 4px; object-fit: contain; }
.pc .ph img.cover { padding: 0; object-fit: cover; }
.pc .ph > .ic { position: absolute; inset: 0; width: 34px; height: 34px; margin: auto; color: #aab3c5; }
.pc .info { display: grid; flex: 1; align-content: start; gap: 2px; padding: 8px 10px 10px; }
.pc .nm { display: -webkit-box; min-height: 2.6em; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: .86rem; font-weight: 600; line-height: 1.3; }
.pc .un { color: var(--slate); font-size: .74rem; }
.pc .un:empty { display: none; }
.pc .pr { margin: 2px 0 6px; font-size: 1rem; font-weight: 700; }
.pc .pr small { color: var(--slate); font-size: .72rem; font-weight: 500; }
.pc .info .btn { min-height: 34px; font-size: .86rem; }
.pc .qty button { width: 32px; height: 32px; }
.pc.out .ph img { opacity: .45; filter: grayscale(1); }
.pc .oos { position: absolute; top: 6px; inset-inline-start: 6px; z-index: 1; }
/* عرض القائمة: صف مضغوط لكل صنف، مناسب لقوائم الطعام الطويلة */
.grid.list { grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 900px) { .grid.list { grid-template-columns: 1fr 1fr; } }
.grid.list .pc { flex-direction: row; align-items: center; gap: 10px; padding: 8px; }
.grid.list .ph { flex: none; width: 72px; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; }
.grid.list .info { grid-template-columns: 1fr auto; align-items: center; column-gap: 10px; min-width: 0; padding: 0; }
.grid.list .nm, .grid.list .un, .grid.list .pr { grid-column: 1; min-height: 0; margin: 0; }
.grid.list .info > .btn, .grid.list .info > .qty { grid-column: 2; grid-row: 1 / span 3; width: auto; }
.grid.list .info > .btn { padding-inline: 14px; }
.st-row { display: flex; gap: 8px; }
.st-row .searchbox { flex: 1; }
.st-row .btn-icon { flex: none; width: 40px; min-height: 40px; }
.st-tools .searchbox .input { min-height: 40px; padding-block: 6px; }
.qty { display: flex; align-items: center; justify-content: space-between; background: var(--accent-tint); border-radius: 12px; padding: 3px; }
.qty button { width: 38px; height: 38px; border-radius: 10px; border: 0; background: var(--surface); color: var(--accent); cursor: pointer; display: grid; place-items: center; box-shadow: 0 1px 2px rgb(0 0 0 / .12); }
.qty b { min-width: 28px; text-align: center; font-size: 1.02rem; }
.qty.sm button { width: 32px; height: 32px; }
.cartbar { position: fixed; inset-inline: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30; max-width: 560px; margin-inline: auto; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; background: var(--ink); color: var(--paper); border: 0; border-radius: 18px; box-shadow: 0 12px 30px -8px rgb(0 0 0 / .5); cursor: pointer; width: calc(100% - 24px); text-align: start; }
.cartbar .cnt { background: var(--accent); color: var(--on-accent); min-width: 28px; height: 28px; padding: 0 8px; border-radius: 99px; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.cartbar .tot { font-weight: 700; margin-inline-start: auto; }
.cartbar .go { background: var(--accent); color: var(--on-accent); padding: 9px 16px; border-radius: 12px; font-weight: 700; font-size: .92rem; }
.cart-line { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }
.sumbox { background: var(--mist); border-radius: var(--r-m); padding: 12px 14px; display: grid; gap: 6px; font-size: .92rem; }
.sumbox div { display: flex; justify-content: space-between; }
.sumbox .big { font-size: 1.1rem; font-weight: 700; padding-top: 6px; border-top: 1px dashed var(--line); }
.st-foot { text-align: center; padding: 28px 16px 140px; font-size: .82rem; color: var(--slate); }
.st-foot a { color: var(--accent); font-weight: 600; }
.success { text-align: center; display: grid; gap: 12px; justify-items: center; }
.success .tick { width: 64px; height: 64px; border-radius: 50%; background: var(--green-tint); color: var(--green); display: grid; place-items: center; }
.success .tick .ic { width: 32px; height: 32px; }
.success .code { font-size: 1.6rem; font-weight: 700; letter-spacing: .12em; direction: ltr; background: var(--mist); border-radius: 12px; padding: 4px 16px; }
.hp { position: absolute; inset-inline-start: -9999px; height: 0; overflow: hidden; }

/* ============ الصفحة الرئيسية ============ */
.lp-nav { max-width: 1080px; margin: 0 auto; padding: 14px 18px; display: flex; align-items: center; gap: 10px; }
.lp-brand { font-weight: 700; font-size: 1.25rem; margin-inline-end: auto; display: flex; align-items: center; gap: 10px; text-decoration: none; }
.lp-brand i { width: 30px; height: 30px; border-radius: 9px; background: var(--cobalt); display: grid; place-items: center; color: #fff; }
.lp-hero { max-width: 1080px; margin: 0 auto; padding: 28px 18px 48px; display: grid; gap: 36px; align-items: center; }
.lp-hero h1 { font-size: clamp(2rem, 6.4vw, 3.3rem); line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
.lp-hero p.lead { font-size: 1.12rem; color: var(--slate); margin-top: 14px; max-width: 42ch; }
.lp-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.lp-note { font-size: .85rem; color: var(--slate); margin-top: 12px; }
.lp-mock { max-width: 400px; width: 100%; margin-inline: auto; transform: rotate(-1.6deg); box-shadow: var(--shadow); border-radius: var(--r-m); }
.lp-mock .ticket { --accent: var(--cobalt); }
@media (min-width: 880px) { .lp-hero { grid-template-columns: 1.1fr .9fr; padding-top: 56px; padding-bottom: 72px; } }
.lp-sec { max-width: 1080px; margin: 0 auto; padding: 44px 18px; }
.lp-sec > h2 { font-size: clamp(1.5rem, 4.4vw, 2.1rem); margin-bottom: 22px; }
.lp-how { display: grid; gap: 0; counter-reset: s; border-inline-start: 2px solid var(--line); margin-inline-start: 14px; }
.lp-how li { list-style: none; position: relative; padding: 0 0 26px; padding-inline-start: 28px; }
.lp-how li::before { counter-increment: s; content: counter(s); position: absolute; inset-inline-start: -16px; top: -2px; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.lp-how b { display: block; font-size: 1.08rem; }
.lp-how span { color: var(--slate); }
.lp-feats { display: grid; gap: 4px 36px; grid-template-columns: 1fr; list-style: none; margin: 0; padding: 0; }
@media (min-width: 760px) { .lp-feats { grid-template-columns: 1fr 1fr; } }
.lp-feats li { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.lp-feats .ic { color: var(--cobalt); margin-top: 3px; width: 1.4em; height: 1.4em; }
.lp-feats b { display: block; }
.lp-feats span { color: var(--slate); font-size: .92rem; }
.lp-price { display: grid; gap: 14px; grid-template-columns: 1fr; max-width: 640px; }
@media (min-width: 560px) { .lp-price { grid-template-columns: 1fr 1fr; } }
.price { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-l); padding: 22px; display: grid; gap: 6px; }
.price.hot { border-color: var(--cobalt); }
.price .amt { font-size: 2.2rem; font-weight: 700; line-height: 1.1; }
.price .amt small { font-size: 1rem; font-weight: 500; color: var(--slate); }
.lp-faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.lp-faq summary { cursor: pointer; font-weight: 600; font-size: 1.02rem; }
.lp-faq p { color: var(--slate); margin-top: 8px; }
.lp-foot { border-top: 1px solid var(--line); padding: 26px 18px 40px; text-align: center; color: var(--slate); font-size: .88rem; }
.tabs2 { display: grid; grid-template-columns: 1fr 1fr; background: var(--mist); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.tabs2 button { min-height: 40px; border: 0; background: none; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--slate); }
.tabs2 button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }

/* تحسينات صغيرة بعد المراجعة على الجوال */
.sumbox .big:first-child { border-top: 0; padding-top: 0; }
@media (max-width: 520px) { .lp-cta .btn { width: 100%; } }

@media (max-width: 440px) { .tb-txt { display: none; } }

/* ---------- الإصدار 1.1: أقسام الكتالوج وخيارات الأصناف ---------- */
.pills.wrap { flex-wrap: wrap; overflow: visible; row-gap: 8px; }
.pills.wrap .pill::after { inset: -4px; }
.cat-h { font-size: 1.12rem; margin: 22px 0 10px; padding-inline-start: 10px; border-inline-start: 4px solid var(--accent); line-height: 1.2; }
.cat-sec:first-child .cat-h { margin-top: 4px; }
.sel-bar { position: fixed; inset-inline: 0; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 29; margin: 0 auto; max-width: 560px; width: calc(100% - 24px); background: var(--ink); color: var(--paper); border-radius: 16px; padding: 10px 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; box-shadow: 0 12px 30px -8px rgb(0 0 0 / .5); }
.sel-bar .btn { background: rgb(255 255 255 / .12); color: inherit; min-height: 38px; font-size: .85rem; padding: 0 12px; }
.sel-bar b { margin-inline-end: auto; }
@media (min-width: 900px) { .sel-bar { bottom: 20px; } }
.cat-row { display: flex; align-items: center; gap: 6px; padding: 8px 12px; }
.cat-row .btn-icon.btn-sm { width: 32px; min-height: 32px; border-radius: 9px; }
.cat-row .btn-icon .ic { width: 1.1em; height: 1.1em; }
.cat-row .nm { flex: 1; min-width: 0; font-weight: 600; }
.chk { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.opt-row { display: flex; gap: 8px; align-items: center; }
.tpl { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl .btn { min-height: 30px; padding: 0 12px; font-size: .8rem; font-weight: 500; border-radius: 99px; }

/* ---------- الصفحات القانونية ---------- */
.legal { max-width: 760px; margin: 0 auto; padding: 8px 18px 60px; line-height: 1.9; }
.legal h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); margin: 18px 0 6px; }
.legal h2 { font-size: 1.15rem; margin: 28px 0 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.legal p, .legal li { color: var(--ink); }
.legal ul { padding-inline-start: 22px; margin: 6px 0; }
.legal .meta { color: var(--slate); font-size: .9rem; }
.legal .box { background: var(--accent-tint); border-radius: var(--r-m); padding: 12px 16px; margin: 14px 0; }
.legal .ph { background: var(--amber-tint); color: var(--amber); padding: 0 6px; border-radius: 6px; font-weight: 600; }
.xtra { color: var(--accent); font-size: .85rem; }

/* ============ رمز QR: النافذة واللافتات القابلة للطباعة ============ */
dialog.sheet-qr { max-width: 520px; }
.qr-stage { display: flex; justify-content: center; overflow: hidden; margin-bottom: 14px; padding: 12px; border-radius: var(--r-m); background: color-mix(in srgb, var(--ink) 7%, var(--surface)); }
.qr-stage:focus { outline: none; }
.qr-fit { flex: none; direction: ltr; }
.qr-fit > .qrp, .qr-fit > .qrp-sheet { direction: rtl; box-shadow: 0 1px 8px rgb(16 27 51 / .22); }
.qr-url-line { margin: 4px 0 6px; text-align: center; font-size: .9rem; font-weight: 600; }
.qr-note { margin: 0 0 6px; font-size: .8rem; line-height: 1.6; }
.qr-actions { display: grid; gap: 8px; margin-top: 12px; }
.qr-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* اللافتة: كل القياسات بوحدة --u (1mm في A4) فتتناسب مع A5 بتغيير الوحدة فقط. ألوانها ثابتة لتُطبع كما تُرى. */
.qrp { --u: 1mm; box-sizing: border-box; width: calc(var(--u) * 210); height: calc(var(--u) * 296); padding: calc(var(--u) * 14); display: flex; flex-direction: column; align-items: center; justify-content: space-between; overflow: hidden; background: #fff; color: #101b33; text-align: center; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.qrp-a5 { --u: .705mm; }
.qrp-top { display: flex; align-items: center; gap: calc(var(--u) * 4); max-width: 100%; }
.qrp-logo { flex: none; display: grid; place-items: center; width: calc(var(--u) * 16); height: calc(var(--u) * 16); overflow: hidden; border-radius: calc(var(--u) * 4); background: var(--qa); color: var(--qo); font-size: calc(var(--u) * 9); font-weight: 700; }
.qrp-logo img { width: 100%; height: 100%; object-fit: cover; }
.qrp-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(var(--u) * 8); font-weight: 700; }
.qrp-mid { display: flex; flex-direction: column; align-items: center; }
.qrp-head { margin: 0; font-size: calc(var(--u) * 17); font-weight: 700; line-height: 1.2; }
.qrp-sub { margin: calc(var(--u) * 3) 0 0; color: #58627a; font-size: calc(var(--u) * 6.5); }
.qrp-frame { box-sizing: border-box; width: calc(var(--u) * 150); margin-top: calc(var(--u) * 8); overflow: hidden; border: calc(var(--u) * 4.5) solid var(--qa); border-radius: calc(var(--u) * 7); background: #fff; }
.qrp-frame svg { display: block; width: 100%; height: auto; }
.qrp-steps { counter-reset: qs; display: grid; grid-template-columns: repeat(3, 1fr); gap: calc(var(--u) * 5); width: 100%; margin: 0; padding: 0; list-style: none; }
.qrp-steps li { counter-increment: qs; display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 2.5); font-size: calc(var(--u) * 5.6); line-height: 1.4; }
.qrp-steps li::before { content: counter(qs); display: grid; place-items: center; width: calc(var(--u) * 10); height: calc(var(--u) * 10); border-radius: 50%; background: var(--qa); color: var(--qo); font-size: calc(var(--u) * 6); font-weight: 700; }
.qrp-url { font-size: calc(var(--u) * 5.5); font-weight: 600; }

/* 4 ملصقات في صفحة A4، بخط قص منقّط حول كل واحد */
.qrp-sheet, .qrp-st { --u: 1mm; }
.qrp-sheet { box-sizing: border-box; display: grid; grid-template-columns: repeat(2, 100mm); grid-auto-rows: 100mm; gap: 6mm; justify-content: center; align-content: center; width: 210mm; height: 296mm; background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.qrp-st { box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: space-between; width: 100mm; height: 100mm; padding: 5mm; border: .25mm dashed #9aa3b5; border-radius: 3mm; background: #fff; color: #101b33; text-align: center; }
.qrp-st-head { font-size: 6.5mm; font-weight: 700; line-height: 1.2; }
.qrp-st .qrp-frame { width: 62mm; margin: 0; border-width: 2.2mm; border-radius: 4mm; }
.qrp-st-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #58627a; font-size: 4mm; font-weight: 600; }

#qr-print { display: none; }
@media print {
  html { background: #fff; }
  body.printing-qr > *:not(#qr-print) { display: none !important; }
  body.printing-qr { margin: 0; padding: 0; background: #fff; }
  body.printing-qr #qr-print { display: block; }
  #qr-print .qrp, #qr-print .qrp-sheet { box-shadow: none; page-break-inside: avoid; break-inside: avoid; }
}

/* صفحة الهبوط: وسوم الاستعمال ومعاينة الملصق */
.lp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.lp-tags span { padding: 3px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--slate); font-size: .85rem; }
.lp-qr { display: grid; gap: 30px; align-items: center; }
@media (min-width: 820px) { .lp-qr { grid-template-columns: 1.1fr .9fr; } }
.lp-qr > div > h2 { font-size: clamp(1.5rem, 4.4vw, 2.1rem); margin-bottom: 14px; }
.lp-qr p { margin: 0 0 10px; max-width: 46ch; color: var(--slate); }
.lp-qr-demo { display: flex; justify-content: center; }
.lp-qr-demo .qrp { border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); transform: rotate(1.4deg); }
.lp-qr-demo .qrp-head { font-size: calc(var(--u) * 15); }

/* طرق الدفع */
.pay-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.pay-row .input { grid-column: 1; }
.pay-row .btn-icon { grid-column: 2; grid-row: 1 / span 2; }
.t-pay { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 4px 0; }
.t-pay-note { color: var(--amber); font-size: .82rem; font-weight: 600; }
.pay-row .pay-c { grid-column: 1 / -1; grid-row: 3; display: flex; align-items: center; gap: 6px; color: var(--slate); font-size: .82rem; }
.pay-done { margin: 6px 0 10px; padding: 8px 12px; border-radius: var(--r-s); background: var(--accent-tint); font-size: .92rem; line-height: 1.6; }

/* أرقام الحسابات: عند صاحب المتجر (محرّر) وعند الزبون (قراءة ونسخ) */
.pay-row .pay-accts { grid-column: 1 / -1; grid-row: 4; display: grid; gap: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.acct-list { display: grid; gap: 6px; }
.acct-list:empty { display: none; }
.acct-row { display: grid; grid-template-columns: 1fr 1.2fr auto; gap: 6px; align-items: center; }
@media (max-width: 480px) { .acct-row { grid-template-columns: 1fr auto; } .acct-row [name=an] { grid-column: 1 / -1; } }
.pay-box { display: grid; gap: 8px; margin: 2px 0 6px; }
.pay-box:empty { display: none; }
.pay-hint { color: var(--slate); font-size: .84rem; line-height: 1.6; }
.accts { display: grid; gap: 6px; }
.acct { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); }
.acct-t { display: grid; min-width: 0; gap: 1px; }
.acct-l { color: var(--slate); font-size: .78rem; }
.acct-n { font-size: 1.02rem; font-weight: 700; letter-spacing: .02em; overflow-wrap: anywhere; }
