/* ==========================================================================
   Zado — Design tokens & primitives
   Luxury fresh produce. Mobile-first, RTL-native, zero frameworks.
   Layer 1 of 3: tokens.css -> store.css / admin.css
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

:root {
  color-scheme: light;

  /* --- Fresh leaf: the brand, the "in stock", the action ------------------
     Lifted a full step in chroma off the old bottle-green. Same family, but
     it now reads as something picked this morning rather than something
     stored in a cellar. */
  --green-50:  #EFFCF4;
  --green-100: #D6F7E4;
  --green-200: #ADEDC9;
  --green-300: #75DDA6;
  --green-400: #3FC880;
  --green-500: #17AE63;
  --green-600: #0C8F51;
  --green-700: #0A7343;
  --green-800: #0A5B37;
  --green-900: #08422A;
  --green-950: #052D1D;

  /* --- Sun mango: deals, savings, warmth ---------------------------------- */
  --citrus-50:  #FFF9EC;
  --citrus-100: #FFEFCB;
  --citrus-200: #FFE0A2;
  --citrus-300: #FFC95C;
  --citrus-400: #FDB022;
  --citrus-500: #EF9A0B;
  --citrus-600: #B96D04;
  --citrus-700: #8E5305;

  /* --- Clear sky: trust, verification, order tracking --------------------- */
  --indigo-50:  #EFF5FF;
  --indigo-100: #DBE8FE;
  --indigo-300: #93B4FD;
  --indigo-500: #3B70F6;
  --indigo-600: #2557D6;
  --indigo-700: #1D45A8;

  /* --- Strawberry: destructive, errors ------------------------------------ */
  --berry-50:  #FFF1F2;
  --berry-100: #FFE1E3;
  --berry-500: #F04350;
  --berry-600: #D3202E;
  --berry-700: #A31824;

  /* --- Neutrals: clean, a whisper of green, never cold grey --------------- */
  --stone-0:   #FFFFFF;
  --stone-50:  #F6FAF7;
  --stone-100: #EDF3EF;
  --stone-200: #DFE8E2;
  --stone-300: #C7D2CB;

  --ink-300: #9EAAA3;
  --ink-400: #78857E;
  --ink-500: #58655E;
  --ink-700: #33403A;
  --ink-900: #12211A;

  /* --- Semantic surfaces ------------------------------------------------- */
  --bg-app:      var(--stone-50);
  --bg-raised:   var(--stone-0);
  --bg-sunken:   var(--stone-100);
  --bg-inverse:  var(--ink-900);
  --hairline:    var(--stone-200);
  --hairline-soft: rgba(18, 33, 26, 0.06);

  --text-strong: var(--ink-900);
  --text-body:   var(--ink-700);
  --text-muted:  var(--ink-500);
  --text-faint:  var(--ink-400);
  --text-invert: var(--stone-0);

  --accent:        var(--green-500);
  --accent-hover:  var(--green-600);
  --accent-press:  var(--green-700);
  --accent-tint:   var(--green-50);

  /* The header's own ground. Kept as a variable so the appbar, the splash and
     the theme-color meta can never drift apart. */
  --brand-bar:     var(--green-700);
  --brand-bar-2:   var(--green-800);

  /* --- Radii: smooth, generous, consistent ------------------------------- */
  --r-xs:   6px;
  --r-sm:   10px;
  --r-md:   14px;
  --r-lg:   18px;
  --r-xl:   24px;
  --r-2xl:  32px;
  --r-pill: 999px;

  /* --- Elevation: soft, green-tinted, never muddy ------------------------
     Shadows now carry a trace of the green ink instead of brown, so a card
     lifting off the mint background reads as depth rather than as dirt. */
  --sh-hairline: 0 0 0 1px var(--hairline-soft);
  --sh-xs: 0 1px 2px rgba(10, 45, 30, 0.05);
  --sh-sm: 0 2px 8px -2px rgba(10, 45, 30, 0.08), 0 1px 2px rgba(10, 45, 30, 0.04);
  --sh-md: 0 8px 24px -8px rgba(10, 45, 30, 0.13), 0 2px 6px -2px rgba(10, 45, 30, 0.05);
  --sh-lg: 0 18px 44px -14px rgba(10, 45, 30, 0.18), 0 4px 12px -4px rgba(10, 45, 30, 0.06);
  --sh-xl: 0 28px 64px -20px rgba(8, 38, 25, 0.28);
  --sh-up: 0 -10px 34px -14px rgba(10, 45, 30, 0.16);
  --sh-accent: 0 10px 26px -10px rgba(23, 174, 99, 0.55);
  --sh-inset-press: inset 0 2px 6px rgba(10, 45, 30, 0.10);
  /* Ring + lift used for the "this is in your cart" state */
  --sh-incart: 0 6px 20px -8px rgba(12, 143, 81, 0.30), 0 0 0 1.5px var(--green-200);

  /* --- Type ---------------------------------------------------------------
     Two families, on purpose:

     Tajawal carries the Arabic and the Latin copy. It is the most legible
     modern Arabic UI face at small sizes — open counters, low contrast,
     short ascenders — which is exactly what a dense product grid needs.

     Inter carries digits only, via .num / .mono and the numeric utilities.
     Arabic UI faces almost always draw Latin figures as an afterthought;
     prices, weights, totals and the OTP are the numbers a shopper actually
     has to trust, so they get a face built around tabular figures. */
  --font-sans: "Tajawal", "IBM Plex Sans Arabic", "SF Pro Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-num:  "Inter", "SF Pro Display", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Inter", ui-monospace, "SF Mono", "SFMono-Regular", "Menlo", monospace;

  --fs-2xs:  0.6875rem;  /* 11px */
  --fs-xs:   0.75rem;    /* 12px */
  --fs-sm:   0.8125rem;  /* 13px */
  --fs-base: 0.875rem;   /* 14px */
  --fs-md:   0.9375rem;  /* 15px */
  --fs-lg:   1.0625rem;  /* 17px */
  --fs-xl:   1.25rem;    /* 20px */
  --fs-2xl:  1.5rem;     /* 24px */
  --fs-3xl:  1.875rem;   /* 30px */

  /* --- Rhythm: an 8pt spine, with generous negative space ---------------- */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;

  /* --- Layout ------------------------------------------------------------ */
  --shell-max: 30rem;      /* phone-first column */
  --gutter: 0.875rem;
  --cartbar-h: 4.25rem;
  --tap-min: 44px;         /* accessible minimum target */

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* --- Motion ------------------------------------------------------------ */
  --ease-out: cubic-bezier(0.22, 0.9, 0.28, 1);
  --ease-spring: cubic-bezier(0.34, 1.5, 0.64, 1);
  --t-fast: 130ms;
  --t-base: 200ms;
  --t-slow: 300ms;

  /* --- Stacking ---------------------------------------------------------- */
  --z-appbar: 40;
  --z-cartbar: 46;
  --z-sheet: 60;
  --z-toast: 80;
  --z-splash: 100;
}

@media (min-width: 900px) {
  :root {
    --shell-max: 76rem;
    --gutter: 2rem;
  }
}

/* ==========================================================================
   Base
   ========================================================================== */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Anchors the sticky header's scroll-into-view offset. */
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-app);
  color: var(--text-strong);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  /* Kills the rubber-band flash behind the sticky header on iOS. */
  overscroll-behavior-y: none;
}

h1, h2, h3, h4, h5, h6, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
svg { flex: none; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled { cursor: not-allowed; }

/* Prevent iOS zoom-on-focus without shrinking the visual design */
@media (max-width: 900px) {
  input, select, textarea { font-size: 1rem; }
}

[hidden], [x-cloak] { display: none !important; }

::selection {
  background: var(--green-100);
  color: var(--green-800);
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2.5px solid var(--green-500);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.u-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Layout primitives
   ========================================================================== */

.shell {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.stack > * + * { margin-top: var(--stack-gap, var(--sp-4)); }

.row {
  display: flex;
  align-items: center;
  gap: var(--row-gap, var(--sp-2));
}

.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.shrink-0 { flex: none; }

/* Horizontal scrollers with hidden rails */
.hscroll {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
}
.hscroll::-webkit-scrollbar { display: none; }

.vscroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.vscroll::-webkit-scrollbar { width: 4px; }
.vscroll::-webkit-scrollbar-thumb {
  background: var(--stone-300);
  border-radius: var(--r-pill);
}

/* ==========================================================================
   Typography primitives
   ========================================================================== */

.t-eyebrow {
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.t-title { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.015em; }
.t-heading { font-size: var(--fs-md); font-weight: 700; letter-spacing: -0.01em; }
.t-body { font-size: var(--fs-base); color: var(--text-body); }
.t-meta { font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); }

/* Every number in the app routes through one of these three. .num is the
   default: Inter figures, tabular so a price never reflows as it counts up,
   and a touch of extra tracking because Inter's digits sit tighter than
   Tajawal's at the same size. */
.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "cv01" 1;
  letter-spacing: 0.01em;
}
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: 0.01em;
}

/* For runs of mixed Arabic + digits, where wrapping each number in a span
   isn't practical. Applied to the element; Arabic glyphs fall through to
   Tajawal via the stack, digits get resolved by Inter first. */
.num-inline {
  font-family: var(--font-num), var(--font-sans);
  font-variant-numeric: tabular-nums;
}

.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  --btn-h: 2.75rem;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--btn-h);
  padding-inline: var(--sp-5);
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out),
              transform var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out);
}

.btn:active:not(:disabled) { transform: scale(0.975); }
.btn:disabled { opacity: 0.45; box-shadow: none; }

/* ---- The primary call to action ------------------------------------------
   A two-stop leaf gradient, a coloured shadow that reads as glow rather than
   as drop-shadow, and a press that sinks the button into its own light. The
   ::after is a one-pass sheen that sweeps across on hover — cheap, because it
   only ever animates transform. */
.btn--primary,
.btn--ink {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--green-500) 0%, var(--green-600) 100%);
  color: var(--text-invert);
  box-shadow: var(--sh-accent), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  isolation: isolate;
}
.btn--primary > *,
.btn--ink > * { position: relative; z-index: 1; }

.btn--primary::after,
.btn--ink::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  transform: translate3d(-120%, 0, 0) skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  pointer-events: none;
}

@media (hover: hover) {
  .btn--primary:hover:not(:disabled),
  .btn--ink:hover:not(:disabled) {
    background: linear-gradient(180deg, var(--green-400) 0%, var(--green-500) 100%);
    box-shadow: 0 14px 32px -10px rgba(23, 174, 99, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  }
  .btn--primary:hover:not(:disabled)::after,
  .btn--ink:hover:not(:disabled)::after {
    transform: translate3d(120%, 0, 0) skewX(-18deg);
    transition: transform 620ms var(--ease-out);
  }
}

.btn--primary:active:not(:disabled),
.btn--ink:active:not(:disabled) {
  background: linear-gradient(180deg, var(--green-600) 0%, var(--green-700) 100%);
  box-shadow: 0 4px 12px -6px rgba(10, 91, 55, 0.5), var(--sh-inset-press);
  transform: scale(0.982);
}

.btn--indigo {
  background: linear-gradient(180deg, var(--indigo-500) 0%, var(--indigo-600) 100%);
  color: var(--text-invert);
  box-shadow: 0 10px 26px -10px rgba(59, 112, 246, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn--indigo:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--indigo-500) 0%, var(--indigo-500) 100%);
  box-shadow: 0 14px 32px -10px rgba(59, 112, 246, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn--indigo:active:not(:disabled) {
  background: linear-gradient(180deg, var(--indigo-600) 0%, var(--indigo-700) 100%);
  box-shadow: var(--sh-inset-press);
}

.btn--soft {
  background: var(--bg-sunken);
  color: var(--text-body);
  box-shadow: inset 0 0 0 1px var(--hairline);
}
.btn--soft:hover:not(:disabled) { background: var(--stone-200); }

.btn--tint {
  background: var(--accent-tint);
  color: var(--green-700);
  box-shadow: inset 0 0 0 1px var(--green-100);
}
.btn--tint:hover:not(:disabled) { background: var(--green-100); }

.btn--ghost { background: transparent; color: var(--text-muted); }
.btn--ghost:hover:not(:disabled) { background: var(--bg-sunken); color: var(--text-strong); }

.btn--danger {
  background: var(--berry-50);
  color: var(--berry-600);
  box-shadow: inset 0 0 0 1px var(--berry-100);
}
.btn--danger:hover:not(:disabled) { background: var(--berry-100); }

.btn--block { width: 100%; }
.btn--sm { --btn-h: 2.25rem; padding-inline: var(--sp-3); font-size: var(--fs-sm); }
.btn--lg {
  --btn-h: 3.5rem;
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: -0.015em;
  border-radius: var(--r-lg);
}

/* Square icon-only control, always a legal tap target */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-min);
  height: var(--tap-min);
  border-radius: var(--r-pill);
  color: var(--text-muted);
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
}
.icon-btn:hover:not(:disabled) { background: var(--bg-sunken); color: var(--text-strong); }
.icon-btn:active:not(:disabled) { transform: scale(0.92); }
.icon-btn--filled { background: var(--bg-sunken); }
.icon-btn--sm { width: 2rem; height: 2rem; }

/* ==========================================================================
   Form controls
   ========================================================================== */

.field {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-raised);
  border: 1.5px solid var(--hairline);
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text-strong);
  outline: none;
  transition: border-color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out);
}

.field::placeholder { color: var(--text-faint); font-weight: 500; }

.field:focus {
  border-color: var(--green-400);
  box-shadow: 0 0 0 4px var(--green-50);
}

.field:disabled {
  background: var(--bg-sunken);
  color: var(--text-muted);
  cursor: not-allowed;
}

textarea.field { resize: none; line-height: 1.7; min-height: 5.25rem; }

select.field {
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-400) 50%),
                    linear-gradient(135deg, var(--ink-400) 50%, transparent 50%);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  background-position: left 1.15rem top 1.4rem, left 0.8rem top 1.4rem;
  padding-inline-start: 2.5rem;
}
[dir="ltr"] select.field {
  background-position: right 0.8rem top 1.4rem, right 1.15rem top 1.4rem;
  padding-inline-start: var(--sp-4);
  padding-inline-end: 2.5rem;
}

.field-label {
  display: block;
  margin-bottom: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-body);
}

.field-hint {
  margin-top: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* Toggle switch — direction-agnostic */
.switch {
  position: relative;
  display: inline-flex;
  flex: none;
  width: 3.25rem;
  height: 1.875rem;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 100%; height: 100%;
  margin: 0;
  cursor: pointer;
}
.switch__track {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--stone-300);
  border-radius: var(--r-pill);
  transition: background var(--t-base) var(--ease-out);
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 1.375rem;
  height: 1.375rem;
  background: var(--stone-0);
  border-radius: 50%;
  box-shadow: var(--sh-sm);
  transition: transform var(--t-base) var(--ease-spring);
}
.switch input:checked + .switch__track { background: var(--green-500); }
.switch input:checked + .switch__track::after { transform: translateX(1.375rem); }
[dir="rtl"] .switch input:checked + .switch__track::after { transform: translateX(-1.375rem); }
.switch input:focus-visible + .switch__track {
  outline: 2.5px solid var(--green-500);
  outline-offset: 2px;
}
.switch--danger .switch__track { background: var(--berry-500); }

/* ==========================================================================
   Chips, badges, pills
   ========================================================================== */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  flex: none;
  /* 36px pill with a 44px hit-slop below (see .chip::after) — visually compact
     without dropping under the WCAG 2.5.5 target size. */
  min-height: 2.25rem;
  padding: 0 var(--sp-3);
  background: var(--bg-raised);
  border-radius: var(--r-pill);
  box-shadow: inset 0 0 0 1px var(--hairline);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-body);
  white-space: nowrap;
  scroll-snap-align: start;
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
}

/* Invisible tap-slop so the 36px pill still answers to a 44px thumb. */
.chip { position: relative; }
.chip::after {
  content: "";
  position: absolute;
  inset: -4px -2px;
}

.chip:hover { background: var(--bg-sunken); }
.chip:active { transform: scale(0.96); }

.chip[aria-pressed="true"] {
  background: var(--green-600);
  color: var(--text-invert);
  box-shadow: 0 6px 16px -8px rgba(13, 107, 73, 0.6);
}

.chip--deal {
  background: var(--citrus-50);
  color: var(--citrus-600);
  box-shadow: inset 0 0 0 1px var(--citrus-100);
}
.chip--deal[aria-pressed="true"] {
  background: var(--citrus-500);
  color: var(--text-invert);
  box-shadow: 0 6px 16px -8px rgba(196, 143, 27, 0.65);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 0.25rem var(--sp-2);
  border-radius: var(--r-xs);
  font-size: var(--fs-2xs);
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.badge--green  { background: var(--green-50);  color: var(--green-700); }
.badge--citrus { background: var(--citrus-50); color: var(--citrus-600); }
.badge--indigo { background: var(--indigo-50); color: var(--indigo-700); }
.badge--berry  { background: var(--berry-50);  color: var(--berry-600); }
.badge--stone  { background: var(--bg-sunken); color: var(--text-body); }
.badge--ink    { background: var(--ink-900);   color: var(--text-invert); }
.badge--solid-indigo { background: var(--indigo-500); color: var(--text-invert); }

/* Live status dot */
.dot {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  flex: none;
  background: currentColor;
}
.dot--live { animation: dotPulse 2.2s var(--ease-out) infinite; }

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.82); }
}

/* ==========================================================================
   Cards & surfaces
   ========================================================================== */

.card {
  background: var(--bg-raised);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.card--flat { box-shadow: inset 0 0 0 1px var(--hairline); }
.card--sunken { background: var(--bg-sunken); box-shadow: none; }

.panel {
  background: var(--bg-raised);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-md);
  overflow: hidden;
}

.divider {
  height: 1px;
  background: var(--hairline);
  border: 0;
  margin: 0;
}

/* ==========================================================================
   Sheets (bottom-sheet on phones, centred dialog on desktop)
   ========================================================================== */

.scrim {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  /* Flat tint instead of a backdrop blur: blurring a full-screen layer forces a
     repaint of everything beneath it on every sheet frame, which is where most
     of the open/close stutter came from. */
  background: rgba(19, 16, 11, 0.58);
  animation: fxFadeIn var(--t-fast) linear;
}

.scrim__hit { position: absolute; inset: 0; }

.sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--sheet-max, 30rem);
  max-height: 92dvh;
  background: var(--bg-raised);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  box-shadow: var(--sh-xl);
  overflow: hidden;
  /* Promote once, up front, so the rise animation never triggers a layer
     rebuild mid-transition. */
  will-change: transform;
}

.sheet__grip {
  display: flex;
  justify-content: center;
  padding: var(--sp-3) 0 var(--sp-1);
  flex: none;
}
.sheet__grip::before {
  content: "";
  width: 2.5rem;
  height: 0.25rem;
  background: var(--stone-300);
  border-radius: var(--r-pill);
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-5) var(--sp-3);
  flex: none;
}

.sheet__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: var(--sp-2) var(--sp-5) var(--sp-6);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sheet__body::-webkit-scrollbar { display: none; }

.sheet__foot {
  flex: none;
  padding: var(--sp-4) var(--sp-5) calc(var(--sp-4) + var(--safe-bottom));
  background: var(--bg-raised);
  border-top: 1px solid var(--hairline);
}

@media (min-width: 720px) {
  .scrim { align-items: center; padding: var(--sp-6); }
  .sheet { border-radius: var(--r-2xl); max-height: 88dvh; }
  .sheet__grip { display: none; }
  .sheet__head { padding-top: var(--sp-5); }
  .sheet__foot { padding-bottom: var(--sp-4); }
}

/* ==========================================================================
   Loading skeletons
   ========================================================================== */

/* One shimmer, used by the skeleton cards and by every product image while it
   decodes. The sweep is a single translated pseudo-element on its own layer:
   no background-position animation, so it never repaints the box beneath it. */
.skel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(100deg, var(--stone-100) 0%, var(--stone-200) 52%, var(--stone-100) 100%);
  border-radius: var(--r-sm);
}
.skel::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translate3d(-100%, 0, 0);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.55) 45%,
    rgba(255, 255, 255, 0.9) 50%,
    rgba(255, 255, 255, 0.55) 55%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: skelSweep 1.25s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  will-change: transform;
}
/* RTL sweeps right-to-left so the motion follows the reading direction. */
[dir="rtl"] .skel::after { animation-name: skelSweepRtl; }

@keyframes skelSweep    { to { transform: translate3d(100%, 0, 0); } }
@keyframes skelSweepRtl { from { transform: translate3d(100%, 0, 0); } to { transform: translate3d(-100%, 0, 0); } }

/* A skeleton that outlives its own animation is worse than no skeleton, so
   reduced-motion gets the flat tint and no sweep at all. */
@media (prefers-reduced-motion: reduce) {
  .skel::after { animation: none; opacity: 0; }
}

/* Indeterminate spinner */
.spinner {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-top-color: transparent;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Empty / error states
   ========================================================================== */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-2);
  padding: var(--sp-12) var(--sp-6);
}

.state__icon {
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  margin-bottom: var(--sp-2);
  border-radius: 50%;
  background: var(--bg-sunken);
  color: var(--text-faint);
}
.state__icon--berry { background: var(--berry-50); color: var(--berry-500); }
.state__title { font-size: var(--fs-md); font-weight: 700; color: var(--text-strong); }
.state__text { font-size: var(--fs-base); color: var(--text-muted); max-width: 26ch; }
.state > .btn { margin-top: var(--sp-4); }

/* ==========================================================================
   Toast
   ========================================================================== */

.toast-slot {
  position: fixed;
  inset-inline: var(--sp-4);
  top: calc(var(--sp-4) + var(--safe-top));
  z-index: var(--z-toast);
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  max-width: 24rem;
  padding: var(--sp-3) var(--sp-4);
  background: var(--ink-900);
  color: var(--text-invert);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xl);
  font-size: var(--fs-base);
  font-weight: 600;
}
.toast--error { background: var(--berry-500); }

/* ==========================================================================
   Shared transition helpers (used by Alpine x-transition)
   ========================================================================== */

/* Transition end-states used by x-transition:*-end */
.opacity-0 { opacity: 0 !important; }

.fx-fade-in  { animation: fxFadeIn var(--t-base) var(--ease-out); }
.fx-rise     { animation: fxRise var(--t-slow) var(--ease-out); }

@keyframes fxFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fxRise {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* Sheets travel further than toasts and get their own curve. */
.fx-sheet-in { animation: fxSheetIn var(--t-slow) var(--ease-out); }
@keyframes fxSheetIn {
  from { transform: translate3d(0, 100%, 0); }
  to   { transform: translate3d(0, 0, 0); }
}

