/* ============================================================
   Saeng Rung MINI App — Design System (mobile-first)
   ============================================================ */
:root {
  --bg: #eeeeee;
  --card: #ffffff;
  --surface-2: #f6f6f6;
  --border: #dedede;
  --border-strong: #cfcfcf;
  --text: #2b2620;
  --muted: #8a8278;
  --accent: #b45309;
  --accent-soft: #fdf3e7;
  --accent-dark: #92400e;
  --brand-blue: #2563eb;
  --brand-blue-soft: #bfdbfe;
  --brand-blue-deep: #1d4ed8;
  --brand-blue-pale: #eff6ff;
  --icon-blue-bg: #f3f8ff;
  --icon-blue-bg-strong: #dbeafe;
  --icon-blue-border: #d6e8ff;
  --danger: #b91c1c;
  --danger-dark: #991b1b;
  --success: #15803d;
  --font-thai: "Prompt", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 3px 9px rgba(0, 0, 0, 0.08);
  --shadow: 0 5px 14px rgba(0, 0, 0, 0.09);
  --shadow-md: 0 8px 22px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 14px 34px rgba(0, 0, 0, 0.16);
  --press: scale(0.97);
  --t-fast: 0.15s;
  --t-med: 0.22s;
  --nav-h: 58px;
  --topbar-h: 52px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
a { text-decoration: none; color: inherit; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-thai);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Global interaction (press state / transition) ---------- */
.btn, .chip, .filter-chip, .nav-item, .act-btn, .icon-btn, .copy-btn, .quick-item,
.cat-item, .promo-card, .video-card, .addr-pick, .ss-opt, .row, .card a.row, .g-dots button {
  transition: transform var(--t-fast) ease, box-shadow var(--t-med) ease, background var(--t-fast) ease,
    border-color var(--t-fast) ease, color var(--t-fast) ease, opacity var(--t-fast) ease;
}
.btn:active, .chip:active, .filter-chip:active, .nav-item:active, .act-btn:active, .copy-btn:active,
.quick-item:active, .cat-item:active, .addr-pick:active, .ss-opt:active, .icon-btn:active {
  transform: var(--press);
}
.row:active, .card a.row:active { background: var(--surface-2); }
.card { transition: box-shadow var(--t-med) ease; }
:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 2px; }
button { touch-action: manipulation; }

/* ---------- Skeleton shimmer (โหลดข้อมูลจริง) ---------- */
.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, #efe9df 25%, #f8f4ec 50%, #efe9df 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Fly-to-cart ---------- */
.flyer {
  position: fixed; z-index: 90; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; border-radius: 50%;
  background: var(--icon-blue-bg); color: var(--brand-blue-deep);
  box-shadow: var(--shadow-md); will-change: transform, opacity;
}
.flyer.has-img { background: #fff; overflow: hidden; padding: 2px; }
.flyer.has-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
#cart-badge.bump { animation: badge-bump 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.4); }
@keyframes badge-bump {
  0% { transform: scale(1); }
  45% { transform: scale(1.5); }
  100% { transform: scale(1); }
}
#cart-badge.bump-down { animation: badge-bump-down 0.4s cubic-bezier(0.3, 0.8, 0.4, 1); }
@keyframes badge-bump-down {
  0% { transform: scale(1); }
  40% { transform: scale(0.7); }
  100% { transform: scale(1); }
}
.qty-bump { animation: qty-bump 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
@keyframes qty-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* ---------- Toast animation ---------- */
@keyframes toast-in {
  from { transform: translate(-50%, 14px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; background: var(--bg); }

/* ---------- Top bar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
#topbar-title {
  flex: 1; font-weight: 700; font-size: 16px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.icon-btn[hidden], [hidden] { display: none !important; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border: 1px solid rgba(222, 222, 222, 0.78); background: rgba(255, 255, 255, 0.86);
  color: var(--text); border-radius: 10px; cursor: pointer; position: relative;
  box-shadow: var(--shadow-xs);
}
.icon-btn:active { background: var(--brand-blue-pale); color: var(--brand-blue-deep); }
.icon-btn svg { width: 22px; height: 22px; }
#cart-badge {
  position: absolute; top: 2px; right: 0;
  min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- Main view ---------- */
#view { padding: 14px 14px calc(var(--nav-h) + 24px); }
body.product-detail-mode #topbar { display: none; }
body.product-detail-mode #view {
  padding: 0 0 calc(94px + env(safe-area-inset-bottom));
  background: #fff;
}
body.cart-page-mode #topbar {
  height: 118px;
  padding: calc(18px + env(safe-area-inset-top)) 26px 0;
  align-items: center;
  background: var(--brand-blue);
  border-bottom: none;
  box-shadow: none;
}
body.cart-page-mode #topbar-title {
  color: #fff;
  text-align: center;
  font-size: 26px;
  font-weight: 800;
}
body.cart-page-mode #topbar-back {
  width: 52px;
  height: 52px;
  margin-right: -52px;
  border: none;
  background: transparent;
  color: #fff;
  box-shadow: none;
}
body.cart-page-mode #topbar-back svg { width: 38px; height: 38px; }
body.cart-page-mode #topbar-cart { display: none !important; }
body.cart-page-mode #app { background: #fff; }
body.cart-page-mode #view {
  padding: 0 0 calc(188px + env(safe-area-inset-bottom));
  background: #fff;
  min-height: calc(100vh - 118px);
}
body.cart-empty-mode #view {
  padding-bottom: 0;
}
body.home-page-mode #topbar { display: none; }
body.home-page-mode #view { padding: 0 0 calc(var(--nav-h) + 24px); }
#shop-results { scroll-margin-top: 72px; }

/* ---------- Bottom nav ---------- */
#bottomnav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; height: var(--nav-h);
  display: flex;
  background: #fff;
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.08);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; border: none; background: transparent; cursor: pointer;
  color: var(--muted); font-size: 10.5px; font-weight: 600;
  position: relative;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-badge {
  position: absolute; top: 6px; right: 25%;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--danger); color: #fff; font-size: 9px; font-weight: 800;
  border: 2px solid #fff; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-xs);
}
.nav-badge.bump { animation: badge-bump 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.4); }
.nav-badge.bump-down { animation: badge-bump-down 0.4s cubic-bezier(0.3, 0.8, 0.4, 1); }
.nav-svg { overflow: visible; }
.nav-fill {
  fill: currentColor;
  opacity: 0;
  transition: opacity var(--t-fast) ease;
}
.nav-line,
.nav-mark {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-mark { opacity: 0; }
.nav-item.active { color: var(--brand-blue); font-weight: 800; }
.nav-item.active .nav-fill { opacity: 0.24; }
.nav-item.active .nav-mark { opacity: 1; }
.nav-item[data-nav="shop"].active { color: var(--danger); }
.nav-item[data-nav="shop"].active .nav-fill { opacity: 0.32; }

/* ---------- Cards & layout ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 14px; margin-bottom: 12px;
}
@media (hover: hover) {
  .card:hover { box-shadow: var(--shadow-md); }
}
.section-title { font-size: 15px; font-weight: 700; margin: 24px 2px 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-2 .card { margin-bottom: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 12px; border: none; border-radius: 12px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-deep) 100%);
  color: #fff; box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
}
.btn:active { background: linear-gradient(135deg, var(--brand-blue-deep) 0%, var(--brand-blue) 100%); box-shadow: none; }
.btn.secondary { background: var(--brand-blue-pale); color: var(--brand-blue-deep); box-shadow: none; }
.btn.secondary:active { background: #dbeafe; }
.btn.ghost { background: var(--card); color: var(--brand-blue-deep); border: 1px solid #bfdbfe; box-shadow: var(--shadow-xs); }
.btn.ghost:active { background: var(--brand-blue-pale); }
.btn.small { padding: 8px 12px; font-size: 13px; width: auto; border-radius: 10px; }
.btn:disabled { opacity: 0.55; cursor: default; box-shadow: none; }

/* ---------- Chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card);
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-xs);
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Filter tabs (shop) ---------- */
.tabs {
  display: flex; gap: 4px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.tab {
  flex: 1; padding: 8px 2px; border: none; background: transparent;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; font-family: inherit;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

/* ---------- Filter panel (shop) ---------- */
.filter-panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.filter-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; }

/* ---------- Product card ---------- */
.prod-img {
  height: 235px; border-radius: 0; margin: -14px -14px 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 58px;
  background: #fff !important;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.04);
  text-shadow: 0 8px 18px rgba(43, 38, 32, 0.12);
}
.prod-info { padding: 16px 10px 12px; }
.prod-name { font-size: 17px; font-weight: 700; margin-bottom: 12px; line-height: 1.45; min-height: 50px; }
.prod-cat { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.price-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 0; }
.price { font-size: 20px; font-weight: 500; color: var(--danger); }
.price.old { font-size: 15px; font-weight: 400; color: var(--muted); text-decoration: line-through; }
.stock { font-size: 11px; font-weight: 600; }
.stock.in { color: var(--success); }
.stock.out { color: var(--danger); }
.badge {
  position: absolute; top: 8px; right: 8px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
}
.badge.green { background: #16a34a; }
.disc-pct { font-size: 11px; font-weight: 700; color: var(--danger); }
.prod-wrap {
  position: relative;
  padding: 14px;
  overflow: hidden;
  min-height: 360px;
}
.prod-wrap .prod-link {
  display: block;
  color: inherit;
  text-decoration: none;
  height: 100%;
}

/* ---------- Search bar (home) ---------- */
.home-hero {
  position: relative;
  min-height: 430px;
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.home-search-row {
  position: absolute;
  top: calc(18px + env(safe-area-inset-top));
  left: 26px;
  right: 26px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
}
.searchbar {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 0 14px; height: 42px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.home-searchbar {
  flex: 1;
  height: 54px;
  margin: 0;
  padding: 0 22px;
  border-color: #c8c8c8;
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.16);
}
.home-searchbar input {
  font-size: 22px;
  font-weight: 800;
}
.home-chat-btn {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #555;
}
.home-chat-btn svg { width: 38px; height: 38px; }
.searchbar-icon { font-size: 14px; display: inline-flex; align-items: center; }
.searchbar-icon svg { width: 21px; height: 21px; }
.searchbar input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 14px; font-family: inherit; color: var(--text);
}
body.home-page-mode .home-searchbar input {
  font-size: 22px;
  font-weight: 800;
}

/* ---------- Hero carousel (home) ---------- */
.hero-carousel-wrap { margin-bottom: 18px; }
.home-hero .hero-carousel-wrap { margin: 0; height: 100%; }
.carousel {
  display: flex; gap: 0; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.home-hero .carousel {
  height: 398px;
  border-radius: 0;
  box-shadow: none;
}
.carousel::-webkit-scrollbar { display: none; }
.slide {
  flex: 0 0 100%; scroll-snap-align: start; position: relative;
  height: 150px; border-radius: var(--radius); color: #fff;
  display: flex; align-items: center; overflow: hidden;
}
.home-hero .slide {
  height: 398px;
  border-radius: 0;
  align-items: flex-end;
  background-size: cover;
}
.home-hero .slide::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 28% 44%, rgba(255, 255, 255, 0.88), transparent 30%),
    radial-gradient(circle at 78% 42%, rgba(255, 255, 255, 0.48), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,0.12), rgba(0,0,0,0.16));
}
.slide-body { padding: 18px 16px; max-width: 70%; }
.home-hero .slide-body {
  position: relative;
  z-index: 2;
  max-width: 76%;
  padding: 0 26px 56px;
}
.slide-tag {
  display: inline-block; background: rgba(255, 255, 255, 0.25);
  font-size: 10.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  margin-bottom: 8px; backdrop-filter: blur(2px);
}
.slide-title { font-size: 21px; font-weight: 800; margin-bottom: 2px; text-shadow: 0 1px 4px rgba(0,0,0,0.15); }
.slide-sub { font-size: 12.5px; opacity: 0.95; margin-bottom: 10px; }
.home-hero .slide-title { font-size: 30px; line-height: 1.05; text-shadow: 0 2px 8px rgba(0,0,0,0.18); }
.home-hero .slide-sub { font-size: 14px; font-weight: 600; }
.slide-cta {
  display: inline-block; background: rgba(255, 255, 255, 0.9); color: #333;
  font-size: 12px; font-weight: 700; padding: 5px 14px; border-radius: 999px;
}
.slide-emoji { position: absolute; right: 10px; font-size: 72px; opacity: 0.9; transform: rotate(6deg); }
.home-hero .slide-emoji {
  right: 34px;
  bottom: 86px;
  font-size: 124px;
  opacity: 0.96;
  z-index: 1;
  filter: drop-shadow(0 18px 30px rgba(0,0,0,0.18));
}
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.hero-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  z-index: 4;
  margin: 0;
  padding: 10px 0 12px;
  background: rgba(255, 255, 255, 0.92);
}
.dot {
  width: 7px; height: 7px; border-radius: 999px; border: none; padding: 0;
  background: var(--border); cursor: pointer; transition: width 0.2s;
}
.dot.active { width: 22px; background: var(--accent); }
.hero-dots .dot {
  width: 11px;
  height: 11px;
  background: #9e9e9e;
}
.hero-dots .dot.active {
  width: 58px;
  background: #f9c300;
}

/* ---------- Quick menu grid (home) ---------- */
.home-content {
  padding: 34px 14px 0;
}
.quick-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 8px; margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}
.home-page-mode .quick-grid {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 24px 0 4px;
  gap: 18px;
}
.quick-item { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.home-page-mode .quick-item { gap: 12px; }
.quick-icon {
  width: 46px; height: 46px; border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; box-shadow: var(--shadow);
}
.home-page-mode .quick-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  font-size: 28px;
  background: #fff;
  box-shadow: var(--shadow);
}
.quick-label { font-size: 10.5px; font-weight: 600; color: var(--text); text-align: center; line-height: 1.3; }
.home-page-mode .quick-label { font-size: 16px; font-weight: 700; color: #555; }
.home-cat-title {
  margin-top: 32px;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 800;
  color: #f9c300;
}

/* ---------- Category circle icons (home + shop) ---------- */
.cat-scroll {
  display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.cat-scroll::-webkit-scrollbar { display: none; }
.shop-cat-scroll {
  display: flex;
  gap: 12px;
  overflow-y: hidden;
  padding: 6px 2px 14px;
}
.cat-item {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 82px; min-width: 0; border: none; background: transparent; cursor: pointer; font-family: inherit;
}
.shop-cat-scroll .cat-item { width: 82px; }
.cat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 8px;
  padding: 8px 2px 10px;
}
.cat-grid .cat-item { width: auto; }
.cat-item.active .cat-circle {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(248, 169, 48, 0.42), var(--shadow);
}
.cat-circle {
  width: 72px; height: 72px; min-width: 72px; border-radius: 50%;
  background: var(--card); border: 1px solid rgba(222, 222, 222, 0.92);
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-blue);
  box-shadow: var(--shadow-sm), inset 0 0 0 5px rgba(233, 246, 255, 0.62);
}
.cat-svg { width: 58px; height: 42px; display: block; }
.cat-fill { fill: rgba(42, 143, 217, 0.22); }
.cat-line {
  fill: none;
  stroke: #1f2933;
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.cat-label {
  font-size: 11px; font-weight: 700; color: var(--text); text-align: center;
  line-height: 1.25; width: 100%; min-height: 32px; overflow-wrap: anywhere;
}
.shop-cat-scroll .cat-label { min-height: 32px; display: flex; align-items: flex-start; justify-content: center; }

/* ---------- Promo banners (shop) ---------- */
.promo-banners { gap: 10px; }
.promo-banner {
  flex: 0 0 236px; border-radius: var(--radius); padding: 14px 16px; color: #fff;
}
.promo-tag {
  display: inline-block; background: rgba(255, 255, 255, 0.25);
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  margin-bottom: 8px;
}
.promo-title { font-size: 14px; font-weight: 800; }
.promo-sub { font-size: 11px; opacity: 0.95; margin: 2px 0 8px; }
.promo-big { font-size: 21px; font-weight: 800; line-height: 1.2; }
.promo-note { font-size: 10px; opacity: 0.85; margin-top: 2px; }

/* ---------- Flash deal head ---------- */
.deal-head {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 10px 0 14px;
}
.deal-head span {
  font-size: 17px; font-weight: 800; color: var(--danger); letter-spacing: 0.5px;
}
.deal-head em {
  font-style: normal; font-size: 11px; color: var(--muted);
  background: var(--card); border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 999px;
  box-shadow: var(--shadow-xs);
}
.deal-head::before, .deal-head::after {
  content: ""; flex: 1; height: 2px; background: repeating-linear-gradient(90deg, var(--danger) 0 6px, transparent 6px 12px);
}

/* ---------- Horizontal scroll rows ---------- */
.h-scroll {
  display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px;
  scrollbar-width: none;
}
.h-scroll::-webkit-scrollbar { display: none; }
.promo-card {
  flex: 0 0 172px; position: relative;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0; box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.promo-card .promo-img {
  height: 138px;
  margin: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 48px;
  background: #fff !important;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.05);
  text-shadow: 0 10px 22px rgba(43, 38, 32, 0.12);
}
.promo-card .prod-name {
  min-height: 54px;
  margin: 0;
  padding: 10px 10px 4px;
  font-size: 14.5px;
  line-height: 1.35;
  font-weight: 800;
}
.promo-card .price-row {
  padding: 0 10px 12px;
  gap: 7px;
  flex-wrap: wrap;
}
.promo-card .price {
  font-size: 19px;
  line-height: 1.1;
}
.promo-card .price.old {
  font-size: 12.5px;
}
.save-pill {
  position: absolute; top: 18px; left: 12px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  z-index: 2;
}

/* ---------- Video cards ---------- */
.video-card { flex: 0 0 168px; }
.video-thumb {
  position: relative; height: 104px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.video-emoji { font-size: 36px; }
.play-btn {
  position: absolute; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.45); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; padding-left: 3px;
}
.video-title { font-size: 12.5px; font-weight: 600; line-height: 1.35; margin-bottom: 2px; }
.video-meta { font-size: 11px; color: var(--muted); }

/* ---------- Member banner (home) ---------- */
.member-banner {
  display: flex; align-items: center; gap: 12px;
  margin: 2px 0 16px; padding: 16px;
  background: linear-gradient(135deg, #7c3aed22, #b4530922), var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.home-page-mode .member-banner {
  min-height: 126px;
  margin: 0 28px 18px;
  padding: 24px 22px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.member-emoji { font-size: 32px; }
.home-page-mode .member-emoji {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9c300;
  font-size: 28px;
}
.member-body { flex: 1; }
.member-title { font-weight: 800; font-size: 14.5px; }
.home-page-mode .member-title { font-size: 19px; margin-bottom: 14px; }
.member-sub { font-size: 12px; color: var(--muted); }
.home-page-mode .member-sub { font-size: 15px; color: #707070; }
.member-cta { font-size: 12.5px; font-weight: 700; color: var(--brand-blue-deep); white-space: nowrap; }
.home-page-mode .member-cta {
  width: 22px;
  color: transparent;
  font-size: 0;
  overflow: hidden;
}
.home-page-mode .member-cta::after {
  content: "›";
  color: #9b9b9b;
  font-size: 30px;
  line-height: 1;
}

/* ---------- Product gallery (detail) ---------- */
.product-hero {
  position: relative;
  background: #fff;
  overflow: hidden;
}
.product-float-actions {
  position: absolute; top: calc(16px + env(safe-area-inset-top)); left: 18px; right: 18px;
  display: flex; align-items: center; gap: 16px;
  z-index: 5; pointer-events: none;
}
.product-float-spacer { flex: 1; }
.product-float-btn {
  width: 58px; height: 58px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: rgba(150, 150, 150, 0.58);
  color: #fff; cursor: pointer; position: relative;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(5px);
  pointer-events: auto;
}
.product-float-btn:active { transform: var(--press); background: rgba(120, 120, 120, 0.72); }
.product-float-btn svg { width: 30px; height: 30px; }
.product-back-btn svg { width: 36px; height: 36px; }
#product-cart-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 28px; height: 28px; padding: 0 7px;
  background: #ffc20d; color: #111; font-size: 14px; font-weight: 800;
  border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
}
.gallery {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none;
  background: var(--card);
}
.gallery::-webkit-scrollbar { display: none; }
.g-slide {
  flex: 0 0 100%; scroll-snap-align: start; height: clamp(430px, 62vh, 620px);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.g-slide.g-fade { animation: g-crossfade 0.45s ease; }
@keyframes g-crossfade {
  from { opacity: 0.25; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}
.g-emoji { font-size: clamp(150px, 39vw, 210px); }
.g-dots {
  position: absolute; left: 0; right: 0; bottom: 12px;
  display: flex; justify-content: center; gap: 6px; padding: 10px 0 2px;
}
.g-dot {
  width: 7px; height: 7px; border-radius: 999px; border: none; padding: 0;
  background: rgba(140, 140, 140, 0.58); cursor: pointer; transition: width 0.2s;
}
.g-dot.active { width: 22px; background: #ffc20d; }
.play-btn.big {
  width: 86px; height: 86px; font-size: 32px; border-radius: 28px;
  background: #ffc20d; color: #fff; box-shadow: var(--shadow-md);
}

.product-detail-main {
  background: #fff;
}
.product-info-panel {
  padding: 18px 16px 14px;
}
.product-price-row {
  align-items: baseline;
  gap: 18px;
  margin: 4px 0 8px;
}
.product-price-row .price.old {
  color: #888;
  font-size: 22px;
  font-weight: 400;
}
.product-price {
  font-size: 30px;
  color: var(--danger);
  font-weight: 500;
}
.product-disc {
  font-size: 22px;
  color: var(--danger);
  background: transparent;
  padding: 0;
  font-weight: 500;
}
.product-detail-name {
  font-size: 22px;
  line-height: 1.45;
  margin: 0 0 8px;
}
.product-desc { font-size: 14px; margin-bottom: 0; }

/* ---------- Variant selector (สี/ขนาด) (detail) ---------- */
.variant-block { margin-bottom: 14px; }
.variant-block:last-child { margin-bottom: 0; }
.variant-label { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.variant-block .chips { padding-bottom: 2px; }
.variant-preview-card {
  background: #fff;
  padding: 20px 16px 18px;
  border-bottom: 10px solid var(--bg);
}
.variant-preview-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 8px;
}
.variant-more {
  border: none; background: transparent; color: var(--brand-blue-deep);
  font: inherit; font-size: 12.5px; font-weight: 700; padding: 4px 0;
}
.variant-summary {
  font-size: 13px; color: var(--muted); margin-bottom: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.variant-thumb-row {
  display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 4px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.variant-thumb-row::-webkit-scrollbar { display: none; }
.variant-thumb {
  width: 76px; height: 76px; flex: 0 0 76px;
  border: 2px solid var(--border-strong); border-radius: 2px;
  background: #fff; padding: 4px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-xs);
}
.variant-thumb.active {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18), var(--shadow-xs);
}
.variant-thumb-img {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 32px; background: #fff; border-radius: 1px;
}
.variant-sheet-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, 0.56);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}
.variant-sheet-overlay.open { opacity: 1; visibility: visible; }
.variant-sheet {
  width: 100%; max-width: 480px; max-height: 72vh; overflow-y: auto;
  background: #fff; border-radius: 18px 18px 0 0;
  padding: 28px 30px calc(14px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  position: relative;
}
.variant-close {
  position: absolute; top: 26px; right: 24px;
  width: 34px; height: 34px; border: none; border-radius: 50%;
  background: transparent; color: var(--muted);
  font-size: 34px; line-height: 1; cursor: pointer;
}
.variant-sheet-top {
  display: grid; grid-template-columns: 112px 1fr; gap: 18px;
  align-items: center; margin-bottom: 22px; padding-right: 22px;
}
.variant-sheet-img {
  width: 112px; height: 112px; border: 2px solid var(--border-strong); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 54px;
  background: #fff; box-shadow: var(--shadow-xs);
}
.variant-sheet-info .price { font-size: 26px; color: var(--danger); font-weight: 500; }
.variant-sheet-info .price.old { font-size: 20px; font-weight: 400; }
.variant-pct { font-size: 22px; font-weight: 500; }
.variant-sheet-name {
  font-size: 16px; font-weight: 700; line-height: 1.45; margin: 8px 0 2px;
}
.variant-sheet-sku {
  font-size: 13.5px; color: var(--muted); font-weight: 600;
}
.variant-sheet-group { margin-bottom: 24px; }
.variant-sheet-label {
  font-size: 17px; font-weight: 800; margin-bottom: 12px;
}
.variant-choice-row {
  display: flex; flex-wrap: wrap; gap: 12px;
}
.variant-choice {
  min-width: 92px; min-height: 58px; padding: 12px 18px;
  border: 2px solid var(--border-strong); border-radius: 8px;
  background: #fff; color: #111; font: inherit; font-size: 18px; font-weight: 800;
  cursor: pointer; box-shadow: var(--shadow-xs);
}
.variant-choice.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(248, 169, 48, 0.28), var(--shadow-xs);
  color: var(--accent-dark);
}
.variant-sheet-qty {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin: 28px 0 18px; font-size: 17px; font-weight: 800;
}
.variant-qty {
  border-radius: 8px; padding: 0; gap: 0; overflow: hidden;
}
.variant-qty button,
.variant-qty span {
  width: 64px; height: 52px; display: flex; align-items: center; justify-content: center;
  border-right: 1px solid var(--border);
  font-size: 22px; font-weight: 600;
}
.variant-qty span { font-size: 18px; background: #fff; }
.variant-qty button:last-child,
.variant-qty span:last-child { border-right: none; }
.variant-add-btn { margin-top: 4px; min-height: 52px; font-size: 18px; }

/* ---------- Features line (detail) ---------- */
.features-box {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: #fff;
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  padding: 16px 6px; margin: 6px 0 10px;
  box-shadow: none;
}
.feat-item {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  text-align: center; padding: 0 4px;
}
.feat-item + .feat-item { border-left: 1px solid var(--border); }
.feat-icon {
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--brand-blue-deep);
}
.feat-icon svg { width: 34px; height: 34px; }
.feat-text { font-size: 12px; font-weight: 700; line-height: 1.35; }

/* ---------- Spec (detail) ---------- */
.product-spec-panel {
  margin-top: 16px;
  padding: 16px 0 2px;
  border-top: 10px solid var(--bg);
  border-bottom: 1px solid var(--border-strong);
}
.product-spec-panel .section-title {
  padding: 0 16px;
}
.spec-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.spec-k { color: var(--muted); font-weight: 600; flex: 0 0 auto; }
.spec-v { text-align: right; font-weight: 600; }
.spec-head { font-weight: 700; font-size: 14px; margin: 16px 16px 8px; }
.spec-list { margin: 0; padding: 0 16px 0 34px; font-size: 13.5px; color: var(--text); }
.spec-list li { margin-bottom: 4px; }
.more-btn {
  width: 100%; margin-top: 6px; padding: 12px 16px; border: none;
  border-top: 1px solid var(--border);
  border-radius: 0; background: #fff; color: var(--brand-blue-deep);
  font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
  text-align: center;
}

/* ---------- Product action bar (detail) ---------- */
.product-actions {
  position: fixed; bottom: calc(var(--nav-h) + 8px); left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 10px 12px; box-shadow: 0 -8px 22px rgba(0, 0, 0, 0.12);
  z-index: 25;
}
body.product-detail-mode .product-actions {
  bottom: 0;
  border-radius: 14px 14px 0 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.act-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: none; background: transparent; cursor: pointer;
  font-size: 10px; font-weight: 600; color: var(--muted); font-family: inherit;
  min-width: 52px;
}
.act-icon { font-size: 20px; display: inline-flex; }
.act-icon svg { width: 22px; height: 22px; }
.product-actions .btn { flex: 1; }
.btn svg, .copy-btn svg { width: 17px; height: 17px; }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; }
.ic-txt { width: 13px; height: 13px; vertical-align: -2px; }
.inline-ic { width: 16px; height: 16px; vertical-align: -3px; }

/* ---------- List rows ---------- */
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 2px; border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }
.row .row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 14px; }
.row-sub { font-size: 12.5px; color: var(--muted); }
.row-sub svg { width: 13px; height: 13px; vertical-align: -2px; }
.row-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: var(--icon-blue-bg); flex: 0 0 auto; color: var(--brand-blue-deep);
  border: 1px solid var(--icon-blue-border);
  box-shadow: var(--shadow-xs);
}
.row-icon svg { width: 21px; height: 21px; }
.empty-ic {
  width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--icon-blue-bg); display: flex; align-items: center; justify-content: center;
  color: var(--brand-blue-deep);
  border: 1px solid var(--icon-blue-border);
  box-shadow: var(--shadow-sm);
}
.empty-ic svg { width: 34px; height: 34px; }
.status-pill {
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.status-pill.success { background: #dcfce7; color: var(--success); }
.status-pill.warn { background: #fef3c7; color: #b45309; }
.status-pill.info { background: #dbeafe; color: #1d4ed8; }
.status-pill.danger { background: #fee2e2; color: var(--danger); }

/* ---------- Orders / Tracking ---------- */
.ord-sum { display: flex; gap: 8px; }
.ord-sum > div {
  flex: 1; text-align: center; padding: 12px 6px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--accent-soft);
}
.ord-num { font-size: 20px; font-weight: 800; color: var(--text); }
.ord-num.warn { color: #b45309; }
.ord-num.info { color: #1d4ed8; }
.ord-lbl { font-size: 11px; color: var(--muted); margin-top: 2px; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; -webkit-overflow-scrolling: touch; }
.filter-chip {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper { display: flex; margin-top: 16px; padding: 4px 0 6px; }
.stp { flex: 1; text-align: center; position: relative; }
.stp:not(:last-child)::after {
  content: ""; position: absolute; top: 13px; left: 50%; width: 100%; height: 2px;
  background: var(--border); z-index: 0;
}
.stp.done:not(:last-child)::after { background: var(--success); }
.stp-dot {
  width: 26px; height: 26px; margin: 0 auto 6px; border-radius: 50%; z-index: 1; position: relative;
  background: var(--card); border: 2px solid var(--border); color: var(--muted);
  font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.stp.done .stp-dot { background: var(--success); border-color: var(--success); color: #fff; }
.stp.cur .stp-dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.stp-lbl { font-size: 9.5px; color: var(--muted); line-height: 1.25; }
.stp.done .stp-lbl, .stp.cur .stp-lbl { color: var(--text); font-weight: 700; }
.track-no {
  font-size: 15px; font-weight: 800; letter-spacing: 0.5px; text-align: center;
  padding: 8px 0 2px; user-select: all;
}
.copy-btn {
  flex: 0 0 auto; padding: 7px 12px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--card); color: var(--accent); font-size: 12px; font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow-xs);
}
.copy-btn:active { background: var(--accent-soft); }
.timeline { padding: 4px 0; }
.tl { display: flex; gap: 12px; position: relative; }
.tl-dot {
  width: 12px; height: 12px; border-radius: 50%; background: var(--success);
  flex: 0 0 auto; margin-top: 4px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--success);
  z-index: 1;
}
.tl-dot.last { background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tl:not(:last-child)::before {
  content: ""; position: absolute; left: 5px; top: 18px; bottom: -6px; width: 2px; background: var(--success);
}
.tl-body { padding-bottom: 16px; }
.tl-label { font-size: 13.5px; font-weight: 600; }
.tl-date { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Forms (skeleton) ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; font-family: inherit; background: var(--card); color: var(--text);
  box-shadow: var(--shadow-xs);
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---------- Searchable select (จังหวัด/อำเภอ/ตำบล) ---------- */
.search-select { position: relative; }
.ss-input {
  width: 100%; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit;
  background: var(--card); color: var(--text);
  box-shadow: var(--shadow-xs);
}
.ss-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.ss-input[disabled] { background: #f3f0ea; color: var(--muted); }
.ss-panel {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  max-height: 220px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-md);
}
.ss-opt {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px; border: none; background: transparent;
  font-size: 13.5px; font-family: inherit; color: var(--text); cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.ss-opt:last-child { border-bottom: none; }
.ss-opt.selected { background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }
.ss-opt:active { background: var(--accent-soft); }
.ss-empty { padding: 12px; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- ที่อยู่จัดส่ง ---------- */
.addr-card { padding: 14px; box-shadow: var(--shadow-sm); }
.addr-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 8px;
}
.addr-name { font-weight: 800; font-size: 15px; }
.addr-pill {
  flex: 0 0 auto; font-size: 11px; font-weight: 700;
  background: #fef3c7; color: #b45309;
  padding: 4px 10px; border-radius: 999px;
  box-shadow: var(--shadow-xs);
}
.addr-text { font-size: 13.5px; line-height: 1.55; margin-bottom: 6px; }
.addr-phone { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.addr-actions { display: flex; gap: 8px; }
.addr-actions .btn { flex: 1; }
.btn.ghost.danger { color: var(--danger); border-color: #fecaca; background: #fef2f2; }
.form-row2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px;
}
.addr-primary-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 600; margin: 2px 0 14px;
}
.addr-primary-check input { width: 18px; height: 18px; accent-color: var(--brand-blue); }
.err {
  background: #fef2f2; border: 1px solid #fecaca; color: var(--danger);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px;
  box-shadow: var(--shadow-xs);
}

/* ---------- Modal (send order to admin) ---------- */
.modal-addr {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 12px; background: var(--card);
  box-shadow: var(--shadow-sm);
}
.modal-addr-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 6px;
}
.modal-addr-title { font-size: 12.5px; font-weight: 700; color: var(--brand-blue-deep); }
.modal-addr-head .btn { padding: 5px 12px; font-size: 12px; width: auto; }
.modal-addr-current { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.modal-addr-list {
  margin: 8px 0; border-top: 1px solid var(--border); padding-top: 8px;
  max-height: 170px; overflow-y: auto;
}
.addr-pick {
  display: block; width: 100%; text-align: left;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); padding: 8px 10px; margin-bottom: 8px;
  cursor: pointer; font-family: inherit;
  box-shadow: var(--shadow-xs);
}
.addr-pick.selected { border-color: var(--brand-blue-soft); background: var(--icon-blue-bg); }
.addr-pick-name { display: block; font-size: 13px; font-weight: 700; }
.addr-pick-text { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.4; }
#order-addr-add { width: 100%; }
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(43, 38, 32, 0.5);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  width: 100%; max-width: 480px;
  background: #fff; border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.2, 0.85, 0.3, 1);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-title { font-size: 16px; font-weight: 800; }
.order-msg {
  background: var(--accent-soft); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; font-size: 13px;
  white-space: pre-wrap; word-break: break-word;
  max-height: 40vh; overflow-y: auto; font-family: inherit;
  box-shadow: var(--shadow-xs);
}

/* ---------- Cart page (หน้า cart) ---------- */
.cart-page {
  min-height: calc(100vh - 118px);
  background: #fff;
}
.cart-empty {
  min-height: calc(100vh - 118px - 188px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 24px 48px;
  background: #fff;
}
.cart-list {
  background: #fff;
}
.cart-line {
  display: grid;
  grid-template-columns: 106px 1fr;
  gap: 20px;
  padding: 34px 26px 30px;
  border-bottom: 1px solid #e7e7e7;
}
.cart-thumb {
  width: 106px;
  height: 106px;
  border: 2px solid #b9b9b9;
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
  color: var(--text);
  overflow: hidden;
}
.cart-line-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cart-line-title {
  color: #555;
  font-size: 19px;
  line-height: 1.55;
  font-weight: 700;
}
.cart-variant-tag {
  align-self: flex-start;
  max-width: 100%;
  border-radius: 8px;
  background: #eeeeee;
  color: #111;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-line-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}
.cart-price-stack {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.cart-sale-price {
  color: var(--danger);
  font-size: 20px;
  line-height: 1;
  font-weight: 500;
  white-space: nowrap;
}
.cart-old-price {
  color: #8f8f8f;
  font-size: 15px;
  text-decoration: line-through;
  white-space: nowrap;
}
.cart-qty {
  flex: 0 0 auto;
  border-radius: 9px;
  border-color: #bdbdbd;
  padding: 0;
  gap: 0;
  overflow: hidden;
  box-shadow: none;
}
.cart-qty button,
.cart-qty span {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #bdbdbd;
  background: #fff;
  color: #111;
  font-size: 20px;
  font-weight: 500;
}
.cart-qty span { font-size: 18px; font-weight: 700; }
.cart-qty button {
  border-radius: 0;
  cursor: pointer;
}
.cart-qty button:last-child { border-right: none; }
.cart-spacer { height: 260px; }
.cart-checkout-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #fff;
  z-index: 25;
  box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.cart-coupon-panel {
  border-top: 1px solid #f0f0f0;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
}
body.cart-page-mode .coupon-row {
  min-height: 82px;
  padding: 18px 26px;
  gap: 16px;
}
body.cart-page-mode .coupon-ic {
  width: 36px;
  height: 36px;
  background: transparent;
  color: #ffc20d;
  box-shadow: none;
}
body.cart-page-mode .coupon-ic svg { width: 28px; height: 28px; }
body.cart-page-mode .coupon-title {
  font-size: 22px;
  font-weight: 800;
  color: #111;
}
.cart-coupon-saving {
  color: var(--danger);
  font-size: 14px;
  font-weight: 700;
}
body.cart-page-mode .coupon-chev {
  color: #969696;
  font-size: 56px;
  line-height: 1;
}
body.cart-page-mode .coupon-list {
  padding: 6px 26px 12px;
}
.cart-checkout-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 196px;
  gap: 12px;
  align-items: center;
  padding: 20px 28px 22px;
}
.cart-total-box div:first-child {
  display: flex;
  align-items: baseline;
  gap: 14px;
  color: #111;
}
.cart-total-box span {
  font-size: 22px;
  font-weight: 800;
}
.cart-total-box strong {
  font-size: 27px;
  line-height: 1;
  font-weight: 900;
}
.cart-discount-line {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-top: 8px;
}
.cart-discount-line span {
  color: var(--danger);
  font-size: 18px;
  font-weight: 500;
}
.cart-pay-btn {
  min-height: 58px;
  border-radius: 26px;
  background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
  color: #fff;
  font-size: 16px;
  line-height: 1.15;
  font-weight: 800;
  box-shadow: 0 7px 16px rgba(185, 28, 28, 0.2);
  white-space: normal;
  padding-left: 12px;
  padding-right: 12px;
}
.cart-pay-btn:active { background: linear-gradient(135deg, var(--danger-dark) 0%, var(--danger) 100%); }

/* ---------- Coupon + cart summary (หน้า cart) ---------- */
.coupon-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 13px 14px; border: none; background: transparent;
  font-family: inherit; cursor: pointer; text-align: left;
}
.coupon-ic {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: #fef3c7; color: #b45309;
  box-shadow: var(--shadow-xs);
}
.coupon-ic svg { width: 18px; height: 18px; }
.coupon-main { flex: 1; min-width: 0; }
.coupon-title { display: block; font-size: 13.5px; font-weight: 700; color: var(--text); }
.coupon-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.coupon-chev {
  color: var(--muted); font-size: 18px; transition: transform var(--t-fast) ease;
  flex: 0 0 auto;
}
.coupon-chev.open { transform: rotate(90deg); }
.coupon-list { border-top: 1px solid var(--border); padding: 6px 12px 10px; }
.coupon-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 6px; border: none; background: transparent; border-bottom: 1px solid var(--border);
  font-family: inherit; cursor: pointer;
}
.coupon-item:last-child { border-bottom: none; }
.coupon-item.selected { background: var(--icon-blue-bg); border-radius: 12px; }
.coupon-item .coupon-ic { background: var(--icon-blue-bg); color: var(--brand-blue-deep); }
.coupon-item.selected .coupon-ic { background: #fef3c7; color: #b45309; }
.coupon-code { display: block; font-size: 13.5px; font-weight: 800; color: var(--brand-blue-deep); }
.coupon-check { color: var(--brand-blue); font-size: 16px; font-weight: 800; flex: 0 0 auto; }
.coupon-empty { padding: 14px 6px; text-align: center; }
.sum-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 4px 2px; font-size: 13.5px; color: var(--text);
}
.sum-row.disc span:last-child { color: var(--danger); font-weight: 600; }
.sum-row.total { padding: 8px 2px 10px; }
.sum-row.total span:first-child { font-weight: 800; font-size: 14px; }
.sum-row.total .price { font-size: 20px; color: var(--text); }

/* ---------- Misc ---------- */
.muted { color: var(--muted); font-size: 12.5px; }
.center { text-align: center; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.qty {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 6px;
  background: var(--card);
  box-shadow: var(--shadow-xs);
}
.qty button {
  width: 26px; height: 26px; border-radius: 50%; border: none;
  background: var(--icon-blue-bg); color: var(--brand-blue-deep); font-size: 15px; font-weight: 700; cursor: pointer;
  transition: transform var(--t-fast) ease, background var(--t-fast) ease;
}
.qty button:active { transform: var(--press); background: var(--icon-blue-bg-strong); }
body.cart-page-mode .cart-qty button,
body.cart-page-mode .cart-qty span {
  width: 36px;
  height: 36px;
  border-right: 1px solid #bdbdbd;
  background: #fff;
  color: #111;
  border-radius: 0;
  font-size: 20px;
  font-weight: 500;
}
body.cart-page-mode .cart-qty span { font-size: 18px; font-weight: 700; }
body.cart-page-mode .cart-qty button:last-child { border-right: none; }
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 18px); left: 50%; transform: translateX(-50%);
  background: #2b2620; color: #fff; font-size: 13px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px; z-index: 40; opacity: 0; transition: opacity 0.25s;
  pointer-events: none; white-space: nowrap; box-shadow: var(--shadow-md);
}
.toast.show { opacity: 1; animation: toast-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
