:root {
  --bg: #F5F4EF; --card: #FFFFFF; --ink: #1F2A27; --muted: #6B7470; --line: #E4E2DA;
  --brand: #2F5D50; --brand-2: #3F7A69; --brand-soft: #E5EFEA; --gold: #C9A227; --gold-soft: #FBF3DA;
  --ok: #1E7A4F; --ok-soft: #E3F3EA; --bad: #B3412F; --bad-soft: #FBE8E4; --warn: #B7791F; --warn-soft: #FDF1DC;
  --radius: 14px; --shadow: 0 1px 2px rgba(31,42,39,.06), 0 4px 14px rgba(31,42,39,.05);
  --font: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; -webkit-text-size-adjust: 100% }
body { padding-bottom: calc(76px + env(safe-area-inset-bottom)) }
button, input, select, textarea { font: inherit; color: inherit }
a { color: var(--brand) }
img { max-width: 100% }
.boot { padding: 40vh 0; text-align: center; color: var(--muted) }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px }
.num { font-variant-numeric: tabular-nums; white-space: nowrap }
.muted { color: var(--muted) } .small { font-size: 13px } .tiny { font-size: 12px } .b { font-weight: 600 }
.ok { color: var(--ok) } .bad { color: var(--bad) } .warn { color: var(--warn) }
.hide { display: none !important }
.row { display: flex; align-items: center; gap: 10px } .between { justify-content: space-between } .grow { flex: 1; min-width: 0 } .wrapt { flex-wrap: wrap }
.stack > * + * { margin-top: 12px }
h1, h2, h3 { margin: 0; line-height: 1.3 } h2 { font-size: 18px } h3 { font-size: 16px }
.serif { font-family: "Playfair Display", Georgia, serif }

/* Thanh trên */
.top { position: sticky; top: 0; z-index: 6; background: rgba(245,244,239,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line) }
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 58px }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--brand); font-weight: 700 }
.logo img { width: 32px; height: 32px; border-radius: 50% }
.logo small { display: block; font-weight: 500; font-size: 11px; color: var(--muted) }
.search { flex: 1; display: flex; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; align-items: center }
.search input { border: 0; outline: 0; background: none; padding: 9px 6px; width: 100%; min-width: 0 }

/* Thanh tab dưới */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 7; background: #fff; border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom) }
.tabs a { flex: 1; text-align: center; padding: 8px 0 7px; font-size: 11.5px; color: var(--muted); text-decoration: none; position: relative }
.tabs a .i { display: block; font-size: 21px; line-height: 1.2 }
.tabs a.on { color: var(--brand); font-weight: 600 }
.badge { position: absolute; top: 3px; left: calc(50% + 6px); background: var(--bad); color: #fff; border-radius: 999px; font-size: 10px; padding: 1px 6px; font-weight: 700 }

/* Khối */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px }
.card.flat { box-shadow: none; border: 1px solid var(--line) }
.sec { margin: 18px 0 }
.sec-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--brand-soft); color: var(--brand) }
.pill.gold { background: var(--gold-soft); color: #8a6d0f } .pill.bad { background: var(--bad-soft); color: var(--bad) } .pill.warn { background: var(--warn-soft); color: var(--warn) } .pill.ok { background: var(--ok-soft); color: var(--ok) } .pill.grey { background: #eee; color: #555 }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none }
.chips::-webkit-scrollbar { display: none }
.chip { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 13.5px; white-space: nowrap }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand) }

/* Nút & ô nhập */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 11px 18px; font-weight: 600; cursor: pointer; background: var(--brand); color: #fff; text-decoration: none; min-height: 44px }
.btn:disabled { opacity: .5; cursor: default }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--line) }
.btn.gold { background: var(--gold); color: #fff }
.btn.danger { background: #fff; color: var(--bad); border: 1px solid #efcfc8 }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 13.5px; border-radius: 10px }
.btn.block { width: 100% }
label.f { display: block; margin-bottom: 12px }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 500 }
input.i, select.i, textarea.i { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; outline: 0; min-height: 44px }
input.i:focus, select.i:focus, textarea.i:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-soft) }
textarea.i { min-height: 90px; resize: vertical }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px }
.radio-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; margin-bottom: 8px; background: #fff }
.radio-card.on { border-color: var(--brand); background: var(--brand-soft) }

/* Lưới sản phẩm */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)) } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)) } }
.pcard { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: flex; flex-direction: column }
.pimg { aspect-ratio: 1; background: var(--brand-soft) center/cover no-repeat; display: flex; align-items: center; justify-content: center; font-size: 42px; position: relative }
.pimg .tag { position: absolute; left: 6px; top: 6px; background: var(--gold); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 6px; font-weight: 700 }
.pbody { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 4px; flex: 1 }
.pname { font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px }
.price { color: var(--bad); font-weight: 700 }
.old { color: var(--muted); text-decoration: line-through; font-size: 12px; margin-left: 4px; font-weight: 400 }

/* Hero */
.hero { background: linear-gradient(135deg, var(--brand) 0%, #4C8A73 100%); color: #fff; border-radius: 18px; padding: 20px; margin-top: 14px }
.hero h1 { font-size: 21px } .hero p { margin: 6px 0 0; opacity: .92; font-size: 14px }
.trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px }
.trust div { background: rgba(255,255,255,.14); border-radius: 10px; padding: 8px; font-size: 12px; text-align: center }

/* Chi tiết */
.detail-img { aspect-ratio: 1; border-radius: 16px; background: var(--brand-soft) center/cover no-repeat; display: flex; align-items: center; justify-content: center; font-size: 90px }
@media (min-width: 760px) { .detail { display: grid; grid-template-columns: 1fr 1fr; gap: 24px } }
.buybar { position: fixed; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); padding: 10px 16px; display: flex; gap: 10px; z-index: 6 }
.qty { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden }
.qty button { border: 0; background: #fff; width: 36px; height: 36px; cursor: pointer; font-size: 18px }
.qty input { width: 44px; text-align: center; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line) }
.info-block { white-space: pre-line; line-height: 1.6 }

/* Danh sách */
.list > * { border-bottom: 1px solid var(--line); padding: 12px 0 }
.list > *:last-child { border-bottom: 0 }
.thumb { width: 56px; height: 56px; border-radius: 10px; background: var(--brand-soft) center/cover no-repeat; flex: none; display: flex; align-items: center; justify-content: center; font-size: 24px }

/* Số liệu */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, minmax(0,1fr)) } }
.stat { background: #fff; border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow) }
.stat .l { font-size: 12.5px; color: var(--muted) } .stat .v { font-size: 19px; font-weight: 700; margin-top: 3px }
.stat.hl { background: var(--brand); color: #fff } .stat.hl .l { color: rgba(255,255,255,.8) }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden } .bar > i { display: block; height: 100%; background: var(--gold); border-radius: 99px }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 6px; border-bottom: 1px solid var(--line) }
table.t td { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top }
table.t td.r, table.t th.r { text-align: right }
.scroll-x { overflow-x: auto }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px }
.chart > div { flex: 1; background: var(--brand-2); border-radius: 4px 4px 0 0; min-height: 2px; position: relative }

/* Bảng trượt, thông báo */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(20,28,25,.45); display: flex; align-items: flex-end; justify-content: center }
.sheet[hidden] { display: none }
.sheet .box { background: var(--bg); width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)) }
@media (min-width: 700px) { .sheet { align-items: center } .sheet .box { border-radius: 18px } }
.sheet .x { float: right; border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1 }
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 30; max-width: 90vw; font-size: 14px; text-align: center }
.toast.err { background: var(--bad) }
.empty { text-align: center; padding: 40px 16px; color: var(--muted) }
.empty .e { font-size: 44px }
.note { background: var(--gold-soft); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; line-height: 1.55 }
.note.green { background: var(--brand-soft) }
.copybox { display: flex; gap: 8px; align-items: center; background: #fff; border: 1px dashed var(--brand-2); border-radius: 10px; padding: 8px 10px; font-size: 13px; word-break: break-all }
.steps { display: flex; gap: 4px; margin: 10px 0 } .steps i { flex: 1; height: 4px; background: var(--line); border-radius: 99px } .steps i.on { background: var(--ok) }
.auth { max-width: 420px; margin: 6vh auto; padding: 0 16px }
.auth .brand { text-align: center; margin-bottom: 18px } .auth .brand img { width: 64px; border-radius: 50% }
.seg { display: flex; background: #e9e7df; border-radius: 12px; padding: 3px; margin-bottom: 16px } .seg button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--muted) } .seg button.on { background: #fff; color: var(--brand); box-shadow: var(--shadow) }
