/* =====================================================================
   وصلة — UI components
   Load order in every page:
     <link rel="stylesheet" href="/shared/tokens.css">
     <link rel="stylesheet" href="/shared/ui.css">
   RTL-first: logical properties only (inline-start = right in Arabic).
   Docs + snippets: /shared/README.md · Live gallery: /styleguide.html
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. Reset + base
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
h1, h2, h3, h4 { font-weight: var(--fw-bold); line-height: var(--lh-tight); letter-spacing: 0; text-wrap: balance; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
p { text-wrap: pretty; }
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
input, textarea { accent-color: var(--brand); }
hr { border: 0; }
table { border-collapse: collapse; }
s, del { text-decoration-thickness: 1px; }
::selection { background: var(--brand-soft); color: var(--ink); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }
[hidden] { display: none !important; }
html.is-locked { overflow: hidden; }

/* icons — <svg class="ic"><use href="/shared/icons.svg#home"/></svg> */
.ic {
  width: 24px; height: 24px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.ic--xs { width: 14px; height: 14px; }
.ic--sm { width: 16px; height: 16px; }
.ic--md { width: 20px; height: 20px; }
.ic--lg { width: 28px; height: 28px; }
.ic--xl { width: 40px; height: 40px; stroke-width: 1.5; }
.ic--flip { transform: scaleX(-1); }   /* mirror directional icons in RTL */

/* ---------------------------------------------------------------------
   2. Layout
   --------------------------------------------------------------------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.page { padding-block: var(--s-4) var(--s-7); }
body.has-bottom-nav .page { padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + var(--s-6)); }
body.has-cartbar .page { padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 96px); }
@media (min-width: 1024px) {
  body.has-bottom-nav .page { padding-bottom: var(--s-7); }
  body.has-cartbar .page { padding-bottom: 120px; }
}

.section { margin-block: var(--s-6); }
.section:first-child { margin-top: var(--s-4); }
.section__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.section__title { font-size: var(--fs-lg); font-weight: var(--fw-bold); line-height: var(--lh-tight); }
.section__sub { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.section__link { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--brand); white-space: nowrap; }
.section__link .ic { width: 18px; height: 18px; }

/* horizontal scroller that bleeds to the screen edge on mobile */
.hscroll {
  display: flex; gap: var(--s-3);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  margin-inline: calc(var(--gutter) * -1);
  padding-inline: var(--gutter);
  scroll-padding-inline: var(--gutter);
  padding-block: 4px 12px;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { flex-shrink: 0; scroll-snap-align: start; }
.hscroll--cards > * { width: min(78%, 300px); }

/* responsive card grid: 1 col @360 · 2 @768 · 3–4 @1200 */
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 260px)), 1fr)); gap: var(--gap, var(--s-4)); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap, var(--s-3)); }
@media (min-width: 768px) {
  .grid-auto { --gap: var(--s-5); }
}

/* ---------------------------------------------------------------------
   3. Customer shell — top header, bottom nav, floating cart bar
   --------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: var(--z-header);
  background: var(--header-bg);
  color: var(--header-ink);
  padding-top: var(--safe-top);
}
.topbar :focus-visible { outline-color: var(--header-ink); }
.topbar__inner { display: flex; align-items: center; gap: var(--s-2); min-height: var(--header-h); }
.topbar__title { flex: 1; min-width: 0; font-size: var(--fs-lg); font-weight: var(--fw-bold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; align-items: center; gap: var(--s-1); margin-inline-start: auto; }
.topbar .btn--icon { color: var(--header-ink); }
.topbar .btn--icon:hover { background: var(--header-fill); }
.topbar__search { padding-bottom: var(--s-3); }
.topbar__search .search__input { background: var(--surface); border-color: transparent; }
.topbar__nav { display: none; }
.logo { display: inline-flex; align-items: center; gap: var(--s-2); color: inherit; font-size: var(--fs-xl); font-weight: var(--fw-bold); line-height: 1; text-decoration: none !important; }
.logo__mark { width: 32px; height: 32px; border-radius: 10px; background: var(--header-fill-hover); display: grid; place-items: center; }
.logo__mark svg { width: 20px; height: 20px; }
.topbar .logo { display: none; }
@media (min-width: 1024px) {
  .topbar .logo { display: inline-flex; margin-inline-end: var(--s-4); }
  .topbar__nav { display: flex; gap: var(--s-1); }
  .topbar__nav a {
    display: inline-flex; align-items: center; gap: var(--s-2);
    min-height: 44px; padding-inline: 14px; border-radius: var(--r-pill);
    color: var(--header-muted); font-size: var(--fs-sm); font-weight: var(--fw-semi);
    text-decoration: none; transition: background var(--dur-1), color var(--dur-1);
  }
  .topbar__nav a:hover { background: var(--header-fill); color: var(--header-ink); }
  .topbar__nav a.is-active { background: var(--header-fill-hover); color: var(--header-ink); }
  .topbar__nav .ic { width: 20px; height: 20px; }
}

/* delivery address chip (in header) */
.addr-chip {
  display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: 44px; min-width: 0; max-width: 100%;
  padding: 4px var(--s-3) 4px var(--s-2);
  border-radius: var(--r-pill);
  background: var(--header-fill);
  color: var(--header-ink);
  text-align: start; text-decoration: none !important;
  transition: background var(--dur-1);
}
.addr-chip:hover { background: var(--header-fill-hover); }
.addr-chip__pin { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--header-fill); flex-shrink: 0; }
.addr-chip__pin .ic { width: 18px; height: 18px; }
.addr-chip__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.addr-chip__label { font-size: var(--fs-xs); color: var(--header-muted); }
.addr-chip__value { font-size: var(--fs-sm); font-weight: var(--fw-semi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.addr-chip > .ic { width: 16px; height: 16px; opacity: .8; }

/* bottom navigation (mobile, 5 tabs) */
.bottom-nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: var(--z-nav);
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--line);
}
.bottom-nav__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 44px; color: var(--muted);
  font-size: var(--fs-xs); font-weight: var(--fw-semi); line-height: 1.2;
  text-decoration: none !important;
  transition: color var(--dur-1);
}
.bottom-nav__icon { width: 56px; height: 30px; border-radius: var(--r-pill); display: grid; place-items: center; transition: background var(--dur-2) var(--ease); position: relative; }
.bottom-nav__icon .ic { width: 22px; height: 22px; }
.bottom-nav__item.is-active { color: var(--brand); }
.bottom-nav__item.is-active .bottom-nav__icon { background: var(--brand-soft); }
.bottom-nav__item.is-active .ic { stroke-width: 2.1; }
.bottom-nav__icon .badge { position: absolute; top: -2px; inset-inline-end: 8px; }
@media (min-width: 1024px) { .bottom-nav { display: none; } }

/* floating cart bar — the page's main CTA (accent) */
.cartbar {
  position: fixed; z-index: var(--z-cartbar);
  inset-inline: var(--s-3);
  bottom: calc(var(--nav-h) + var(--safe-bottom) + var(--s-3));
  margin-inline: auto; max-width: 560px;
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 60px; padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4);
  padding-inline-start: var(--s-2);
  border-radius: var(--r-lg);
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent), var(--sh-2);
  font-weight: var(--fw-semi);
  text-decoration: none !important;
  transform: translateY(calc(100% + 120px)); opacity: 0;
  transition: transform var(--dur-3) var(--ease), opacity var(--dur-2), background var(--dur-1);
}
.cartbar.is-visible { transform: none; opacity: 1; }
.cartbar:hover { background: var(--accent-strong); }
.cartbar:active { transform: scale(.985); }
.cartbar__count {
  min-width: 44px; height: 44px; padding-inline: 8px; border-radius: var(--r-md);
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent-ink) 16%, transparent);
  font-weight: var(--fw-bold); font-size: var(--fs-md);
}
.cartbar__count.is-bump { animation: bump var(--dur-3) var(--ease); }
.cartbar__label { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.cartbar__title { font-size: var(--fs-md); }
.cartbar__sub { font-size: var(--fs-xs); font-weight: var(--fw-regular); opacity: .9; }
.cartbar__total { font-size: var(--fs-md); font-weight: var(--fw-bold); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.cartbar.is-static { position: relative; inset: auto; transform: none; opacity: 1; }
@media (min-width: 1024px) { .cartbar { bottom: var(--s-5); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* ---------------------------------------------------------------------
   4. Buttons
   --------------------------------------------------------------------- */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--ink);
  --btn-bg-hover: var(--surface-3);
  --btn-border: transparent;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 48px; padding: 0 var(--s-5);
  border: 1px solid var(--btn-border); border-radius: var(--r-md);
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: var(--fs-md); font-weight: var(--fw-semi); line-height: 1.2;
  white-space: nowrap; text-decoration: none !important;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1), color var(--dur-1), transform var(--dur-1) var(--ease), box-shadow var(--dur-1);
}
@media (hover: hover) { .btn:hover { background: var(--btn-bg-hover); } }
.btn:active { transform: scale(.97); }
.btn .ic { width: 20px; height: 20px; }
/* icon button — put variant classes after it: .btn.btn--icon.btn--secondary */
.btn--icon {
  --btn-bg: transparent; --btn-bg-hover: var(--surface-2);
  width: 44px; height: 44px; min-height: 44px; padding: 0;
  border-radius: var(--r-pill);
}
.btn--icon .ic { width: 22px; height: 22px; }
.btn--icon.btn--sm { width: 40px; height: 40px; min-height: 40px; padding: 0; }
.btn--icon.btn--lg { width: 52px; height: 52px; min-height: 52px; padding: 0; }
.btn--primary   { --btn-bg: var(--accent); --btn-fg: var(--accent-ink); --btn-bg-hover: var(--accent-strong); }
.btn--secondary { --btn-bg: var(--brand); --btn-fg: var(--brand-ink); --btn-bg-hover: var(--brand-strong); }
.btn--soft      { --btn-bg: var(--brand-soft); --btn-fg: var(--brand); --btn-bg-hover: color-mix(in srgb, var(--brand) 16%, var(--brand-soft)); }
.btn--outline   { --btn-bg: var(--surface); --btn-fg: var(--ink); --btn-bg-hover: var(--surface-2); --btn-border: var(--line-strong); }
.btn--ghost     { --btn-bg: transparent; --btn-fg: var(--brand); --btn-bg-hover: var(--brand-soft); }
.btn--danger    { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-bg-hover: color-mix(in srgb, var(--danger) 14%, var(--danger-soft)); }
.btn--primary { box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 28%, transparent); }
.btn--sm { min-height: 44px; padding: 0 var(--s-4); font-size: var(--fs-sm); border-radius: 10px; }
.btn--sm .ic { width: 18px; height: 18px; }
.btn--lg { min-height: 56px; padding: 0 var(--s-6); font-size: var(--fs-md); font-weight: var(--fw-bold); border-radius: 14px; }
.btn--block { display: flex; width: 100%; }
.btn--split { justify-content: space-between; }       /* «أضف للسلة ……… ١٢٠ ج.م» */
.btn--pill { border-radius: var(--r-pill); }
.btn--float { --btn-bg: var(--surface); --btn-fg: var(--ink); --btn-bg-hover: var(--surface-2); box-shadow: var(--sh-2); }
.btn:disabled, .btn.is-disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; box-shadow: none; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--btn-fg); border-inline-end-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: var(--s-3); }
.btn-row > .btn { flex: 1; }

/* ---------------------------------------------------------------------
   5. Forms
   --------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.label { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--ink); }
.label .opt { font-weight: var(--fw-regular); color: var(--muted); }
.hint { font-size: var(--fs-xs); color: var(--muted); }
.field-error, .field.is-error .hint { font-size: var(--fs-xs); color: var(--danger); }
.input, .select, .textarea {
  width: 100%; min-height: 48px;
  padding: 12px var(--s-4);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink);
  font-size: var(--fs-md); line-height: 1.4;
  transition: border-color var(--dur-1), box-shadow var(--dur-1), background var(--dur-1);
  appearance: none; -webkit-appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line-strong)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.field.is-error .input, .input.is-error, .input[aria-invalid="true"] { border-color: var(--danger); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--muted); }
.textarea { min-height: 104px; resize: vertical; }
.select {
  padding-inline-end: 44px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: left 18px center, left 23px center;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.input--ltr { direction: ltr; text-align: right; }

/* search field */
.search { position: relative; display: flex; align-items: center; }
.search > .ic { position: absolute; inset-inline-start: 14px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.search__input {
  width: 100%; min-height: 48px;
  padding: 0 46px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: var(--surface-2); color: var(--ink);
  font-size: var(--fs-md);
  transition: border-color var(--dur-1), box-shadow var(--dur-1), background var(--dur-1);
}
.search__input::placeholder { color: var(--muted); }
.search__input::-webkit-search-cancel-button { display: none; }
.search__input:focus { outline: none; background: var(--surface); border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.search__clear { position: absolute; inset-inline-end: 2px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.search__clear .ic { width: 18px; height: 18px; }
.search__input:placeholder-shown ~ .search__clear { display: none; }
a.search__input { display: flex; align-items: center; color: var(--muted); text-decoration: none; }

/* phone input (+20 prefix, LTR digits) */
.phone-input {
  display: flex; direction: ltr;
  border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface);
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.phone-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.phone-input__prefix { display: flex; align-items: center; gap: 6px; padding-inline: var(--s-4); border-inline-end: 1px solid var(--line); color: var(--muted); font-weight: var(--fw-semi); font-variant-numeric: tabular-nums; }
.phone-input input { flex: 1; min-width: 0; min-height: 52px; padding: 0 var(--s-4); border: 0; background: none; font-size: var(--fs-lg); font-weight: var(--fw-semi); letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.phone-input input:focus { outline: none; }

/* OTP code boxes */
.otp { display: flex; justify-content: center; gap: var(--s-3); direction: ltr; }
.otp input {
  width: 56px; height: 64px; padding: 0;
  border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface);
  text-align: center; font-size: var(--fs-xl); font-weight: var(--fw-bold); caret-color: var(--brand);
  transition: border-color var(--dur-1), box-shadow var(--dur-1), transform var(--dur-1);
}
.otp input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.otp input:not(:placeholder-shown) { border-color: var(--brand); background: var(--brand-soft); }
.otp.is-error input { border-color: var(--danger); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* checkbox row */
.check { display: inline-flex; align-items: center; gap: var(--s-3); min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; flex-shrink: 0; }

/* switch — <input type="checkbox" class="switch" role="switch"> */
.switch {
  appearance: none; -webkit-appearance: none;
  position: relative; flex-shrink: 0;
  width: 52px; height: 32px; margin: 0;
  border-radius: var(--r-pill); background: var(--line-strong);
  cursor: pointer; transition: background var(--dur-2) var(--ease);
}
.switch::before {
  content: ""; position: absolute; top: 4px; inset-inline-start: 4px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25);
  transition: inset-inline-start var(--dur-2) var(--ease);
}
.switch:checked { background: var(--brand); }
.switch:checked::before { inset-inline-start: 24px; }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch--lg { width: 68px; height: 40px; }
.switch--lg::before { width: 32px; height: 32px; }
.switch--lg:checked::before { inset-inline-start: 32px; }

/* radio cards (payment methods, options) */
.radio-cards { display: flex; flex-direction: column; gap: var(--s-3); }
.radio-card {
  position: relative;
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 64px; padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  background: var(--surface); cursor: pointer;
  transition: border-color var(--dur-1), background var(--dur-1), box-shadow var(--dur-1);
}
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card__icon { width: 44px; height: 44px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--surface-2); color: var(--ink); flex-shrink: 0; transition: background var(--dur-1), color var(--dur-1); }
.radio-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.radio-card__title { font-weight: var(--fw-semi); }
.radio-card__sub { font-size: var(--fs-sm); color: var(--muted); }
.radio-card__end { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--muted); }
.radio-card__check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); flex-shrink: 0; display: grid; place-items: center; transition: border-color var(--dur-1), background var(--dur-1); }
.radio-card__check::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-ink); transform: scale(0); transition: transform var(--dur-2) var(--ease); }
.radio-card:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line-strong)); }
.radio-card:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: color-mix(in srgb, var(--brand-soft) 55%, var(--surface)); }
.radio-card:has(input:checked) .radio-card__icon { background: var(--brand); color: var(--brand-ink); }
.radio-card:has(input:checked) .radio-card__check { border-color: var(--brand); background: var(--brand); }
.radio-card:has(input:checked) .radio-card__check::after { transform: scale(1); }
.radio-card:has(input[type="checkbox"]) .radio-card__check { border-radius: 6px; }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.radio-card:has(input:disabled) { opacity: .5; cursor: not-allowed; }

/* ---------------------------------------------------------------------
   6. Chips, tabs, segmented
   --------------------------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chips.hscroll { flex-wrap: nowrap; }
.chip {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 var(--s-4);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink);
  font-size: var(--fs-sm); font-weight: var(--fw-semi); white-space: nowrap;
  text-decoration: none !important;
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1), transform var(--dur-1);
}
.chip::after { content: ""; position: absolute; inset: -3px 0; }          /* 46px hit area */
.chip .ic { width: 18px; height: 18px; }
.chip:hover { border-color: var(--brand); }
.chip:active { transform: scale(.97); }
.chip.is-selected, .chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip__count { font-size: var(--fs-xs); opacity: .8; font-weight: var(--fw-regular); }

.tabs {
  display: flex; gap: var(--s-1);
  border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs--sticky { position: sticky; top: calc(var(--header-h) + var(--safe-top)); z-index: var(--z-sticky); background: var(--bg); margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
.tab {
  position: relative; flex-shrink: 0;
  min-height: 48px; padding: 0 var(--s-4);
  color: var(--muted); font-weight: var(--fw-semi); font-size: var(--fs-sm);
  white-space: nowrap; transition: color var(--dur-1);
  text-decoration: none !important; display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--ink); }
.tab::after { content: ""; position: absolute; inset-inline: var(--s-3); bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); transform: scaleX(0); transition: transform var(--dur-2) var(--ease); }
.tab.is-active, .tab[aria-selected="true"] { color: var(--brand); }
.tab.is-active::after, .tab[aria-selected="true"]::after { transform: scaleX(1); }

.segmented { display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--surface-2); }
.segmented--block { display: flex; width: 100%; }
.segmented--block > * { flex: 1; }
.segmented__btn {
  min-height: 40px; padding: 0 var(--s-4); border-radius: 10px;
  color: var(--muted); font-size: var(--fs-sm); font-weight: var(--fw-semi); white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background var(--dur-2) var(--ease), color var(--dur-1), box-shadow var(--dur-2);
}
.segmented__btn:hover { color: var(--ink); }
.segmented__btn.is-active, .segmented__btn[aria-pressed="true"], .segmented__btn[aria-selected="true"] { background: var(--surface); color: var(--brand); box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 2px 8px rgb(0 0 0 / .06); }

/* ---------------------------------------------------------------------
   7. Media, placeholders, badges, tags, rating
   --------------------------------------------------------------------- */
.media { position: relative; overflow: hidden; background: var(--surface-2); }
.media > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ratio-16x9 { aspect-ratio: 16 / 9; }
.ratio-4x3 { aspect-ratio: 4 / 3; }
.ratio-1 { aspect-ratio: 1; }
/* placeholder image boxes — warm food-photo gradients */
.ph { background-image: radial-gradient(120% 90% at 85% 10%, rgb(255 255 255 / .35), transparent 55%), var(--ph-1); }
.ph--2 { background-image: radial-gradient(120% 90% at 85% 10%, rgb(255 255 255 / .35), transparent 55%), var(--ph-2); }
.ph--3 { background-image: radial-gradient(120% 90% at 85% 10%, rgb(255 255 255 / .35), transparent 55%), var(--ph-3); }
.ph--4 { background-image: radial-gradient(120% 90% at 85% 10%, rgb(255 255 255 / .35), transparent 55%), var(--ph-4); }
.ph--5 { background-image: radial-gradient(120% 90% at 85% 10%, rgb(255 255 255 / .35), transparent 55%), var(--ph-5); }
.ph--6 { background-image: radial-gradient(120% 90% at 85% 10%, rgb(255 255 255 / .35), transparent 55%), var(--ph-6); }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 24px; padding: 2px var(--s-2);
  border-radius: var(--r-xs);
  background: var(--surface-2); color: var(--ink);
  font-size: var(--fs-xs); font-weight: var(--fw-semi); line-height: 1.4; white-space: nowrap;
}
.tag .ic { width: 14px; height: 14px; }
.tag--brand  { background: var(--brand-soft); color: var(--brand); }
.tag--solid  { background: var(--brand); color: var(--brand-ink); }
.tag--accent { background: var(--accent); color: var(--accent-ink); }   /* discount / urgent ONLY */
.tag--danger { background: var(--danger-soft); color: var(--danger); }
.tag--warn   { background: var(--warn-soft); color: var(--warn); }
.tag--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--muted); }
.tag--pill { border-radius: var(--r-pill); padding-inline: 10px; }

.badge {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--brand); color: var(--brand-ink);
  font-size: 11px; font-weight: var(--fw-bold); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.badge--accent { background: var(--accent); color: var(--accent-ink); }
.badge--danger { background: var(--danger); color: var(--danger-ink); }
.badge--muted { background: var(--surface-2); color: var(--muted); }
.badge--dot { min-width: 10px; width: 10px; height: 10px; padding: 0; }

/* order status pill — <span class="status" data-status="preparing">…</span> (statusPill() in ui.js) */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 28px; padding: 2px 10px 2px 12px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: var(--fw-semi); white-space: nowrap;
  background: var(--brand-soft); color: var(--brand);
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status[data-status="pending_payment"], .status[data-status="placed"] { background: var(--warn-soft); color: var(--warn); }
.status[data-status="placed"]::before, .status[data-status="preparing"]::before, .status[data-status="picked"]::before { animation: blink 1.4s ease-in-out infinite; }
.status[data-status="picked"] { background: var(--brand); color: var(--brand-ink); }
.status[data-status="delivered"] { background: var(--surface-2); color: var(--ink); }
.status[data-status="delivered"]::before { background: var(--brand); }
.status[data-status="cancelled"], .status[data-status="failed"] { background: var(--danger-soft); color: var(--danger); }
@keyframes blink { 50% { opacity: .25; } }

.rating { display: inline-flex; align-items: center; gap: 4px; font-weight: var(--fw-semi); color: var(--ink); font-variant-numeric: tabular-nums; }
.rating .ic { width: 16px; height: 16px; color: var(--star); }
.rating__count { font-weight: var(--fw-regular); color: var(--muted); }
.stars { display: inline-flex; gap: 2px; color: var(--star); }
.stars .ic { width: 16px; height: 16px; }
.stars .is-off { color: var(--line-strong); }

/* rating input — DOM order 5→1 (see README) */
.rating-input { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.rating-input input { position: absolute; opacity: 0; pointer-events: none; }
.rating-input label { width: 48px; height: 48px; display: grid; place-items: center; color: var(--line-strong); cursor: pointer; border-radius: 50%; transition: color var(--dur-1), transform var(--dur-2) var(--ease); }
.rating-input label .ic { width: 34px; height: 34px; }
.rating-input input:checked ~ label,
.rating-input label:hover, .rating-input label:hover ~ label { color: var(--star); }
.rating-input:hover input:checked ~ label:not(:hover):not(:hover ~ label) { color: var(--line-strong); }
.rating-input input:checked + label { transform: scale(1.12); }
.rating-input input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 0; }

/* meta row: ★ ٤٫٦ · ⏱ ٢٥–٣٥ د · 🛵 ١٥ ج.م */
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: var(--fs-sm); color: var(--muted); line-height: 1.4; }
.meta > * { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.meta .ic { width: 16px; height: 16px; }

.price { font-weight: var(--fw-semi); color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-old { color: var(--muted); font-size: var(--fs-sm); text-decoration: line-through; white-space: nowrap; }
.price--discount { color: var(--brand); }

/* ---------------------------------------------------------------------
   8. Cards
   --------------------------------------------------------------------- */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); border: var(--card-border); padding: var(--s-4); }
.card--flat { box-shadow: none; border: 1px solid var(--line); }
.card--lg { padding: var(--s-5); }
.card--flush { padding: 0; overflow: hidden; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); }
.card__title { font-size: var(--fs-md); font-weight: var(--fw-bold); }
a.card { display: block; color: inherit; text-decoration: none; transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2); }
a.card:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }

/* hero card (wallet balance / driver earnings) — brand surface */
.hero-card { position: relative; overflow: hidden; border-radius: var(--r-xl); padding: var(--s-5); background: var(--hero-bg); color: var(--header-ink); border: var(--card-border); }
.hero-card::after { content: ""; position: absolute; inset-inline-end: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: var(--header-fill); pointer-events: none; }
.hero-card__label { font-size: var(--fs-sm); color: var(--header-muted); }
.hero-card__value { font-size: var(--fs-3xl); font-weight: var(--fw-bold); line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hero-card__value small { font-size: var(--fs-md); font-weight: var(--fw-semi); color: var(--header-muted); }
.hero-card .btn--glass { --btn-bg: var(--header-fill-hover); --btn-fg: var(--header-ink); --btn-bg-hover: color-mix(in srgb, var(--header-ink) 26%, transparent); }

/* store card */
.store-card {
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--sh-1); border: var(--card-border);
  color: inherit; text-decoration: none !important;
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2);
}
@media (hover: hover) { .store-card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); } }
.store-card:active { transform: scale(.99); }
.store-card__cover { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background-color: var(--surface-2); }
.store-card__cover > img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-3) var(--ease); }
@media (hover: hover) { .store-card:hover .store-card__cover > img { transform: scale(1.03); } }
.store-card__ribbon {
  position: absolute; top: var(--s-3); inset-inline-start: 0; z-index: 1;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px var(--s-3) 4px 10px;
  border-start-end-radius: var(--r-pill); border-end-end-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-ink);
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
  box-shadow: 0 2px 8px rgb(0 0 0 / .18);
}
.store-card__ribbon .ic { width: 14px; height: 14px; }
.store-card__fav { position: absolute; top: var(--s-2); inset-inline-end: var(--s-2); z-index: 1; }
.store-card__badges { position: absolute; bottom: var(--s-2); inset-inline-end: var(--s-2); display: flex; gap: 4px; z-index: 1; }
.store-card__badges .tag { background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink); backdrop-filter: blur(6px); }
.store-card__body { position: relative; display: flex; gap: var(--s-3); padding: var(--s-3) var(--s-4) var(--s-4); }
.store-card__logo {
  width: 56px; height: 56px; margin-top: -36px; flex-shrink: 0;
  border-radius: 50%; overflow: hidden;
  border: 3px solid var(--surface); background-color: var(--surface);
  box-shadow: 0 2px 8px rgb(0 0 0 / .12);
  display: grid; place-items: center; font-weight: var(--fw-bold); color: var(--brand);
}
.store-card__logo > img { width: 100%; height: 100%; object-fit: cover; }
.store-card__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.store-card__name { font-size: var(--fs-md); font-weight: var(--fw-bold); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-card__sub { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-card__info .meta { margin-top: 6px; gap: 4px 10px; }
@media (max-width: 399px) { .store-card .rating__count { display: none; } }
.store-card__closed {
  position: absolute; inset: 0; z-index: 2;
  display: none; place-items: center; text-align: center; padding: var(--s-4);
  background: rgb(10 14 12 / .58); color: #fff;
  font-weight: var(--fw-semi); font-size: var(--fs-sm); line-height: 1.5;
}
.store-card__closed strong { display: block; font-size: var(--fs-md); font-weight: var(--fw-bold); }
.store-card.is-closed .store-card__closed { display: grid; }
.store-card.is-closed .store-card__cover > img, .store-card.is-closed .store-card__cover.ph { filter: grayscale(.85); }
.store-card.is-closed .store-card__ribbon { display: none; }
.store-card.is-closed .store-card__info { opacity: .65; }
/* compact horizontal store row (search results) */
.store-row { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 0; color: inherit; text-decoration: none !important; }
.store-row + .store-row { border-top: 1px solid var(--line); }
.store-row__logo { width: 64px; height: 64px; border-radius: var(--r-md); overflow: hidden; flex-shrink: 0; }
.store-row__logo > img { width: 100%; height: 100%; object-fit: cover; }
.store-row__info { flex: 1; min-width: 0; }

/* store page hero */
.store-hero { position: relative; margin-inline: calc(var(--gutter) * -1); }
.store-hero__cover { aspect-ratio: 16 / 9; max-height: 320px; width: 100%; }
.store-hero__cover > img { width: 100%; height: 100%; object-fit: cover; }
.store-hero__actions { position: absolute; top: var(--s-3); inset-inline: var(--s-3); display: flex; justify-content: space-between; }
.store-hero__card { position: relative; margin: -48px var(--gutter) 0; }
.store-hero__card .store-card__logo { margin-top: -52px; width: 72px; height: 72px; }
@media (min-width: 768px) { .store-hero { margin-inline: 0; border-radius: var(--r-lg); } .store-hero__cover { border-radius: var(--r-lg); overflow: hidden; } }

/* item row — text on the right, 96px image on the left */
.item-row { display: flex; align-items: flex-start; gap: var(--s-4); padding: var(--s-4) 0; color: inherit; text-decoration: none !important; }
.item-row + .item-row { border-top: 1px solid var(--line); }
.item-row__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.item-row__name { font-size: var(--fs-md); font-weight: var(--fw-semi); line-height: 1.4; }
.item-row__desc { font-size: var(--fs-sm); color: var(--muted); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-row__price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px var(--s-2); margin-top: 4px; }
.item-row__media { position: relative; width: 96px; height: 96px; flex-shrink: 0; border-radius: var(--r-md); background-color: var(--surface-2); margin-bottom: 12px; }
.item-row__media > img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.item-row__add, .item-row__media .stepper {
  position: absolute; bottom: -14px; inset-inline: 0; margin-inline: auto; width: max-content;
}
.item-row__add {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); color: var(--brand);
  box-shadow: 0 2px 10px rgb(0 0 0 / .14); border: 1px solid var(--line);
  transition: transform var(--dur-1) var(--ease), background var(--dur-1), color var(--dur-1);
}
.item-row__add::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; }
.item-row__add:hover { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.item-row__add:active { transform: scale(.9); }
.item-row__add .ic { width: 22px; height: 22px; stroke-width: 2.2; }
.item-row.is-unavailable .item-row__media, .item-row.is-unavailable .item-row__body { opacity: .5; }
.item-row.is-unavailable .item-row__add { display: none; }
@media (min-width: 768px) { .item-row__media { width: 112px; height: 112px; } }
.items-grid { display: grid; grid-template-columns: 1fr; column-gap: var(--s-6); }
@media (min-width: 900px) {
  .items-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .items-grid > .item-row { border-top: 1px solid var(--line); }
  .items-grid > .item-row:nth-child(-n + 2) { border-top: 0; }
}

/* qty stepper */
.stepper {
  display: inline-flex; align-items: center; gap: 2px;
  height: 44px; padding: 2px;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: var(--surface);
}
.stepper__btn { position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--brand); transition: background var(--dur-1), transform var(--dur-1); }
.stepper__btn:hover { background: var(--brand-soft); }
.stepper__btn:active { transform: scale(.88); }
.stepper__btn .ic { width: 20px; height: 20px; stroke-width: 2.2; }
.stepper__btn--danger { color: var(--danger); }
.stepper__btn--danger:hover { background: var(--danger-soft); }
.stepper__val { min-width: 24px; text-align: center; font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.stepper--sm { height: 40px; }
.stepper--sm .stepper__btn { width: 34px; height: 34px; }
.stepper--sm .stepper__btn::after { content: ""; position: absolute; inset: -4px -2px; }
.stepper--float { border-color: transparent; box-shadow: 0 2px 12px rgb(0 0 0 / .16); }
.stepper--lg { height: 52px; }
.stepper--lg .stepper__btn { width: 46px; height: 46px; }
.stepper--lg .stepper__val { min-width: 36px; font-size: var(--fs-lg); }

/* category tiles — food (big) · grocery · pharmacy */
.cat-tiles { display: grid; grid-template-columns: 1.15fr 1fr; grid-template-rows: repeat(2, minmax(108px, auto)); gap: var(--s-3); }
.cat-tiles > :first-child { grid-row: span 2; }
.cat-tile {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 108px; padding: var(--s-3) var(--s-4);
  border-radius: var(--r-lg); background-color: var(--surface-2);
  color: #fff; text-decoration: none !important;
  box-shadow: var(--sh-1);
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2);
}
.cat-tile__img { position: absolute; inset: 0; z-index: -2; }
.cat-tile__img > img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-3) var(--ease); }
.cat-tile::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgb(8 12 10 / .72) 0%, rgb(8 12 10 / .25) 50%, transparent 75%); }
.cat-tile__label { font-size: var(--fs-lg); font-weight: var(--fw-bold); line-height: 1.25; }
.cat-tile__sub { font-size: var(--fs-xs); opacity: .92; }
.cat-tile__icon { position: absolute; top: var(--s-3); inset-inline-start: var(--s-3); width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: rgb(255 255 255 / .9); color: #0B5D4B; }
.cat-tile__icon .ic { width: 20px; height: 20px; }
.cat-tiles > :first-child .cat-tile__label { font-size: var(--fs-xl); }
@media (hover: hover) { .cat-tile:hover { transform: translateY(-2px); box-shadow: var(--sh-2); } .cat-tile:hover .cat-tile__img > img { transform: scale(1.04); } }
@media (min-width: 768px) {
  .cat-tiles { grid-template-columns: repeat(3, 1fr); grid-template-rows: auto; }
  .cat-tiles > :first-child { grid-row: auto; }
  .cat-tile { aspect-ratio: 16 / 10; }
}
/* small round sub-category bubbles (cuisines) */
.cuisine { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 76px; color: var(--ink); font-size: var(--fs-xs); font-weight: var(--fw-semi); text-align: center; text-decoration: none !important; }
.cuisine__img { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; box-shadow: var(--sh-1); transition: transform var(--dur-2) var(--ease); }
.cuisine__img > img { width: 100%; height: 100%; object-fit: cover; }
.cuisine.is-selected .cuisine__img { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--brand); }
.cuisine.is-selected { color: var(--brand); }

/* banner carousel */
.carousel { position: relative; }
.carousel__track {
  display: flex; gap: var(--s-3);
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: none; overscroll-behavior-x: contain;
  margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter);
}
.carousel__track::-webkit-scrollbar { display: none; }
.carousel__slide { flex: 0 0 88%; scroll-snap-align: start; }
@media (min-width: 768px) { .carousel__slide { flex-basis: calc(50% - 6px); } }
@media (min-width: 1200px) { .carousel__slide { flex-basis: calc(33.333% - 8px); } }
.carousel__dots { display: flex; justify-content: center; gap: 6px; margin-top: var(--s-3); }
.carousel__dot { width: 6px; height: 6px; border-radius: var(--r-pill); background: var(--line-strong); transition: width var(--dur-3) var(--ease), background var(--dur-2); }
.carousel__dot.is-active { width: 22px; background: var(--brand); }

.banner {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
  aspect-ratio: 2 / 1; padding: var(--s-5) var(--s-5) var(--s-4);
  border-radius: var(--r-lg); background-color: var(--surface-2);
  color: #fff; text-decoration: none !important;
}
.banner > img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.banner::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(270deg, rgb(8 12 10 / .7) 0%, rgb(8 12 10 / .35) 55%, transparent 85%); }
.banner__eyebrow { align-self: flex-start; margin-bottom: auto; }
.banner__title { font-size: var(--fs-xl); font-weight: var(--fw-bold); line-height: 1.2; max-width: 75%; }
.banner__text { font-size: var(--fs-sm); opacity: .92; max-width: 75%; }

/* coupon / offer card */
.coupon { display: flex; align-items: stretch; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); border: var(--card-border); overflow: hidden; }
.coupon__value { position: relative; display: grid; place-items: center; align-content: center; min-width: 96px; padding: var(--s-4) var(--s-3); background: var(--brand-soft); color: var(--brand); text-align: center; border-inline-end: 2px dashed var(--line-strong); }
.coupon__value strong { font-size: var(--fs-xl); font-weight: var(--fw-bold); line-height: 1.1; }
.coupon__value span { font-size: var(--fs-xs); font-weight: var(--fw-semi); }
.coupon__body { flex: 1; min-width: 0; padding: var(--s-3) var(--s-4); display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.coupon__title { font-weight: var(--fw-semi); }
.coupon__code { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border-radius: var(--r-sm); background: var(--surface-2); font-size: var(--fs-sm); font-weight: var(--fw-bold); letter-spacing: .06em; direction: ltr; }

/* ---------------------------------------------------------------------
   9. Lists, avatar, dividers
   --------------------------------------------------------------------- */
.list { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); border: var(--card-border); overflow: hidden; }
.list--plain { background: none; box-shadow: none; border: 0; border-radius: 0; }
.list-row {
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%; min-height: 60px; padding: var(--s-3) var(--s-4);
  color: var(--ink); text-align: start; text-decoration: none !important;
  background: none; border: 0;
  transition: background var(--dur-1);
}
.list-row + .list-row { border-top: 1px solid var(--line); }
a.list-row:hover, button.list-row:hover, label.list-row:hover { background: var(--surface-2); }
label.list-row { cursor: pointer; }
.list-row__icon { width: 40px; height: 40px; border-radius: var(--r-md); display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); color: var(--brand); }
.list-row__icon .ic { width: 20px; height: 20px; }
.list-row__icon--danger { background: var(--danger-soft); color: var(--danger); }
.list-row__body { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.45; }
.list-row__title { font-weight: var(--fw-semi); }
.list-row__sub { font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row__end { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.list-row__chev { width: 20px; height: 20px; color: var(--muted); flex-shrink: 0; }
.list-row--danger .list-row__title { color: var(--danger); }

.avatar {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 50%; overflow: hidden;
  display: inline-grid; place-items: center;
  background-color: var(--brand-soft); color: var(--brand);
  font-size: var(--fs-sm); font-weight: var(--fw-bold); line-height: 1;
}
.avatar > img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 32px; height: 32px; font-size: var(--fs-xs); }
.avatar--lg { width: 56px; height: 56px; font-size: var(--fs-lg); }
.avatar--xl { width: 80px; height: 80px; font-size: var(--fs-xl); }
.avatar-group { display: inline-flex; }
.avatar-group > .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-group > .avatar + .avatar { margin-inline-start: -10px; }
.avatar--more { background-color: var(--surface-2); color: var(--muted); }

.divider { height: 1px; background: var(--line); margin-block: var(--s-4); border: 0; }
.divider--thick { height: 8px; background: var(--surface-2); margin-inline: calc(var(--gutter) * -1); }
.divider--dashed { height: 0; background: none; border-top: 1px dashed var(--line-strong); }
.divider--label { display: flex; align-items: center; gap: var(--s-3); height: auto; background: none; color: var(--muted); font-size: var(--fs-xs); }
.divider--label::before, .divider--label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------------------------------------------------------------------
   10. Price breakdown, timeline, progress
   --------------------------------------------------------------------- */
.price-rows { display: flex; flex-direction: column; gap: var(--s-3); }
.price-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4); font-size: var(--fs-sm); color: var(--muted); }
.price-row__label { display: inline-flex; align-items: center; gap: 6px; }
.price-row__label .ic { width: 16px; height: 16px; }
.price-row__hint { display: block; font-size: var(--fs-xs); color: var(--muted); }
.price-row__value { color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-row--sub { padding-inline-start: var(--s-4); font-size: var(--fs-xs); }
.price-row--discount .price-row__value, .price-row--discount .price-row__label { color: var(--brand); font-weight: var(--fw-semi); }
.price-row--free .price-row__value { color: var(--brand); font-weight: var(--fw-semi); }
.price-row--total { margin-top: var(--s-1); padding-top: var(--s-4); border-top: 1px dashed var(--line-strong); color: var(--ink); font-size: var(--fs-md); font-weight: var(--fw-bold); }
.price-row--total .price-row__value { font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.price-group { padding-bottom: var(--s-3); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--s-2); }
.price-group__title { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--ink); }

.timeline { display: flex; flex-direction: column; }
.timeline__step { position: relative; display: grid; grid-template-columns: 32px 1fr; gap: var(--s-3); padding-bottom: var(--s-5); }
.timeline__step:last-child { padding-bottom: 0; }
.timeline__step::before { content: ""; position: absolute; inset-inline-start: 15px; top: 36px; bottom: 4px; width: 2px; border-radius: 2px; background: var(--line); }
.timeline__step:last-child::before { display: none; }
.timeline__step.is-done::before { background: var(--brand); }
.timeline__dot {
  position: relative; z-index: 1;
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); color: var(--muted); border: 2px solid var(--line-strong);
  transition: background var(--dur-2), border-color var(--dur-2), color var(--dur-2);
}
.timeline__dot .ic { width: 16px; height: 16px; stroke-width: 2.2; }
.timeline__step.is-done .timeline__dot { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.timeline__step.is-current .timeline__dot { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); animation: ring 1.8s var(--ease) infinite; }
.timeline__body { padding-top: 4px; min-width: 0; }
.timeline__title { font-weight: var(--fw-semi); line-height: 1.4; }
.timeline__step:not(.is-done):not(.is-current) .timeline__title { color: var(--muted); font-weight: var(--fw-regular); }
.timeline__step.is-current .timeline__title { color: var(--brand); font-weight: var(--fw-bold); }
.timeline__time, .timeline__text { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 35%, transparent); } 80%, 100% { box-shadow: 0 0 0 10px transparent; } }

/* compact horizontal steps (order card / tracking header) */
.steps { display: flex; gap: 4px; }
.steps__seg { flex: 1; height: 4px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; position: relative; }
.steps__seg.is-done { background: var(--brand); }
.steps__seg.is-current { background: color-mix(in srgb, var(--brand) 25%, var(--line)); }
.steps__seg.is-current::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 45%; border-radius: inherit; background: var(--brand); animation: seg 1.6s var(--ease) infinite; }
@keyframes seg { 0% { inset-inline-start: -45%; } 100% { inset-inline-start: 100%; } }
.steps-label { display: flex; justify-content: space-between; gap: var(--s-2); margin-top: var(--s-2); font-size: var(--fs-xs); color: var(--muted); }
.steps-label .is-current { color: var(--brand); font-weight: var(--fw-semi); }
/* icon steps (horizontal) */
.isteps { display: flex; align-items: center; }
.isteps__item { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex-shrink: 0; }
.isteps__item .ic { width: 18px; height: 18px; }
.isteps__item.is-done { background: var(--brand); color: var(--brand-ink); }
.isteps__item.is-current { background: var(--brand-soft); color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.isteps__line { flex: 1; height: 2px; background: var(--line); margin-inline: 4px; border-radius: 2px; }
.isteps__line.is-done { background: var(--brand); }

.progress { height: 8px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.progress__bar { height: 100%; width: var(--value, 0%); border-radius: inherit; background: var(--brand); transition: width var(--dur-3) var(--ease); }
.progress--sm { height: 4px; }
.progress--on-brand { background: var(--header-fill-hover); }
.progress--on-brand .progress__bar { background: var(--header-ink); }

/* ---------------------------------------------------------------------
   11. Overlays — bottom sheet, dialog, toast
   --------------------------------------------------------------------- */
.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0 auto;
  width: 100%; max-width: 640px; max-height: 92dvh;
  padding: 0; border: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--surface); color: var(--ink);
  box-shadow: var(--sh-3);
  transform: translateY(100%);
  transition: transform var(--dur-3) var(--ease);
  overflow: hidden;
}
.sheet[open], .sheet.is-static { display: flex; flex-direction: column; }
.sheet.is-open { transform: none; }
.sheet::backdrop { background: rgb(10 14 12 / .5); animation: fade-in var(--dur-3) var(--ease); }
.sheet.is-closing::backdrop, .dialog.is-closing::backdrop { opacity: 0; transition: opacity var(--dur-2); }
.sheet__handle { flex-shrink: 0; width: 40px; height: 4px; border-radius: var(--r-pill); background: var(--line-strong); margin: 10px auto 0; }
.sheet__head { flex-shrink: 0; display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-4) 0 var(--s-2); padding-inline-start: var(--s-5); min-height: 56px; }
.sheet__title { flex: 1; min-width: 0; font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.sheet__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: var(--s-3) var(--s-5) var(--s-5); }
.sheet__media { margin: calc(var(--s-3) * -1) calc(var(--s-5) * -1) var(--s-4); aspect-ratio: 16 / 9; }
.sheet__foot { flex-shrink: 0; padding: var(--s-3) var(--s-5) calc(var(--s-4) + var(--safe-bottom)); border-top: 1px solid var(--line); background: var(--surface); display: flex; gap: var(--s-3); align-items: center; }
.sheet__foot > .btn { flex: 1; }
.sheet.is-static { position: relative; transform: none; max-width: 100%; box-shadow: var(--sh-2); border: var(--card-border); }
@media (min-width: 768px) {
  .sheet { inset: 0; margin: auto; height: fit-content; max-width: 560px; max-height: 86dvh; border-radius: var(--r-xl); transform: translateY(16px) scale(.98); opacity: 0; transition: transform var(--dur-3) var(--ease), opacity var(--dur-2); }
  .sheet.is-open { transform: none; opacity: 1; }
  .sheet:not(.is-static) .sheet__handle { display: none; }
  .sheet:not(.is-static) .sheet__head { padding-top: var(--s-3); }
  .sheet__foot { padding-bottom: var(--s-4); }
  .sheet.is-static { opacity: 1; }
}

.dialog {
  inset: 0; margin: auto; height: fit-content;
  width: min(100% - 48px, 400px);
  padding: var(--s-5); border: 0; border-radius: var(--r-xl);
  background: var(--surface); color: var(--ink); box-shadow: var(--sh-3);
  opacity: 0; transform: scale(.94);
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-3) var(--ease);
}
.dialog.is-open, .dialog.is-static { opacity: 1; transform: none; }
.dialog.is-static { position: relative; display: block; margin: 0 auto; box-shadow: var(--sh-2); border: var(--card-border); }
.dialog::backdrop { background: rgb(10 14 12 / .5); animation: fade-in var(--dur-2) var(--ease); }
.dialog__icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: var(--s-4); }
.dialog__icon--danger { background: var(--danger-soft); color: var(--danger); }
.dialog__title { font-size: var(--fs-lg); font-weight: var(--fw-bold); line-height: 1.35; }
.dialog__text { margin-top: var(--s-2); color: var(--muted); font-size: var(--fs-sm); line-height: 1.7; }
/* owner rule: «رجوع» on the RIGHT (first in DOM), green «نعم، …» on the LEFT */
.dialog__actions { display: flex; gap: var(--s-3); margin-top: var(--s-5); }
.dialog__actions > .btn { flex: 1; }
@keyframes fade-in { from { opacity: 0; } }

.toasts {
  position: fixed; z-index: var(--z-toast);
  top: calc(var(--safe-top) + var(--s-3)); inset-inline: 0;
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2);
  padding-inline: var(--s-4); pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: var(--s-3);
  width: fit-content; max-width: min(100%, 480px); min-height: 52px;
  padding: var(--s-3) var(--s-4); padding-inline-start: var(--s-3);
  border-radius: var(--r-md);
  background: var(--inverse-bg); color: var(--inverse-ink);
  box-shadow: var(--sh-2);
  font-size: var(--fs-sm); font-weight: var(--fw-semi); line-height: 1.5;
  animation: toast-in var(--dur-3) var(--ease);
}
.toast.is-leaving { animation: toast-out var(--dur-2) var(--ease-in) forwards; }
.toast .ic { width: 22px; height: 22px; color: var(--inverse-muted); }
.toast--success .ic { color: var(--inverse-brand); }
.toast--error .ic { color: var(--inverse-danger); }
.toast__action { margin-inline-start: var(--s-2); min-height: 36px; padding: 0 var(--s-2); color: var(--inverse-brand); font-weight: var(--fw-bold); }
.toast.is-static { animation: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px) scale(.97); } }

/* tooltip (data-tip) — used by charts */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); inset-inline-start: 50%; translate: 50% 4px;
  padding: 6px 10px; border-radius: var(--r-sm);
  background: var(--inverse-bg); color: var(--inverse-ink);
  font-size: var(--fs-xs); font-weight: var(--fw-semi); white-space: nowrap; line-height: 1.4;
  opacity: 0; pointer-events: none; z-index: 5;
  transition: opacity var(--dur-1), translate var(--dur-1);
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; translate: 50% 0; }

/* ---------------------------------------------------------------------
   12. Loading + empty
   --------------------------------------------------------------------- */
.sk {
  display: block;
  background: linear-gradient(100deg, var(--skeleton-a) 30%, var(--skeleton-b) 50%, var(--skeleton-a) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
.sk--text { height: 12px; width: 100%; border-radius: var(--r-pill); }
.sk--text + .sk--text { margin-top: 8px; }
.sk--title { height: 16px; width: 55%; border-radius: var(--r-pill); }
.sk--circle { border-radius: 50%; }
.sk--img { aspect-ratio: 16 / 9; width: 100%; border-radius: 0; }
.sk--w40 { width: 40%; } .sk--w60 { width: 60%; } .sk--w80 { width: 80%; }
.sk-card { background: var(--surface); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-1); border: var(--card-border); }
.sk-card__body { padding: var(--s-4); display: flex; flex-direction: column; gap: 10px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-2); padding: var(--s-7) var(--s-5); }
.empty__art { width: 168px; height: 128px; margin-bottom: var(--s-3); }
.empty__art svg { width: 100%; height: 100%; }
.empty__title { font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.empty__text { color: var(--muted); font-size: var(--fs-sm); max-width: 320px; }
.empty .btn { margin-top: var(--s-4); }
/* illustration palette (inline SVG uses these classes) */
.ill-bg { fill: var(--brand-soft); }
.ill-fill { fill: var(--surface); stroke: var(--brand); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.ill-line { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ill-soft { fill: var(--line); }
.ill-accent { fill: var(--accent); }

/* ---------------------------------------------------------------------
   13. Map
   --------------------------------------------------------------------- */
.map {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 240px; border-radius: var(--r-lg);
  background-color: var(--surface-2);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 32px 32px;
  border: var(--card-border);
}
.map--tall { min-height: 50dvh; }
.map--bleed { border-radius: 0; margin-inline: calc(var(--gutter) * -1); }
.map > .leaflet-container, .map__canvas { position: absolute; inset: 0; z-index: 0; font-family: var(--font); background: var(--surface-2); }
.map__pill {
  position: absolute; z-index: 500; top: var(--s-3); inset-inline-start: var(--s-3);
  display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: 40px; padding: 0 var(--s-4);
  border-radius: var(--r-pill); background: var(--surface); color: var(--ink);
  box-shadow: var(--sh-2); font-size: var(--fs-sm); font-weight: var(--fw-semi);
}
.map__pill .ic { width: 18px; height: 18px; color: var(--brand); }
.map__controls { position: absolute; z-index: 500; bottom: var(--s-3); inset-inline-end: var(--s-3); display: flex; flex-direction: column; gap: var(--s-2); }
/* Leaflet divIcon markers: L.divIcon({className:'', html:'<div class="marker marker--driver">…icon…</div>'}) */
.marker { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--brand); box-shadow: 0 2px 10px rgb(0 0 0 / .25); border: 3px solid var(--surface); }
.marker .ic { width: 20px; height: 20px; }
.marker--driver { background: var(--brand); color: var(--brand-ink); animation: ring 1.8s var(--ease) infinite; }
.marker--home { background: var(--ink); color: var(--bg); }
.marker--store { background: var(--surface); color: var(--brand); }
.leaflet-container .leaflet-control-attribution { font-size: 10px; background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--muted); }
.leaflet-container .leaflet-control-attribution a { color: var(--muted); }
:root[data-theme="dark"] .map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6); } }

/* ---------------------------------------------------------------------
   14. Dashboard (vendor / admin) — sidebar + top bar, drawer on mobile
   --------------------------------------------------------------------- */
.dash { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); }
.dash__side {
  position: fixed; z-index: var(--z-drawer);
  inset-block: 0; inset-inline-start: 0;
  width: min(86vw, 300px);
  display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-4) var(--s-3) calc(var(--s-4) + var(--safe-bottom));
  background: var(--header-bg); color: var(--header-ink);
  border-inline-end: var(--card-border);
  transform: translateX(100%);
  transition: transform var(--dur-3) var(--ease);
  overflow-y: auto;
}
:root[dir="ltr"] .dash__side { transform: translateX(-100%); }
.dash.is-open .dash__side { transform: none; box-shadow: var(--sh-3); }
.dash__backdrop { position: fixed; inset: 0; z-index: calc(var(--z-drawer) - 1); background: rgb(10 14 12 / .5); opacity: 0; pointer-events: none; transition: opacity var(--dur-3); }
.dash.is-open .dash__backdrop { opacity: 1; pointer-events: auto; }
.dash__side :focus-visible { outline-color: var(--header-ink); }
.dash__brand { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-2) var(--s-4); }
.dash__brand .logo { font-size: var(--fs-lg); }
.dash__role { font-size: var(--fs-xs); color: var(--header-muted); padding: 2px 10px; border-radius: var(--r-pill); background: var(--header-fill); white-space: nowrap; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav__label { padding: var(--s-4) var(--s-3) var(--s-2); font-size: var(--fs-xs); color: var(--header-muted); }
.side-nav__link {
  position: relative;
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 46px; padding: 0 var(--s-3);
  border-radius: var(--r-md);
  color: var(--header-muted); font-size: var(--fs-sm); font-weight: var(--fw-semi);
  text-decoration: none !important;
  transition: background var(--dur-1), color var(--dur-1);
}
.side-nav__link .ic { width: 20px; height: 20px; }
.side-nav__link:hover { background: var(--header-fill); color: var(--header-ink); }
.side-nav__link.is-active { background: var(--header-fill-hover); color: var(--header-ink); }
.side-nav__link.is-active::before { content: ""; position: absolute; inset-inline-start: -12px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--header-ink); }
.side-nav__link .badge { margin-inline-start: auto; background: var(--header-ink); color: var(--header-bg); }
.dash__user { margin-top: auto; display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-2) 0; border-top: 1px solid var(--header-fill-hover); }
.dash__user .avatar { background: var(--header-fill-hover); color: var(--header-ink); }
.dash__user-name { flex: 1; min-width: 0; font-size: var(--fs-sm); font-weight: var(--fw-semi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash__user .btn--icon { color: var(--header-ink); --btn-bg-hover: var(--header-fill); }
.dash__body { min-width: 0; display: flex; flex-direction: column; }
.dash__top {
  position: sticky; top: 0; z-index: var(--z-header);
  display: flex; align-items: center; gap: var(--s-2);
  min-height: var(--header-h); padding: var(--safe-top) var(--gutter) 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.dash__title { flex: 1; min-width: 0; font-size: var(--fs-lg); font-weight: var(--fw-bold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash__actions { display: flex; align-items: center; gap: var(--s-1); }
.dash__main { flex: 1; width: 100%; max-width: 1400px; padding: var(--s-5) var(--gutter) var(--s-7); }
@media (min-width: 1024px) {
  .dash { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .dash__side { position: sticky; top: 0; height: 100dvh; width: auto; transform: none !important; box-shadow: none !important; }
  .dash__backdrop, .dash__menu { display: none; }
  .dash__main { padding-top: var(--s-6); padding-inline: var(--s-6); }
  .dash__top { padding-inline: var(--s-6); }
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: var(--s-3); margin-bottom: var(--s-5); }
.page-head__title { font-size: var(--fs-xl); font-weight: var(--fw-bold); }
.page-head__sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); } }
.kpi { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: var(--s-4); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); border: var(--card-border); }
.kpi__label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--muted); }
.kpi__label .ic { width: 16px; height: 16px; }
.kpi__value { font-size: var(--fs-xl); font-weight: var(--fw-bold); line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi__unit { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--muted); margin-inline-start: 2px; }
.kpi__delta { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--muted); }
.kpi__delta .ic { width: 14px; height: 14px; }
.kpi__delta--up { color: var(--brand); }
.kpi__delta--down { color: var(--danger); }
.kpi__spark { height: 32px; margin-top: 4px; }
.kpi--hero { background: var(--hero-bg); color: var(--header-ink); }
.kpi--hero .kpi__label, .kpi--hero .kpi__unit, .kpi--hero .kpi__delta { color: var(--header-muted); }
@media (min-width: 900px) { .kpi__value { font-size: var(--fs-2xl); } }

/* data table — add .table--stack to turn rows into cards under 720px (td[data-label]) */
.table-wrap { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); border: var(--card-border); overflow-x: auto; }
.table { width: 100%; font-size: var(--fs-sm); }
.table th { padding: var(--s-3) var(--s-4); text-align: start; font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.table td { padding: var(--s-3) var(--s-4); border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background var(--dur-1); }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table .num, .table th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: end; white-space: nowrap; }
.table__main { font-weight: var(--fw-semi); }
.table__cell-media { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.table__thumb { width: 40px; height: 40px; border-radius: var(--r-sm); overflow: hidden; flex-shrink: 0; }
.table__thumb > img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 719px) {
  .table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { padding: var(--s-3) var(--s-4); }
  .table--stack tr + tr { border-top: 1px solid var(--line); }
  .table--stack td { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 6px 0; border: 0; text-align: end; }
  .table--stack td::before { content: attr(data-label); font-size: var(--fs-xs); color: var(--muted); text-align: start; flex-shrink: 0; }
  .table--stack td:not([data-label])::before, .table--stack td[data-label=""]::before { display: none; }
  .table--stack td.table__main { font-size: var(--fs-md); padding-bottom: var(--s-2); text-align: start; }
  .table--stack td.actions { justify-content: flex-end; padding-top: var(--s-2); }
  .table--stack td.num { text-align: end; }
  .table-wrap:has(.table--stack) { overflow: hidden; }
}

/* charts — single series in brand, recessive grid, hover tooltip via data-tip */
.chart { display: flex; flex-direction: column; gap: var(--s-3); }
.chart__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.chart__title { font-size: var(--fs-md); font-weight: var(--fw-bold); }
.chart__sub { font-size: var(--fs-xs); color: var(--muted); }
.bar-chart { display: flex; align-items: stretch; height: var(--h, 200px); }
.bar-chart__col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; outline: none; }
.bar-chart__track {
  flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center;
  background-image: linear-gradient(to bottom, var(--chart-grid) 1px, transparent 1px);
  background-size: 100% 25%;
  border-bottom: 1px solid var(--line-strong);
}
.bar-chart__bar {
  position: relative;
  width: 62%; max-width: 36px; min-height: 2px; height: var(--v, 0%);
  border-radius: 4px 4px 0 0; background: var(--chart-1);
  transition: height var(--dur-3) var(--ease), background var(--dur-1), opacity var(--dur-1);
}
.bar-chart:hover .bar-chart__bar { opacity: .45; }
.bar-chart__col:hover .bar-chart__bar, .bar-chart__col:focus-visible .bar-chart__bar { opacity: 1; background: var(--brand-strong); }
.bar-chart__val { position: absolute; bottom: calc(100% + 4px); inset-inline: -20px; text-align: center; font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--ink); white-space: nowrap; }
.bar-chart__x { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; line-height: 1.2; }
.line-chart { position: relative; height: var(--h, 200px); }
.line-chart__plot { position: absolute; inset: 0 0 24px 0; }
.line-chart__svg { width: 100%; height: 100%; display: block; overflow: visible; }
.line-chart__grid { stroke: var(--chart-grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.line-chart__base { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.line-chart__area { fill: var(--chart-1-soft); stroke: none; }
.line-chart__line { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.line-chart__pt { position: absolute; top: 0; bottom: 0; translate: 50% 0; outline: none; }
.line-chart__pt::before { content: ""; position: absolute; top: 0; bottom: 0; inset-inline-start: 50%; width: 1px; background: var(--line-strong); opacity: 0; transition: opacity var(--dur-1); }
.line-chart__dot { position: absolute; inset-inline-start: 50%; width: 10px; height: 10px; margin: -5px -5px 0 0; border-radius: 50%; background: var(--chart-1); box-shadow: 0 0 0 2px var(--surface); opacity: 0; transition: opacity var(--dur-1); }
.line-chart__pt:hover .line-chart__dot, .line-chart__pt:focus-visible .line-chart__dot, .line-chart__pt.is-last .line-chart__dot,
.line-chart__pt:hover::before, .line-chart__pt:focus-visible::before { opacity: 1; }
.line-chart__x { position: absolute; inset: auto 0 0 0; height: 18px; }
.line-chart__x span { position: absolute; bottom: 0; translate: 50% 0; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; line-height: 1.2; }
.line-chart__x span:first-child { translate: 0 0; }
.line-chart__x span:last-child { translate: 100% 0; }
.sparkline { width: 100%; height: 32px; display: block; overflow: visible; }
.sparkline path { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.kpi--hero .sparkline path { stroke: var(--header-ink); }
.legend { display: flex; flex-wrap: wrap; gap: var(--s-3); font-size: var(--fs-xs); color: var(--muted); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend__swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--chart-1); }

/* kanban (vendor orders board) */
.kanban {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 86%);
  gap: var(--s-3); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin;
  margin-inline: calc(var(--gutter) * -1); padding: 0 var(--gutter) var(--s-3); scroll-padding-inline: var(--gutter);
  align-items: start;
}
@media (min-width: 1024px) { .kanban { grid-auto-columns: minmax(0, 1fr); margin-inline: 0; padding-inline: 0; overflow: visible; } }
.kanban__col { scroll-snap-align: start; display: flex; flex-direction: column; gap: var(--s-3); min-height: 320px; padding: var(--s-3); border-radius: var(--r-lg); background: var(--surface-2); }
.kanban__head { display: flex; align-items: center; gap: var(--s-2); padding: 4px 4px 0; font-size: var(--fs-sm); font-weight: var(--fw-bold); }
.kanban__head .badge { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.kanban__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.kanban__dot--new { background: var(--warn); }
.kanban__dot--active { background: var(--brand); }
.kanban__empty { padding: var(--s-5) var(--s-3); text-align: center; font-size: var(--fs-xs); color: var(--muted); border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); }
.order-card { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-3) var(--s-4); background: var(--surface); border-radius: var(--r-md); box-shadow: var(--sh-1); border: var(--card-border); animation: card-in var(--dur-3) var(--ease); }
.order-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.order-card__id { font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.order-card__time { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.order-card__time .ic { width: 14px; height: 14px; }
.order-card__who { font-size: var(--fs-sm); color: var(--muted); }
.order-card__items { font-size: var(--fs-sm); display: flex; flex-direction: column; gap: 2px; }
.order-card__items li { display: flex; gap: var(--s-2); }
.order-card__items .qty { font-weight: var(--fw-bold); color: var(--brand); min-width: 24px; }
.order-card__note { font-size: var(--fs-xs); padding: 6px 10px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn); }
.order-card__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding-top: var(--s-2); border-top: 1px dashed var(--line); }
.order-card__foot .btn { flex-shrink: 0; }
.order-card.is-new { box-shadow: 0 0 0 2px var(--brand), var(--sh-2); animation: card-in var(--dur-3) var(--ease), ring 1.8s var(--ease) 3; }
.order-card.is-late .order-card__time { color: var(--danger); font-weight: var(--fw-semi); }
@keyframes card-in { from { opacity: 0; transform: translateY(-6px); } }

/* pagination */
.pager { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.pager__btn { min-width: 44px; height: 44px; padding: 0 var(--s-2); border-radius: var(--r-md); display: grid; place-items: center; color: var(--ink); font-weight: var(--fw-semi); font-variant-numeric: tabular-nums; text-decoration: none !important; transition: background var(--dur-1); }
.pager__btn:hover { background: var(--surface-2); }
.pager__btn.is-current, .pager__btn[aria-current="page"] { background: var(--brand); color: var(--brand-ink); }
.pager__btn:disabled, .pager__btn.is-disabled { opacity: .35; pointer-events: none; }
.pager__btn .ic { width: 20px; height: 20px; }
.pager__gap { min-width: 24px; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------------
   15. Utilities
   --------------------------------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: var(--gap, var(--s-4)); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--s-2)); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--gap, var(--s-3)); }
.row { display: flex; align-items: center; gap: var(--gap, var(--s-3)); }
.gap-0 { --gap: 0; } .gap-1 { --gap: var(--s-1); } .gap-2 { --gap: var(--s-2); } .gap-3 { --gap: var(--s-3); }
.gap-4 { --gap: var(--s-4); } .gap-5 { --gap: var(--s-5); } .gap-6 { --gap: var(--s-6); } .gap-7 { --gap: var(--s-7); }
.grow { flex: 1; min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.items-start { align-items: flex-start; }
.w-full { width: 100%; }
.d-block { display: block; } .d-flex { display: flex; } .d-grid { display: grid; }

.t-xs { font-size: var(--fs-xs); } .t-sm { font-size: var(--fs-sm); } .t-md { font-size: var(--fs-md); }
.t-lg { font-size: var(--fs-lg); } .t-xl { font-size: var(--fs-xl); } .t-2xl { font-size: var(--fs-2xl); } .t-3xl { font-size: var(--fs-3xl); line-height: 1.1; }
.t-regular { font-weight: var(--fw-regular); } .t-semi { font-weight: var(--fw-semi); } .t-bold { font-weight: var(--fw-bold); }
.t-muted { color: var(--muted); } .t-ink { color: var(--ink); } .t-brand { color: var(--brand); }
.t-danger { color: var(--danger); } .t-warn { color: var(--warn); }
.t-center { text-align: center; } .t-start { text-align: start; } .t-end { text-align: end; }
.t-tight { line-height: var(--lh-tight); }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.nowrap { white-space: nowrap; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.mt-0 { margin-top: 0; } .mt-1 { margin-top: var(--s-1); } .mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); } .mt-5 { margin-top: var(--s-5); } .mt-6 { margin-top: var(--s-6); } .mt-7 { margin-top: var(--s-7); }
.mb-2 { margin-bottom: var(--s-2); } .mb-3 { margin-bottom: var(--s-3); } .mb-4 { margin-bottom: var(--s-4); } .mb-5 { margin-bottom: var(--s-5); }
.p-0 { padding: 0; } .p-3 { padding: var(--s-3); } .p-4 { padding: var(--s-4); } .p-5 { padding: var(--s-5); }

.surface { background: var(--surface); } .surface-2 { background: var(--surface-2); }
.rounded { border-radius: var(--r-md); } .rounded-lg { border-radius: var(--r-lg); } .rounded-full { border-radius: 50%; }

.vh, .sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
@media (max-width: 767px) { .hide-mobile { display: none !important; } }
@media (min-width: 768px) { .hide-tablet-up { display: none !important; } }
@media (max-width: 1023px) { .only-desktop { display: none !important; } }
@media (min-width: 1024px) { .hide-desktop { display: none !important; } }

/* edge tooltips stay inside the chart */
.bar-chart__col:first-child::after, .line-chart__pt:nth-child(2)::after { inset-inline-start: 0; translate: 0 4px; }
.bar-chart__col:last-child::after, .line-chart__pt:last-child::after { inset-inline-start: auto; inset-inline-end: 0; translate: 0 4px; }
.bar-chart__col:first-child:hover::after, .bar-chart__col:first-child:focus-visible::after, .line-chart__pt:nth-child(2):hover::after,
.bar-chart__col:last-child:hover::after, .bar-chart__col:last-child:focus-visible::after, .line-chart__pt:last-child:hover::after { translate: 0 0; }
.list-row__icon .ic--lg { width: 28px; height: 28px; }
.list-row__icon .ic--xl { width: 40px; height: 40px; }
