/* ==========================================================================
   SILAI — design system
   --------------------------------------------------------------------------
   A tailor's workroom, on screen.

   Palette — Indian textile dyes:
     cloth      undyed mulmul cotton (page)
     paper      fresh pattern paper (cards)
     ink        indigo ink (all text — never pure black)
     rani       rani pink, "the navy blue of India" (accent)
     marigold   the tailor's inch-tape (progress, highlights)
     thread     unbleached thread (hairlines)

   Type — Rozha One (Indian Type Foundry) for display, Karla for the rest.

   Signature — the running stitch: dashed seams instead of solid rules,
   drawn in on page load; a measuring tape for progress.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Rozha+One&family=Karla:ital,wght@0,300..800;1,300..800&display=swap');

:root {
  --cloth:     #FBF7EF;
  --paper:     #FFFEFA;
  --ink:       #23264B;
  --ink-soft:  #575B84;
  --ink-faint: #8B8EAE;
  --rani:      #C9285D;
  --rani-deep: #A31C4A;
  --rani-tint: #FCEDF2;
  --marigold:  #E4A028;
  --marigold-deep: #B87E15;
  --thread:    #E9E0CE;
  --night:     #14162B;          /* scan screen */
  --ok:        #2F7A52;

  --display: "Rozha One", serif;
  --body:    "Karla", system-ui, sans-serif;

  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem;
  --s5: 1.5rem; --s6: 2rem;  --s7: 3rem;  --s8: 4.5rem;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(35,38,75,.06), 0 8px 24px -12px rgba(35,38,75,.18);
  --shadow-lift: 0 2px 4px rgba(35,38,75,.08), 0 16px 32px -12px rgba(35,38,75,.22);

  /* the running stitch */
  --stitch-img: repeating-linear-gradient(90deg,
      var(--rani) 0 9px, transparent 9px 16px);
}

/* ---------------------------------------------------------------- reset -- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cloth);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--rani-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; cursor: pointer; }
:focus-visible {
  outline: 2px solid var(--rani);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ----------------------------------------------------------- typography -- */
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.12; margin: 0; }
h1 { font-size: clamp(2.1rem, 4.5vw, 3.4rem); letter-spacing: .005em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.28rem; }
p  { margin: 0 0 var(--s4); }
.lede  { font-size: 1.18rem; color: var(--ink-soft); max-width: 46ch; }
.small { font-size: .9rem;  color: var(--ink-soft); }
.eyebrow {
  font-size: .78rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--rani-deep);
}
.mark { font-family: var(--display); }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------ the running stitch */
.seam {
  border: 0; height: 3px; margin: var(--s5) 0;
  background-image: var(--stitch-img);
  background-repeat: repeat-x;
  background-size: 200% 3px;
}
.seam--thread { --stitch-img: repeating-linear-gradient(90deg,
      var(--thread) 0 9px, transparent 9px 16px); }
.seam--gold { --stitch-img: repeating-linear-gradient(90deg,
      var(--marigold) 0 9px, transparent 9px 16px); }
@keyframes sew { from { background-position: 120% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: no-preference) {
  .seam { animation: sew .9s cubic-bezier(.6,0,.2,1) both; }
}

/* --------------------------------------------------------------- layout -- */
.wrap   { width: min(1140px, 100% - 2.5rem); margin-inline: auto; }
.wrap--narrow { width: min(560px, 100% - 2.5rem); margin-inline: auto; }
.section { padding-block: var(--s7); }
.stack > * + * { margin-top: var(--s4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.split { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4); flex-wrap: wrap; }

/* ------------------------------------------------------------------ nav -- */
.nav {
  background: var(--paper);
  border-bottom: 1px solid var(--thread);
  position: sticky; top: 0; z-index: 40;
}
.nav__inner {
  display: flex; align-items: center; gap: var(--s5);
  min-height: 64px;
}
.brand {
  font-family: var(--display); font-size: 1.6rem; color: var(--ink);
  display: inline-flex; align-items: baseline; gap: .55rem;
}
.brand:hover { text-decoration: none; }
.brand__logo { height: 30px; width: auto; display: block; }
.brand small {
  font-size: 1.05rem; color: var(--rani);
}
.nav__links { display: flex; gap: var(--s5); margin-left: auto; align-items: center; }
.nav__links a { color: var(--ink-soft); font-weight: 500; }
.nav__links a:hover { color: var(--ink); text-decoration: none; }
.nav__links a[aria-current="page"] { color: var(--rani-deep); }
.nav__toggle { display: none; background: none; border: 0; color: var(--ink); }
@media (max-width: 720px) {
  .nav__toggle { display: block; font-size: 1.6rem; line-height: 1; padding: var(--s2); }
  .nav__links {
    display: none; position: absolute; inset: 64px 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--thread);
    padding: var(--s3) var(--s5) var(--s5);
  }
  .nav__links.open { display: flex; }
  .nav__links a { padding: var(--s3) 0; border-bottom: 1px dashed var(--thread); }
}

/* -------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  text-align: center; /* keep wrapped lines centred (e.g. WhatsApp button) */
  gap: .5rem; padding: .8rem 1.6rem;
  border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 700; letter-spacing: .01em;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--rani); color: #fff; box-shadow: var(--shadow); }
.btn--primary:hover { background: var(--rani-deep); box-shadow: var(--shadow-lift); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn--ghost:hover { border-style: dashed; }           /* the tailor's baste */
.btn--gold { background: var(--marigold); color: var(--ink); }
.btn--gold:hover { background: var(--marigold-deep); color: #fff; }
.btn--quiet { background: var(--rani-tint); color: var(--rani-deep); }
.btn--danger { background: transparent; color: var(--rani-deep); border-color: var(--rani-deep); }
.btn--danger:hover { background: var(--rani-deep); color: #fff; }
.btn--small { padding: .45rem 1rem; font-size: .9rem; }
.btn--wide  { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------------------------------------------------------------- forms -- */
.field { display: grid; gap: .4rem; }
.field label { font-weight: 700; font-size: .95rem; }
.field .hint { font-size: .85rem; color: var(--ink-faint); }
.input, select.input, textarea.input {
  width: 100%; padding: .75rem .9rem;
  border: 1.5px solid var(--thread); border-radius: var(--radius);
  background: var(--paper); color: var(--ink); font: inherit;
}
.input:focus { border-color: var(--rani); outline: none; }
textarea.input { resize: vertical; min-height: 6.5rem; }
.form-grid { display: grid; gap: var(--s4); }
.form-grid--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 620px) { .form-grid--2 { grid-template-columns: 1fr; } }

.notice, .flash {
  border-radius: var(--radius); padding: var(--s3) var(--s4);
  background: var(--rani-tint); color: var(--rani-deep);
  border: 1px dashed var(--rani);
}
.notice--ok { background: #EAF5EE; color: var(--ok); border-color: var(--ok); }

/* ----------------------------------------------------------------- hero -- */
.hero { padding-block: var(--s7) var(--s6); }
.hero h1 .accent { color: var(--rani); }
.hero .devanagari { color: var(--marigold-deep); }
.hero__tag { margin-top: var(--s3); }

/* -------------------------------------------------------------- filters -- */
.filters { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.filters form { display: contents; }
.search {
  flex: 1 1 240px; display: flex; background: var(--paper);
  border: 1.5px solid var(--thread); border-radius: 999px; overflow: hidden;
}
.search input { border: 0; background: none; padding: .7rem 1.1rem; flex: 1; font: inherit; color: var(--ink); min-width: 0; }
.search input:focus { outline: none; }
.search button { border: 0; background: var(--ink); color: var(--cloth); padding: 0 1.2rem; }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip {
  padding: .42rem 1rem; border-radius: 999px;
  border: 1.5px solid var(--thread); background: var(--paper);
  color: var(--ink-soft); font-weight: 600; font-size: .92rem;
}
.chip:hover { border-color: var(--ink-faint); text-decoration: none; color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--cloth); }
select.sort {
  border: 1.5px solid var(--thread); background: var(--paper);
  border-radius: 999px; padding: .5rem 1rem; font: inherit; color: var(--ink);
}

/* ---------------------------------------------------------- product grid -- */
.grid {
  display: grid; gap: var(--s5);
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.card {
  background: var(--paper); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease;
  position: relative;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card:hover::after {                     /* stitched outline on hover */
  content: ""; position: absolute; inset: 7px;
  border: 2px dashed var(--rani); border-radius: calc(var(--radius) - 4px);
  pointer-events: none;
}
.card__img { aspect-ratio: 3 / 4; background: var(--thread); }
.card__img img { width: 100%; height: 100%; object-fit: cover; }
.card__img--empty { display: grid; place-items: center; color: var(--ink-faint); font-family: var(--display); font-size: 2rem; }
.card__body { padding: var(--s4); display: grid; gap: .3rem; }
.card__name { font-weight: 700; }
.card__shop { font-size: .88rem; color: var(--ink-faint); }
.card__price { color: var(--rani-deep); font-weight: 700; }
.card a.card__cover { position: absolute; inset: 0; z-index: 1; }

.empty {
  text-align: center; padding: var(--s8) var(--s4); color: var(--ink-soft);
}
.empty .mark { font-size: 2.6rem; color: var(--thread); }

/* --------------------------------------------------------- product page -- */
.product { display: grid; gap: var(--s6); grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; }
@media (max-width: 860px) { .product { grid-template-columns: 1fr; } }
.gallery { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--paper); box-shadow: var(--shadow); }
.gallery__track { display: flex; transition: transform .35s cubic-bezier(.4,0,.2,1); }
.gallery__track img { width: 100%; flex: 0 0 100%; aspect-ratio: 3/4; object-fit: cover; }
.gallery__nav {
  position: absolute; top: 50%; translate: 0 -50%;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,254,250,.92); border: 1px solid var(--thread);
  color: var(--ink); font-size: 1.2rem; display: grid; place-items: center;
}
.gallery__nav--prev { left: 12px; } .gallery__nav--next { right: 12px; }
.gallery__dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; gap: 7px; justify-content: center; }
.gallery__dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.7); border: 1px solid var(--ink-faint); }
.gallery__dots i.on { background: var(--rani); border-color: var(--rani); }

.pdp__meta { display: flex; gap: .6rem; flex-wrap: wrap; }
.tag {
  font-size: .8rem; font-weight: 700; letter-spacing: .04em;
  padding: .28rem .7rem; border-radius: 999px;
  background: var(--rani-tint); color: var(--rani-deep);
}
.tag--gold { background: #FBF0DA; color: var(--marigold-deep); }
.price { font-size: 1.7rem; font-family: var(--display); }
.price small { font-family: var(--body); font-size: .85rem; color: var(--ink-faint); display: block; }
.like {
  background: var(--paper); border: 1.5px solid var(--thread);
  width: 46px; height: 46px; border-radius: 50%; font-size: 1.25rem;
  display: grid; place-items: center; color: var(--ink-soft);
  transition: transform .15s ease;
}
.like:hover { transform: scale(1.08); }
.like.on { color: var(--rani); border-color: var(--rani); background: var(--rani-tint); }

.how {
  background: var(--paper); border-radius: var(--radius);
  border: 1px solid var(--thread); padding: var(--s4);
  display: grid; gap: .45rem;
}
.how strong { color: var(--rani-deep); }

/* ----------------------------------------------------- the measuring tape */
.tape {
  --fill: 0%;
  position: relative; height: 30px; border-radius: 6px;
  background: var(--paper); border: 1px solid var(--thread); overflow: hidden;
}
.tape::before {                                    /* marigold fill */
  content: ""; position: absolute; inset: 0; width: var(--fill);
  background:
    repeating-linear-gradient(90deg,
      transparent 0 6px, rgba(35,38,75,.55) 6px 7.5px,   /* minor ticks */
      transparent 7.5px 30px, rgba(35,38,75,.85) 30px 32px) /* inch ticks */
    var(--marigold);
  transition: width .3s linear;
}
.tape::after {                                     /* leading edge */
  content: ""; position: absolute; top: 0; bottom: 0; left: var(--fill);
  width: 3px; background: var(--rani); transition: left .3s linear;
}
.tape--steps::before { transition: width .5s cubic-bezier(.4,0,.2,1); }

/* ---------------------------------------------------- scan: instruction deck */
.deck {
  background: var(--paper); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.deck__track {
  display: flex; transition: transform .35s cubic-bezier(.4,0,.2,1);
}
.deck__slide {
  flex: 0 0 100%; padding: var(--s5) var(--s5) var(--s4);
  display: grid; gap: .45rem; justify-items: center; text-align: center;
}
.deck__slide img {
  width: min(70%, 300px); max-height: 42vh; object-fit: contain;
  margin-bottom: var(--s3);
}
.deck__slide h2 { font-size: 1.5rem; }
.deck__body { color: var(--ink-soft); max-width: 34ch; margin: 0; }
.deck__dots { display: flex; gap: 8px; justify-content: center; padding-bottom: var(--s3); }
.deck__dots i {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--thread); transition: background .2s ease, transform .2s ease;
}
.deck__dots i.on { background: var(--rani); transform: scale(1.2); }
.deck__nav {
  display: flex; justify-content: space-between; gap: var(--s3);
  padding: 0 var(--s5) var(--s5);
}
.deck__nav .btn { min-width: 42%; }
/* Last slide: the camera CTA takes the full row, centred, Back beneath it. */
.deck__nav--final { flex-wrap: wrap; justify-content: center; }
.deck__nav--final #deck-go { order: -1; flex-basis: 100%; text-align: center; }

.stars { color: #B98A1C; letter-spacing: .08em; }

/* ------------------------------------------------------------------ ads -- */
.ad-box { margin-block: var(--s5); text-align: center; }
.ad-box__label {
  display: block; font-size: .68rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: .35rem;
}
.ad-box--placeholder {
  border: 2px dashed var(--thread); border-radius: var(--radius);
  padding: var(--s6) var(--s4); color: var(--ink-faint); background: var(--paper);
}
/* The in-feed ad wears the same shell as a product card: the ad sits where
   the photo goes (3:4), the "Sponsored" label sits where the caption goes. */
.card--ad .ad-box { margin: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; }
.card--ad .adsbygoogle,
.card--ad .ad-box--placeholder {
  aspect-ratio: 3 / 4; width: 100%; flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--cloth); border: 0; border-radius: 0; padding: 0;
  overflow: hidden;
}
.card--ad .ad-box__label { order: 2; margin: 0; padding: var(--s4);
  text-align: left; }

/* ------------------------------------------------------- scan: numbered -- */
.steps { counter-reset: step; display: grid; gap: var(--s4); }
.step {
  counter-increment: step;
  background: var(--paper); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: var(--s4) var(--s5);
  display: grid; grid-template-columns: auto 1fr; gap: var(--s4);
  align-items: start;
}
.step::before {
  content: counter(step);
  font-family: var(--display); font-size: 1.5rem; color: var(--marigold-deep);
  border: 2px dashed var(--marigold); border-radius: 50%;
  width: 2.6rem; height: 2.6rem; display: grid; place-items: center;
}
.step--illustrated { grid-template-columns: auto 132px 1fr; }
.step__img {
  width: 132px; height: 132px; object-fit: contain;
  background: var(--cloth); border-radius: 10px; padding: 6px;
}
@media (max-width: 560px) {
  .step--illustrated { grid-template-columns: auto 92px 1fr; }
  .step__img { width: 92px; height: 92px; }
}
.step h3 { margin-bottom: .2rem; font-family: var(--body); font-weight: 700; font-size: 1.05rem; }
.step p { margin: 0; color: var(--ink-soft); }

/* --------------------------------------------------------- scan: capture -- */
.scan-body { background: var(--night); color: #F4F1FA; min-height: 100dvh; }
.scan-stage { position: relative; height: 100dvh; overflow: hidden; }
.scan-stage video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transform: scaleX(-1);        /* mirror the preview */
}
.scan-frame {
  position: absolute; inset: 19% 7% 2.5%; pointer-events: none;
  border-radius: 18px;   /* starts below the HUD; reaches nearly the bottom */
}
.scan-frame i {
  position: absolute; width: 44px; height: 44px;
  border: 3px solid var(--marigold); border-radius: 4px;
}
.scan-frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.scan-frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.scan-frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.scan-frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }

/* Everything lives at the TOP so the bottom of the frame — where feet
   are — stays completely uncovered. */
.scan-hud {
  position: absolute; left: 0; right: 0; top: 0;
  padding: calc(var(--s3) + env(safe-area-inset-top)) var(--s4) var(--s3);
  background: linear-gradient(rgba(20,22,43,.88) 55%, transparent);
  display: grid; gap: .55rem; justify-items: center; text-align: center;
}
.scan-hud .tape { width: min(420px, 88vw); height: 14px;
  background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); }
.scan-note { margin: 0; font-size: .8rem; color: var(--marigold);
  background: rgba(228,160,40,.14); border: 1px dashed var(--marigold);
  border-radius: 8px; padding: .25rem .7rem; }
/* Fixed-height guide box: messages change, the box never shifts. Reserve
   two lines each and clip anything longer. */
.scan-status { font-size: 1.05rem; font-weight: 700; margin: 0;
  height: 2.9em; overflow: hidden;
  display: flex; align-items: center; justify-content: center; }
.scan-sub { font-size: .88rem; color: #C6C3DB; margin: 0;
  height: 2.7em; overflow: hidden;
  display: flex; align-items: center; justify-content: center; }

.rec {
  position: absolute; top: calc(var(--s3) + env(safe-area-inset-top)); left: var(--s3);
  display: none; align-items: center; gap: .45rem;
  font-weight: 700; letter-spacing: .06em; font-size: .8rem;
}
.rec.on { display: inline-flex; }
.rec i { width: 10px; height: 10px; border-radius: 50%; background: var(--rani); }

/* The pose tracker — eight pips tick off as each side is captured. */
.poses { display: grid; gap: .35rem; justify-items: center; }
.poses[hidden] { display: none; }
.poses__row { display: flex; align-items: center; gap: .45rem; }
.poses .turn { font-size: .72rem; letter-spacing: .1em; color: #C6C3DB;
  text-transform: uppercase; width: 3.4rem; text-align: right; margin: 0; }
.poses i {
  width: 30px; height: 30px; border-radius: 50%; display: grid;
  place-items: center; font-style: normal; font-weight: 700; font-size: .8rem;
  border: 2px dashed rgba(228,160,40,.75); color: #E8DFC9;
  transition: background .2s ease, transform .2s ease;
}
.poses i.done {
  background: var(--marigold); border-style: solid; border-color: var(--marigold);
  color: var(--night); transform: scale(1.06);
}
@media (prefers-reduced-motion: no-preference) {
  .rec.on i { animation: pulse 1.1s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: .3; } }
}

.countdown {
  position: absolute; inset: 0; display: none; place-items: center;
  font-family: var(--display); font-size: clamp(6rem, 22vw, 11rem);
  color: var(--marigold); text-shadow: 0 4px 30px rgba(0,0,0,.5);
}
.countdown.on { display: grid; }

.scan-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(20,22,43,.86); text-align: center; padding: var(--s5);
}
.scan-overlay[hidden] { display: none; }
.scan-overlay .panel { max-width: 30rem; display: grid; gap: var(--s4); justify-items: center; }
.spinner {
  width: 54px; height: 54px; border-radius: 50%;
  border: 4px dashed var(--marigold);
}
@media (prefers-reduced-motion: no-preference) {
  .spinner { animation: spin 1.6s linear infinite; }
  @keyframes spin { to { rotate: 360deg; } }
}

/* ---------------------------------------------------------- scan: verify -- */
.frames { display: grid; gap: var(--s4); grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) { .frames { grid-template-columns: repeat(2, 1fr); } }
.frame { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--paper); }
.frame img { aspect-ratio: 3/4; width: 100%; object-fit: cover; }
.frame figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: .35rem .6rem; font-size: .82rem; font-weight: 700;
  background: rgba(35,38,75,.78); color: var(--cloth);
  display: flex; justify-content: space-between; align-items: center;
}
.frame .conf { font-weight: 600; color: var(--marigold); }
.rotation-label { grid-column: 1 / -1; }

/* --------------------------------------------------------------- tables -- */
.table-wrap { overflow-x: auto; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }
table.silai { width: 100%; border-collapse: collapse; min-width: 560px; }
table.silai th {
  text-align: left; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); padding: var(--s3) var(--s4);
  border-bottom: 2px dashed var(--thread);
}
table.silai td { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--cloth); vertical-align: middle; }
table.silai tr:last-child td { border-bottom: 0; }

/* Inventory on phones: reflow the table into one card per item so the Edit
   and Hide buttons are always visible — no sideways scrolling. */
@media (max-width: 640px) {
  .table-wrap { overflow: visible; background: transparent; box-shadow: none; }
  table.silai { min-width: 0; display: block; }
  table.silai thead { display: none; }
  table.silai tbody { display: block; }
  table.silai tr {
    display: block; background: var(--paper); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: var(--s4); margin-bottom: var(--s4);
  }
  table.silai td { display: block; padding: 0; border: 0; }
  table.silai td[data-label] {
    display: flex; justify-content: space-between; align-items: center;
    gap: var(--s3); padding: .55rem 0; border-top: 1px dashed var(--cloth);
  }
  table.silai td[data-label]::before {
    content: attr(data-label); color: var(--ink-faint);
    font-size: .82rem; font-weight: 700;
  }
  table.silai td.inv-actions:empty { display: none; }
  table.silai td.inv-actions { padding-top: var(--s3); }
  table.silai td.inv-actions .cluster { display: flex; gap: var(--s2); }
  table.silai td.inv-actions .cluster > * { flex: 1; }
  table.silai td.inv-actions .btn { width: 100%; text-align: center; }
}
.thumb { width: 52px; height: 66px; object-fit: cover; border-radius: 6px; }
.pill { font-size: .8rem; font-weight: 700; padding: .22rem .65rem; border-radius: 999px; }
.pill--ok { background: #EAF5EE; color: var(--ok); }
.pill--wait { background: #FBF0DA; color: var(--marigold-deep); }
.pill--low { background: var(--rani-tint); color: var(--rani-deep); }

/* --------------------------------------------------------------- vendor -- */
.workroom { display: grid; grid-template-columns: 220px 1fr; gap: var(--s6); align-items: start; padding-block: var(--s6); }
.workroom > * { min-width: 0; } /* let .side / .table-wrap scroll instead of widening the page on phones */
@media (max-width: 860px) { .workroom { grid-template-columns: 1fr; } }
.side { display: grid; gap: .3rem; position: sticky; top: 84px; }
.side a {
  padding: .65rem .9rem; border-radius: 8px; color: var(--ink-soft); font-weight: 600;
  display: flex; align-items: center; gap: .55rem;
}
.side__ico { font-size: 1.05rem; line-height: 1; }
.side a:hover { background: var(--paper); text-decoration: none; }
.side a[aria-current="page"] { background: var(--ink); color: var(--cloth); }
.side .side__shop { font-family: var(--display); font-size: 1.15rem; color: var(--ink); padding: .4rem .9rem .8rem; }

.stats { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--s4); }
.stat b { font-family: var(--display); font-size: 2rem; display: block; }
.stat span { color: var(--ink-soft); font-size: .9rem; }
.stat--alert b { color: var(--rani); }

.dropzone {
  border: 2px dashed var(--thread); border-radius: var(--radius);
  background: var(--paper); padding: var(--s6);
  text-align: center; color: var(--ink-soft);
  transition: border-color .15s ease, background .15s ease;
}
.dropzone.drag { border-color: var(--rani); background: var(--rani-tint); }
.previews { display: flex; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s3); }
.previews figure { position: relative; margin: 0; }
.previews img { width: 88px; height: 112px; object-fit: cover; border-radius: 8px; border: 1px solid var(--thread); }
.previews button, .previews label.remove {
  position: absolute; top: -8px; right: -8px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: var(--cloth); border: 0;
  font-size: .8rem; line-height: 1; display: grid; place-items: center; cursor: pointer;
}
.previews figure.removed img { opacity: .3; }

.order-card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }
.order-card summary {
  padding: var(--s4) var(--s5); cursor: pointer; list-style: none;
  display: flex; gap: var(--s4); align-items: center; flex-wrap: wrap;
}
.order-card summary::-webkit-details-marker { display: none; }
.order-card summary::after { content: "▾"; margin-left: auto; color: var(--ink-faint); }
.order-card[open] summary::after { content: "▴"; }
.order-card .body { padding: 0 var(--s5) var(--s5); display: grid; gap: var(--s4); }
.measure-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .4rem var(--s4);
}
.measure-grid div { display: flex; flex-wrap: wrap; justify-content: space-between; border-bottom: 1px dashed var(--thread); padding-block: .25rem; }
.measure-grid b { font-variant-numeric: tabular-nums; margin-left: auto; } /* stays right-aligned even when a long label wraps */

/* -------------------------------------------------------------- footer -- */
.footer { margin-top: var(--s8); border-top: 1px solid var(--thread); background: var(--paper); }
.footer__inner { padding-block: var(--s6); display: flex; gap: var(--s5); flex-wrap: wrap; justify-content: space-between; align-items: center; color: var(--ink-soft); }


/* ---------------------------------------------------------------- utils -- */
.center { text-align: center; }
.mt-2 { margin-top: var(--s5); } .mt-3 { margin-top: var(--s6); }
.mb-0 { margin-bottom: 0; }
.hidden { display: none !important; }
.card-panel { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--s5); }
.auth { padding-block: var(--s7); }
.auth .card-panel { display: grid; gap: var(--s4); }
.auth h1 { font-size: 2rem; }

/* ------------------------------------------------------- mobile refinements */

/* Swatch density: two-up cards on phones, like a fabric book. */
@media (max-width: 540px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: var(--s3); }
  .card__body { padding: var(--s3); }
  .card:hover::after { display: none; }        /* no hover stitch on touch */
}

/* Category chips become one thumb-scrollable row. */
@media (max-width: 720px) {
  .chips {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; margin-inline: -1.25rem; padding-inline: 1.25rem;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }
}

/* Sticky buy bar on the product page — the CTA never scrolls away. */
.buybar { display: none; }
@media (max-width: 860px) {
  .buybar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--s4);
    padding: var(--s3) var(--s5) calc(var(--s3) + env(safe-area-inset-bottom));
    background: var(--paper); border-top: 3px dashed var(--rani);
    box-shadow: 0 -10px 30px -18px rgba(35,38,75,.35);
  }
  .buybar__price { font-family: var(--display); font-size: 1.35rem; }
  .buybar__price small { font-family: var(--body); font-size: .78rem;
    color: var(--ink-faint); display: block; line-height: 1.1; }
  body:has(.buybar) .footer { padding-bottom: 84px; }
  body:has(.buybar) .product { padding-bottom: var(--s6); }
}

/* Workroom rail on phones: a native-style tab bar — the four tabs split the
   width evenly (icon over label), so they always fit with no sideways scroll. */
@media (max-width: 860px) {
  .side {
    position: static; grid-template-columns: repeat(4, 1fr); gap: .3rem;
    align-items: stretch; overflow: visible;
    margin-inline: -1.25rem; padding: 0 1.25rem var(--s3);
    border-bottom: 1px dashed var(--thread);
  }
  .side .side__shop {           /* shop name on its own full-width line */
    grid-column: 1 / -1; padding: 0 0 .5rem; font-size: 1.05rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .side a {
    flex-direction: column; gap: .2rem; text-align: center;
    padding: .5rem .2rem; font-size: .72rem; line-height: 1.15;
    white-space: normal; border-radius: 12px; min-width: 0;
  }
  .side__ico { font-size: 1.35rem; }
  .side__lbl { display: block; }
}

/* Capture screen: nudge landscape phones upright. */
.rotate-hint { display: none; }
@media (max-height: 450px) and (orientation: landscape) {
  .rotate-hint {
    position: absolute; inset: 0; z-index: 5;
    display: grid; place-items: center; gap: var(--s2);
    background: rgba(20,22,43,.92); text-align: center;
    font-size: 1.15rem; font-weight: 700; padding: var(--s5);
  }
  .rotate-hint span { font-size: 2.6rem; color: var(--marigold); display: block; }
}

/* Bigger touch targets for the small action buttons on phones. */
@media (max-width: 720px) {
  .btn--small { padding: .6rem 1.1rem; }
  .like { width: 50px; height: 50px; }
}
