/* AquaPOS – giao diện "công nghệ số" với 2 chế độ:
   Tối (trong nhà) và Sáng (ngoài trời, tương phản cao).
   Chế độ đặt bằng thuộc tính data-mode trên thẻ <html>. */
/* Màu nhấn lấy từ bảng màu theo mệnh (js/palettes.js đặt các biến --p*) */
:root {
  --p1: #2563EB; --p1b: #0E7490; --p2: #22D3EE; --p-ink: #0E7490; --p-rgb: 34, 211, 238; --p1-rgb: 37, 99, 235;
  --hdr-light: linear-gradient(160deg, #0E1B2C 0%, #173A7A 62%, #1D6FB8 100%); --bg-dark: #060B17;
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'Roboto Mono', ui-monospace, Menlo, monospace;
  --r: 18px;
  /* ----- Sáng: dùng ngoài trời ----- */
  --outer: #DCE4EE;
  --bg: #EEF3F9; --bg-grid: rgba(var(--p1-rgb), .07); --bg-glow: none;
  --surface: #FFFFFF; --surface-2: #F3F7FC; --soft: var(--surface-2); --sheet: #EEF3F9; --sheet-h: #FFFFFF;
  --line: #D3DEEA; --line-strong: #B8C7D9;
  --ink: #0B1220; --muted: #44546B; --faint: #66758C; --accent: var(--p-ink);
  --blue: var(--p1); --blue-d: var(--p-ink); --blue-l: rgba(var(--p1-rgb), .12);
  --cyan: var(--p-ink); --cyan-l: var(--p2); --cyan-bg: rgba(var(--p-rgb), .16); --cyan-d: var(--p-ink);
  --warn: #B45309; --warn-bg: #FEF3C7; --warn-ink: #92400E;
  --danger: #B91C1C; --danger-bg: #FEE2E2; --danger-ink: #991B1B;
  --ok: #047857; --ok-bg: #DDF5EA;
  --orange: #C2410C; --orange-bg: #FFEDD5; --indigo: #4338CA; --indigo-bg: #E7E9FF;
  --hdr: var(--hdr-light); --hdr-line: transparent;
  --hdr-search: #FFFFFF; --hdr-search-line: transparent;
  --btn-grad: linear-gradient(120deg, var(--p1), var(--p1b));
  --glow: 0 6px 18px rgba(var(--p1-rgb), .3); --glow-sel: 0 0 0 3px rgba(var(--p1-rgb), .18);
  --shadow: 0 10px 26px rgba(14, 27, 44, .12);
  --input-bg: #FFFFFF; --chip-bg: #FFFFFF; --chip-line: #D3DEEA;
  --chip-on-bg: #0B1220; --chip-on-ink: #FFFFFF; --chip-on-line: #0B1220;
  --seg-bg: #DFE7F1; --seg-on: #FFFFFF; --seg-on-ink: #0B1220;
  --tile-sel: rgba(var(--p-rgb), .1); --nav-bg: #0B1220; --nav-line: transparent;
  --toast: #0B1220;
  color-scheme: light;
}
:root[data-mode="dark"] {
  /* ----- Tối: dùng trong nhà ----- */
  --outer: #020305;
  --bg: var(--bg-dark); --bg-grid: rgba(var(--p-rgb), .05);
  --bg-glow: radial-gradient(circle at 92% 0%, rgba(var(--p-rgb), .18), transparent 38%), radial-gradient(circle at 0% 55%, rgba(var(--p1-rgb), .16), transparent 42%);
  --surface: rgba(255, 255, 255, .055); --surface-2: rgba(255, 255, 255, .04);
  --sheet: color-mix(in srgb, var(--bg-dark), #FFFFFF 5%); --sheet-h: color-mix(in srgb, var(--bg-dark), #FFFFFF 9%);
  --line: rgba(var(--p-rgb), .2); --line-strong: rgba(var(--p-rgb), .34);
  --ink: #F1F5FB; --muted: #B3C0D2; --faint: #8C9AAF; --accent: var(--p2);
  --blue: var(--p1); --blue-d: var(--p2); --blue-l: rgba(var(--p-rgb), .14);
  --cyan: var(--p2); --cyan-l: var(--p2); --cyan-bg: rgba(var(--p-rgb), .14); --cyan-d: var(--p2);
  --warn: #FBBF24; --warn-bg: rgba(251, 191, 36, .14); --warn-ink: #FCD34D;
  --danger: #F87171; --danger-bg: rgba(248, 113, 113, .14); --danger-ink: #FCA5A5;
  --ok: #34D399; --ok-bg: rgba(52, 211, 153, .14);
  --orange: #FDBA74; --orange-bg: rgba(251, 146, 60, .14); --indigo: #A5B4FC; --indigo-bg: rgba(129, 140, 248, .16);
  --hdr: linear-gradient(160deg, rgba(var(--p-rgb), .13), rgba(var(--p1-rgb), .05)); --hdr-line: rgba(var(--p-rgb), .2);
  --hdr-search: rgba(255, 255, 255, .07); --hdr-search-line: rgba(var(--p-rgb), .3);
  --btn-grad: linear-gradient(120deg, var(--p1), var(--p1b));
  --glow: 0 0 24px rgba(var(--p-rgb), .38); --glow-sel: 0 0 22px rgba(var(--p-rgb), .3);
  --shadow: 0 14px 34px rgba(0, 0, 0, .45);
  --input-bg: rgba(255, 255, 255, .06); --chip-bg: rgba(255, 255, 255, .05); --chip-line: rgba(var(--p-rgb), .2);
  --chip-on-bg: rgba(var(--p-rgb), .16); --chip-on-ink: var(--p2); --chip-on-line: var(--p2);
  --seg-bg: rgba(255, 255, 255, .06); --seg-on: rgba(var(--p-rgb), .16); --seg-on-ink: var(--p2);
  --tile-sel: linear-gradient(150deg, rgba(var(--p-rgb), .16), rgba(var(--p1-rgb), .1));
  --nav-bg: color-mix(in srgb, var(--bg-dark) 92%, transparent); --nav-line: rgba(var(--p-rgb), .24);
  --toast: color-mix(in srgb, var(--bg-dark), #FFFFFF 14%);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--outer); }
body { font-family: var(--font); color: var(--ink); font-size: 15px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue-d); text-decoration: none; }
img { display: block; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

#app {
  max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative;
  background-color: var(--bg);
  background-image: var(--bg-glow), linear-gradient(var(--bg-grid) 1px, transparent 1px), linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: auto, 24px 24px, 24px 24px; background-attachment: local;
}
.screen { min-height: 100dvh; display: flex; flex-direction: column; }
.body { flex: 1; padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.has-nav .body { padding-bottom: 104px; }
.has-bar .body { padding-bottom: 100px; }

/* Chữ số kiểu máy cho tiền và số lượng */
.mono, .big-num, .hstat .v, .stat .v, .tile .pr, .tile .code, .paybtn .amt, .paybtn .cnt, .tile .badge,
.sumrow span:last-child, .inp.num, .stepper input, .lbl, .hero .num, .kpi .v, .doc-code { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.lbl { font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--faint); }
.lbl.accent { color: var(--accent); }

/* ---------- Đầu trang ---------- */
.hdr { background: var(--hdr); border-bottom: 1px solid var(--hdr-line); color: #EEF4FF; padding: 16px; display: flex; flex-direction: column; gap: 14px; position: relative; }
.hdr.tall { padding-bottom: 64px; }
.hdr-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.hdr h1 { font-size: 21px; font-weight: 800; margin: 0; flex: 1; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr .sub { font-size: 13px; color: #B9CCEA; }
.hdr .logo, .top-logo { width: 42px; height: 42px; border-radius: 12px; box-shadow: 0 0 16px rgba(var(--p-rgb), .45); }
.ibtn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .1); display: inline-flex; align-items: center; justify-content: center; color: #EEF4FF; flex-shrink: 0; position: relative; }
.ibtn:active { background: rgba(255, 255, 255, .22); }
.ibtn .dot { position: absolute; top: 10px; right: 11px; width: 8px; height: 8px; border-radius: 50%; background: #F87171; box-shadow: 0 0 8px #F87171; }
.hbtn { height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .1); display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #EEF4FF; max-width: 60%; }
.hbtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; letter-spacing: 1px; color: #6EE7B7; }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: #34D399; box-shadow: 0 0 8px #34D399; }
.sync.off { color: #FCD34D; } .sync.off i { background: #FBBF24; box-shadow: 0 0 8px #FBBF24; }
.big-num { font-size: 36px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.big-num small { font-size: 20px; color: var(--cyan-l); font-weight: 800; }
.hstats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hstat { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .12); border-radius: 14px; padding: 10px 12px; text-align: left; color: #EEF4FF; }
.hstat .k { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: #B9CCEA; }
.hstat .v { font-size: 18px; font-weight: 800; }
.hstat.hot { background: rgba(248, 113, 113, .2); border-color: rgba(248, 113, 113, .45); }
.hstat.hot .k { color: #FECACA; }

/* ---------- Tìm kiếm ---------- */
.search { height: 46px; border-radius: 14px; background: var(--input-bg); border: 1.5px solid var(--line); display: flex; align-items: center; gap: 8px; padding: 0 14px; color: var(--accent); }
.hdr .search { background: var(--hdr-search); border-color: var(--hdr-search-line); }
.search input { border: 0; background: transparent; font-size: 15px; color: var(--ink); outline: none; width: 100%; min-width: 0; }
.search input::placeholder { color: var(--faint); }

/* ---------- Thẻ ---------- */
.card, .list, .stat, .pcard, .mitem { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.card { padding: 14px 16px; }
.card.float { margin: -44px 16px 0; box-shadow: var(--shadow); position: relative; z-index: 2; background: var(--sheet-h); }
.sec-title { font-size: 16px; font-weight: 800; display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.sec-title a, .sec-title button { font-size: 13px; font-weight: 600; color: var(--blue-d); background: none; border: 0; padding: 6px 0; }
.muted { color: var(--muted); } .small { font-size: 12px; } .tiny { font-size: 11px; }
.b { font-weight: 700; } .xb { font-weight: 800; } .right { text-align: right; }
.red { color: var(--danger); } .green { color: var(--ok); } .blue { color: var(--blue-d); } .warn { color: var(--warn); }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gap4 { gap: 4px; } .gap8 { gap: 8px; } .gap12 { gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }

/* Thẻ doanh thu kiểu công nghệ */
.hero { border-radius: 22px; padding: 18px 18px 10px; background: linear-gradient(150deg, rgba(var(--p-rgb), .14), rgba(var(--p1-rgb), .08)); border: 1px solid rgba(var(--p-rgb), .45); color: #EEF4FF; }
:root:not([data-mode="dark"]) .hero { background: var(--hdr); border-color: transparent; box-shadow: var(--shadow); }
.hero .num { font-size: 34px; font-weight: 800; margin-top: 6px; letter-spacing: -.01em; text-shadow: 0 0 18px rgba(var(--p-rgb), .5); }
.hero .num small { font-size: 18px; color: var(--p2); }
.hero svg { display: block; width: 100%; height: 86px; margin-top: 6px; }
.hero .days { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: #9FB4D3; padding-bottom: 4px; }
.delta { font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 8px; }
.delta.up { color: #6EE7B7; background: rgba(52, 211, 153, .16); } .delta.down { color: #FCA5A5; background: rgba(248, 113, 113, .16); }
.kpi { border-radius: 16px; padding: 12px; background: var(--surface); border: 1px solid var(--line); text-align: left; color: var(--ink); }
.kpi .k { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.kpi .v { font-size: 19px; font-weight: 800; }
.alert-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 0; background: transparent; width: 100%; text-align: left; color: var(--ink); border-bottom: 1px solid var(--line); font-weight: 600; }
.alert-row:last-child { border-bottom: 0; }
.alert-row .d { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.alert-row .go { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.d.red { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.d.warn { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.d.blue { background: var(--blue); box-shadow: 0 0 10px var(--blue); }

.qa { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--ink); padding: 12px 2px; }
.qa.main { background: var(--btn-grad); color: #fff; border-color: transparent; box-shadow: var(--glow); }
.qa .ic { display: flex; align-items: center; justify-content: center; }
.ic-blue { background: var(--btn-grad); color: #fff; }
.ic-cyan { background: var(--cyan-bg); color: var(--cyan-d); }
.ic-orange { background: var(--orange-bg); color: var(--orange); }
.ic-indigo { background: var(--indigo-bg); color: var(--indigo); }
.ic-red { background: var(--danger-bg); color: var(--danger); }
.ic-warn { background: var(--warn-bg); color: var(--warn); }
.ic-green { background: var(--ok-bg); color: var(--ok); }
.ic-soft { background: var(--blue-l); color: var(--blue-d); }
.ico { width: 36px; height: 36px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

.stat { padding: 14px; display: flex; flex-direction: column; gap: 6px; text-align: left; color: var(--ink); }
.stat .v { font-size: 22px; font-weight: 800; }
.stat .k { font-size: 13px; color: var(--muted); font-weight: 500; }

/* ---------- Danh sách ---------- */
.list { overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border: 0; background: transparent; width: 100%; text-align: left; border-bottom: 1px solid var(--line); color: var(--ink); }
.item:last-child { border-bottom: 0; }
.item:active, .pcard:active, .alert-row:active { background: var(--surface-2); }
.item .t { font-size: 15px; font-weight: 700; }
.item .s { font-size: 12px; color: var(--muted); }
.item .right .b { font-family: var(--mono); }
.av { width: 42px; height: 42px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex-shrink: 0; }
:root[data-mode="dark"] .av { background: rgba(148, 197, 255, .1) !important; color: var(--p2) !important; border: 1px solid var(--line); }
.pcard { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; width: 100%; text-align: left; color: var(--ink); }
.pcard .xb { font-family: var(--mono); }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--blue), var(--cyan)); }
:root[data-mode="dark"] .bar > i { box-shadow: 0 0 10px rgba(var(--p-rgb), .6); }
.bar.warn > i { background: var(--warn); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 8px; white-space: nowrap; }
.tag.warn { color: var(--warn-ink); background: var(--warn-bg); }
.tag.red { color: var(--danger-ink); background: var(--danger-bg); }
.tag.green { color: var(--ok); background: var(--ok-bg); }
.tag.blue { color: var(--blue-d); background: var(--blue-l); }
.tag.gray { color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
.tag.cyan { color: var(--cyan-d); background: var(--cyan-bg); }
.tag.orange { color: var(--orange); background: var(--orange-bg); }
.tag.indigo { color: var(--indigo); background: var(--indigo-bg); }
.lot-warn { color: var(--warn-ink); } .lot-red { color: var(--danger); }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--chip-line); background: var(--chip-bg); color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.chip.on { background: var(--chip-on-bg); color: var(--chip-on-ink); border-color: var(--chip-on-line); }
:root[data-mode="dark"] .chip.on { box-shadow: 0 0 12px rgba(var(--p-rgb), .3); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--seg-bg); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { height: 40px; border: 0; border-radius: 11px; background: transparent; font-weight: 700; font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button.on { background: var(--seg-on); color: var(--seg-on-ink); box-shadow: 0 2px 6px rgba(14, 27, 44, .1); }

.empty { text-align: center; padding: 36px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ico { width: 56px; height: 56px; border-radius: 18px; }

/* ---------- Bán hàng: ô vuông ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-content: start; }
.tile { position: relative; text-align: left; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 6px; color: var(--ink); min-height: 138px; }
.tile:active { transform: scale(.98); }
.tile.sel { border-color: var(--cyan); background: var(--tile-sel); box-shadow: var(--glow-sel); }
.tile.out { opacity: .6; border-style: dashed; }
.tile .code { font-size: 10px; letter-spacing: 1px; color: var(--accent); }
.tile .nm { font-size: 15px; font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .pr { font-size: 15px; font-weight: 800; color: var(--ink); }
.tile .st { font-family: var(--mono); font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.tile .st.warn { color: var(--warn); } .tile .st.red { color: var(--danger); }
.tile .st i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.tile .badge { position: absolute; top: 10px; right: 10px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px; background: var(--cyan); color: #0B0F17; font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 12px rgba(var(--p-rgb), .6); }

/* ---------- Nút ---------- */
.btn { height: 50px; border-radius: 16px; border: 1px solid var(--line); padding: 0 18px; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface); color: var(--ink); }
.btn.primary { background: var(--btn-grad); color: #fff; border-color: transparent; box-shadow: var(--glow); }
.btn.dark { background: var(--nav-bg); color: #fff; }
.btn.soft { background: var(--blue-l); color: var(--blue-d); border-color: transparent; }
.btn.line { border: 1.5px solid var(--line-strong); background: var(--surface); }
.btn.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.btn.green { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.btn.sm { height: 40px; border-radius: 12px; font-size: 14px; padding: 0 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.paybar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, var(--bg) 30%); z-index: 20; }
.paybtn { width: 100%; height: 62px; border-radius: 20px; border: 0; background: var(--btn-grad); color: #fff; display: flex; align-items: center; padding: 0 18px; gap: 12px; box-shadow: var(--glow); }
.paybtn .cnt { min-width: 36px; height: 36px; border-radius: 12px; background: rgba(6, 11, 23, .3); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; padding: 0 6px; }
.paybtn .lbl2 { flex: 1; text-align: left; font-size: 16px; font-weight: 700; }
.paybtn .amt { font-size: 19px; font-weight: 800; }
.paybtn:disabled { background: var(--surface-2); color: var(--faint); box-shadow: none; border: 1px solid var(--line); }
.fab { position: fixed; bottom: calc(98px + env(safe-area-inset-bottom)); right: max(18px, calc(50% - 222px)); width: 58px; height: 58px; border-radius: 18px; border: 0; background: var(--btn-grad); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--glow); z-index: 15; }

/* ---------- Thanh menu dưới ---------- */
.nav { position: fixed; bottom: calc(12px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: calc(min(480px, 100%) - 24px); background: var(--nav-bg); border: 1px solid var(--nav-line); border-radius: 22px; height: 68px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; padding: 0 6px; z-index: 20; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); backdrop-filter: blur(10px); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 54px; border-radius: 16px; font-size: 11px; font-weight: 500; color: #B9CCEA; border: 1px solid transparent; }
.nav a.on { background: rgba(var(--p-rgb), .14); border-color: rgba(var(--p-rgb), .45); color: var(--p2); font-weight: 700; box-shadow: 0 0 16px rgba(var(--p-rgb), .25); }

/* ---------- Ô nhập ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.inp { height: 48px; border-radius: 14px; border: 1.5px solid var(--line-strong); background: var(--input-bg); padding: 0 14px; font-size: 16px; outline: none; width: 100%; min-width: 0; color: var(--ink); }
.inp::placeholder { color: var(--faint); }
.inp:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(var(--p-rgb), .18); }
textarea.inp { height: 80px; padding: 12px 14px; resize: vertical; }
select.inp { appearance: auto; }
.inp.num { text-align: right; font-weight: 700; }
.inp.sm { height: 42px; border-radius: 12px; font-size: 15px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 38px; height: 38px; border-radius: 11px; border: 1.5px solid var(--line-strong); background: var(--surface); font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.stepper button.plus { background: var(--btn-grad); border-color: transparent; color: #fff; }
.stepper input { width: 58px; height: 38px; text-align: center; border: 1.5px solid var(--line-strong); border-radius: 11px; font-weight: 800; font-size: 16px; outline: none; background: var(--input-bg); color: var(--ink); }
.stepper input:focus { border-color: var(--cyan); }
.sumrow { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 15px; }
.sumrow.total { font-size: 18px; font-weight: 800; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }

/* ---------- Bảng trượt ---------- */
#sheet-root .ov { position: fixed; inset: 0; background: rgba(3, 6, 13, .6); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
.sheet { width: 100%; max-width: 480px; max-height: 92dvh; background: var(--sheet); border: 1px solid var(--line); border-bottom: 0; border-radius: 24px 24px 0 0; display: flex; flex-direction: column; animation: up .22s cubic-bezier(.2, .8, .2, 1); color: var(--ink); }
.sheet.full { height: 92dvh; }
.sheet-h { padding: 12px 16px; display: flex; align-items: center; gap: 10px; background: var(--sheet-h); border-radius: 24px 24px 0 0; border-bottom: 1px solid var(--line); }
.sheet-h h2 { margin: 0; font-size: 18px; font-weight: 800; flex: 1; }
.sheet-h .x { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--ink); }
.sheet-b { padding: 14px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.sheet-f { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: var(--sheet-h); border-top: 1px solid var(--line); display: flex; gap: 10px; }
.sheet .card.solid, .sheet .card { background: var(--sheet-h); }
@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Thông báo ---------- */
#toast-root { position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: calc(min(480px, 100%) - 32px); pointer-events: none; }
.toast { background: var(--toast); color: #fff; padding: 13px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); border: 1px solid rgba(103, 232, 249, .2); animation: up .2s ease; display: flex; gap: 10px; align-items: center; }
.toast.err { background: #7F1D1D; border-color: rgba(248, 113, 113, .5); }
.toast.ok { background: #065F46; border-color: rgba(52, 211, 153, .5); }
.banner { border-radius: 14px; padding: 12px 14px; font-size: 13px; font-weight: 600; display: flex; gap: 10px; align-items: flex-start; border: 1px solid transparent; }
.banner.red { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--danger); }
.banner.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn); }
.banner.blue { background: var(--blue-l); color: var(--blue-d); border-color: var(--line); }
.offline { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 60; background: #78350F; color: #fff; font-size: 12px; font-weight: 600; padding: 4px 14px; border-radius: 0 0 12px 12px; }

/* ---------- Biểu đồ cột ---------- */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 8px; }
.bars .bc { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .bc i { width: 100%; max-width: 26px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--p2), var(--p1)); min-height: 3px; }
:root[data-mode="dark"] .bars .bc i { box-shadow: 0 0 10px rgba(var(--p-rgb), .35); }
.bars .bc span { font-family: var(--mono); font-size: 10px; color: var(--muted); white-space: nowrap; }

/* ---------- Đăng nhập ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; }
.login .top { background: var(--hdr); border-bottom: 1px solid var(--hdr-line); color: #EEF4FF; padding: 56px 24px 90px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.login .top img { width: 96px; height: 96px; border-radius: 26px; box-shadow: 0 0 34px rgba(var(--p-rgb), .5); }
.brand { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.brand b { color: var(--cyan-l); }
.login > .card { margin: -56px 16px 0; box-shadow: var(--shadow); padding: 22px 18px; display: flex; flex-direction: column; gap: 14px; background: var(--sheet-h); }
.login .body .card { background: var(--sheet-h); }

/* ---------- Phiếu ---------- */
.doc-line { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.doc-line:last-child { border-bottom: 0; }
.doc-line .right { font-family: var(--mono); }
.receipt-img { width: 100%; border-radius: 14px; border: 1px solid var(--line); background: #fff; }
.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mitem { padding: 16px; display: flex; flex-direction: column; gap: 10px; color: var(--ink); text-align: left; }
.mitem .t { font-weight: 700; font-size: 15px; }
.mitem .s { font-size: 12px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .nav, .paybar, .fab { display: none; } }

/* ---------- Bảng màu theo mệnh ---------- */
.pal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pal { border: 2px solid var(--line); background: var(--surface); border-radius: 16px; padding: 8px; display: flex; flex-direction: column; gap: 6px; text-align: left; color: var(--ink); min-width: 0; }
.pal.on { border-color: var(--accent); box-shadow: var(--glow-sel); }
.pal .sw { height: 46px; border-radius: 11px; position: relative; overflow: hidden; }
.pal .sw i { position: absolute; right: 7px; bottom: 7px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85); }
.pal .n { font-size: 12px; font-weight: 700; line-height: 1.25; }
.pal .k { font-size: 10px; color: var(--muted); font-family: var(--mono); letter-spacing: .5px; text-transform: uppercase; }
.menh-h { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; }
.menh-h b { font-size: 15px; } .menh-h span { font-size: 12px; color: var(--muted); }
.menh-res { border-radius: 14px; padding: 12px 14px; background: var(--cyan-bg); border: 1px solid var(--line); font-size: 14px; }

/* ===== Đợt 1: mã vạch, đơn vị, QR chuyển khoản, xả hàng, mô-đun ===== */
.banner.green { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.hdr .scan-btn { width: 46px; height: 46px; }
.scan-box { position: relative; border-radius: 18px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; width: 100%; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.scan-frame i { width: 78%; height: 42%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); position: relative; }
.scan-frame i::after { content: ""; position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; background: #F87171; box-shadow: 0 0 10px #F87171; animation: scanline 1.6s ease-in-out infinite; }
@keyframes scanline { 0%, 100% { transform: translateY(-40px); } 50% { transform: translateY(40px); } }
@media (prefers-reduced-motion: reduce) { .scan-frame i::after { animation: none; } }
.scan-msg { display: flex; gap: 8px; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: var(--ink); min-height: 24px; text-align: center; }
.unit-chips .chip { height: 32px; font-size: 13px; }
.unit-row { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.qr-pay { display: flex; gap: 14px; align-items: center; background: #fff; color: #0B1220; border-radius: 16px; padding: 12px; border: 2px solid var(--p1); }
.qr-pay img { width: 46%; max-width: 220px; aspect-ratio: 1; image-rendering: pixelated; flex-shrink: 0; }
.qr-pay .qr-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.qr-pay .lbl { color: var(--p1); }
.qr-pay .muted { color: #44546B; }
.usage { color: var(--accent); font-weight: 600; display: flex; gap: 4px; align-items: flex-start; margin-top: 2px; }
.usage svg { margin-top: 2px; flex-shrink: 0; }
.usage-box { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: rgba(var(--p1-rgb), .08); color: var(--ink); font-size: 14px; }
.usage-box svg { color: var(--accent); margin-top: 2px; flex-shrink: 0; }
.clr { border-left: 4px solid var(--warn); }
.clr.red { border-left-color: var(--danger); }
.clr-tip { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-ink); }
.clr.red .clr-tip { background: var(--danger-bg); color: var(--danger-ink); }
.clr-tip svg { flex-shrink: 0; margin-top: 1px; }
.check-row { display: flex; gap: 12px; align-items: center; font-size: 14px; cursor: pointer; }
.check-row input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--p1); flex-shrink: 0; }
.pts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pts li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.pts li svg { color: var(--ok); flex-shrink: 0; margin-top: 2px; }
.plan-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--soft); color: var(--ink); text-align: left; width: 100%; }
.sec-title a { cursor: pointer; }
.btn.stack { flex-direction: column; height: 64px; gap: 3px; font-size: 13px; padding: 0 6px; }
/* ===== Đợt 2 ===== */
.agebar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--line); }
.agebar i, .dotk { background: var(--ok); }
.agebar .a2, .dotk.a2 { background: var(--warn); } .agebar .a3, .dotk.a3 { background: var(--danger); }
.dotk { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.promo-box { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--ok-bg); color: var(--ok); font-size: 13px; }
.promo-box svg { flex-shrink: 0; margin-top: 1px; }
.linkbox { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line-strong); word-break: break-all; }
.sheet-f .btn.line { white-space: nowrap; }

/* Đăng nhập Google (màu nút theo nhận diện của Google) */
.btn.gbtn { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; font-weight: 600; }
.btn.gbtn:active { background: #f2f2f2; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
