:root {
  --brand: #2f9e44; --brand-d: #1f7a33; --brand-dd: #14532d; --lime: #8dc63f; --brand-50: #eef8ea; --brand-100: #dcf0d3;
  --ink: #1f2937; --muted: #6b7280; --line: #e5e7eb; --bg: #f6f8f5; --card: #fff;
  --warn: #b45309; --warn-bg: #fef3c7; --danger: #dc2626; --danger-bg: #fee2e2; --info: #1d4ed8; --info-bg: #dbeafe;
  --r: 14px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand-d); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 28px; } h2 { font-size: 22px; } h3 { font-size: 17px; }
p { margin: 0 0 .8em; }
.container { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .g2 { grid-template-columns: minmax(0, 1fr); } h1 { font-size: 23px; } }

/* Header */
.topbar { background: var(--brand-dd); color: #e6f4ea; font-size: 13px; }
.topbar .container { display: flex; justify-content: space-between; gap: 12px; padding-top: 6px; padding-bottom: 6px; }
@media (max-width: 600px) { .topbar .container span:last-child { display: none; } }
.topbar a { color: #fff; }
header.site { background: #fff; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; box-shadow: 0 1px 0 var(--line); }
header.site .container { display: flex; align-items: center; gap: 18px; height: 66px; }
.logo img { height: 44px; width: auto; }
nav.main { display: flex; gap: 4px; flex: 1; }
nav.main a { color: var(--ink); padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: 14.5px; }
nav.main a:hover, nav.main a.active { background: var(--brand-50); color: var(--brand-d); text-decoration: none; }
.hdr-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; color: var(--ink); font-weight: 600; font-size: 14px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.icon-btn:hover { border-color: var(--brand); text-decoration: none; }
.icon-btn svg { width: 20px; height: 20px; }
.badge-count { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 6px; font-weight: 700; }
.subnav { display: none; }
@media (max-width: 860px) {
  nav.main { display: none; }
  .subnav { display: flex; gap: 6px; overflow-x: auto; padding: 8px 16px; background: #fff; border-top: 1px solid var(--line); }
  .subnav a { white-space: nowrap; padding: 6px 12px; border-radius: 99px; background: var(--brand-50); color: var(--brand-d); font-weight: 600; font-size: 13px; }
  .hdr-actions .lbl { display: none; }
  header.site .container { gap: 10px; }
  .logo { flex: 1; } .logo img { height: 38px; }
}

/* Buttons & form */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 11px; border: 1px solid transparent; font-weight: 700; font-size: 15px; cursor: pointer; font-family: inherit; text-decoration: none !important; transition: .15s; }
.btn-primary { background: var(--brand); color: #fff; } .btn-primary:hover { background: var(--brand-d); }
.btn-lime { background: var(--lime); color: var(--brand-dd); } .btn-lime:hover { filter: brightness(.95); }
.btn-outline { background: #fff; color: var(--brand-d); border-color: var(--brand); } .btn-outline:hover { background: var(--brand-50); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); } .btn-ghost:hover { background: #f3f4f6; }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; } .btn-danger:hover { background: var(--danger-bg); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
label.f { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 5px; color: #374151; }
.input, select.input, textarea.input { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 10px; font-size: 15px; font-family: inherit; background: #fff; color: var(--ink); }
.input:focus { outline: 2px solid var(--brand-100); border-color: var(--brand); }
textarea.input { min-height: 80px; resize: vertical; }
.field { margin-bottom: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--brand); }

/* Card & chips */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card h3 { margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: #f3f4f6; color: #374151; white-space: nowrap; }
.chip.green { background: var(--brand-50); color: var(--brand-d); } .chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.red { background: var(--danger-bg); color: var(--danger); } .chip.blue { background: var(--info-bg); color: var(--info); }
.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; }
.alert.info { background: var(--info-bg); color: #1e3a8a; } .alert.warn { background: var(--warn-bg); color: #78350f; }
.alert.ok { background: var(--brand-50); color: var(--brand-dd); } .alert.err { background: var(--danger-bg); color: #7f1d1d; }

/* Hero */
.ref-banner { background: linear-gradient(90deg, var(--lime), #b7e07a); color: var(--brand-dd); font-weight: 600; font-size: 14px; }
.ref-banner .container { padding-top: 8px; padding-bottom: 8px; }
.hero { background: radial-gradient(1200px 400px at 85% 0%, #c8eab4 0%, transparent 60%), linear-gradient(135deg, #f2faee 0%, #e2f3d8 100%); }
.hero .container { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: center; padding-top: 44px; padding-bottom: 44px; }
.hero h1 { font-size: 40px; color: var(--brand-dd); letter-spacing: -.5px; }
.hero .tag { display: inline-block; background: #fff; color: var(--brand-d); padding: 5px 12px; border-radius: 99px; font-weight: 700; font-size: 13px; margin-bottom: 14px; box-shadow: var(--shadow); }
.hero p.lead { font-size: 17px; color: #374151; max-width: 520px; }
.hero-imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hero-imgs img { border-radius: 20px; box-shadow: 0 20px 40px rgba(31, 122, 51, .18); background: #fff; }
.hero-imgs img:nth-child(2) { margin-top: 40px; }
@media (max-width: 860px) { .hero .container { grid-template-columns: 1fr; padding-top: 28px; padding-bottom: 28px; } .hero h1 { font-size: 30px; } }
.usp { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: -26px; position: relative; }
.usp .card { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
.usp .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-d); font-size: 20px; flex: none; }
.usp b { display: block; font-size: 14.5px; } .usp span { font-size: 12.5px; color: var(--muted); }
@media (max-width: 860px) { .usp { grid-template-columns: 1fr 1fr; margin-top: 16px; } }
section.blk { padding: 36px 0; }
.sec-title { display: flex; justify-content: space-between; align-items: end; margin-bottom: 16px; gap: 12px; }
.sec-title h2 { margin: 0; }

/* Product */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.pcard { background: #fff; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .15s; }
.pcard:hover { transform: translateY(-2px); }
.pcard .img { aspect-ratio: 1; background: var(--brand-50); }
.pcard .img img { width: 100%; height: 100%; object-fit: cover; }
.pcard .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pcard .name { font-weight: 700; font-size: 16px; color: var(--ink); }
.price { font-weight: 800; color: var(--brand-d); font-size: 20px; }
.cb-note { font-size: 12.5px; color: var(--warn); background: var(--warn-bg); padding: 3px 8px; border-radius: 8px; display: inline-block; font-weight: 600; }
.pdetail { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.pdetail .img { border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); background: #fff; }
@media (max-width: 760px) { .pdetail { grid-template-columns: 1fr; gap: 18px; } }
.qty { display: inline-flex; border: 1px solid #d1d5db; border-radius: 11px; overflow: hidden; }
.qty button { width: 40px; border: 0; background: #f9fafb; font-size: 18px; cursor: pointer; }
.qty input { width: 54px; border: 0; text-align: center; font-size: 16px; font-weight: 700; font-family: inherit; }
ul.desc { padding-left: 18px; margin: 0; } ul.desc li { margin-bottom: 6px; }

/* Opportunity */
.opp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.opp .card { border-top: 5px solid var(--brand); display: flex; flex-direction: column; }
.opp .card.mid { border-top-color: var(--lime); } .opp .card.top { border-top-color: var(--brand-dd); }
.opp .big { font-size: 26px; font-weight: 800; color: var(--brand-d); }
.opp ul { padding-left: 18px; margin: 8px 0 14px; flex: 1; } .opp li { margin-bottom: 5px; font-size: 14px; }
@media (max-width: 860px) { .opp { grid-template-columns: 1fr; } }
.store-teaser { background: linear-gradient(120deg, var(--brand-dd), var(--brand)); color: #fff; border-radius: 22px; padding: 28px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: center; }
.store-teaser h2 { color: #fff; } .store-teaser p { color: #dcfce7; }
@media (max-width: 760px) { .store-teaser { grid-template-columns: 1fr; } }

/* Footer */
footer.site { background: #0f2d1a; color: #c7d7cc; margin-top: 40px; padding: 32px 0 20px; font-size: 14px; }
footer.site a { color: #e5f5ea; }
footer.site .grid { grid-template-columns: 1.4fr 1fr 1fr; }
footer.site img { height: 46px; background: #fff; border-radius: 10px; padding: 4px 8px; margin-bottom: 10px; }
@media (max-width: 760px) { footer.site .grid { grid-template-columns: 1fr; } }

/* Page */
main { min-height: 60vh; }
.page { padding: 26px 0 40px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.auth-box { max-width: 460px; margin: 0 auto; }
.summary-line { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14.5px; }
.summary-line.total { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 12px; font-weight: 800; font-size: 18px; }
.pay-opt { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; margin-bottom: 8px; background: #fff; }
.pay-opt.on { border-color: var(--brand); background: var(--brand-50); }
.pay-opt input { accent-color: var(--brand); }
.cart-row { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-row img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.steps span { padding: 4px 10px; border-radius: 99px; background: #f3f4f6; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.steps span.on { background: var(--brand); color: #fff; }
.qr-box { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: center; }
.qr-box img { width: 220px; border-radius: 12px; border: 1px solid var(--line); }
@media (max-width: 600px) { .qr-box { grid-template-columns: 1fr; } .qr-box img { margin: 0 auto; } }

/* Dashboard */
.dash { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 20px; align-items: start; }
#dbody { min-width: 0; }
.side { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 10px; position: sticky; top: 82px; }
.side .who { padding: 10px 10px 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.side .who b { display: block; }
.side a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; color: var(--ink); font-weight: 600; font-size: 14px; }
.side a:hover { background: #f3f4f6; text-decoration: none; }
.side a.on { background: var(--brand-50); color: var(--brand-d); }
.side a .n { margin-left: auto; background: var(--danger); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; }
@media (max-width: 900px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; display: flex; overflow-x: auto; gap: 4px; padding: 6px; }
  .side .who { display: none; }
  .side a { white-space: nowrap; }
}
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px; }
.kpi .l { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 22px; font-weight: 800; margin-top: 2px; letter-spacing: -.3px; }
.kpi .d { font-size: 12.5px; margin-top: 2px; }
.kpi.hl { background: linear-gradient(135deg, var(--brand-d), var(--brand)); color: #fff; } .kpi.hl .l, .kpi.hl .d { color: #dcfce7; } .kpi.hl .up, .kpi.hl .down, .kpi.hl a { color: #fff; font-weight: 700; }
.up { color: #15803d; } .down { color: var(--danger); }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi .v { font-size: 18px; } }
.range { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: #fff; border-radius: 12px; padding: 8px 10px; box-shadow: var(--shadow); margin-bottom: 16px; }
.range input { padding: 7px 9px; border: 1px solid #d1d5db; border-radius: 9px; font-family: inherit; font-size: 14px; }
.range .presets { display: flex; gap: 4px; flex-wrap: wrap; }
.range .presets button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
.range .presets button.on, .range .presets button:hover { border-color: var(--brand); color: var(--brand-d); background: var(--brand-50); }
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--r); box-shadow: var(--shadow); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); background: #f9fafb; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
table.t td:first-child { min-width: 130px; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #f9fbf8; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* Chart */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 190px; padding: 10px 4px 0; border-bottom: 1px solid var(--line); }
.bars .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; position: relative; min-width: 0; }
.bars .seg { border-radius: 4px 4px 0 0; min-height: 0; }
.bars .seg + .seg { border-radius: 0; }
.bars .val { font-size: 10.5px; text-align: center; color: var(--muted); margin-bottom: 3px; white-space: nowrap; overflow: hidden; }
.bar-labels { display: flex; gap: 6px; padding: 6px 4px 0; }
.bar-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); min-width: 0; overflow: hidden; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.hbar { display: grid; grid-template-columns: 170px 1fr 110px; gap: 10px; align-items: center; font-size: 13.5px; margin-bottom: 8px; }
.hbar > * { min-width: 0; }
.hbar .track { background: #f1f5f9; border-radius: 99px; height: 10px; overflow: hidden; }
.hbar .fill { background: var(--brand); height: 100%; border-radius: 99px; }
@media (max-width: 600px) { .hbar { grid-template-columns: 100px 1fr 90px; } }
.copy { display: flex; gap: 8px; }
.copy input { flex: 1; min-width: 0; }
.tool-card { display: flex; gap: 14px; align-items: flex-start; }
.tool-card .ic { width: 46px; height: 46px; border-radius: 12px; background: var(--brand-50); display: grid; place-items: center; font-size: 22px; flex: none; }

/* Modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 18px; max-width: 760px; width: 100%; max-height: 90vh; overflow: auto; padding: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.modal .x { float: right; border: 0; background: #f3f4f6; border-radius: 99px; width: 32px; height: 32px; cursor: pointer; font-size: 18px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; width: calc(100% - 32px); max-width: 420px; pointer-events: none; }
#toast div { background: #111827; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
#toast div.err { background: #991b1b; } #toast div.ok { background: var(--brand-d); }
.loading { padding: 50px; text-align: center; color: var(--muted); }
.policy-table td:first-child { font-weight: 600; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { border: 1px solid var(--line); background: #fff; padding: 9px 14px; border-radius: 11px; font-weight: 700; cursor: pointer; font-family: inherit; font-size: 14px; }
.tabs button.on { border-color: var(--brand); background: var(--brand-50); color: var(--brand-d); }
.sim-table td input { width: 110px; padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 8px; text-align: right; font-family: inherit; }
.pos-line { display: grid; grid-template-columns: 1fr 120px 110px; gap: 10px; align-items: center; margin-bottom: 8px; }

.two-col { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }
.sticky { position: sticky; top: 82px; }
@media (max-width: 760px) { .sticky { position: static; } }
.demo-bar { background: #fef3c7; color: #78350f; font-size: 13px; }
.demo-bar .container { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.demo-bar button { border: 1px solid #d97706; background: #fff; color: #92400e; border-radius: 99px; padding: 3px 10px; font-weight: 700; cursor: pointer; font-family: inherit; font-size: 12px; }

/* ---- v3: nhãn sản phẩm, đặt trước, tin tức, hợp tác ---- */
.pcard .img, .pdetail .img { position: relative; }
.badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.badges .chip { box-shadow: 0 1px 4px #0002; }
.track { background: #f1f5f9; border-radius: 99px; height: 10px; overflow: hidden; }
.track .fill { background: var(--brand); height: 100%; border-radius: 99px; }
.tickets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ticket { border: 2px dashed var(--brand); color: var(--brand); border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 600; }
.ticket.used { border-color: #cbd5e1; color: #94a3b8; text-decoration: line-through; }
.preorder-band { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 22px; padding: 22px 24px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: center; }
@media (max-width: 760px) { .preorder-band { grid-template-columns: minmax(0, 1fr); } }
.post-card { display: flex; flex-direction: column; color: var(--ink); text-decoration: none; transition: transform .15s; }
.post-card:hover { transform: translateY(-2px); }
.post-img { aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: linear-gradient(120deg, var(--brand-50), #ecfccb); display: grid; place-items: center; font-size: 42px; }
.post-img img { width: 100%; height: 100%; object-fit: cover; }
.post-body p { line-height: 1.7; }
.coop { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.btn.disabled { opacity: .5; pointer-events: none; }
.agent-link { border-color: var(--brand); background: var(--brand-50); }
.pdetail .img { align-self: start; }
