/* 2Guys Inventory — phong cách sang trọng theo app 2GUYS: nền ngà, nút đen, điểm nhấn đỏ rượu từ logo */
:root {
  --bg: #F6F4F1;        /* ngà ấm */
  --paper: #FFFFFF;
  --tint: #F1EEEA;      /* ô nền nhạt */
  --ink: #161414;
  --muted: #7B7371;
  --line: #E3DED9;
  --wine: #6C2128;      /* màu logo */
  --wine-soft: #F4E7E6;
  --rose: #B79A9C;      /* hồng tro như nút Apply */
  --cream: #FBE4D1;     /* màu mặt logo */
  --shop: #6C2128;      /* Shopify */
  --kiot: #2F4A5A;      /* KiotViet: xanh đá từ kính lúp trong logo */
  --ok: #3E6B52;
  --warn: #8A5A1E;
  --warn-bg: #F7EFE3;
  --bad: #9B2226;
  --bad-bg: #F7E8E7;
  --r: 4px;             /* bo góc nhẹ, vuông vức */
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: "Be Vietnam Pro", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); min-height: 100%; }
body { -webkit-tap-highlight-color: transparent; font-size: 16px; line-height: 1.5; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; }
b, strong { font-weight: 600; }

.screen { min-height: 100dvh; }

/* ---------- buttons ---------- */
.btn { border: 1px solid transparent; border-radius: var(--r); padding: 14px 18px; font-weight: 500; letter-spacing: .01em; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:disabled { opacity: .5; }
.btn.ghost { background: var(--paper); border-color: var(--line); }
.btn.light { color: #fff; border-color: rgba(255,255,255,.5); background: rgba(0,0,0,.3); }
.btn.cam { background: var(--ink); color: #fff; width: 100%; font-size: 17px; padding: 17px; }
.btn.sm { padding: 8px 12px; font-size: 14px; }
.btn.wide { width: 100%; margin-top: 14px; }
.iconbtn { border: 0; background: transparent; padding: 6px; margin-left: -6px; cursor: pointer; display: inline-grid; place-items: center; color: var(--ink); }

/* ---------- đăng nhập ---------- */
.login { max-width: 380px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 40px) 22px 40px; display: grid; gap: 16px; }
.loginTop { display: flex; justify-content: space-between; align-items: flex-start; }
.login img { border-radius: var(--r); display: block; }
.login h1 { margin: 6px 0 0; font-size: 30px; font-weight: 500; letter-spacing: -.01em; }
.login > p { margin: 0; color: var(--muted); font-weight: 300; }
.login label { display: grid; gap: 7px; font-weight: 500; font-size: 14px; }
.login input:not([type="checkbox"]) { border: 1px solid var(--line); border-radius: var(--r); padding: 13px 14px; background: var(--paper); font-size: 17px; }
.login input:not([type="checkbox"]):focus { border-color: var(--ink); outline: none; }
.login small { color: var(--muted); font-weight: 300; font-size: 13px; }
.login .su { display: none; }
#login.signup .su { display: grid; }
.check { display: flex !important; align-items: center; gap: 10px; font-weight: 400 !important; cursor: pointer; }
.check input { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; margin: 0; border: 1px solid var(--muted); border-radius: 2px; background: var(--paper); display: grid; place-items: center; flex: none; }
.check input:checked { background: var(--wine); border-color: var(--wine); }
.check input:checked::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.err { color: var(--bad); font-weight: 500; margin: 0; }

.seg { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 12px 4px; font-weight: 400; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.seg button[aria-selected="true"] { color: var(--ink); font-weight: 500; border-bottom-color: var(--ink); }

/* ---------- header (giống app 2GUYS: menu trái, tên giữa) ---------- */
.bar { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 500; font-size: 18px; letter-spacing: -.005em; white-space: nowrap; }
.brand img { border-radius: 3px; }
.barRight { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.scanstate { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.scanstate i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(62,107,82,.14); }
.scanstate.busy i { background: var(--wine); animation: pulse .7s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .3; } }
@media (max-width: 520px) { .scanstate span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
@media (max-width: 380px) { .brand span { font-size: 16px; } }

.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 2px; background: var(--paper); }
.lang button { border: 0; background: transparent; padding: 5px 8px; font-size: 12px; font-weight: 500; letter-spacing: .04em; color: var(--muted); cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- menu ---------- */
.menu { position: fixed; z-index: 15; left: 12px; top: calc(env(safe-area-inset-top, 0px) + 58px); width: min(300px, calc(100vw - 24px)); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 6px; box-shadow: 0 18px 40px rgba(22,20,20,.12); display: grid; }
.menu .who { display: flex; gap: 12px; align-items: center; padding: 12px 10px 14px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .who b { display: block; font-weight: 500; }
.menu .who small { color: var(--muted); font-size: 13px; }
.menu button { text-align: left; border: 0; background: transparent; padding: 13px 10px; border-radius: 2px; cursor: pointer; }
.menu button:hover, .menu button[aria-current] { background: var(--tint); }
.menu button[aria-current] { font-weight: 500; }
#logoutBtn { color: var(--bad); }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--wine); color: var(--cream); font-weight: 500; font-size: 13px; letter-spacing: .04em; display: inline-grid; place-items: center; }
.avatar.sm { width: 36px; height: 36px; }

main { padding: 4px 16px calc(180px + var(--safe-b)); max-width: 560px; margin: 0 auto; }

/* ---------- trạng thái chờ ---------- */
.idle h2 { font-size: 30px; font-weight: 400; line-height: 1.15; letter-spacing: -.015em; margin: 32px 0 10px; max-width: 14ch; }
.idle p { color: var(--muted); font-weight: 300; margin: 0 0 32px; max-width: 34ch; }
.idle h3, .hist h3 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 6px; letter-spacing: .02em; }
.recent { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.recent li button { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 14px 0; display: flex; justify-content: space-between; gap: 12px; cursor: pointer; }
.recent li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent li em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }

.loading { display: flex; align-items: center; gap: 12px; padding: 28px 0; color: var(--muted); list-style: none; }
.spin { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--wine); animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

.notice { margin: 16px 0; padding: 14px 16px; border-radius: var(--r); background: var(--warn-bg); color: var(--warn); border: 1px solid #EADBC4; list-style: none; }
.notice.bad { background: var(--bad-bg); color: var(--bad); border-color: #EDD3D1; }
.notice .acts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.notice .btn { padding: 10px 14px; font-size: 15px; }

.chooser { display: grid; gap: 8px; margin-top: 16px; }
.chooser h3 { margin: 0 0 4px; font-size: 16px; font-weight: 500; }
.chooser button { text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; cursor: pointer; }
.chooser small { display: block; color: var(--muted); }

/* ---------- thẻ sản phẩm ---------- */
.card { margin-top: 18px; }
.prod { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.thumb { flex: none; width: 76px; height: 76px; border-radius: 2px; background: var(--paper) center/cover no-repeat; border: 1px solid var(--line); display: grid; place-items: center; color: var(--wine); font-weight: 500; font-size: 18px; letter-spacing: .02em; }
.prod h2 { margin: 0 0 6px; font-size: 18px; font-weight: 400; line-height: 1.35; }
.meta { margin: 0; color: var(--muted); font-size: 14px; font-weight: 300; font-variant-numeric: tabular-nums; }

/* Sổ cộng: Shopify + KiotViet = Tổng */
.ledger { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 18px 20px; }
.row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.src b { display: block; font-size: 16px; font-weight: 500; }
.src small { color: var(--muted); font-size: 13px; font-weight: 300; }
#rowS .src b { color: var(--shop); }
#rowK .src b { color: var(--kiot); }
.qty { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 2px; }
.step { width: 44px; height: 46px; border: 0; background: transparent; font-size: 22px; font-weight: 300; cursor: pointer; line-height: 1; }
.step:active { background: var(--tint); }
.numwrap { position: relative; width: 72px; text-align: center; border-left: 1px solid var(--line); border-right: 1px solid var(--line); align-self: stretch; display: grid; place-items: center; }
.num { width: 100%; text-align: center; border: 0; background: transparent; font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; padding: 4px 0; }
.num:focus { background: var(--wine-soft); outline: none; }
.row.dirty .num { color: var(--wine); }
.was { position: absolute; left: 0; right: 0; top: -20px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.missing { grid-column: 1 / -1; margin: 0; font-size: 14px; color: var(--muted); font-weight: 300; }
.row.off .qty { display: none; }
.row.off .missing { grid-column: 2; text-align: right; }

.sum { display: flex; justify-content: space-between; align-items: baseline; padding-top: 18px; border-top: 1px solid var(--ink); margin-top: -1px; }
.sum span { font-size: 17px; }
.sum output { font-size: 56px; font-weight: 500; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--ink); }

.savebar { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 14px; }

/* ---------- thanh dưới ---------- */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--bg); padding: 12px 16px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); display: grid; gap: 10px; }
.dock > * { max-width: 528px; width: 100%; margin: 0 auto; }
.manual { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.manual input { border: 1px solid var(--line); border-radius: var(--r); padding: 13px 14px; background: var(--paper); min-width: 0; }
.manual input:focus { border-color: var(--ink); outline: none; }
.manual .btn { background: var(--rose); color: #fff; border: 0; padding: 0 22px; }

/* ---------- camera ---------- */
.camera { position: fixed; inset: 0; z-index: 20; background: #000; }
.camera video { width: 100%; height: 100%; object-fit: cover; }
.reticle { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.reticle span { width: min(62vw, 300px); aspect-ratio: 1; border-radius: 6px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.55); border: 2px solid #fff; }
.camera.hit .reticle span { border-color: #9FD8B4; }
.camhint { position: absolute; left: 16px; right: 16px; top: calc(env(safe-area-inset-top, 0px) + 28px); margin: 0; text-align: center; color: #fff; font-weight: 300; }
.camtools { position: absolute; left: 16px; right: 16px; bottom: calc(28px + var(--safe-b)); display: flex; gap: 10px; justify-content: center; }
.camtools .btn { min-width: 120px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(160px + var(--safe-b)); z-index: 30; margin: 0 auto; max-width: 420px; background: var(--ink); color: #fff; padding: 13px 16px; border-radius: var(--r); text-align: center; }
.toast.ok { background: var(--ink); }
.toast.bad { background: var(--bad); }

/* ---------- trang con ---------- */
.pagehead { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 24px 0 14px; }
.pagehead h2 { margin: 0; font-size: 26px; font-weight: 400; letter-spacing: -.01em; }
.filters { display: grid; gap: 10px; margin-bottom: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line); background: var(--paper); border-radius: 2px; padding: 8px 14px; font-size: 14px; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.filters select { border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px; background: var(--paper); }
.empty { color: var(--muted); padding: 24px 0; font-weight: 300; }

.hist h3 { margin: 22px 0 8px; }
.hist h3::first-letter { text-transform: uppercase; }
.hist ol { list-style: none; margin: 0; padding: 0 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.hist li { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.hist li:last-child { border-bottom: 0; }
.hist time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hist .what { min-width: 0; }
.hist .what b { display: block; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist .what small { color: var(--muted); font-size: 13px; }
.sys { font-weight: 500; margin-right: 4px; }
.sys.shopify { color: var(--shop); }
.sys.kiotviet { color: var(--kiot); }
.hist .chg { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }
.hist .chg span { display: block; color: var(--muted); }
.hist .chg span b { color: var(--ink); }
.hist .chg em { font-style: normal; font-weight: 500; font-size: 13px; }
.hist .chg em.up { color: var(--ok); }
.hist .chg em.down { color: var(--wine); }

.users { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.users > li { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 14px; }
.users > li.off { opacity: .55; }
.uhead { display: flex; gap: 12px; align-items: center; }
.uhead b { display: block; font-weight: 500; }
.uhead small { color: var(--muted); font-size: 13px; font-weight: 300; }
.uacts { display: flex; gap: 6px; flex-wrap: wrap; }
.pwform { display: grid; grid-template-columns: 1fr; gap: 8px; }
.pwform input { border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px; }
@media (min-width: 420px) { .pwform { grid-template-columns: 1fr auto auto; } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* ---------- con mắt mật khẩu ---------- */
.pw { position: relative; display: block; }
.pw input { width: 100%; padding-right: 50px !important; }
.eye { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.eye .x { opacity: 0; }
.eye[aria-pressed="false"] .x { opacity: 1; }
.eye[aria-pressed="true"] { color: var(--ink); }

/* ---------- Face ID ---------- */
.facewrap { display: grid; gap: 12px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 300; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn.face { width: 100%; padding: 13px 18px; }
.offer { margin: 18px 0 0; padding: 16px; background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--wine); border-radius: var(--r); display: grid; gap: 12px; }
.offer b { font-weight: 500; }
.offer p { margin: 4px 0 0; color: var(--muted); font-weight: 300; font-size: 14px; }
.offer .acts { display: flex; gap: 8px; }

/* =================== bố cục mới: tab dưới chân · menu phải · máy tính =================== */
:root { --tabh: 66px; }
.bar { grid-template-columns: 1fr auto; }
.brand { justify-self: start; }
.barRight .iconbtn { margin: 0 -6px 0 0; }
.menu { left: auto; right: 12px; }
.noscroll { overflow: hidden; }

/* thanh tab */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; height: calc(var(--tabh) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; background: var(--paper); border-top: 1px solid var(--line); }
.tabs > button { position: relative; border: 0; background: transparent; height: var(--tabh); display: grid; place-items: center; align-content: center; gap: 3px; color: var(--muted); font-size: 11px; letter-spacing: .01em; cursor: pointer; padding: 0 2px; }
.tabs > button svg { width: 24px; height: 24px; }
.tabs > button[aria-current] { color: var(--ink); font-weight: 500; }
.tabs .dot { position: absolute; top: 10px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--wine); }
.tabs .tabbrand, .tabs .deskOnly { display: none !important; }
.scanTab { align-content: end !important; padding-bottom: 8px !important; }
.scanTab .big { width: 64px; height: 64px; margin-top: -30px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(22,20,20,.25), 0 0 0 5px var(--bg); }
.scanTab .big svg { width: 32px; height: 32px; }
.scanTab[aria-current] .big { background: var(--wine); }
.scanTab[aria-current] { color: var(--wine) !important; }

.dock { bottom: calc(var(--tabh) + var(--safe-b)); padding-bottom: 12px; border-top: 1px solid var(--line); }
main { padding-bottom: calc(var(--tabh) + 200px + var(--safe-b)); }
body:not([data-view="scan"]) main { padding-bottom: calc(var(--tabh) + 40px + var(--safe-b)); }
.toast { bottom: calc(var(--tabh) + 150px + var(--safe-b)); }
body:not([data-view="scan"]) .toast { bottom: calc(var(--tabh) + 20px + var(--safe-b)); }

/* trang con: rộng hơn */
#vReports, #vOrders, #vSettings, #vHistory, #vUsers { max-width: 1180px; }
.seg.wide { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); margin-bottom: 12px; }
.seg.wide button { white-space: nowrap; font-size: 14px; }
.seg.narrow { max-width: 320px; }
.rtools { display: grid; gap: 8px; margin-bottom: 12px; }
.rtools select, .rtools input { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; background: var(--paper); min-width: 0; }
.chips button small { color: inherit; opacity: .7; margin-left: 2px; }
.foot { margin-top: 18px; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.kpi { text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 2px; font: inherit; color: inherit; }
button.kpi { cursor: pointer; }
.kpi b { font-size: 26px; font-weight: 500; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi b.sm { font-size: 17px; line-height: 1.4; }
.kpi span { font-size: 12px; color: var(--muted); }
.kpi.warn { border-color: var(--wine); }
.kpi.warn b { color: var(--wine); }

.chanbars { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 14px; display: grid; gap: 6px; }
.chanbars h3 { margin: 0 0 4px; font-size: 13px; font-weight: 500; color: var(--muted); }
.cb { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: 10px; align-items: center; border: 0; background: transparent; padding: 4px 0; text-align: left; cursor: pointer; font-size: 13px; }
.cb i { height: 8px; background: var(--tint); border-radius: 1px; position: relative; overflow: hidden; }
.cb i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--ink); }
.cb.on i::after { background: var(--wine); }
.cb.on span { color: var(--wine); font-weight: 500; }
.cb b { font-weight: 500; font-variant-numeric: tabular-nums; }

.rlist { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.rlist li + li { border-top: 1px solid var(--line); }
.rrow { width: 100%; display: grid; grid-template-columns: auto 44px 1fr auto; gap: 12px; align-items: center; border: 0; background: transparent; text-align: left; padding: 12px 14px; cursor: pointer; font: inherit; color: inherit; }
.rrow:hover { background: var(--tint); }
.rrow .rank { font-style: normal; font-size: 13px; color: var(--muted); width: 18px; text-align: right; }
.rrow:not(:has(.rank)) { grid-template-columns: 44px 1fr auto; }
.rrow .th { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; display: grid; place-items: center; font-size: 11px; color: var(--wine); background: var(--bg); }
.rrow .th img { width: 100%; height: 100%; object-fit: cover; }
.rmain { min-width: 0; display: grid; gap: 1px; }
.rmain b { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rmain small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rmain small.st { white-space: normal; }
.rright { display: grid; justify-items: end; gap: 1px; text-align: right; }
.rright .big { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.1; }
.rright .big.zero, .rright .big.wine { color: var(--wine); }
.rright small { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tr { font-style: normal; font-size: 12px; font-weight: 500; }
.tr.up { color: var(--ok); } .tr.down { color: var(--wine); }

/* đặt hàng */
.ro { background: var(--tint); padding: 8px 12px; border-radius: var(--r); }
.vgrid { display: grid; gap: 10px; }
.vcard { text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 4px; cursor: pointer; font: inherit; color: inherit; }
.vcard:hover { border-color: var(--ink); }
.vcard b { font-weight: 500; font-size: 16px; }
.vcard small { color: var(--muted); font-size: 13px; }
.chips2 { display: flex; gap: 6px; flex-wrap: wrap; }
.chips2 i { font-style: normal; font-size: 11px; letter-spacing: .02em; padding: 2px 8px; border: 1px solid var(--line); border-radius: 2px; color: var(--muted); }
.vtitle { margin: 6px 0 4px; font-size: 26px; font-weight: 400; }
.chips3 { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.chip { font-size: 13px; padding: 6px 10px; border-radius: 2px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); text-decoration: none; }
.chip.whatsapp { border-color: #9FD3B0; } .chip.wechat { border-color: #A9D7A0; } .chip.alibaba { border-color: #F2C08B; }
a.chip:hover { border-color: var(--ink); }
.vnote { background: var(--paper); border: 1px solid var(--line); padding: 10px 12px; border-radius: var(--r); white-space: pre-wrap; font-size: 14px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.plist { display: grid; gap: 8px; margin-top: 10px; }
.pline { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 12px; text-align: left; border: 1px solid var(--line); border-left: 3px solid var(--rose); background: var(--paper); border-radius: var(--r); padding: 12px 14px; cursor: pointer; font: inherit; color: inherit; }
.pline.st-shipped { border-left-color: var(--kiot); } .pline.st-received { border-left-color: var(--ok); opacity: .8; } .pline.st-cancelled { opacity: .5; }
.pmain { min-width: 0; display: grid; gap: 2px; }
.pmain b { font-weight: 500; }
.pmain small, .pright small { font-size: 12px; color: var(--muted); }
.pmain small.chg, .pmeta .chg { color: var(--warn); }
.pright { display: grid; justify-items: end; align-content: start; gap: 3px; text-align: right; }
.pright .big { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
.stb { font-style: normal; font-size: 11px; padding: 2px 8px; border-radius: 2px; background: var(--tint); }
.st-shipped .stb { background: #E6EDF2; color: var(--kiot); } .st-received .stb { background: #E7F0EA; color: var(--ok); }
.late { color: var(--bad) !important; font-weight: 500; }
.track { color: var(--ink); }
a.track { text-decoration: underline; text-underline-offset: 2px; }
a.track b { font-weight: 600; }

/* hộp nhập */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(22,20,20,.4); display: grid; align-items: end; }
.sheetBox { background: var(--bg); max-height: 92dvh; overflow: auto; border-radius: 10px 10px 0 0; padding: 4px 18px calc(22px + var(--safe-b)); width: 100%; }
.sheetHead { position: sticky; top: 0; background: var(--bg); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0 8px; z-index: 1; }
.sheetHead h3 { margin: 0; font-size: 18px; font-weight: 500; }
.sheetHead .iconbtn { font-size: 18px; width: 40px; height: 40px; }
.sheetActs { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.sheetActs .btn { flex: 1 1 auto; }
.btn.danger { color: var(--bad); }
.form { display: grid; gap: 12px; }
.fld { display: grid; gap: 6px; font-size: 13px; font-weight: 500; }
.fld input, .fld select, .fld textarea { border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px; background: var(--paper); font-weight: 400; font-size: 16px; min-width: 0; width: 100%; }
.fld input:focus, .fld select:focus, .fld textarea:focus { border-color: var(--ink); outline: none; }
.fld input[readonly] { background: var(--tint); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .grid3 { grid-template-columns: 1fr; } }
.trk { margin: -4px 0 0; font-size: 13px; color: var(--muted); min-height: 1em; }
.trk a { color: var(--ink); font-weight: 500; }
.pmeta { display: grid; gap: 2px; margin-bottom: 10px; }
.pmeta small { font-size: 13px; color: var(--muted); }
.hist2 { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.hist2 summary { cursor: pointer; font-weight: 500; }
.hist2 ol { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
.hist2 li small { color: var(--muted); }
.hist2 li div { font-size: 14px; }
.hist2 li div span { color: var(--muted); }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0; }
.kv > div { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; display: grid; gap: 2px; }
.kv span { font-size: 12px; color: var(--muted); }
.kv b { font-weight: 500; font-size: 18px; word-break: break-word; }
.kv.list b { font-size: 15px; }
.tbl { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); font-size: 14px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th { font-weight: 500; font-size: 12px; color: var(--muted); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tblwrap { overflow-x: auto; }
.suggest { margin-top: 14px; background: var(--wine-soft); border-radius: var(--r); padding: 12px 14px; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: baseline; }
.suggest b { font-size: 28px; font-weight: 500; color: var(--wine); grid-row: span 2; }
.suggest span { font-size: 13px; }
.suggest small { font-size: 12px; color: var(--muted); }
.inline { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.inline h4 { margin: 0; font-weight: 500; }
h4 { font-weight: 500; }

/* cài đặt */
.set { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 12px; display: grid; gap: 10px; }
.set h3 { margin: 0; font-size: 15px; font-weight: 500; }
.set .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.set .meta { margin: 0; }
.who2 { display: flex; gap: 12px; align-items: center; }
.who2 b { display: block; font-weight: 500; }
.who2 small { color: var(--muted); }
.set .btn.sm { justify-self: start; }

/* =================== máy tính (≥ 1024px): cột trái =================== */
@media (min-width: 1024px) {
  :root { --side: 236px; }
  body { padding-left: var(--side); }
  .tabs { top: 0; bottom: 0; right: auto; width: var(--side); height: auto; padding: 18px 12px; border-top: 0; border-right: 1px solid var(--line);
    grid-auto-flow: row; grid-auto-rows: min-content; grid-auto-columns: auto; align-items: stretch; gap: 2px; }
  .tabs .tabbrand { order: -2; display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: 16px; }
  .tabs .tabbrand img { border-radius: 3px; }
  .tabs > button { height: auto; display: flex; justify-content: flex-start; gap: 12px; font-size: 15px; padding: 11px 12px; border-radius: 3px; }
  .tabs > button[aria-current] { background: var(--tint); }
  .tabs .deskOnly { display: flex !important; }
  .tabs .deskOnly[hidden], .tabs .adm[hidden] { display: none !important; }
  .tabs .dot { position: static; margin-left: auto; }
  .scanTab { order: -1; padding: 0 !important; margin-bottom: 14px; align-content: initial !important; }
  .scanTab { background: var(--ink) !important; color: #fff !important; padding: 12px !important; }
  .scanTab .big { width: 24px; height: 24px; margin: 0; box-shadow: none; background: transparent; }
  .scanTab .big svg { width: 24px; height: 24px; }
  .scanTab[aria-current] { background: var(--wine) !important; }
  .bar { padding-left: 32px; padding-right: 32px; }
  .bar .brand { visibility: hidden; }
  main { max-width: none; padding-left: 32px; padding-right: 32px; padding-bottom: 200px; }
  body:not([data-view="scan"]) main { padding-bottom: 60px; }
  #vScan { max-width: 640px; }
  .dock { left: var(--side); bottom: 0; padding-bottom: 16px; }
  .toast { bottom: 150px; left: var(--side); }
  body:not([data-view="scan"]) .toast { bottom: 24px; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .rtools { grid-template-columns: auto minmax(160px, 220px) minmax(200px, 1fr); align-items: center; }
  .rtools:not(:has(select)) { grid-template-columns: auto minmax(200px, 1fr); }
  .rmain small.st { white-space: nowrap; }
  .vgrid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .plist { grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); }
  .sheet { align-items: center; justify-items: center; }
  .sheetBox { width: min(620px, 92vw); border-radius: 6px; max-height: 88vh; }
  .menu { top: 58px; }
  .seg.wide { max-width: 640px; }
}
@media (min-width: 1024px) and (max-height: 640px) { .tabs { overflow: auto; } }

/* =================== Chuyển kho / Xuất nội bộ =================== */
#vTransfer, #vIssue { max-width: 640px; }
.srcpick { display: grid; gap: 8px; margin: 14px 0 4px; }
.srcpick > span { font-size: 13px; font-weight: 500; }
.srcpick .seg button { padding: 14px 4px; font-size: 16px; }
.scanpad { display: grid; gap: 10px; margin: 16px 0 6px; padding: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.scanpad.off { opacity: .55; }
.scanbig { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 6px 0 4px; }
.scanbig svg { width: 64px; height: 64px; color: var(--wine); }
.scanbig b { font-weight: 500; }
.subh { font-size: 13px; font-weight: 500; color: var(--muted); margin: 22px 0 8px; }
.moves { display: grid; gap: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.moves .empty, .moves .loading { padding: 16px; }
.mv { display: grid; grid-template-columns: 62px 1fr; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); }
.mv:first-child { border-top: 0; }
.mv .q { font-size: 20px; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; color: var(--wine); }
.mm { min-width: 0; display: grid; gap: 1px; }
.mm b { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm small { font-size: 12px; color: var(--muted); }

/* hộp số lượng + bàn phím số */
.qprod { margin: 0 0 6px; display: grid; gap: 2px; }
.qprod b { font-weight: 500; }
.qprod small { color: var(--muted); font-size: 13px; }
.qnum { text-align: center; padding: 6px 0 2px; }
.qnum output { font-size: 56px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.qafter { display: grid; justify-items: center; gap: 2px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; margin-bottom: 10px; }
.qafter .bad { color: var(--bad); font-weight: 500; }
.qnote { width: 100%; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-bottom: 10px; background: var(--paper); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { height: 58px; border: 1px solid var(--line); background: var(--paper); border-radius: var(--r); font-size: 24px; font-weight: 500; cursor: pointer; }
.keypad button:active { background: var(--tint); }
.keypad [data-k="C"], .keypad [data-k="B"] { font-size: 18px; color: var(--muted); }
.qgo { margin-top: 12px; padding: 17px; font-size: 17px; }
.qtyopen .sheetBox { padding-bottom: calc(16px + var(--safe-b)); }
@media (min-width: 1024px) { .keypad button { height: 52px; } }

/* =================== đợt 30/10: thanh trên cố định, chuông, 7 tab, vật tư, máy tính =================== */
:root { --barh: 56px; --top: env(safe-area-inset-top, 0px); }
html, body { overscroll-behavior: none; }
body { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
.bar { position: fixed; top: 0; left: 0; right: 0; z-index: 9; height: calc(var(--barh) + var(--top)); padding-top: var(--top); padding-bottom: 0; }
#main main, main { padding-top: calc(var(--barh) + var(--top)); }
.bell { position: relative; width: 42px; height: 42px; margin-right: -8px !important; }
.bell b { position: absolute; top: 3px; right: 2px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: #D0281F; color: #fff; font-size: 11px; font-weight: 600; line-height: 19px; text-align: center; box-shadow: 0 0 0 2px var(--bg); font-variant-numeric: tabular-nums; }

/* 7 tab: chữ nhỏ lại cho vừa */
.tabs > button { font-size: 10px; gap: 2px; }
.tabs > button svg { width: 23px; height: 23px; }
.tabs > button span:not(.big) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.scanTab .big { width: 58px; height: 58px; }
@media (max-width: 360px) { .tabs > button { font-size: 9px; } }

/* xoay ngang → nhắc xoay lại */
.rotate { display: none; }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .rotate[data-on="1"] { display: grid; position: fixed; inset: 0; z-index: 100; background: var(--bg); place-items: center; align-content: center; gap: 14px; text-align: center; padding: 24px; color: var(--ink); }
  .rotate svg { animation: tilt 1.6s ease-in-out infinite alternate; }
}
@keyframes tilt { from { transform: rotate(90deg); } to { transform: rotate(0); } }

/* camera: nút biểu tượng */
.camtools { justify-content: space-between; padding: 0 12px; }
.camicon { width: 60px; height: 60px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); background: rgba(0,0,0,.45); color: #fff; display: grid; place-items: center; cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.camicon.on { background: #fff; color: var(--ink); }
#camClose { margin-left: auto; }

/* lưới 2 cột (Quét, Chuyển kho, Nội bộ) */
.twocol { display: grid; gap: 0 28px; }
.colSide { min-width: 0; }
.sidebox { margin-top: 26px; }
.sidehead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sidehead h3 { margin: 0 0 6px; }
.linkbtn { border: 0; background: none; padding: 6px 0; color: var(--wine); font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* báo cáo */
.seg.wide button { position: relative; }
.badge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; margin-left: 6px; border-radius: 10px; background: #D0281F; color: #fff; font-style: normal; font-size: 11px; font-weight: 600; vertical-align: 1px; }
.rtools.one, .rtools.two { grid-template-columns: 1fr 1fr; }
.rtools.one select { grid-column: 1 / -1; }
.rtools select { width: 100%; }
.rfilter { width: 100%; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; background: var(--paper); margin-bottom: 12px; }
.rlist li.urgent { box-shadow: inset 3px 0 0 #D0281F; }
.subh.rawh { margin-top: 20px; }
.th.rawth, .rawth { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 2px; background: var(--cream); color: var(--wine); font-size: 8.5px; font-weight: 600; font-style: normal; letter-spacing: .02em; text-transform: uppercase; flex: none; }

/* đặt hàng */
.contactRow { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; }
.contactRow .chips3 { flex: 1; margin: 0; }
.chip { cursor: pointer; font: inherit; font-size: 13px; }
.plusWrap { position: relative; flex: none; }
.btn.plus { width: 44px; height: 44px; padding: 0; font-size: 26px; font-weight: 300; line-height: 1; }
.plusMenu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 12; min-width: 230px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 14px 34px rgba(22,20,20,.14); padding: 4px; display: grid; }
.plusMenu button { text-align: left; border: 0; background: none; padding: 12px; border-radius: 2px; cursor: pointer; }
.plusMenu button:hover { background: var(--tint); }
.pline { grid-template-columns: auto 1fr auto; align-items: start; border-left-width: 1px; }
.pline.is-late { border-color: #E3B8B5; }
.sico { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: 14px; margin-top: 1px; flex: none; }
.sico svg { width: 18px; height: 18px; }
.sico.ok { background: #E3F1E7; color: #2E8B4F; }
.sico.ship { background: #E6EDF2; color: var(--kiot); }
.sico.wait::after, .sico.late::after { content: ""; width: 10px; height: 10px; border-radius: 50%; }
.sico.wait::after { background: #E2B33B; }
.sico.late::after { background: #D0281F; box-shadow: 0 0 0 4px rgba(208,40,31,.15); }
.sico.bad { background: #D0281F; color: #fff; }
.sico.off { background: var(--tint); color: var(--muted); }
.typeahead { position: relative; }
.tawrap { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.tascan { width: 46px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.talist { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; margin-top: 4px; max-height: 260px; overflow: auto; background: var(--paper); border: 1px solid var(--ink); border-radius: var(--r); box-shadow: 0 12px 30px rgba(22,20,20,.14); display: grid; }
.talist button { text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 10px 12px; cursor: pointer; display: grid; gap: 1px; font-weight: 400; }
.talist button:hover { background: var(--tint); }
.talist b { font-weight: 500; font-size: 14px; }
.talist small { font-size: 12px; color: var(--muted); }
.newbox { display: grid; gap: 6px; padding: 10px 12px; background: var(--warn-bg); border-radius: var(--r); }
.newbox .btn { justify-self: start; }
.recvbox { display: grid; gap: 8px; padding: 12px; background: #EEF5F0; border: 1px solid #CFE3D6; border-radius: var(--r); }
.recvbox h4 { margin: 0; }
.okc { color: var(--ok) !important; }
.rogrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.rofld { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; display: grid; }
.rofld span { font-size: 12px; color: var(--muted); }
.rofld b { font-weight: 500; word-break: break-word; }
.rphead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.evlist li { grid-template-columns: 48px 1fr auto; }
.evlist .what b { white-space: normal; }
.check.solo { justify-content: center; }
.tbl.perms td:first-child { font-size: 14px; }
.tbl.perms td.c, .tbl.perms th:not(:first-child) { text-align: center; width: 92px; }

/* thông báo */
.notifs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.notifs button { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 3px; cursor: pointer; font: inherit; color: inherit; }
.notifs li.unread button { border-left: 3px solid #D0281F; }
.nt { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.nt b { font-weight: 500; font-size: 15px; }
.nb { font-size: 14px; color: var(--ink); }
.notifs small { color: var(--muted); font-size: 12px; }
.newtag { font-style: normal; font-size: 10px; font-weight: 600; color: #D0281F; letter-spacing: .04em; text-transform: uppercase; flex: none; }

/* tài khoản */
.acprof { display: flex; gap: 14px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.acprof .avatar { width: 52px; height: 52px; font-size: 20px; }
.acprof b { display: block; font-weight: 500; font-size: 18px; }
.acprof small { color: var(--muted); }
.aclist { margin-top: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); display: grid; }
.acrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 0; border-top: 1px solid var(--line); background: none; padding: 15px 16px; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.acrow:first-child { border-top: 0; }
.acrow b { display: block; font-weight: 500; }
.acrow small { color: var(--muted); font-size: 13px; }
.acrow svg { color: var(--muted); flex: none; }

/* vật tư */
.rawtools { display: grid; gap: 10px; margin: 14px 0; }
.rawtools input { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; background: var(--paper); }
.chips .lowchip[aria-pressed="false"] { border-color: #E3B8B5; color: var(--bad); }
.rawgrid { display: grid; gap: 8px; }
.rawcard { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: var(--r); padding: 12px 14px; cursor: pointer; font: inherit; color: inherit; }
.rawcard:hover { border-color: var(--ink); }
.rawcard.low { border-left: 3px solid #D0281F; }
.rc-main { min-width: 0; display: grid; gap: 1px; }
.rc-main b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-main small { font-size: 12px; color: var(--muted); }
.loc { color: var(--wine) !important; font-weight: 500; }
.rc-qty { display: grid; justify-items: end; text-align: right; }
.rc-qty b { font-size: 24px; font-weight: 500; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rc-qty small { font-size: 12px; color: var(--muted); }
.lowtag { font-style: normal; font-size: 10px; font-weight: 600; color: #D0281F; text-transform: uppercase; letter-spacing: .04em; }
.rwhead { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; margin-bottom: 10px; }
.rwbig { display: grid; justify-items: start; }
.rwbig b { font-size: 48px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.rwbig small { color: var(--muted); font-size: 13px; }
.rwbig.low b { color: #D0281F; }
.rwinfo { display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.rwinfo b { color: var(--ink); font-weight: 500; }
.rwadj { display: grid; gap: 8px; margin-top: 12px; padding: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.rwadj .seg { grid-template-columns: repeat(3, 1fr); }
.bignum { border: 1px solid var(--line); border-radius: var(--r); padding: 10px; font-size: 32px; font-weight: 500; text-align: center; font-variant-numeric: tabular-nums; background: var(--bg); width: 100%; }
.bignum:focus { border-color: var(--ink); outline: none; }
.codebox { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; background: var(--paper); display: grid; gap: 8px; }
.codebox summary { cursor: pointer; font-weight: 500; font-size: 14px; }
.codebox[open] { gap: 10px; }
.codebox .btn { justify-self: start; }
.rawfound { display: grid; gap: 12px; }
.rfhead { display: flex; gap: 12px; align-items: center; }
.rfhead h2 { margin: 0; font-size: 18px; font-weight: 500; }

/* =================== máy tính: bố cục thống nhất =================== */
@media (min-width: 1024px) {
  :root { --content: 1120px; }
  .bar { left: var(--side); padding-left: 32px; padding-right: 32px; }
  main { padding-left: 40px; padding-right: 40px; }
  main > div, #vScan, #vTransfer, #vIssue, #vReports, #vOrders, #vSettings, #vHistory, #vUsers, #vRaw, #vAccount { max-width: var(--content); margin-left: auto; margin-right: auto; }
  .twocol { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .colSide { position: sticky; top: calc(var(--barh) + 20px); }
  .sidebox { margin-top: 24px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 4px; }
  .sidebox .recent { border-top: 0; }
  .twocol .colSide .subh { margin-top: 24px; }
  /* thanh quét nằm trong cột chính, không nổi */
  .dock { position: static; padding: 16px; margin-top: 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }
  .dock > * { max-width: none; }
  main { padding-bottom: 60px; }
  .toast, body:not([data-view="scan"]) .toast { bottom: 24px; left: var(--side); }
  .scanTab[aria-current] { color: #fff !important; }
  .scanTab span { color: inherit; }
  .tabs > button { font-size: 15px; }
  .tabs > button svg { width: 22px; height: 22px; }
  .rtools.one, .rtools.two { grid-template-columns: 220px 260px; }
  .rtools.one select { grid-column: auto; }
  .rfilter { max-width: 492px; }
  .rawgrid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .setgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
  .setgrid .set { margin: 0; }
  .setgrid .set.wide { grid-column: 1 / -1; }
  .aclist, .acprof { max-width: 640px; }
  #acOut { max-width: 640px; }
  .rawtools { grid-template-columns: 360px 1fr; align-items: center; }
  .seg.wide { max-width: 720px; }
}
@media (min-width: 700px) and (max-width: 1023px) {
  main { max-width: 760px; }
  .rawgrid, .vgrid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
  .tabs .acctTab { order: 3; }
  .tabs .deskSep { order: 1; }
  .tabs .deskOnly { order: 2; }
  .idle h2 { max-width: none; }
  .idle p { max-width: 60ch; }
}

/* thanh lọc trạng thái đơn: 5 ô cùng 1 hàng, vừa ngang điện thoại */
.stbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 12px 0 4px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); overflow: hidden; }
.stbar button { border: 0; border-left: 1px solid var(--line); background: none; padding: 8px 2px 7px; display: grid; justify-items: center; gap: 0; cursor: pointer; font: inherit; color: var(--ink); min-width: 0; }
.stbar button:first-child { border-left: 0; }
.stbar b { font-size: 17px; font-weight: 500; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stbar span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.stbar button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.stbar button[aria-pressed="true"] span { color: rgba(255,255,255,.8); }
.rphead { margin: 0 0 6px; }
@media (min-width: 1024px) { .stbar { max-width: 640px; } .stbar span { font-size: 12px; } }

/* nút copy mã vạch */
.cpwrap { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.cpbtn { width: 44px; min-height: 40px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); color: var(--ink); display: inline-grid; place-items: center; cursor: pointer; padding: 0; }
.cpbtn:active { background: var(--tint); }
.rofld b { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rofld .cpbtn { width: 34px; min-height: 30px; flex: none; }

/* máy tính: danh sách đặt hàng trải hết chiều ngang, thẳng hàng với thanh trạng thái */
@media (min-width: 1024px) {
  .plist { grid-template-columns: 1fr; }
  .stbar { max-width: none; }
  .pline { padding: 14px 18px; }
  .pline .pmain { grid-template-columns: 1fr; }
  .seg.wide { max-width: none; }
  .rfilter { max-width: none; }
  .rtools.one, .rtools.two { grid-template-columns: 1fr 1fr; max-width: none; }
}
.trk:empty { display: none; }
.form .grid2 { align-items: start; }

/* đơn đặt hàng nhiều sản phẩm */
.blocks { display: grid; gap: 10px; }
.pblk { display: grid; gap: 10px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.pblk.single { background: none; border: 0; padding: 0; }
.pblkhead { display: flex; justify-content: space-between; align-items: center; margin: -2px 0 -4px; }
.pblkhead b { font-size: 13px; font-weight: 600; color: var(--wine); letter-spacing: .02em; text-transform: uppercase; }
.pblkhead .iconbtn { width: 34px; height: 34px; margin-right: -6px; }
.codetoggle { justify-self: start; display: inline-flex; align-items: center; gap: 8px; border: 1px dashed var(--line); background: none; border-radius: 999px; padding: 6px 12px 6px 8px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; max-width: 100%; }
.codetoggle i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 15px; line-height: 1; flex: none; }
.codetoggle .codesum { color: var(--ink); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.codetoggle[aria-expanded="true"] { border-style: solid; }
.codebox2 { display: grid; gap: 10px; }
.addblk { margin-top: 0; border-style: dashed; }
.ogroup { border: 1px solid var(--line); border-left: 3px solid var(--wine); border-radius: var(--r); background: var(--tint); padding: 8px; display: grid; gap: 6px; }
.ohead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 2px 6px 0; }
.ohead b { font-weight: 500; font-size: 14px; }
.ohead small { color: var(--muted); font-size: 12px; }

/* kéo thả sắp xếp nhà cung cấp */
.sorthint { margin: 0 0 8px; font-size: 13px; }
.vcardwrap { position: relative; display: grid; }
.vcardwrap .vcard { padding-right: 46px; }
.vdrag { position: absolute; top: 6px; right: 6px; z-index: 1; width: 36px; height: 36px; display: grid; place-items: center; color: var(--muted); cursor: grab; touch-action: none; border-radius: 3px; -webkit-user-select: none; user-select: none; }
.vdrag:hover { background: var(--tint); color: var(--ink); }
.vgrid.sorting { -webkit-user-select: none; user-select: none; }
.vgrid.sorting .vdrag { cursor: grabbing; }
.vcardwrap.dragging { pointer-events: none; }
.vcardwrap.dragging .vcard { border: 1px dashed var(--wine); background: var(--wine-soft); box-shadow: 0 10px 26px rgba(22,20,20,.16); }
.vcardwrap.dragging .vdrag { pointer-events: auto; color: var(--wine); }

/* vai trò từng tài khoản (Cài đặt) */
.tbl.roles td { vertical-align: middle; }
.tbl.roles td b { display: block; font-weight: 500; }
.tbl.roles td small { color: var(--muted); font-size: 12px; }
.tbl.roles td.r { text-align: right; width: 200px; }
.tbl.roles select { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; background: var(--paper); width: 100%; max-width: 190px; }
.ownerconfirm { background: var(--warn-bg); border: 1px solid #EADBC4; border-radius: var(--r); padding: 12px 14px; display: grid; gap: 10px; }
.ownerconfirm p { margin: 0; color: var(--warn); font-weight: 500; font-size: 14px; }
.check.locked input { opacity: .45; }

/* sửa / xoá đơn, cảnh báo chưa lưu */
.lineacts { display: flex; gap: 8px; margin: 2px 0 12px; }
.lineacts .btn { flex: 1; }
.reasons { display: grid; gap: 8px; }
.radio { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--paper); border-radius: var(--r); padding: 12px 14px; cursor: pointer; }
.radio input { width: 20px; height: 20px; accent-color: var(--wine); margin: 0; }
.radio:has(input:checked) { border-color: var(--wine); background: var(--wine-soft); }
.btn.danger-fill { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.danger-fill:disabled { opacity: .45; }
.leavebar { position: sticky; top: 52px; z-index: 2; background: var(--warn-bg); border: 1px solid #EADBC4; border-radius: var(--r); padding: 10px 12px; margin: 0 0 12px; display: grid; gap: 8px; }
.leavebar p { margin: 0; color: var(--warn); font-weight: 600; }
.leavebar .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.leavebar.flash { animation: flash .5s ease 2; }
@keyframes flash { 50% { background: #F2DDBE; } }
.delbox { background: #EDEDED; border: 1px solid #D5D5D5; border-radius: var(--r); padding: 10px 12px; display: grid; gap: 3px; margin-bottom: 10px; font-size: 14px; color: #555; }
.delbox > b { color: var(--bad); }
.evlist li[data-rp] { cursor: pointer; }
.evlist li[data-rp]:hover { background: var(--tint); }
.evlist li.del { opacity: .5; background: #F0F0F0; }
.pagehead .plusWrap { margin-left: auto; }
.pagehead .plusWrap .btn.plus { width: 40px; height: 40px; }
.evlist li.del { margin: 0 -14px; padding-left: 14px; padding-right: 14px; }

/* camera luôn nằm trên mọi hộp nhập (đơn hàng, vật tư…) */
.camera { z-index: 80; }
.rolechip { font-size: 12px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 2px; color: var(--muted); }

/* đơn hàng + tiến trình (timeline) */
.osplit { display: block; }
.tl { margin-top: 18px; }
.tlwrap { background: #E9E3DC; border: 1px solid #DDD5CC; border-radius: var(--r); padding: 0 14px; }
.tlwrap > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0; }
.tlwrap > summary::-webkit-details-marker { display: none; }
.tlwrap > summary b { font-weight: 600; font-size: 14px; }
.tlwrap > summary b::before { content: "▸ "; color: var(--wine); }
.tlwrap[open] > summary b::before { content: "▾ "; }
.tlwrap > summary small { color: #5c5452; font-size: 12px; }
.tlasg { margin: 0 0 10px; font-size: 13px; color: var(--ink); }
.tlempty { font-size: 13px; color: #3a3434; margin: 0 0 14px; line-height: 1.5; }
.tlist { list-style: none; margin: 0 0 14px; padding: 0; font-size: 13px; color: var(--ink); }
.tlday { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #5c5452; margin: 10px 0 6px; }
.tlitem { display: grid; grid-template-columns: 14px 1fr; gap: 8px; position: relative; padding-bottom: 12px; }
.tlitem::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: #CFC5BA; }
.tlitem:last-child::before { display: none; }
.tlitem > i { width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); margin-top: 3px; position: relative; z-index: 1; }
.tlitem.create > i { background: var(--ink); }
.tlitem.done > i { background: #2E8B4F; border-color: #2E8B4F; }
.tlitem.del > i { background: #9a9a9a; border-color: #9a9a9a; }
.tlh { display: flex; justify-content: space-between; gap: 8px; }
.tlh b { font-weight: 600; }
.tlh time { color: #5c5452; font-variant-numeric: tabular-nums; }
.tlby { color: #3a3434; font-size: 12px; }
.tlitem ul { margin: 3px 0 0; padding-left: 16px; color: #2a2525; }
.tlitem ul li { margin: 1px 0; }
.tlitem.del ul { color: #777; }
@media (min-width: 1024px) {
  .sheetBox:has(.osplit .tl) { width: min(1080px, 94vw); padding: 0; overflow: hidden; }
  .osplit:has(.tl) { display: grid; grid-template-columns: 3fr 2fr; max-height: 88vh; }
  .osplit:has(.tl) .osmain { overflow: auto; padding: 4px 22px 22px; max-height: 88vh; }
  .osmain .sheetHead { position: sticky; top: 0; }
  .tl { margin: 0; overflow: auto; max-height: 88vh; background: #E9E3DC; border-left: 1px solid #DDD5CC; }
  .tl .tlwrap { border: 0; border-radius: 0; background: none; padding: 6px 20px 20px; min-height: 100%; }
  .tl .tlwrap > summary { pointer-events: none; padding-top: 16px; }
  .tl .tlwrap > summary b::before { content: ""; }
}

/* in nhãn ngay trong app */
#printArea { display: none; }
@media print {
  @page { size: 2.25in 1.25in; margin: 0; }
  body.printing > *:not(#printArea) { display: none !important; }
  body.printing { padding: 0 !important; background: #fff !important; }
  body.printing #printArea { display: block !important; }
  .plabel { width: 2.25in; height: 1.25in; box-sizing: border-box; padding: .08in .12in; display: flex; flex-direction: column; justify-content: space-between; font-family: -apple-system, Helvetica, Arial, sans-serif; color: #000; }
  .plabel b { font-size: 11pt; line-height: 1.1; max-height: 2.2em; overflow: hidden; }
  .plabel svg { width: 100%; height: .48in; }
  .plabel small { font-size: 8pt; display: flex; justify-content: space-between; }
}

/* ô ngày trên iPhone không tràn sang ô bên cạnh */
.fld input[type="date"] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; display: block; min-height: 46px; text-align: left; }
.fld input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.grid2 > * { min-width: 0; }
.fakeinput { border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px; background: var(--tint); min-height: 46px; display: flex; align-items: center; font-size: 16px; }
.fakeinput b { font-weight: 500; }

.form .grid2 { align-items: end; }
#vHistory .filters { grid-template-columns: 1fr 1fr; }
#vHistory .filters #userFilter { grid-column: 1 / -1; }
@media (min-width: 1024px) { #vHistory .filters { grid-template-columns: 200px 220px 260px; } #vHistory .filters #userFilter { grid-column: auto; } }
.headacts { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.rwtabs { margin: 4px 0 10px; }
.rlfilters { grid-template-columns: 1fr 1fr; }
@media (min-width: 1024px) { .rlfilters { grid-template-columns: 200px 260px; } }
@media (min-width: 1024px) {
  .rlfilters { grid-template-columns: 1fr 1fr; }
  #vHistory .filters { grid-template-columns: 1fr 1fr 1fr; }
}

/* tài khoản chờ duyệt */
.users > li.pendingu { border: 1px solid #E2B33B; background: #FFF8E6; }
.pendtag { font-style: normal; font-size: 11px; font-weight: 600; color: #8A5A1E; background: #F7E7BF; padding: 2px 8px; border-radius: 10px; margin-left: 6px; vertical-align: 1px; }
.err.okmsg { color: var(--ok); }

/* nút Lịch sử cập nhật trên thanh trên (trước chuông) */
.histbtn { width: 42px; height: 42px; margin: 0 -6px 0 0 !important; }
.histbtn[aria-current] { color: var(--wine); }

/* thẻ tên trong Tài khoản: bấm để sửa */
button.acprof { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
button.acprof:hover { border-color: var(--ink); }
button.acprof > div { flex: 1; min-width: 0; display: grid; gap: 1px; }
.acedit { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 13px; flex: none; }
.acdel { display: block; margin: 18px auto 0; color: var(--muted); }
.delwarn { margin: 0; padding: 12px 14px; background: var(--bad-bg); color: var(--bad); border-radius: var(--r); font-size: 14px; }
.sharebox { white-space: pre-wrap; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; font: inherit; font-size: 14px; margin: 8px 0 0; }
.warnchip { color: var(--warn); border-color: #EADBC4; background: var(--warn-bg); }
#vUsers .pagehead .btn[hidden] { display: none; }
