/* ── Brand font (Preuksa) ────────────────────────────────────────────────
   font-display: swap keeps text visible in the fallback stack while the
   font loads; if a file fails to load, the Thai-capable system stack below
   is used instead. Files are served by the backend with immutable caching. */
@font-face {
  font-family: 'Preuksa';
  src: url('/portal/fonts/Preuksa-Regular.otf') format('opentype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Preuksa';
  src: url('/portal/fonts/Preuksa-Medium.otf') format('opentype');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Preuksa';
  src: url('/portal/fonts/Preuksa-SemiBold.otf') format('opentype');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Preuksa';
  src: url('/portal/fonts/Preuksa-Bold.otf') format('opentype');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Preuksa';
  src: url('/portal/fonts/Preuksa-ExtraBold.otf') format('opentype');
  font-weight: 800; font-style: normal; font-display: swap;
}

/* ── Design tokens ───────────────────────────────────────────────────── */
:root {
  color-scheme: light;
  --c-bg:        #f5f6f8;
  --c-surface:   #fff;
  --c-border:    #e3e8ee;
  --c-muted-bg:  #eef1f4;
  --c-text:      #17212b;
  --c-subtle:    #5c6b7a;
  --c-green:     #06c755;
  --c-green-dk:  #04a94a;
  --c-green-bg:  #e6f7ed;
  --c-green-txt: #0a7a3d;
  --c-red-bg:    #fdecea;
  --c-red-txt:   #b3261e;
  --c-amber-bg:  #fff4e5;
  --c-amber-txt: #9a6700;
  --radius-card: 14px;
  --radius-btn:  8px;
  --shadow-card: 0 2px 10px rgba(0,0,0,.06);
  --touch-min:   44px;
  --transition:  200ms ease;
  --nav-h:       64px;
}

/* ── Reset & base ────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body {
  font-family: 'Preuksa', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans Thai', 'Sarabun', sans-serif;
}
body {
  margin: 0; background: var(--c-bg); color: var(--c-text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea, optgroup, option {
  font-family: inherit;
}
.wrap { max-width: 480px; margin: 0 auto; padding: 12px 16px calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px); }

/* ── Task-led portal shell ────────────────────────────────────────────── */
.portal-topbar {
  display: flex; justify-content: flex-end; align-items: center;
  min-height: 42px; margin: 0 0 8px;
}
.account-open {
  min-height: 36px; padding: 6px 10px; background: transparent;
  color: var(--c-subtle); font-size: .78rem; font-weight: 700;
}
.account-open:active:not(:disabled) { background: var(--c-muted-bg); color: var(--c-text); }
.account-open-icon {
  width: 17px; height: 17px; flex: 0 0 17px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; color: var(--c-green);
}
.activity-switch {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  padding: 4px; margin: 0 0 14px; background: var(--c-muted-bg); border-radius: 12px;
}
.activity-switch-btn {
  min-width: 0; min-height: 38px; padding: 6px 4px; background: transparent;
  color: var(--c-subtle); font-size: .78rem; font-weight: 700;
}
.activity-switch-btn.active { background: var(--c-surface); color: var(--c-green-txt); box-shadow: 0 1px 4px rgba(23,33,43,.12); }
.activity-switch-btn:active:not(:disabled) { background: var(--c-green-bg); }

/* Account sheet shares the motion and safe-area behavior of the detail panel,
   but remains independently operable for profile and privacy controls. */
.account-sheet {
  position: fixed; inset: 0; z-index: 320; display: flex; align-items: flex-end;
  justify-content: center; background: rgba(0,0,0,.45); opacity: 1;
}
.account-sheet.hidden { display: none; }
.account-sheet-panel {
  width: 100%; max-width: 480px; max-height: min(86vh, 760px); overflow-y: auto;
  background: var(--c-surface); border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,.18);
  animation: accountSheetIn 220ms cubic-bezier(.32,.72,0,1) both;
}
@keyframes accountSheetIn { from { transform: translateY(24px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }
.account-sheet-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 12px 20px 0;
}
.account-sheet-header h2 { margin: 0; padding-top: 5px; }
.account-sheet-body { padding: 14px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
.account-summary { padding: 2px 4px 14px; }
.account-summary .profile img { width: 44px; height: 44px; }
.account-summary .sub { color: var(--c-subtle); font-size: .8rem; margin-top: 2px; }
.account-sheet .lang-bar {
  justify-content: space-between; align-items: center; padding: 10px 4px 14px;
}
.account-setting-label { color: var(--c-subtle); font-size: .82rem; font-weight: 600; }
.account-sheet .card { margin-bottom: 12px; }
.account-sheet .card:last-child { margin-bottom: 0; }

/* ── Initial LIFF loading splash ─────────────────────────────────────── */
/* This is intentionally present in the first HTML response, before LIFF or
   config requests begin.  `100svh` avoids the mobile browser chrome jump;
   the padding keeps content clear of LINE WebView safe-area cutouts. */
#portalSplash {
  position: fixed; inset: 0; z-index: 1000;
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  padding:
    calc(28px + env(safe-area-inset-top, 0px))
    calc(24px + env(safe-area-inset-right, 0px))
    calc(28px + env(safe-area-inset-bottom, 0px))
    calc(24px + env(safe-area-inset-left, 0px));
  background:
    radial-gradient(circle at 50% 35%, rgba(6,199,85,.12), transparent 46%),
    linear-gradient(180deg, #fff 0%, var(--c-bg) 100%);
  opacity: 1; visibility: visible;
  transition: opacity 220ms ease, visibility 0s linear 220ms;
}
#portalSplash.is-exiting {
  opacity: 0; visibility: hidden; pointer-events: none;
}
.portal-splash-card {
  width: min(100%, 320px);
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.portal-splash-logo {
  width: 96px; height: 96px; border-radius: 28px;
  display: grid; place-items: center; overflow: hidden;
  background: #fff; border: 1px solid rgba(6,199,85,.14);
  box-shadow: 0 12px 32px rgba(23,33,43,.12);
}
.portal-splash-logo img {
  width: 100%; height: 100%; display: block; object-fit: contain;
  background: #fff;
}
.portal-splash-logo img.hidden { display: none; }
.portal-splash-logo-fallback {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--c-green), var(--c-green-dk));
  color: #fff;
}
.portal-splash-shop-name {
  margin: 18px 0 4px; max-width: 100%;
  font-size: 1.1rem; font-weight: 700; line-height: 1.35;
  overflow-wrap: anywhere;
}
.portal-splash-copy {
  margin: 0; color: var(--c-subtle);
  font-size: .9rem; line-height: 1.65;
}
.portal-splash-progress {
  width: min(100%, 220px); height: 5px; margin: 26px 0 0;
  overflow: hidden; border-radius: 999px; background: #dce6df;
}
.portal-splash-progress::after {
  content: ''; display: block; width: 42%; height: 100%;
  border-radius: inherit; background: var(--c-green);
  animation: portalSplashProgress 1.25s ease-in-out infinite;
}
@keyframes portalSplashProgress {
  from { transform: translateX(-110%); }
  to { transform: translateX(350%); }
}
@media (prefers-reduced-motion: reduce) {
  #portalSplash { transition: none; }
  .portal-splash-progress::after { animation: none; width: 100%; }
  .account-sheet-panel { animation: none; }
}

.browser-auth {
  min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center;
  padding: 28px 20px;
  background: linear-gradient(180deg, #fff 0%, var(--c-bg) 100%);
}
.browser-auth.hidden { display: none; }
.browser-auth-card {
  width: min(100%, 420px); padding: 30px 24px;
  text-align: center; background: var(--c-surface);
  border-radius: 20px; box-shadow: var(--shadow-card);
}
.browser-auth-mark {
  width: 64px; height: 64px; margin: 0 auto 16px;
  display: grid; place-items: center; border-radius: 18px;
  color: #fff; background: #06c755; font-size: .86rem; font-weight: 800;
}
.browser-auth-card h1 { margin: 0 0 10px; font-size: 1.5rem; }
.browser-auth-card p { color: var(--c-subtle); line-height: 1.55; }
.browser-auth-continue {
  min-height: 48px; margin: 20px 0 14px; padding: 0 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; color: #fff; background: #06c755;
  font-weight: 700; text-decoration: none;
}
.browser-auth-continue:hover { background: #05ad49; }
.browser-auth-guidance { margin: 4px 0 0; font-size: .82rem; }

/* ── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 16px;
}

/* ── Typography ──────────────────────────────────────────────────────── */
h1 { font-size: 1.2rem; margin: 0; line-height: 1.3; }
h2 { font-size: 1rem; margin: 0 0 12px; color: #35424f; font-weight: 700; }
.muted { color: var(--c-subtle); font-size: .85rem; line-height: 1.5; }

/* ── Profile header ──────────────────────────────────────────────────── */
.profile { display: flex; align-items: center; gap: 14px; }
.profile img { width: 54px; height: 54px; border-radius: 50%; background: var(--c-muted-bg); flex-shrink: 0; }
.profile .sub { color: var(--c-subtle); font-size: .85rem; margin-top: 3px; }

/* ── Tier badge (admin-mapped pricelist label) ───────────────────────── */
.tier-badge {
  display: inline-block; margin-top: 5px; padding: 3px 10px;
  border-radius: 999px; font-size: .72rem; font-weight: 700;
  background: var(--c-green-bg); color: var(--c-green-txt);
  letter-spacing: .02em; white-space: nowrap;
}

/* ── Tier-colored profile card ───────────────────────────────────────── */
/* Gradient + texture only when the admin mapped a tier color; otherwise
   the profile card keeps the plain .card styling above. The three
   gradient stops (--tier-g1/2/3) are shades of the configured color,
   computed in JS. Text color adapts via the --on-dark / --on-light
   modifier so names stay readable on any configured color. */
.card.tier-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--tier-g1) 0%, var(--tier-g2) 52%, var(--tier-g3) 100%);
}
.card.tier-hero::before {
  /* Subtle minimal texture: a soft top-left sheen + fine diagonal hairlines. */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at 12% 0%, var(--tier-tex-sheen) 0%, transparent 55%),
    repeating-linear-gradient(45deg, var(--tier-tex-line) 0, var(--tier-tex-line) 1px, transparent 1px, transparent 8px);
}
.card.tier-hero .profile { position: relative; z-index: 1; }
.card.tier-hero .profile img { box-shadow: 0 0 0 2px var(--tier-ring); background: var(--tier-ring); }
/* Light text on dark/saturated tier colors */
.card.tier-hero.tier-hero--on-dark { color: #fff; }
.card.tier-hero.tier-hero--on-dark { --tier-tex-sheen: rgba(255,255,255,.14); --tier-tex-line: rgba(255,255,255,.05); --tier-ring: rgba(255,255,255,.55); }
.card.tier-hero.tier-hero--on-dark h1 { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.18); }
.card.tier-hero.tier-hero--on-dark .sub { color: #fff; }
.card.tier-hero.tier-hero--on-dark .tier-badge {
  /* Darkening pill: raises white-text contrast instead of lowering it. */
  background: rgba(0,0,0,.22); color: #fff;
  border: 1px solid rgba(255,255,255,.3);
}
/* Dark text on light tier colors (ink must match DARK_TEXT in the JS) */
.card.tier-hero.tier-hero--on-light { color: #1d2733; }
.card.tier-hero.tier-hero--on-light { --tier-tex-sheen: rgba(255,255,255,.35); --tier-tex-line: rgba(0,0,0,.035); --tier-ring: rgba(255,255,255,.75); }
.card.tier-hero.tier-hero--on-light h1 { color: #1d2733; }
.card.tier-hero.tier-hero--on-light .sub { color: #1d2733; }
.card.tier-hero.tier-hero--on-light .tier-badge {
  /* Lightening pill: raises dark-ink contrast further. */
  background: rgba(255,255,255,.6); color: #1d2733;
  border: 1px solid rgba(0,0,0,.12);
}

/* ── Loyalty points ──────────────────────────────────────────────────── */
.points { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.points .value { font-size: 2.2rem; font-weight: 800; color: var(--c-green); line-height: 1; }
.points .unit  { color: var(--c-subtle); font-size: .9rem; }

/* ── Loyalty progress bar (toward next reward) ───────────────────────── */
.progress-wrap { margin: 10px 0 2px; }
.progress-track {
  height: 6px; border-radius: 999px;
  background: var(--c-muted-bg);
  overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%;
  border-radius: 999px;
  background: var(--c-green);
  transition: width 500ms cubic-bezier(.32,.72,0,1);
}
.progress-label {
  margin-top: 6px; color: var(--c-subtle);
  font-size: .8rem; line-height: 1.5;
}
.progress-label .reward-name { font-weight: 600; color: var(--c-text); }
.progress-label.redeemable { color: var(--c-green-txt); }
.progress-label.redeemable .reward-name { color: var(--c-green-txt); }
/* Tier progress inside the profile card: keep the bar legible on both the
   plain card and the tier-colored gradient (inherit the hero ink). */
#tierProgress { position: relative; z-index: 1; padding-top: 18px; /* room above the bar for the pip */ }
/* Base track for #tierProgress — 10px tall, overflow visible for the pip */
#tierProgress .progress-track {
  height: 10px; overflow: visible; position: relative;
}
#tierProgress .progress-fill {
  transition: width 0.6s ease;
}
/* Percentage pip — floats above the right edge of the fill */
#tierProgress .tier-pct-pip {
  position: absolute; bottom: calc(100% + 4px); left: 0;
  transform: translateX(-50%);
  font-size: .65rem; font-weight: 700; line-height: 1;
  padding: 1px 5px; border-radius: 999px; white-space: nowrap;
  background: #d1fae5; color: #065f46;
  pointer-events: none; transition: left 500ms cubic-bezier(.32,.72,0,1);
}
/* Two-row label layout */
#tierProgressLabel { margin-top: 6px; }
#tierProgressLabel .pbar-spend-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: .8rem; color: var(--c-text);
}
#tierProgressLabel .pbar-spend-row .pbar-target { color: var(--c-subtle); }
#tierProgressLabel .pbar-remaining-row {
  display: block; font-size: .75rem; font-weight: 600;
  color: var(--c-green-txt, #059669); margin-top: 2px;
}
/* Dedicated track tokens — clearly visible on both on-dark and on-light tier cards */
.card.tier-hero.tier-hero--on-dark  { --tier-track-bg: rgba(255,255,255,.28); }
.card.tier-hero.tier-hero--on-light { --tier-track-bg: rgba(0,0,0,.15); }
.card.tier-hero #tierProgress .progress-track {
  background: var(--tier-track-bg, var(--c-muted-bg));
}
.card.tier-hero.tier-hero--on-dark  #tierProgress .progress-fill { background: rgba(255,255,255,.9); }
.card.tier-hero.tier-hero--on-light #tierProgress .progress-fill { background: rgba(29,39,51,.75); }
.card.tier-hero #tierProgress .progress-label { color: inherit; }
.card.tier-hero #tierProgress #tierProgressLabel .pbar-spend-row { color: inherit; }
.card.tier-hero.tier-hero--on-dark  #tierProgress #tierProgressLabel .pbar-remaining-row { color: rgba(255,255,255,.85); }
.card.tier-hero.tier-hero--on-light #tierProgress #tierProgressLabel .pbar-remaining-row { color: rgba(29,39,51,.8); }
.card.tier-hero.tier-hero--on-dark  #tierProgress .tier-pct-pip { background: rgba(0,0,0,.28); color: #fff; }
.card.tier-hero.tier-hero--on-light #tierProgress .tier-pct-pip { background: rgba(255,255,255,.55); color: #1d2733; }
button.progress-browse {
  background: none; color: var(--c-green);
  font-size: .8rem; font-weight: 600;
  min-height: 28px; padding: 2px 0; margin-top: 2px;
}
button.progress-browse:active:not(:disabled) { background: none; color: var(--c-green-dk); }
.rewards-list { margin-top: 8px; }
.rewards-list .reward-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--c-muted-bg);
  font-size: .82rem;
}
.rewards-list .reward-row:last-child { border-bottom: 0; }
.rewards-list .reward-row .pts { color: var(--c-subtle); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rewards-list .reward-row.affordable .pts { color: var(--c-green-txt); font-weight: 700; }

/* ── Card head (title + action) ──────────────────────────────────────── */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

/* ── Badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: .7rem; font-weight: 700; background: var(--c-muted-bg); color: var(--c-subtle);
  text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
}
.badge.sale, .badge.done, .badge.paid { background: var(--c-green-bg); color: var(--c-green-txt); }
.badge.delivery-picked  { background: var(--c-amber-bg); color: var(--c-amber-txt); }
.badge.delivery-packed  { background: #dbeafe; color: #1d4ed8; }
.badge.delivery-shipped { background: var(--c-green-bg); color: var(--c-green-txt); }
.badge.delivery-partial { background: #ede9fe; color: #6d28d9; }
.badge.not_paid, .badge.partial        { background: var(--c-red-bg);   color: var(--c-red-txt); }
.badge.in_payment                      { background: var(--c-amber-bg); color: var(--c-amber-txt); }

/* ── Buttons ─────────────────────────────────────────────────────────── */
button {
  min-height: var(--touch-min);
  padding: 10px 18px;
  background: var(--c-green); color: #fff;
  font-size: .95rem; font-weight: 700;
  border: 0; border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition), transform 80ms ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  -webkit-tap-highlight-color: transparent;
}
button:active:not(:disabled) { transform: scale(.97); background: var(--c-green-dk); }
button:disabled { opacity: .55; cursor: default; }

/* Refresh / secondary buttons */
button.secondary {
  background: var(--c-muted-bg); color: #35424f;
  font-size: .82rem; font-weight: 600;
  min-height: 36px; padding: 6px 14px;
}
button.secondary:active:not(:disabled) { background: #dde1e6; }

/* Inline pay button */
button.pay {
  min-height: 36px; padding: 6px 14px;
  font-size: .82rem; margin-top: 6px;
}

/* ── Redeem product picker ───────────────────────────────────────────── */
.redeem-open { width: 100%; margin-top: 12px; }
.redeem-catalog { margin-top: 12px; }
.redeem-list { display: flex; flex-direction: column; gap: 8px; }
.redeem-item {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  width: 100%; min-height: var(--touch-min);
  padding: 10px 14px;
  background: var(--c-muted-bg); color: var(--c-text);
  border: 2px solid transparent; border-radius: 10px;
  font-size: .9rem; font-weight: 600; text-align: left;
  transition: border-color var(--transition), background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.redeem-image { width: 64px; height: 56px; border-radius: 8px; object-fit: cover; background: #fff; }
.redeem-image-placeholder { display: grid; place-items: center; font-size: 1.35rem; }
.redeem-details { min-width: 0; }
.redeem-item .redeem-name { min-width: 0; word-break: break-word; line-height: 1.35; }
.redeem-item .redeem-cost { margin-top: 3px; font-weight: 700; color: var(--c-green-txt); font-size: .8rem; }
.redeem-item.selected { border-color: var(--c-green); background: var(--c-green-bg); }
.redeem-item.unaffordable {
  background: var(--c-muted-bg); border-color: transparent;
}
.redeem-item.unaffordable .redeem-cost { color: var(--c-subtle); }
.redeem-qty { display: grid; grid-template-columns: 34px 44px 34px; gap: 4px; align-items: center; }
.redeem-qty button { min-height: 34px; padding: 2px; }
.redeem-qty input {
  width: 44px; height: 34px; padding: 4px; border: 1px solid var(--c-border);
  border-radius: 7px; text-align: center; font: inherit; color: var(--c-text); background: #fff;
}
.redeem-summary { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--c-green-bg); color: var(--c-green-txt); font-size: .84rem; font-weight: 600; }
.redeem-summary.over { background: var(--c-red-bg); color: var(--c-red-txt); }
.redeem-confirm { width: 100%; margin-top: 10px; }
@media (max-width: 380px) {
  .redeem-item { grid-template-columns: 52px minmax(0, 1fr); }
  .redeem-image { width: 52px; height: 48px; }
  .redeem-qty { grid-column: 1 / -1; justify-self: end; }
}

/* ── Rewards tab: coupon wallet ──────────────────────────────────────── */
.redemption-tracker-sub { margin: -4px 0 12px; }
.redemption-history { display: flex; flex-direction: column; gap: 10px; }
.redemption-card {
  padding: 12px 13px; border: 1px solid var(--c-border);
  border-radius: 10px; background: var(--c-muted-bg);
}
.redemption-card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; margin-bottom: 7px;
}
.redemption-items {
  margin: 0; padding: 0; list-style: none;
  font-size: .88rem; line-height: 1.45;
}
.redemption-item { overflow-wrap: anywhere; }
.redemption-meta {
  display: flex; flex-wrap: wrap; gap: 5px 12px;
  margin-top: 9px; color: var(--c-subtle); font-size: .76rem;
}
.redemption-reference {
  margin-top: 8px; font-size: .8rem; font-weight: 600;
  color: var(--c-text); overflow-wrap: anywhere;
}
.redemption-status {
  display: inline-block; flex: 0 0 auto; max-width: 62%;
  padding: 4px 9px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; line-height: 1.25;
  text-align: right; white-space: normal;
}
.redemption-status.pending { background: var(--c-amber-bg); color: var(--c-amber-txt); }
.redemption-status.draft { background: var(--c-amber-bg); color: var(--c-amber-txt); }
.redemption-status.confirmed { background: var(--c-green-bg); color: var(--c-green-txt); }
.redemption-reference-label { color: var(--c-subtle); font-weight: 400; }
.redemption-tracker-pager { margin-top: 12px; }
@media (max-width: 380px) {
  .redemption-card-head { display: block; }
  .redemption-status { display: inline-block; max-width: 100%; margin-top: 7px; text-align: left; }
}

.coupon-card {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 12px 14px; margin-bottom: 10px;
  background: var(--c-muted-bg); border-radius: 10px;
}
.coupon-card.tappable { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.coupon-card.tappable:active { background: var(--c-border); }
.coupon-card.tappable:focus-visible { outline: 3px solid var(--c-text); outline-offset: 2px; }
.coupon-card:last-child { margin-bottom: 0; }
.coupon-card .coupon-main { min-width: 0; flex: 1; }
.coupon-card .coupon-program { font-weight: 600; font-size: .88rem; line-height: 1.35; word-break: break-word; }
.coupon-card .coupon-code {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 4px 10px; min-height: 30px;
  background: var(--c-surface); border: 1px dashed #c6cdd5;
  border-radius: 6px; font-weight: 700; font-size: .9rem; letter-spacing: .04em;
  font-variant-numeric: tabular-nums; cursor: pointer; word-break: break-all;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.coupon-card .coupon-code:active { background: var(--c-green-bg); }
.coupon-card .coupon-expiry { margin-top: 6px; font-size: .75rem; color: var(--c-subtle); }
.coupon-card .coupon-side { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
/* Status badge — same pill styling + palette family as the tier badge */
.coupon-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}
.coupon-badge.active    { background: var(--c-green-bg); color: var(--c-green-txt); }
.coupon-badge.expired   { background: var(--c-amber-bg); color: var(--c-amber-txt); }
.coupon-badge.used      { background: #dde1e6;           color: var(--c-subtle); }
.coupon-badge.cancelled { background: var(--c-red-bg);   color: var(--c-red-txt); }
/* Expired/used/cancelled coupons fade slightly but stay readable */
.coupon-card.inactive .coupon-program,
.coupon-card.inactive .coupon-code { opacity: .55; }
.coupon-card button.coupon-copy {
  background: var(--c-surface); color: var(--c-green-txt);
  font-size: .78rem; font-weight: 700; min-height: 32px; padding: 4px 12px;
  border: 1px solid var(--c-border); border-radius: var(--radius-btn);
}
.coupon-card button.coupon-copy:active:not(:disabled) { background: var(--c-green-bg); transform: none; }

/* ── Full-screen coupon barcode ─────────────────────────────────────── */
.coupon-code-overlay {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
  padding: env(safe-area-inset-top, 0px) 18px env(safe-area-inset-bottom, 0px);
  background: rgba(23, 23, 23, .92);
  opacity: 0; transition: opacity 180ms ease;
}
.coupon-code-overlay.open { opacity: 1; }
.coupon-code-overlay.hidden { display: none; }
.coupon-code-view {
  width: min(100%, 430px); max-height: 100%; overflow-y: auto;
  padding: 18px 18px 24px; border-radius: 16px;
  background: var(--c-surface); color: var(--c-text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
}
.coupon-code-view-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.coupon-code-view-header h2 { margin: 0; font-size: 1.1rem; }
.coupon-code-view-header .panel-close { margin-left: 0; }
.coupon-code-scan-hint {
  margin: 12px 0 18px; color: var(--c-subtle);
  font-size: .86rem; text-align: center;
}
.coupon-barcode {
  display: flex; justify-content: center; align-items: center;
  min-height: 150px; padding: 16px 10px; overflow-x: auto;
  background: #fff; border: 1px solid var(--c-border); border-radius: 10px;
}
.coupon-barcode svg { display: block; width: 100%; max-width: 370px; height: auto; }
.coupon-code-value {
  margin-top: 18px; color: var(--c-text);
  font-size: clamp(1.35rem, 7vw, 2.1rem); font-weight: 800;
  letter-spacing: .1em; line-height: 1.2; text-align: center;
  overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
}

/* ── Clipboard toast ("Copied!") ─────────────────────────────────────── */
#copyToast {
  position: fixed; left: 50%;
  transform: translateX(-50%) translateY(8px);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 18px);
  background: rgba(23,33,43,.92); color: #fff;
  padding: 8px 16px; border-radius: 999px;
  font-size: .82rem; font-weight: 600; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 400;
}
#copyToast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Order / invoice rows ─────────────────────────────────────────────── */
.row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px; padding: 12px 0; border-bottom: 1px solid #eef1f4;
}
.row:last-child { border-bottom: 0; padding-bottom: 0; }
.row-left  { min-width: 0; flex: 1; }
.row-right { flex-shrink: 0; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row .name  { font-weight: 600; font-size: .92rem; word-break: break-word; line-height: 1.35; }
.row .date  { color: var(--c-subtle); font-size: .78rem; margin-top: 2px; }
.row .amount { font-weight: 700; font-size: .92rem; white-space: nowrap; }

/* Per-row payment feedback message */
.row-msg {
  font-size: .78rem; padding: 5px 8px; border-radius: 6px;
  margin-top: 4px; display: none; text-align: left;
  max-width: 100%; word-break: break-word;
}
.row-msg.error   { display: block; background: var(--c-red-bg);   color: var(--c-red-txt); }
.row-msg.success { display: block; background: var(--c-green-bg); color: var(--c-green-txt); }
.row-msg.info    { display: block; background: var(--c-amber-bg); color: var(--c-amber-txt); }

/* ── Status / alert messages ─────────────────────────────────────────── */
.msg { margin-top: 12px; padding: 10px 14px; border-radius: 8px; font-size: .85rem; display: none; }
.msg.error   { display: block; background: var(--c-red-bg);   color: var(--c-red-txt); }
.msg.success { display: block; background: var(--c-green-bg); color: var(--c-green-txt); }
.msg.info    { display: block; background: var(--c-amber-bg); color: var(--c-amber-txt); }

.redemption-refresh-status {
  min-height: 1.25rem;
  margin: 8px 0 2px;
  color: var(--c-subtle);
  font-size: .78rem;
  line-height: 1.4;
}
.redemption-refresh-status.error { color: var(--c-red-txt); }
.redemption-refresh-status.warning { color: var(--c-amber-txt); }
.redemption-refresh-status.success { color: var(--c-green-txt); }

/* ── Account-link pending state ───────────────────────────────────────── */
.account-pending-banner {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0 0 16px; padding: 12px 14px;
  background: var(--c-amber-bg); color: var(--c-amber-txt);
  border: 1px solid #f5d8ac; border-radius: var(--radius-card);
  font-size: .85rem; line-height: 1.45;
}
.account-pending-banner .pending-copy { flex: 1; }
.account-pending-banner .pending-dismiss {
  flex-shrink: 0; min-height: 30px; min-width: 30px; padding: 3px;
  background: transparent; color: inherit; font-size: 1.1rem; line-height: 1;
}
.account-pending-banner.hidden { display: none; }
.nav-btn.restricted {
  color: var(--c-subtle); opacity: .5; cursor: default;
}
.nav-btn.restricted::after {
  content: ''; font-size: .62rem; line-height: 1;
  position: absolute; margin: -18px 0 0 27px;
}
.nav-btn.restricted { position: relative; }

/* ── Empty / error state cards ──────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 12px; gap: 10px; text-align: center;
}
.empty-state svg { color: var(--c-subtle); opacity: .45; flex-shrink: 0; }
.empty-state .empty-title { font-weight: 600; font-size: .9rem; color: var(--c-subtle); }
.empty-state .empty-body  { color: var(--c-subtle); font-size: .82rem; line-height: 1.5; max-width: 260px; }

.error-state {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px; background: var(--c-red-bg); border-radius: 10px;
  color: var(--c-red-txt); font-size: .85rem;
}
.error-state .error-msg { line-height: 1.5; word-break: break-word; }
.error-state button.retry-btn {
  align-self: flex-start; background: var(--c-red-txt); color: #fff;
  font-size: .82rem; min-height: 36px; padding: 6px 14px;
}
.error-state button.retry-btn:active { background: #8e1e18; }

/* ── Credit Term card ────────────────────────────────────────────────── */
.ct-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--c-muted-bg);
  font-size: .88rem;
}
.ct-row:last-of-type { border-bottom: 0; }
.ct-label { color: var(--c-subtle); flex-shrink: 0; }
.ct-value { font-weight: 600; text-align: right; word-break: break-word; }
.credit-bar-wrap { margin: 10px 0 4px; }
.credit-bar-track {
  height: 8px; border-radius: 999px;
  background: var(--c-muted-bg); overflow: hidden;
}
.credit-bar-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: var(--c-green);
  transition: width 500ms cubic-bezier(.32,.72,0,1);
}
.credit-bar-fill.amber { background: #f59e0b; }
.credit-bar-fill.red   { background: var(--c-red-txt); }
.ct-asof { font-size: .75rem; color: var(--c-subtle); margin-top: 4px; margin-bottom: 4px; }
.on-hold-notice {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 8px;
  background: var(--c-amber-bg); color: var(--c-amber-txt);
  font-size: .85rem; font-weight: 600; margin-top: 12px;
}
.policy-link-btn {
  display: block; margin-top: 14px; text-align: center;
  padding: 10px 18px;
  border: 2px solid var(--c-green); border-radius: var(--radius-btn);
  color: var(--c-green); font-weight: 700; font-size: .9rem;
  text-decoration: none; font-family: inherit;
  transition: background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.policy-link-btn:active { background: var(--c-green-bg); }

/* ── Address card ─────────────────────────────────────────────────────── */
.addr-primary { font-size: .88rem; line-height: 1.7; color: var(--c-text); margin-bottom: 12px; }
.addr-primary:last-child { margin-bottom: 0; }
.addr-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--c-subtle); margin-bottom: 8px; }
.addr-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.addr-card {
  background: var(--c-muted-bg); border-radius: 10px;
  padding: 10px 12px; font-size: .82rem; line-height: 1.6; color: var(--c-text);
}
.addr-card .addr-name { font-weight: 600; margin-bottom: 2px; font-size: .85rem; }
.addr-country { color: var(--c-subtle); }

/* ── Collapsible shipping section ────────────────────────────────────── */
details summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
details summary::-webkit-details-marker { display: none; }
details summary .toggle-icon { transition: transform var(--transition); flex-shrink: 0; }
details[open] summary .toggle-icon { transform: rotate(90deg); }

/* ── Top products card ───────────────────────────────────────────────── */
.rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: var(--c-green-bg); color: var(--c-green-txt);
  font-size: .75rem; font-weight: 800;
}
.top-product-row { display: flex; align-items: center; gap: 12px; }
.top-product-row .row-left { display: flex; align-items: center; gap: 12px; }

/* ── Skeleton loading ────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}
.skel {
  background: linear-gradient(90deg, #e8eaed 25%, #f3f4f6 50%, #e8eaed 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 6px;
}
.skel-text  { height: 14px; margin-bottom: 6px; }
.skel-title { height: 18px; width: 55%; margin-bottom: 8px; }
.skel-sub   { height: 12px; width: 72%; }
.skel-value { height: 36px; width: 90px; margin-bottom: 4px; }
.skel-avatar {
  width: 54px; height: 54px; border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(90deg, #e8eaed 25%, #f3f4f6 50%, #e8eaed 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
}
.skel-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #eef1f4; }
.skel-row:last-child { border-bottom: 0; }
.skel-row-left  { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.skel-row-right { flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }

/* ── Section reveal transition ───────────────────────────────────────── */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeSlideIn 240ms ease forwards; }

/* ── Spinner ─────────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  flex-shrink: 0;
}
.spinner.dark {
  border-color: rgba(0,0,0,.18);
  border-top-color: var(--c-subtle);
}

/* ── Tabs (orders / quotations) ──────────────────────────────────────── */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button.tab-btn {
  flex: 1; min-height: 36px; padding: 6px 10px;
  background: var(--c-muted-bg); color: var(--c-subtle);
  font-size: .82rem; font-weight: 700;
}
.tabs button.tab-btn.active { background: var(--c-green-bg); color: var(--c-green-txt); }

/* ── Date-range filter ──────────────────────────────────────────────── */
.date-filter { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.date-filter input[type=date] {
  flex: 1; min-width: 118px; padding: 8px 10px; min-height: 36px;
  border: 1px solid #d4dbe2; border-radius: var(--radius-btn);
  font-size: .82rem; font-family: inherit; color: var(--c-text); background: #fff;
}

/* ── Pagination ─────────────────────────────────────────────────────── */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.pager .page-info { color: var(--c-subtle); font-size: .8rem; white-space: nowrap; }

/* ── Text-style button (show older invoices) ────────────────────────── */
button.link-btn {
  background: none; color: var(--c-green);
  font-size: .8rem; font-weight: 600;
  min-height: 32px; padding: 4px 8px;
}
button.link-btn:active:not(:disabled) { background: none; color: var(--c-green-dk); }

/* ── Link ────────────────────────────────────────────────────────────── */
a.link { color: var(--c-green); font-weight: 600; text-decoration: none; }
.hidden { display: none; }

/* ── Tappable row ────────────────────────────────────────────────────── */
.row.tappable {
  cursor: pointer;
  border-radius: 8px;
  margin: 0 -8px; padding-left: 8px; padding-right: 8px;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.row.tappable:active { background: var(--c-muted-bg); }
.row.tappable .chevron { color: var(--c-subtle); flex-shrink: 0; align-self: center; }

/* ── Detail panel (slide-up) ─────────────────────────────────────────── */
.panel-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  /* Must stack above #bottom-nav (z-index: 200) so panel actions stay visible */
  z-index: 300;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity 220ms ease;
}
.panel-overlay.open { opacity: 1; }
.panel-overlay.hidden { display: none; }

.panel {
  background: var(--c-surface);
  border-radius: 18px 18px 0 0;
  width: 100%; max-width: 480px;
  max-height: 86vh; overflow-y: auto;
  /* safe-area clearance lives on .panel-body so it scrolls with the content */
  padding: 0;
  transform: translateY(100%);
  transition: transform 260ms cubic-bezier(.32,.72,0,1);
  will-change: transform;
}
.panel-overlay.open .panel { transform: translateY(0); }

.panel-handle {
  display: flex; justify-content: center; padding: 12px 0 0;
}
.panel-handle::before {
  content: '';
  width: 36px; height: 4px;
  background: var(--c-border); border-radius: 99px;
}

.panel-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 12px 20px 0;
}
.panel-title { font-size: 1.05rem; font-weight: 700; color: var(--c-text); line-height: 1.3; flex: 1; }
.panel-close {
  background: var(--c-muted-bg); border: 0;
  min-height: 32px; width: 32px; height: 32px;
  padding: 0; border-radius: 50%;
  font-size: 1.1rem; line-height: 1;
  color: var(--c-subtle); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-left: 8px;
}
.panel-close:active { background: var(--c-border); }

.panel-body { padding: 12px 20px calc(28px + env(safe-area-inset-bottom, 0px)); }

.panel-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 16px; }
.panel-meta-item { display: flex; flex-direction: column; gap: 2px; }
.panel-meta-item .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--c-subtle); font-weight: 600; }
.panel-meta-item .value { font-size: .88rem; font-weight: 600; color: var(--c-text); }

/* ── Line-item table ─────────────────────────────────────────────────── */
.line-table { width: 100%; border-collapse: collapse; font-size: .83rem; margin-bottom: 14px; }
.line-table th {
  text-align: left; padding: 0 6px 6px;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--c-subtle); font-weight: 600; border-bottom: 1px solid var(--c-border);
}
.line-table th:last-child, .line-table td:last-child { text-align: right; }
.line-table td { padding: 8px 6px; border-bottom: 1px solid var(--c-muted-bg); vertical-align: top; color: var(--c-text); }
.line-table tr:last-child td { border-bottom: 0; }

.panel-totals { border-top: 1px solid var(--c-border); padding-top: 12px; }
.panel-total-row { display: flex; justify-content: space-between; font-size: .88rem; padding: 3px 0; color: var(--c-subtle); }
.panel-total-row.grand { font-size: 1rem; font-weight: 800; color: var(--c-text); padding-top: 6px; }
.panel-total-row.due   { color: var(--c-red-txt); font-weight: 700; }

.panel-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.panel-actions button { flex: 1; min-width: 120px; }
.panel-actions a.link-btn {
  flex: 1; min-width: 120px;
  min-height: var(--touch-min);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px;
  background: var(--c-muted-bg); color: #35424f;
  font-size: .9rem; font-weight: 700;
  border-radius: var(--radius-btn); text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.panel-actions a.link-btn:active { background: #dde1e6; }

.panel-loading { display: flex; align-items: center; gap: 10px; color: var(--c-subtle); font-size: .88rem; padding: 24px 0; justify-content: center; }

/* ── Quote badge extras ──────────────────────────────────────────────── */
.badge.draft   { background: var(--c-muted-bg); color: var(--c-subtle); }
.badge.sent    { background: var(--c-amber-bg); color: var(--c-amber-txt); }
.badge.sale    { background: var(--c-green-bg); color: var(--c-green-txt); }
.fulfillment-section { margin: 14px 0 4px; padding: 10px 12px; background: var(--c-muted-bg); border-radius: 8px; }
.fulfillment-header  { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.fulfillment-title   { font-size: .72rem; font-weight: 600; color: var(--c-subtle); text-transform: uppercase; letter-spacing: .04em; }
.fulfillment-row     { display: flex; justify-content: space-between; font-size: .82rem; margin-top: 4px; }
.fulfillment-row .label { color: var(--c-subtle); }
.fulfillment-row .value { font-weight: 500; }

/* ── Bottom navigation bar ───────────────────────────────────────────── */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding: 4px calc(16px + env(safe-area-inset-right, 0px))
    env(safe-area-inset-bottom, 0px) calc(16px + env(safe-area-inset-left, 0px));
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  display: flex; align-items: stretch;
  z-index: 200;
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
  max-width: 480px; margin: 0 auto;
  /* Stretch to full width even though max-width is set */
  left: max(0px, calc(50% - 240px));
  right: max(0px, calc(50% - 240px));
}
#bottom-nav.hidden { display: none; }
@media (max-width: 480px) {
  #bottom-nav { left: 0; right: 0; }
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px;
  background: none; border: 0; border-radius: 0;
  min-width: 0; min-height: 44px; padding: 4px 2px;
  color: var(--c-subtle); font-size: .72rem; font-weight: 600;
  cursor: pointer; transition: color var(--transition), background var(--transition);
  -webkit-tap-highlight-color: transparent;
  line-height: 1.1; letter-spacing: .01em; white-space: nowrap;
}
.nav-btn:active { background: var(--c-muted-bg); }
.nav-btn.active { color: var(--c-green); }
.nav-btn svg { flex-shrink: 0; }
.nav-btn.active svg { color: var(--c-green); }
.nav-btn .nav-icon {
  width: 24px; height: 24px; display: grid; place-items: center;
  line-height: 1;
}
.nav-btn .nav-icon svg {
  width: 23px; height: 23px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.legacy-nav-compat { display: none !important; }

/* ── Inventory search ────────────────────────────────────────────────── */
.inv-search-wrap { display: flex; gap: 8px; margin-bottom: 16px; position: relative; }
.inv-search-wrap input {
  flex: 1; padding: 10px 14px; min-height: 44px;
  border: 1px solid var(--c-border); border-radius: var(--radius-btn);
  font-size: .95rem; font-family: inherit; color: var(--c-text);
  background: #fff;
}
.inv-search-wrap input:focus { outline: 2px solid var(--c-green); border-color: transparent; }

/* ── Autocomplete dropdown ───────────────────────────────────────────── */
.inv-autocomplete {
  position: absolute; top: calc(100% + 4px); left: 0;
  width: calc(100% - 90px); /* leave room for Search button */
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-btn);
  box-shadow: 0 4px 16px rgba(0,0,0,.10);
  z-index: 50;
  overflow: hidden;
  max-height: 300px; overflow-y: auto;
}
.inv-autocomplete.hidden { display: none; }
.inv-ac-item {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; padding: 10px 14px; cursor: pointer;
  font-size: .88rem; border-bottom: 1px solid var(--c-muted-bg);
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.inv-ac-item:last-child { border-bottom: 0; }
.inv-ac-item.active, .inv-ac-item:active { background: var(--c-muted-bg); }
.inv-ac-item .ac-name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-ac-item .ac-meta { flex-shrink: 0; font-size: .78rem; color: var(--c-subtle); text-align: right; white-space: nowrap; }

/* ── Suggested products (Your products) ─────────────────────────────── */
.your-products-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-top: 4px; }
.your-products-table th {
  text-align: left; padding: 0 8px 8px;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--c-subtle); font-weight: 600; border-bottom: 1px solid var(--c-border);
}
.your-products-table th:last-child { text-align: right; }
.your-products-table td { padding: 10px 8px; border-bottom: 1px solid var(--c-muted-bg); vertical-align: middle; }
.your-products-table tr:last-child td { border-bottom: 0; }
.your-products-table tbody tr {
  cursor: pointer; transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.your-products-table tbody tr:active { background: var(--c-muted-bg); }
.your-products-table .yp-name { font-weight: 600; line-height: 1.3; }
.your-products-table .yp-sku { font-size: .75rem; color: var(--c-subtle); margin-top: 1px; }
.your-products-table .yp-qty { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--c-green-txt); white-space: nowrap; }
.inv-result {
  padding: 18px; background: var(--c-muted-bg);
  border-radius: var(--radius-card); margin-top: 4px;
}
.inv-result .inv-name { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.inv-result .inv-sku { font-size: .8rem; color: var(--c-subtle); margin-bottom: 12px; }
.inv-result .inv-qty-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--c-subtle); font-weight: 600; }
.inv-result .inv-qty-value { font-size: 2rem; font-weight: 800; color: var(--c-green); line-height: 1.1; }
.inv-stock-badge { display: inline-block; font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-bottom: 6px; }
/* "Stock data as of …" freshness note beneath the result card */
.inv-asof {
  font-size: .72rem; color: var(--c-subtle); margin-top: 10px;
  padding: 8px 10px; text-align: center;
  border: 1px solid var(--c-border); border-radius: var(--radius-btn);
  background: rgba(255,255,255,.45);
}
.inv-stock-badge.out { background: var(--c-red-bg); color: var(--c-red-txt); }
.inv-stock-badge.low { background: var(--c-amber-bg); color: var(--c-amber-txt); }
.inv-waitlist-wrap { margin-top: 14px; }
.inv-waitlist-btn {
  display: block; margin-top: 0; width: 100%; box-sizing: border-box;
  background: var(--c-green); color: #fff;
  font-size: .85rem; font-weight: 700;
  border: 2px solid var(--c-green); border-radius: var(--radius-btn);
  padding: 10px 16px; cursor: pointer; transition: background .15s, border-color .15s;
}
.inv-waitlist-btn.waitlisted { background: var(--c-green-bg); color: var(--c-green-txt); border-color: var(--c-green); }
.inv-waitlist-btn:disabled { opacity: .55; cursor: default; }
.inv-waitlist-error { display: none; margin-top: 8px; }
.inv-waitlist-error.visible { display: block; }
.ac-meta .inv-stock-badge { font-size: .63rem; padding: 1px 5px; margin-left: 3px; vertical-align: middle; }

/* ── Waitlist rows ───────────────────────────────────────────────────── */
.waitlist-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-top: 4px; }
.waitlist-table th {
  text-align: left; padding: 0 8px 8px;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--c-subtle); font-weight: 600; border-bottom: 1px solid var(--c-border);
}
.waitlist-table th.col-action { text-align: right; }
.waitlist-table td { padding: 10px 8px; border-bottom: 1px solid var(--c-muted-bg); vertical-align: middle; }
.waitlist-table tr:last-child td { border-bottom: 0; }
.waitlist-table .wl-name { font-weight: 600; line-height: 1.3; }
.waitlist-table .wl-sku  { font-size: .75rem; color: var(--c-subtle); margin-top: 1px; }
.waitlist-table .wl-qty  { font-variant-numeric: tabular-nums; color: var(--c-subtle); white-space: nowrap; }
.wl-remove-btn {
  min-height: 32px; padding: 4px 12px;
  background: var(--c-red-bg); color: var(--c-red-txt);
  font-size: .78rem; font-weight: 700; border-radius: var(--radius-btn);
  border: 0; cursor: pointer; white-space: nowrap;
  transition: background var(--transition), opacity var(--transition);
}
.wl-remove-btn:active:not(:disabled) { background: #f5c0bc; transform: scale(.97); }
.wl-remove-btn:disabled { opacity: .55; cursor: default; }

/* ── Spending trend chart ────────────────────────────────────────────── */
#spendingCard { display: none; }
#spendingCard.visible { display: block; }
.spending-chart-wrap {
  margin-top: 6px;
  width: 100%; overflow: visible;
  position: relative;
}
.spending-chart-wrap svg {
  display: block; width: 100%; height: auto;
}
.spending-bar { fill: var(--c-green); opacity: .85; border-radius: 3px; cursor: pointer; }
.spending-bar.current-month { fill: var(--c-green); opacity: 1; }
.spending-bar.tapped { opacity: 1; filter: brightness(1.12); stroke: var(--c-green-dk); stroke-width: 2.5; }
.spending-threshold { stroke: var(--c-amber-txt); stroke-dasharray: 4 3; stroke-width: 1.5; fill: none; }
.spending-label { font-size: 9px; fill: var(--c-subtle); font-family: inherit; }
.spending-label.current { fill: var(--c-green-txt); font-weight: 700; }
.spending-threshold-label { font-size: 8.5px; fill: var(--c-amber-txt); font-weight: 700; font-family: inherit; }
.spending-amount-label { font-size: 8px; fill: var(--c-subtle); font-family: inherit; text-anchor: middle; }

/* ── Spending bar tap tooltip ─────────────────────────────────────────── */
.spending-tooltip {
  position: absolute;
  background: #17212b;
  color: #fff;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  /* Allow wrapping so very large amounts (฿1,000,000+) don't overflow the
     card on narrow (320 px) screens. max-width is relative to the chart
     wrap, which is the nearest positioned ancestor. */
  white-space: normal;
  max-width: calc(100% - 8px);
  box-shadow: 0 3px 10px rgba(0,0,0,.28);
  /* centre horizontally on the bar, sit above it */
  transform: translate(-50%, calc(-100% - 7px));
  z-index: 20;
  pointer-events: none;
  /* hidden by default */
  opacity: 0;
  transition: opacity 130ms ease;
}
.spending-tooltip.visible { opacity: 1; }
/* Small downward caret — left is shifted by --tt-caret when the tooltip is
   clamped to stay inside the wrap (leftmost / rightmost bars on narrow screens) */
.spending-tooltip::after {
  content: '';
  position: absolute;
  bottom: -5px; left: calc(50% + var(--tt-caret, 0px));
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-width: 0;
  border-top-color: #17212b;
}

/* ── Spending bar tap hint ────────────────────────────────────────────── */
.spending-chart-hint {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  margin-top: 8px;
  color: var(--c-subtle); font-size: .76rem;
  transition: opacity 300ms ease;
  /* Prevent the hint from overflowing the card on narrow (320 px) screens */
  overflow: hidden;
}
.spending-chart-hint svg { flex-shrink: 0; opacity: .7; }
/* Allow the text node to shrink below its intrinsic width so it word-wraps
   rather than overflowing on narrow (320 px) LIFF viewports. */
.spending-chart-hint span { min-width: 0; word-break: break-word; }
.spending-chart-hint--gone { opacity: 0; pointer-events: none; }

/* ── Language toggle ─────────────────────────────────────────────────── */
.lang-bar { display: flex; justify-content: flex-end; padding: 8px 0 4px; }
.lang-toggle { display: inline-flex; border: 1px solid var(--c-border); border-radius: 999px; overflow: hidden; background: var(--c-surface); }
.lang-toggle button { border: 0; background: transparent; padding: 5px 12px; font-size: .78rem; font-weight: 600; color: var(--c-subtle); cursor: pointer; min-height: 30px; }
.lang-toggle button.active { background: var(--c-green); color: #fff; }

/* ── Document-type pill (detail panel) ───────────────────────────────── */
.doc-type-pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: .68rem; font-weight: 700; letter-spacing: .03em;
  background: var(--c-muted-bg); color: var(--c-subtle);
  margin-bottom: 3px; white-space: nowrap;
}
.doc-type-pill.quotation { background: var(--c-amber-bg); color: var(--c-amber-txt); }
.doc-type-pill.confirmed { background: var(--c-green-bg); color: var(--c-green-txt); }
.doc-type-pill.invoice   { background: var(--c-red-bg);   color: var(--c-red-txt); }
.doc-type-pill.receipt   { background: var(--c-green-bg); color: var(--c-green-txt); }
.panel-title { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.panel-title-ref { font-size: 1.05rem; font-weight: 700; color: var(--c-text); line-height: 1.3; }

/* ── Overdue due-date ────────────────────────────────────────────────── */
.overdue-date { color: var(--c-red-txt); font-weight: 700; }

/* ── Marketing consent banner ────────────────────────────────────────── */
/* Sits ABOVE the bottom nav (never over it) and, when hidden, is fully
   removed from rendering. NOTE: display:none must be set here explicitly —
   the generic `.hidden { display:none }` rule is overridden by this later,
   more specific block's `display:flex`, which previously left the "hidden"
   banner rendered at translateY(110%), i.e. parked on top of the bottom
   nav (z-index 900 vs 200) and swallowing it visually. Keep the hidden
   state as display:none. */
.consent-banner {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 8px);
  left: max(8px, calc(50% - 232px));
  right: max(8px, calc(50% - 232px));
  z-index: 250; /* above nav (200), below the detail panel overlay */
  background: #17212b;
  color: #e8eaed;
  font-size: 13px;
  padding: 14px 16px;
  border-radius: 12px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
}
.consent-banner.hidden { display: none; pointer-events: none; }
/* Privacy card consent control (state label + grant/withdraw button) */
.privacy-consent-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.privacy-consent-state { display: flex; flex-direction: column; gap: 2px; font-size: .85rem; }
.privacy-consent-state .muted { font-size: .78rem; }
.consent-banner p { margin: 0 0 6px; line-height: 1.5; }
.consent-banner a.consent-policy-link {
  color: #74b9ff; font-weight: 600; text-decoration: none; font-size: 13px;
}
.consent-banner a.consent-policy-link:active { text-decoration: underline; }
.consent-banner-btns { display: flex; gap: 8px; }
.consent-banner-btns button {
  flex: 1; border: none; border-radius: 8px; padding: 10px 14px;
  min-height: 40px;
  font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.consent-accept { background: var(--c-green); color: #fff; }
.consent-decline { background: rgba(255,255,255,.12); color: #e8eaed; }
/* Bilingual copy: both languages are in the DOM; the html-level
   lang-th / lang-en class (kept in sync by setLang) picks one. */
html.lang-th .consent-lang-en { display: none; }
html.lang-en .consent-lang-th { display: none; }

/* ── Overdue invoice summary banner ─────────────────────────────────── */
.overdue-banner {
  display: none;
  background: var(--c-red-bg);
  border: 1.5px solid #f5c6c2;
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 16px;
}
.overdue-banner.visible {
  display: block;
  animation: fadeSlideIn 240ms ease forwards;
}
.overdue-banner .ob-row1 {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.overdue-banner .ob-label {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--c-red-txt); margin-bottom: 2px;
}
.overdue-banner .ob-amount {
  font-size: 1.45rem; font-weight: 800; color: var(--c-red-txt); line-height: 1.1;
}
.overdue-banner .ob-count {
  font-size: .78rem; color: var(--c-red-txt); margin-top: 1px;
}
.overdue-banner .ob-pay-btn {
  flex-shrink: 0;
  background: var(--c-red-txt); color: #fff;
  min-height: 44px; padding: 10px 20px;
  font-size: .9rem; font-weight: 700;
  border-radius: var(--radius-btn);
  white-space: nowrap;
}
.overdue-banner .ob-pay-btn:active:not(:disabled) { background: #8e1e18; transform: scale(.97); }
.overdue-banner .ob-due-soon {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid #f5c6c2;
  font-size: .8rem; color: var(--c-amber-txt);
}
/* Brief highlight flash for the targeted overdue row */
@keyframes overdueRowFlash {
  0%, 100% { background: transparent; }
  20%, 80% { background: rgba(179,38,30,.10); }
}
.row.overdue-highlight { animation: overdueRowFlash 1.4s ease; }

/* ── Cal-inspired portal migration ─────────────────────────────────────
   The portal is a task surface inside LINE: quiet canvas, compact controls,
   and strong black actions. Keep the existing selectors/IDs above intact so
   the vanilla modules can continue to own all state and interactions. */
:root {
  --c-bg: #f4f4f2;
  --c-surface: #ffffff;
  --c-border: #dededb;
  --c-muted-bg: #efefed;
  --c-text: #171717;
  --c-subtle: #656560;
  --c-green: #246247;
  --c-green-dk: #174b36;
  --c-green-bg: #e7f0eb;
  --c-green-txt: #1d5a41;
  --c-red-bg: #fae9e7;
  --c-red-txt: #a33d35;
  --c-amber-bg: #f8efdc;
  --c-amber-txt: #805c1d;
  --radius-card: 10px;
  --radius-btn: 7px;
  --shadow-card: 0 1px 2px rgba(23,23,23,.04);
  --touch-min: 44px;
  --transition: 160ms ease;
  --nav-h: 68px;
}

html { background: var(--c-bg); }
body {
  background: var(--c-bg);
  color: var(--c-text);
  letter-spacing: -.006em;
}
.wrap {
  max-width: 520px;
  padding: 14px 16px calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 20px);
}
/* A single, unmistakable keyboard treatment across native and custom controls. */
:where(button, a, input, select, summary, [tabindex]):focus-visible {
  outline: 3px solid #5f5c56;
  outline-offset: 2px;
}

.card {
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-card);
  padding: 18px;
  margin-bottom: 12px;
}
h1 { font-size: 1.16rem; font-weight: 700; letter-spacing: -.02em; }
h2 {
  color: var(--c-text);
  font-size: .94rem;
  letter-spacing: -.01em;
}
.muted, .profile .sub { color: var(--c-subtle); }

/* Compact black controls are the primary action language. */
button {
  background: #171717;
  color: #fff;
  border: 1px solid #171717;
  border-radius: var(--radius-btn);
  font-size: .86rem;
  font-weight: 700;
  transition: background var(--transition), border-color var(--transition),
    color var(--transition), opacity var(--transition), transform 80ms ease;
}
button:active:not(:disabled) { background: #3b3b39; border-color: #3b3b39; }
button.secondary {
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  min-height: 38px;
  font-size: .78rem;
  padding: 6px 12px;
}
button.secondary:active:not(:disabled) { background: var(--c-muted-bg); }
button.link-btn, button.progress-browse {
  color: var(--c-text);
}
.account-open {
  color: var(--c-text);
  border-color: transparent;
  min-width: var(--touch-min);
  min-height: var(--touch-min);
}
.account-open-icon { color: var(--c-text); }

/* Main navigation: a small floating control rail, not a green app footer. */
#bottom-nav {
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  /* The bar is capped to the same 480px shell as .wrap. Keep its gutters
     bounded too; viewport-derived padding would squeeze these four buttons
     on tablets and desktop screens. */
  padding: 6px calc(16px + env(safe-area-inset-right, 0px))
    env(safe-area-inset-bottom, 0px) calc(16px + env(safe-area-inset-left, 0px));
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--c-border);
  box-shadow: 0 -5px 18px rgba(23,23,23,.05);
  backdrop-filter: blur(14px);
}
.nav-btn {
  min-height: 52px;
  color: var(--c-subtle);
  border: 0;
  background: transparent;
  border-radius: 8px;
  font-size: .68rem;
  font-weight: 600;
}
.nav-btn:hover, .nav-btn:active { background: var(--c-muted-bg); color: var(--c-text); }
.nav-btn.active {
  color: var(--c-text);
  background: var(--c-muted-bg);
  font-weight: 800;
}
.nav-btn.active svg { color: var(--c-text); }
.nav-btn .nav-icon { height: 21px; }
.nav-btn.restricted::after { content: ''; }

.activity-switch {
  background: #e8e8e5;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  gap: 3px;
}
.activity-switch-btn { border: 0; border-radius: 6px; color: var(--c-subtle); }
.activity-switch-btn.active {
  background: var(--c-text);
  color: var(--c-text);
  box-shadow: 0 1px 2px rgba(23,23,23,.10);
}
.activity-switch-btn.active { color: #fff; }
.tabs button.tab-btn.active {
  background: var(--c-text);
  color: #fff;
}
.inv-waitlist-btn:not(.waitlisted) {
  background: var(--c-text);
  border-color: var(--c-text);
}
.inv-waitlist-btn:not(.waitlisted):active:not(:disabled) {
  background: #3b3b39;
  border-color: #3b3b39;
}
.spending-bar, .spending-bar.current-month { fill: var(--c-text); }

/* Progress and points use the restrained semantic green only for status. */
.points .value { color: var(--c-text); }
.progress-track, .credit-bar-track { background: #dededb; }
.progress-fill, .credit-bar-fill { background: var(--c-green); }
.progress-label.redeemable, .progress-label.redeemable .reward-name { color: var(--c-green-txt); }
.tier-badge { background: var(--c-green-bg); color: var(--c-green-txt); }

input, select {
  min-height: 44px;
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid #cfcfcb;
  border-radius: var(--radius-btn);
  font: inherit;
  padding: 9px 11px;
}
input::placeholder { color: var(--c-subtle); }
.inv-search-wrap input:focus { outline: 3px solid #5f5c56; border-color: #5f5c56; }
.inv-search-wrap button { min-height: 44px; }

.badge, .coupon-badge {
  border: 1px solid transparent;
  font-size: .67rem;
  letter-spacing: .035em;
}
.badge.delivery-packed, .badge.delivery-partial {
  background: #e9e9f3; color: #4f4f78;
}
.row { border-bottom-color: var(--c-border); }
.row-msg, .msg { border: 1px solid transparent; }

.coupon-card, .redeem-item {
  background: var(--c-muted-bg);
  border: 1px solid var(--c-border);
  border-radius: 8px;
}
.redeem-item.selected {
  border-color: var(--c-text);
  background: var(--c-surface);
}
.redeem-item .redeem-cost, .your-products-table .yp-qty { color: var(--c-green-txt); }
.coupon-card .coupon-code { border-color: #bdbdb8; }

.panel-overlay { background: rgba(23,23,23,.42); }
.panel, .account-sheet-panel {
  border: 1px solid var(--c-border);
  box-shadow: 0 -12px 36px rgba(23,23,23,.16);
}
.panel-close { background: transparent; color: var(--c-text); border-color: transparent; }
.panel-handle { background: #c7c7c2; }

.consent-banner {
  background: #20201f;
  color: #f4f4f2;
  border: 1px solid #3a3a37;
  border-radius: 10px;
  box-shadow: 0 8px 26px rgba(23,23,23,.20);
}
.consent-banner a.consent-policy-link { color: #d7cfff; }
.consent-accept { background: #fff; color: #171717; }
.consent-decline { background: transparent; color: #f4f4f2; border: 1px solid #666660 !important; }

.overdue-banner { border-color: #e6beba; }
.overdue-banner .ob-pay-btn { background: #171717; }
.overdue-banner .ob-pay-btn:active:not(:disabled) { background: #3b3b39; }

@media (max-width: 380px) {
  .card { padding: 15px; }
  .wrap { padding-left: 12px; padding-right: 12px; }
  #bottom-nav {
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
  }
  .nav-btn { font-size: .64rem; }
}

/* ── Customer portal promotional banners ─────────────────────────────── */
.portal-ads-section { margin-bottom: 14px; }
.portal-ads-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 2px 8px;
}
.portal-ads-heading h2 { margin: 0; font-size: .9rem; font-weight: 700; }
.portal-ads-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  max-width: 100%;
  padding: 2px 0 8px;
}
.portal-ad {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 3 / 1;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background: var(--c-muted-bg);
  box-shadow: var(--shadow-card);
  cursor: pointer;
}
.portal-ad img { display: block; width: 100%; height: 100%; object-fit: cover; }
.portal-ad-image-error {
  width: 100%; height: 100%; padding: 12px;
  display: grid; place-items: center;
  color: var(--c-subtle); font-size: .82rem; font-weight: 600;
}
.portal-ads-error {
  padding: 12px 14px; border: 1px solid #f2c7c3; border-radius: 10px;
  color: var(--c-red-txt); background: var(--c-red-bg);
  font-size: .84rem; line-height: 1.45;
}
.portal-ad:focus-visible { outline: 3px solid var(--c-text); outline-offset: 2px; }
.portal-ad:active { transform: scale(.992); }
.portal-ad[aria-busy="true"] { opacity: .72; cursor: wait; }

/* Product-bound promotions use their own presentation and do not share
   portal-ad markup or behaviour. */
.campaign-banners-section { margin-bottom: 14px; }
.campaign-banners-viewport { overflow: hidden; }
.campaign-banners-track {
  display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 10px;
  scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.campaign-banners-track::-webkit-scrollbar { display: none; }
.campaign-banner-card {
  flex: 0 0 100%; min-width: 0; scroll-snap-align: start;
  overflow: hidden; border: 1px solid #e8bc58; border-radius: 12px;
  background: #fff9e8; box-shadow: var(--shadow-card);
}
.campaign-banner-image {
  display: block; width: 100%; aspect-ratio: 3 / 1; object-fit: cover;
  background: var(--c-muted-bg);
}
.campaign-banner-image-error {
  display: grid; place-items: center; width: 100%; aspect-ratio: 3 / 1;
  padding: 12px; color: var(--c-subtle); font-size: .82rem; text-align: center;
}
.campaign-banner-title {
  margin: 12px 14px 0; font-size: .95rem; line-height: 1.35;
  overflow-wrap: anywhere;
}
.campaign-banner-btn { width: calc(100% - 28px); margin: 10px 14px 14px; }
.campaign-banner-feedback {
  display: block; min-height: 0; margin: -6px 14px 12px;
  color: var(--c-subtle); font-size: .78rem; line-height: 1.35;
}
.campaign-banner-feedback:empty { display: none; }
.campaign-banner-feedback.error { color: var(--c-red-txt); }
.campaign-banners-controls {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px;
}
.campaign-banner-nav {
  min-width: 40px; min-height: 36px; padding: 4px 10px;
  font-size: 1.3rem; line-height: 1;
}
.campaign-banner-indicators { display: flex; align-items: center; gap: 5px; }
.campaign-banner-indicator {
  width: 7px; height: 7px; border-radius: 50%; background: #cbd2d8;
}
.campaign-banner-indicator.active { background: var(--c-green); transform: scale(1.2); }
.campaign-banner-position { min-width: 72px; color: var(--c-subtle); font-size: .75rem; text-align: center; }
.campaign-banners-error {
  padding: 12px 14px; border: 1px solid #f2c7c3; border-radius: 10px;
  color: var(--c-red-txt); background: var(--c-red-bg);
  font-size: .84rem; line-height: 1.45;
}
.campaign-banner-card:focus-within { outline: 3px solid var(--c-text); outline-offset: 2px; }
.product-promotion { margin-top: 14px; padding: 12px; border: 1px solid #e8bc58; border-radius: 10px; background: #fff9e8; }
.product-promotion-banner { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: 8px; margin-bottom: 10px; }
.product-promotion-title { font-weight: 700; }
.product-promotion-body { margin-top: 3px; font-size: .84rem; }
.product-promotion-offer { margin-top: 8px; color: #805c00; font-weight: 700; }
.product-promotion-offer span { color: var(--c-muted); font-size: .78rem; font-weight: 500; }
.product-promotion-btn { margin-top: 10px; width: 100%; }

