/* Giao diện theo "Quy chuẩn giao diện" (F:\Quy chuẩn giao diện\QuyChuan_GiaoDien.html) — chỉ dùng biến màu, không viết mã màu cố định trong thành phần. */
/* ============ Tokens ============
   Phương án A "Xanh dương doanh nghiệp" (kiểu Microsoft 365 / Atlassian / MISA).
   Sáng: nền xanh xám rất nhạt, thẻ trắng, menu navy.
   Tối: kiểu GitHub Dimmed — xám xanh vừa phải (không đen kịt), mỗi lớp sáng dần rõ rệt
   để phân biệt menu / nền / thẻ / ô nhập / tab đang chọn. */
:root {
  --bg: #f4f6fa;               /* nền trang: xanh xám rất nhạt */
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --line: #e1e6ee;
  --text: #1f2937;
  --muted: #64748b;
  --primary: #2563eb;          /* nút chính, liên kết, mục đang chọn */
  --primary-2: #1d4ed8;        /* khi rê chuột */
  --primary-soft: #e8effd;
  --on-primary: #ffffff;
  --brand: #0f2447;
  --brand-2: #1d4ed8;
  --side: #0f2447;             /* nền menu trái: xanh navy */
  --side-accent: #60a5fa;      /* vạch mục menu đang chọn */
  --hero-a: #1e40af;           /* nền thẻ nổi bật */
  --hero-b: #2563eb;
  --seg-bg: #e6ebf3;           /* nền nhóm tab */
  --seg-on: #ffffff;           /* tab đang chọn */
  --gold: #d4af6a;             /* điểm nhấn vàng đồng (thẻ quảng bá) */
  --gold-2: #e8c887;
  --good: #15803d;
  --good-soft: #e7f6ec;
  --bad: #dc2626;
  --bad-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fdf2e0;
  --sale: #2563eb;
  --buy: #f59e0b;
  --shadow: 0 1px 2px rgba(15, 36, 71, .05), 0 6px 20px -10px rgba(15, 36, 71, .16);
  --shadow-lg: 0 10px 28px -8px rgba(15, 36, 71, .2);
  --focus: rgba(37, 99, 235, .22);
  --cta-shadow: rgba(37, 99, 235, .45);
  /* Bảng kiểu Excel (báo cáo / form nhập) */
  --x-bg: #ffffff; --x-text: #111111; --x-head: #dce6f2; --x-head-text: #1f3b66; --x-grid: #8c8c8c; --x-rule: #222222;
  --x-sep: #bdbdbd; --x-dot: #cfcfcf; --x-border: #d6dbe3; --x-card-line: #e3e3e3; --x-muted: #666666;
  --x-note: #333333; --x-ph: #bdbdbd; --x-neg: #d90000; --x-hl: #ffff00; --x-hl-text: #111111;
  --x-focus: #2563eb; --x-focus-bg: #eef4ff; --x-bad-bg: #fff0f0; --x-manual: #c25400;
  /* Báo giá: ô giá tăng (vàng) / giảm (cam), cột tên máy */
  --x-up: #fff35c; --x-up-text: #111111; --x-down: #ffc24d; --x-down-text: #111111; --x-label: #eef2f7;
  --r: 14px;
  --r-sm: 10px;
  --tabbar: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c2230;
    --surface: #252c3b;
    --surface-2: #2e3647;
    --line: #353e52;
    --text: #dfe4ec;
    --muted: #9aa6b8;
    --primary: #6ea8fe;
    --primary-2: #8fbcff;
    --primary-soft: rgba(110, 168, 254, .16);
    --on-primary: #0b1426;
    --brand: #151a24;
    --brand-2: #2a4a8a;
    --side: #151a24;
    --side-accent: #6ea8fe;
    --hero-a: #22417a;
    --hero-b: #2c58a3;
    --seg-bg: #151a24;
    --seg-on: #343d51;
    --good: #5fd08f;
    --good-soft: rgba(95, 208, 143, .14);
    --bad: #f47a7a;
    --bad-soft: rgba(244, 122, 122, .14);
    --warn: #e8b15a;
    --warn-soft: rgba(232, 177, 90, .14);
    --sale: #6ea8fe;
    --buy: #e8b15a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 6px 18px -10px rgba(0, 0, 0, .45);
    --shadow-lg: 0 12px 30px -8px rgba(0, 0, 0, .5);
    --focus: rgba(110, 168, 254, .3);
    --cta-shadow: rgba(0, 0, 0, .45);
    --x-bg: #252c3b; --x-text: #dfe4ec; --x-head: #34405a; --x-head-text: #e6ecf5; --x-grid: #46506a; --x-rule: #7a869c;
    --x-sep: #4a5570; --x-dot: #353e52; --x-border: #353e52; --x-card-line: #353e52; --x-muted: #9aa6b8;
    --x-note: #c9d1dc; --x-ph: #66728a; --x-neg: #f47a7a; --x-hl: rgba(250, 204, 21, .24); --x-hl-text: #fde68a;
    --x-focus: #6ea8fe; --x-focus-bg: rgba(110, 168, 254, .12); --x-bad-bg: rgba(244, 122, 122, .13); --x-manual: #f0a55a;
    --x-up: rgba(250, 204, 21, .32); --x-up-text: #fef08a; --x-down: rgba(251, 146, 60, .36); --x-down-text: #fed7aa; --x-label: #2b3445;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1c2230;
  --surface: #252c3b;
  --surface-2: #2e3647;
  --line: #353e52;
  --text: #dfe4ec;
  --muted: #9aa6b8;
  --primary: #6ea8fe;
  --primary-2: #8fbcff;
  --primary-soft: rgba(110, 168, 254, .16);
  --on-primary: #0b1426;
  --brand: #151a24;
  --brand-2: #2a4a8a;
  --side: #151a24;
  --side-accent: #6ea8fe;
  --hero-a: #22417a;
  --hero-b: #2c58a3;
  --seg-bg: #151a24;
  --seg-on: #343d51;
  --good: #5fd08f;
  --good-soft: rgba(95, 208, 143, .14);
  --bad: #f47a7a;
  --bad-soft: rgba(244, 122, 122, .14);
  --warn: #e8b15a;
  --warn-soft: rgba(232, 177, 90, .14);
  --sale: #6ea8fe;
  --buy: #e8b15a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 6px 18px -10px rgba(0, 0, 0, .45);
  --shadow-lg: 0 12px 30px -8px rgba(0, 0, 0, .5);
  --focus: rgba(110, 168, 254, .3);
  --cta-shadow: rgba(0, 0, 0, .45);
  --x-bg: #252c3b; --x-text: #dfe4ec; --x-head: #34405a; --x-head-text: #e6ecf5; --x-grid: #46506a; --x-rule: #7a869c;
  --x-sep: #4a5570; --x-dot: #353e52; --x-border: #353e52; --x-card-line: #353e52; --x-muted: #9aa6b8;
  --x-note: #c9d1dc; --x-ph: #66728a; --x-neg: #f47a7a; --x-hl: rgba(250, 204, 21, .24); --x-hl-text: #fde68a;
  --x-focus: #6ea8fe; --x-focus-bg: rgba(110, 168, 254, .12); --x-bad-bg: rgba(244, 122, 122, .13); --x-manual: #f0a55a;
  --x-up: rgba(250, 204, 21, .32); --x-up-text: #fef08a; --x-down: rgba(251, 146, 60, .36); --x-down-text: #fed7aa; --x-label: #2b3445;
  color-scheme: dark;
}

/* ---- Màu biểu đồ 2 màu (đã kiểm tra mù màu — dùng lại, đừng tự chọn cặp xanh/đỏ) ---- */
:root { --c1: #2563eb; --c2: #b07d2a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c1: #3d7fe6; --c2: #b0812c; } }
:root[data-theme="dark"] { --c1: #3d7fe6; --c2: #b0812c; }

/* ============ Base ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.noscroll { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
a { color: var(--primary); text-decoration: none; }
button { font: inherit; color: inherit; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.pad { padding: 20px 0; }
.grow { flex: 1; min-width: 0; }
.strong { font-weight: 600; }
.neg { color: var(--bad) !important; }
.pos { color: var(--good); }
.nowrap { white-space: nowrap; }
.ic { flex-shrink: 0; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ============ Shell ============ */
.app { min-height: 100vh; }
.side { display: none; }
.main { padding-bottom: calc(var(--tabbar) + 90px + env(safe-area-inset-bottom)); }
.page { max-width: 1120px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.page-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-h p { margin: 2px 0 0; font-size: .88rem; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar a, .tabbar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: .7rem; font-weight: 500; background: none; border: 0; cursor: pointer;
}
.tabbar .on { color: var(--primary); }
.tabbar .on .ic { stroke-width: 2.3; }

@media (min-width: 900px) {
  .side {
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: 236px; z-index: 20;
    background: var(--side); color: #fff; padding: 18px 10px 12px; overflow-y: auto; box-shadow: inset -1px 0 0 rgba(255, 255, 255, .06);
  }
  .main { margin-left: 236px; padding-bottom: 90px; }
  .tabbar { display: none; }
  .page { padding: 28px 32px; }
  h1 { font-size: 1.6rem; }
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand b { display: block; font-size: 1.05rem; }
.brand small { color: rgba(255, 255, 255, .6); font-size: .78rem; }
.logo { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--primary); color: var(--on-primary); }
.side .logo { background: rgba(96, 165, 250, .16); border: 1px solid rgba(96, 165, 250, .45); color: #bfdbfe; }
.logo.big { width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 6px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm);
  color: rgba(255, 255, 255, .68); font-weight: 500; transition: background .15s, color .15s, transform .15s;
}
.side nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; transform: translateX(2px); }
.side nav a.on { background: rgba(255, 255, 255, .13); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--side-accent); }
.side-foot { display: flex; flex-direction: column; gap: 8px; padding: 0 2px; }
.side-foot .who { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 6px; }
.side-foot small { color: rgba(255, 255, 255, .55); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .74rem; }
.side-foot .icon-btn { width: 30px; height: 30px; color: rgba(255, 255, 255, .6); }
.side-foot .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* Thẻ quảng bá dịch vụ — ghim đáy menu (theo bộ cấu kiện mẫu) */
@keyframes promoGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 106, 0); } 50% { box-shadow: 0 0 16px 2px rgba(212, 175, 106, .28); } }
@keyframes promoBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
.promo-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 7px;
  margin: auto 6px 6px; padding: 14px 12px 12px; border-radius: 14px; text-decoration: none;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .14); border-top: 2px solid var(--gold);
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
  animation: promoGlow 2.8s ease-in-out infinite;
}
.promo-card:hover { transform: translateY(-3px); background: rgba(255, 255, 255, .09); border-color: rgba(212, 175, 106, .55); }
.promo-card:active { transform: translateY(0); }
.promo-card-icon {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 14px; background: rgba(212, 175, 106, .16); border: 1px solid rgba(212, 175, 106, .45);
  animation: promoBounce 2.4s ease-in-out infinite;
}
.promo-card-text { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.promo-card-text strong { font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, .95); line-height: 1.4; }
.promo-card-text span { font-size: 11px; font-weight: 800; color: var(--gold-2); white-space: nowrap; }
.promo-card.on-light { background: var(--side); margin: 4px 0 0; }

.theme-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 6px; padding: 8px;
  border: 0; border-radius: 8px; background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .8);
  font-size: .78rem; font-weight: 500; cursor: pointer; transition: background .15s;
}
.theme-btn:hover { background: rgba(255, 255, 255, .14); color: #fff; }

/* ============ Controls ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-solid:hover { filter: brightness(1.08); }
.confirm-text { margin: 0; line-height: 1.6; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: .88rem; }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; color: var(--muted); cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.link { background: none; border: 0; color: var(--primary); font-weight: 600; cursor: pointer; padding: 0 4px; }
.flip { display: inline-flex; transform: rotate(180deg); }

.inp {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.inp:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.inp.num { text-align: right; font-variant-numeric: tabular-nums; }
.inp.big { font-size: 1.2rem; font-weight: 600; }
input[type=date].inp { min-width: 0; }
.fld { display: flex; flex-direction: column; gap: 5px; }
.fld > span { font-size: .82rem; font-weight: 500; color: var(--muted); }
.form-row { display: flex; gap: 12px; align-items: flex-end; }
.form-row.wrap { flex-wrap: wrap; justify-content: space-between; }
.w-date { width: 165px; flex-shrink: 0; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; min-height: 44px; }
.toggle.small { font-size: .82rem; min-height: auto; color: var(--muted); }
.toggle input { width: 20px; height: 20px; accent-color: var(--primary); }
.hint { margin: 0; font-size: .82rem; color: var(--muted); }

.search { position: relative; display: flex; align-items: center; flex: 1; min-width: 180px; }
.search .ic { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search .inp { padding-left: 36px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.combo-wrap { position: relative; flex: 1; min-width: 200px; }
.combo-wrap .inp { padding-right: 36px; }
.combo-wrap .clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); width: 34px; height: 34px; cursor: pointer; border-radius: 50%; }

.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px;
  list-style: none; max-height: 260px; overflow: auto; min-width: 200px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow-lg);
}
.combo-list li { padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.combo-list li:hover, .combo-list li.hi { background: var(--primary-soft); }
.combo-list li.new { color: var(--primary); font-weight: 600; border-top: 1px solid var(--line); margin-top: 2px; }

.seg { display: inline-flex; background: var(--seg-bg); border-radius: 12px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button {
  border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 500; font-size: .9rem;
  color: var(--muted); cursor: pointer; white-space: nowrap; min-height: 38px;
}
.seg button.on { background: var(--seg-on); color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }

.range { display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; border-radius: 99px;
  font-size: .85rem; font-weight: 500; white-space: nowrap; cursor: pointer; color: var(--muted);
}
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.range-dates { display: flex; align-items: center; gap: 8px; }
.range-dates .inp { flex: 1; }
.range-dates > span { color: var(--muted); }
@media (min-width: 1560px) {
  .range { flex-direction: row; align-items: center; justify-content: space-between; }
  .chips { margin: 0; padding: 0; }
  .range-dates { width: 340px; }
}

.badge { display: inline-flex; align-items: center; gap: 3px; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--good-soft); color: var(--good); }
.avatar {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .9rem; text-transform: uppercase;
}

.fab {
  position: fixed; z-index: 25; right: 16px; bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 8px; height: 54px; padding: 0 22px 0 18px; border-radius: 27px;
  border: 0; background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: .98rem; cursor: pointer;
  box-shadow: 0 8px 22px -6px var(--cta-shadow); transition: transform .18s ease, box-shadow .18s ease;
}
.fab:hover { transform: translateY(-3px); background: var(--primary-2); box-shadow: 0 12px 28px -6px var(--cta-shadow); }
.fab:active { transform: translateY(-1px) scale(.98); }
@media (min-width: 900px) { .fab { bottom: 28px; right: 32px; } }

/* ============ Cards ============ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.flush { padding: 4px; gap: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.grid2 { display: grid; gap: 14px; }
@media (min-width: 1000px) { .grid2 { grid-template-columns: 1.15fr 1fr; align-items: start; } }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px;
  display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); color: var(--text); min-width: 0;
}
.kpi > span { font-size: .8rem; color: var(--muted); font-weight: 500; }
.kpi b { font-size: clamp(1.02rem, 4.4vw, 1.3rem); font-weight: 700; letter-spacing: -.01em; }
.kpi > small { font-size: .74rem; color: var(--muted); }
.kpi.hero {
  grid-column: 1 / -1; position: relative; overflow: hidden; border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--hero-a) 0%, var(--hero-b) 100%); box-shadow: var(--shadow-lg);
}
.kpi.hero::before, .kpi.hero::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .08); pointer-events: none; }
.kpi.hero::before { width: 160px; height: 160px; top: -70px; right: -50px; }
.kpi.hero::after { width: 110px; height: 110px; bottom: -60px; left: -30px; background: rgba(255, 255, 255, .06); }
.kpi.hero > * { position: relative; }
.kpi.hero > span, .kpi.hero > small { color: inherit; opacity: .85; }
.kpi.hero b { font-size: 1.9rem; }
.kpi.good b { color: var(--good); }
.kpi.bad b { color: var(--bad); }
.kpi.link:hover { border-color: var(--primary); }
@media (min-width: 700px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi.hero { grid-column: span 1; }
  .kpi.hero b { font-size: 1.5rem; }
}
@media (min-width: 1200px) { .kpis { grid-template-columns: repeat(5, 1fr); } }

.legend { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 8px; }
.dot.sale { background: var(--sale); }
.dot.buy { background: var(--buy); }
.chart svg { width: 100%; height: 220px; display: block; }
.chart-tip { font-size: .85rem; min-height: 22px; margin-bottom: 4px; }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .bar.sale { fill: var(--sale); }
.chart .bar.buy { fill: var(--buy); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart g.hov .hit { fill: var(--surface-2); }
.chart g.dim .bar { opacity: .35; }

/* tables */
.tbl-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tr.first td { border-top: 1px solid var(--line); }
.tbl tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--line); }
.tbl .r { text-align: right; white-space: nowrap; }
.tbl .c { text-align: center; color: var(--good); }
.tbl tbody tr:hover td { background: var(--surface-2); }

.debts { list-style: none; margin: 0 -8px; padding: 0; max-height: 520px; overflow: auto; }
.debts a, .debts button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 8px; border-radius: var(--r-sm);
  color: var(--text); background: none; border: 0; cursor: pointer; text-align: left;
}
.debts a:hover, .debts button:hover { background: var(--surface-2); }
.total-row { display: flex; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--line); font-weight: 600; }

/* lists of orders/payments */
.summary { display: flex; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.summary div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.summary div:last-child { text-align: right; }
.summary div > span { font-size: .75rem; color: var(--muted); }
.summary b { font-size: 1.05rem; }
.day { display: flex; flex-direction: column; gap: 8px; }
.day-h { display: flex; justify-content: space-between; font-size: .82rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 6px 4px 0; }
.order {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow);
}
.order:hover { border-color: var(--primary); }
.order-h { display: flex; align-items: center; gap: 8px; }
.order-h b:first-child { flex: 1; font-size: 1rem; }
.order-lines { list-style: none; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 4px; font-size: .88rem; }
.order-lines li { display: flex; gap: 10px; align-items: baseline; }
.order-lines li > span:nth-child(2) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.order-lines .money { min-width: 90px; text-align: right; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; background: none;
  border-radius: var(--r-sm); text-align: left; cursor: pointer; color: var(--text);
}
.row + .row { border-top: 1px solid var(--line); border-radius: 0; }
.row:hover { background: var(--surface-2); }
.row .grow { display: flex; flex-direction: column; }
.row small { font-size: .8rem; }

.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.menu-grid a, .menu-grid button {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px; border-radius: var(--r);
  background: var(--surface-2); border: 0; color: var(--text); font-size: .82rem; font-weight: 500; text-align: center; cursor: pointer;
}
.menu-grid .on { background: var(--primary-soft); color: var(--primary); }
.menu-grid .emoji { font-size: 24px; line-height: 26px; }

/* ============ Hộp thoại kiểu mới + toast (quy chuẩn mục 18) ============ */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(9, 18, 36, .55); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .18s; }
.sheet { width: 100%; max-height: 94vh; background: var(--surface); border-radius: 22px 22px 0 0; display: flex; flex-direction: column;
  box-shadow: 0 24px 60px -12px rgba(9, 18, 36, .45); animation: up .24s cubic-bezier(.2, .9, .3, 1.1); position: relative; overflow: hidden; }
.sheet::before { content: ''; position: absolute; top: 7px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 99px; background: var(--line); }
.sheet-h { display: flex; align-items: center; gap: 12px; padding: 20px 14px 14px 20px; border-bottom: 1px solid var(--line); }
.sheet-h h2 { font-size: 1.08rem; font-weight: 700; letter-spacing: -.01em; }
.sheet-sub { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }
.sheet-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; background: var(--primary-soft); color: var(--primary); }
.sheet-ic.warn { background: var(--warn-soft); color: var(--warn); }
.sheet-ic.danger { background: var(--bad-soft); color: var(--bad); }
.sheet-ic.ok { background: var(--good-soft); color: var(--good); }
.sheet-b { padding: 18px 20px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.sheet-b > * { flex-shrink: 0; }
.sheet-f { display: flex; align-items: center; gap: 10px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--surface-2); }
.sheet-f .total { display: flex; flex-direction: column; }
.sheet-f .total small { font-size: .75rem; color: var(--muted); }
.sheet-f .total b { font-size: 1.2rem; }
.confirm-text + .confirm-text { margin-top: -6px; color: var(--muted); font-size: .9rem; }
@media (min-width: 700px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { width: 560px; border-radius: 18px; max-height: 88vh; animation: pop .2s cubic-bezier(.2, .9, .3, 1.2); }
  .sheet::before { display: none; }
  .sheet.wide { width: 920px; }
  .sheet.small { width: 440px; }
  .sheet.small .sheet-h { border-bottom: 0; padding-bottom: 4px; }
  .sheet.small .sheet-b { padding-top: 8px; }
  .sheet.small .sheet-f { background: transparent; border-top: 0; padding-top: 4px; padding-bottom: 18px; }
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.97); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); top: calc(12px + env(safe-area-inset-top));
  display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; pointer-events: auto; background: var(--surface); color: var(--text);
  padding: 11px 10px 11px 12px; border-radius: 12px; border: 1px solid var(--line); border-left: 4px solid var(--good);
  box-shadow: var(--shadow-lg); font-weight: 500; font-size: .92rem; line-height: 1.45; animation: up .22s; }
.toast-ic { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; background: var(--good-soft); color: var(--good); }
.toast.err { border-left-color: var(--bad); }
.toast.err .toast-ic { background: var(--bad-soft); color: var(--bad); }
.toast .grow { padding-top: 2px; }
.toast-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 6px; display: grid; }
.toast-x:hover { background: var(--surface-2); color: var(--text); }
/* states */
.loading { display: grid; place-items: center; padding: 60px 0; }
.spin { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--primary); animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 50px 16px; color: var(--muted); text-align: center; }
.empty p { margin: 0; }
.errbox { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; background: var(--bad-soft); color: var(--bad); padding: 12px 14px; border-radius: var(--r-sm); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 0%, var(--primary-soft), var(--bg) 60%); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 30px 24px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-card .fld { text-align: left; }
.login-card p { margin: 0 0 6px; font-size: .9rem; }
/* ============ Hiệu ứng (theo bộ cấu kiện mẫu) ============ */
@keyframes gtFadeInDown { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes gtFadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes gtFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes gtPulseRing { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .4); } 50% { box-shadow: 0 0 0 12px rgba(255, 255, 255, 0); } }
/* Nội dung mỗi trang hiện dần từ dưới lên, so le từng khối */
.page > :not(.fab):not(.overlay) { animation: gtFadeInUp .45s ease both; }
.page > :nth-child(2) { animation-delay: .04s; } .page > :nth-child(3) { animation-delay: .08s; }
.page > :nth-child(4) { animation-delay: .12s; } .page > :nth-child(5) { animation-delay: .16s; }
.page > :nth-child(n+6) { animation-delay: .2s; }
.kpis > .kpi { animation: gtFadeInUp .45s ease both; }
.kpis > .kpi:nth-child(2) { animation-delay: .06s; } .kpis > .kpi:nth-child(3) { animation-delay: .12s; }
.kpis > .kpi:nth-child(4) { animation-delay: .18s; } .kpis > .kpi:nth-child(5) { animation-delay: .24s; }
/* Nổi lên khi rê chuột */
.kpi, .order, .card, .menu-grid a, .menu-grid button { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.kpi:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.order:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.menu-grid a:hover, .menu-grid button:hover { transform: translateY(-3px); }
.btn { transition: background .15s, transform .12s, box-shadow .15s; }
.btn.primary:hover { box-shadow: 0 6px 16px -4px var(--cta-shadow); transform: translateY(-1px); }

/* ============ Trang Giới thiệu (theo bộ cấu kiện mẫu) ============
   Màu thống nhất với menu: navy trầm + điểm nhấn vàng đồng, còn lại trung tính (không dùng xanh dương chói). */
.intro {
  --i-deep: #0f2447; --i-mid: #1f3b66; --i-ink: #1f3b66; --i-soft: #eef2f8; --i-soft-line: #dfe6f1;
  --i-gold: #b8893b; --i-gold-soft: #fbf4e6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .intro {
    --i-deep: #1d2a44; --i-mid: #2b3d60; --i-ink: #c3cfe2; --i-soft: #2a3244; --i-soft-line: #39435a;
    --i-gold: #e3bd72; --i-gold-soft: rgba(227, 189, 114, .12);
  }
}
:root[data-theme="dark"] .intro {
  --i-deep: #1d2a44; --i-mid: #2b3d60; --i-ink: #c3cfe2; --i-soft: #2a3244; --i-soft-line: #39435a;
  --i-gold: #e3bd72; --i-gold-soft: rgba(227, 189, 114, .12);
}
.page.intro { gap: 0; }
.page.intro > :not(.fab):not(.overlay) { animation: none; }
.gt-hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 42px 24px 38px;
  background: linear-gradient(135deg, var(--i-deep) 0%, var(--i-mid) 100%); border-top: 3px solid var(--gold);
  color: #fff; text-align: center; margin-bottom: 20px; box-shadow: var(--shadow-lg);
}
.page.intro > .gt-hero { animation: gtFadeInDown .55s ease both; }
.gt-hero::before, .gt-hero::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .06); }
.gt-hero::before { width: 240px; height: 240px; top: -100px; right: -70px; }
.gt-hero::after { width: 170px; height: 170px; bottom: -80px; left: -50px; background: rgba(212, 175, 106, .08); }
.gt-hero-icon { position: relative; font-size: 46px; display: inline-block; margin-bottom: 10px; animation: gtFloat 3s ease-in-out infinite; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .2)); }
.gt-hero-title { position: relative; margin: 0 0 10px; font-size: 27px; font-weight: 800; letter-spacing: -.01em; }
.gt-hero-sub { position: relative; margin: 0 auto; max-width: 580px; font-size: 14.5px; line-height: 1.6; color: rgba(255, 255, 255, .86); }
.gt-card {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--i-mid);
  border-radius: 0 14px 14px 0; padding: 18px 20px; margin-bottom: 22px; box-shadow: var(--shadow);
}
.page.intro > .gt-card, .page.intro > .gt-banner, .page.intro > .gt-cta, .page.intro > .gt-social-row { animation: gtFadeInUp .5s ease both; }
.gt-card p { margin: 0 0 12px; line-height: 1.75; font-size: 14px; }
.gt-card p:last-child { margin-bottom: 0; }
.gt-eyebrow { font-size: 11.5px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; margin-bottom: 4px; color: var(--i-gold); }
.gt-section-title { margin: 0 0 16px; font-size: 19px; font-weight: 800; }
.gt-exp-badge {
  display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; margin-left: 4px;
  font-size: 11.5px; font-weight: 800; color: var(--i-gold); background: var(--i-gold-soft);
  border: 1px solid color-mix(in srgb, var(--i-gold) 40%, transparent); padding: 4px 11px; border-radius: 20px;
}
.gt-feature-grid, .gt-service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-bottom: 24px; }
.gt-feature-card {
  display: flex; align-items: flex-start; gap: 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 15px 16px; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  opacity: 0; animation: gtFadeInUp .5s ease both;
}
.gt-feature-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--i-soft-line); }
.gt-feature-icon { flex-shrink: 0; width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: var(--i-soft); font-size: 18px; }
.gt-feature-text { font-size: 13.5px; line-height: 1.55; padding-top: 5px; }
.gt-banner {
  text-align: center; border-radius: 14px; padding: 16px 22px; font-size: 13.5px; line-height: 1.7; margin-bottom: 26px;
  background: var(--i-soft); color: var(--i-ink); border: 1px solid var(--i-soft-line);
}
.gt-divider { height: 1px; background: linear-gradient(90deg, transparent, var(--line) 20%, var(--line) 80%, transparent); margin: 4px 0 26px; }
.gt-service-grid { gap: 12px; margin-bottom: 26px; }
.gt-service-card {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 15px; font-size: 13.5px; font-weight: 600; color: var(--text);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  opacity: 0; animation: gtFadeInUp .5s ease both;
}
.gt-service-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--i-gold) 55%, transparent); }
.gt-service-icon { font-size: 17px; flex-shrink: 0; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--i-gold-soft); }
.gt-steps { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; max-width: 800px; margin: 0 auto 26px; }
.gt-step {
  display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 30px; padding: 7px 16px 7px 7px; font-size: 12.5px; font-weight: 700;
  opacity: 0; animation: gtFadeInUp .45s ease both;
}
.gt-step-num { width: 25px; height: 25px; border-radius: 50%; background: var(--i-mid); color: #fff; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
.gt-step-arrow { color: var(--muted); font-size: 18px; font-weight: 800; }
.gt-cta {
  display: block; text-align: center; text-decoration: none; border-radius: 20px; padding: 30px 20px 26px; margin-bottom: 14px;
  background: linear-gradient(135deg, var(--i-deep) 0%, var(--i-mid) 100%); color: #fff; border-top: 3px solid var(--gold);
  box-shadow: var(--shadow-lg); transition: transform .18s ease, box-shadow .18s ease;
}
.gt-cta:hover { transform: translateY(-4px); box-shadow: 0 16px 36px -10px rgba(15, 36, 71, .55); }
.gt-cta:active { transform: translateY(-1px) scale(.99); }
@keyframes gtPulseGold { 0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 106, .45); } 50% { box-shadow: 0 0 0 12px rgba(212, 175, 106, 0); } }
.gt-cta-ring {
  display: inline-flex; align-items: center; justify-content: center; width: 50px; height: 50px; border-radius: 50%;
  background: rgba(212, 175, 106, .16); border: 1px solid rgba(212, 175, 106, .5); margin-bottom: 12px; font-size: 23px;
  animation: gtPulseGold 1.8s ease-in-out infinite;
}
.gt-cta-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: rgba(255, 255, 255, .8); margin-bottom: 6px; }
.gt-cta-phone { font-size: 27px; font-weight: 800; letter-spacing: .6px; color: var(--gold-2); }
.gt-social-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 4px 0 18px; }
.gt-social-btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: 13.5px; font-weight: 700;
  color: var(--i-ink); background: var(--surface); border: 1px solid var(--line); border-radius: 30px; padding: 10px 20px;
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.gt-social-btn .ic { color: var(--i-gold); }
.gt-social-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--i-gold) 55%, transparent); }
.gt-tagline { text-align: center; font-weight: 800; color: var(--i-ink); margin: 4px 0 0; font-size: 13.5px; }

/* Giảm hiệu ứng nếu máy bật chế độ hạn chế chuyển động */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ============ Màn hình chờ + keyframes dùng chung ============ */
.boot { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(circle at 50% 35%, #1d3a6e 0%, #0f2447 55%, #0b1c3a 100%); color: #fff; }
.boot img { border-radius: 22px; box-shadow: 0 14px 40px -10px rgba(0, 0, 0, .55); animation: bootPop .5s cubic-bezier(.2, .9, .3, 1.2) both; }
.boot b { font-size: 1.15rem; letter-spacing: .01em; animation: gtFadeInUp .5s .1s ease both; }
.boot .spin { border-color: rgba(255, 255, 255, .18); border-top-color: #fff; margin-top: 6px; }
@keyframes bootPop { from { transform: scale(.8); opacity: 0; } }
@keyframes ckdDraw { to { stroke-dashoffset: 0; } }
@keyframes ckdRise { from { opacity: 0; transform: translateY(8px); } }
@keyframes exfIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes exfPop { from { opacity: 0; transform: scale(.85); } }
.spin.sm { width: 16px; height: 16px; border-width: 2px; }
.row-gap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn.xls { background: #217346; border-color: #217346; color: #fff; }
.btn.xls:hover:not(:disabled) { background: #1a5c38; border-color: #1a5c38; transform: translateY(-1px); box-shadow: 0 8px 18px -8px rgba(33, 115, 70, .7); }
.btn.xls:disabled { opacity: .55; }
.sheet-actions {
  position: sticky; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 8px); z-index: 5;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; box-shadow: var(--shadow-lg);
}
@media (min-width: 900px) { .sheet-actions { bottom: 12px; } }
.btn.go-red { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.go-red:hover:not(:disabled) { filter: brightness(1.08); }
kbd { font-family: inherit; font-size: .78em; padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); }
mark.hl { background: color-mix(in srgb, var(--primary) 16%, transparent); color: inherit; font-weight: 700; border-radius: 3px; padding: 0 1px; }
.combo-list { scroll-behavior: smooth; }
.tbl tr.sum-top td { font-weight: 700; background: var(--surface-2); border-bottom: 2px solid var(--line); }

/* ============ Bộ chọn thời gian đầy đủ (mục 12) ============ */
.rg-nav { display: flex; gap: 4px; flex: none; }
.rg-nav .icon-btn { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface); font-size: 1.2rem; }
.rg-nav .icon-btn:disabled { opacity: .4; cursor: default; }
.rg-br { display: none; }
.xls-mini { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 11px 0 8px; border-radius: 999px;
  border: 0; background: linear-gradient(180deg, #2a8a55, #217346); color: #fff; font: inherit; font-size: .78rem; font-weight: 700; letter-spacing: .2px;
  cursor: pointer; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 2px 6px -2px rgba(33, 115, 70, .6); transition: transform .15s, box-shadow .15s, filter .15s; }
.xls-mini:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 6px 14px -4px rgba(33, 115, 70, .7); }
.xls-mini:active { transform: none; }
.xls-mini:disabled { opacity: .75; cursor: wait; }
.xls-mini .spin.sm { width: 14px; height: 14px; border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
@media (min-width: 1560px) { .range-dates.has-lead { width: 430px; } .range-dates.has-lead2 { width: 520px; } }
@media (max-width: 699px) {
  .range-dates.has-lead { flex-wrap: wrap; row-gap: 8px; }
  .range-dates.has-lead .rg-br { display: block; flex-basis: 100%; height: 0; }
  .range-dates.has-lead .inp { flex: 1 1 0; min-width: 0; }
}

/* ============ Tổng quan (mục 14 + 19) ============ */
.kpi small .pos { color: var(--good); font-weight: 600; }
.kpi small .neg { font-weight: 600; }
.trend { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 99px; font-weight: 700; font-size: .74rem; background: rgba(255, 255, 255, .18); color: #fff; }
.trend.dn { background: rgba(0, 0, 0, .18); }
a.kpi, button.kpi { text-decoration: none; font: inherit; text-align: left; cursor: pointer; }
.kpi.tq-link:hover { border-color: var(--primary); }
.tq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.tq-list { display: flex; flex-direction: column; }
.tq-row { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.tq-row:last-child { border-bottom: 0; }
.tq-row:hover { background: var(--surface-2); }
.tq-row .grow { display: flex; flex-direction: column; min-width: 0; }
.tq-row small { font-size: .8rem; }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart-scroll { overflow-x: auto; }
.legend .dot.c1 { background: var(--c1); }
.legend .dot.c2 { background: var(--c2); }
.stack-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.stack-bar i { display: block; flex-basis: 0; min-width: 6px; transition: flex-grow .9s cubic-bezier(.2, .8, .2, 1); }
.grade-list { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.grade-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border: 0; background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; border-radius: 8px; }
.grade-row:hover { background: var(--surface-2); }
.grade-row .grow { display: flex; align-items: center; gap: 8px; }
.grade-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* ============ Danh sách cuộn trong khung (mục 19) ============ */
.scroll-wrap { position: relative; display: flex; flex-direction: column; gap: 6px; }
.scroll-list { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.scroll-wrap.fade::after { content: ""; position: absolute; left: 0; right: 0; bottom: 22px; height: 28px; pointer-events: none; background: linear-gradient(to bottom, transparent, var(--surface)); }
.scroll-hint { font-size: .74rem; color: var(--muted); text-align: center; }

/* ============ Tìm nhanh Ctrl + K (mục 15) ============ */
.side > * { flex-shrink: 0; }
.side nav { margin-bottom: 12px; }
.side .promo-card { flex-direction: row; text-align: left; gap: 8px; padding: 8px 8px; margin: auto 2px 6px; }
.side .promo-card-icon { width: 26px; height: 26px; font-size: 12px; flex: none; }
.side .promo-card-text { align-items: flex-start; gap: 1px; }
.side .promo-card-text strong { font-size: 9.5px; line-height: 1.3; white-space: nowrap; letter-spacing: -.1px; }
.side .promo-card-text span { font-size: 10.5px; }
.side .qs-btn { width: auto; margin: 0 2px 12px; }
.qs-btn { display: flex; align-items: center; gap: 8px; width: calc(100% - 24px); margin: 4px 12px 10px; padding: 8px 10px; border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); color: rgba(255, 255, 255, .75); font: inherit; font-size: .88rem; cursor: pointer; text-align: left; }
.qs-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.qs-btn .grow { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qs-btn kbd { white-space: nowrap; font: 600 .68rem/1 inherit; padding: 3px 5px; border-radius: 4px; background: rgba(255, 255, 255, .12); border: 0; }
.qs-btn.on-light { width: 100%; margin: 0 0 12px; border-color: var(--line); background: var(--surface-2); color: var(--muted); }
.qs-inp { width: 100%; font-size: 1.05rem; min-height: 46px; }
.qs-res { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; min-height: 60px; }
.qs-grp { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 10px 4px 4px; }
.qs-hit { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.qs-hit:hover, .qs-hit.on { background: var(--primary-soft); }
.qs-hit .grow { display: flex; flex-direction: column; min-width: 0; }
.qs-hit small { font-size: .78rem; }
.qs-ic { width: 28px; text-align: center; font-size: 18px; }

/* ============ Băng chỉ xem / hạn dùng ============ */
.view-banner { display: flex; align-items: center; gap: 8px; margin: 12px 16px 0; padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--primary-soft); color: var(--primary); font-size: .85rem; }
@media (min-width: 900px) { .view-banner { margin: 16px 32px 0; } }
.row:disabled { cursor: default; color: inherit; opacity: 1; }
.row:disabled:hover { background: none; }
.icon-btn.danger:hover { background: var(--bad-soft); color: var(--bad); }

/* ============ Ứng dụng điện thoại: bảng, nhãn, form ============ */
.tbl-click tbody tr { cursor: pointer; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th .arr { font-size: .7rem; margin-left: 3px; color: var(--primary); }
.tbl td.wrap { white-space: normal; min-width: 140px; }
.tbl-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tbl-tools .search { flex: 1 1 220px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.pager .btn { min-height: 34px; padding: 0 12px; font-size: .85rem; }
.pager .btn:disabled { opacity: .4; }
.filters-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.grade { display: inline-block; min-width: 28px; text-align: center; padding: 2px 8px; border-radius: 99px; font-size: .74rem; font-weight: 800; color: #fff; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.ok { background: var(--good-soft); color: var(--good); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.info { background: var(--primary-soft); color: var(--primary); }
.model-hint { font-size: .78rem; color: var(--muted); min-height: 1.1em; }
.model-hint.on { color: var(--good); font-weight: 600; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.item-grid .span2 { grid-column: span 2; }
.section-t { margin: 4px 0 -4px; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--warn); }
.select-add { display: flex; gap: 6px; }
.select-add select { flex: 1; min-width: 0; }
.select-add .btn-add { flex: none; width: 44px; min-height: 44px; padding: 0; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--primary); font-weight: 800; font-size: 1.15rem; cursor: pointer; }
.select-add .btn-add:hover { background: var(--primary-soft); }
select.inp { appearance: auto; }
.thanhtien-box { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; padding: 8px 14px; border-radius: var(--r-sm); background: var(--good-soft); }
.thanhtien-box small { font-size: .74rem; color: var(--muted); font-weight: 600; }
.thanhtien-box b { font-size: 1.2rem; color: var(--good); font-variant-numeric: tabular-nums; }
.thanhtien-box.neg { background: var(--bad-soft); }
.thanhtien-box.neg b { color: var(--bad); }
.money-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.money-wrap { position: relative; }
.money-wrap .inp { padding-right: 34px; }
.money-step { position: absolute; right: 3px; top: 3px; bottom: 3px; width: 26px; display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.money-step button { flex: 1; border: 0; background: transparent; color: var(--muted); font-size: 8px; cursor: pointer; }
.money-step button:hover { color: var(--primary); background: var(--primary-soft); }
.dm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.dm-add { display: flex; gap: 8px; }
.dm-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.dm-tag { display: inline-flex; align-items: center; gap: 4px; padding: 5px 4px 5px 12px; border-radius: 99px; background: var(--surface-2); font-size: .86rem; font-weight: 500; animation: exfPop .25s ease both; }
.dm-tag button { border: 0; background: none; color: var(--muted); width: 22px; height: 22px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; padding: 0; }
.dm-tag button:hover { background: var(--bad-soft); color: var(--bad); }
.imei-card { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 18px; padding: 14px; border-radius: var(--r-sm); background: var(--surface-2); }
.imei-card span { display: block; font-size: .74rem; color: var(--muted); }
.imei-card b { font-size: .95rem; }
.empty-hint { padding: 22px 12px; text-align: center; color: var(--muted); font-size: .9rem; }
.pick-sum { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pick-sum b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.head-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
@media print { .side, .tabbar, .fab, .no-print, .toasts { display: none !important; } .main { margin: 0; padding: 0; } .page { padding: 0; max-width: none; } }
/* ---------- Nhập dữ liệu từ Excel: các bước, ô thả file, xem trước, tiến trình ---------- */
.imp .card { animation: exfIn .35s ease both; }
.imp .card:nth-of-type(2) { animation-delay: .08s; }
.imp-step { flex-direction: row; align-items: center; gap: 14px; }
.imp-step.col { flex-direction: column; align-items: stretch; }
.imp-step h3 { margin: 0; }
.imp-step p { margin: 2px 0 0; }
.imp-head { display: flex; align-items: center; gap: 14px; }
.imp-num {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: var(--on-primary); font-weight: 800; box-shadow: 0 6px 14px -6px var(--cta-shadow);
}
.imp-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 170px; padding: 20px;
  border: 2px dashed color-mix(in srgb, var(--primary) 40%, var(--line)); border-radius: 16px; cursor: pointer; text-align: center;
  background: color-mix(in srgb, var(--primary-soft) 45%, transparent); transition: background .2s, border-color .2s, transform .2s;
}
.imp-drop:hover { background: var(--primary-soft); border-color: var(--primary); }
.imp-drop.over { background: var(--primary-soft); border-color: var(--primary); transform: scale(1.015); }
.imp-drop.over .imp-ic { animation: impBounce .6s ease infinite; }
.imp-drop.busy { cursor: progress; }
.imp-ic { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.imp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.imp-stats > div { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); animation: exfPop .3s ease both; }
.imp-stats > div:nth-child(2) { animation-delay: .05s; } .imp-stats > div:nth-child(3) { animation-delay: .1s; } .imp-stats > div:nth-child(4) { animation-delay: .15s; }
.imp-stats b { font-size: 1.5rem; line-height: 1.2; }
.imp-stats span { font-size: .78rem; color: var(--muted); }
.imp-stats .ok { background: var(--good-soft); } .imp-stats .ok b { color: var(--good); }
.imp-stats .skip { background: var(--surface-2); } .imp-stats .skip b { color: var(--muted); }
.imp-stats .err { background: var(--bad-soft); } .imp-stats .err b { color: var(--bad); }
.imp-stats .new { background: var(--primary-soft); } .imp-stats .new b { color: var(--primary); }
.imp-tabs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: space-between; }
.imp-tbl td, .imp-tbl th { white-space: nowrap; font-size: .85rem; }
.imp-tbl tbody tr { animation: exfIn .3s ease both; animation-delay: calc(var(--i, 0) * 18ms); }
.imp-tbl tr.st-err td { background: var(--bad-soft); }
.imp-tbl tr.st-skip td { color: var(--muted); }
.imp-msg { white-space: normal !important; min-width: 180px; font-size: .8rem !important; }
.imp-tbl tr.st-err .imp-msg { color: var(--bad); font-weight: 600; }
.imp-badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.imp-badge.ok { background: var(--good-soft); color: var(--good); }
.imp-badge.skip { background: var(--surface-2); color: var(--muted); }
.imp-badge.err { background: var(--bad); color: #fff; }
.imp-tag { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); }
.imp-run { align-items: center; text-align: center; padding: 32px 18px; gap: 14px; }
.imp-run h3 { margin: 0; }
.imp-bar { width: min(420px, 100%); height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.imp-bar i {
  display: block; height: 100%; border-radius: 99px; transition: width .3s ease;
  background: repeating-linear-gradient(45deg, var(--primary) 0 12px, var(--primary-2) 12px 24px); background-size: 34px 34px; animation: impStripe .8s linear infinite;
}
.spin-slow { animation: impBounce 1s ease infinite; }
.imp-okmark { width: 84px; height: 84px; }
.imp-okmark circle, .imp-okmark path { fill: none; stroke: var(--good); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.imp-okmark circle { stroke-dasharray: 176; stroke-dashoffset: 176; animation: ckdDraw .5s ease forwards; opacity: .35; }
.imp-okmark path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: ckdDraw .4s ease .3s forwards; }
.imp-sum { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.imp-sum > div { display: flex; flex-direction: column; align-items: center; min-width: 110px; padding: 10px 14px; border-radius: 12px; background: var(--good-soft); animation: exfPop .35s ease both; animation-delay: calc(var(--i, 0) * 70ms + .3s); }
.imp-sum b { font-size: 1.4rem; color: var(--good); }
.imp-sum span { font-size: .78rem; color: var(--muted); }
.center-row { justify-content: center; }
@keyframes impBounce { 50% { transform: translateY(-6px); } }
@keyframes impStripe { to { background-position: 34px 0; } }
@media (max-width: 640px) { .imp-step { flex-wrap: wrap; } .imp-step > .btn { width: 100%; justify-content: center; } }
/* Nhập Excel: sao lưu, chọn cách nhập (thêm / thay thế), cảnh báo xoá, hộp gõ XOÁ */
.imp-backup { border-color: color-mix(in srgb, #217346 35%, var(--line)); background: color-mix(in srgb, #217346 5%, var(--surface)); }
.imp-backup .imp-num { background: #217346; box-shadow: 0 6px 14px -6px rgba(33, 115, 70, .7); }
.imp-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.imp-mode {
  display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 12px 14px; border-radius: 12px; cursor: pointer;
  border: 2px solid var(--line); background: var(--surface); color: var(--text); font: inherit; transition: border-color .15s, background .15s, transform .15s;
}
.imp-mode b { display: flex; align-items: center; gap: 6px; }
.imp-mode span { font-size: .8rem; color: var(--muted); }
.imp-mode:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--primary); }
.imp-mode.on { border-color: var(--primary); background: var(--primary-soft); }
.imp-mode.on b { color: var(--primary); }
.imp-mode.danger:hover:not(:disabled) { border-color: var(--bad); }
.imp-mode.danger.on { border-color: var(--bad); background: var(--bad-soft); }
.imp-mode.danger.on b { color: var(--bad); }
.imp-warn { padding: 10px 12px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: .86rem; font-weight: 600; animation: exfIn .3s ease both; }
.imp-warn.info { background: var(--warn-soft); color: var(--warn); }
.imp-stats.dim { opacity: .5; }
.imp-wipe { width: min(440px, 100%); }
.imp-wipe-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.imp-wipe-list span { font-size: .8rem; padding: 3px 10px; border-radius: 99px; background: var(--bad-soft); color: var(--bad); }
.imp-wipe-in { margin-top: 14px; text-align: left; }
.imp-wipe-in .inp { text-align: center; font-weight: 800; letter-spacing: .1em; }
/* Phần khớp tìm kiếm tô đậm */
mark.hl { background: color-mix(in srgb, var(--primary) 16%, transparent); color: inherit; font-weight: 700; border-radius: 3px; padding: 0 1px; }
.combo-list { scroll-behavior: smooth; }
/* Tab Tài khoản */
.acc .page-h { align-items: center; }
.acc-new { flex: none; }
.acc-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.acc-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 16px; text-align: left; font: inherit; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); cursor: pointer;
  transition: border-color .18s, transform .18s, box-shadow .18s; animation: exfPop .3s ease both; animation-delay: calc(var(--i, 0) * 60ms); }
.acc-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.acc-tile.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus), var(--shadow); }
.acc-tile small { color: var(--muted); font-size: .78rem; line-height: 1.35; }
.acc-tile-t { font-size: .95rem; font-weight: 600; }
.acc-tile-t b { font-size: 1.5rem; font-weight: 800; margin-right: 4px; font-variant-numeric: tabular-nums; }
.acc-tile-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.acc-tile.manager .acc-tile-ic, .acc-role-card.manager .acc-tile-ic { background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); color: #fff; }
.acc-tile.viewer .acc-tile-ic, .acc-role-card.viewer .acc-tile-ic { background: var(--surface-2); color: var(--muted); }
.acc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.acc-head h3 { margin: 0; }
.acc-search { width: min(260px, 100%); margin: 0; }
.acc-list { list-style: none; margin: 4px 0 0; padding: 0; }
.acc-list li { display: flex; align-items: center; gap: 12px; padding: 12px 10px; margin: 0 -10px; border-radius: 12px;
  border-bottom: 1px solid var(--line); transition: background .2s; animation: exfIn .3s ease both; animation-delay: calc(var(--i, 0) * 35ms); }
.acc-list li:last-child { border-bottom-color: transparent; }
.acc-list li { position: relative; }
.acc-list li.menu-on { z-index: 5; }
.acc-list li:hover { background: var(--surface-2); }
.acc-list li.fresh { animation: accFlash 1.8s ease; }
.acc-list li.out { animation: accOut .32s ease forwards; pointer-events: none; }
@keyframes accFlash { 0%, 40% { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); } }
@keyframes accOut { to { opacity: 0; transform: translateX(24px); } }
.acc-av { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; flex: none;
  font-weight: 800; font-size: 1rem; background: var(--surface-2); color: var(--muted); }
.acc-av.manager { background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); color: #fff; box-shadow: 0 4px 10px -4px var(--cta-shadow); }
.acc-dot { position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--good); border: 2px solid var(--surface); }
.acc-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acc-name { display: flex; align-items: center; gap: 6px; }
.acc-name b { overflow-wrap: anywhere; }
.acc-pill { display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 5px 11px; border-radius: 99px; font-size: .78rem; font-weight: 700;
  background: var(--surface-2); color: var(--muted); transition: background .3s, color .3s; }
.acc-pill.manager { background: var(--primary-soft); color: var(--primary); }
.acc-menu { position: relative; flex: none; }
.acc-menu .icon-btn.on { background: var(--surface-2); }
.acc-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 220px; padding: 6px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); transform-origin: top right; animation: accPop .16s ease-out both; }
@keyframes accPop { from { opacity: 0; transform: scale(.92) translateY(-4px); } }
.acc-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none;
  font: inherit; font-size: .9rem; color: var(--text); text-align: left; cursor: pointer; animation: exfIn .2s ease both; animation-delay: calc(var(--i, 0) * 30ms); }
.acc-pop button:hover { background: var(--surface-2); }
.acc-pop button.danger { color: var(--bad); }
.acc-pop button.danger:hover { background: var(--bad-soft); }
.acc-form { display: flex; flex-direction: column; gap: 14px; }
.acc-form .fld { margin: 0; }
.acc-form .fld small { margin-top: 4px; font-size: .8rem; }
.acc-form small.good { color: var(--good); font-weight: 600; }
.acc-roles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acc-role-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; text-align: left; font: inherit; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .18s, box-shadow .18s, transform .15s;
  animation: exfPop .3s ease both; animation-delay: calc(var(--i, 0) * 60ms); }
.acc-role-card:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); }
.acc-role-card:active { transform: scale(.98); }
.acc-role-card small { color: var(--muted); font-size: .78rem; line-height: 1.35; }
.acc-role-card.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--surface)); box-shadow: 0 0 0 3px var(--focus); }
.acc-check { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); transform: scale(0); transition: transform .22s cubic-bezier(.3, 1.6, .5, 1); }
.acc-role-card.on .acc-check { transform: scale(1); }
.acc-pw { position: relative; }
.acc-pw .inp { width: 100%; padding-right: 56px; }
.acc-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--primary);
  font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; padding: 4px 6px; }
.acc-pw-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.acc-form .inp.bad { border-color: var(--bad); }
.acc-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.acc-done p { margin: 0; }
.acc-cred { width: 100%; margin: 4px 0 0; border: 1px dashed color-mix(in srgb, var(--primary) 45%, var(--line)); border-radius: 12px; background: var(--primary-soft); overflow: hidden; }
.acc-cred div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; animation: ckdRise .35s ease both; animation-delay: calc(var(--i, 0) * 80ms + .35s); }
.acc-cred div + div { border-top: 1px dashed color-mix(in srgb, var(--primary) 30%, transparent); }
.acc-cred dt { color: var(--muted); font-size: .85rem; }
.acc-cred dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.acc-mono { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; letter-spacing: .06em; color: var(--primary); }
@media (max-width: 700px) {
  .acc .page-h { flex-wrap: wrap; }
  .acc-new { width: 100%; justify-content: center; }
  .acc-tiles { gap: 8px; }
  .acc-tile { padding: 10px; }
  .acc-tile small { display: none; }
  .acc-tile-t { display: flex; flex-direction: column; font-size: .8rem; }
  .acc-roles { grid-template-columns: 1fr; }
  .acc-pill { display: none; }
  .acc-av.manager + .acc-who small::before { content: 'Quản lý · '; color: var(--primary); font-weight: 600; }
}

/* Biểu đồ cột HTML (mọc từ đáy lên) */
.chart-scroll { overflow-x: auto; }
.bc { display: flex; align-items: flex-end; gap: 6px; height: 210px; padding-top: 6px; }
.bc-col { flex: 1 0 32px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; border-radius: 8px; cursor: pointer; }
.bc-col:hover, .bc-col.hov { background: var(--surface-2); }
.bc-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.bc-bar { width: min(40%, 14px); min-height: 0; border-radius: 4px 4px 0 0; transition: height .9s cubic-bezier(.34, 1.25, .5, 1); }
.bc-bar.c1 { background: var(--c1); }
.bc-bar.c2 { background: var(--c2); }
.bc-col.out .bc-bar { opacity: .3; }
.bc-col.out.hov .bc-bar { opacity: .6; }
.bc-lbl { font-size: .68rem; color: var(--muted); padding: 4px 0 2px; white-space: nowrap; min-height: 1.3em; }
.chart-tip { font-size: .85rem; min-height: 22px; margin-bottom: 4px; }

/* Tổng quan 4 ô: máy tính 1 hàng (ô đầu rộng hơn); điện thoại: ô đầu và ô cuối chiếm cả hàng */
@media (min-width: 700px) { .kpis.k4 { grid-template-columns: 1.3fr 1fr 1fr 1fr; } }
@media (max-width: 699px) { .kpis.k4 > :last-child { grid-column: 1 / -1; } }

/* ---------- Đời máy: hình máy theo màu vỏ, ô chọn màu / dung lượng, chấm màu ----------
   --dev / --c là MÃ MÀU VỎ MÁY (dữ liệu từng đời máy), không phải màu giao diện. */
.cdot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--c); flex: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); margin-right: 6px; vertical-align: -1px; }
.cname { display: inline-flex; align-items: center; white-space: nowrap; }

.phone-art { display: block; overflow: visible; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .18)); }
.phone-art .ph-body { stroke: rgba(0, 0, 0, .16); stroke-width: 1.5; transition: fill .5s ease; }
.phone-art .ph-bump, .phone-art .ph-cover { fill: currentColor; stroke: rgba(0, 0, 0, .22); stroke-width: 1.2; transition: fill .5s ease; }
.phone-art .ph-cover { fill: rgba(0, 0, 0, .78); }
.phone-art .ph-ring { fill: rgba(0, 0, 0, .28); }
.phone-art .ph-lens { fill: #15171c; }
.phone-art .ph-glass { fill: #24324a; }
.phone-art .ph-glint { fill: rgba(255, 255, 255, .65); }
.phone-art .ph-flash { fill: rgba(255, 244, 214, .9); stroke: rgba(0, 0, 0, .2); }
.phone-art .ph-hinge { stroke: rgba(0, 0, 0, .22); stroke-width: 1.5; }

.dev-preview { --dev: var(--line); position: relative; display: flex; align-items: center; gap: 18px; padding: 14px 18px; margin-bottom: 14px;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); overflow: hidden; transition: border-color .5s ease; }
.dev-preview::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .5s ease;
  background: radial-gradient(120% 140% at 0% 50%, color-mix(in srgb, var(--dev) 55%, transparent) 0%, transparent 62%); }
.dev-preview.has-color { border-color: color-mix(in srgb, var(--dev) 55%, var(--line)); }
.dev-preview.has-color::before { opacity: 1; }
.dev-art { position: relative; flex: none; animation: dev-pop .5s cubic-bezier(.2, .9, .3, 1.25); }
.dev-info { position: relative; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dev-name { font-size: 1.2rem; line-height: 1.25; }
.dev-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.dev-tag { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); }
@keyframes dev-pop { from { transform: translateY(6px) rotate(-4deg) scale(.94); opacity: .4; } to { transform: none; opacity: 1; } }

.pick-row { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch, .cap { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 5px 12px 5px 6px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; cursor: pointer;
  transition: border-color .2s, background .2s, transform .12s, box-shadow .2s; }
.cap { padding: 5px 14px; font-weight: 600; }
.swatch:hover, .cap:hover { border-color: var(--primary); }
.swatch:active, .cap:active { transform: scale(.96); }
.swatch:focus-visible, .cap:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.sw-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--c, var(--surface-2)); display: grid; place-items: center; flex: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .16), inset 0 -6px 10px rgba(0, 0, 0, .08); transition: transform .2s; }
.sw-dot.none { background: repeating-linear-gradient(45deg, var(--surface-2) 0 4px, var(--line) 4px 8px); }
.swatch.on { border-color: var(--c, var(--primary)); background: color-mix(in srgb, var(--c, var(--primary)) 16%, var(--surface)); font-weight: 600;
  box-shadow: 0 4px 14px -6px color-mix(in srgb, var(--c, var(--primary)) 70%, transparent); }
.swatch.on .sw-dot { transform: scale(1.08); }
.cap.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.swatch.add, .cap.add { padding: 5px 10px; color: var(--muted); border-style: dashed; }
.pick-stack { display: grid; gap: 14px; margin-bottom: 14px; }

/* Cài đặt → Đời máy */
.dm-models { display: grid; gap: 8px; }
.dm-model { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.dm-model b { display: block; }
.dm-model .pick-row { gap: 4px; margin-top: 4px; }
.dm-model .mini { font-size: .76rem; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.dm-new { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--primary-soft); color: var(--text); margin-bottom: 12px; }
.color-rows { display: grid; gap: 8px; }
.color-row { display: grid; grid-template-columns: 44px 1fr 40px; gap: 8px; align-items: center; }
.color-row input[type=color] { width: 44px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
@media (max-width: 600px) {
  .dev-preview { gap: 12px; padding: 12px; }
  .dm-model { grid-template-columns: 40px 1fr auto; }
}
@media (prefers-reduced-motion: reduce) { .dev-art { animation: none; } }
.tool-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 12px; }
.tool-row .search { min-width: 200px; margin: 0; }
@media (max-width: 480px) { .item-grid .span2 { grid-column: auto; } }
.dm-model .cname { margin-right: 8px; font-size: .82rem; }
.dev-preview, .pick-stack, .pick-row, .color-rows { flex-shrink: 0; }
.phone-art .ph-band, .phone-art .ph-crown { stroke: rgba(0, 0, 0, .18); stroke-width: 1.2; transition: fill .5s ease; filter: brightness(.92); }
.dev-spec { font-size: .78rem; line-height: 1.4; }

/* Tra bằng AI (Cài đặt → Đời máy) */
.ai-open { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; margin-bottom: 14px; border-radius: var(--r-sm);
  border: 1.5px dashed var(--primary); background: var(--primary-soft); color: var(--text); font: inherit; text-align: left; cursor: pointer; flex-shrink: 0; }
.ai-open svg { color: var(--primary); flex: none; }
.ai-open span { display: flex; flex-direction: column; }
.ai-open small { color: var(--muted); font-size: .8rem; }
.ai-box { display: grid; gap: 8px; padding: 12px 14px; margin-bottom: 14px; border-radius: var(--r-sm); border: 1px solid var(--primary); background: var(--primary-soft); flex-shrink: 0; }
.ai-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ai-row .search { min-width: 220px; margin: 0; }
.ai-wait { display: flex; align-items: center; gap: 10px; font-size: .88rem; }
.ai-wait .spin { width: 18px; height: 18px; border-width: 2px; flex: none; }
.ai-err { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-radius: var(--r-sm); background: var(--bad-soft); color: var(--bad); font-size: .88rem; }
.ai-res { display: grid; gap: 6px; }
.ai-res p { margin: 0; }
.ai-warn { font-size: .82rem; color: var(--warn); }

/* ---------- Báo giá (giống file Excel: giá gốc | giá VND, ô tăng vàng / giảm cam) ---------- */
.page.bg-page { max-width: none; }
.bg-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bg-bar .seg { flex: none; }
.bg-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 2px; }
.bg-check { display: inline-flex; align-items: center; gap: 5px; font-size: .88rem; color: var(--muted); cursor: pointer; user-select: none; }
.bg-chip { display: inline-block; padding: 1px 8px; border-radius: 6px; font-weight: 600; font-size: .85em; }
.bg-chip.up { background: var(--x-up); color: var(--x-up-text); }
.bg-chip.down { background: var(--x-down); color: var(--x-down-text); }
.bg-edit { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 6px 0 2px; display: flex; flex-direction: column; gap: 4px; }
.bg-edit p { margin: 0; }
.bg-menu { display: flex; flex-direction: column; gap: 8px; }
.bg-menu .btn { justify-content: flex-start; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.bg-scroll { container-type: inline-size; overflow: auto; max-width: 100%; border: 1px solid var(--x-border); border-radius: var(--r-sm); background: var(--x-bg); outline: none; }
.bg-scroll.editing { position: relative; }
.bg-scroll.editing:focus-within { box-shadow: 0 0 0 3px var(--focus); }
.bg-catch { position: absolute; left: 0; top: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; resize: none; pointer-events: none; }
.bg-sheet { width: max-content; min-width: 100%; padding: 14px; background: var(--x-bg); color: var(--x-text); display: flex; flex-direction: column; gap: 14px; }
.bg-top { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 40px; position: sticky; left: 14px; max-width: calc(100cqw - 28px); }
.bg-top-l { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.bg-date { font-weight: 700; font-size: 1.05rem; }
.bg-legend { display: flex; gap: 6px; }
.bg-title { font-size: 2rem; font-weight: 800; letter-spacing: .02em; text-align: center; color: var(--x-head-text); }
.bg-title .inp { font-size: 1.2rem; text-align: center; min-width: 260px; }
.bg-params { border-collapse: collapse; font-size: .85rem; }
.bg-params th, .bg-params td { border: 1px solid var(--x-grid); padding: 2px 10px; }
.bg-params th { background: var(--x-head); color: var(--x-head-text); text-align: left; font-weight: 600; }
.bg-params td { text-align: right; font-weight: 700; min-width: 64px; }
.bg-num { width: 80px; padding: 4px 6px; min-height: 0; text-align: right; }
.bg-tbl { border-collapse: collapse; font-size: .82rem; line-height: 1.3; }
.bg-tbl td, .bg-tbl th { border: 1px solid var(--x-grid); padding: 4px 6px; text-align: center; vertical-align: middle; min-width: 44px; }
.bg-tbl th { background: var(--x-head); color: var(--x-head-text); font-weight: 700; white-space: pre-line; font-size: .78rem; }
.bg-tbl td.n { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bg-tbl td.t { white-space: pre-line; font-size: .76rem; text-align: center; max-width: 230px; }
.bg-tbl td.ma { background: var(--x-label); font-weight: 700; white-space: nowrap; }
.bg-tbl td.neg { color: var(--x-neg); }
.bg-tbl td.up { background: var(--x-up); color: var(--x-up-text); }
.bg-tbl td.down { background: var(--x-down); color: var(--x-down-text); }
.bg-tbl td.gap { border: 0; min-width: 18px; padding: 0; background: transparent; }
.bg-tbl tr.bg-cap td { border: 0; padding: 0 0 4px; text-align: left; font-weight: 700; color: var(--primary); background: transparent; font-size: .85rem; }
.bg-tbl .c0 { position: sticky; left: 0; z-index: 1; }
.bg-tbl th.c0 { z-index: 2; }
.bg-tbl.ed td:not(.gap), .bg-tbl.ed th { cursor: cell; }
.bg-tbl .bg-sel { outline: 2px solid var(--x-focus); outline-offset: -2px; }
.bg-in { display: block; width: 100%; min-width: 70px; border: 0; padding: 0; margin: 0; resize: none; font: inherit; text-align: inherit;
  background: var(--x-focus-bg); color: var(--x-text); outline: none; }
.bg-notes { display: flex; flex-direction: column; gap: 8px; max-width: 1100px; }
.bg-notes-h { font-size: 1.1rem; font-weight: 800; color: var(--x-neg); }
.bg-notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; align-items: start; }
.bg-note { border: 1px solid var(--x-card-line); border-radius: 8px; padding: 10px 12px; font-size: .8rem; display: flex; flex-direction: column; color: var(--x-note); }
.bg-note b { color: var(--x-neg); margin-top: 4px; }
.bg-note.ed { gap: 6px; padding: 8px; }
.bg-note.ed textarea { font-size: .82rem; }
@media (max-width: 700px) {
  .bg-top { gap: 10px 20px; left: 10px; max-width: calc(100cqw - 20px); }
  .bg-title { font-size: 1.5rem; }
  .bg-sheet { padding: 10px; }
}
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  .bg-scroll { overflow: visible; border: 0; }
  .bg-sheet { zoom: var(--print-zoom, 1); padding: 0; }
  .bg-tbl .c0 { position: static; }
  .bg-tbl td.up, .bg-tbl td.down, .bg-tbl th, .bg-tbl td.ma, .bg-chip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* Gợi ý giá từ Báo giá (form Nhập mua) */
.bg-hint { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--primary-soft); color: var(--text); font-size: .88rem; }
.bg-hint > .ic { color: var(--primary); flex: none; margin-top: 2px; }
.bg-hint small { display: block; margin-top: 3px; line-height: 1.4; }
.bg-hint .btn { flex: none; }

/* ============ Bán hàng / Nhập mua kiểu máy POS (giống KiotViet): trái = tìm + phiếu, phải = khung thanh toán ============ */
.page.pos-page { max-width: 1400px; }
.pos-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pos-head h1 { margin: 0; }
.pos-head p { margin: 2px 0 0; font-size: .88rem; }
.pos-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 16px; align-items: start; }
.pos-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pos-main > * { animation: gtFadeInUp .4s ease both; }
.pos-main > :nth-child(2) { animation-delay: .05s; } .pos-main > :nth-child(3) { animation-delay: .1s; }
.pos-cart-h { display: flex; align-items: center; gap: 8px; }
.pos-cart-h h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 1rem; }

/* Ô tìm / quét IMEI */
.pos-search { position: relative; display: flex; align-items: center; }
.pos-search > .ic { position: absolute; left: 16px; color: var(--primary); pointer-events: none; z-index: 1; }
.pos-search .inp { width: 100%; height: 54px; padding: 0 64px 0 50px; font-size: 1.05rem; border-radius: 14px; border-width: 1.5px; box-shadow: var(--shadow);
  transition: border-color .18s, box-shadow .18s; }
.pos-search .inp:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus), var(--shadow); }
.pos-search > kbd { position: absolute; right: 14px; }

/* Dòng máy trong phiếu */
.pos-lines { list-style: none; margin: 0; padding: 0; }
.pos-lines-h, .pos-line { display: grid; grid-template-columns: 26px 50px minmax(0, 1fr) 150px 112px 112px 120px 40px; align-items: center; gap: 10px; }
.pos-line.buy, .pos-lines-h.buy { grid-template-columns: 26px 50px minmax(0, 1fr) 150px 112px 112px 120px 76px; }
.pos-lines-h { padding: 6px 10px; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.pos-lines-h > :first-child { grid-column: span 3; }
.pos-lines-h > :nth-child(n+2) { text-align: right; }
.pos-line { position: relative; padding: 10px; border-bottom: 1px solid var(--line); border-radius: 10px; transition: background .2s; animation: posIn .3s ease both; }
.pos-line:last-child { border-bottom-color: transparent; }
.pos-line:hover { background: var(--surface-2); }
.pos-line.fresh { animation: posIn .3s ease both, accFlash 1.8s ease; }
.pos-line.out { animation: accOut .22s ease forwards; pointer-events: none; }
@keyframes posIn { from { opacity: 0; transform: translateY(-8px); } }
.pos-no { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: .75rem; font-weight: 800; }
.pos-thumb { display: grid; place-items: center; width: 50px; height: 56px; border-radius: 10px; background: var(--surface-2); flex: none; }
.pos-thumb .phone-art { height: 46px; width: auto; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .18)); }
.pos-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pos-info > b { font-size: .98rem; overflow-wrap: anywhere; }
.pos-specs { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: .78rem; }
.pos-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text); font-weight: 600; }
.pos-line:hover .pos-chip { background: var(--surface); }
.pos-imei { font-family: ui-monospace, Consolas, monospace; color: var(--muted); font-size: .76rem; }
.pos-pin { color: var(--muted); }
.pos-loi { color: var(--warn); font-weight: 600; }
.pos-price { display: flex; flex-direction: column; gap: 2px; margin: 0; min-width: 0; }
.pos-price > span { display: none; font-size: .72rem; color: var(--muted); font-weight: 600; }
.pos-price .inp { height: 40px; font-weight: 700; }
.pos-price.sub .inp { font-weight: 500; }
.pos-sum { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.pos-sum b { font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.pos-sum small { font-size: .74rem; font-weight: 600; }
.pos-acts { display: flex; justify-content: flex-end; }
.pos-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px 16px; text-align: center; border: 2px dashed var(--line); border-radius: 14px; }
.pos-empty-ic { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); margin-bottom: 4px;
  animation: exfPop .4s ease both; }

/* Lưới máy trong kho để bấm chọn */
.pos-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.pos-tile { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px; text-align: left; font: inherit; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer;
  transition: transform .18s, box-shadow .18s, border-color .18s; animation: exfIn .3s ease both; animation-delay: calc(var(--i, 0) * 22ms); }
.pos-tile:hover:not(:disabled) { transform: translateY(-3px); border-color: color-mix(in srgb, var(--primary) 55%, var(--line)); box-shadow: var(--shadow-lg); }
.pos-tile:active:not(:disabled) { transform: scale(.98); }
.pos-tile:disabled { cursor: default; opacity: .75; }
.pos-tile.first { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.pos-tile-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding-right: 22px; }
.pos-tile-t b { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-tile-s { display: flex; align-items: center; gap: 5px; font-size: .78rem; color: var(--muted); }
.pos-tile-t small { font-size: .74rem; }
.pos-tile-p { font-weight: 700; font-size: .86rem; color: var(--primary); }
.pos-tile-p small { color: var(--muted); font-weight: 500; }
.pos-add { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary); transition: transform .18s, background .18s, color .18s; }
.pos-tile:hover:not(:disabled) .pos-add { background: var(--primary); color: var(--on-primary); transform: rotate(90deg); }
.pos-enter { position: absolute; top: 8px; right: 8px; }
.pos-more { margin-top: 10px; width: 100%; justify-content: center; }

/* Dòng nhập nhanh (Nhập mua) */
.pos-quick-grid { display: grid; grid-template-columns: minmax(180px, 2.2fr) 1fr 1fr .8fr 1.4fr 1.4fr auto; gap: 10px; align-items: end; }
.pos-quick-grid .fld { margin: 0; min-width: 0; }
.pos-quick-grid .q-add { height: 44px; white-space: nowrap; }
.pos-quick .q-name { position: relative; }
.pos-quick .q-name .model-hint { position: absolute; top: 100%; left: 0; margin-top: 2px; white-space: nowrap; }

/* Khung thanh toán bên phải */
.pos-side { position: sticky; top: 14px; display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: gtFadeInUp .45s .08s ease both; }
.pos-side-h { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.pos-side-h > .grow { min-width: 0; }
.pos-side-h b { display: block; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-side-h small { font-size: .8rem; }
.pos-side-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none; color: #fff;
  background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); box-shadow: 0 6px 14px -6px var(--cta-shadow); }
.pos-date { order: 3; flex: 1 0 100%; display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); color: var(--muted); cursor: pointer; }
.pos-date input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: .88rem; font-weight: 600; color: var(--text); }
.pos-party { margin: 0; }
.pos-party-in { position: relative; }
.pos-party-in > .ic { position: absolute; left: 11px; top: 13px; z-index: 1; color: var(--muted); pointer-events: none; }
.pos-party-in .combo .inp { padding-left: 34px; }
.pos-rows { display: flex; flex-direction: column; gap: 7px; }
.pos-row { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; color: var(--muted); }
.pos-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.pos-total { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--primary-soft); }
.pos-total span { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); }
.pos-total b { font-size: 2rem; font-weight: 800; line-height: 1.15; color: var(--primary); font-variant-numeric: tabular-nums; animation: posBump .25s ease; }
.pos-total b.neg { color: var(--bad); }
.pos-total b small { font-size: 1rem; margin-left: 3px; font-weight: 700; }
@keyframes posBump { 40% { transform: scale(1.03); } }
.pos-profit { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 10px; font-size: .88rem; }
.pos-profit.up { background: var(--good-soft); color: var(--good); }
.pos-profit.down { background: var(--bad-soft); color: var(--bad); }
.pos-profit b .money { color: inherit; }
.pos-pay { width: 100%; height: 54px; justify-content: center; font-size: 1.05rem; font-weight: 800; border-radius: 14px; gap: 8px; }
.pos-pay kbd { margin-left: 6px; background: rgba(255, 255, 255, .2); border-color: transparent; color: inherit; }
.pos-clear { width: 100%; justify-content: center; color: var(--muted); }
.pos-clear:hover { color: var(--bad); background: var(--bad-soft); }
.pos-keys { margin: 0; text-align: center; font-size: .76rem; }
.pos-paybar { display: none; }

/* Lưu xong */
.pos-done { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.pos-done-ma { font-size: 1.3rem; letter-spacing: .04em; color: var(--primary); animation: gtFadeInUp .35s .3s ease both; }
.pos-done-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; }
.pos-done-grid > div { flex: 1; min-width: 100px; display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 12px; background: var(--surface-2);
  animation: exfPop .35s ease both; animation-delay: calc(var(--i, 0) * 70ms + .35s); }
.pos-done-grid small { color: var(--muted); font-size: .76rem; }

@media (max-width: 1280px) { .pos-grid { grid-template-columns: minmax(0, 1fr) 310px; } }
@media (max-width: 1000px) {
  .pos-grid { grid-template-columns: 1fr; }
  .pos-side { position: static; }
  .pos-paybar { position: sticky; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 8px); z-index: 6; display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--primary) 40%, var(--line)); box-shadow: var(--shadow-lg); }
  .pos-paybar small { display: block; font-size: .74rem; color: var(--muted); }
  .pos-paybar b { font-size: 1.2rem; color: var(--primary); }
}
/* Dòng máy: khung trái hẹp (màn hình nhỏ / có khung thanh toán bên phải) → xếp 2–3 tầng */
.pos-main { container: posmain / inline-size; }
@container posmain (max-width: 860px) {
  .pos-lines-h { display: none; }
  .pos-line, .pos-line.buy { grid-template-columns: 26px 50px repeat(3, minmax(0, 1fr)) auto; grid-template-areas: "no th info info info x" "p1 p1 p1 p2 p3 p3" "sum sum sum sum sum sum"; row-gap: 8px; }
  .pos-line > .pos-no { grid-area: no; } .pos-line > .pos-thumb { grid-area: th; } .pos-line > .pos-info { grid-area: info; }
  .pos-line > .icon-btn, .pos-line > .pos-acts { grid-area: x; }
  .pos-line > .pos-price:nth-of-type(1) { grid-area: p1; } .pos-line > .pos-price:nth-of-type(2) { grid-area: p2; } .pos-line > .pos-price:nth-of-type(3) { grid-area: p3; }
  .pos-line > .pos-sum { grid-area: sum; flex-direction: row; justify-content: space-between; align-items: baseline; padding-top: 6px; border-top: 1px dashed var(--line); }
  .pos-price > span { display: block; }
  .pos-quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pos-quick-grid .q-name { grid-column: span 3; margin-bottom: 18px; }
}
@container posmain (max-width: 520px) {
  .pos-line, .pos-line.buy { grid-template-areas: "no th info info info x" "p1 p1 p1 p1 p1 p1" "p2 p2 p2 p3 p3 p3" "sum sum sum sum sum sum"; }
  .pos-quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos-quick-grid .q-name, .pos-quick-grid .q-add { grid-column: span 2; }
  .pos-tiles { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .pos-search .inp { height: 50px; }
  .pos-search > kbd { display: none; }
}
