:root {
  --bg: #FFF8F1;
  --card: #FFFFFF;
  --ink: #2E2620;
  --mut: #6B5D50;
  --line: #F1E3D3;
  --brand: #8A5120;
  --deep: #5B361A;
  --deep-hover: #472914;
  --peach: #FBEBD8;
  --cream: #FFE9D2;
  --red: #991B1B;
  --red-soft: #FEE2E2;
  --green: #166534;
  --hero: linear-gradient(160deg, #A5682D, #6F3F18);
  --shadow: 0 6px 18px rgba(126, 74, 30, .1);
  --tabs-h: 84px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 600 14px/1.4 Nunito, "Segoe UI", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
::selection { background: var(--cream); color: var(--deep); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; text-align: left; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 10px; }
.hero :focus-visible, .side :focus-visible { outline-color: #fff; }
svg.i { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.page { min-height: 100dvh; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 640px; margin: 0 auto; padding: 16px 16px 32px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.has-tabs .wrap { padding-bottom: calc(var(--tabs-h) + 22px); }
.has-bar .wrap { padding-bottom: 170px; }

/* Đầu trang nâu */
.hero { background: var(--hero); color: #fff; padding: 18px 16px 22px; border-radius: 0 0 32px 32px; }
.hero-in { width: 100%; max-width: 608px; margin: 0 auto; }
.who { display: flex; align-items: center; gap: 10px; }
.who img { width: 42px; height: 42px; border-radius: 50%; border: 2px solid #fff; display: block; }
.who .txt { flex: 1; min-width: 0; font-size: 15.5px; font-weight: 800; line-height: 1.2; }
.who small { display: block; font-size: 12px; font-weight: 600; color: var(--peach); }
.who small.onshift { display: flex; align-items: center; gap: 5px; color: #fff; font-weight: 800; white-space: nowrap; }
.who small.onshift::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #6EE7A0; box-shadow: 0 0 0 3px rgba(110, 231, 160, .25); margin-left: 3px; flex: none; }
.pill { flex: none; min-height: 44px; padding: 10px 18px; border-radius: 22px; background: #fff; color: var(--brand); font-weight: 900; font-size: 13px; white-space: nowrap; }
.pill:hover { background: var(--peach); }
.pill.on { background: rgba(255, 255, 255, .18); color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7); }
.pill.on:hover { background: rgba(255, 255, 255, .28); }
.bign { display: flex; align-items: flex-end; gap: 12px; padding-top: 16px; }
.bign b { font-size: 75.5px; font-weight: 900; line-height: .85; letter-spacing: -.03em; }
.bign .t { font-size: 17px; font-weight: 800; line-height: 1.2; padding-bottom: 2px; }
.bign button, .bign em { display: block; font-style: normal; font-size: 13px; font-weight: 700; color: var(--cream); }
.bign button { text-decoration: underline; text-underline-offset: 3px; }
.seg { display: flex; gap: 6px; padding-top: 16px; }
.seg button { flex: 1; min-width: 0; min-height: 58px; padding: 8px 0; border-radius: 16px; background: rgba(255, 255, 255, .16); text-align: center; font-size: 12px; font-weight: 700; }
.seg button:hover { background: rgba(255, 255, 255, .26); }
.seg b { display: block; font-size: 19px; font-weight: 900; line-height: 1.1; }
.seg .on, .seg .on:hover { background: #fff; color: var(--brand); }
.subhead { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.subhead h1 { flex: 1; min-width: 0; font-size: 22px; font-weight: 900; line-height: 1.2; letter-spacing: -.01em; }
.backb { width: 44px; height: 44px; margin-left: -10px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.backb:hover { background: rgba(255, 255, 255, .16); }
.backb.tabpage { display: none; }
.subhead:has(.backb.tabpage) h1 { font-size: 22px; font-weight: 900; }
@media (min-width: 900px) { .subhead h1, .subhead:has(.backb.tabpage) h1 { font-size: 26px; } }
.dots { display: flex; gap: 7px; padding-top: 10px; }
.dots i { flex: 1; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .28); }
.dots i.on { background: #fff; }

/* Thanh dưới */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; height: var(--tabs-h); padding: 0 6px 8px; display: flex; align-items: center; justify-content: space-around; background: var(--card); border-radius: 26px 26px 0 0; box-shadow: 0 -4px 20px rgba(126, 74, 30, .1); }
.tab { width: 68px; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 700; color: var(--mut); white-space: nowrap; }
.tab.on { color: var(--brand); font-weight: 900; }
.fab { width: 72px; height: 72px; margin-top: -38px; display: grid; place-items: center; flex: none; border-radius: 50%; background: var(--deep); color: #fff; box-shadow: 0 6px 16px rgba(91, 54, 26, .35); }
.fab:hover { background: var(--deep-hover); }
.fab svg.i { width: 32px; height: 32px; }

.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--bg); box-shadow: 0 -4px 16px rgba(126, 74, 30, .08); }
.bar-in { width: 100%; max-width: 608px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.tot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-weight: 800; }
.tot b { font-size: 24px; font-weight: 900; color: var(--deep); white-space: nowrap; }

/* Nút */
.btn { width: 100%; min-height: 62px; padding: 10px 16px; display: flex; align-items: center; justify-content: center; gap: 9px; border-radius: 22px; background: var(--deep); color: #fff; font-size: 15.5px; font-weight: 800; text-align: center; line-height: 1.2; transition: background .12s, transform .08s; }
.btn:hover { background: var(--deep-hover); }
.btn:active { transform: scale(.985); }
.btn[disabled], .btn[disabled]:hover { background: #E6D8C8; color: var(--deep); cursor: not-allowed; transform: none; }
.btn.ghost { background: var(--card); color: var(--brand); box-shadow: inset 0 0 0 2px #B97636; }
.btn.ghost:hover { background: var(--peach); }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #7F1616; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.link { display: block; width: 100%; min-height: 44px; padding: 10px; text-align: center; font-weight: 800; color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.link.red { color: var(--red); }

/* Thẻ đơn */
.cards { display: flex; flex-direction: column; gap: 12px; }
.ord { background: var(--card); border-radius: 24px; padding: 14px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.ord.late { box-shadow: inset 0 0 0 2px var(--red), var(--shadow); }
.ord-head { display: flex; align-items: center; gap: 12px; }
.ord-head:hover b { text-decoration: underline; text-underline-offset: 3px; }
.no { min-width: 48px; font-size: 29px; font-weight: 900; line-height: 1; color: var(--deep); }
.ord .t { flex: 1; min-width: 0; }
.ord b { display: block; font-size: 15.5px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.ord small { display: block; font-size: 12px; color: var(--mut); }
.ord small.late { color: var(--red); font-weight: 800; }
.ord small.ok { color: var(--green); font-weight: 800; }
.ord small.stage { color: var(--brand); font-size: 13px; font-weight: 800; }
.chev { flex: none; color: #A5682D; }
.ord > .act, .ord > a.act { margin-top: auto; }
.act { width: 100%; min-height: 54px; padding: 8px 12px; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 18px; background: var(--deep); color: #fff; font-size: 14.5px; font-weight: 800; text-align: center; }
.act:hover { background: var(--deep-hover); }
.act svg.i { width: 18px; height: 18px; stroke-width: 3; }

/* Bàn phím số */
.q { font-size: 22.5px; font-weight: 900; line-height: 1.2; color: var(--deep); padding-top: 6px; }
.num { min-height: 70px; display: grid; place-items: center; background: var(--card); border-radius: 22px; font-size: 27.5px; font-weight: 900; letter-spacing: .03em; box-shadow: var(--shadow); }
.num.empty { display: grid; gap: 0; padding: 0 12px; color: #8A7A6B; font-weight: 700; font-size: 19px; letter-spacing: 0; } /* .empty (khung trống) không được làm ô số cao lên */
.num.bad { box-shadow: inset 0 0 0 2px var(--red); }
.known { text-align: center; font-size: 13px; font-weight: 800; color: var(--green); }
.err { font-size: 13px; font-weight: 800; color: var(--red); text-align: center; }
.err.left { text-align: left; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pad button { height: 62px; display: grid; place-items: center; border-radius: 20px; background: var(--card); font-size: 23px; font-weight: 800; box-shadow: 0 3px 10px rgba(126, 74, 30, .07); }
.pad button:hover { background: var(--peach); }
.pad button:active { background: var(--cream); }
.pad .del { color: var(--brand); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .lb { font-size: 14px; font-weight: 900; color: var(--deep); }
.lb small, .field label small { font-size: 12px; font-weight: 600; color: var(--mut); }
.inp { width: 100%; min-height: 56px; padding: 12px 16px; border: 2px solid var(--line); border-radius: 18px; background: var(--card); font-size: 15.5px; font-weight: 700; caret-color: var(--brand); }
.inp::placeholder { color: #7D6E60; font-weight: 600; }
.inp:focus { outline: none; border-color: #A5682D; box-shadow: 0 0 0 3px var(--peach); }
.inp.bad { border-color: var(--red); }
textarea.inp { min-height: 84px; resize: vertical; }

/* Số kg */
.dial { text-align: center; padding-top: 10px; }
.dial .v { font-size: 89.5px; font-weight: 900; line-height: 1; letter-spacing: -.03em; }
.dial .v small { font-size: 22.5px; font-weight: 800; letter-spacing: 0; margin-left: 6px; }
.dial .ctl { display: flex; justify-content: center; gap: 16px; margin-top: 10px; }
.dial .ctl button { width: 104px; height: 60px; display: grid; place-items: center; border-radius: 20px; background: rgba(255, 255, 255, .18); }
.dial .ctl button:hover { background: rgba(255, 255, 255, .3); }
.dial .ctl svg.i { stroke-width: 3; }
.dial .mon { font-size: 19px; font-weight: 800; padding: 10px 0 4px; }

.opt { width: 100%; min-height: 66px; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--card); border-radius: 20px; box-shadow: inset 0 0 0 2px var(--line); }
.opt:hover { box-shadow: inset 0 0 0 2px #C89A6C; }
.opt.on { background: var(--peach); box-shadow: inset 0 0 0 3px #A5682D; }
.opt .t { flex: 1; min-width: 0; }
.opt b { display: block; font-size: 14.5px; font-weight: 800; line-height: 1.2; }
.opt small { font-size: 12px; color: var(--mut); }
.rd { width: 24px; height: 24px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 2px #B9A68F; }
.opt.on .rd { box-shadow: inset 0 0 0 7px var(--deep); }
.opts { display: flex; flex-direction: column; gap: 8px; }

.items { background: var(--card); border-radius: 20px; box-shadow: inset 0 0 0 2px var(--line); overflow: hidden; }
.item { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; min-height: 62px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .t { flex: 1; min-width: 0; line-height: 1.2; }
.item b { display: block; font-weight: 800; }
.item small { font-size: 12px; color: var(--mut); }
.item button { width: 46px; height: 46px; display: grid; place-items: center; flex: none; border-radius: 14px; background: var(--peach); color: var(--brand); }
.item button:hover { background: var(--cream); }
.item .c { width: 28px; text-align: center; font-size: 16.5px; font-weight: 900; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 46px; padding: 10px 16px; border-radius: 23px; background: var(--card); box-shadow: inset 0 0 0 2px var(--line); font-size: 13px; font-weight: 800; }
.chip:hover { box-shadow: inset 0 0 0 2px #C89A6C; }
.chip.on, .chip.on:hover { background: var(--deep); color: #fff; box-shadow: none; }
.chips.even { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.chips.even .chip { padding: 8px 2px; text-align: center; font-size: 12px; }
.chips.even3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chips.even3 .chip { padding: 8px 2px; text-align: center; }
.scan-form { gap: 10px; }
.box.qr-row { flex-direction: row; align-items: center; gap: 14px; }
.qr-row .qr-sm { width: 128px; height: 128px; margin: 0; flex: none; }
.qr-btns { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.qr-btns .btn { min-height: 54px; font-size: 14px; }

.sw { width: 100%; min-height: 62px; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--card); border-radius: 20px; box-shadow: inset 0 0 0 2px var(--line); }
.sw .t { flex: 1; min-width: 0; }
.sw b { display: block; font-weight: 800; line-height: 1.2; }
.sw small { font-size: 12px; color: var(--mut); }
.knob { position: relative; width: 56px; height: 32px; flex: none; border-radius: 16px; background: #B9A68F; transition: background .15s; }
.knob::after { content: ""; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: left .15s; }
.sw.on .knob { background: var(--deep); }
.sw.on .knob::after { left: 27px; }

/* Khung thông tin */
.info { background: var(--card); border-radius: 24px; padding: 6px 18px; box-shadow: var(--shadow); }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--mut); flex: none; max-width: 48%; }
.kv b { font-weight: 800; text-align: right; overflow-wrap: anywhere; }
.box { background: var(--card); border-radius: 24px; padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.box-t { font-size: 14.5px; font-weight: 900; color: var(--deep); }
.box-t small { font-size: 12px; font-weight: 600; color: var(--mut); }

/* Chi tiết đơn */
.ohead { display: flex; align-items: center; gap: 14px; }
.ohead .big { font-size: 48px; font-weight: 900; line-height: 1; letter-spacing: -.02em; }
.ohead .t { flex: 1; min-width: 0; }
.ohead b { display: block; font-size: 17px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.ohead small { display: block; font-size: 13px; font-weight: 700; color: var(--cream); }
.call { width: 54px; height: 54px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.call:hover { background: rgba(255, 255, 255, .3); }
.steps { display: flex; flex-direction: column; }
.steps > div { position: relative; display: flex; gap: 12px; padding-bottom: 16px; color: var(--mut); }
.steps > div:last-child { padding-bottom: 0; }
.steps > div:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.steps > div.done:not(:last-child)::after { background: #A5682D; }
.steps i { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--line); color: #fff; }
.steps i svg.i { width: 16px; height: 16px; stroke-width: 3.4; }
.steps .done { color: var(--ink); }
.steps .done i { background: #A5682D; }
.steps .now { color: var(--deep); font-weight: 900; }
.steps .now i { background: var(--deep); box-shadow: 0 0 0 4px var(--peach); }
.steps .now i::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.steps small { display: block; font-size: 12px; font-weight: 600; color: var(--mut); }
.qr-sm { width: 148px; height: 148px; margin: 0 auto; }
.qr svg, .qr-sm svg { display: block; width: 100%; height: 100%; }

/* Bill */
.bill { background: var(--card); border-radius: 24px; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; box-shadow: var(--shadow); }
.bill img { width: 52px; height: 52px; border-radius: 14px; }
.bill .numb { font-size: 44.5px; font-weight: 900; line-height: 1; color: var(--deep); }
.qr { width: 190px; height: 190px; }
.bill .lines { width: 100%; margin-top: 10px; border-top: 2px dashed var(--line); text-align: left; }

/* Trang khách */
.ringw { display: grid; place-items: center; padding: 14px 0 4px; }
.ring { width: 222px; height: 222px; display: grid; place-items: center; border-radius: 50%; }
.ring > div { width: 184px; height: 184px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 12px; border-radius: 50%; background: #8A5424; text-align: center; }
.ring small { font-size: 12px; font-weight: 700; color: var(--cream); }
.ring b { font-size: 26px; font-weight: 900; line-height: 1.1; }
.eta { text-align: center; font-size: 14.5px; font-weight: 800; padding-top: 8px; }

/* Quét */
.scan { position: relative; width: 100%; aspect-ratio: 1; margin: 0 auto; overflow: hidden; border-radius: 26px; background: #3B2214; }
.scan video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan::after { content: ""; position: absolute; inset: 14%; border: 4px solid var(--cream); border-radius: 22px; }
.note { font-size: 13px; color: var(--mut); text-align: center; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 34px 16px; text-align: center; color: var(--mut); }
.empty svg.i { width: 44px; height: 44px; color: #A5682D; }
.empty b { font-size: 16.5px; font-weight: 800; color: var(--ink); }
.count { font-size: 13px; color: var(--mut); font-weight: 700; }
.foot { text-align: center; font-size: 12px; color: var(--mut); padding-top: 4px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 14px); z-index: 20; width: min(560px, calc(100% - 28px)); display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 18px; background: #3B2214; color: #fff; font-weight: 700; opacity: 0; pointer-events: none; transform: translate(-50%, 14px); transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.toast span { flex: 1; }
.toast button { flex: none; min-height: 44px; padding: 6px 12px; color: var(--cream); font-weight: 900; }
body.bar-open .toast { bottom: 176px; }
body.no-dock .toast { bottom: 24px; }
.bar .row .btn { font-size: 14px; padding-inline: 8px; }

/* Máy tính */
.side, .desk-only { display: none; }
@media (min-width: 900px) {
  .tabs { display: none; }
  .has-tabs .wrap { padding-bottom: 40px; }
  .toast { bottom: 24px; }
  .wrap { padding-top: 24px; }
  .wrap.wide { max-width: 980px; }
  .cards.two { display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; }
  .backb.tabpage { display: grid; }
  .scan { max-width: 340px; }
  .hero { padding-inline: 32px; }
  .hero-in.wide { max-width: 948px; }
  .desk-only { display: flex; }
  .home { flex-direction: row; align-items: flex-start; }
  .home > .hero { display: none; }
  .side { position: sticky; top: 0; flex: none; width: 430px; height: 100dvh; padding: 28px; display: flex; flex-direction: column; gap: 12px; color: #fff; background: var(--hero); border-radius: 0 34px 34px 0; }
  .side .bign b { font-size: 110px; }
  .side .bign .t { font-size: 20.5px; }
  .side .seg button { padding: 11px 0; font-size: 12px; }
  .side .seg b { font-size: 21.5px; }
  .side .sp { flex: 1; }
  .dbtn { min-height: 62px; display: flex; align-items: center; justify-content: center; gap: 10px; border-radius: 24px; background: rgba(255, 255, 255, .16); font-weight: 900; font-size: 15.5px; }
  .dbtn:hover { background: rgba(255, 255, 255, .26); }
  .dbtn.w { background: #fff; color: var(--brand); }
  .dbtn.w:hover { background: var(--peach); }
  .home .wrap { max-width: none; padding: 28px 30px 40px; }
  .wtitle { font-size: 21.5px; font-weight: 900; color: var(--deep); }
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .two-col > div { display: flex; flex-direction: column; gap: 12px; }
  .bar-in.wide { max-width: 948px; flex-direction: row; align-items: center; justify-content: flex-end; gap: 16px; }
  .bar-in.wide .tot { flex: none; justify-content: flex-start; margin-right: auto; }
  .bar-in.wide .row { flex: 0 1 640px; }
}
@media (max-width: 899px) {
  .wtitle { display: none; }
  .two-col, .two-col > div { display: flex; flex-direction: column; gap: 12px; }
}
@media print {
  body { background: #fff; }
  .hero, .tabs, .bar, .toast, .no-print { display: none !important; }
  .wrap { padding: 0; }
  .bill { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Ô nhập không nhỏ hơn 16px: nhỏ hơn thì iPhone tự phóng to màn hình khi bấm vào. */
input.inp, textarea.inp, select.inp, .item .qn { font-size: 16px; }
select { font: inherit; color: inherit; }
select.inp { font-size: 16px; font-weight: 800; }
