/* ===== tokens ===== */
:root {
  --ink: #17233b;        /* كحلي الليل — النص والعناوين */
  --paper: #f3f5f8;      /* خلفية باردة */
  --card: #ffffff;
  --tatreez: #a8262e;    /* أحمر التطريز — الأفعال الأساسية */
  --olive: #4e6b3c;      /* زيتوني — النجاح والجاهزية */
  --line: #d8dde6;
  --muted: #5d6879;
  --tint: #f7f8fb;       /* خلفية خفيفة جوّا الكروت */
  --tatreez-soft: #fbe9ea;
  --ink-soft: #e8edf5;
  --olive-soft: #e7efe2;

  /* spacing: one scale for everything */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  /* type: body 17, nothing readable below 14 */
  --t-meta: 14px; --t-small: 15px; --t-body: 17px; --t-lead: 19px; --t-h3: 20px; --t-h2: 28px;
  --t-display: clamp(40px, 6.5vw, 64px);
  --radius-lg: 18px;
  --radius-sm: 10px;
  /* page gutters breathe on wide screens, give width back on phones */
  --gutter: clamp(16px, 4vw, 40px);
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --display: "Reem Kufi", "IBM Plex Sans Arabic", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); color: var(--ink); background: var(--paper);
  font-size: var(--t-body); line-height: 1.7; -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }
.wrap.narrow { max-width: 680px; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--tatreez); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

/* شريط التطريز: صلبان صغيرة متكررة — العنصر المميّز الوحيد */
.stitch {
  height: 14px;
  background:
    linear-gradient(45deg, transparent 42%, var(--tatreez) 42% 58%, transparent 58%) 0 0 / 14px 14px,
    linear-gradient(-45deg, transparent 42%, var(--tatreez) 42% 58%, transparent 58%) 0 0 / 14px 14px;
  opacity: .9;
}

header.site { padding: var(--s5) 0 var(--s4); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }
.brand { font-family: var(--display); font-size: 30px; line-height: 1; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }
.brand img { width: 36px; height: 36px; flex: none; }
.help-link { font-size: var(--t-small); color: var(--muted); }

/* ===== hero ===== */
.hero { padding: var(--s7) 0 var(--s6); max-width: 760px; }
.hero h1 { font-family: var(--display); font-weight: 600; font-size: var(--t-display); line-height: 1.15; margin: 0 0 var(--s3); }
.hero p { margin: 0 0 var(--s5); color: var(--muted); font-size: var(--t-lead); max-width: 32em; }
.search { position: relative; }
.search input {
  width: 100%; font: inherit; font-size: var(--t-lead); padding: 18px 20px;
  border: 2px solid var(--ink); border-radius: var(--radius-sm); background: var(--card); color: var(--ink);
}
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }
.chip {
  font: inherit; font-size: var(--t-small); padding: 8px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.results {
  position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 5;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  box-shadow: 0 12px 28px rgba(23, 35, 59, .12);
}
.results button {
  display: flex; justify-content: space-between; align-items: center; width: 100%; font: inherit; text-align: right;
  padding: 14px var(--s4); border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; color: var(--ink);
}
.results button:last-child { border-bottom: 0; }
.results button:hover { background: var(--tint); }
.results small { color: var(--muted); font-size: var(--t-small); }

/* ===== list + side panel (store and agency portal) ===== */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--s6); align-items: start; }
.split-side { position: sticky; top: var(--s5); }
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; gap: var(--s5); }
  .split-side { position: static; }
}

/* ===== packages: one list, rows divided — not a stack of separate cards ===== */
section.block { padding: var(--s5) 0 var(--s7); }
h2 { font-family: var(--display); font-weight: 600; font-size: var(--t-h2); line-height: 1.3; margin: 0 0 var(--s2); }
.sub { color: var(--muted); margin: 0 0 var(--s5); font-size: var(--t-small); max-width: 36em; }
.plans { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.plan {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px var(--s5);
  width: 100%; padding: 20px var(--s5); background: none; border: 0; border-bottom: 1px solid var(--line);
  border-inline-start: 4px solid transparent;
  cursor: pointer; text-align: right; font: inherit; color: var(--ink);
}
.plan:last-child { border-bottom: 0; }
.plan:hover { background: var(--tint); }
.plan[aria-pressed="true"] { background: var(--tatreez-soft); border-inline-start-color: var(--tatreez); }
.plan .size { font-size: 24px; font-weight: 700; line-height: 1.3; }
.plan .meta { grid-column: 1; color: var(--muted); font-size: var(--t-meta); }
.plan .price { grid-row: 1 / span 2; grid-column: 2; font-size: 24px; font-weight: 700; text-align: left; }
.plan .price small { display: block; font-size: var(--t-meta); font-weight: 400; color: var(--muted); }
.group-title { font-size: var(--t-small); color: var(--muted); margin: var(--s6) 0 var(--s3); }

/* ===== checkout ===== */
.checkout { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s5); }
.checkout.placeholder { color: var(--muted); text-align: center; padding: var(--s6) var(--s5); border-style: dashed; background: transparent; }
.summary-line { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); padding-bottom: var(--s4); border-bottom: 1px dashed var(--line); margin-bottom: var(--s2); font-size: var(--t-lead); }
label { display: block; font-size: var(--t-small); margin: var(--s4) 0 6px; }
label .opt { color: var(--muted); }
input:not([type]), input[type=text], input[type=tel], input[type=email], input[type=search], input[type=number], input[type=password], select, textarea {
  width: 100%; font: inherit; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink);
}
/* Form fields: label above its input, laid out in a grid so rows line up whatever the label length. */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: var(--t-meta); color: var(--muted); }
.field > span b { color: var(--ink); font-weight: 600; }
.check { display: flex; align-items: center; gap: var(--s2); margin: 0; font-size: var(--t-small); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s5); }
@media (max-width: 560px) { .fields { grid-template-columns: 1fr; } }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-soft); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  font: inherit; font-weight: 600; padding: 14px 24px; border-radius: var(--radius-sm); border: 0; cursor: pointer;
  background: var(--tatreez); color: #fff; text-decoration: none; min-height: 48px;
}
.btn:hover { filter: brightness(1.06); }
.btn.block { width: 100%; margin-top: var(--s5); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.btn.ghost:hover { background: var(--tint); filter: none; }
.btn[disabled] { opacity: .55; cursor: wait; }
.error { color: var(--tatreez); font-size: var(--t-small); margin-top: var(--s3); }
.error:empty { display: none; }
.note { font-size: var(--t-meta); color: var(--muted); margin-top: var(--s4); line-height: 1.65; }

/* ===== order ticket ===== */
.ticket { background: var(--card); border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); margin: var(--s5) 0 var(--s7); }
.ticket-head { padding: var(--s6) var(--s6) var(--s4); display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); }
.ticket-head h1 { font-family: var(--display); font-size: 34px; margin: 0 0 var(--s1); line-height: 1.25; }
.ticket-head .ref { color: var(--muted); font-size: var(--t-meta); }
.status { display: inline-block; padding: 5px 14px; border-radius: 999px; font-size: var(--t-meta); font-weight: 600; white-space: nowrap; }
.status.wait { background: var(--tatreez-soft); color: var(--tatreez); }
.status.work { background: var(--ink-soft); color: var(--ink); }
.status.ok { background: var(--olive-soft); color: var(--olive); }
.status.bad { background: var(--tatreez-soft); color: var(--tatreez); }
.perf { border-top: 2px dashed var(--line); position: relative; }
.perf::before, .perf::after {
  content: ""; position: absolute; top: -12px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper);
}
.perf::before { right: -11px; } .perf::after { left: -11px; }
.ticket-body { padding: var(--s6); }
.ticket-body h2 { margin-bottom: var(--s3); }
.ticket-body > p { margin: 0 0 var(--s4); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); margin: 0; }
.facts dt { font-size: var(--t-meta); color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 700; font-size: var(--t-lead); }
.qr { display: grid; place-items: center; padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); margin: var(--s5) auto; width: fit-content; }
.steps { padding-inline-start: 22px; margin: var(--s5) 0; }
.steps li { margin-bottom: var(--s3); }
.manual { background: var(--tint); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px var(--s4); font-size: var(--t-small); }
.manual summary { cursor: pointer; }
.manual code { display: block; direction: ltr; text-align: left; word-break: break-all; font-size: var(--t-meta); margin: 2px 0 var(--s3); user-select: all; }
.bar { height: 10px; background: var(--paper); border-radius: 999px; overflow: hidden; margin: var(--s2) 0 6px; }
.bar > span { display: block; height: 100%; background: var(--olive); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
@media (max-width: 560px) {
  .ticket-head { padding: var(--s5) var(--s4) var(--s3); flex-direction: column; gap: var(--s2); }
  .ticket-head h1 { font-size: 28px; }
  .ticket-body { padding: var(--s5) var(--s4); }
  .facts { gap: var(--s2); }
  .facts dd { font-size: var(--t-body); }
  .checkout { padding: var(--s5) var(--s4); }
  .plan { padding: 18px var(--s4); }
}
footer { padding: var(--s6) 0 var(--s7); color: var(--muted); font-size: var(--t-meta); }
[hidden] { display: none !important; }

/* Shared by the store and the agency portal: a link-looking button, and the 6-digit login code field. */
.linkbtn { background: none; border: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; padding: 0; }
.code-input { font-size: 28px !important; letter-spacing: 10px; text-align: center; }

/* Legal pages (/terms, /privacy, /refund): long text, comfortable to read. */
.legal { padding-bottom: var(--s6); line-height: 1.85; }
.legal h1 { font-family: var(--display); font-weight: 600; font-size: var(--t-h2); margin: var(--s5) 0 var(--s1); }
.legal h2 { font-size: var(--t-h3); margin: var(--s6) 0 var(--s2); }
.legal .updated { color: var(--muted); font-size: var(--t-meta); margin: 0 0 var(--s5); }
.legal ul { padding-inline-start: 1.2em; margin: 0; }
.legal li + li { margin-top: var(--s2); }
.legal-links a { color: var(--muted); }
