/* Soft neutral boutique theme */
:root {
  --bg: #f3f0eb;
  --bg-deep: #e9e4dc;
  --card: #ffffff;
  --text: #1b1a18;
  --muted: #9a948b;
  --line: #ece8e1;
  --ink: #141414;
  --gold: #b8935a;
  --gold-soft: #f3ebdf;
  --danger: #d9534f;
  --ok: #2f8f5b;
  --radius: 26px;
  --shadow: 0 8px 24px rgba(60, 45, 25, 0.07);
  --font: 'Plus Jakarta Sans', 'Kantumruy Pro', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; }
body::before { content: ''; position: fixed; inset: 0; z-index: -1; background: linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%); pointer-events: none; }
button { font-family: inherit; }
svg { width: 20px; height: 20px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 14px 18px 10px; background: linear-gradient(180deg, var(--bg) 70%, rgba(243, 240, 235, 0)); }
.brand { flex: 1; min-width: 0; }
.brand .hello { font-size: 13px; }
.brand h1 { margin: 2px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -0.2px; }
.page-title { flex: 1; text-align: center; margin: 0; font-size: 17px; font-weight: 600; }
.round-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--card); color: var(--ink); display: grid; place-items: center; box-shadow: var(--shadow); cursor: pointer; position: relative; }
.round-btn.glass { background: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); }
.round-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--ink); color: #fff; font-size: 10px; line-height: 16px; }

.view { padding: 4px 16px 120px; }

/* ---------- search + tabs ---------- */
.search { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 18px; padding: 0 16px; height: 50px; box-shadow: var(--shadow); color: var(--muted); }
label.search { flex-direction: row; font-size: 15px; }
.search svg { flex: none; }
.search input { flex: 1; border: 0; outline: 0; background: none; font: inherit; color: var(--text); height: 100%; }
.tabs { display: flex; justify-content: space-between; margin: 18px 4px 4px; border-bottom: 1px solid var(--line); }
.tab { flex: 1; background: none; border: 0; padding: 10px 0 12px; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; position: relative; }
.tab.active { color: var(--text); font-weight: 600; }
.tab.active::after { content: ''; position: absolute; left: 18%; right: 18%; bottom: -1px; height: 2.5px; border-radius: 3px; background: var(--gold); }

/* ---------- category circles ---------- */
.cats { display: flex; gap: 14px; overflow-x: auto; padding: 16px 2px 8px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cat { flex: none; display: flex; flex-direction: column; align-items: center; gap: 7px; background: none; border: 0; cursor: pointer; color: var(--text); font-size: 12.5px; width: 68px; }
.cat .ring { width: 62px; height: 62px; border-radius: 50%; padding: 3px; background: transparent; transition: background .2s; }
.cat .ring span { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: var(--gold-soft) center / cover no-repeat; font-size: 24px; border: 2px solid var(--bg); }
.cat.active .ring { background: linear-gradient(135deg, var(--gold), #e3c9a0); }
.cat.active { font-weight: 600; }

/* ---------- staggered product grid ---------- */
.masonry { columns: 2; column-gap: 12px; margin-top: 10px; }
.p-card { break-inside: avoid; margin-bottom: 12px; background: var(--card); border-radius: var(--radius); padding: 10px 10px 14px; box-shadow: var(--shadow); cursor: pointer; position: relative; animation: fade .35s ease both; }
.p-card .img { border-radius: 20px; background: var(--gold-soft) center / cover no-repeat; aspect-ratio: 1 / 1.05; display: grid; place-items: center; font-size: 54px; }
.p-card.tall .img { aspect-ratio: 1 / 1.35; }
.p-card .price { font-size: 19px; font-weight: 800; margin: 12px 4px 2px; letter-spacing: -0.3px; }
.p-card .name { margin: 0 4px; font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.p-card .meta { margin: 3px 4px 0; font-size: 11.5px; color: var(--muted); }
.p-card .fav { position: absolute; top: 18px; right: 18px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); display: grid; place-items: center; color: #c9c3ba; cursor: pointer; }
.p-card .fav svg { width: 16px; height: 16px; fill: currentColor; }
.p-card .fav.on, .fav-btn.on { color: #e0464e; }
.fav-btn svg { fill: currentColor; color: inherit; }
.fav-btn { color: #c9c3ba; }
.p-card .soldout { position: absolute; top: 18px; left: 18px; background: var(--ink); color: #fff; font-size: 11px; padding: 3px 9px; border-radius: 99px; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- product detail ---------- */
.view-product { padding: 0 0 130px; }
.hero { position: relative; height: 56vh; min-height: 340px; max-height: 520px; background: radial-gradient(circle at 50% 40%, #fbf9f6 0%, var(--bg-deep) 75%); border-radius: 0 0 36px 36px; overflow: hidden; }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-emoji { position: absolute; inset: 0; display: grid; place-items: center; font-size: 120px; }
.hero::after { content: ''; position: absolute; inset: 0 0 auto 0; height: 120px; background: linear-gradient(180deg, rgba(0,0,0,.32), transparent); pointer-events: none; }
.hero-bar { position: absolute; z-index: 2; inset: 0 0 auto 0; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; }
.hero-title { color: #fff; font-weight: 600; text-shadow: 0 1px 6px rgba(0,0,0,.25); }
.pd-body { padding: 20px 20px 0; }
.pd-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { background: var(--ink); color: #fff; font-size: 12px; padding: 6px 13px; border-radius: 99px; }
.rating { display: flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.rating svg { width: 17px; height: 17px; fill: #f2b544; }
.rating span { color: var(--muted); font-weight: 500; }
.pd-name { font-size: 23px; font-weight: 700; margin: 16px 0 6px; letter-spacing: -0.3px; }
.pd-desc { margin: 0; line-height: 1.65; font-size: 14px; }
.opt-label { margin: 18px 0 8px; font-size: 13px; font-weight: 600; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { min-width: 48px; height: 42px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer; transition: all .15s; }
.opt.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.stepper { display: inline-flex; align-items: center; gap: 16px; background: var(--card); border-radius: 99px; padding: 5px; box-shadow: var(--shadow); }
.stepper button, .mini-step button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--bg); color: var(--ink); font-size: 18px; cursor: pointer; }
.stepper span { min-width: 18px; text-align: center; font-weight: 700; }

/* ---------- bottom bar ---------- */
.bottombar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; align-items: center; gap: 14px; padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(14px); border-radius: 28px 28px 0 0; box-shadow: 0 -6px 24px rgba(60, 45, 25, 0.08); }
.price-box { display: flex; flex-direction: column; min-width: 0; }
.price-box b { font-size: 21px; font-weight: 800; letter-spacing: -0.4px; white-space: nowrap; }
.pill-btn { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 56px; padding: 0 6px 0 22px; border: 0; border-radius: 99px; background: var(--ink); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; transition: transform .1s, opacity .2s; }
.pill-btn:active { transform: scale(.98); }
.pill-btn:disabled { opacity: .55; }
.pill-icon { width: 44px; height: 44px; border-radius: 50%; background: #fff; color: var(--ink); display: grid; place-items: center; flex: none; }

/* ---------- panels: cart / checkout / orders ---------- */
.panel { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-top: 12px; }
.c-item { display: flex; gap: 12px; align-items: center; background: var(--card); border-radius: 22px; padding: 10px; margin-top: 10px; box-shadow: var(--shadow); }
.c-item .thumb { width: 78px; height: 78px; border-radius: 16px; background: var(--gold-soft) center / cover no-repeat; flex: none; display: grid; place-items: center; font-size: 30px; }
.c-item .info { flex: 1; min-width: 0; }
.c-item .info .name { font-weight: 600; font-size: 14px; }
.c-item .info .muted { font-size: 12px; margin-top: 2px; }
.c-item .info .price { font-weight: 800; margin-top: 6px; }
.c-item .side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 10px; align-self: stretch; }
.mini-step { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.mini-step button { width: 28px; height: 28px; font-size: 15px; }
.icon-del { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; }
.icon-del svg { width: 18px; height: 18px; }

.summary .line { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 14px; }
.summary .line span:first-child { color: var(--muted); }
.summary .total { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 10px; font-weight: 700; font-size: 16px; }
.summary .total span:first-child { color: var(--text); }

form.panel { display: flex; flex-direction: column; gap: 13px; }
.section-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.section-title svg { color: var(--gold); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
input, select, textarea { font: inherit; font-size: 15px; color: var(--text); background: var(--bg); border: 1.5px solid transparent; border-radius: 14px; padding: 12px 14px; outline: none; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); background: #fff; }
.search input:focus { background: none; }
.invalid { border-color: var(--danger) !important; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }
.chip-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: var(--gold-soft); color: #7a5a2b; border-radius: 14px; padding: 0 14px; min-height: 46px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip-btn svg { width: 17px; height: 17px; }
.full { width: 100%; }

.o-card { background: var(--card); border-radius: 22px; padding: 14px 16px; margin-top: 10px; box-shadow: var(--shadow); }
.o-card .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.o-card .items { font-size: 13px; margin: 8px 0; line-height: 1.6; }
.badge { font-size: 11.5px; padding: 4px 10px; border-radius: 99px; background: var(--bg); font-weight: 600; }
.badge.paid { background: #e3f4ea; color: var(--ok); }
.badge.pending { background: var(--gold-soft); color: #8a6430; }
.badge.cancelled { background: #f1eeea; color: var(--muted); }
.o-card .pay { border: 0; background: var(--ink); color: #fff; border-radius: 99px; padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; }

.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty .big { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 50%; background: var(--card); display: grid; place-items: center; box-shadow: var(--shadow); color: var(--gold); }
.empty .big svg { width: 36px; height: 36px; }

.toast { position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%); background: rgba(20, 20, 20, 0.92); color: #fff; padding: 11px 18px; border-radius: 99px; z-index: 20; font-size: 13.5px; max-width: 90%; text-align: center; }

/* ---------- KHQR payment ---------- */
.center { text-align: center; }
.pay-card { text-align: center; padding: 0 0 18px; overflow: hidden; }
.khqr-head { background: #e1232e; color: #fff; font-weight: 800; letter-spacing: 1px; padding: 12px; font-size: 17px; }
.pay-merchant { margin-top: 14px; }
.pay-amount { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; margin: 2px 0 6px; }
.qr-wrap { margin: 0 auto; width: 240px; height: 240px; border-top: 1.5px dashed var(--line); padding-top: 12px; box-sizing: content-box; }
.qr-wrap img { width: 100%; height: 100%; image-rendering: pixelated; }
.pay-status { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13.5px; font-weight: 600; color: #8a6430; background: var(--gold-soft); padding: 7px 14px; border-radius: 99px; }
.pay-status.expired { color: var(--danger); background: #fdecec; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.7); } }
.aba-btn { width: 100%; margin-top: 14px; background: #005d7c; }
.aba-btn .pill-icon { color: #005d7c; font-style: normal; font-weight: 800; }
#payTimer { margin-top: 8px; }

/* ---------- payment result page ---------- */
.result { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 10px; }
.result .big { width: 96px; height: 96px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; font-size: 44px; }
.result h2 { margin: 10px 0 0; }
.result .actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; margin-top: 14px; }
.result .pill-btn { flex: none; justify-content: center; padding: 0 22px; }
.result .ghost { height: 52px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); font-size: 15px; font-weight: 600; cursor: pointer; color: var(--text); }
.spinner { width: 44px; height: 44px; border: 4px solid var(--card); border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
