:root {
  --bg: #fff8f3;
  --card: #ffffff;
  --text: #2a1a12;
  --muted: #7a6458;
  --line: #f0e2d8;
  --brand: #f05a28;
  --brand-ink: #ffffff;
  --brand-soft: #ffe7dc;
  --ok: #14895a;
  --ok-soft: #dcf5ea;
  --warn: #b7791f;
  --warn-soft: #fdf0d5;
  --bad: #c53030;
  --bad-soft: #fde2e2;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(42, 26, 18, .06), 0 6px 24px rgba(42, 26, 18, .06);
  /* Chỉ dùng theme sáng, kể cả khi máy user đang bật dark mode. */
  color-scheme: light;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); }
main { max-width: 640px; margin: 0 auto; padding: 16px 16px 64px; }
header.top { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 16px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 22px; letter-spacing: -.02em; }
.logo img { border-radius: 8px; }
.logo span { color: var(--brand); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
h1 { font-size: 30px; line-height: 1.2; margin: 8px 0 12px; letter-spacing: -.02em; }
h2 { font-size: 18px; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 14px; }
.hidden { display: none !important; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 18px; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--brand); color: var(--brand-ink); text-decoration: none;
}
button.ghost, .btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.small { padding: 6px 12px; font-size: 14px; }
button:disabled { opacity: .5; cursor: default; }
.full { width: 100%; }
.steps { margin: 0; padding-left: 20px; }
.steps li { margin-bottom: 8px; }
.balance { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.balance small { font-size: 16px; font-weight: 600; color: var(--muted); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.stat { background: var(--bg); border-radius: 12px; padding: 10px; }
.stat b { display: block; font-size: 16px; }
.stat span { font-size: 12px; color: var(--muted); }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.tier { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 14px; }
label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 4px; }
input, select {
  width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit;
}
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .r { text-align: right; white-space: nowrap; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.pill.pending { background: var(--line); color: var(--muted); }
.pill.holding { background: var(--warn-soft); color: var(--warn); }
.pill.available { background: var(--ok-soft); color: var(--ok); }
.pill.cancelled { background: var(--bad-soft); color: var(--bad); }
.code { font-family: ui-monospace, Menlo, monospace; font-weight: 700; font-size: 20px; letter-spacing: .1em; }
.copybox { display: flex; gap: 8px; }
.copybox input { flex: 1; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 10; max-width: calc(100% - 32px); }
.toast.error { background: var(--bad); color: #fff; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.qr { width: 150px; max-width: 40vw; border-radius: 8px; background: #fff; }
.payrow { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.payrow .info { flex: 1; min-width: 0; word-break: break-word; }
pre { white-space: pre-wrap; word-break: break-word; font-size: 13px; background: var(--bg); padding: 12px; border-radius: 12px; }
textarea {
  width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font: inherit; resize: vertical;
}
.note { background: var(--warn-soft); color: #6b4a12; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 12px 0; }
.note-bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-soft); font-weight: 600; }
.or { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
button.link { background: none; color: var(--brand); padding: 8px 0 0; font-weight: 500; font-size: 14px; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin-top: 16px; }
label.check input { width: auto; margin-top: 4px; }
.linkres { margin-top: 12px; }
button.apple { background: #000; }
.wraptext { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); font-size: 14px; overflow-wrap: anywhere; user-select: all; }

/* Chọn ngân hàng */
.banklogo { width: 56px; height: 32px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 3px; flex: none; }
.bankrow { display: flex; align-items: center; gap: 12px; }
.bankpick { width: 100%; justify-content: flex-start; gap: 12px; background: var(--bg); color: var(--text); border: 1px solid var(--line); font-weight: 500; padding: 8px 12px; min-height: 50px; text-align: left; }
.bankpick .chev { margin-left: auto; color: var(--muted); }
.sheet { width: min(560px, calc(100% - 16px)); max-height: min(80vh, 640px); border: 0; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); background: var(--card); color: var(--text); }
.sheet[open] { display: flex; flex-direction: column; gap: 12px; }
.sheet::backdrop { background: rgba(42, 26, 18, .45); }
.sheethead { display: flex; align-items: center; justify-content: space-between; }
.bankgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; overflow-y: auto; padding: 2px; }
.bankopt { flex-direction: column; gap: 6px; padding: 10px 6px; background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 12px; font-weight: 600; font-size: 13px; line-height: 1.2; }
.bankopt img { width: 100%; max-width: 96px; height: 36px; object-fit: contain; }
.bankopt span { overflow-wrap: anywhere; }
.bankopt[aria-selected="true"] { border-color: var(--brand); background: var(--brand-soft); }
.bankgrid .muted { grid-column: 1 / -1; text-align: center; padding: 16px 0; }
@media (max-width: 380px) { .bankgrid { grid-template-columns: repeat(2, 1fr); } }

/* Trang admin: rộng hơn để xem bảng */
body.admin main { max-width: 1120px; }
h3 { font-size: 15px; margin: 20px 0 8px; }
.headrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.periods { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.periods input[type="month"] { width: auto; padding: 6px 10px; font-size: 14px; }
.chip { background: var(--bg); color: var(--text); border: 1px solid var(--line); padding: 6px 12px; font-size: 14px; border-radius: 99px; font-weight: 500; }
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.kpi { background: var(--bg); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi b { font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi small { font-size: 12px; color: var(--muted); }
.kpi.good b { color: var(--ok); }
.kpi.warn b { color: var(--warn); }
.split { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 14px; }
.split span b { font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; margin-top: 8px; -webkit-overflow-scrolling: touch; }
.tablewrap table { min-width: 720px; }
.tablewrap th { position: sticky; top: 0; background: var(--card); font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tablewrap td.n, .tablewrap th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tablewrap tr.click { cursor: pointer; }
.tablewrap tr.click:hover td { background: var(--bg); }
.filters { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.filters input { flex: 1 1 220px; }
.filters select { flex: 0 1 180px; }
summary { cursor: pointer; }

/* Đơn hàng phía user */
.orow { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.orow:first-child { border-top: 0; }
.orow .main { flex: 1; min-width: 0; }
.orow .pname { font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.orow .more { color: var(--muted); font-weight: 400; font-size: 13px; }
.orow .r { text-align: right; white-space: nowrap; }
.screenhead { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.tablewrap td.prod { min-width: 220px; max-width: 340px; }
.orow .ometa { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 4px; }
.orow .r b { font-size: 17px; }
.orow .r .muted { font-size: 12px; }
.support { display: flex; align-items: center; gap: 12px; }
.btn.small { padding: 8px 14px; font-size: 14px; white-space: nowrap; }
.btn.zalo { background: #0068ff; color: #fff; }
.faq details { border-top: 1px solid var(--line); }
.faq details:first-of-type { border-top: 0; }
.faq summary { cursor: pointer; padding: 12px 24px 12px 0; font-weight: 600; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 10px; font-size: 20px; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details p { color: var(--muted); font-size: 15px; }
.todo { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.todo:first-of-type { border-top: 0; }
.todo .tick { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); }
.todo.done .tick { background: var(--ok); border-color: var(--ok); }
.todo.done .tick::after { content: "✓"; color: #fff; font-size: 13px; display: flex; align-items: center; justify-content: center; height: 100%; }
.todo.done b { text-decoration: line-through; color: var(--muted); }
.todo.done button { display: none; }
.center { text-align: center; }
.howto { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hstep { background: var(--bg); border-radius: 14px; padding: 14px 10px; text-align: center; font-size: 14px; line-height: 1.35; }
.hstep i { position: relative; display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; margin: 0 auto 8px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }
.hstep svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hstep em { position: absolute; top: -2px; right: -4px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: #fff; font: 700 12px/20px system-ui, sans-serif; font-style: normal; }
.flow { display: flex; align-items: stretch; gap: 4px; }
.fbox { flex: 1; min-width: 0; background: var(--bg); border-radius: 12px; padding: 10px 4px; text-align: center; }
.fbox span { display: block; font-size: 12px; color: var(--muted); }
.fbox b { font-size: 15px; white-space: nowrap; }
.fbox.you { background: var(--brand); color: #fff; }
.fbox.you span { color: rgba(255,255,255,.85); }
.farrow { align-self: center; color: var(--muted); font-weight: 700; }
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tiers div { border: 1px solid var(--line); border-radius: 12px; padding: 8px 4px; text-align: center; }
.tiers b { display: block; font-size: 20px; color: var(--brand); }
.tiers span { font-size: 12px; color: var(--muted); }
.track { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; position: relative; }
.track::before { content: ""; position: absolute; top: 5px; left: 16.6%; right: 16.6%; height: 2px; background: var(--line); }
.tstep { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.tstep .dot { width: 12px; height: 12px; margin-bottom: 4px; box-shadow: 0 0 0 3px var(--card); }
.tstep small { font-size: 12px; color: var(--muted); }
.tstep b { font-size: 17px; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.dot.pending { background: #c9b8ad; }
.dot.holding { background: var(--warn); }
.dot.available { background: var(--ok); }
.tips { margin-top: 12px; background: var(--warn-soft); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.tips ul { margin: 6px 0 0; padding-left: 18px; }
.tips li { margin-top: 2px; }
