/* ==========================================================================
   Store UI - one token layer, mobile-first, RTL.
   ========================================================================== */
:root {
  --font-body: "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-display: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;

  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #efece4;
  --ink: #16181d;
  --ink-2: #4a4f5a;
  --line: #e2ded4;
  --line-strong: #c9c3b6;
  --accent: #c8f23c;
  --accent-hover: #b6e123;
  --accent-ink: #16181d;
  --hero-bg: #16181d;
  --hero-ink: #f7f5f0;
  --hero-ink-2: #b9bcc3;
  --focus: #2952cc;

  --ok: #067647;   --ok-bg: #e3f6ec;
  --warn: #93370d; --warn-bg: #fdf0e1;
  --bad: #b42318;  --bad-bg: #fdecea;
  --info: #1d4ed8; --info-bg: #e7eefe;
  --muted-bg: #ecebe7;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
  --radius-s: 8px; --radius-m: 12px; --radius-l: 20px; --radius-pill: 999px;
  --text-xs: 0.8125rem; --text-s: 0.875rem; --text-m: 1rem; --text-l: 1.125rem;
  --text-xl: 1.5rem; --text-display: 2.5rem;
  --shadow-pop: 0 8px 24px rgba(22, 24, 29, 0.10);
  --dur: 160ms;
  --container: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1114;
    --surface: #171a1f;
    --surface-2: #1f232a;
    --ink: #eef0f3;
    --ink-2: #a3a9b4;
    --line: #2a2f37;
    --line-strong: #3a414c;
    --hero-bg: #1b1f16;
    --focus: #84adff;
    --ok: #47cd89;   --ok-bg: #0f2a1d;
    --warn: #fdb022; --warn-bg: #2e2109;
    --bad: #f97066;  --bad-bg: #331512;
    --info: #84adff; --info-bg: #13203d;
    --muted-bg: #23272e;
    --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.45);
  }
  .stat-lead, .hero { box-shadow: inset 0 0 0 1px rgb(200 242 60 / 0.22); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: var(--text-m); line-height: 1.65;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0; letter-spacing: 0; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-l); }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; text-align: right; }
.muted { color: var(--ink-2); }
.small { font-size: var(--text-s); }
.xs { font-size: var(--text-xs); }
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--space-4); }
.stack > * + * { margin-top: var(--space-4); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i-s { width: 16px; height: 16px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-s); }
.skip { position: absolute; inset-inline-start: var(--space-2); top: -60px; z-index: 50; background: var(--surface); padding: var(--space-2) var(--space-4); border-radius: var(--radius-s); }
.skip:focus { top: var(--space-2); }

/* ---------------------------------------------------------------- header */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .container { display: flex; align-items: center; gap: var(--space-2); min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); font-family: var(--font-display); font-weight: 700; font-size: var(--text-l); text-decoration: none; white-space: nowrap; flex: none; }
.brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (min-width: 340px) { .topbar:not(:has(.balance-chip)) .brand-name { position: static; width: auto; height: auto; overflow: visible; clip: auto; } }
@media (min-width: 400px) { .brand-name { position: static; width: auto; height: auto; overflow: visible; clip: auto; } }
.brand-mark { width: 32px; height: 32px; border-radius: var(--radius-s); background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.topbar .spacer { flex: 1; }
.balance-chip { flex: none; display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-pill); text-decoration: none; font-weight: 700; font-size: var(--text-s); }
.balance-chip:hover { border-color: var(--line-strong); background: var(--surface-2); }
.icon-btn { flex: none; position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-pill); border: 1px solid transparent; background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { background: var(--line); }
.dot-count { position: absolute; top: 6px; inset-inline-end: 6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--radius-pill); background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.nav-platforms { border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.nav-platforms::-webkit-scrollbar { display: none; }
.nav-platforms ul { list-style: none; margin: 0; padding: 0 var(--space-4); display: flex; gap: var(--space-1); max-width: var(--container); margin-inline: auto; }
.nav-platforms a { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-3); white-space: nowrap; text-decoration: none; font-size: var(--text-s); color: var(--ink-2); border-bottom: 2px solid transparent; min-height: 44px; }
.nav-platforms a:hover { color: var(--ink); }
.nav-platforms a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 700; }
.hide-s { display: none; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 44px; padding: var(--space-2) var(--space-5); border-radius: var(--radius-pill); border: 1px solid transparent; font: inherit; font-weight: 700; font-size: var(--text-m); text-decoration: none; cursor: pointer; transition: background-color var(--dur), border-color var(--dur), transform var(--dur); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn[aria-busy="true"] { cursor: progress; opacity: 0.8; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ink { background: var(--ink); color: var(--bg); }
.btn-ink:hover { background: var(--ink-2); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-s { min-height: 36px; padding: var(--space-1) var(--space-4); font-size: var(--text-s); }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------- forms */
.field { display: grid; gap: var(--space-2); }
.field label, .label { font-weight: 700; font-size: var(--text-s); }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field textarea {
  width: 100%; min-height: 48px; padding: var(--space-3) var(--space-4); font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-m);
  transition: border-color var(--dur);
}
.field textarea { min-height: 120px; resize: vertical; }
.input:hover, .field input:hover, .field textarea:hover { border-color: var(--ink-2); }
.input:focus, .field input:focus, .field textarea:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.input:disabled { background: var(--surface-2); cursor: not-allowed; }
.field .help { font-size: var(--text-xs); color: var(--ink-2); }
.field .errorlist, .errorlist { list-style: none; margin: 0; padding: 0; color: var(--bad); font-size: var(--text-s); }
.field.has-error input, .field.has-error textarea { border-color: var(--bad); }
.check { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }
.choice-grid { display: grid; gap: var(--space-2); }
.choice { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4); border: 1px solid var(--line-strong); border-radius: var(--radius-m); background: var(--surface); cursor: pointer; }
.choice:hover { border-color: var(--ink-2); }
.choice input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--ink); }
.choice:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------------------------------------------------------------- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: var(--space-5); }
.section { padding-block: var(--space-7); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }
.badge { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px var(--space-3); border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: 700; white-space: nowrap; }
.tone-ok { color: var(--ok); background: var(--ok-bg); }
.tone-warn { color: var(--warn); background: var(--warn-bg); }
.tone-bad { color: var(--bad); background: var(--bad-bg); }
.tone-info { color: var(--info); background: var(--info-bg); }
.tone-muted { color: var(--ink-2); background: var(--muted-bg); }
.tone-accent { color: var(--accent-ink); background: var(--accent); }

.flash-wrap { display: grid; gap: var(--space-2); margin-top: var(--space-4); }
.flash { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-m); border: 1px solid currentColor; font-weight: 500; }
.flash p { color: var(--ink); }

/* ---------------------------------------------------------------- hero */
.hero { background: var(--hero-bg); color: var(--hero-ink); padding-block: var(--space-6); }
.hero h1 { font-size: var(--text-display); max-width: 18ch; }
.hero h1 mark { background: none; color: var(--accent); }
.hero .lede { color: var(--hero-ink-2); max-width: 46ch; margin-top: var(--space-4); font-size: var(--text-l); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-5); }
.hero .btn-ghost { color: var(--hero-ink); border-color: #4a4f5a; }
.hero .btn-ghost:hover { background: #262a31; }
.hero-grid { display: grid; gap: var(--space-6); }
.hero-proof { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); margin-top: var(--space-6); max-width: 420px; }
.hero-proof b { display: block; font-family: var(--font-display); font-size: var(--text-xl); }
.hero-proof span { color: var(--hero-ink-2); font-size: var(--text-s); }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-3); counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 40px 1fr; gap: var(--space-3); align-items: start; padding: var(--space-2) 0; }
.steps li::before { content: counter(s); width: 32px; height: 32px; border-radius: var(--radius-pill); display: grid; place-items: center; background: transparent; border: 1px solid var(--accent); color: var(--accent); font-weight: 700; }
.steps b { display: block; }
.steps span { color: var(--hero-ink-2); font-size: var(--text-s); }

/* ---------------------------------------------------------------- platforms + services */
.platform-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.platform-tile { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); text-decoration: none; font-weight: 700; min-height: 64px; transition: border-color var(--dur); }
.platform-tile:hover { border-color: var(--ink); }
.platform-tile .glyph { width: 40px; height: 40px; border-radius: var(--radius-s); display: grid; place-items: center; background: var(--surface-2); }

.svc-list { display: grid; gap: var(--space-2); }
.svc-row { display: grid; grid-template-columns: 40px 1fr; gap: var(--space-3); align-items: center; padding: var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); text-decoration: none; transition: border-color var(--dur); }
.svc-row:hover { border-color: var(--ink); }
.svc-row .glyph { width: 40px; height: 40px; border-radius: var(--radius-s); display: grid; place-items: center; background: var(--surface-2); }
.svc-row .name { font-weight: 500; overflow-wrap: anywhere; }
.svc-row .meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-top: var(--space-1); font-size: var(--text-s); color: var(--ink-2); }
.price { font-weight: 700; color: var(--ink); }
.cat-block + .cat-block { margin-top: var(--space-6); }
.cat-block h2 { margin-bottom: var(--space-3); font-size: var(--text-l); }

/* ---------------------------------------------------------------- service page */
.svc-layout { display: grid; gap: var(--space-5); padding-block: var(--space-6); }
.svc-title { font-size: var(--text-xl); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin-inline: 0; margin-bottom: 0; }
.facts div { padding: var(--space-3); background: var(--surface-2); border-radius: var(--radius-m); }
.facts dt { font-size: var(--text-xs); color: var(--ink-2); }
.facts dd { margin: 0; font-weight: 700; }
.desc { white-space: pre-line; color: var(--ink-2); }
.order-card { position: relative; }
.total-line { display: flex; justify-content: space-between; align-items: baseline; padding-block: var(--space-4); border-block: 1px solid var(--line); }
.total-line b { font-family: var(--font-display); font-size: var(--text-xl); }
.drip { display: none; gap: var(--space-3); grid-template-columns: 1fr 1fr; }
.drip.open { display: grid; }
.review { padding-block: var(--space-3); border-bottom: 1px solid var(--line); }
.stars { display: inline-flex; gap: 2px; color: var(--warn); }
.stars .i { width: 14px; height: 14px; fill: currentColor; }

/* ---------------------------------------------------------------- account */
.acct-head { padding-block: var(--space-6) var(--space-4); }
.stat-row { display: grid; gap: var(--space-3); }
.stat-lead { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--space-4); padding: var(--space-5); border-radius: var(--radius-l); background: var(--hero-bg); color: var(--hero-ink); }
.stat-lead .label { color: var(--hero-ink-2); font-weight: 500; }
.stat-lead .value { font-family: var(--font-display); font-size: var(--text-display); line-height: 1; margin-top: var(--space-2); }
.stat-minor { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.stat-minor div { padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.stat-minor b { display: block; font-size: var(--text-l); }
.tabs { display: flex; gap: var(--space-1); overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-top: var(--space-5); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-3); min-height: 44px; white-space: nowrap; text-decoration: none; color: var(--ink-2); border-bottom: 2px solid transparent; font-size: var(--text-s); }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 700; }
.acct-body { padding-block: var(--space-5) var(--space-8); }
.filters { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.filters form { display: flex; gap: var(--space-2); flex: 1 1 240px; min-width: 0; }
.filters .input { flex: 1; min-width: 0; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-pill); text-decoration: none; font-size: var(--text-s); }
.chip:hover { background: var(--surface-2); }
.chip[aria-current="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.order { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: var(--space-4); }
.order + .order { margin-top: var(--space-3); }
.order-top { display: flex; gap: var(--space-3); align-items: flex-start; justify-content: space-between; }
.order-top > div { min-width: 0; }
.order-top h3 { font-size: var(--text-m); font-family: var(--font-body); font-weight: 700; overflow-wrap: anywhere; }
.order-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2) var(--space-4); margin: var(--space-4) 0 0; font-size: var(--text-s); }
.order-grid dt { color: var(--ink-2); }
.order-grid dd { margin: 0; font-weight: 700; }
.order-link { display: inline-flex; align-items: center; gap: var(--space-1); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--info); font-size: var(--text-s); direction: ltr; }
.progress { height: 6px; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; margin-top: var(--space-3); }
.progress span { display: block; height: 100%; background: var(--ink); }
.order-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }
details.inline-form summary { list-style: none; }
details.inline-form summary::-webkit-details-marker { display: none; }
details.inline-form[open] { flex-basis: 100%; }
details.inline-form form { margin-top: var(--space-3); display: grid; gap: var(--space-3); }
.rating-pick { display: flex; gap: var(--space-2); }
.rating-pick label { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line-strong); border-radius: var(--radius-m); cursor: pointer; font-weight: 700; }
.rating-pick input { position: absolute; opacity: 0; }
.rating-pick label:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.rating-pick label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: var(--text-s); }
th, td { padding: var(--space-3) var(--space-4); text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--ink-2); font-weight: 500; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
.amount-pos { color: var(--ok); }
.amount-neg { color: var(--ink); }

.empty { text-align: center; padding: var(--space-7) var(--space-4); border: 1px dashed var(--line-strong); border-radius: var(--radius-l); }
.empty h3 { margin-bottom: var(--space-2); }
.empty .btn { margin-top: var(--space-4); }

.pager { display: flex; justify-content: center; align-items: center; gap: var(--space-3); margin-top: var(--space-5); }
.msg { padding: var(--space-4); border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--surface); }
.msg.staff { background: var(--surface-2); }
.msg header { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--ink-2); margin-bottom: var(--space-2); }
.msg + .msg { margin-top: var(--space-3); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--text-s); background: var(--surface-2); padding: var(--space-3); border-radius: var(--radius-s); overflow-x: auto; direction: ltr; text-align: left; white-space: pre; }
.key-box { display: flex; gap: var(--space-2); align-items: center; }
.key-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- auth */
.auth { min-height: calc(100vh - 160px); display: grid; place-items: center; padding-block: var(--space-7); }
.auth .card { width: 100%; max-width: 420px; }
.auth h1 { font-size: var(--text-xl); margin-bottom: var(--space-2); }

/* ---------------------------------------------------------------- faq + footer */
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding-block: var(--space-4); cursor: pointer; font-weight: 700; list-style: none; min-height: 44px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .i { transition: transform var(--dur); }
.faq details[open] summary .i { transform: rotate(45deg); }
.faq details p { padding-bottom: var(--space-4); color: var(--ink-2); max-width: 70ch; }
.footer { border-top: 1px solid var(--line); padding-block: var(--space-6); margin-top: var(--space-7); font-size: var(--text-s); color: var(--ink-2); }
.footer nav { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin-top: var(--space-3); }
.footer a { text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.footer a:hover { color: var(--ink); text-decoration: underline; }
.prose h2 { margin-top: var(--space-6); margin-bottom: var(--space-3); }
.prose p, .prose li { color: var(--ink-2); max-width: 72ch; }

/* ---------------------------------------------------------------- wider screens */
@media (min-width: 640px) {
  .hide-s { display: inline-flex; }
  .platform-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat-row { grid-template-columns: 2fr 1fr; align-items: stretch; }
  .stat-minor { grid-template-columns: 1fr; }
  .order-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .choice-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 960px) {
  :root { --text-display: 3.25rem; }
  .hero { padding-block: var(--space-7) var(--space-8); }
  .steps li { padding: var(--space-4); border: 1px solid #2c3038; border-radius: var(--radius-m); }
  .hero-grid { grid-template-columns: 1.3fr 1fr; align-items: center; }
  .platform-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .svc-layout { grid-template-columns: 1.15fr 1fr; align-items: start; }
  .order-card { position: sticky; top: 132px; grid-row: span 2; }
  .svc-list.two { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
