:root {
  --bg: #F1F4F1;
  --paper: #FFFFFF;
  --ink: #12302A;
  --muted: #56665F;
  --rule: #CFD8D2;
  --stamp: #3A3EC2;
  --mint: #D8EEE3;
  --err: #A3261C;
  --focus: #3A3EC2;
  --ui: "IBM Plex Sans Arabic", system-ui, sans-serif;
  --naskh: "Noto Naskh Arabic", "IBM Plex Sans Arabic", serif;
  --wrap: 1120px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1C19; --paper: #F4F6F3; --ink: #E4ECE8; --muted: #9DB0A8;
    --rule: #2C3E38; --stamp: #9296FF; --mint: #1D3A31; --err: #FF8C80; --focus: #9296FF;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1C19; --paper: #F4F6F3; --ink: #E4ECE8; --muted: #9DB0A8;
  --rule: #2C3E38; --stamp: #9296FF; --mint: #1D3A31; --err: #FF8C80; --focus: #9296FF;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.75 var(--ui);
  -webkit-text-size-adjust: 100%;
}
html[lang="en"] body { line-height: 1.6; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }
.narrow { max-width: 760px; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

.skip { position: absolute; inset-inline-start: 16px; top: -48px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 10; }
.skip:focus { top: 8px; }

/* Header */
.top { border-bottom: 1px solid var(--rule); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.mark { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; font-size: 1.05rem; }
.top-nav { display: flex; align-items: center; gap: 20px; font-size: .95rem; }
.top-nav a { text-decoration: none; color: var(--muted); }
.top-nav a:hover { color: var(--ink); }
.lang { font: inherit; font-weight: 500; color: var(--ink); background: none; border: 1px solid var(--rule); border-radius: 999px; padding: 4px 14px; cursor: pointer; }
.lang:hover { border-color: var(--ink); }
@media (max-width: 640px) { .top-nav a { display: none; } }

/* Hero */
.hero { padding: 48px 0 72px; }
.hero-grid { display: grid; gap: 48px; align-items: start; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 64px; padding-top: 24px; } }
.status { display: inline-block; font-size: .9rem; color: var(--ink); background: var(--mint); padding: 2px 12px; border-radius: 999px; margin-bottom: 20px; }
h1 { font-size: clamp(2rem, 4.4vw, 3.25rem); font-weight: 700; letter-spacing: -0.005em; max-width: 16ch; }
html[lang="en"] h1 { line-height: 1.12; letter-spacing: -0.02em; max-width: 18ch; }
.lede { margin-top: 20px; font-size: 1.12rem; color: var(--muted); max-width: 54ch; }

/* Form */
.join { margin-top: 32px; padding-top: 24px; border-top: 2px solid var(--ink); max-width: 560px; }
.join-title { font-size: 1.15rem; margin-bottom: 16px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .92rem; font-weight: 500; }
input, select, textarea {
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 6px; padding: 10px 12px; width: 100%; min-height: 46px;
}
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { color: #12302A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) input, :root:not([data-theme="light"]) select, :root:not([data-theme="light"]) textarea { color: #12302A; } }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 0; }
input[aria-invalid="true"] { border-color: var(--err); }
.row2 { display: grid; gap: 0 16px; }
@media (min-width: 520px) { .row2 { grid-template-columns: 1fr 1fr; } }
.more { margin: 4px 0 16px; }
.more summary { cursor: pointer; color: var(--muted); font-size: .95rem; padding: 4px 0; }
.more[open] summary { margin-bottom: 12px; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.btn {
  display: inline-block; font: inherit; font-weight: 700; font-size: 1.02rem;
  background: var(--ink); color: var(--bg); border: 2px solid var(--ink); border-radius: 6px;
  padding: 11px 24px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--stamp); border-color: var(--stamp); color: #fff; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.fine { margin-top: 12px; font-size: .86rem; color: var(--muted); max-width: 52ch; }
.msg { margin-top: 12px; font-weight: 500; min-height: 1.5em; }
.msg.ok { color: var(--ink); background: var(--mint); padding: 10px 14px; border-radius: 6px; }
.msg.bad { color: var(--err); }

/* Invoice */
.invoice-stage { margin: 0; }
.invoice {
  position: relative; background: var(--paper); color: #1B2A26; font-family: var(--naskh);
  border: 1px solid #DCE2DE; border-radius: 3px; padding: 28px 28px 24px;
  box-shadow: 0 1px 0 #DCE2DE, 0 24px 48px -28px rgba(18, 48, 42, .45);
  font-size: .95rem; line-height: 1.7;
}
.invoice [lang="en"] { font-family: var(--ui); font-size: .78em; color: #5E6D67; }
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 14px; border-bottom: 2px solid #1B2A26; }
.inv-title { font-size: 1.6rem; font-weight: 700; line-height: 1.3; }
.inv-title-en { font-family: var(--ui); font-size: .9rem; color: #5E6D67; }
#qr { width: 96px; height: 96px; image-rendering: pixelated; flex: none; }
.inv-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin: 14px 0; }
.inv-meta dt { font-size: .82rem; color: #5E6D67; }
.inv-meta dd { margin: 0; font-weight: 700; }
.inv-meta dd .num { font-weight: 400; font-family: var(--ui); font-size: .88rem; }
.inv-items { width: 100%; border-collapse: collapse; margin-top: 4px; }
.inv-items th { font-size: .82rem; font-weight: 400; color: #5E6D67; text-align: start; border-bottom: 1px solid #DCE2DE; padding: 6px 0; }
.inv-items td { padding: 8px 0; border-bottom: 1px solid #EEF1EF; vertical-align: top; }
.inv-items th:not(:first-child), .inv-items td:not(:first-child) { text-align: end; width: 22%; }
.inv-items td.num, .inv-total .num { font-family: var(--ui); }
.inv-total { margin: 12px 0 0; display: grid; gap: 2px; max-width: 300px; margin-inline-start: auto; }
.inv-total div { display: flex; justify-content: space-between; gap: 12px; }
.inv-total dt { font-size: .88rem; }
.inv-total dd { margin: 0; }
.inv-total .grand { border-top: 2px solid #1B2A26; padding-top: 6px; margin-top: 4px; font-weight: 700; font-size: 1.1rem; }
.invoice-stage figcaption { margin-top: 12px; font-size: .86rem; color: var(--muted); }

/* The one moment: the clearance stamp */
.stamp {
  position: absolute; inset-inline-end: 22px; top: 196px;
  display: grid; justify-items: center; line-height: 1.1;
  color: #3A3EC2; border: 3px solid currentColor; border-radius: 10px;
  padding: 10px 22px 8px; transform: rotate(-9deg);
  background: rgba(255, 255, 255, .35);
  animation: stamp 520ms cubic-bezier(.2, 1.4, .4, 1) 700ms both;
}
.stamp::before { content: ""; position: absolute; inset: 3px; border: 1px solid currentColor; border-radius: 7px; opacity: .6; }
.stamp-ar { font-family: var(--naskh); font-weight: 700; font-size: 2rem; }
.stamp-en { font-family: var(--ui); font-weight: 700; font-size: .9rem; letter-spacing: .14em; }
@keyframes stamp {
  0% { opacity: 0; transform: rotate(-3deg) scale(1.6); }
  70% { opacity: .95; transform: rotate(-10deg) scale(.96); }
  100% { opacity: .9; transform: rotate(-9deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) { .stamp { animation: none; } }
@media (max-width: 420px) {
  .invoice { padding: 20px 16px; font-size: .9rem; }
  .inv-meta { grid-template-columns: 1fr; }
  #qr { width: 80px; height: 80px; }
  .stamp { inset-inline-end: 10px; top: 150px; }
}

/* Sections */
section h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 700; max-width: 28ch; }
.how, .pdf, .pricing, .faq { padding: 72px 0; border-top: 1px solid var(--rule); }

.steps { list-style: none; margin: 36px 0 0; padding: 0; counter-reset: s; display: grid; gap: 0; }
@media (min-width: 900px) { .steps { grid-template-columns: repeat(5, 1fr); gap: 24px; } }
.steps li { counter-increment: s; position: relative; padding: 20px 0; border-top: 2px solid var(--ink); }
.steps li::before { content: counter(s); display: block; font-weight: 700; font-size: 1.6rem; color: var(--stamp); line-height: 1; margin-bottom: 12px; }
.steps h3 { font-size: 1.05rem; margin-bottom: 6px; }
.steps p { color: var(--muted); font-size: .95rem; }

.pdf-grid { display: grid; gap: 32px; align-items: center; }
@media (min-width: 900px) { .pdf-grid { grid-template-columns: 1fr 1fr; gap: 64px; } }
.pdf-grid p { margin-top: 16px; color: var(--muted); max-width: 56ch; }
.compare { display: grid; grid-template-columns: 1fr 1fr; background: var(--paper); border: 1px solid var(--rule); border-radius: 3px; color: #1B2A26; }
.cmp-col { padding: 20px; }
.cmp-col + .cmp-col { border-inline-start: 1px solid var(--rule); }
.cmp-label { font-size: .85rem; color: #5E6D67; margin: 0 0 12px !important; }
.broken, .fixed { font-family: var(--naskh); font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.5; margin: 0 !important; color: #1B2A26 !important; }
.broken, .broken span { direction: ltr; unicode-bidi: bidi-override; }
.broken { letter-spacing: .22em; color: #8A4B44 !important; text-align: left; }
.fixed { font-weight: 700; }

.pricing .sub { margin-top: 12px; color: var(--muted); }
.plans { width: 100%; border-collapse: collapse; margin-top: 32px; }
.plans thead th { font-size: .9rem; font-weight: 500; color: var(--muted); text-align: start; padding: 0 0 10px; border-bottom: 2px solid var(--ink); }
.plans tbody th, .plans td { text-align: start; vertical-align: top; padding: 20px 16px 20px 0; border-bottom: 1px solid var(--rule); }
[dir="rtl"] .plans tbody th, [dir="rtl"] .plans td { padding: 20px 0 20px 16px; }
.plans tbody th { font-size: 1.15rem; width: 18%; }
.plans td:nth-child(2) { color: var(--muted); max-width: 52ch; }
.plans td:last-child { width: 28%; }
.plans tr.lead th { color: var(--stamp); }
.price { display: block; font-weight: 700; font-size: 1.1rem; }
.price-note { display: block; font-size: .86rem; color: var(--muted); margin-top: 4px; }
@media (max-width: 720px) {
  .plans thead { display: none; }
  .plans, .plans tbody, .plans tr, .plans th, .plans td { display: block; width: auto !important; }
  .plans tr { border-bottom: 1px solid var(--rule); padding: 16px 0; }
  .plans tbody th, .plans td, [dir="rtl"] .plans tbody th, [dir="rtl"] .plans td { border: 0; padding: 4px 0; }
}

.faq details { border-bottom: 1px solid var(--rule); padding: 16px 0; }
.faq details:first-of-type { margin-top: 24px; border-top: 1px solid var(--rule); }
.faq summary { cursor: pointer; font-weight: 500; font-size: 1.05rem; }
.faq details p { margin-top: 10px; color: var(--muted); max-width: 62ch; }
.again { margin-top: 32px; }

.foot { border-top: 1px solid var(--rule); padding: 32px 0 48px; font-size: .88rem; color: var(--muted); }
.foot p + p { margin-top: 6px; }
