/* VTG Bán Hàng — CSS lõi: token, khung máy tính, khung điện thoại, thành phần dùng chung.
   Luồng khác KHÔNG sửa file này: CSS riêng ở assets/css/<nhóm>.css với tiền tố lớp của nhóm.
   Màu theo cửa hàng do Core\StyleVars in <style id="bh-vars"> ghi đè --bh-primary / -d / -l / --bh-accent.
   Không mã màu nào ngoài khối token dưới đây. */

:root {
  --bh-primary: #1d5fbf;
  --bh-primary-d: #1a54a8;
  --bh-primary-l: #e8eff9;
  --bh-on-primary: #fff;
  --bh-accent: #ffab2e;
  --bh-on-accent: #1b2420;
  --bh-bg: #f4f6f8;
  --bh-surface: #fff;
  --bh-soft: #f9fafb;
  --bh-line: #dadee4;
  --bh-text: #1b2420;
  --bh-muted: #66736d;
  --bh-ok: #1e8e4e;
  --bh-warn: #b7791f;
  --bh-danger: #c0392b;
  --bh-info: #2563a8;
  --bh-ok-l: #e6f4ec;
  --bh-warn-l: #fbf1e1;
  --bh-danger-l: #fbe9e7;
  --bh-info-l: #e6eef8;
  --bh-shadow: 0 1px 2px rgb(16 32 24 / .06), 0 6px 20px rgb(16 32 24 / .08);
  --bh-shadow-lg: 0 12px 40px rgb(16 32 24 / .22);
  --bh-backdrop: rgb(16 24 20 / .45);
  --bh-r: 6px;
  --bh-font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --bh-fs: 14px;
  --bh-top: 48px;
  --bh-menu: 44px;
  --bh-ctl: 34px;
  --bh-tap: 44px;
  --bh-gap: 12px;
  --bh-pad: 16px;
  --bh-dock: calc(56px + env(safe-area-inset-bottom));
  color-scheme: light;
}

[data-khung="dien-thoai"] {
  --bh-fs: 16px;
  --bh-top: calc(52px + env(safe-area-inset-top));
  --bh-ctl: 44px;
  --bh-pad: 12px;
}

/* ---------- nền ---------- */

*, *::before, *::after { box-sizing: border-box; }
/* display của tác giả thắng [hidden]{display:none} của trình duyệt. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
html.is-modal { overflow: hidden; }
body {
  margin: 0;
  background: var(--bh-bg);
  color: var(--bh-text);
  font: var(--bh-fs)/1.45 var(--bh-font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--bh-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--bh-focus, var(--bh-primary)); outline-offset: 1px; }
hr { border: 0; border-top: 1px solid var(--bh-line); margin: 6px 0; }
#bh-root { min-height: 100vh; min-height: 100dvh; }

.bh-i {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
/* Cỡ: mặc định 18 · menu 14 · tiêu đề, dock 24 · minh họa trạng thái rỗng 40. Phần tử con tô đặc tự khai fill ngay trên nó (Core\Icons). */
.bh-i--sm { width: 14px; height: 14px; }
.bh-i--lg { width: 24px; height: 24px; }
.bh-i--xl { width: 40px; height: 40px; }

/* Bảng xem bộ icon (#/thiet-lap/icon) */
.bh-icons { display: grid; gap: 12px; padding: 16px; }
.bh-icons-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.bh-icons-bar .bh-list-search { flex: 0 1 320px; }
.bh-icons-count { color: var(--bh-muted); }
.bh-icons-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.bh-icons-cell {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 12px 6px 8px;
  border: 1px solid var(--bh-line);
  border-radius: var(--bh-r);
  background: var(--bh-surface);
  color: var(--bh-text);
}
.bh-icons-cell:hover { border-color: var(--bh-primary); color: var(--bh-primary); }
.bh-icons-big .bh-i { width: 32px; height: 32px; }
.bh-icons-sizes { display: flex; align-items: center; gap: 8px; color: var(--bh-muted); }
.bh-icons-name { font-size: 12px; word-break: break-all; }
.bh-icons-grid.is-dark .bh-icons-cell { background: var(--bh-primary); border-color: var(--bh-primary); color: var(--bh-on-primary); }
.bh-icons-grid.is-dark .bh-icons-sizes { color: inherit; }

/* ---------- nút ---------- */

.bh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--bh-ctl);
  min-width: var(--bh-ctl);
  padding: 0 14px;
  border: 1px solid var(--bh-line);
  border-radius: var(--bh-r);
  background: var(--bh-surface);
  color: var(--bh-text);
  font-weight: 500;
  white-space: nowrap;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.bh-btn:hover { border-color: var(--bh-primary); color: var(--bh-primary); }
.bh-btn--primary { background: var(--bh-primary); border-color: var(--bh-primary-d); color: var(--bh-on-primary); }
.bh-btn--primary:hover { background: var(--bh-primary-d); color: var(--bh-on-primary); }
.bh-btn--accent { background: var(--bh-accent); border-color: var(--bh-accent); color: var(--bh-on-accent); }
.bh-btn--accent:hover { filter: brightness(.94); color: var(--bh-on-accent); border-color: var(--bh-accent); }
.bh-btn--danger { color: var(--bh-danger); border-color: var(--bh-danger); }
.bh-btn--danger:hover { background: var(--bh-danger); color: var(--bh-surface); border-color: var(--bh-danger); }
.bh-btn--ghost { border-color: transparent; background: transparent; }
.bh-btn--ghost:hover { background: var(--bh-primary-l); border-color: transparent; }
.bh-btn--sm { height: 28px; padding: 0 10px; font-size: 13px; }
.bh-btn--block { width: 100%; }
.bh-btn:disabled { opacity: .55; cursor: default; pointer-events: none; }
.bh-btn.is-busy { color: transparent !important; }
.bh-btn.is-busy::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--bh-muted);
  border-right-color: transparent;
  border-radius: 50%;
  animation: bh-spin .7s linear infinite;
}
.bh-btn--primary.is-busy::after { border-color: var(--bh-on-primary); border-right-color: transparent; }
.bh-btn--accent.is-busy::after { border-color: var(--bh-on-accent); border-right-color: transparent; }

/* ---------- huy hiệu trạng thái ---------- */

.bh-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
}
.bh-badge--ok { background: var(--bh-ok-l); color: var(--bh-ok); }
.bh-badge--warn { background: var(--bh-warn-l); color: var(--bh-warn); }
.bh-badge--danger { background: var(--bh-danger-l); color: var(--bh-danger); }
.bh-badge--info { background: var(--bh-info-l); color: var(--bh-info); }
.bh-badge--muted { background: var(--bh-bg); color: var(--bh-muted); }

.bh-dot {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bh-accent);
  color: var(--bh-on-accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* ---------- ô nhập, form ---------- */

.bh-input {
  width: 100%;
  height: var(--bh-ctl);
  padding: 0 10px;
  border: 1px solid var(--bh-line);
  border-radius: var(--bh-r);
  background: var(--bh-surface);
  min-width: 0;
}
textarea.bh-input { height: auto; padding: 8px 10px; resize: vertical; }
select.bh-input { padding-right: 6px; }
.bh-input:focus { border-color: var(--bh-primary); outline: none; box-shadow: 0 0 0 2px var(--bh-primary-l); }
.bh-input.is-num { text-align: right; }
.bh-input.is-error, .bh-field.is-error .bh-input { border-color: var(--bh-danger); }
.bh-input--sm { height: 28px; width: auto; font-size: 13px; }

.bh-form { display: grid; gap: var(--bh-gap); }
.bh-field { display: grid; gap: 4px; }
.bh-field-label { font-weight: 500; }
.bh-req { color: var(--bh-danger); }
.bh-field-hint { color: var(--bh-muted); font-size: 12px; }
.bh-field-err { color: var(--bh-danger); font-size: 12px; }
.bh-field-err:empty { display: none; }
.bh-check { display: flex; align-items: center; gap: 8px; min-height: 28px; cursor: pointer; }
.bh-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--bh-primary); flex: none; }

/* ---------- chờ, rỗng, thông báo ---------- */

@keyframes bh-spin { to { transform: rotate(360deg); } }
.bh-spinner { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 32px; color: var(--bh-muted); }
.bh-spin {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--bh-line);
  border-top-color: var(--bh-primary);
  border-radius: 50%;
  animation: bh-spin .7s linear infinite;
}
.bh-empty { display: grid; justify-items: center; gap: 12px; padding: 40px 16px; color: var(--bh-muted); text-align: center; }
.bh-empty > .bh-i { opacity: .7; }
.bh-boot-fail { padding: 15vh 16px; }

.bh-toasts {
  position: fixed;
  top: calc(var(--bh-top) + 8px);
  right: 16px;
  z-index: 1000;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
}
.bh-toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--bh-r);
  border-left: 4px solid var(--bh-ok);
  background: var(--bh-surface);
  box-shadow: var(--bh-shadow);
  cursor: pointer;
  animation: bh-in .18s ease-out;
}
.bh-toast > .bh-i { margin-top: 1px; color: var(--bh-ok); }
.bh-toast > span { flex: 1; min-width: 0; }
.bh-toast--error { border-left-color: var(--bh-danger); }
.bh-toast--error > .bh-i { color: var(--bh-danger); }
.bh-toast--warn { border-left-color: var(--bh-warn); }
.bh-toast--warn > .bh-i { color: var(--bh-warn); }
@keyframes bh-in { from { opacity: 0; transform: translateY(-6px); } }

.bh-banner { padding: 8px var(--bh-pad); background: var(--bh-warn-l); color: var(--bh-warn); font-weight: 500; text-align: center; }
.bh-banner > .bh-i { margin-right: 6px; vertical-align: -4px; }

/* ---------- hộp thoại ---------- */

.bh-dialog-wrap {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 16px;
  background: var(--bh-backdrop);
  overflow-y: auto;
}
.bh-dialog {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  max-height: 84vh;
  border-radius: calc(var(--bh-r) + 2px);
  background: var(--bh-surface);
  box-shadow: var(--bh-shadow-lg);
  animation: bh-in .16s ease-out;
}
.bh-dialog--md { max-width: 640px; }
.bh-dialog--lg { max-width: 960px; }
.bh-dialog-head { display: flex; align-items: center; gap: 8px; padding: 12px 8px 12px var(--bh-pad); border-bottom: 1px solid var(--bh-line); }
.bh-dialog-head h2 { flex: 1; font-size: 16px; }
.bh-x { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border: 0; border-radius: var(--bh-r); background: transparent; color: var(--bh-muted); font-size: 16px; }
.bh-x:hover { background: var(--bh-bg); color: var(--bh-text); }
.bh-dialog-body { padding: var(--bh-pad); overflow-y: auto; }
.bh-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px var(--bh-pad); border-top: 1px solid var(--bh-line); }
.bh-confirm { display: grid; gap: 12px; }

/* ---------- tab ---------- */

.bh-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--bh-line); overflow-x: auto; scrollbar-width: none; }
.bh-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 8px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--bh-muted);
  font-weight: 500;
  white-space: nowrap;
}
.bh-tab:hover { color: var(--bh-text); }
.bh-tab.is-active { color: var(--bh-primary); border-bottom-color: var(--bh-primary); }
.bh-tab-panel { padding-top: var(--bh-gap); }

/* ---------- menu nổi, ô gợi ý ---------- */

.bh-pop, .bh-picker {
  position: fixed;
  z-index: 950;
  min-width: 200px;
  max-width: min(420px, calc(100vw - 16px));
  border: 1px solid var(--bh-line);
  border-radius: var(--bh-r);
  background: var(--bh-surface);
  box-shadow: var(--bh-shadow);
  color: var(--bh-text);
}
.bh-pop { padding: 6px; max-height: 70vh; overflow-y: auto; }
.bh-pop-list { display: grid; gap: 2px; min-width: 220px; }
.bh-pop-title { padding: 6px 10px; }
.bh-pop-who { display: grid; padding: 6px 10px; }
.bh-pop-who small, .bh-pop-item small { color: var(--bh-muted); }
.bh-pop-item {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--bh-r);
  background: none;
  color: var(--bh-text);
  text-align: left;
}
.bh-pop-item--ic { display: flex; align-items: center; gap: 8px; }
.bh-pop-item--ic > .bh-i { color: var(--bh-muted); }
.bh-pop-item--ic.is-current > .bh-i, .bh-pop-item--ic.is-danger > .bh-i { color: inherit; }
.bh-pop-item:hover { background: var(--bh-primary-l); text-decoration: none; }
.bh-pop-item.is-current { color: var(--bh-primary); font-weight: 600; }
.bh-pop-item.is-danger { color: var(--bh-danger); }
.bh-pop-empty { padding: 10px; color: var(--bh-muted); }
.bh-picker { max-height: 360px; overflow-y: auto; }
.bh-picker-item { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--bh-line); }
.bh-picker-item:last-child { border-bottom: 0; }
.bh-picker-item.is-active, .bh-picker-item:hover { background: var(--bh-primary-l); }
.bh-picker-none { padding: 10px; color: var(--bh-muted); }

/* ---------- phân trang ---------- */

.bh-pager { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.bh-pager-n {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--bh-line);
  border-radius: var(--bh-r);
  background: var(--bh-surface);
}
.bh-pager-n:hover:not(:disabled) { border-color: var(--bh-primary); color: var(--bh-primary); }
.bh-pager-n.is-active { background: var(--bh-primary); border-color: var(--bh-primary); color: var(--bh-on-primary); }
.bh-pager-n:disabled { opacity: .4; cursor: default; }
.bh-pager-total { margin-left: 8px; color: var(--bh-muted); }

/* ================= KHUNG MÁY TÍNH ================= */

.bh-desk { min-height: 100vh; display: flex; flex-direction: column; }

.bh-top {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--bh-top);
  padding: 0 var(--bh-pad);
  background: var(--bh-surface);
  border-bottom: 1px solid var(--bh-line);
}
.bh-top-brand { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--bh-text); font-weight: 700; font-size: 15px; }
.bh-top-brand:hover { text-decoration: none; }
.bh-top-logo { width: 30px; height: 30px; border-radius: var(--bh-r); object-fit: contain; color: var(--bh-primary); }
.bh-top-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.bh-top-branch { display: flex; align-items: center; gap: 6px; color: var(--bh-muted); }
.bh-top-branch .bh-input { max-width: 220px; }
.bh-top-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.bh-top-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  min-width: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--bh-r);
  background: none;
  color: var(--bh-text);
}
.bh-top-btn:hover, .bh-top-btn[aria-expanded="true"] { background: var(--bh-bg); }
a.bh-top-btn, a.bh-top-btn:hover { text-decoration: none; }
.bh-top-btn.is-active { background: var(--bh-primary-l); color: var(--bh-primary); }
.bh-top-user span { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bh-menu {
  position: sticky;
  top: var(--bh-top);
  z-index: 90;
  display: flex;
  align-items: stretch;
  height: var(--bh-menu);
  padding: 0 var(--bh-pad);
  background: var(--bh-primary);
  color: var(--bh-on-primary);
}
.bh-menu-list { display: flex; margin: 0; padding: 0; list-style: none; }
.bh-menu-group { position: relative; display: flex; }
.bh-menu-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 14px;
  border: 0;
  background: none;
  color: var(--bh-on-primary);
  font-weight: 500;
  white-space: nowrap;
}
.bh-menu-link:hover { text-decoration: none; background: var(--bh-primary-d); }
.bh-menu-link .bh-i { width: 14px; height: 14px; opacity: .8; }
.bh-menu-link .bh-menu-ic { width: 16px; height: 16px; margin-right: 2px; opacity: 1; }
/* Màn hẹp (1024–1199): bỏ icon nhóm để 7 nhóm + nút Bán hàng vẫn vừa một dòng. */
@media (max-width: 1199px) { .bh-menu-link .bh-menu-ic { display: none; } }
.bh-menu-group.is-active > .bh-menu-link { background: var(--bh-primary-d); box-shadow: inset 0 -3px 0 var(--bh-accent); }
.bh-menu-sub {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--bh-line);
  border-radius: 0 0 var(--bh-r) var(--bh-r);
  background: var(--bh-surface);
  box-shadow: var(--bh-shadow);
}
.bh-menu-group.has-sub:hover .bh-menu-sub, .bh-menu-group.has-sub:focus-within .bh-menu-sub { display: grid; }
.bh-menu-subitem { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--bh-r); color: var(--bh-text); white-space: nowrap; }
.bh-menu-subitem > .bh-i { color: var(--bh-muted); }
.bh-menu-subitem:hover > .bh-i, .bh-menu-subitem.is-active > .bh-i { color: var(--bh-primary); }
.bh-menu-subitem:hover { background: var(--bh-primary-l); text-decoration: none; }
.bh-menu-subitem.is-active { color: var(--bh-primary); font-weight: 600; }
.bh-menu-sell {
  margin-left: auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 18px;
  border-radius: var(--bh-r);
  background: var(--bh-accent);
  color: var(--bh-on-accent);
  font-weight: 600;
}
.bh-menu-sell:hover { filter: brightness(.94); text-decoration: none; }

.bh-main { flex: 1; padding: var(--bh-pad); min-width: 0; }
.bh-page { max-width: 1880px; margin: 0 auto; }

.bh-wip { display: grid; justify-items: center; gap: 10px; padding: 12vh 16px; color: var(--bh-muted); text-align: center; }
.bh-wip .bh-i { width: 40px; height: 40px; color: var(--bh-primary); }
.bh-wip h2 { color: var(--bh-text); font-size: 18px; }

/* ---------- trang danh sách (bh/shell/list) ---------- */

.bh-list { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: var(--bh-pad); align-items: start; }
.bh-list--nofilter { grid-template-columns: minmax(0, 1fr); }
.bh-list-side { position: sticky; top: calc(var(--bh-top) + var(--bh-menu) + var(--bh-pad)); display: grid; gap: 10px; max-height: calc(100vh - var(--bh-top) - var(--bh-menu) - 2 * var(--bh-pad)); overflow-y: auto; }
.bh-filter { border-radius: var(--bh-r); background: var(--bh-surface); box-shadow: var(--bh-shadow); }
.bh-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: none;
  font-weight: 600;
}
.bh-filter-head .bh-i { width: 14px; height: 14px; color: var(--bh-muted); transition: transform .15s; }
.bh-filter.is-closed .bh-filter-head .bh-i { transform: rotate(-90deg); }
.bh-filter-body { display: grid; gap: 6px; padding: 0 12px 12px; }
.bh-filter.is-closed .bh-filter-body { display: none; }
.bh-filter-dates, .bh-filter-range { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.bh-list-main { min-width: 0; display: grid; gap: 10px; }
.bh-list-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bh-list-title { font-size: 18px; margin-right: 8px; }
.bh-list-search { position: relative; flex: 1; min-width: 220px; max-width: 480px; }
.bh-list-search .bh-i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--bh-muted); }
.bh-list-search .bh-input { padding-left: 34px; }
.bh-list-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.bh-bulkbar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--bh-r); background: var(--bh-primary-l); }
.bh-bulkbar-n { font-weight: 600; margin-right: 8px; }
.bh-colpick { display: grid; gap: 2px; padding: 4px 6px; min-width: 200px; }

.bh-table-wrap { overflow-x: auto; border-radius: var(--bh-r); background: var(--bh-surface); box-shadow: var(--bh-shadow); }
.bh-list.is-loading .bh-table-wrap { opacity: .6; pointer-events: none; }
.bh-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bh-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 40px;
  padding: 0 10px;
  background: var(--bh-primary-l);
  color: var(--bh-text);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--bh-line);
  user-select: none;
}
.bh-table th.is-sort { cursor: pointer; }
.bh-table th.is-sort:hover { color: var(--bh-primary); }
.bh-table th.is-asc > .bh-i, .bh-table th.is-desc > .bh-i { margin-left: 4px; color: var(--bh-primary); }
.bh-table td { height: 40px; padding: 4px 10px; border-bottom: 1px solid var(--bh-line); vertical-align: middle; }
.bh-table .is-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bh-table th.is-num { text-align: right; }
.bh-col-check { width: 36px; text-align: center !important; }
.bh-col-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--bh-primary); vertical-align: middle; }
.bh-row.is-click { cursor: pointer; }
.bh-row:hover { background: var(--bh-soft); }
.bh-row.is-open { background: var(--bh-primary-l); }
.bh-row.is-cancelled td { color: var(--bh-muted); }
.bh-row.is-cancelled td:not(.bh-col-check) { text-decoration: line-through; text-decoration-color: var(--bh-muted); }
.bh-row-sum td { background: var(--bh-warn-l); font-weight: 700; font-size: 14px; }
.bh-row-empty td { height: auto; }
.bh-row-detail > td { padding: 0; background: var(--bh-primary-l); }
.bh-detail {
  margin: 0 0 8px;
  padding: 12px var(--bh-pad) var(--bh-pad);
  border-left: 3px solid var(--bh-primary);
  background: var(--bh-surface);
  font-size: 14px;
  cursor: default;
}
.bh-detail-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: var(--bh-gap); padding-top: var(--bh-gap); border-top: 1px solid var(--bh-line); }
.bh-detail-actions .bh-btn--danger:first-child { margin-right: auto; }
.bh-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 24px; margin: 0; }
.bh-kv div { display: grid; grid-template-columns: 130px 1fr; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--bh-line); }
.bh-kv dt { color: var(--bh-muted); }
.bh-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.bh-thumb { display: inline-block; width: 36px; height: 36px; border-radius: 4px; object-fit: cover; background: var(--bh-bg); vertical-align: middle; }
.bh-list-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- trang lập phiếu (bh/shell/doc) ---------- */

.bh-doc { display: grid; gap: var(--bh-gap); }
.bh-doc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bh-doc-title { font-size: 18px; }
.bh-doc-code { color: var(--bh-primary); }
.bh-doc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--bh-pad); align-items: start; }
.bh-doc-main { min-width: 0; display: grid; gap: 10px; }
.bh-doc-search { max-width: none; }
.bh-doc-lines td { height: 44px; }
.bh-doc-no { width: 44px; text-align: center !important; color: var(--bh-muted); }
.bh-doc-del { width: 44px; text-align: center !important; }
.bh-doc-in { height: 30px; min-width: 84px; }
td.is-num .bh-doc-in { max-width: 140px; margin-left: auto; }
.bh-doc-lot { display: grid; grid-template-columns: minmax(90px, 1fr) 140px; gap: 4px; }
.bh-doc-pick { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; }
.bh-doc-pick small { color: var(--bh-muted); white-space: nowrap; }
.bh-doc-aside { position: sticky; top: calc(var(--bh-top) + var(--bh-menu) + var(--bh-pad)); display: grid; gap: var(--bh-gap); }
.bh-doc-side, .bh-doc-totals { padding: var(--bh-pad); border-radius: var(--bh-r); background: var(--bh-surface); box-shadow: var(--bh-shadow); }
.bh-doc-side:empty { display: none; }
.bh-doc-totals { display: grid; gap: 6px; margin: 0; }
.bh-doc-totals div { display: flex; justify-content: space-between; gap: 12px; }
.bh-doc-totals dt { color: var(--bh-muted); }
.bh-doc-totals dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.bh-doc-totals .is-total { padding-top: 6px; border-top: 1px solid var(--bh-line); font-size: 16px; }
.bh-doc-totals .is-total dt { color: var(--bh-text); font-weight: 700; }
.bh-doc-totals .is-total dd { color: var(--bh-primary); font-weight: 700; }
.bh-doc-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.bh-doc-foot .bh-btn--danger:first-child { margin-right: auto; }
.bh-doc.is-busy .bh-doc-grid { opacity: .6; pointer-events: none; }

/* ---------- Thiết lập (bh/admin/system) ---------- */

.bh-panel { display: grid; gap: var(--bh-gap); padding: var(--bh-pad); border-radius: var(--bh-r); background: var(--bh-surface); box-shadow: var(--bh-shadow); }
.bh-panel h2 { font-size: 15px; }
.bh-set { display: grid; gap: var(--bh-pad); max-width: 960px; }
.bh-set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--bh-gap) var(--bh-pad); align-items: start; }
.bh-set-grid input[type="color"].bh-input { width: 72px; padding: 2px; }
.bh-set-logo-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bh-set-logo { width: 64px; height: 64px; border: 1px solid var(--bh-line); border-radius: var(--bh-r); object-fit: contain; background: var(--bh-bg); }
.bh-set-logo.is-none { display: grid; place-items: center; color: var(--bh-muted); font-size: 11px; text-align: center; }
.bh-set-foot { display: flex; justify-content: flex-end; }

/* ---------- Tổng quan tạm ---------- */

.bh-home { display: grid; gap: var(--bh-pad); }
.bh-home-hello h1 { font-size: 20px; }
.bh-home-hello p, .bh-home-note { color: var(--bh-muted); }
.bh-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--bh-gap); }
.bh-tile { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 12px; padding: var(--bh-pad); border-radius: var(--bh-r); background: var(--bh-surface); box-shadow: var(--bh-shadow); }
.bh-tile-ic { grid-row: span 2; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--bh-primary-l); color: var(--bh-primary); }
.bh-tile-label { color: var(--bh-muted); }
.bh-tile-num { font-size: 20px; }

/* ================= KHUNG ĐIỆN THOẠI ================= */

.bh-mob { min-height: 100vh; min-height: 100dvh; padding-bottom: var(--bh-dock); }
.bh-mhead {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--bh-top);
  padding: env(safe-area-inset-top) 4px 0;
  background: var(--bh-primary);
  color: var(--bh-on-primary);
}
.bh-mhead-title { flex: 1; min-width: 0; padding: 0 8px; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bh-mhead-btn, .bh-mhead-actions > button {
  display: inline-grid;
  place-items: center;
  min-width: var(--bh-tap);
  height: var(--bh-tap);
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--bh-on-primary);
}
.bh-mhead-btn .bh-i, .bh-mhead-actions .bh-i { width: 22px; height: 22px; }
.bh-mhead-actions { display: flex; align-items: center; }
.bh-mbody { padding: var(--bh-pad); }

.bh-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  height: var(--bh-dock);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bh-surface);
  border-top: 1px solid var(--bh-line);
}
.bh-dock-tab {
  flex: 1;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  min-height: var(--bh-tap);
  color: var(--bh-muted);
  font-size: 11px;
  -webkit-tap-highlight-color: transparent;
}
.bh-dock-tab:hover { text-decoration: none; }
.bh-dock-tab.is-active { color: var(--bh-primary); font-weight: 600; }
.bh-dock-ic { position: relative; display: grid; place-items: center; }
.bh-dock-ic .bh-i { width: 24px; height: 24px; }
.bh-dock-ic .bh-dot { top: -6px; right: -14px; }

.bh-mcard { margin-bottom: var(--bh-gap); padding: var(--bh-pad); border-radius: calc(var(--bh-r) + 4px); background: var(--bh-surface); box-shadow: var(--bh-shadow); }
.bh-mwho { display: flex; align-items: center; gap: 12px; }
.bh-mwho > .bh-i { width: 40px; height: 40px; padding: 8px; border-radius: 50%; background: var(--bh-primary-l); color: var(--bh-primary); }
.bh-mwho div { display: grid; }
.bh-mwho small { color: var(--bh-muted); }
.bh-mlist { display: grid; padding: 4px 0; }
.bh-mlist-title { padding: 8px var(--bh-pad) 4px; color: var(--bh-muted); font-size: 14px; }
.bh-mlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--bh-tap);
  padding: 0 var(--bh-pad);
  border: 0;
  background: none;
  color: var(--bh-text);
  text-align: left;
}
.bh-mlist-item + .bh-mlist-item { border-top: 1px solid var(--bh-line); }
.bh-mlist-item.is-current { color: var(--bh-primary); font-weight: 600; }
.bh-mlist-item.is-danger { color: var(--bh-danger); }
/* Số đếm cuối một dòng danh sách (Thêm › Tin nhắn): chấm số nằm trong dòng, không nổi như ở dock. */
.bh-mlist-item .bh-dot { position: static; margin-left: auto; }

/* Điện thoại: vùng bấm >= 44px, ô nhập 16px (iOS không tự phóng), hộp thoại thành bảng trượt từ dưới. */
[data-khung="dien-thoai"] .bh-btn { min-height: var(--bh-tap); }
[data-khung="dien-thoai"] .bh-btn--sm { height: 36px; min-height: 36px; }
[data-khung="dien-thoai"] .bh-input { font-size: 16px; }
[data-khung="dien-thoai"] .bh-check { min-height: var(--bh-tap); }
[data-khung="dien-thoai"] .bh-toasts { top: auto; bottom: calc(var(--bh-dock) + 8px); left: 50%; right: auto; transform: translateX(-50%); }
[data-khung="dien-thoai"] .bh-dialog-wrap { align-items: flex-end; padding: 0; }
[data-khung="dien-thoai"] .bh-dialog {
  max-width: none;
  max-height: 90vh;
  border-radius: 14px 14px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  animation: bh-up .2s ease-out;
}
[data-khung="dien-thoai"] .bh-dialog-foot .bh-btn { flex: 1; }
[data-khung="dien-thoai"] .bh-x { width: var(--bh-tap); height: var(--bh-tap); }
[data-khung="dien-thoai"] .bh-pager-n { min-width: var(--bh-tap); height: var(--bh-tap); }
[data-khung="dien-thoai"] .bh-tab { min-height: var(--bh-tap); }
[data-khung="dien-thoai"] .bh-picker-item, [data-khung="dien-thoai"] .bh-pop-item { min-height: var(--bh-tap); display: flex; flex-direction: column; justify-content: center; }
[data-khung="dien-thoai"] .bh-pop-item--ic { flex-direction: row; justify-content: flex-start; }
@keyframes bh-up { from { transform: translateY(40px); opacity: 0; } }

/* ---------- đăng nhập (Core\Login + shell/login.js) ---------- */

.bh-login { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 24px 16px; }
.bh-login-card {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 380px;
  padding: 28px 24px;
  border-top: 4px solid var(--bh-primary);
  border-radius: calc(var(--bh-r) + 4px);
  background: var(--bh-surface);
  box-shadow: var(--bh-shadow);
}
.bh-login-card h1 { font-size: 22px; }
.bh-login-sub { color: var(--bh-muted); margin-top: -8px; }
.bh-login-card .bh-input { height: var(--bh-tap); font-size: 16px; }
.bh-login-card .bh-btn { height: var(--bh-tap); font-size: 16px; }
.bh-login-err { padding: 8px 12px; border-radius: var(--bh-r); background: var(--bh-danger-l); color: var(--bh-danger); }

@media print {
  .bh-top, .bh-menu, .bh-dock, .bh-mhead, .bh-toasts, .bh-list-side, .bh-list-foot, .bh-banner { display: none !important; }
  body { background: var(--bh-surface); }
}

/* ---------- bộ mẫu màu (bh/admin/system/themes) ----------
   Màu của từng thẻ xem trước đặt qua biến --t-* trên chính thẻ đó (JS), không ghi mã màu ở đây. */

.bh-theme-wrap, .bh-theme, .bh-theme-groups { display: grid; gap: var(--bh-gap); min-width: 0; }
.bh-theme-group { display: grid; gap: 8px; min-width: 0; }
.bh-theme-group-title { color: var(--bh-muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.bh-theme-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1100px) { .bh-theme-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 720px) { .bh-theme-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px) { .bh-theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.bh-theme-card {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 5px 5px 7px;
  border: 1px solid var(--bh-line);
  border-radius: calc(var(--bh-r) + 2px);
  background: var(--bh-surface);
  color: var(--bh-text);
  text-align: left;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.bh-theme-card:hover { border-color: var(--bh-muted); transform: translateY(-1px); }
.bh-theme-card:focus-visible { outline: 3px solid var(--bh-focus, var(--bh-primary)); outline-offset: 3px; }
.bh-theme-card[aria-checked="true"] { border-color: var(--bh-primary); box-shadow: 0 0 0 2px var(--bh-primary); }
.bh-theme-card:disabled { cursor: default; opacity: .7; transform: none; }
.bh-theme-card--custom { border-style: dashed; }

.bh-theme-shot { display: block; overflow: hidden; border: 1px solid var(--t-line); border-radius: 4px; background: var(--t-bg); }
.bh-theme-bar { display: flex; align-items: center; gap: 5px; height: 18px; padding: 0 6px; background: var(--t-p); }
.bh-theme-dash { width: 16%; max-width: 22px; height: 3px; border-radius: 2px; background: var(--t-op); opacity: .7; }
.bh-theme-dash.is-on { opacity: 1; box-shadow: 0 6px 0 -1px var(--t-a); }
.bh-theme-sell { width: 24%; max-width: 34px; height: 10px; margin-left: auto; border-radius: 3px; background: linear-gradient(var(--t-oa), var(--t-oa)) center / 55% 2px no-repeat var(--t-a); }
.bh-theme-body { display: block; padding: 7px; }
.bh-theme-sheet { display: grid; gap: 4px; padding: 6px; border: 1px solid var(--t-line); border-radius: 3px; background: var(--bh-surface); }
.bh-theme-line { height: 4px; width: 78%; border-radius: 2px; background: var(--t-line); }
.bh-theme-line.is-short { width: 52%; }
.bh-theme-row { height: 9px; margin: 0 -3px; border-radius: 2px; background: var(--t-pl); box-shadow: inset 2px 0 0 var(--t-p); }
.bh-theme-btn { justify-self: end; width: 38%; height: 10px; margin-top: 2px; border-radius: 3px; background: linear-gradient(var(--t-op), var(--t-op)) center / 55% 2px no-repeat var(--t-p); }

.bh-theme-name { display: flex; align-items: center; gap: 5px; min-width: 0; padding: 0 2px; font-size: 13px; font-weight: 500; line-height: 1.3; }
.bh-theme-name > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bh-theme-tick { display: none; flex: none; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--bh-primary); color: var(--bh-on-primary); }
.bh-theme-tick .bh-i { width: 11px; height: 11px; stroke-width: 3; }
.bh-theme-card[aria-checked="true"] .bh-theme-tick { display: grid; }
.bh-theme-card[aria-checked="true"] .bh-theme-name { font-weight: 700; }

.bh-theme-custom { display: grid; gap: var(--bh-gap); padding: var(--bh-gap); border: 1px dashed var(--bh-line); border-radius: var(--bh-r); background: var(--bh-soft); }
.bh-theme-custom-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--bh-gap) var(--bh-pad); align-items: start; }
.bh-theme-custom input[type="color"].bh-input { width: 72px; padding: 2px; }
.bh-theme-warn { display: grid; gap: 4px; padding: 8px 10px; border-radius: var(--bh-r); background: var(--bh-warn-l); color: var(--bh-warn); font-size: 13px; }
.bh-theme-warn p { display: flex; gap: 6px; align-items: flex-start; }
.bh-theme-warn .bh-i { flex: none; width: 16px; height: 16px; margin-top: 1px; }

.bh-theme-strip {
  position: sticky;
  top: calc(var(--bh-top) + var(--bh-menu) + 6px);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--bh-info);
  border-radius: var(--bh-r);
  background: var(--bh-info-l);
  color: var(--bh-info);
}
.bh-theme-strip .bh-i { vertical-align: -4px; }
.bh-theme-strip .bh-btn { color: var(--bh-text); }
[data-khung="dien-thoai"] .bh-theme-strip { top: calc(var(--bh-top) + 6px); }
[data-khung="dien-thoai"] .bh-theme-card { padding-bottom: 9px; }
[data-khung="dien-thoai"] .bh-theme-name { font-size: 14px; }
@media (prefers-reduced-motion: reduce) {
  .bh-theme-card { transition: none; }
  .bh-theme-card:hover { transform: none; }
}
