/* ── ងៀតគោពិសេ Special Beef Jerky — design system ───────────────────────
   Palette taken from the official page logo: brick-red wordmark, cream
   paper, warm gold accents. Every component reads from these tokens. */
:root {
  /* brand reds (official logo wordmark) */
  --brand: #8f2c22;
  --brand-2: #a63a2b;
  --brand-deep: #5f1b13;
  /* warm gold accents (CTA / highlights) */
  --accent: #f0a23c;
  --accent-2: #dd7c1f;
  --accent-ink: #3d2404;
  --gold: #c9973f;
  /* paper & ink */
  --bg: #fdf6ec;
  --paper: #fffdf9;
  --surface: #ffffff;
  --surface-2: #f6ecda;
  --line: #eddfc8;
  --text: #2b1d14;
  --muted: #8a7a6b;
  /* semantic */
  --ok: #1d7a46;
  --bad: #b3362a;
  --info: #1d5fbf;
  --prep: #55418f;
  /* shape & depth */
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 10px rgba(43, 29, 20, 0.06);
  --shadow: 0 6px 24px rgba(43, 29, 20, 0.09);
  /* signature gradients */
  --grad-brand: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  --grad-accent: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  --ring: 0 0 0 3px rgba(143, 44, 34, 0.18);
  --tabbar-h: 62px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Kantumruy Pro', 'Noto Sans Khmer', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background:
    radial-gradient(1200px 400px at 50% -100px, #f6e6c8 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }

img { max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 8px; }

#app {
  max-width: 540px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}

/* ── Top bar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 2px 14px rgba(74, 16, 16, 0.35);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.brand-logo {
  border-radius: 50%;
  background: #fdf6ec;
  box-shadow: 0 0 0 2px #ffffff66, 0 2px 6px rgba(0, 0, 0, 0.25);
  object-fit: cover;
}
.brand-names { display: flex; flex-direction: column; line-height: 1.25; }
.brand-names b { font-size: 16px; font-weight: 700; }
.brand-names small { font-size: 11px; opacity: 0.85; letter-spacing: 0.04em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.lang-toggle {
  border: 1px solid #ffffff55;
  background: #ffffff1a;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.lang-toggle:active { transform: scale(0.95); }
.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #ffffff1a;
  border: 1px solid #ffffff33;
  font-size: 18px;
}
.badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #3d2404;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid var(--brand);
}

/* ── Tab bar ── */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: space-around;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.tab-ico { font-size: 20px; filter: grayscale(1) opacity(0.6); }
.tabbar a.active { color: var(--brand); }
.tabbar a.active .tab-ico { filter: none; }

/* ── Common components ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 4px 14px rgba(95, 27, 19, 0.35);
}
.btn-primary:disabled { filter: grayscale(0.6) opacity(0.7); cursor: default; }
.btn-gold {
  background: var(--grad-accent);
  color: var(--accent-ink);
}
.btn-ghost {
  background: var(--paper);
  border: 1.5px solid var(--line);
  color: var(--text);
}
.btn-danger {
  background: var(--paper);
  border: 1.5px solid #f2c4bd;
  color: var(--bad);
}
.btn-sm { width: auto; padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #5a4a3c; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1.5px solid var(--line);
  background: #fffdf9;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: var(--ring);
}
.delivery-eta {
  display: block;
  margin-top: 7px;
  color: var(--info);
  font-size: 12px;
  font-weight: 600;
}
.field .err { color: var(--bad); font-size: 12px; margin-top: 4px; display: none; }
.field.invalid input, .field.invalid textarea { border-color: var(--bad); }
.field.invalid .err { display: block; }

.section-title { display: flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 800; margin: 26px 0 12px; }
/* signature: brand-red bar with a gold foot — used on every section heading */
.section-title::before {
  content: '';
  width: 5px;
  height: 20px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand) 68%, var(--accent) 68%, var(--accent) 100%);
  flex: 0 0 auto;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.st-pending_payment { background: #fdf3e0; color: #9a6a12; }
.st-expired { background: #f2eee8; color: #77695d; }
.st-archived { background: #eceff2; color: #5f6872; }
.st-paid { background: #e5f4ea; color: var(--ok); }
.st-confirmed { background: #ece9fb; color: var(--prep); }
.st-shipping { background: #e3eefd; color: var(--info); }
.st-delivered { background: #e5f4ea; color: var(--ok); }
.st-cancelled { background: #fdeae7; color: var(--bad); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1.5px solid var(--line);
  background: #fff;
  color: #5a4a3c;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ── Hero ── */
.carousel { position: relative; touch-action: pan-y; }
.carousel-viewport { width: 100%; height: 100%; overflow: hidden; }
.carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.42s cubic-bezier(0.22, 0.72, 0.24, 1);
  will-change: transform;
}
.carousel-arrow {
  position: absolute;
  z-index: 4;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 50%;
  background: rgba(43, 16, 10, 0.54);
  color: #fff;
  font: 700 26px/1 system-ui, sans-serif;
  cursor: pointer;
  backdrop-filter: blur(5px);
}
.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }
.carousel-dots {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 999px;
  background: rgba(43, 16, 10, 0.42);
}
.carousel-dots button {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.58);
  cursor: pointer;
  transition: width 0.2s ease, background 0.2s ease;
}
.carousel-dots button.active { width: 18px; border-radius: 8px; background: #fff; }
.carousel-counter {
  position: absolute;
  z-index: 4;
  top: 10px;
  right: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(43, 16, 10, 0.62);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.carousel.single .carousel-arrow,
.carousel.single .carousel-dots,
.carousel.single .carousel-counter { display: none; }

.hero {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  min-height: 240px;
  display: flex;
}
.hero-min { min-height: 250px; }
.hero-track { height: 250px; }
.hero-slide { position: relative; flex: 0 0 100%; height: 250px; }
.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero .carousel-arrow { top: 36%; }
.hero-dots { top: 11px; bottom: auto; }
.hero-cta-btn { width: auto; align-self: flex-start; padding: 11px 22px; }
.hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px;
  background: linear-gradient(180deg, rgba(43, 16, 10, 0.02) 0%, rgba(43, 16, 10, 0.42) 42%, rgba(43, 16, 10, 0.92) 100%);
  color: #fff;
}
.hero-overlay h1 { font-size: 19px; font-weight: 800; margin-bottom: 4px; text-shadow: 0 1px 8px rgba(0,0,0,0.4); }
.hero-overlay p { margin: 0 0 12px; font-size: 12.5px; opacity: 0.94; }
.hero-cta { display: flex; gap: 10px; }
.hero-cta .btn { flex: 1; padding: 11px 10px; font-size: 14px; }

/* ── Features / how-to ── */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center;
}
.feature-ico { font-size: 24px; }
.feature-card b { display: block; font-size: 12.5px; margin-top: 4px; }
.feature-card span { display: block; font-size: 11px; color: var(--muted); line-height: 1.45; margin-top: 2px; }

.steps { display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.step-num {
  flex: 0 0 30px; height: 30px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 800; font-size: 14px;
}
.step b { font-size: 14px; display: block; }
.step span { font-size: 12.5px; color: var(--muted); }

/* ── Product list (single column, order-first) ── */
.product-list { display: flex; flex-direction: column; gap: 14px; }
.product-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}
@media (hover: hover) {
  .product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
  .product-card:hover img { transform: scale(1.04); }
}
.product-media { position:relative; overflow:hidden; }
.product-card img { display: block; width: 100%; aspect-ratio: 16/10; object-fit: cover; transition: transform 0.25s ease; }
.product-badge {
  position: absolute; top: 10px; left: 10px;
  background: var(--grad-accent);
  color: #fff;
  font-size: 11px; font-weight: 800;
  padding: 4px 11px; border-radius: 999px;
  box-shadow: 0 2px 8px rgba(143, 44, 34, 0.45);
}
.product-info { padding: 12px 14px 14px; }
.product-info b { display: block; font-size: 16px; line-height: 1.4; }
.product-meta { display: flex; align-items: baseline; justify-content: space-between; margin-top: 4px; }
.price { color: var(--brand); font-weight: 800; font-size: 17px; }
.price-khr { color: var(--brand); font-weight: 800; font-size: 17px; }
.price-sep { color: var(--muted); font-weight: 400; }
.price-alt { color: #a1663d; font-weight: 600; font-size: 13px; }
.price-pricing { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.price-before { color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: line-through; }
.price-current { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 3px; }
.discount-pill { display: inline-block; padding: 2px 6px; border-radius: 999px; background: #fde7df; color: var(--brand); font-size: 10px; font-weight: 800; }
.promotion-countdown { color: #b14a24; font-size: 10.5px; font-weight: 700; }
.weight { font-size: 12px; color: var(--muted); }
.product-add {
  margin-top: 10px;
  width: 100%;
  border: 0;
  background: var(--grad-accent);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 14.5px;
  border-radius: var(--radius-sm);
  padding: 11px 0;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(221, 124, 31, 0.35);
}
.product-add:active { transform: scale(0.98); }
@media (hover: hover) { .product-add:hover { filter: brightness(1.05); } }
.product-add.unavailable, .product-add:disabled { background:#ddd4ca; color:#776e66; box-shadow:none; cursor:not-allowed; }
.stock-overlay { position:absolute; z-index:4; left:50%; top:50%; transform:translate(-50%,-50%) rotate(-8deg); width:112px; height:112px; display:grid; place-items:center; padding:10px; border-radius:50%; border:5px solid rgba(255,255,255,.92); background:rgba(123,24,20,.9); color:#fff; text-align:center; font-size:17px; font-weight:900; line-height:1.25; box-shadow:0 5px 20px rgba(40,10,7,.42); backdrop-filter:blur(2px); }
.stock-overlay-large { width:132px; height:132px; font-size:20px; }
.free-delivery-label { display:block; margin-top:7px; color:#18844c; font-weight:700; line-height:1.35; }
.offer-banner { width:100%; display:flex; align-items:center; gap:12px; margin:0 0 16px; padding:14px 16px; border:1px solid #b8e2c8; border-radius:16px; background:linear-gradient(135deg,#e9f8ef,#d8f3e3); color:#126b3f; text-align:left; box-shadow:0 5px 16px rgba(24,132,76,.14); cursor:pointer; }
.offer-banner > span { font-size:28px; }
.offer-banner div { display:flex; flex:1; flex-direction:column; gap:2px; }
.offer-banner b { font-size:15px; }
.offer-banner small { line-height:1.4; }
.offer-banner i { font-size:25px; font-style:normal; }
.stock-notice, .free-delivery-notice { display:flex; flex-direction:column; gap:2px; margin:8px 0 12px; padding:10px 12px; border-radius:12px; background:#fce9e5; color:#8f2c22; font-size:12px; }
.stock-notice.preorder, .free-delivery-notice { background:#e9f7ef; color:#187847; }
.payment-choice { display:grid; gap:9px; margin-top:15px; }
.payment-choice > label { display:flex; gap:10px; align-items:flex-start; padding:12px; border:1.5px solid var(--line); border-radius:13px; cursor:pointer; }
.payment-choice input { margin-top:4px; accent-color:var(--brand); }
.payment-choice span { display:flex; flex-direction:column; gap:2px; }
.payment-choice small { color:var(--muted); line-height:1.4; }
.deposit-summary, .cod-balance-card { margin-top:10px; padding:12px; border-radius:13px; background:#fff4dc; border:1px solid #efcf91; }
.cod-balance-card { display:flex; flex-direction:column; gap:5px; color:var(--text); }
.free-delivery-row { color:#187847; }
.simple-rule-box { margin:14px 0; padding:13px; border:1px solid var(--line); border-radius:14px; background:#fffaf1; }
.simple-rule-box h4 { margin:0 0 4px; }
.simple-rule-box p, .simple-rule-box small { display:block; color:var(--muted); font-size:11.5px; line-height:1.5; }
.simple-rule-box .compact { margin:10px 0 0; }
.order-flag { display:inline-block; margin:7px 5px 0 0; padding:5px 8px; border-radius:8px; background:#f7eee4; color:#704c31; font-size:11px; }
.order-flag.free { background:#e9f7ef; color:#187847; }
.order-flag.cod { display:block; line-height:1.5; }
.campaign-offer-fields { margin:12px 0; padding:13px; border:1px solid #b8e2c8; border-radius:14px; background:#f1fbf5; }
.campaign-offer-fields h4 { margin:0 0 5px; color:#126b3f; }
.campaign-offer-fields > p { margin:0 0 12px; color:var(--muted); font-size:12px; line-height:1.55; }
.campaign-products { max-height:180px; overflow:auto; border:1px solid var(--line); border-radius:12px; background:#fff; padding:4px 10px; }
.campaign-offer-summary { margin:8px 0; padding:8px 10px; border-radius:9px; background:#e9f8ef; color:#126b3f; font-size:12px; font-weight:700; }

.order-guide {
  padding: 14px;
  background: linear-gradient(145deg, #fffdf9, #fff7e9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.order-guide h2 { margin-bottom: 11px; font-size: 15px; color: var(--brand-deep); }
.order-journey { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.order-step {
  position: relative; min-width: 0; padding: 12px 9px 10px;
  text-align: center; border-radius: 12px; background: #fff;
  border: 1px solid #f0e2ce;
}
.step-number {
  position: absolute; top: -7px; left: -5px;
  display: grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 800; box-shadow: 0 2px 6px rgba(95, 27, 19, 0.25);
}
.step-icon { display: block; margin-bottom: 4px; font-size: 24px; }
.order-step b, .order-step small { display: block; }
.order-step b { font-size: 12.5px; color: var(--text); }
.order-step small { margin-top: 2px; color: var(--muted); font-size: 9.5px; line-height: 1.45; }

/* ── Modal ── */
.modal-root {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(30, 14, 8, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-sheet {
  width: 100%; max-width: 540px;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  animation: slide-up 0.18s ease;
}
@keyframes slide-up { from { transform: translateY(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.modal-sheet img { border-radius: 14px; }
.product-gallery { width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 14px; background: var(--surface-2); }
.product-gallery-slide { flex: 0 0 100%; width: 100%; height: 100%; }
.product-gallery-slide img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.product-dots { bottom: 9px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-close { border: 0; background: var(--surface-2); width: 32px; height: 32px; border-radius: 10px; font-size: 15px; cursor: pointer; color: var(--text); }
.stepper { display: inline-flex; align-items: center; gap: 14px; border: 1.5px solid var(--line); border-radius: 12px; padding: 6px 10px; }
.stepper button { border: 0; background: none; font-size: 18px; font-weight: 800; color: var(--brand); width: 26px; cursor: pointer; }
.stepper b { min-width: 20px; text-align: center; font-size: 15px; }

.photo-previews { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.photo-preview { position: relative; aspect-ratio: 1; border-radius: 11px; overflow: hidden; background: var(--surface-2); }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.photo-preview button {
  position: absolute; top: 4px; right: 4px;
  width: 23px; height: 23px; border: 0; border-radius: 50%;
  background: rgba(43, 16, 10, 0.72); color: #fff; cursor: pointer;
}
.photo-preview span {
  position: absolute; left: 4px; bottom: 4px;
  padding: 2px 5px; border-radius: 6px;
  background: var(--accent); color: var(--accent-ink); font-size: 8px; font-weight: 800;
}

@media (prefers-reduced-motion: reduce) {
  .carousel-track { transition: none; }
  .telegram-connect-attention { animation: none !important; }
}

/* ── Cart ── */
.cart-line { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; }
.cart-line img { width: 62px; height: 62px; border-radius: 12px; object-fit: cover; }
.cart-line .grow { flex: 1; min-width: 0; }
.cart-line b { font-size: 14px; display: block; }
.cart-line .price { font-size: 13.5px; }
.line-total { font-weight: 800; font-size: 14px; white-space: nowrap; }
.summary-card { margin-top: 14px; }
.sum-row { display: flex; justify-content: space-between; font-size: 14px; padding: 4px 0; color: #5a4a3c; }
.sum-row.total { border-top: 1.5px dashed var(--line); margin-top: 8px; padding-top: 10px; color: var(--text); font-weight: 800; font-size: 16px; }
.sum-row .free { color: var(--ok); font-weight: 700; }
.sum-hint { font-size: 11.5px; color: var(--muted); }

/* ── KHQR card (CutLuy recommended layout) ── */
.khqr-wrap { max-width: 350px; margin: 14px auto 0; }
.khqr-card { background: #fff; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.khqr-header {
  background: var(--grad-brand); color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px;
  position: relative;
}
.khqr-wordmark { font-size: 18px; font-weight: 800; letter-spacing: 0.06em; font-style: italic; }
.khqr-wordmark small { font-weight: 600; font-style: normal; font-size: 13px; opacity: 0.9; }
.khqr-amount-row { position: relative; padding: 14px 20px 12px; text-align: center; border-bottom: 2px dashed var(--line); }
.khqr-amount-row::after {
  content: ''; position: absolute; right: -1px; bottom: -14px;
  width: 0; height: 0;
  border-bottom: 27px solid var(--brand);
  border-left: 27px solid transparent;
}
.khqr-merchant { font-size: 12px; color: var(--muted); }
.khqr-amount { font-size: 26px; font-weight: 800; color: var(--text); }
.khqr-riel { font-size: 12px; color: var(--muted); }
.khqr-qr { position: relative; padding: 18px 26px 20px; }
.khqr-qr img.qr-img { display: block; width: 100%; aspect-ratio: 1; background: #fff; }
.khqr-medallion {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 62px; height: 62px; border-radius: 50%;
  background: #fff;
  border: 3px solid var(--gold);
  display: grid; place-items: center;
  font-size: 30px; font-weight: 800; color: var(--brand);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
}
.khqr-footer { padding: 10px 16px 14px; text-align: center; }
.khqr-footer .hint { font-size: 12px; color: var(--muted); }
.khqr-footer .brandline { font-size: 10.5px; color: #b9a98f; margin-top: 4px; letter-spacing: 0.05em; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--brand); }

.pay-state { text-align: center; padding: 26px 18px; }
.pay-state .big { font-size: 44px; }
.pay-state h3 { margin-top: 8px; }
.pay-state p { color: var(--muted); font-size: 13.5px; margin: 4px 0 16px; }

.demo-banner {
  background: #fdf3e0; border: 1.5px dashed var(--accent);
  color: #7a5a12; border-radius: 14px;
  padding: 10px 14px; font-size: 12.5px; margin-top: 14px;
}
.demo-banner b { display: block; font-size: 13px; }
.demo-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

/* ── Orders ── */
.order-card { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; cursor: pointer; }
.order-card .grow { flex: 1; min-width: 0; }
.order-card .oid { font-weight: 800; font-size: 14.5px; }
.order-card .odate { font-size: 11.5px; color: var(--muted); }
.order-card .oitems { font-size: 12px; color: #5a4a3c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-card .ototal { font-weight: 800; color: var(--brand); white-space: nowrap; }
.chev { color: var(--muted); font-size: 18px; }

/* ── Timeline ── */
.timeline { position: relative; margin: 14px 4px 6px; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 8px; bottom: 8px; width: 2.5px; background: var(--line); border-radius: 2px; }
.tl-step { position: relative; padding: 7px 0; }
.tl-dot {
  position: absolute; left: -26px; top: 10px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-2); border: 2.5px solid var(--line);
  display: grid; place-items: center; font-size: 10px;
}
.tl-step.done .tl-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.tl-step.done::after {
  content: '✓'; position: absolute; left: -26px; top: 10px;
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-size: 11px; font-weight: 800;
}
.tl-step.current .tl-dot { background: #fff; border-color: var(--brand); box-shadow: var(--ring); }
.tl-step b { font-size: 13.5px; }
.tl-step.done b, .tl-step.current b { color: var(--text); }
.tl-step.pending b { color: var(--muted); font-weight: 500; }

/* ── Empty states / misc ── */
.empty { text-align: center; padding: 44px 20px; }
.empty .big { font-size: 46px; }
.empty h3 { margin-top: 10px; }
.empty p { color: var(--muted); font-size: 13.5px; margin: 4px 0 18px; }
.spinner {
  width: 26px; height: 26px; margin: 40px auto;
  border: 3px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
.admin-loading {
  min-height: calc(100vh - 110px - env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
}
.admin-loading img {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gold);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.admin-loading .spinner { margin: 24px auto 12px; }
.admin-loading p { margin: 0; font-size: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600;
  z-index: 80; box-shadow: var(--shadow);
  animation: toast-in 0.2s ease;
  max-width: 88vw; text-align: center;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }

/* ── About / footer ── */
.about-card { background: linear-gradient(160deg, var(--paper), #fdf3e4); }
.fb-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #1877f2; color: #fff; font-weight: 700;
  border-radius: var(--radius-sm); padding: 11px; margin-top: 10px; font-size: 14px;
}
.about-logo {
  display: block;
  width: 92px; height: 92px;
  margin: 0 auto 10px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--gold), var(--shadow-sm);
}footer.page-footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 30px; }

/* ── Admin dashboard ── */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { padding: 12px 14px; }
.kpi-label { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.kpi-value { display: block; font-size: 22px; font-weight: 800; color: var(--brand); line-height: 1.35; }
.kpi-sub { display: block; font-size: 11px; color: var(--muted); }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status-cell { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.admin-order { margin-bottom: 10px; padding: 12px 14px; }
.admin-order-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-order .btn-sm { flex: 0 0 auto; }
.admin-order-clickable { cursor: pointer; transition: border-color 0.15s ease, transform 0.15s ease; }
.admin-order-clickable:active { transform: scale(0.992); }
.admin-order-clickable:focus-visible { outline: 3px solid rgba(37, 130, 196, 0.25); border-color: var(--info); }
.order-open-hint { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10.5px; font-weight: 700; }
.order-open-hint span { color: var(--brand); font-size: 18px; line-height: 10px; }
.order-detail-sheet { max-height: 90vh; overflow-y: auto; }
.order-detail-sheet .modal-head small, .order-detail-sheet .modal-head b { display: block; }
.order-detail-sheet .modal-head small { color: var(--muted); font-size: 10px; }
.order-detail-id { color: var(--brand); font-size: 18px; }
.order-detail-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; color: var(--muted); font-size: 11px; }
.order-detail-section { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.order-detail-section h4 { margin: 0 0 8px; color: var(--brand-deep); font-size: 12.5px; }
.order-detail-row, .order-detail-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid #f4eadb; font-size: 12px; }
.order-detail-section h4 + .order-detail-row, .order-detail-section h4 + .order-detail-item { border-top: 0; }
.order-detail-row > span { color: var(--muted); }
.order-detail-row > b, .order-detail-row > a { max-width: 64%; text-align: right; overflow-wrap: anywhere; }
.order-detail-row.stacked { display: block; }
.order-detail-row.stacked > span, .order-detail-row.stacked > b { display: block; max-width: none; text-align: left; }
.order-detail-row.stacked > b { margin-top: 3px; }
.order-detail-row.total { margin-top: 4px; color: var(--brand); font-size: 14px; font-weight: 800; }
.order-detail-item small { color: var(--prep); }
.order-copy-btn { margin-top: 12px; }
.prod-hidden { opacity: 0.62; }
.product-admin-facts { display: flex; flex-wrap: wrap; gap: 5px 14px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; }
.product-admin-facts b { color: var(--text); }
.checkline { display: flex; align-items: center; gap: 9px; margin: 8px 0 14px; font-size: 13px; font-weight: 700; }
.checkline input { width: 20px; height: 20px; accent-color: var(--brand); }
.action-needed { display: flex; align-items: center; gap: 11px; width: 100%; margin: 12px 0; padding: 12px 14px; border-radius: 15px; border: 1px solid #f0d09e; background: #fff8e9; color: var(--text); text-align: left; font: inherit; }
.action-needed.needs-action { border-color: #efb45e; box-shadow: 0 4px 14px rgba(196, 116, 24, 0.13); cursor: pointer; }
.action-needed.all-clear { border-color: #cce8d7; background: #edf8f2; }
.action-needed > span { font-size: 22px; }
.action-needed > div { flex: 1; min-width: 0; }
.action-needed b, .action-needed small { display: block; }
.action-needed b { font-size: 13.5px; }
.action-needed small { color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.action-needed i { font-size: 22px; font-style: normal; }

/* ── Sales ledger (admin) ── */
.ledger-day-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  background: #faf3e7;
  border-bottom: 1px solid #f0e4cd;
  border-radius: 14px 14px 0 0;
  font-size: 13px;
}
.ledger-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #f6eee0;
}
.ledger-row:last-child { border-bottom: 0; }
.ledger-row.is-expense .lr-items { color: #a1663d; }
.lr-info { flex: 1; min-width: 0; }
.lr-items { font-size: 13px; font-weight: 600; }
.lr-meta { font-size: 11px; color: var(--muted); margin-top: 1px; }
.excel-tag {
  background: #eef3e6; color: #5a7a3a;
  font-size: 10px; font-weight: 800;
  padding: 1px 6px; border-radius: 999px;
}
.lr-money { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; white-space: nowrap; }
.lr-sales { color: #1e7c43; font-size: 11.5px; font-weight: 700; }
.lr-cost { color: #c0392b; font-size: 11px; }
.lr-profit { font-size: 13.5px; }
.pos { color: #1e7c43; }
.neg { color: #c0392b; }
.lr-act { display: flex; flex-direction: column; gap: 4px; }
.ledger-total {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; font-weight: 800; font-size: 13.5px;
  border: 1.5px dashed var(--line);
  background: #fdfaf4;
}
.ledger-total .lt-nums { display: flex; gap: 10px; align-items: baseline; font-size: 12.5px; }
.ledger-line {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 1fr 1fr auto;
  gap: 6px; margin-bottom: 6px; align-items: center;
}
.ledger-line select,
.ledger-line input {
  border: 1.5px solid var(--line); border-radius: 9px;
  padding: 8px 6px; font-family: inherit; font-size: 12.5px;
  min-width: 0; background: #fff;
}
.ledger-totals {
  display: flex; gap: 12px; flex-wrap: wrap;
  background: #faf3e7; border-radius: 12px;
  padding: 9px 12px; font-size: 12.5px; margin: 4px 0 12px;
}
.ledger-totals b { margin-left: 4px; }
.biz-split { padding: 11px 13px; background: #fffaf1; }
.biz-split b { font-size: 13px; }
.biz-split-row {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin-top: 6px; font-size: 12.5px; color: #6b5b4a;
}
@media (max-width: 420px) {
  .ledger-line { grid-template-columns: 1.3fr 0.7fr 1fr 1fr auto; }
}

/* `hidden` must always win over display rules (e.g. .tabbar { display:flex }) */
[hidden] { display: none !important; }
.kpi-khr { display: block; font-size: 11.5px; color: #a1663d; font-weight: 700; margin-top: 1px; }

/* ── Telegram connection + progressive catalog ── */
.telegram-connect {
  display: flex; align-items: center; gap: 11px;
  margin: 0 0 16px; padding: 11px 13px;
  border-radius: 14px; color: #fff;
  background: linear-gradient(135deg, #2481cc, #176aa8);
  box-shadow: 0 4px 14px rgba(23, 106, 168, 0.22);
}
.telegram-connect > span { font-size: 20px; }
.telegram-connect > div { flex: 1; min-width: 0; }
.telegram-connect b, .telegram-connect small { display: block; }
.telegram-connect b { font-size: 13.5px; }
.telegram-connect small { font-size: 11px; opacity: 0.88; line-height: 1.45; }
.telegram-connect i { font-style: normal; font-size: 24px; }
.telegram-connect.connected { background: #edf8f2; color: var(--ok); box-shadow: none; border: 1px solid #cce8d7; }
.telegram-connect-attention { animation: telegram-attention 2.8s ease-in-out infinite; }
.wholesale-banner { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; padding: 11px 13px; border: 1px solid #efd18c; border-radius: 14px; background: #fff7df; color: #704b09; }
.wholesale-banner b, .wholesale-banner small { display: block; }
.wholesale-banner b { font-size: 13px; }
.wholesale-banner small { margin-top: 2px; font-size: 10.5px; opacity: .8; }
@keyframes telegram-attention {
  0%, 68%, 100% { transform: translateY(0) scale(1); box-shadow: 0 4px 14px rgba(23, 106, 168, 0.22); }
  76% { transform: translateY(-2px) scale(1.015); box-shadow: 0 8px 24px rgba(36, 129, 204, 0.4); }
  84% { transform: translateY(0) scale(1); }
  91% { transform: translateY(-1px) scale(1.008); }
}
.product-skeletons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.product-skeletons span {
  display: block; height: 260px; border-radius: var(--radius-lg);
  background: linear-gradient(100deg, #f2e8d9 20%, #fff8ed 38%, #f2e8d9 56%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer { to { background-position-x: -200%; } }
.catalog-loader { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 58px; color: var(--muted); font-size: 12px; }
.spinner.spinner-sm { width: 18px; height: 18px; margin: 0; border-width: 2px; }

/* ── Campaigns, admin roles and management IA ── */
.role-pill { white-space: nowrap; font-size: 10.5px; font-weight: 800; padding: 4px 8px; border-radius: 999px; color: var(--brand); background: #f8e9de; }
.auth-note { max-width: 340px; margin: 0 auto 14px; padding: 10px 12px; border-radius: 12px; background: #edf5ff; color: #255986; font-size: 12px; }
.btn.btn-telegram { max-width: 340px; margin: 0 auto; color: #fff; background: linear-gradient(135deg, #2481cc, #176aa8); }
.admin-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 16px 0 12px; }
.admin-section-head h3, .admin-section-head p { margin: 0; }
.btn.btn-compact { width: auto; flex: 0 0 auto; padding: 9px 12px; font-size: 12px; }
.audience-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; }
.audience-grid > div { padding: 10px; text-align: center; border-radius: 12px; background: var(--surface-2); }
.audience-grid b, .audience-grid span { display: block; }
.audience-grid b { color: var(--brand); font-size: 20px; }
.audience-grid span { color: var(--muted); font-size: 10.5px; }
.campaign-card { margin-bottom: 10px; }
.campaign-card p { white-space: pre-wrap; margin: 8px 0; font-size: 13px; }
.campaign-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.campaign-status { border-radius: 999px; padding: 3px 8px; font-size: 10px; font-weight: 800; background: var(--surface-2); }
.campaign-status.st-sent { background: #e6f6ec; color: var(--ok); }
.campaign-status.st-sending { background: #edf5ff; color: var(--info); }
.campaign-meta { display: flex; flex-wrap: wrap; gap: 5px 12px; margin: 8px 0; color: var(--muted); font-size: 11px; }
.campaign-form { max-height: 92vh; overflow-y: auto; }
.campaign-preview { margin: 8px 0 14px; padding: 14px; border-radius: 15px; background: #172433; color: #fff; }
.campaign-preview small, .campaign-preview b, .campaign-preview p, .campaign-preview span { display: block; }
.campaign-preview small { color: #91a9bd; margin-bottom: 8px; }
.campaign-preview p { white-space: pre-wrap; font-size: 13px; }
.campaign-preview span { width: 100%; padding: 8px; text-align: center; border-radius: 9px; background: #263a4c; font-size: 12px; font-weight: 700; }
.management-list { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
.management-list button, .management-list a {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--text); text-align: left; font: inherit;
}
.management-list span { font-size: 22px; }
.management-list b { flex: 1; }
.management-list i { color: var(--muted); font-size: 22px; font-style: normal; }
.team-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.team-row { display: flex; align-items: center; gap: 10px; padding: 11px; }
.team-avatar { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 50%; background: var(--surface-2); color: var(--brand); font-weight: 800; }
.team-row .grow { flex: 1; min-width: 0; }
.team-row .grow b, .team-row .grow span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-row .grow b { font-size: 13px; }
.team-row .grow span { color: var(--muted); font-size: 10.5px; }
.team-actions { display: flex; align-items: flex-end; flex-direction: column; gap: 5px; }
.team-badges { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px; }
.tier-pill { white-space: nowrap; font-size: 10.5px; font-weight: 800; padding: 4px 8px; border-radius: 999px; color: #82500b; background: #fff1c9; }
.access-person { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 11px; border-radius: 13px; background: var(--surface-2); }
.access-person b, .access-person span { display: block; }
.access-person span { color: var(--muted); font-size: 11px; }
.safety-note { margin: 4px 0 14px; padding: 10px 12px; border-radius: 12px; background: #fff7e6; color: #77531c; font-size: 11.5px; line-height: 1.45; }
.reach-dot { color: var(--muted); }
.reach-dot.online { color: var(--ok); }
.empty.compact { padding: 24px; }

@media (max-width: 600px) {
  .tabbar-admin a { font-size: 10px; }
  .tabbar-admin .tab-ico { font-size: 18px; }
  .product-skeletons { grid-template-columns: 1fr; }
  .order-journey { display: flex; flex-direction: column; }
  .order-step { display: flex; align-items: center; gap: 10px; padding: 10px 12px; text-align: left; }
  .step-number { position: static; flex: 0 0 24px; width: 24px; height: 24px; }
  .step-icon { flex: 0 0 28px; margin: 0; font-size: 22px; }
  .order-step b { font-size: 13px; }
  .order-step small { font-size: 10.5px; }
}
