/* Components shared by the site and the admin panel. Colours only via tokens.css.
   Every component is shown on /admin/design. */

/* =========================================================== icons */
.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 1em; height: 1em; }
.icon-lg { width: 1.5em; height: 1.5em; }
.icon-xl { width: 2rem; height: 2rem; stroke-width: 1.75; }
.icon-gold { color: var(--gold); }

/* =========================================================== brand */
.brand { display: inline-flex; align-items: center; gap: var(--sp-3); }
.brand-mark { width: 40px; height: 40px; object-fit: contain; }
.brand-name {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: var(--fs-18);
  line-height: 1;
  letter-spacing: .08em;
  color: var(--silver);
  direction: ltr;
  white-space: nowrap;
}
.brand-name b { color: var(--gold); font-weight: 800; }
.brand-sub { display: block; margin-top: 4px; font-size: var(--fs-12); color: var(--text-faint); letter-spacing: 0; font-weight: 500; }

/* =========================================================== buttons */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-border: var(--border-strong);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--touch);
  padding: 0 var(--sp-5);
  border: 1px solid var(--btn-border);
  border-radius: var(--r-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  font-size: var(--fs-16);
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease),
              color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease),
              transform var(--dur-1) var(--ease);
}
.btn:hover { --btn-bg: var(--surface-3); --btn-border: var(--border-hover); }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

.btn-primary {
  --btn-bg: var(--gold);
  --btn-fg: var(--on-gold);
  --btn-border: transparent;
  font-weight: 700;
}
.btn-primary:hover { --btn-bg: var(--gold-hover); --btn-border: transparent; }
.btn-primary:active { --btn-bg: var(--gold-press); }

.btn-outline { --btn-bg: transparent; --btn-fg: var(--gold); --btn-border: var(--gold-line); }
.btn-outline:hover { --btn-bg: var(--gold-soft); --btn-border: var(--gold); }

.btn-ghost { --btn-bg: transparent; --btn-fg: var(--text-muted); --btn-border: transparent; }
.btn-ghost:hover { --btn-bg: var(--surface-2); --btn-fg: var(--text); --btn-border: transparent; }

.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-border: var(--danger-line); }
.btn-danger:hover { --btn-bg: var(--danger-soft); --btn-border: var(--danger); }

.btn-success { --btn-bg: var(--success-soft); --btn-fg: var(--success); --btn-border: var(--success-line); }
/* Google's own button rules: neutral button + the official "G" (static/brand/google-g.svg) */
.btn-google > img { width: 20px; height: 20px; flex: none; }
.btn-success:hover { --btn-bg: var(--success-soft); --btn-border: var(--success); }

.btn-sm { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-14); }
.btn-lg { min-height: 52px; padding: 0 var(--sp-6); font-size: var(--fs-18); border-radius: var(--r-md); }
.btn-block { width: 100%; }
.btn-icon { width: var(--touch); padding: 0; }
.btn-icon.btn-sm { width: 36px; }
@media (pointer: coarse) {
  .btn-sm { min-height: var(--touch); }
  .btn-icon.btn-sm { width: var(--touch); }
}

.btn.is-loading { color: transparent; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--btn-fg);
  border-inline-end-color: transparent;
  animation: ds-spin .7s linear infinite;
}

/* =========================================================== forms */
/* minmax(0, 1fr): a wide input inside (its intrinsic size) never pushes the field past its card */
.field { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--sp-2); min-width: 0; }
.label { font-size: var(--fs-14); font-weight: 600; color: var(--text); }
.label .req { color: var(--danger); margin-inline-start: 2px; }
.label .opt { color: var(--text-faint); font-weight: 400; }
.hint { font-size: var(--fs-13); color: var(--text-faint); }
.error-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-14);
  color: var(--danger);
}
.error-text .icon { width: 16px; height: 16px; }

.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-16); /* 16px stops iOS from zooming on focus */
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-hover); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: var(--ring); outline: none; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus, .textarea[aria-invalid="true"]:focus { box-shadow: var(--ring-danger); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: .55; cursor: not-allowed; }
.input[readonly] { background: var(--surface-1); color: var(--text-muted); }
.textarea { min-height: 120px; padding: var(--sp-3) var(--sp-4); resize: vertical; line-height: var(--lh-body); }

.select-wrap { position: relative; }
.select { appearance: none; padding-inline-end: 44px; cursor: pointer; }
.select-wrap > .icon {
  position: absolute;
  inset-inline-end: 14px;
  top: 50%;
  translate: 0 -50%;
  color: var(--text-faint);
  pointer-events: none;
}

/* input with a fixed prefix/suffix, e.g. "@" before a Telegram username */
.affix {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 48px;
  padding-inline: var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.affix:hover { border-color: var(--border-hover); }
.affix:focus-within { border-color: var(--gold); box-shadow: var(--ring); }
.affix[aria-invalid="true"] { border-color: var(--danger); }
.affix > .affix-text { color: var(--text-faint); font-weight: 600; }
.affix > input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: var(--fs-16);
  outline: none;
}
.affix > input::placeholder { color: var(--text-faint); }

/* 6-digit code: one real input (paste and SMS/e-mail autofill keep working) */
.input-otp {
  min-height: 64px;
  padding-inline-start: .6em;
  font-family: var(--font-head);
  font-size: var(--fs-28);
  font-weight: 700;
  letter-spacing: .6em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}
.input-otp::placeholder { letter-spacing: .6em; }

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  min-height: var(--touch);
  padding-block: 10px;
  cursor: pointer;
}
.check > input {
  appearance: none;
  flex: none;
  display: grid;
  place-content: center;
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  border: 1.5px solid var(--border-hover);
  border-radius: 6px;
  background: var(--surface-2);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.check > input[type="radio"] { border-radius: 50%; }
.check > input:checked { background: var(--gold); border-color: var(--gold); }
.check > input[type="checkbox"]:checked::after {
  content: "";
  width: 11px;
  height: 6px;
  margin-top: -3px;
  border-left: 2.5px solid var(--on-gold);
  border-bottom: 2.5px solid var(--on-gold);
  transform: rotate(-45deg);
}
.check > input[type="radio"]:checked::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--on-gold);
}
.check > input:focus-visible { box-shadow: var(--ring); }
.check-text { color: var(--text); }
.check-text small { display: block; color: var(--text-faint); font-size: var(--fs-13); }

.switch { display: inline-flex; align-items: center; gap: var(--sp-3); min-height: var(--touch); cursor: pointer; }
.switch > input {
  appearance: none;
  position: relative;
  flex: none;
  width: 46px;
  height: 26px;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  background: var(--surface-3);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.switch > input::after {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: inset-inline-start var(--dur-2) var(--ease), background var(--dur-1) var(--ease);
}
.switch > input:checked { background: var(--gold); border-color: var(--gold); }
.switch > input:checked::after { inset-inline-start: 22px; background: var(--on-gold); }
.switch > input:focus-visible { box-shadow: var(--ring); }

/* selectable chips (device, duration, type) - real radios/checkboxes inside */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip { position: relative; display: inline-flex; }
.chip > input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip-body {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--touch);
  padding: 0 var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 500;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.chip:hover .chip-body { border-color: var(--border-hover); }
.chip > input:checked + .chip-body { border-color: var(--gold); background: var(--gold-soft); color: var(--gold); }
.chip > input:focus-visible + .chip-body { box-shadow: var(--ring); }
.chip > input:disabled { cursor: not-allowed; }
.chip > input:disabled + .chip-body { opacity: .45; text-decoration: line-through; }

/* bigger selectable cards (payment method, delivery option) */
.options { display: grid; gap: var(--sp-3); }
.option { position: relative; display: block; }
.option > input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.option-body {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-1);
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.option:hover .option-body { border-color: var(--border-hover); }
.option > input:checked + .option-body { border-color: var(--gold); background: var(--gold-soft); }
.option > input:focus-visible + .option-body { box-shadow: var(--ring); }
.option-icon {
  display: grid;
  place-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--silver);
}
.option > input:checked + .option-body .option-icon { background: var(--gold); color: var(--on-gold); }
/* decision 86: a payment company's logo in place of the icon; the chosen one gets a gold ring */
.option-logo { overflow: hidden; padding: 0; border: 1px solid var(--border); }
.option-logo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.option > input:checked + .option-body .option-logo { background: var(--surface-3); box-shadow: 0 0 0 2px var(--gold); }
.option-title { display: block; font-weight: 700; color: var(--text); }
.option-desc { display: block; font-size: var(--fs-14); color: var(--text-muted); }
.option-tick { margin-inline-start: auto; color: var(--gold); opacity: 0; transition: opacity var(--dur-1) var(--ease); }
.option > input:checked + .option-body .option-tick { opacity: 1; }

/* receipt upload */
.dropzone {
  position: relative;
  display: grid;
  justify-items: center;
  gap: var(--sp-2);
  padding: var(--sp-8) var(--sp-4);
  border: 1.5px dashed var(--border-hover);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  color: var(--text-muted);
  text-align: center;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.dropzone > input[type="file"] { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone:hover, .dropzone.is-drag { border-color: var(--gold); background: var(--gold-soft); }
.dropzone:focus-within { box-shadow: var(--ring); }
.dropzone-icon {
  display: grid;
  place-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--gold);
}
.dropzone-title { color: var(--text); font-weight: 700; }
.dropzone-preview { display: none; width: 100%; max-width: 280px; }
.dropzone.has-file .dropzone-preview { display: block; }
.dropzone-preview img { width: 100%; max-height: 220px; object-fit: contain; border-radius: var(--r-sm); background: var(--surface-2); }
.dropzone-file { font-size: var(--fs-14); color: var(--text); direction: ltr; word-break: break-all; }

/* =========================================================== badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: var(--fs-13);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.badge .icon { width: 14px; height: 14px; }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-gold { background: var(--gold-soft); color: var(--gold); }
.badge-neutral { background: var(--surface-2); color: var(--text-muted); }
.badge-instant { background: var(--surface-1); border-color: var(--border-strong); color: var(--silver); }
.badge-instant .icon { color: var(--gold); fill: currentColor; }
/* an offer (H6): solid, so it reads on any picture */
.badge-sale { background: var(--danger); color: var(--on-strong); font-weight: 800; }
.badge-out { background: var(--surface-1); border-color: var(--border-strong); color: var(--text-muted); }
.badge-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.count {
  display: inline-grid;
  place-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text);
  font-size: var(--fs-12);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.count-alert { background: var(--danger); color: var(--on-strong); }
.count-gold { background: var(--gold); color: var(--on-gold); }

.kbd {
  display: inline-grid;
  place-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-muted);
  font: 600 var(--fs-12)/1 var(--font-body);
  direction: ltr;
}

.status-pill {
  --pill-c: var(--text-faint);
  --pill-soft: transparent;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  height: 34px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface-1);
  color: var(--text-muted);
  font-size: var(--fs-13);
  font-weight: 600;
  white-space: nowrap;
}
.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pill-c);
  box-shadow: 0 0 0 3px var(--pill-soft);
}
.status-pill.is-online { --pill-c: var(--success); --pill-soft: var(--success-soft); }
.status-pill.is-wait { --pill-c: var(--warning); --pill-soft: var(--warning-soft); }
.status-pill.is-off { --pill-c: var(--danger); --pill-soft: var(--danger-soft); }

/* =========================================================== cards */
.card {
  padding: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  box-shadow: var(--inner-hi);
}
.card-flush { padding: 0; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.card-title { font-family: var(--font-head); font-size: var(--fs-18); font-weight: 700; color: var(--silver); }
.card-sub { font-size: var(--fs-14); color: var(--text-muted); }
a.card, .card-link { display: block; transition: border-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); }
a.card:hover, .card-link:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-2); }
a.card:focus-visible, .card-link:focus-visible { outline: none; box-shadow: var(--ring); }

.price {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: var(--fs-18);
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.price small { font-size: .72em; font-weight: 500; color: var(--text-muted); }
.price-lg { font-size: var(--fs-28); }
/* relative: its hidden «بدل» (.sr-only) stays inside a card in a swiped row, never widening the page */
.price-old { position: relative; color: var(--text-faint); text-decoration: line-through; font-size: var(--fs-14); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* product card: the picture, the name and the price (H7). 2 to 5 a row, from a small phone to a wide screen */
.products { display: grid; gap: var(--sp-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .products { gap: var(--sp-4); grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px) { .products { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1240px) { .products { gap: var(--sp-5); grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease-out);
}
.product-card:hover { border-color: var(--gold-line); box-shadow: var(--shadow-2), var(--card-glow); transform: translateY(-3px); }
.product-card:active { transform: scale(.985); }
.product-card:focus-visible { outline: none; box-shadow: var(--ring); }
.product-card:hover .cover > img:not(.lqip) { transform: scale(1.05); }
.product-body { display: grid; flex: 1; align-content: space-between; gap: var(--sp-2); padding: var(--sp-3); }
@media (min-width: 768px) { .product-body { padding: var(--sp-3) var(--sp-4) var(--sp-4); } }
/* two lines kept for every name, so the prices of one row line up */
.product-name { min-height: 2.7em; font-family: var(--font-head); font-size: clamp(.9375rem, .88rem + .2vw, 1rem); font-weight: 700; line-height: 1.35; color: var(--silver); }
.product-body .price-wrap { flex-wrap: wrap; column-gap: var(--sp-2); }
.product-card.is-soldout .cover > *:not(.cover-flag) { opacity: .4; }
.product-card.is-soldout .price { color: var(--text-faint); }
/* one flag on a cover: the offer or «نفذت الكمية» */
.cover-flag { position: absolute; inset-block-start: var(--sp-2); inset-inline-start: var(--sp-2); z-index: 1; display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 var(--sp-2); border-radius: var(--r-full); background: var(--bg); color: var(--text-muted); font-size: var(--fs-12); font-weight: 700; }
.cover-flag-sale { background: var(--danger); color: var(--on-strong); }

.cover {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--cover-art);
}
.cover-wide { aspect-ratio: 16 / 9; }
.cover-square { aspect-ratio: 1 / 1; }
.cover > img { width: 100%; height: 100%; object-fit: cover; }
.cover-art {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3);
  text-align: center;
}
.cover-mark {
  font-family: var(--font-head);
  font-size: var(--fs-22);
  overflow-wrap: anywhere;
  font-weight: 900;
  line-height: 1.1;
  color: var(--silver);
  direction: ltr;
}
.cover-art .icon { width: 28px; height: 28px; color: var(--text-faint); }
.product-card .cover-art .icon { width: clamp(30px, 8vw, 40px); height: clamp(30px, 8vw, 40px); stroke-width: 1.4; }
@media (min-width: 768px) { .cover-mark { font-size: var(--fs-28); } }

/* =========================================================== alerts */
.alert {
  --alert-c: var(--text-muted);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-1);
}
.alert > .icon { color: var(--alert-c); margin-top: 3px; }
.alert-title { font-weight: 700; color: var(--text); }
.alert-text { font-size: var(--fs-14); color: var(--text-muted); }
.alert-info { --alert-c: var(--info); border-color: var(--info-line); background: var(--info-soft); }
.alert-success { --alert-c: var(--success); border-color: var(--success-line); background: var(--success-soft); }
.alert-warning { --alert-c: var(--warning); border-color: var(--warning-line); background: var(--warning-soft); }
.alert-danger { --alert-c: var(--danger); border-color: var(--danger-line); background: var(--danger-soft); }

/* =========================================================== stepper */
.stepper { display: flex; gap: var(--sp-2); counter-reset: step; }
.step { position: relative; display: flex; flex: 1; flex-direction: column; align-items: center; gap: var(--sp-2); min-width: 0; text-align: center; }
.step::before {
  content: "";
  position: absolute;
  top: 16px;
  inset-inline-start: calc(50% + 22px);
  width: calc(100% - 44px + var(--sp-2));
  height: 2px;
  border-radius: 2px;
  background: var(--border-strong);
}
.step:last-child::before { display: none; }
.step.is-done::before { background: var(--text-muted); }
.step-dot {
  position: relative;
  display: grid;
  place-content: center;
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-1);
  color: var(--text-faint);
  font-weight: 700;
  font-size: var(--fs-14);
  font-variant-numeric: tabular-nums;
}
.step-dot .icon { width: 16px; height: 16px; stroke-width: 3; }
.step-dot .step-check { display: none; }
.step.is-done .step-check { display: block; }
.step.is-done .step-num { display: none; }
.step-label { font-size: var(--fs-13); color: var(--text-faint); font-weight: 500; }
.step.is-done .step-dot { border-color: var(--silver); background: var(--silver); color: var(--bg); }
.step.is-done .step-label { color: var(--text-muted); }
.step.is-current .step-dot { border-color: var(--gold); background: var(--gold); color: var(--on-gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.step.is-current .step-label { color: var(--gold); font-weight: 700; }

/* =========================================================== timeline */
.timeline { position: relative; display: grid; gap: var(--sp-5); padding-inline-start: 28px; }
.timeline::before {
  content: "";
  position: absolute;
  inset-block: 8px;
  inset-inline-start: 7px;
  width: 2px;
  border-radius: 2px;
  background: var(--border-strong);
}
.tl-item { position: relative; }
.tl-dot {
  position: absolute;
  top: 6px;
  inset-inline-start: -28px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--bg);
}
.tl-item.is-done .tl-dot { border-color: var(--success); background: var(--success); }
.tl-item.is-current .tl-dot { border-color: var(--gold); background: var(--bg); box-shadow: 0 0 0 4px var(--gold-soft); }
.tl-item.is-failed .tl-dot { border-color: var(--danger); background: var(--danger); }
.tl-title { font-weight: 600; color: var(--text); }
.tl-item:not(.is-done):not(.is-current):not(.is-failed) .tl-title { color: var(--text-faint); }
.tl-time { font-size: var(--fs-13); color: var(--text-faint); font-variant-numeric: tabular-nums; }
.tl-note { margin-top: 4px; font-size: var(--fs-14); color: var(--text-muted); }

/* =========================================================== tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-1); }
.table { width: 100%; font-size: var(--fs-14); }
.table th {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-muted);
  font-size: var(--fs-13);
  font-weight: 600;
  text-align: start;
  white-space: nowrap;
}
.table td { padding: 14px var(--sp-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-1) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: end; }
@media (max-width: 767px) {
  .table-cards thead { display: none; }
  .table-cards tbody tr, .table-cards tfoot tr { display: grid; gap: var(--sp-2); padding: var(--sp-4); border-bottom: 1px solid var(--border); }
  .table-cards tbody tr:last-child, .table-cards tfoot tr:last-child { border-bottom: 0; }
  .table-cards tfoot tr:first-child { border-top: 1px solid var(--border-strong); }  /* totals: cards like the rows */
  .table.table-cards tfoot td { padding: 0; border: 0; }
  .table-cards td { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px var(--sp-3); padding: 0; border: 0; }
  /* a second line under the value (its detail, its buttons) takes the whole width */
  .table-cards td > .cell-sub, .table-cards td > .row-actions { flex-basis: 100%; text-align: end; }
  .table-cards td > .row-actions { justify-content: flex-end; }
  .table-cards td::before { content: attr(data-label); color: var(--text-faint); font-size: var(--fs-13); }
  .table-cards .num { text-align: start; }
}
/* the same cards when the table's own box is narrow (a laptop with the menu open; decision 64) */
.table-wrap { container-type: inline-size; }
@container (max-width: 720px) {
  .table-cards thead { display: none; }
  .table-cards tbody tr, .table-cards tfoot tr { display: grid; gap: var(--sp-2); padding: var(--sp-4); border-bottom: 1px solid var(--border); }
  .table-cards tbody tr:last-child, .table-cards tfoot tr:last-child { border-bottom: 0; }
  .table-cards tfoot tr:first-child { border-top: 1px solid var(--border-strong); }  /* totals: cards like the rows */
  .table.table-cards tfoot td { padding: 0; border: 0; }
  .table-cards td { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px var(--sp-3); padding: 0; border: 0; }
  .table-cards td > .cell-sub, .table-cards td > .row-actions { flex-basis: 100%; text-align: end; }
  .table-cards td > .row-actions { justify-content: flex-end; }
  .table-cards td::before { content: attr(data-label); color: var(--text-faint); font-size: var(--fs-13); }
  .table-cards .num { text-align: start; }
}

/* =========================================================== tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;  /* every tab stays in sight on a phone (decision 64) */
  gap: var(--sp-1);
  border-bottom: 1px solid var(--border);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--touch);
  padding: 0 var(--sp-4);
  border: 0;
  background: none;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  transition: color var(--dur-1) var(--ease);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--gold); }
.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset-inline: var(--sp-3);
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold);
}
.tab:focus-visible { outline: none; box-shadow: inset var(--ring); border-radius: var(--r-sm); }
.tab-panel { padding-top: var(--sp-5); }

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.segmented > label { position: relative; }
.segmented input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.segmented span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: var(--fs-14);
  font-weight: 600;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.segmented input:checked + span { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-1); }
.segmented input:focus-visible + span { box-shadow: var(--ring); }

/* =========================================================== dialogs */
dialog { color: var(--text); }
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(3px); }
.modal {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100dvh - 64px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  background: var(--surface-1);
  box-shadow: var(--shadow-3);
}
.modal[open] { display: flex; flex-direction: column; animation: ds-pop var(--dur-2) var(--ease); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.modal-title { font-family: var(--font-head); font-size: var(--fs-18); font-weight: 700; color: var(--silver); }
.modal-body { padding: var(--sp-5); overflow-y: auto; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); }
@media (max-width: 639px) {
  .modal { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .modal[open] { animation: ds-sheet var(--dur-2) var(--ease); }
  .modal-foot .btn { flex: 1; }
}

.drawer {
  width: min(480px, 100%);
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  margin-inline-end: 0;
  margin-inline-start: auto;
  padding: 0;
  border: 0;
  border-inline-start: 1px solid var(--border-strong);
  background: var(--surface-1);
  box-shadow: var(--shadow-3);
}
.drawer[open] { display: flex; flex-direction: column; animation: ds-drawer var(--dur-2) var(--ease); }
.drawer .modal-body { flex: 1; }

/* =========================================================== toasts */
.toasts {
  position: fixed;
  inset-block-start: calc(var(--header-h) + var(--sp-2) + env(safe-area-inset-top));
  inset-inline: 0;
  z-index: var(--z-toast);
  display: grid;
  justify-items: center;
  gap: var(--sp-2);
  padding-inline: var(--sp-4);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  max-width: 480px;
  min-height: 48px;
  padding: 10px var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-3);
  box-shadow: var(--shadow-3);
  color: var(--text);
  font-weight: 500;
  pointer-events: auto;
  animation: ds-toast-in var(--dur-2) var(--ease);
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
/* ds.js times it (4.5 s; a problem stays until closed) and gives it a close button (decision 64) */
.toast.is-leaving { opacity: 0; transform: translateY(-8px); }
.toast-close { display: grid; place-items: center; width: 32px; height: 32px; margin-inline-start: auto; margin-inline-end: -6px; padding: 0; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-muted); cursor: pointer; }
.toast-close:hover { color: var(--text); background: var(--surface-2); }
.toast-close:focus-visible { outline: none; box-shadow: var(--ring); }
.toast-close .icon { width: 16px; height: 16px; }
.toast-link { margin-inline-start: auto; padding: 6px var(--sp-2); border-radius: var(--r-sm); color: var(--gold); font-weight: 700; white-space: nowrap; text-decoration: none; }
.toast-link:hover { background: var(--surface-2); }
.toast-link:focus-visible { outline: none; box-shadow: var(--ring); }
.toast-link + .toast-close { margin-inline-start: 0; }
/* the first tap of a [data-confirm] button only asks */
.is-confirming { border-color: var(--danger) !important; color: var(--danger) !important; }
.toast > .icon { color: var(--text-muted); }
.toast-success > .icon { color: var(--success); }
.toast-danger > .icon { color: var(--danger); }
.toast-info > .icon { color: var(--info); }
.toast-warning > .icon { color: var(--warning); }

/* =========================================================== feedback */
.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: ds-spin .8s linear infinite;
}
.skeleton { position: relative; overflow: hidden; border-radius: var(--r-sm); background: var(--surface-2); }
.skeleton::after { content: ""; position: absolute; inset: 0; background: var(--shimmer); animation: ds-shimmer 1.4s ease-in-out infinite; }
.skeleton-line { height: 12px; }
.skeleton-title { height: 18px; width: 60%; }
.skeleton-box { aspect-ratio: 3 / 4; border-radius: var(--r-lg); }

.progress {
  appearance: none;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border: 0;
  border-radius: var(--r-full);
  background: var(--surface-3);
}
.progress::-webkit-progress-bar { background: var(--surface-3); }
.progress::-webkit-progress-value { background: var(--gold-gradient); border-radius: var(--r-full); }
.progress::-moz-progress-bar { background: var(--gold); border-radius: var(--r-full); }

.empty { display: grid; justify-items: center; gap: var(--sp-3); padding: var(--sp-10) var(--sp-4); text-align: center; }
.empty-icon { display: grid; place-content: center; width: 64px; height: 64px; border-radius: 50%; background: var(--surface-2); color: var(--text-faint); }
.empty-title { font-family: var(--font-head); font-size: var(--fs-18); font-weight: 700; color: var(--silver); }
.empty-text { max-width: 40ch; color: var(--text-muted); }

.avatar {
  display: grid;
  place-content: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--silver);
  font-weight: 700;
  font-size: var(--fs-14);
}

.avatar.avatar-lg { width: 52px; height: 52px; font-size: var(--fs-18); }

.divider-text { display: flex; align-items: center; gap: var(--sp-3); color: var(--text-faint); font-size: var(--fs-13); }
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.list { display: grid; }
.list-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
/* a signed-in device («حسابي») */
.device { gap: var(--sp-3); }
.device-icon { display: grid; place-content: center; flex: none; width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--surface-3); color: var(--silver); }
.device-name { color: var(--text); font-weight: 600; }
.device-meta { color: var(--text-faint); font-size: var(--fs-13); }

.copy-field {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 48px;
  padding-inline: var(--sp-4) var(--sp-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.copy-field > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }

/* =========================================================== auth card */
.gate { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; min-height: 100dvh; padding: var(--sp-6) var(--sp-4); background: var(--page-glow) no-repeat, var(--bg); }
.auth-card { width: min(440px, 100%); display: grid; align-content: start; gap: var(--sp-5); padding: var(--sp-6); border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface-1); box-shadow: var(--shadow-2); }
@media (min-width: 640px) { .auth-card { padding: var(--sp-8); } }
.auth-head { display: grid; justify-items: center; gap: var(--sp-3); text-align: center; }
.auth-head .brand-mark { width: 72px; height: 72px; }
.auth-title { font-family: var(--font-head); font-size: var(--fs-22); font-weight: 800; color: var(--silver); }
.auth-note { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); color: var(--text-faint); font-size: var(--fs-13); text-align: center; }

/* =========================================================== stats (admin) */
.stat { display: grid; gap: 6px; padding: var(--sp-5); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-1); }
.stat-label { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-14); color: var(--text-muted); }
.stat-value { font-family: var(--font-head); font-size: var(--fs-28); font-weight: 700; color: var(--silver); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-delta { font-size: var(--fs-13); font-weight: 600; color: var(--text-faint); }
.stat-delta.is-up { color: var(--success); }
.stat-delta.is-down { color: var(--danger); }

.attn {
  --attn-c: var(--text-muted);
  --attn-soft: var(--surface-3);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
a.attn:hover { border-color: var(--border-hover); background: var(--surface-2); }
a.attn:focus-visible { outline: none; box-shadow: var(--ring); }
.attn-icon { display: grid; place-content: center; flex: none; width: 46px; height: 46px; border-radius: var(--r-md); background: var(--attn-soft); color: var(--attn-c); }
.attn-count { font-family: var(--font-head); font-size: var(--fs-22); font-weight: 800; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.attn-label { font-size: var(--fs-14); color: var(--text-muted); }
.attn-go { margin-inline-start: auto; color: var(--text-faint); }
.attn-pay { --attn-c: var(--gold); --attn-soft: var(--gold-soft); }
.attn-fail { --attn-c: var(--danger); --attn-soft: var(--danger-soft); }
.attn-stock { --attn-c: var(--warning); --attn-soft: var(--warning-soft); }
.attn-manual { --attn-c: var(--info); --attn-soft: var(--info-soft); }
.attn-ok { --attn-c: var(--success); --attn-soft: var(--success-soft); }

/* =========================================================== motion */
@keyframes ds-spin { to { transform: rotate(360deg); } }
@keyframes ds-shimmer { from { transform: translateX(100%); } to { transform: translateX(-100%); } }
@keyframes ds-pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes ds-sheet { from { transform: translateY(100%); } }
@keyframes ds-drawer { from { opacity: 0; transform: translateX(-24px); } }
@keyframes ds-toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes ds-toast-out { to { opacity: 0; transform: translateY(-8px); visibility: hidden; } }
@keyframes ds-rise { from { opacity: 0; transform: translateY(4px); } }
.rise { animation: ds-rise var(--dur-2) var(--ease) both; }

/* =========================================================== storefront & catalog (phase C1) */
/* breadcrumbs: Home › Category › Product */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); margin-bottom: var(--sp-4); color: var(--text-faint); font-size: var(--fs-13); }
.crumbs a { color: var(--text-muted); transition: color var(--dur-1) var(--ease); }
.crumbs a:hover { color: var(--gold); }
.crumbs [aria-current] { color: var(--text); font-weight: 600; }

/* filter / sort links that look like chips (no JS: each is a real link) */
.chip-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: var(--touch);
  padding: 0 var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 500;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.chip-link:hover { border-color: var(--border-hover); }
.chip-link:focus-visible { outline: none; box-shadow: var(--ring); }
.chip-link[aria-current="true"] { border-color: var(--gold); background: var(--gold-soft); color: var(--gold); }
.chip-link-sm { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-14); }
@media (pointer: coarse) { .chip-link-sm { min-height: var(--touch); } }

.price-wrap { display: inline-flex; align-items: baseline; gap: 4px; }
.price-from { color: var(--text-muted); font-size: var(--fs-13); font-weight: 500; }

/* «قبل لا تطلب»: conditions above the price */
.note-box { display: grid; gap: var(--sp-2); padding: var(--sp-4); border: 1px solid var(--warning-line); border-radius: var(--r-md); background: var(--warning-soft); }
.note-box .label { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--warning); }
.req-list { display: grid; gap: var(--sp-1); padding-inline-start: var(--sp-5); list-style: disc; color: var(--text); font-size: var(--fs-14); }

.pre-line { white-space: pre-line; }
.warn-text { color: var(--warning); }
.info-text { color: var(--info); }  /* decision 105: «بعد التصحيح» */
.danger-text { color: var(--danger); }
/* an icon at the start of a line of text (svg is display:block): <p class="with-icon">{icon}<span>…</span></p> */
.with-icon { display: flex; align-items: center; gap: var(--sp-2); }
.with-icon > .icon { flex: none; }
.link { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.textarea-sm { min-height: 88px; }
.field-narrow { max-width: 220px; }
.dropzone-sm { padding: var(--sp-5) var(--sp-4); }
.dropzone-sm .dropzone-icon { width: 44px; height: 44px; }

/* =========================================================== old pages in the new design (phase C3) */
/* a selectable card that cannot be chosen (more than the budget) */
.option > input:disabled { cursor: not-allowed; }
.option > input:disabled + .option-body { opacity: .5; }
.option.is-off:hover .option-body { border-color: var(--border-strong); }
@media (min-width: 640px) { .options-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .options-3 .option-body { height: 100%; } }

/* <details> that opens without JS: FAQs, the rules of a category */
.disclosures { display: grid; gap: var(--sp-2); }
.disclosure { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-1); }
.disclosure > summary {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--touch);
  padding: var(--sp-3) var(--sp-4);
  color: var(--text);
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary > .icon:first-child { color: var(--gold); }
.disclosure > summary:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-md); }
.disclosure-chevron { margin-inline-start: auto; color: var(--text-faint); transition: transform var(--dur-1) var(--ease); }
.disclosure[open] > summary .disclosure-chevron { transform: rotate(180deg); }
.disclosure-body { display: grid; gap: var(--sp-3); padding: 0 var(--sp-4) var(--sp-4); }
.disclosure-sm > summary { min-height: 40px; padding-block: var(--sp-2); font-size: var(--fs-14); font-weight: 600; }
@media (pointer: coarse) { .disclosure-sm > summary { min-height: var(--touch); } }

/* star rating: radios 5..1 laid out in reverse, so in RTL they fill from the right */
.rating-field { display: grid; gap: var(--sp-2); min-width: 0; margin: 0; padding: 0; border: 0; }
.rating { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: var(--sp-1); }
.rating > label { display: grid; place-content: center; width: var(--touch); height: var(--touch); border-radius: var(--r-sm); color: var(--border-hover); cursor: pointer; transition: color var(--dur-1) var(--ease); }
.rating > label .icon { width: 28px; height: 28px; fill: currentColor; }
.rating > input:checked ~ label,
.rating > label:hover,
.rating > label:hover ~ label { color: var(--gold); }
.rating > input:focus-visible + label { box-shadow: var(--ring); }
.stars .is-off { color: var(--border-hover); }

/* ---------- wallet balances: «محفظتي» and the customer's file in the panel (W, F1) ---------- */
.wallet-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.wallet-card { display: grid; gap: var(--sp-1); padding: var(--sp-5); border: 1px solid var(--gold-line); border-radius: var(--r-lg); background: var(--surface-1); }
.wallet-kind { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text-muted); font-size: var(--fs-14); font-weight: 600; }
.wallet-kind .icon { color: var(--gold); }
.wallet-amount { color: var(--gold); font-family: var(--font-head); font-size: var(--fs-28); font-weight: 800; }
.success-text { color: var(--success); }

/* ---------- one-time codes: staff two-step sign-in (F6) ---------- */
.code-input { font-family: var(--font-head); font-size: var(--fs-22); font-weight: 700; letter-spacing: 4px; text-align: center; }
.steps-list { display: grid; gap: var(--sp-2); padding-inline-start: var(--sp-6); list-style: decimal; }

/* A small menu that opens under its button (details.menu; ds.js closes it on a click outside or Esc).
   On the site (sorting) and in the panel («تنزيل»: Excel or PDF, decision 54). */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { border-color: var(--border-hover); }
.menu-list {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  z-index: var(--z-sticky);
  display: grid;
  min-width: 168px;
  padding: var(--sp-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  box-shadow: var(--shadow-3);
  animation: ds-pop var(--dur-2) var(--ease-out);
}
.menu-list a { display: flex; align-items: center; gap: var(--sp-2); min-height: 40px; padding: 0 var(--sp-3); border-radius: var(--r-sm); color: var(--text-muted); font-size: var(--fs-14); font-weight: 600; }
.menu-list a:hover { background: var(--surface-3); color: var(--text); }
.menu-list a[aria-current="true"] { color: var(--gold); }
.menu-list a:focus-visible { outline: none; box-shadow: var(--ring); }
@media (pointer: coarse) { .menu-list a { min-height: var(--touch); } }
.menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  z-index: var(--z-sticky);
  display: grid;
  gap: var(--sp-3);
  width: min(300px, calc(100vw - 32px));
  padding: var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  box-shadow: var(--shadow-3);
  animation: ds-pop var(--dur-2) var(--ease-out);
}

/* the time left (decision 58, ds.js [data-until]): red once it is over */
[data-until].is-over { color: var(--danger); }

/* «عجلة الحظ» (decision 74; the lights, colours and icons: decision 75): the server's slices (ds.wheel) in a gold
   rim with lights; the disc turns by --wheel-turn (site-wheel.js); the middle is a button or the logo */
.wheel-stage { position: relative; width: min(100%, 360px); margin-inline: auto; aspect-ratio: 1; }
.wheel-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.rim-stop-a { stop-color: var(--gold-hover); }
.rim-stop-b { stop-color: var(--gold-deep); }
.rim-stop-c { stop-color: var(--gold); }
.wheel-rim { fill: var(--surface-1); stroke-width: 13; }
.wheel-disc { transform-origin: 120px 120px; transform: rotate(var(--wheel-turn, 0deg)); }
.wheel-slice { stroke: var(--bg); stroke-width: 1.2; }
.fill-gold { fill: var(--gold); } .fill-bronze { fill: var(--gold-deep); } .fill-silver { fill: var(--silver); }
.fill-black { fill: var(--surface-1); } .fill-gray { fill: var(--surface-3); } .fill-green { fill: var(--success); }
.fill-red { fill: var(--danger); } .fill-blue { fill: var(--info); } .fill-orange { fill: var(--warning); }
.ink-gold, .ink-bronze, .ink-silver, .ink-green, .ink-red, .ink-blue, .ink-orange { color: var(--bg); fill: var(--bg); }
.ink-black, .ink-gray { color: var(--silver); fill: var(--silver); }
.wheel-icon { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.wheel-label { font-family: inherit; font-size: 9px; font-weight: 800; }
.wheel-label.is-long { font-size: 7px; }
.wheel-bulb { fill: var(--gold-hover); }
.wheel-pointer { fill: var(--gold); stroke: var(--bg); stroke-width: 2; stroke-linejoin: round; }
.wheel-slice.is-picked { stroke: var(--gold-hover); stroke-width: 3; }
.wheel-hub { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.wheel-hub > * { pointer-events: auto; }
.wheel-hub-form { display: contents; }
.wheel-hub-btn { display: grid; place-content: center; width: 25%; min-width: 64px; aspect-ratio: 1; padding: 0;
  border: 3px solid var(--bg); border-radius: 50%; background: var(--gold-gradient); color: var(--on-gold);
  font: inherit; font-size: var(--fs-16); font-weight: 900; box-shadow: var(--gold-glow); cursor: pointer; }
.wheel-hub-btn:focus-visible { outline: none; box-shadow: var(--ring), var(--gold-glow); }
.wheel-hub-btn:disabled { cursor: default; filter: saturate(.6); }
.wheel-hub-logo { width: 22%; min-width: 52px; aspect-ratio: 1; padding: 10px; border: 3px solid var(--gold);
  border-radius: 50%; background: var(--bg); object-fit: contain; }
@media (prefers-reduced-motion: no-preference) {
  .wheel-disc { transition: transform 5s cubic-bezier(.12, .7, .14, 1); }
  .wheel-bulb { animation: bulb-blink 1.4s steps(1, end) infinite; }
  .wheel-bulb.is-odd { animation-delay: .7s; }
  .is-turning .wheel-bulb { animation-duration: .3s; }
  .is-turning .wheel-bulb.is-odd { animation-delay: .15s; }
  .is-won .wheel-bulb { animation: bulb-win .45s ease-in-out 4; }
  .wheel-hub-btn:not(:disabled) { animation: hub-pulse 2.2s ease-in-out infinite; }
  .is-won .wheel-pointer { animation: pointer-tap .5s ease-out 2; transform-origin: 120px 8px; }
}
@keyframes bulb-blink { 0% { opacity: 1; } 50% { opacity: .25; } }
@keyframes bulb-win { 50% { opacity: .2; } }
@keyframes hub-pulse { 50% { transform: scale(1.06); } }
@keyframes pointer-tap { 40% { transform: rotate(-12deg); } }
/* the panel's live preview (decision 75): the wheel alone in its frame */
.wheel-frame-body { background: var(--bg); }
.wheel-frame-in { display: grid; place-items: center; min-height: 100vh; padding: var(--sp-3); }
.wheel-frame-empty { margin: 0; color: var(--text-muted); text-align: center; }

/* «المفضلة» (decision 82): the card and its heart side by side (a button never sits inside a link). The heart is
   gold when kept (the chosen one), and moves with the card on hover. */
.product-tile { position: relative; display: grid; }
.product-tile > .product-card { height: 100%; }
.fav-btn { position: absolute; inset-block-start: var(--sp-2); inset-inline-end: var(--sp-2); z-index: 2; display: grid; place-items: center; width: var(--touch); height: var(--touch); border: 1px solid var(--border-strong); border-radius: var(--r-full); background: var(--header-bg); color: var(--silver); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), transform var(--dur-2) var(--ease-out); }
.fav-btn .icon { width: 20px; height: 20px; }
.fav-btn:hover { color: var(--gold); }
.fav-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.fav-btn[aria-pressed="true"], .fav-toggle[aria-pressed="true"] { border-color: var(--gold-line); color: var(--gold); }
.fav-btn[aria-pressed="true"] .icon, .fav-toggle[aria-pressed="true"] .icon { fill: currentColor; }
@media (hover: hover) { .product-tile:hover > .fav-btn { transform: translateY(-3px); } }
@keyframes fav-pop { 40% { transform: scale(1.35); } }
@media (prefers-reduced-motion: no-preference) { .fav-btn.is-pop .icon, .fav-toggle.is-pop .icon { animation: fav-pop .4s var(--ease-out); } }

/* ---------- a conversation (decisions 99 and 102): ds/_support.html, on the site and in the panel. Like a
   messenger: one's own bubbles at the end side in a warm tint, the other side's on the start side in grey; no
   avatars and no name on every line (the panel names the member over the first of his run); the time and ✓✓
   inside the bubble, on its last line; a run of lines from one side sits close, a new run gets a little air and
   one sharp corner; the automatic answer and a change of status are quiet lines in the middle ---------- */
.thread { display: grid; gap: 3px; padding-block: var(--sp-2); }
.msg { display: grid; gap: 4px; max-width: min(82%, 560px); }
.msg.is-start, .msg.is-event { margin-top: var(--sp-3); }
.thread > .msg:first-child { margin-top: 0; }
.msg.is-mine { justify-self: end; justify-items: end; }
.msg.is-theirs { justify-self: start; justify-items: start; }
.msg-label { display: flex; align-items: center; gap: 4px; margin: 0; padding-inline: var(--sp-2); color: var(--text-muted); font-size: var(--fs-12); font-weight: 600; }
.msg-label.is-note { color: var(--warning); }
.msg-bubble { position: relative; max-width: 100%; padding: 7px 12px 8px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface-2); color: var(--text); font-size: var(--fs-15); line-height: 1.65; overflow-wrap: anywhere; }
.msg.is-theirs.is-start .msg-bubble { border-start-start-radius: 6px; }
.msg.is-mine.is-start .msg-bubble { border-start-end-radius: 6px; }
.msg.is-mine .msg-bubble { border-color: var(--bubble-mine-line); background: var(--bubble-mine); }
.msg.is-note .msg-bubble { border-color: var(--warning-line); background: var(--warning-soft); }
.msg-text { white-space: pre-line; }
/* decision 116: a link in a message (services/support/links.py): blue on every bubble (6:1 and more), underlined */
.msg-link { color: var(--info); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; overflow-wrap: anywhere; border-radius: 4px; }
.msg-link:hover { text-decoration-thickness: 2px; }
.msg-link:focus-visible { outline: none; box-shadow: var(--ring); }
/* room on the last line for the time (and ✓✓), which sits in the bubble's end corner */
.msg-bubble.has-text .msg-text::after { content: ""; display: inline-block; width: 52px; }
.msg[data-tick] .msg-bubble.has-text .msg-text::after { width: 74px; }
.msg.is-long .msg-bubble.has-text .msg-text::after { width: 118px; }
.msg.is-long[data-tick] .msg-bubble.has-text .msg-text::after { width: 140px; }
.msg-meta { display: flex; align-items: center; justify-content: flex-end; gap: 3px; color: var(--text-muted); font-size: var(--fs-12); line-height: 1; white-space: nowrap; }
.msg-bubble.has-text .msg-meta { position: absolute; inset-inline-end: 10px; bottom: 8px; }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 3px -6px 6px; }
.msg-files a { display: block; overflow: hidden; border-radius: 12px; }
.msg-files a:focus-visible { outline: none; box-shadow: var(--ring); }
.msg-files img { display: block; width: 132px; height: 96px; object-fit: cover; }
.msg.is-event { justify-self: center; max-width: min(92%, 520px); }
.msg-event { margin: 0; padding: 6px 14px; border-radius: 14px; background: var(--surface-1); color: var(--text-muted); font-size: var(--fs-13); line-height: 1.7; text-align: center; }
.msg-event-label { margin-inline-end: 6px; color: var(--text); font-weight: 700; }
.msg-event-by, .msg-event-when { margin-inline-start: 8px; color: var(--text-faint); font-size: var(--fs-12); white-space: nowrap; }
.msg.is-order .msg-event { border: 1px solid var(--info-line); background: var(--info-soft); color: var(--text); }  /* decision 104 */
.msg.is-order .msg-event-label { display: inline-flex; align-items: center; gap: 4px; color: var(--info); }
.msg.is-order .msg-event-label .icon { display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
  .msg.is-new { animation: msg-in .3s var(--ease-out) both; }
}
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* decision 103: a day's line between the days, and a picture over the page (static/ds/support.js) */
.msg-day { justify-self: center; margin: var(--sp-3) 0 0; }
.thread > .msg-day:first-child { margin-top: 0; }
.msg-day > span { display: inline-block; padding: 3px 12px; border-radius: var(--r-full); background: var(--surface-2); color: var(--text-muted); font-size: var(--fs-12); font-weight: 700; }
.msg-day + .msg { margin-top: var(--sp-2); }
.tk-lightbox { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: var(--sp-4); overflow: auto; border: 0; background: transparent; color: var(--text); }
.tk-lightbox[open] { display: grid; place-items: center; }
.tk-lightbox::backdrop { background: var(--scrim-photo); }
.tk-lightbox img { max-width: calc(100vw - 32px); max-height: calc(100dvh - 140px); border-radius: var(--r-md); object-fit: contain; cursor: zoom-in; }
.tk-lightbox img.is-zoomed { width: min(1800px, 180vw); max-width: none; max-height: none; cursor: zoom-out; }
.tk-lightbox-btn { position: fixed; z-index: 1; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--header-bg); color: var(--text); cursor: pointer; }
.tk-lightbox-btn:hover { background: var(--surface-3); }
.tk-lightbox-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.tk-lightbox-btn.is-close { top: max(var(--sp-4), env(safe-area-inset-top)); inset-inline-end: var(--sp-4); }
.tk-lightbox-btn.is-prev { top: 50%; inset-inline-start: var(--sp-4); transform: translateY(-50%); }
.tk-lightbox-btn.is-next { top: 50%; inset-inline-end: var(--sp-4); transform: translateY(-50%); }
.tk-lightbox-count { position: fixed; inset-inline: 0; bottom: max(var(--sp-4), env(safe-area-inset-bottom)); color: var(--text-muted); font-size: var(--fs-13); text-align: center; }

/* the reply box: a rounded bar with the pictures, the words (growing with them) and a gold send */
.composer { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); padding: var(--sp-2); border: 1px solid var(--border-strong); border-radius: 22px; background: var(--surface-1); transition: border-color var(--dur-1) var(--ease); }
.composer:focus-within { border-color: var(--gold-line); }
.composer-row { display: flex; align-items: flex-end; gap: var(--sp-1); }
.composer-input { flex: 1; min-width: 0; min-height: 44px; max-height: 220px; padding: 10px 8px; border: 0; background: transparent; color: var(--text); font: inherit; line-height: 1.6; resize: none; outline: none; }
.composer-input::placeholder { color: var(--text-faint); }
.composer-icon { flex: none; display: grid; place-items: center; width: var(--touch); height: var(--touch); border-radius: 50%; color: var(--text-muted); cursor: pointer; transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); }
.composer-icon:hover { background: var(--surface-3); color: var(--text); }
.composer-icon:focus-within { box-shadow: var(--ring); }
.composer-send { flex: none; display: grid; place-items: center; width: var(--touch); height: var(--touch); border: 0; border-radius: 50%; background: var(--gold); color: var(--on-gold); cursor: pointer; transition: background var(--dur-1) var(--ease), transform var(--dur-1) var(--ease); }
.composer-send:hover { background: var(--gold-hover); }
.composer-send:active { transform: scale(.94); }
.composer-send:focus-visible { outline: none; box-shadow: var(--ring); }
.composer-send .icon { transform: scaleX(-1); }
.composer-error { padding-inline: var(--sp-2); color: var(--danger); font-size: var(--fs-13); }
.tk-attach-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tk-attach-list:empty { display: none; }
.tk-attach-chip { position: relative; width: 64px; height: 64px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-md); }
.tk-attach-chip img { width: 100%; height: 100%; object-fit: cover; }
.tk-attach-chip button { position: absolute; top: 2px; inset-inline-end: 2px; display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 50%; background: var(--scrim-strong); color: var(--text); cursor: pointer; }
/* decision 101, both sides: pictures dropped on the box, ✓ and ✓✓, a reply's buttons, «يكتب…» */
.composer.is-drop { border-color: var(--gold); border-style: dashed; background: var(--gold-soft); }
.msg-tick { display: inline-flex; color: var(--text-muted); }
.msg-tick .icon { width: 14px; height: 14px; }
.msg-tick .icon + .icon { display: none; margin-inline-start: -8px; }
.msg-tick.is-read { color: var(--info); }
.msg-tick.is-read .icon + .icon { display: block; }
/* a reply's buttons, under its bubble: plain until one is chosen (that one gold) */
.msg-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.msg.is-theirs .msg-choices { justify-content: flex-start; }
.msg.is-mine .msg-choices { justify-content: flex-end; }
.msg-choice { display: inline-flex; align-items: center; gap: 4px; min-height: var(--touch); padding: 6px 16px; border: 1px solid var(--border-strong); border-radius: var(--r-full); background: transparent; color: var(--text); font: inherit; font-size: var(--fs-14); font-weight: 600; cursor: pointer; transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease); }
button.msg-choice:hover:not(:disabled) { border-color: var(--border-hover); background: var(--surface-2); }
.msg-choice:focus-visible { outline: none; box-shadow: var(--ring); }
.msg-choice-error { flex-basis: 100%; margin: 0; color: var(--danger); font-size: var(--fs-12); }
.msg-choices.is-done .msg-choice { border-color: var(--border); color: var(--text-faint); cursor: default; }
.msg-choices.is-done .msg-choice.is-chosen { border-color: var(--gold-line); background: var(--gold-soft); color: var(--text); }
.chat-typing { display: inline-flex; align-items: center; gap: 4px; min-height: 22px; }
.chat-typing > span:not(.sr-only) { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
@media (prefers-reduced-motion: no-preference) {
  .chat-typing > span:not(.sr-only) { animation: chat-dot 1s ease-in-out infinite; }
  .chat-typing > span:nth-child(2) { animation-delay: .15s; }
  .chat-typing > span:nth-child(3) { animation-delay: .3s; }
}
@keyframes chat-dot { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* =========================================================== «التصنيفات والشارات» (decision 119)
   A tag in one of tags.PALETTE's colours: .tag-<key> sets its colours (on the tag, or on a box around it: the panel's
   live preview), .tag-chip draws it soft (its colour on its tint), .tag-badge filled (dark or silver text on it, each
   above 4.5:1), .tag-dot as a small round mark. Every colour from tokens.css. */
.tag-gold { --tag-fg: var(--gold); --tag-soft: var(--gold-soft); --tag-line: var(--gold-line); --tag-fill: var(--gold); --tag-on: var(--on-gold); }
.tag-silver { --tag-fg: var(--silver); --tag-soft: var(--surface-2); --tag-line: var(--border-hover); --tag-fill: var(--silver); --tag-on: var(--bg); }
.tag-green { --tag-fg: var(--success); --tag-soft: var(--success-soft); --tag-line: var(--success-line); --tag-fill: var(--success); --tag-on: var(--on-strong); }
.tag-red { --tag-fg: var(--danger); --tag-soft: var(--danger-soft); --tag-line: var(--danger-line); --tag-fill: var(--danger); --tag-on: var(--on-strong); }
.tag-blue { --tag-fg: var(--info); --tag-soft: var(--info-soft); --tag-line: var(--info-line); --tag-fill: var(--info); --tag-on: var(--on-strong); }
.tag-orange { --tag-fg: var(--warning); --tag-soft: var(--warning-soft); --tag-line: var(--warning-line); --tag-fill: var(--warning); --tag-on: var(--on-strong); }
.tag-purple { --tag-fg: var(--silver); --tag-soft: var(--promo-purple); --tag-line: var(--promo-purple); --tag-fill: var(--promo-purple); --tag-on: var(--silver); --tag-ring: var(--border-hover); }
.tag-gray { --tag-fg: var(--text-muted); --tag-soft: var(--surface-2); --tag-line: var(--border); --tag-fill: var(--surface-3); --tag-on: var(--text); --tag-ring: var(--text-faint); }
.tag-black { --tag-fg: var(--text); --tag-soft: var(--bg); --tag-line: var(--border-strong); --tag-fill: var(--bg); --tag-on: var(--silver); --tag-edge: var(--gold-line); --tag-ring: var(--border-hover); }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; height: 22px; padding: 0 8px; overflow: hidden; border: 1px solid var(--tag-line, var(--border)); border-radius: var(--r-full); background: var(--tag-soft, var(--surface-2)); color: var(--tag-fg, var(--text-muted)); font-size: var(--fs-12); font-weight: 600; line-height: 1; white-space: nowrap; text-overflow: ellipsis; }
.tag-chip .icon { flex: none; width: 13px; height: 13px; }
.tag-badge { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; height: 24px; padding: 0 var(--sp-2); overflow: hidden; border: 1px solid var(--tag-edge, transparent); border-radius: var(--r-full); background: var(--tag-fill, var(--surface-3)); color: var(--tag-on, var(--text)); font-size: var(--fs-12); font-weight: 800; line-height: 1; white-space: nowrap; text-overflow: ellipsis; }
.tag-badge .icon { flex: none; width: 13px; height: 13px; }
.tag-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--tag-fill, var(--text-faint)); box-shadow: 0 0 0 1px var(--tag-ring, transparent); }
/* on a product card: the badge in the cover's bottom corner, the chips one line under the name (the second one
   leaves a narrow card: never crowded on a phone) */
.cover-badge { position: absolute; inset-block-end: var(--sp-2); inset-inline-start: var(--sp-2); z-index: 1; max-width: calc(100% - 2 * var(--sp-2)); box-shadow: var(--shadow-1); }
.product-body { container-type: inline-size; }
.product-tags { display: flex; flex-wrap: nowrap; gap: 4px; min-width: 0; overflow: hidden; margin-top: calc(-1 * var(--sp-1)); }
.product-tags .tag-chip { flex: 0 1 auto; }
@container (max-width: 170px) { .product-tags .tag-chip + .tag-chip { display: none; } }
