/* ==========================================================================
   Quản lý bán hàng & Kế Toán Thuế · Hệ thống giao diện
   Tác giả: Vương Đồng Khánh (VDK)
   ========================================================================== */
:root {
  --accent: #8a5a32;
  --accent-ink: #fff;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, var(--surface));
  --accent-line: color-mix(in srgb, var(--accent) 30%, var(--line));
  --accent-strong: color-mix(in srgb, var(--accent) 82%, #000);
  --bg: #f6f4f0;
  --surface: #ffffff;
  --surface-2: #faf8f5;
  --surface-3: #f1ede7;
  --line: #e6e0d7;
  --line-2: #efeae3;
  --text: #221d18;
  --text-2: #4a433b;
  --muted: #7a7067;
  --pos: #12805a;
  --neg: #c9353f;
  --warn: #b26a00;
  --pos-soft: #e5f5ee;
  --neg-soft: #fdecee;
  --warn-soft: #fdf3e2;
  --shadow-sm: 0 1px 2px rgba(40, 28, 16, .06);
  --shadow: 0 1px 2px rgba(40, 28, 16, .05), 0 6px 20px rgba(40, 28, 16, .06);
  --shadow-lg: 0 24px 64px rgba(30, 20, 10, .22);
  --r-sm: 9px; --r: 13px; --r-lg: 18px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --side-w: 248px;
  --top-h: 64px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #13110e; --surface: #1c1915; --surface-2: #211d19; --surface-3: #2a2520;
  --line: #342e27; --line-2: #2c2722; --text: #f2ede6; --text-2: #d6cfc5; --muted: #a0968a;
  --pos: #3fc28e; --neg: #f0646c; --warn: #f0a63a; --pos-soft: #143327; --neg-soft: #3a1a1d; --warn-soft: #3a2a12;
  --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--surface));
  --accent-line: color-mix(in srgb, var(--accent) 45%, var(--line));
  --accent-strong: color-mix(in srgb, var(--accent) 70%, #fff);
  --shadow-sm: none; --shadow: 0 1px 0 rgba(255, 255, 255, .02); --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------- Nền tảng ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .45; }
input, select, textarea { min-width: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
.hidden { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; }
.ic.flip { transform: rotate(180deg); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.center { text-align: center; }
small { font-size: .78em; font-weight: 500; }
.link { color: var(--accent-strong); font-weight: 600; text-decoration: underline; }

/* ---------- Khung ứng dụng ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { scrollbar-width: thin; scrollbar-color: var(--line) transparent; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; overflow-y: auto; z-index: 30; }
.brand { width: 100%; display: flex; align-items: center; gap: 11px; padding: 8px; margin-bottom: 12px; border-radius: 14px; text-align: left; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.brand:hover { background: var(--surface-2); border-color: var(--line); }
.brand-switch { margin-left: auto; color: var(--muted); display: grid; }
.brand-text { flex: 1; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); flex: none; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.brand-mark .ic { width: 23px; height: 23px; }
.brand-mark.lg { width: 60px; height: 60px; border-radius: 18px; }
.brand-mark.lg .ic { width: 34px; height: 34px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: 12px; color: var(--muted); }
.side-nav { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.nav-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 10px 6px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--text-2); font-weight: 500; text-align: left; position: relative; transition: background .15s, color .15s; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 650; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { font-style: normal; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; display: grid; place-items: center; background: var(--neg); color: #fff; }
.nav-badge.soft { background: var(--accent); }
.side-foot { padding: 14px 8px 2px; border-top: 1px solid var(--line-2); margin-top: 14px; display: grid; gap: 8px; }
.storage-chip { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--pos) 18%, transparent); }
.dot.bad, .dot.off { background: var(--muted); box-shadow: none; }
.credit { font-size: 11.5px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 25; height: var(--top-h); display: flex; align-items: center; gap: 16px; padding: 0 24px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line-2); }
.top-title { display: none; align-items: center; gap: 9px; font-size: 17px; }
.mobile-brand { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.mobile-brand svg { width: 19px; height: 19px; }
.top-search { position: relative; flex: 1; max-width: 560px; }
.top-search .search-field { height: 42px; background: var(--surface); }
.top-search kbd { font: 600 11px var(--font); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; display: none; max-height: 60vh; overflow: auto; }
.search-results.open { display: block; }
.sr-item { width: 100%; display: grid; grid-template-columns: 86px 1fr auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 9px; text-align: left; }
.sr-item:hover, .sr-item:focus { background: var(--surface-3); }
.sr-item em { font-style: normal; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.sr-item span { font-size: 13px; color: var(--muted); }
.sr-empty { padding: 14px; color: var(--muted); text-align: center; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.shift-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.content { padding: 24px; width: 100%; max-width: 1640px; margin: 0 auto; }
.page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Nút & điều khiển ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 15px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .15s, border-color .15s, transform .08s; box-shadow: var(--shadow-sm); }
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover:not(:disabled) { background: var(--accent-strong); }
:root[data-theme="dark"] .btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 85%, #fff); }
.btn.danger { background: var(--neg); border-color: transparent; color: #fff; }
.btn.danger-ghost { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 30%, var(--line)); }
.btn.danger-ghost:hover:not(:disabled) { background: var(--neg-soft); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--accent-strong); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.lg { height: 46px; padding: 0 20px; font-size: 15px; }
.btn.xl { height: 52px; font-size: 16px; flex: 1; }
.btn .badge { margin-left: 2px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; display: inline-grid; place-items: center; color: var(--text-2); flex: none; }
.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.search-field { display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: var(--muted); min-width: 0; }
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.search-field input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); height: 100%; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 11px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { height: 34px; padding: 0 13px; border-radius: 8px; font-size: 13.5px; font-weight: 550; color: var(--text-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; transition: background .15s, color .15s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 650; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
:root[data-theme="dark"] .seg button.on { background: var(--surface-2); box-shadow: 0 0 0 1px var(--line); }
.seg button small { color: var(--muted); font-weight: 500; }
.chips { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 34px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 550; white-space: nowrap; color: var(--text-2); }
.chip:hover { border-color: var(--accent-line); color: var(--text); }
.chip.on { background: var(--text); border-color: var(--text); color: var(--surface); }
.badge { display: inline-flex; align-items: center; height: 21px; padding: 0 8px; border-radius: 99px; font-size: 11.5px; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap; vertical-align: middle; }
.badge.green { background: var(--pos-soft); color: var(--pos); }
.badge.red { background: var(--neg-soft); color: var(--neg); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input, .check-row input { width: 17px; height: 17px; accent-color: var(--accent); }
.check-row { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.check-row label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

/* ---------- Tiêu đề trang ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 750; }
.page-head p { color: var(--muted); margin-top: 3px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 24px; border-radius: var(--r-lg); background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%), linear-gradient(135deg, var(--surface), var(--accent-soft)); border: 1px solid var(--accent-line); }
.hero h1 { font-size: 28px; font-weight: 800; margin: 2px 0 4px; }
.hero p { color: var(--text-2); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-strong); }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar .chips { flex: 1; min-width: 0; }
.period-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.custom-range { display: flex; align-items: center; gap: 6px; }
.custom-range input { height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--surface); }
.type-switch { display: flex; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 15px 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi.feature { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.kpi.feature .kpi-label, .kpi.feature .kpi-sub { color: color-mix(in srgb, var(--accent-ink) 80%, transparent); }
.kpi.feature .kpi-ic { background: rgba(255, 255, 255, .18); color: var(--accent-ink); }
.kpi.feature .delta { background: rgba(255, 255, 255, .18); color: var(--accent-ink); }
.kpi-ic { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); }
.kpi-ic .ic { width: 17px; height: 17px; }
.kpi-label { font-size: 13px; font-weight: 550; color: var(--muted); padding-right: 36px; }
.kpi-value { font-size: 23px; font-weight: 750; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value small { font-size: 13px; font-weight: 550; color: inherit; opacity: .7; }
.kpi-value.pos { color: var(--pos); } .kpi-value.neg { color: var(--neg); }
.kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 99px; font-size: 11.5px; font-weight: 700; }
.delta.up { background: var(--pos-soft); color: var(--pos); }
.delta.down { background: var(--neg-soft); color: var(--neg); }
.delta.flat { background: var(--surface-3); color: var(--muted); }

/* ---------- Bảng điều khiển ---------- */
.grid { display: grid; gap: 18px; }
.cols-main { grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h3 { font-size: 16px; font-weight: 700; }
.sub-title { font-size: 14px; font-weight: 700; margin: 16px 0 8px; }
.empty { display: grid; place-items: center; text-align: center; gap: 8px; padding: 28px 12px; color: var(--muted); }
.empty > .ic { width: 30px; height: 30px; opacity: .55; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); font-size: 14px; }
.notice .ic { color: var(--warn); margin-top: 1px; }
.notice.info { background: var(--accent-soft); border-color: var(--accent-line); }
.notice.info .ic { color: var(--accent-strong); }
.notice.danger { background: var(--neg-soft); border-color: color-mix(in srgb, var(--neg) 30%, transparent); }
.notice.danger .ic { color: var(--neg); }
.notice.warn .ic { color: var(--warn); }
.alerts { display: grid; gap: 8px; }
.alert-item { display: flex; gap: 11px; align-items: flex-start; text-align: left; padding: 11px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 14px; color: var(--text-2); transition: border-color .15s; }
.alert-item:hover { border-color: var(--accent-line); }
.alert-item .ic { margin-top: 1px; }
.alert-item.warn .ic { color: var(--warn); }
.alert-item.danger .ic { color: var(--neg); }
.alert-item.info .ic { color: var(--accent-strong); }
.alert-item b { color: var(--text); }
.all-good { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 12px; background: var(--pos-soft); }
.all-good > .ic { width: 28px; height: 28px; color: var(--pos); }
.all-good p { color: var(--muted); font-size: 13.5px; }

/* ---------- Bảng dữ liệu ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr[data-act] { cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.is-void td { color: var(--muted); }
.table tr.is-void td b { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--neg) 60%, transparent); }
.table tr.empty-row td { text-align: center; color: var(--muted); padding: 26px 12px; }
.table tr.cont-line td { border-top: 0; }
.table tr.first-line td { border-top: 1px solid var(--line); }
.table tr.total-row td { background: var(--surface-2); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 320px; color: var(--text-2); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters .search-field { flex: 1; min-width: 220px; }
.filters select { height: 40px; border: 1px solid var(--line); border-radius: 11px; padding: 0 12px; background: var(--surface); }
.meter { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; min-width: 70px; }
.meter span { display: block; height: 100%; border-radius: 99px; background: var(--pos); }
.meter.low span { background: var(--warn); }
.meter.out span { background: var(--neg); }
.meter.big { height: 12px; margin: 12px 0 6px; }

/* ---------- Biểu đồ ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line-2); stroke-width: 1; }
.chart .axis { font-size: 12px; fill: var(--muted); font-family: var(--font); }
.chart .bar-val { font-size: 11.5px; fill: var(--text-2); font-weight: 600; font-family: var(--font); }
.chart rect { transition: opacity .15s; }
.chart g:hover rect { opacity: .8; }
.share-list { display: grid; gap: 12px; }
.share-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.share-top span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-top b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.share-bar { height: 8px; border-radius: 99px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.share-bar span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.share-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 5px; }
.heat-cell { height: 40px; border-radius: 8px; background: color-mix(in srgb, var(--accent) calc(var(--a) * 100%), var(--surface-3)); display: grid; place-items: end center; padding-bottom: 3px; }
.heat-cell span { font-size: 10.5px; font-weight: 600; color: var(--text-2); background: color-mix(in srgb, var(--surface) 75%, transparent); padding: 0 4px; border-radius: 4px; }
.pl { display: grid; }
.pl-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.pl-row b { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.pl-row.sub { font-weight: 700; border-bottom-style: solid; }
.pl-row.sub b { font-weight: 750; }
.pl-row.grand { font-size: 17px; font-weight: 800; border-bottom: 0; padding-top: 12px; }
.pl-row.grand b { font-weight: 800; color: var(--accent-strong); }
.sum-row { display: flex; justify-content: space-between; gap: 10px; font-variant-numeric: tabular-nums; }

/* ---------- Biểu mẫu ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label, .opt-block > label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea, .opt-block input, .opt-block select, .meta-input { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.field input[readonly] { background: var(--surface-2); color: var(--muted); }
.field input:focus, .field select:focus, .opt-block input:focus, .opt-block select:focus, .meta-input:focus, .input-unit:focus-within { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.field input[type=file] { font-size: 13px; }
.hint { font-size: 12.5px; color: var(--muted); }
.input-unit { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); height: 42px; overflow: hidden; }
.input-unit input { flex: 1; border: 0 !important; box-shadow: none !important; height: 100% !important; background: transparent !important; padding: 0 10px; outline: 0; width: 100%; }
.input-unit span { padding: 0 10px; color: var(--muted); font-size: 13px; white-space: nowrap; background: var(--surface-2); align-self: stretch; display: grid; place-items: center; border-left: 1px solid var(--line-2); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.form-actions.left { justify-content: flex-start; }

/* ---------- Hộp thoại ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(20, 14, 8, .45); display: grid; place-items: center; padding: 20px; animation: fadeIn .15s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { width: min(680px, 100%); max-height: min(88vh, 900px); display: flex; flex-direction: column; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop .18s cubic-bezier(.2, .9, .3, 1.2); border: 1px solid var(--line); }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal.sm { width: min(480px, 100%); }
.modal.md { width: min(600px, 100%); }
.modal.lg { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px 22px; }
.modal-head h3 { font-size: 18px; font-weight: 700; }
.modal-body { padding: 4px 22px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 14px 22px; border-top: 1px solid var(--line-2); background: var(--surface-2); border-radius: 0 0 20px 20px; }
.modal-foot .danger-ghost { margin-right: auto; }
.ask { font-size: 15px; color: var(--text-2); line-height: 1.6; }
.sheet-root { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.sheet-root.open { pointer-events: auto; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 14, 8, .4); animation: fadeIn .15s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; background: var(--surface); border-radius: 22px 22px 0 0; padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); animation: up .22s cubic-bezier(.2, .9, .3, 1); max-height: 86vh; overflow: auto; }
@keyframes up { from { transform: translateY(100%); } }
.sheet-grip { width: 42px; height: 5px; border-radius: 9px; background: var(--line); margin: 2px auto 8px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sheet-head h3 { font-size: 17px; }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.more-grid button { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 14px 6px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 12.5px; font-weight: 600; color: var(--text-2); text-align: center; }
.more-grid button .ic { width: 22px; height: 22px; color: var(--accent-strong); }
.more-grid button.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); }
#toasts { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 9px; padding: 11px 16px; border-radius: 12px; background: var(--text); color: var(--surface); font-weight: 550; font-size: 14px; box-shadow: var(--shadow-lg); animation: toastIn .2s ease-out; }
.toast .ic { color: #5fd3a0; }
.toast.danger .ic { color: #ff8a90; }
.toast.warn .ic { color: #ffc260; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Bán hàng ---------- */
.page-pos { gap: 0; }
.pos-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; align-items: start; }
.pos-catalog { display: grid; gap: 12px; min-width: 0; }
.pos-toolbar { display: flex; gap: 10px; }
.pos-toolbar .search-field { flex: 1; height: 44px; background: var(--surface); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.product { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 14px; min-height: 132px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: left; box-shadow: var(--shadow-sm); transition: border-color .15s, transform .1s, box-shadow .15s; }
.product:hover { border-color: var(--accent-line); box-shadow: var(--shadow); }
.product:active { transform: scale(.97); }
.product.bump { animation: bump .3s; }
@keyframes bump { 40% { transform: scale(.95); border-color: var(--accent); } }
.product.is-out { opacity: .6; }
.p-emoji { font-size: 30px; line-height: 1; margin-bottom: 6px; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; background: var(--surface-3); }
.p-name { font-weight: 650; font-size: 14.5px; line-height: 1.3; }
.p-price { font-weight: 750; color: var(--accent-strong); font-variant-numeric: tabular-nums; margin-top: auto; }
.stock { font-size: 11.5px; font-weight: 650; }
.stock.low { color: var(--warn); }
.stock.out { color: var(--neg); }
.in-cart { position: absolute; top: 10px; right: 10px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 12.5px; font-weight: 750; display: grid; place-items: center; }
.pos-order { position: sticky; top: calc(var(--top-h) + 16px); height: calc(100vh - var(--top-h) - 40px); min-height: 520px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.order-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 10px; }
.order-head h3 { font-size: 17px; }
.order-head > div:first-child { display: flex; align-items: baseline; gap: 10px; }
.order-head-actions { display: flex; gap: 4px; }
.only-mobile { display: none; }
.order-meta { padding: 0 16px 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--line-2); }
.order-meta .seg { width: 100%; }
.order-meta .seg button { flex: 1; padding: 0 6px; font-size: 12.5px; }
.meta-row { display: grid; grid-template-columns: 1fr 120px; gap: 8px; }
.meta-btn { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; text-align: left; min-width: 0; }
.meta-btn span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; font-size: 14px; }
.meta-btn em { font-style: normal; font-size: 12px; color: var(--accent-strong); font-weight: 650; }
.meta-input { height: 40px !important; }
.cart-lines { flex: 1; overflow-y: auto; padding: 4px 8px; }
.cart-empty { height: 100%; min-height: 160px; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted); text-align: center; }
.cart-empty .ic { width: 36px; height: 36px; opacity: .4; }
.line { display: flex; gap: 10px; padding: 10px 8px; border-bottom: 1px solid var(--line-2); }
.line:last-child { border-bottom: 0; }
.line-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; border-radius: 8px; }
.line-main:hover .line-name { color: var(--accent-strong); }
.line-name { font-weight: 650; font-size: 14.5px; }
.line-opts { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.line-unit { font-size: 12.5px; color: var(--text-2); }
.line-unit em { font-style: normal; color: var(--warn); font-weight: 600; }
.line-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.line-side b { font-variant-numeric: tabular-nums; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.stepper button { width: 32px; height: 32px; display: grid; place-items: center; color: var(--text-2); }
.stepper button:hover { background: var(--surface-3); }
.stepper button .ic { width: 15px; height: 15px; }
.stepper span { min-width: 30px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper.lg button { width: 44px; height: 44px; }
.stepper.lg span { min-width: 44px; font-size: 17px; }
.order-foot { border-top: 1px solid var(--line); padding: 12px 16px 16px; display: grid; gap: 7px; background: var(--surface-2); }
.discount-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.discount-input { display: flex; gap: 6px; align-items: center; }
.discount-input input { width: 104px; height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; text-align: right; background: var(--surface); }
.discount-input .seg button { height: 30px; padding: 0 10px; }
.order-foot .sum-row { font-size: 14px; color: var(--text-2); }
.order-foot .sum-row.muted { color: var(--muted); }
.sum-row.grand { font-size: 19px; font-weight: 800; color: var(--text); padding-top: 4px; }
.order-actions { display: flex; gap: 8px; margin-top: 6px; }
.order-actions .btn:first-child { height: 52px; }
.order-actions .btn.xl span { font-variant-numeric: tabular-nums; opacity: .9; }
.cart-bar, .cart-backdrop { display: none; }
.opt-block { display: grid; gap: 7px; margin-bottom: 16px; }
.opt-block .seg { width: 100%; }
.opt-block .seg button { flex: 1; height: 42px; flex-direction: column; gap: 0; justify-content: center; line-height: 1.15; }
.opt-row { display: flex; gap: 14px; align-items: flex-end; }
.opt-row .grow { flex: 1; }
.toggle-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.tchip { height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; font-weight: 550; font-size: 13.5px; }
.tchip small { color: var(--muted); }
.tchip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.pick-list { display: grid; gap: 6px; margin-top: 10px; max-height: 50vh; overflow: auto; }
.pick-item { display: flex; justify-content: space-between; gap: 10px; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line-2); text-align: left; }
.pick-item:hover { border-color: var(--accent-line); }
.pick-item.on { background: var(--accent-soft); border-color: var(--accent-line); }
.pick-item span { color: var(--muted); font-size: 13px; }
.held { display: flex; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.held > div:first-child { display: grid; gap: 2px; min-width: 0; }
.held-actions { display: flex; align-items: center; gap: 6px; }
.pay-total { text-align: center; padding: 16px; border-radius: 14px; background: var(--accent-soft); margin-bottom: 16px; display: grid; gap: 2px; }
.pay-total span { font-size: 13px; color: var(--text-2); font-weight: 550; }
.pay-total b { font-size: 32px; font-weight: 800; letter-spacing: -.02em; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.pay-total em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.quick-cash { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 12px; }
.change-box { padding: 12px 14px; border-radius: 12px; background: var(--pos-soft); color: var(--text); margin-bottom: 16px; font-size: 14.5px; }
.change-box b { font-size: 18px; color: var(--pos); }
.change-box.neg { background: var(--neg-soft); }
.change-box.neg b { color: var(--neg); }
.qr-pay { display: flex; gap: 16px; align-items: center; padding: 14px; border: 1px dashed var(--line); border-radius: 14px; margin-bottom: 16px; background: var(--surface-2); }
.qr-pay img { width: 170px; height: 170px; object-fit: contain; border-radius: 10px; background: #fff; flex: none; }
.qr-pay > div { display: grid; gap: 3px; }
.qr-amount { font-size: 22px; color: var(--accent-strong); }
.receipt-preview { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; background: #fffef9; color: #222; border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; max-width: 360px; margin: 0 auto; box-shadow: 0 8px 24px rgba(0, 0, 0, .06); }
.receipt-preview h2 { font-size: 16px; }
.receipt-preview .c { text-align: center; } .receipt-preview .r { text-align: right; } .receipt-preview .b { font-weight: 700; }
.receipt-preview table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.receipt-preview th { text-align: left; border-bottom: 1px dashed #999; font-size: 12px; padding: 3px 0; }
.receipt-preview td { padding: 4px 0; vertical-align: top; }
.receipt-preview .row { display: flex; justify-content: space-between; gap: 8px; margin: 2px 0; }
.receipt-preview .total { font-size: 15px; font-weight: 700; border-top: 1px dashed #999; padding-top: 5px; margin-top: 5px; }
.receipt-preview hr { border: 0; border-top: 1px dashed #999; margin: 8px 0; }
.receipt-preview .note { font-size: 11.5px; color: #666; }

/* ---------- Menu ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.menu-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 15px; display: grid; gap: 5px; box-shadow: var(--shadow-sm); }
.menu-card.inactive { opacity: .62; }
.mc-top { display: flex; align-items: center; gap: 8px; }
.mc-emoji { width: 46px; height: 46px; border-radius: 13px; background: var(--surface-3); display: grid; place-items: center; font-size: 26px; margin-right: auto; }
.menu-card h4 { font-size: 16px; margin-top: 6px; }
.mc-price { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 4px; }
.mc-price b { font-size: 19px; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.mc-price span { font-size: 13px; color: var(--muted); }
.mc-bar { height: 6px; border-radius: 9px; background: var(--surface-3); overflow: hidden; }
.mc-bar span { display: block; height: 100%; border-radius: 9px; }
.mc-bar .good, .margin-pill.good { background: var(--pos); }
.mc-bar .ok, .margin-pill.ok { background: var(--warn); }
.mc-bar .bad, .margin-pill.bad { background: var(--neg); }
.margin-pill { display: inline-flex; height: 22px; align-items: center; padding: 0 8px; border-radius: 99px; color: #fff; font-size: 12px; font-weight: 700; }
.mc-actions { display: flex; gap: 6px; margin-top: 8px; }
.mc-actions .icon-btn { margin-left: auto; width: 32px; height: 32px; border: 1px solid var(--line); }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.emoji-pick button { width: 38px; height: 38px; border-radius: 10px; font-size: 20px; border: 1px solid var(--line-2); }
.emoji-pick button.on { border-color: var(--accent); background: var(--accent-soft); }
.emoji-pick input { width: 64px !important; text-align: center; font-size: 18px; }
.size-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.size-cell { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; }
.size-cell span { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.size-cell em { font-style: normal; color: var(--muted); font-size: 13px; height: 38px; display: flex; align-items: center; }
.size-cell input[type=number] { height: 38px !important; }
.recipe-rows { display: grid; gap: 8px; margin-bottom: 10px; }
.recipe-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 100px 38px; gap: 8px; align-items: center; }
.recipe-row select { height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--surface); }
.rc-cost { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 13.5px; }
.recipe-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2); }
.recipe-sum > div { display: grid; gap: 2px; }
.recipe-sum span { font-size: 12.5px; color: var(--muted); }
.recipe-sum b { font-size: 17px; font-variant-numeric: tabular-nums; }
.recipe-sum .full { grid-column: 1 / -1; padding-top: 8px; border-top: 1px dashed var(--line); }
.recipe-sum .full b { font-size: 15px; }
.pur-line { display: grid; grid-template-columns: minmax(0, 1.4fr) 130px 140px 130px 110px 38px; gap: 8px; align-items: center; margin-bottom: 8px; }
.pur-line select, .pur-line > input { height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--surface); width: 100%; }
.pl-total { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.pur-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 15px; }
.pur-foot b { font-size: 18px; color: var(--accent-strong); }
.stocktake { display: grid; gap: 6px; max-height: 56vh; overflow: auto; }
.st-row { display: grid; grid-template-columns: 1fr 170px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.st-row > div:first-child { display: grid; }

/* ---------- Sổ quỹ ---------- */
.fund-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.fund { display: grid; gap: 4px; text-align: left; padding: 15px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: border-color .15s; }
button.fund:hover { border-color: var(--accent-line); }
.fund.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.fund span { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.fund span .ic { color: var(--accent-strong); }
.fund b { font-size: 21px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.fund em { font-style: normal; font-size: 12px; color: var(--muted); }
.fund.total { background: var(--text); color: var(--surface); border-color: transparent; }
.fund.total span, .fund.total em { color: color-mix(in srgb, var(--surface) 70%, transparent); }
.fund.total span .ic { color: inherit; }
.shift-panel { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 14px 18px; }
.shift-info { display: flex; align-items: center; gap: 12px; }
.shift-info > div:last-child { display: grid; }
.shift-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); }
.shift-dot.on { background: var(--pos); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pos) 20%, transparent); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--pos) 8%, transparent); } }
.shift-stats { display: flex; flex-wrap: wrap; gap: 6px 22px; flex: 1; }
.shift-stats > div { display: grid; }
.shift-stats span { font-size: 12px; color: var(--muted); }
.shift-stats b { font-variant-numeric: tabular-nums; }
.shift-stats.big { padding: 14px; border-radius: 14px; background: var(--surface-2); }
.shift-panel .btn { margin-left: auto; }

/* ---------- Thuế & cài đặt ---------- */
.law { margin: 0; padding-left: 18px; display: grid; gap: 10px; color: var(--text-2); font-size: 14px; line-height: 1.6; }
.law b { color: var(--text); }
.threshold { margin-bottom: 14px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.theme-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font-weight: 600; text-align: left; }
.theme-opt span { width: 26px; height: 26px; border-radius: 8px; flex: none; }
.theme-opt.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--text) inset; }
.qr-saved { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.qr-saved img { width: 120px; height: 120px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.data-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin: 14px 0; }
.data-stats > div { padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); display: grid; }
.data-stats b { font-size: 19px; }
.data-stats span { font-size: 12.5px; color: var(--muted); }
.danger-zone { border-color: color-mix(in srgb, var(--neg) 30%, var(--line)); }
.about { display: flex; align-items: center; gap: 14px; padding: 18px; }
.about > div:last-child { display: grid; gap: 2px; }
.about span { font-size: 13px; color: var(--muted); }

/* ---------- Màn hình khóa ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(80% 60% at 50% 0%, var(--accent-soft), var(--bg)); }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 30px 26px 22px; box-shadow: var(--shadow-lg); display: grid; justify-items: center; gap: 6px; text-align: center; }
.login-card h2 { font-size: 22px; margin-top: 10px; }
.pin-dots { display: flex; gap: 14px; margin: 18px 0 20px; }
.pin-dots i { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line); transition: .15s; }
.pin-dots i.on { background: var(--accent); border-color: var(--accent); transform: scale(1.1); }
.pin-dots.shake { animation: shake .4s; }
.pin-dots.shake i { border-color: var(--neg); }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px; margin-bottom: 16px; }
.keypad button { height: 64px; border-radius: 50%; width: 72px; font-size: 24px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line-2); display: grid; place-items: center; }
.keypad button:hover { background: var(--accent-soft); }
.keypad button:active { transform: scale(.94); }
.keypad .ic { width: 22px; height: 22px; }

/* ---------- Ngành hàng & sổ bán hàng ---------- */
.mode-chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px 0 8px; margin-bottom: 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--accent-line); font-size: 12.5px; font-weight: 650; color: var(--accent-strong); }
.mode-chip .ic { width: 15px; height: 15px; }
.mode-chip em { font-style: normal; font-weight: 500; color: var(--muted); padding-left: 7px; border-left: 1px solid var(--line); }
.mode-chip:hover { border-color: var(--accent); }
.ws-list { display: grid; gap: 8px; }
.ws-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; }
.ws-item.on { border-color: var(--accent-line); background: var(--accent-soft); }
.ws-item .brand-mark { width: 36px; height: 36px; border-radius: 11px; box-shadow: none; }
.ws-item .brand-mark .ic { width: 19px; height: 19px; }
.ws-text { flex: 1; min-width: 0; display: grid; }
.ws-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-text span { font-size: 12.5px; color: var(--muted); }
.ws-current { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 12px; border-radius: 14px; background: var(--accent-soft); border: 1px solid var(--accent-line); text-align: left; }
.ws-current .brand-mark { width: 38px; height: 38px; box-shadow: none; }
.ws-current > span:nth-child(2) { flex: 1; display: grid; min-width: 0; }
.ws-current em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl { display: grid; gap: 6px; align-content: start; text-align: left; padding: 14px; border: 1.5px solid var(--line); border-radius: 16px; background: var(--surface); transition: border-color .15s, background .15s; }
.tpl:hover { border-color: var(--accent-line); }
.tpl.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.tpl .brand-mark { width: 38px; height: 38px; box-shadow: none; margin-bottom: 4px; }
.tpl b { font-size: 15px; }
.tpl em { font-style: normal; font-size: 13px; color: var(--muted); line-height: 1.45; }
.start-guide .panel-head { align-items: flex-start; }
.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.step { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); transition: border-color .15s; }
.step:hover { border-color: var(--accent-line); }
.step > span:last-child { display: grid; gap: 2px; min-width: 0; }
.step b { font-size: 14px; }
.step em { font-style: normal; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.step-n { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 13px; font-weight: 750; background: var(--surface); border: 1.5px solid var(--accent-line); color: var(--accent-strong); }
.step.done { background: var(--pos-soft); border-color: transparent; }
.step.done .step-n { background: var(--pos); border-color: var(--pos); color: #fff; }
.step.done .step-n .ic { width: 15px; height: 15px; }
.step.done b { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--pos) 50%, transparent); }
.ini { width: 100%; height: 100%; display: grid; place-items: center; border-radius: inherit; font-size: 16px; font-weight: 750; letter-spacing: .02em; background: hsl(var(--h) 65% 92%); color: hsl(var(--h) 45% 30%); }
:root[data-theme="dark"] .ini { background: hsl(var(--h) 30% 24%); color: hsl(var(--h) 60% 82%); }
.p-emoji.sm { width: 38px; height: 38px; font-size: 22px; margin: 0; border-radius: 11px; flex: none; }
.p-emoji.sm .ini { font-size: 13px; }
.mc-emoji .ini { font-size: 15px; }
.p-price small { font-size: 12px; font-weight: 550; color: var(--muted); margin-left: 2px; }
.goods { display: flex; align-items: center; gap: 10px; }
.warn-t { color: var(--warn); }
.toolbar-search { width: 240px; flex: none; background: var(--surface); }
.empty.big { padding: 44px 16px; gap: 12px; }
.empty.big > .ic { width: 44px; height: 44px; }
.empty .btn { margin-top: 4px; }
.cols-hint { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.cols-hint span { font-size: 12.5px; padding: 4px 9px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); }
.import-area { width: 100%; min-height: 110px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font: 13px/1.5 ui-monospace, Consolas, monospace; background: var(--surface); resize: vertical; }
.import-area:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.stepper input { width: 64px; height: 44px; border: 0; text-align: center; font-weight: 700; font-size: 17px; background: transparent; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; }
#payDetail > .notice { margin-bottom: 16px; }

/* ---------- Nhập / xuất dữ liệu ---------- */
.imp-steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 18px; }
.imp-steps li { flex: 1; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 13.5px; font-weight: 600; color: var(--muted); }
.imp-steps li span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1.5px solid var(--line); font-size: 12px; flex: none; }
.imp-steps li span .ic { width: 14px; height: 14px; }
.imp-steps li.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); }
.imp-steps li.on span { border-color: var(--accent); color: var(--accent-strong); }
.imp-steps li.done span { background: var(--pos); border-color: var(--pos); color: #fff; }
.drop-zone { display: grid; justify-items: center; gap: 6px; padding: 30px 16px; border: 2px dashed var(--accent-line); border-radius: 18px; background: var(--surface-2); text-align: center; cursor: pointer; transition: background .15s, border-color .15s; }
.drop-zone:hover, .drop-zone.over { background: var(--accent-soft); border-color: var(--accent); }
.drop-zone.loading { opacity: .6; pointer-events: none; }
.drop-zone > .ic { width: 34px; height: 34px; color: var(--accent-strong); }
.drop-zone b { font-size: 15.5px; }
.drop-zone span { font-size: 13px; color: var(--muted); }
.imp-or { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; color: var(--muted); font-size: 13px; }
.imp-or::before, .imp-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.imp-help { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--text-2); }
.imp-help > div { display: flex; gap: 8px; flex: 1; min-width: 260px; }
.imp-help > div .ic { color: var(--accent-strong); margin-top: 1px; }
.imp-file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); margin-bottom: 12px; }
.imp-file > .ic { color: var(--accent-strong); width: 22px; height: 22px; }
.imp-file > div { flex: 1; min-width: 0; display: grid; }
.imp-file b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-file span { font-size: 12.5px; color: var(--muted); }
.imp-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.imp-opts .input-unit span { padding: 0 8px; }
.imp-opts .input-unit .check { font-size: 12.5px; gap: 5px; }
.map-grid { display: grid; gap: 6px; }
.map-row { display: grid; grid-template-columns: 190px minmax(0, 1fr) minmax(0, 180px); gap: 10px; align-items: center; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line-2); }
.map-row.ok { background: var(--pos-soft); border-color: transparent; }
.map-row.need { background: var(--warn-soft); }
.map-label { font-weight: 600; font-size: 13.5px; }
.map-label em { color: var(--neg); font-style: normal; }
.map-row select { height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 8px; background: var(--surface); min-width: 0; }
.map-sample { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 14px 0; }
.imp-stats > div { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); display: grid; }
.imp-stats b { font-size: 19px; }
.imp-stats span { font-size: 12px; color: var(--muted); }
.imp-done { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--pos-soft); }
.imp-done > .ic { width: 28px; height: 28px; color: var(--pos); }
.imp-done > div { display: grid; }
.imp-done span { font-size: 13px; color: var(--muted); }
.skip-list { display: grid; gap: 4px; max-height: 200px; overflow: auto; font-size: 13px; }
.skip-list span { display: inline-block; min-width: 70px; color: var(--muted); }
.imp-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; width: 100%; }
.imp-launch { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.imp-tile { display: grid; gap: 4px; text-align: left; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); transition: border-color .15s; }
.imp-tile:hover { border-color: var(--accent); }
.imp-tile .ic { width: 22px; height: 22px; color: var(--accent-strong); }
.imp-tile span { font-size: 12.5px; color: var(--muted); }
.exp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.exp-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; font-size: 13.5px; }
.exp-item input { width: 16px; height: 16px; accent-color: var(--accent); }
.exp-item span { flex: 1; }
.exp-item em { font-style: normal; font-size: 12px; color: var(--muted); }
.need-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); font-size: 12px; font-weight: 650; white-space: nowrap; }
.p-price.none { color: var(--warn); font-size: 13px; }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); display: inline-flex; align-items: center; gap: 6px; }
.chip.warn .ic { width: 15px; height: 15px; }
.chip.warn.on { background: var(--warn); border-color: var(--warn); color: #fff; }
.quick-bar { gap: 10px; }
.quick-panel .table td { padding: 5px 6px; }
.qe { width: 100%; min-width: 90px; height: 34px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 8px; background: var(--surface); font-size: 13.5px; }
.qe.wide { min-width: 220px; }
.qe.xs { min-width: 64px; }
.qe[type=number] { text-align: right; }
.qe:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.qe.need { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.qe.dirty { border-color: var(--accent); background: var(--accent-soft); }
.toast.has-action { pointer-events: auto; }
.toast-btn { margin-left: 6px; padding: 4px 10px; border-radius: 8px; background: rgba(255, 255, 255, .16); color: inherit; font-weight: 650; font-size: 13px; }
@media (max-width: 900px) {
  .map-row { grid-template-columns: 1fr; gap: 4px; }
  .imp-steps li { font-size: 12px; padding: 7px 8px; }
  .qe, .qe.wide, .qe.xs { min-width: 0; }
}

/* ---------- Thanh điều hướng di động ---------- */
.mobile-bottom { display: none; }

/* ==========================================================================
   Đáp ứng màn hình
   ========================================================================== */
@media (max-width: 1440px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pos-wrap { grid-template-columns: minmax(0, 1fr) 370px; }
}
@media (max-width: 1180px) {
  :root { --side-w: 76px; }
  .sidebar { padding: 14px 10px; }
  .brand-text, .brand-switch, .nav-title, .nav-item span, .side-foot { display: none; }
  .brand { padding: 4px 0; justify-content: center; }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav-group { display: grid; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--line-2); }
  .nav-group:last-child { border: 0; }
  .side-nav { gap: 8px; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .nav-item .ic { width: 21px; height: 21px; }
  .nav-item.active::before { left: -10px; }
  .nav-badge { position: absolute; top: 3px; right: 6px; min-width: 17px; height: 17px; font-size: 10px; padding: 0 4px; }
  .cols-main { grid-template-columns: 1fr; }
  .cols-3 { grid-template-columns: 1fr 1fr; }
  .fund-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pur-line { grid-template-columns: 1fr 1fr 1fr; }
  .pur-line > select:first-child { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .pos-wrap { grid-template-columns: 1fr; }
  .pos-order { position: fixed; z-index: 80; inset: auto 0 0 0; top: auto; height: min(88vh, 760px); min-height: 0; border-radius: 22px 22px 0 0; transform: translateY(105%); transition: transform .25s cubic-bezier(.2, .9, .3, 1); box-shadow: var(--shadow-lg); padding-bottom: env(safe-area-inset-bottom); }
  .pos-order.open { transform: none; }
  .pos-order.open ~ .cart-backdrop { display: block; position: fixed; inset: 0; z-index: 79; background: rgba(20, 14, 8, .42); animation: fadeIn .15s; }
  .only-mobile { display: inline-grid; }
  .cart-bar { position: fixed; z-index: 70; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 18px 0 10px; border-radius: 16px; background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 45%, transparent); font-weight: 650; }
  .cb-count { position: relative; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .18); display: grid; place-items: center; }
  .cb-count em { position: absolute; top: -5px; right: -6px; min-width: 20px; height: 20px; border-radius: 99px; background: #fff; color: var(--accent-strong); font-size: 11.5px; font-style: normal; font-weight: 800; display: grid; place-items: center; padding: 0 5px; }
  .cb-text { flex: 1; text-align: left; }
  .cart-bar b { font-size: 17px; font-variant-numeric: tabular-nums; }
  .page-pos { padding-bottom: 70px; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 0 14px; gap: 10px; height: 58px; padding-top: env(safe-area-inset-top); height: calc(58px + env(safe-area-inset-top)); }
  :root { --top-h: 58px; }
  .top-title { display: flex; }
  .top-search { display: none; }
  .top-pos { display: none; }
  .shift-chip { height: 32px; font-size: 12px; padding: 0 10px; }
  .content { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
  .page { gap: 14px; }
  .page-head h1 { font-size: 22px; }
  .hero { padding: 18px; }
  .hero h1 { font-size: 23px; }
  .kpi-grid, .kpi-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-grid.three { grid-template-columns: 1fr 1fr 1fr; }
  .kpi { padding: 13px 14px; }
  .kpi-value { font-size: 19px; }
  .kpi-ic { width: 28px; height: 28px; right: 10px; top: 10px; }
  .cols-3 { grid-template-columns: 1fr; }
  .panel { padding: 15px; border-radius: 16px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .mobile-bottom { display: flex; position: fixed; z-index: 75; left: 0; right: 0; bottom: 0; height: calc(66px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .mobile-bottom button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); }
  .mobile-bottom button .ic { width: 22px; height: 22px; }
  .mobile-bottom button.active { color: var(--accent-strong); }
  .mobile-bottom button.active .ic { stroke-width: 2.2; }
  /* Bảng → thẻ */
  .table-wrap { border: 0; overflow: visible; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 8px; background: var(--surface); }
  .table tbody tr:hover td { background: transparent; }
  .table td { display: grid; grid-template-columns: 40% minmax(0, 1fr); gap: 10px; padding: 5px 0; border: 0; text-align: left; }
  .table td::before { content: attr(data-label); font-size: 12.5px; font-weight: 600; color: var(--muted); }
  .table td[data-label=""]::before { content: none; }
  .table td[data-label=""] { display: flex; justify-content: flex-end; }
  .table .num { text-align: left; }
  .table tr.cont-line, .table tr.first-line { border-radius: 0; margin: 0; border-bottom: 0; }
  .table tr.first-line { border-radius: 12px 12px 0 0; margin-top: 8px; }
  .table tr.empty-row td { display: block; }
  .table tr.empty-row td::before { content: none; }
  .clip { max-width: none; }
  .modal-backdrop { place-items: end stretch; padding: 0; }
  .modal, .modal.sm, .modal.md, .modal.lg { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; animation: up .22s cubic-bezier(.2, .9, .3, 1); }
  .modal-foot { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .modal-foot .danger-ghost { flex: 0 0 100%; order: 3; margin: 0; }
  .recipe-row { grid-template-columns: 1fr 120px 38px; }
  .recipe-row .rc-cost { display: none; }
  .recipe-sum { grid-template-columns: 1fr 1fr; }
  .pur-line { grid-template-columns: 1fr 1fr; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
  .pur-line .pl-total { text-align: left; }
  .qr-pay { flex-direction: column; text-align: center; }
  .qr-pay img { width: 220px; height: 220px; }
  .fund b { font-size: 18px; }
  .shift-panel .btn { margin-left: 0; width: 100%; }
  #toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .opt-row { flex-direction: column; align-items: stretch; }
  .steps, .tpl-grid { grid-template-columns: 1fr; }
  .toolbar-search { width: 100%; }
  .mode-chip em { display: none; }
}
@media (max-width: 520px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .product { min-height: 118px; padding: 12px; }
  .p-emoji { width: 40px; height: 40px; font-size: 25px; }
  .kpi-grid.three { grid-template-columns: 1fr; }
  .fund-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .fund { padding: 12px; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .page-head { align-items: flex-start; }
  .meta-row { grid-template-columns: 1fr 100px; }
  .opt-block .seg button { padding: 0 4px; font-size: 12.5px; }
  .size-grid { grid-template-columns: 1fr; }
  .shift-chip { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .menu-grid { grid-template-columns: 1fr; }
  .keypad { grid-template-columns: repeat(3, 68px); }
  .keypad button { width: 68px; height: 60px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .sidebar, .topbar, .mobile-bottom, .cart-bar { display: none !important; } .app { display: block; } body { background: #fff; } }
