/* App An Nhiên – thân thiện người lớn tuổi: chữ ≥ 16px, nhãn chữ cạnh icon, nút to trong tầm ngón cái */
:root {
  --bg: #f4f2ec; --paper: #fff; --ink: #1f2a22; --muted: #5d6b60; --line: #e2e1d8;
  --brand: #2f6b3f; --brand-ink: #fff; --brand-soft: #e5efe7;
  --amber: #8a5300; --amber-soft: #fbf0c8; --red: #b42318; --red-soft: #fde8e6; --blue: #1f5fae; --blue-soft: #e3edfb;
  --radius: 18px; --fs: 17px;
  color-scheme: light;
}
:root.large { --fs: 20px; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--fs)/1.55 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
h1 { font-size: 1.65em; line-height: 1.2; margin: 0 0 .4em; font-weight: 700; }
h2 { font-size: 1.3em; margin: 0 0 .5em; font-weight: 700; }
h3 { font-size: 1.1em; margin: 0 0 .3em; }
p { margin: 0 0 .5em; }
.muted { color: var(--muted); }
.small { font-size: .88em; }
.big { font-size: 1.5em; font-weight: 800; }
.good { color: var(--brand); font-weight: 700; }
.bad { color: var(--red); font-weight: 700; }
.row { display: flex; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stack > * + * { margin-top: 14px; }

header.top { position: sticky; top: 0; z-index: 10; background: var(--paper); border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); gap: 6px; }
.logo { font-weight: 800; font-size: 1.35em; color: var(--brand); display: flex; align-items: center; gap: 8px; margin-right: auto; text-decoration: none; }
.hbtn { background: none; border: 0; display: grid; justify-items: center; font-size: .78em; color: var(--muted); padding: 4px 8px; position: relative; cursor: pointer; text-decoration: none; }
.hbtn .ic { font-size: 1.6em; line-height: 1; }
.dot { position: absolute; top: 0; right: 6px; width: 12px; height: 12px; border-radius: 50%; background: #d42a2a; }

main { max-width: 640px; margin: 0 auto; padding: 18px 16px 120px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.card.accent { border: 2px solid var(--brand); }
.task { display: flex; align-items: center; gap: 14px; background: var(--amber-soft); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: var(--ink); font-weight: 500; }
.task .n { width: 40px; height: 40px; border-radius: 50%; background: #a8650b; color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.task::after { content: "›"; margin-left: auto; font-size: 1.4em; color: var(--muted); }

.btn { display: block; width: 100%; text-align: center; border: 0; border-radius: 16px; padding: 16px 18px; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--brand); color: var(--brand-ink); }
.btn.inline { display: inline-block; width: auto; padding: 10px 16px; border-radius: 12px; }
.btn.ghost { background: var(--paper); color: var(--ink); border: 1.5px solid var(--line); }
.btn.danger { background: var(--paper); color: var(--red); border: 1.5px solid var(--red); }
.btn:disabled { opacity: .5; cursor: default; }
.btn + .btn { margin-top: 10px; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btns .btn + .btn { margin-top: 0; }

.chip { display: inline-block; padding: 3px 12px; border-radius: 99px; font-size: .82em; font-weight: 700; background: var(--brand); color: #fff; white-space: nowrap; }
.st { display: inline-block; padding: 3px 12px; border-radius: 99px; font-size: .85em; font-weight: 600; white-space: nowrap; }
.st.wait { background: var(--amber-soft); color: var(--amber); }
.st.ok { background: var(--brand-soft); color: var(--brand); }
.st.info { background: var(--blue-soft); color: var(--blue); }
.st.err { background: var(--red-soft); color: var(--red); }
.st.gray { background: #eee; color: #555; }

label.f { display: block; font-weight: 600; margin: 10px 0 6px; }
input.in, select.in, textarea.in { width: 100%; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; }
input.in:focus, select.in:focus, textarea.in:focus, .btn:focus-visible { outline: 3px solid #9cc7a7; outline-offset: 1px; }

.bar { height: 14px; background: #ecebe4; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.kv:last-child { border-bottom: 0; }
.kv b { text-align: right; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .v { font-size: 1.35em; font-weight: 800; margin-top: 4px; }
.stat.alert { border: 2px solid var(--red); }

.prod { display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: center; }
.pimg { aspect-ratio: 1; background: #e8efe6; border-radius: 16px; display: grid; place-items: center; font-size: 3em; }
.price { font-weight: 800; font-size: 1.1em; }
.price s { color: var(--muted); font-weight: 400; margin-left: 6px; }
.earn { color: #1e7a3c; font-weight: 700; }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.qty button { width: 44px; height: 44px; border: 0; background: #f2f1ea; font-size: 1.3em; cursor: pointer; }
.qty span { min-width: 44px; text-align: center; font-weight: 700; }

.tabs { display: grid; grid-auto-flow: column; gap: 10px; margin-bottom: 14px; }
.tabs a { text-align: center; padding: 14px; border-radius: 14px; background: var(--paper); border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 500; }
.tabs a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.scroller { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.scroller > * { flex: none; }
.pick { padding: 14px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--paper); cursor: pointer; max-width: 150px; text-align: left; }
.pick.on { background: var(--brand); color: #fff; border-color: var(--brand); }

table.t { width: 100%; border-collapse: collapse; font-size: .92em; }
table.t th { text-align: left; color: var(--muted); font-weight: 600; font-size: .85em; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.t td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t td.r, table.t th.r { text-align: right; }
.tw { overflow-x: auto; }

.qr { display: grid; place-items: center; padding: 10px; }
.qr svg { width: min(260px, 70vw); height: auto; }
.verified { background: var(--brand-soft); color: var(--brand); border-radius: 99px; padding: 4px 14px; font-weight: 700; font-size: .9em; display: inline-block; }
.chat { background: #efeee7; border-radius: 16px; padding: 14px; display: grid; gap: 10px; max-height: 55vh; overflow-y: auto; }
.msg { max-width: 82%; padding: 12px 16px; border-radius: 18px; background: #fff; border: 1px solid var(--line); }
.msg.me { justify-self: end; background: var(--brand); color: #fff; border-color: var(--brand); }
.msg .when { font-size: .78em; opacity: .7; margin-top: 4px; }

nav.bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: var(--paper); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom); }
nav.bottom a { display: grid; justify-items: center; gap: 2px; padding: 10px 2px 12px; text-decoration: none; color: var(--ink); font-size: .8em; border-radius: 14px; margin: 4px 3px; }
nav.bottom a .ic { font-size: 1.5em; line-height: 1.1; }
nav.bottom a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
nav.bottom a.center { background: var(--brand); color: #fff; margin-top: -18px; border-radius: 18px; box-shadow: 0 4px 10px rgba(47,107,63,.35); font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); background: #1f2a22; color: #fff; padding: 12px 20px; border-radius: 14px; z-index: 50; max-width: 90vw; text-align: center; }
.toast.err { background: var(--red); }
.empty { text-align: center; color: var(--muted); padding: 18px; }
.note { background: var(--amber-soft); border-radius: 12px; padding: 12px 14px; font-size: .93em; }
.rule { background: var(--red-soft); border-radius: 12px; padding: 12px 14px; font-size: .93em; }
details > summary { cursor: pointer; font-weight: 600; }
@media (max-width: 380px) { .grid3 { grid-template-columns: 1fr 1fr; } .prod { grid-template-columns: 84px 1fr; } }

/* Bảng tiền trước / sau thuế ở Ví */
table.money { width: 100%; border-collapse: collapse; font-size: .92em; }
table.money th { font-weight: 500; color: var(--muted, #6b7280); font-size: .85em; padding: 0 0 6px; }
table.money td { padding: 8px 0; border-top: 1px solid var(--line, #e5e7eb); }
table.money .r { text-align: right; padding-left: 6px; white-space: nowrap; }
