/* ============================================================
   E-Commerce mini-app

   A light retail surface — white cards on soft grey, indigo as the only accent.
   Deliberately the most "ordinary" looking of the four mini-apps: a shop that
   looks like a shop is the point, and the wallet's cashier arriving in upay
   yellow over the top of it is the contrast worth showing.
   ============================================================ */
:root {
  --sh-indigo: #4C3FD6;
  --sh-indigo-dark: #2B2394;
  --sh-ink: #171634;
  --sh-bg: #F4F5F9;
  --sh-price: #E23744;
}

.sh-app {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 100%;
  background: var(--sh-bg);
  color: var(--sh-ink);
}
.sh-app [hidden] { display: none !important; }

/* ---------- top bar ---------- */
.sh-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #FFF;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(23, 22, 52, 0.06);
}
/* Over the product hero: floats on the image rather than sitting above it. */
.sh-top.over {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 5;
  background: none;
  border-bottom: none;
}
.sh-title { flex: 1; text-align: center; font-size: 16px; font-weight: 700; }

.sh-back, .sh-iconbtn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%;
  background: rgba(23, 22, 52, 0.06);
  color: var(--sh-ink);
  cursor: pointer;
  flex-shrink: 0;
}
.sh-top.over .sh-back { background: rgba(255, 255, 255, 0.9); box-shadow: 0 2px 8px rgba(0,0,0,.14); }
.sh-back:active, .sh-iconbtn:active { transform: scale(0.92); }

.sh-search, .sh-searchbox {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--sh-bg);
  color: var(--color-text-muted);
  font-size: 13.5px;
  cursor: pointer;
  min-width: 0;
}
.sh-searchbox input {
  flex: 1; min-width: 0;
  border: none; background: none; outline: none;
  font-size: 13.5px; color: var(--sh-ink);
}

.sh-capsule {
  display: inline-flex; align-items: center;
  height: 30px; padding: 0 3px;
  border-radius: var(--radius-pill);
  background: rgba(23, 22, 52, 0.06);
  flex-shrink: 0;
}
.sh-top.over .sh-capsule {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}
.sh-capsule-btn {
  width: 30px; height: 26px;
  border: none; background: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--sh-ink); cursor: pointer;
}
.sh-capsule-btn:active { transform: scale(0.9); }
.sh-capsule-split { width: 1px; height: 15px; background: rgba(23, 22, 52, 0.18); }

/* ---------- body ---------- */
.sh-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; }
.sh-body.no-pad { padding: 0; }

/* Artwork block. The tint carries the card until the generated image lands, so
   an empty assets folder never shows a broken-image icon to a client. */
.sh-art {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--tint, #E6E8F2);
  flex-shrink: 0;
}
.sh-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sh-art-card { width: 100%; aspect-ratio: 1; border-radius: 12px 12px 0 0; }
.sh-art-banner { position: absolute; inset: 0; }
.sh-art-hero { width: 100%; aspect-ratio: 1; }
.sh-art-sku { width: 74px; height: 74px; border-radius: 10px; }
.sh-art-line { width: 68px; height: 68px; border-radius: 10px; }

/* ---------- banners ---------- */
.sh-banners {
  display: flex; gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  margin-bottom: 14px;
}
.sh-banners::-webkit-scrollbar { display: none; }
.sh-banner {
  position: relative;
  flex: 0 0 86%;
  aspect-ratio: 2 / 1;
  scroll-snap-align: start;
  border-radius: 14px;
  overflow: hidden;
  background: var(--tint);
  cursor: pointer;
}
.sh-banner-copy {
  position: absolute;
  inset: 0 45% 0 0;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  padding: 0 16px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
  color: #FFF;
}
.sh-banner-copy em {
  font-style: normal; font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  opacity: 0.85;
}
.sh-banner-copy strong { font-size: 16px; font-weight: 800; line-height: 1.25; }

/* ---------- category grid ---------- */
.sh-cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sh-cat {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 12px 4px;
  border: none; border-radius: 12px;
  background: #FFF;
  font-size: 11.5px; font-weight: 600; color: var(--sh-ink);
  cursor: pointer;
}
.sh-cat:active { transform: scale(0.96); }
.sh-cat-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: var(--tint);
  color: var(--sh-indigo-dark);
}

.sh-section { margin: 18px 2px 10px; font-size: 15px; font-weight: 800; }

/* ---------- product grid ---------- */
.sh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sh-card {
  display: flex; flex-direction: column;
  border: none; padding: 0;
  border-radius: 12px;
  background: #FFF;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
}
.sh-card:active { transform: scale(0.98); }
.sh-card-name {
  padding: 9px 10px 0;
  font-size: 13px; line-height: 1.35; color: var(--sh-ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sh-card-price {
  padding: 6px 10px 0;
  font-size: 15px; font-weight: 800; color: var(--sh-price);
}
.sh-card-price s { margin-left: 6px; font-size: 11.5px; font-weight: 500; color: var(--color-text-muted); }
.sh-card-meta {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px 10px;
  font-size: 11px; color: var(--color-text-muted);
}
.sh-card-meta em { font-style: normal; }
.sh-stars { display: inline-flex; color: #F5A623; }

/* ---------- cart bar ---------- */
.sh-cartbar {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
  padding: 11px 14px calc(11px + env(safe-area-inset-bottom, 0px));
  border: none; border-top: 1px solid rgba(23, 22, 52, 0.08);
  background: #FFF;
  cursor: pointer;
  text-align: left;
}
.sh-cartbar-icon { position: relative; display: flex; color: var(--sh-ink); }
.sh-badge {
  position: absolute; top: -6px; right: -8px;
  min-width: 16px; height: 16px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-pill);
  background: var(--sh-price);
  color: #FFF; font-size: 10px; font-weight: 700;
}
.sh-cartbar-text { flex: 1; font-size: 15px; font-weight: 800; color: var(--sh-price); }
.sh-cartbar:not(.on) .sh-cartbar-text { color: var(--color-text-muted); font-weight: 600; font-size: 13px; }
.sh-cartbar-go {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 13px; font-weight: 700; color: var(--sh-indigo);
}

/* ---------- chips / empty ---------- */
.sh-chiprow { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 12px; }
.sh-chiprow::-webkit-scrollbar { display: none; }
.sh-chip {
  flex-shrink: 0;
  padding: 7px 14px;
  border: 1px solid rgba(23, 22, 52, 0.10);
  border-radius: var(--radius-pill);
  background: #FFF;
  font-size: 13px; font-weight: 600; color: var(--sh-ink);
  cursor: pointer;
}
.sh-chip.on { background: var(--sh-indigo); border-color: var(--sh-indigo); color: #FFF; }
.sh-empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 54px 20px;
  color: var(--color-text-muted); font-size: 14px;
}

/* ---------- panes and rows ---------- */
.sh-pane {
  margin: 0 0 10px;
  padding: 14px;
  border-radius: 12px;
  background: #FFF;
}
.sh-body.no-pad .sh-pane { margin: 10px 12px; }
.sh-pane-head { font-size: 13px; font-weight: 800; margin-bottom: 10px; }

.sh-price-row { display: flex; align-items: baseline; gap: 8px; }
.sh-price { font-size: 22px; font-weight: 800; color: var(--sh-price); }
.sh-price-row s { font-size: 13px; color: var(--color-text-muted); }
.sh-off {
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(226, 55, 68, 0.12);
  color: var(--sh-price);
  font-size: 11.5px; font-weight: 800;
}
.sh-name { margin-top: 8px; font-size: 16px; font-weight: 700; line-height: 1.35; }
.sh-blurb { margin-top: 5px; font-size: 13px; color: var(--color-text-muted); line-height: 1.5; }
.sh-meta {
  display: flex; align-items: center; gap: 7px;
  margin-top: 10px;
  font-size: 12px; color: var(--color-text-muted);
}
.sh-meta em { font-style: normal; margin-left: auto; }

.sh-row-line {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 0;
  font-size: 13.5px;
}
.sh-row-line .k { color: var(--color-text-muted); }
.sh-row-line .v { font-weight: 600; text-align: right; }
.sh-row-line .v.minus { color: #0E7A4A; }
.sh-row-line.total { border-top: 1px solid rgba(23, 22, 52, 0.08); margin-top: 6px; padding-top: 12px; }
.sh-row-line.total .k { color: var(--sh-ink); font-weight: 700; }
.sh-row-line.total .v { font-size: 17px; font-weight: 800; color: var(--sh-price); }

/* ---------- buy bar ---------- */
.sh-buybar {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
  padding: 11px 14px calc(11px + env(safe-area-inset-bottom, 0px));
  background: #FFF;
  border-top: 1px solid rgba(23, 22, 52, 0.08);
}
.sh-buybar .btn { flex: 1; }
/* The cart, kept within thumb reach of the buy buttons. */
.sh-buybar-cart {
  position: relative;
  width: 44px; height: 44px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(23, 22, 52, 0.12);
  border-radius: 12px;
  background: #FFF;
  color: var(--sh-ink);
  cursor: pointer;
}
.sh-buybar-cart:active { transform: scale(0.94); }
.sh-buybar-cart .sh-badge { top: 2px; right: 2px; }
.sh-buybar-sum { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.sh-buybar-sum span { font-size: 11px; color: var(--color-text-muted); }
.sh-buybar-sum b { font-size: 18px; font-weight: 800; color: var(--sh-price); }

/* ---------- variant sheet ---------- */
.sh-sku-head { display: flex; align-items: flex-start; gap: 12px; }
.sh-sku-head > div:nth-child(2) { flex: 1; min-width: 0; }
.sh-sku-picked { margin-top: 5px; font-size: 12.5px; color: var(--color-text-muted); }
.sh-sku-group { margin-top: 18px; }
.sh-sku-label { font-size: 12.5px; font-weight: 700; color: var(--color-text-muted); margin-bottom: 9px; }
.sh-sku-values { display: flex; flex-wrap: wrap; gap: 8px; }
.sh-sku-val {
  padding: 8px 15px;
  border: 1px solid rgba(23, 22, 52, 0.12);
  border-radius: 9px;
  background: #FFF;
  font-size: 13px; font-weight: 600; color: var(--sh-ink);
  cursor: pointer;
}
.sh-sku-val.on {
  border-color: var(--sh-indigo);
  background: rgba(76, 63, 214, 0.08);
  color: var(--sh-indigo-dark);
}
.sh-sku .btn-block { margin-top: 22px; }

.sh-stepper {
  display: inline-flex; align-items: center; gap: 2px;
  border: 1px solid rgba(23, 22, 52, 0.12);
  border-radius: 9px;
  overflow: hidden;
}
.sh-stepper button {
  width: 34px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: #FFF;
  color: var(--sh-ink); cursor: pointer;
}
.sh-stepper button:disabled { color: rgba(23, 22, 52, 0.25); cursor: default; }
.sh-stepper span { min-width: 34px; text-align: center; font-size: 14px; font-weight: 700; }
.sh-stepper.sm button { width: 28px; height: 26px; }
.sh-stepper.sm span { min-width: 28px; font-size: 13px; }

/* ---------- cart lines ---------- */
.sh-line {
  display: flex; gap: 11px;
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: #FFF;
}
.sh-line-main { flex: 1; min-width: 0; }
.sh-line-name { font-size: 13.5px; line-height: 1.35; }
.sh-line-opts { margin-top: 4px; font-size: 12px; color: var(--color-text-muted); }
.sh-line-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.sh-line-foot .sh-price { font-size: 16px; }
.sh-line-del {
  align-self: flex-start;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none;
  color: var(--color-text-muted); cursor: pointer;
}

/* ---------- address ---------- */
.sh-addr-top { display: flex; align-items: center; gap: 7px; color: var(--sh-indigo); }
.sh-addr-label { font-size: 13px; font-weight: 800; }
.sh-addr-src {
  margin-left: auto;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(76, 63, 214, 0.1);
  font-size: 10.5px; font-weight: 700;
}
.sh-addr-name { margin-top: 10px; font-size: 14px; font-weight: 700; }
.sh-addr-line { margin-top: 4px; font-size: 13px; color: var(--color-text-muted); line-height: 1.5; }

/* ---------- selectable options ---------- */
.sh-opt {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(23, 22, 52, 0.10);
  border-radius: 10px;
  background: #FFF;
  cursor: pointer;
  color: var(--sh-ink);
  text-align: left;
}
.sh-opt:last-child { margin-bottom: 0; }
.sh-opt.on { border-color: var(--sh-indigo); background: rgba(76, 63, 214, 0.06); color: var(--sh-indigo-dark); }
.sh-opt:disabled { opacity: 0.45; cursor: default; }
.sh-opt-main { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sh-opt-main b { font-size: 13.5px; }
.sh-opt-main em { font-style: normal; font-size: 11.5px; color: var(--color-text-muted); }
.sh-opt-fee { font-size: 13.5px; font-weight: 700; }

/* ---------- order tracking ---------- */
.sh-track { display: flex; justify-content: space-between; gap: 6px; }
.sh-track-step {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--color-text-muted);
  text-align: center;
}
.sh-track-step.on { color: var(--sh-indigo-dark); font-weight: 700; }
.sh-track-dot {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(23, 22, 52, 0.10);
  color: #FFF;
}
.sh-track-step.on .sh-track-dot { background: var(--sh-indigo); }

.sh-sum-row { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; font-size: 13px; }
.sh-sum-qty { color: var(--color-text-muted); min-width: 26px; }
.sh-sum-name { flex: 1; min-width: 0; }
.sh-sum-name small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--color-text-muted); }
.sh-sum-amt { font-weight: 700; }
/* The arithmetic between the lines and the total, spelled out. */
.sh-order-break {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(23, 22, 52, 0.08);
}
.sh-order-break .sh-row-line { padding: 5px 0; font-size: 13px; }
.sh-sum-foot {
  display: flex; justify-content: space-between;
  margin-top: 6px; padding-top: 11px;
  border-top: 1px solid rgba(23, 22, 52, 0.08);
  font-size: 14px; font-weight: 800;
}

/* ---------- consent sheet ---------- */
.sh-auth { text-align: center; }
.sh-auth-mark img { width: 56px; height: 56px; border-radius: 16px; }
.sh-auth-title { margin-top: 12px; font-size: 17px; font-weight: 800; }
.sh-auth-body { margin-top: 7px; font-size: 13.5px; color: var(--color-text-muted); line-height: 1.5; }
.sh-auth-fields {
  margin-top: 16px;
  border-radius: 10px;
  background: var(--sh-bg);
  overflow: hidden;
  text-align: left;
}
.sh-auth-fields div {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 11px 13px;
  font-size: 13px;
}
.sh-auth-fields div + div { border-top: 1px solid rgba(23, 22, 52, 0.06); }
.sh-auth-fields span:first-child { color: var(--color-text-muted); }
.sh-auth-fields span:last-child { font-weight: 600; text-align: right; }

/* ---------- menu sheet ---------- */
.sh-sheet-rows { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.sh-sheet-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 4px;
  border: none; background: none;
  font-size: 15px; color: var(--color-text-main);
  cursor: pointer; text-align: left;
}
.sh-sheet-row:active { background: var(--sh-bg); border-radius: 10px; }
.sh-sheet-note, .sh-hostnote {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--color-text-muted);
}
.sh-sheet-note { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--color-border); }
.sh-hostnote { justify-content: center; padding: 18px 10px 6px; font-size: 11.5px; }

@media (prefers-reduced-motion: reduce) {
  .sh-card:active, .sh-cat:active, .sh-back:active, .sh-iconbtn:active { transform: none; }
}
