/* ============ 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;
  --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;
    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;
  color-scheme: dark;
}

/* ============ 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: 1150px) {
  .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); }
.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; }

/* ============ Modal / sheet ============ */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(6, 20, 26, .5);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .15s;
}
.sheet {
  width: 100%; max-height: 94vh; background: var(--surface); border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: up .2s ease-out;
}
.sheet-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 8px 20px; }
.sheet-b { padding: 8px 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.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);
}
.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; }
@media (min-width: 700px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { width: 540px; border-radius: 20px; max-height: 88vh; }
  .sheet.wide { width: 920px; }
}
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.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; }

/* order lines editor */
.lines { display: flex; flex-direction: column; gap: 10px; }
.lines-h { display: none; }
.line {
  display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2);
  grid-template-columns: .8fr 1.1fr 1.1fr 40px;
  grid-template-areas: "prod prod prod del" "qty price amt amt" "note note note note";
}
.c-prod { grid-area: prod; } .c-qty { grid-area: qty; } .c-price { grid-area: price; }
.c-amt { grid-area: amt; font-weight: 600; } .c-note { grid-area: note; } .c-del { grid-area: del; align-self: center; }
.c-amt.manual { border-color: var(--warn); }
.line .inp { background: var(--surface); }
.line .inp.num { padding: 9px 10px; }
.add-line { align-self: flex-start; }
@media (min-width: 700px) {
  .lines-h, .line { display: grid; grid-template-columns: 1.5fr .75fr 1fr 1.1fr 1fr 40px; grid-template-areas: "prod qty price amt note del"; gap: 8px; }
  .line { padding: 0; border: 0; background: none; }
  .lines-h span { font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; }
  .lines-h span:nth-child(n+2):nth-child(-n+4) { text-align: right; }
}
.paynow { width: 220px; }
.balance-hint { background: var(--primary-soft); color: var(--text); padding: 10px 14px; border-radius: var(--r-sm); font-size: .9rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* statement / bill */
.day-pick { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.day-pick .inp { max-width: 180px; }
.bill { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.bill-h { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; padding-bottom: 12px; border-bottom: 2px solid var(--primary); }
.bill-h small { display: block; font-size: .75rem; color: var(--muted); }
.bill-h h2 { font-size: 1.3rem; }
.bill-h .r { text-align: right; }
.sub-h { font-size: .8rem; text-transform: uppercase; color: var(--muted); letter-spacing: .03em; }
.pays-mini { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
.pays-mini div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; background: var(--good-soft); border-radius: 8px; }
.totals { margin: 0; display: flex; flex-direction: column; gap: 6px; margin-left: auto; width: 100%; max-width: 380px; }
.totals div { display: flex; justify-content: space-between; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.totals .grand { border-top: 2px solid var(--line); padding-top: 8px; margin-top: 4px; font-size: 1.15rem; }
.totals .grand dt { color: var(--text); font-weight: 700; }
.totals .grand dd { color: var(--primary); font-weight: 700; }
.note { margin: 0; font-size: .88rem; color: var(--muted); font-style: italic; }
.bill-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Form nhập phiếu bán / nhập: y hệt bảng báo cáo (nền giấy trắng) */
.xl.xf-paper { overflow: visible; padding: 14px 10px 10px; }
.xf-party { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.xf-party .combo { flex: 1; max-width: 360px; }
.xf-party .inp { background: var(--x-bg); color: var(--x-text); border-color: var(--x-sep); }
.xl-tbl.xf { font-size: .92rem; }
.xf th { background: var(--x-head); color: var(--x-head-text); }
.xf col.x-d { width: 11%; } .xf col.x-n { width: 17%; } .xf col.x-q { width: 10%; } .xf col.x-p { width: 13%; }
.xf col.x-a { width: 14%; } .xf col.x-t { width: 14%; } .xf col.x-g { width: 15%; } .xf col.x-x { width: 6%; }
.xf td { padding: 0; vertical-align: middle; }
.xf .cell .inp, .xf .inp.cell {
  border: 0; border-radius: 0; background: transparent; color: inherit; min-height: 38px; padding: 7px 6px; box-shadow: none; width: 100%;
}
.xf .cell .inp:focus, .xf .inp.cell:focus { outline: 2px solid var(--x-focus); outline-offset: -2px; background: var(--x-focus-bg); box-shadow: none; }
.xf .inp::placeholder { color: var(--x-ph); }
/* Máy tính: đã có tiêu đề cột nên ẩn chữ gợi ý trong ô (trừ dòng đầu) */
@media (min-width: 700px) { .xf tbody tr:not(:first-child) .inp::placeholder { color: transparent; } }
.xf .t-date .inp, .xf .t-prod .inp, .xf .t-note .inp { text-align: center; }
.xf .inp.bad { outline: 2px solid var(--x-neg); outline-offset: -2px; background: var(--x-bad-bg); }
.xf .inp.amt { font-weight: 600; }
.xf .inp.amt.manual { color: var(--x-manual); }
.xf tr.neg td:not(.t-pay):not(.t-note) .inp { color: var(--x-neg); font-weight: 700; }
.xf tr.neg td.t-pay, .xf tr.neg td.t-note { color: var(--x-text); font-weight: 400; }
.qty-cell { display: flex; align-items: center; }
.qty-cell .sign { border: 0; background: none; color: var(--x-ph); font-weight: 700; font-size: .95rem; width: 18px; padding: 0; cursor: pointer; flex-shrink: 0; }
.qty-cell .sign:hover { color: var(--x-neg); }
.xf .combo-list { color: var(--text); text-align: left; }
.xf-paper .add-line { margin-top: 6px; color: var(--primary); }
@media (max-width: 699px) {
  .xl-tbl.xf, .xf tbody, .xf tfoot { display: block; }
  .xf colgroup, .xf thead { display: none; }
  .xf tbody tr {
    display: grid; grid-template-columns: 1fr 1fr 1.2fr;
    grid-template-areas: "date prod prod" "qty price amt" "pay note note";
    border: 1px solid var(--x-sep); border-radius: 8px; margin-bottom: 8px;
  }
  .xf td { display: block; border: 0 !important; }
  .xf .t-date { grid-area: date; border-right: 1px solid var(--x-card-line) !important; border-bottom: 1px solid var(--x-card-line) !important; }
  .xf .t-prod { grid-area: prod; border-bottom: 1px solid var(--x-card-line) !important; }
  .xf .t-qty { grid-area: qty; border-right: 1px solid var(--x-card-line) !important; }
  .xf .t-price { grid-area: price; border-right: 1px solid var(--x-card-line) !important; }
  .xf .t-amt { grid-area: amt; }
  .xf .t-pay { grid-area: pay; border-top: 1px solid var(--x-card-line) !important; border-right: 1px solid var(--x-card-line) !important; }
  .xf .t-note { grid-area: note; border-top: 1px solid var(--x-card-line) !important; }
  .xf .t-pay .inp::placeholder, .xf .t-note .inp::placeholder, .xf .t-amt .inp::placeholder { color: var(--x-ph); }
  .xf tfoot tr { display: flex; justify-content: space-between; border-top: 1px solid var(--x-rule); }
  .xf tfoot td { display: block; }
  .xf tfoot td:empty { display: none; }
}

/* Phiếu dạng Excel (báo cáo khách / NCC) — luôn nền trắng như tờ giấy để chụp ảnh gửi Zalo */
.xl-wrap { display: flex; flex-direction: column; gap: 12px; }
.xl {
  background: var(--x-bg); color: var(--x-text); border: 1px solid var(--x-border); border-radius: 6px; padding: 16px 12px 14px;
  font-family: 'Be Vietnam Pro', Arial, sans-serif; box-shadow: var(--shadow); overflow-x: auto;
}
.xl-party { font-size: .95rem; margin-left: 8%; }
.xl-party span { font-weight: 600; margin-right: 6px; }
.xl-party b { font-weight: 700; }
.xl-title { text-align: center; font-size: clamp(1rem, 4.2vw, 1.35rem); font-weight: 700; margin: 8px 0 12px; color: var(--x-text); }
.xl-tbl { width: 100%; min-width: 340px; border-collapse: collapse; font-size: clamp(.7rem, 3vw, .9rem); font-variant-numeric: tabular-nums; }
.xl-tbl col.c-d { width: 9%; } .xl-tbl col.c-n { width: 17%; } .xl-tbl col.c-q { width: 11%; }
.xl-tbl col.c-p { width: 14%; } .xl-tbl col.c-a { width: 17%; } .xl-tbl col.c-t { width: 17%; } .xl-tbl col.c-g { width: 15%; }
.xl-tbl th {
  background: var(--x-head); color: var(--x-head-text); font-weight: 700; text-align: center; padding: 8px 4px; border-top: 1px solid var(--x-rule); border-bottom: 1px solid var(--x-rule);
  border-left: 1px solid var(--x-grid); white-space: nowrap;
}
.xl-tbl th:first-child, .xl-tbl td:first-child { border-left: 0; }
.xl-tbl td { padding: 6px 6px; border-left: 1px solid var(--x-grid); border-bottom: 1px dotted var(--x-dot); vertical-align: top; }
.xl-tbl tbody tr.first td { border-top: 1px solid var(--x-sep); }
.xl-tbl tbody tr:first-child td { border-top: 0; }
.xl-tbl .c { text-align: center; } .xl-tbl .r { text-align: right; white-space: nowrap; }
.xl-tbl tr.neg td:not(.pay):not(.gc) { color: var(--x-neg); font-weight: 700; }
.xl-tbl .negc { color: var(--x-neg); font-weight: 700; }
.xl-tbl td.gc { font-size: .88em; color: var(--x-note); text-align: center; }
.xl-tbl td.empty { color: var(--x-muted); padding: 18px; }
.xl-tbl tfoot td { border-bottom: 0; padding: 8px 6px; font-size: 1.05em; }
.xl-tbl tfoot tr:first-child td { border-top: 1px solid var(--x-rule); }
.xl-tbl tfoot tr + tr td { border-top: 1px solid var(--x-rule); }
.xl-tbl tfoot .lbl { text-align: right; font-weight: 700; border-left: 0; }
.xl-tbl tfoot .b { font-weight: 700; }
.xl-tbl tfoot .hl { background: var(--x-hl); color: var(--x-hl-text); }
@media (max-width: 520px) {
  .xl { padding: 12px 4px 10px; }
  .xl-party { margin-left: 4px; font-size: .88rem; }
  .xl-tbl { min-width: 0; font-size: 9.5px; }
  .xl-tbl colgroup { display: none; }
  .xl-tbl th { white-space: normal; padding: 6px 2px; line-height: 1.2; }
  .xl-tbl td { padding: 5px 2px; }
  .xl-tbl td.gc { min-width: 40px; font-size: 1em; }
  .xl-tbl tfoot td { font-size: 1em; padding: 7px 2px; }
}
}
/* Khi chụp ảnh: khổ cố định, chữ to rõ */
.xl.capture { width: 820px; border: 0; border-radius: 0; box-shadow: none; padding: 22px 18px 18px; overflow: visible; }
.xl.capture .xl-title { font-size: 1.45rem; }
.xl.capture .xl-tbl { font-size: 15px; }
@media print { .xl { border: 0; box-shadow: none; padding: 0; } }

/* 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); }

.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 { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; animation: up .2s; }
.toast.err { background: var(--bad); color: #fff; }

/* 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; }
}

/* ============ In ấn ============ */
@media print {
  body { background: #fff; color: #000; font-size: 12pt; }
  .side, .tabbar, .fab, .no-print, .toasts { display: none !important; }
  .main { margin: 0; padding: 0; }
  .page { padding: 0; max-width: none; }
  .bill { border: 0; box-shadow: none; padding: 0; }
  .tbl-wrap { overflow: visible; margin: 0; padding: 0; }
  .tbl tbody tr:hover td { background: none; }
}

/* ---------- Hạn dùng: băng nhắc + trang gia hạn ---------- */
.lic-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 16px 0; padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid; font-size: 14px; line-height: 1.45; }
.lic-banner.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.lic-banner.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.lic-banner .grow { flex: 1 1 220px; }
.lic-emoji { font-size: 20px; line-height: 1; }
.lic-status { border-left: 4px solid var(--good); }
.lic-status.warn { border-left-color: var(--warn); }
.lic-status.bad { border-left-color: var(--bad); }
.lic-big { font-size: 20px; margin: 0; }
.lic-status p { margin: 0; }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.plan { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; transition: border-color .15s, transform .15s; }
.plan:hover:not(:disabled) { border-color: var(--primary); transform: translateY(-1px); }
.plan:disabled { opacity: .6; cursor: wait; }
.plan-price { font-size: 20px; font-weight: 700; color: var(--primary); }
.plan-top { display: flex; align-items: center; gap: 8px; width: 100%; justify-content: space-between; }
.plan-off { background: var(--bad); color: #fff; font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.qr-col { display: flex; flex-direction: column; gap: 8px; width: 280px; max-width: 100%; }
.qr-box { width: 280px; height: 280px; max-width: 100%; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px; box-sizing: border-box; }
img.qr-box { height: auto; aspect-ratio: 1; }
.pay-info { flex: 1 1 240px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pay-info p { margin: 0; }
.pay-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.pay-dl dt { color: var(--muted); }
.pay-dl dd { margin: 0; overflow-wrap: anywhere; }
.pay-wait { display: flex; align-items: center; gap: 8px; color: var(--primary); }
.spin.sm { width: 16px; height: 16px; border-width: 2px; }
.lic-done { display: flex; gap: 12px; align-items: flex-start; background: var(--good-soft); color: var(--good); padding: 14px; border-radius: var(--r-sm); }
.lic-done p { margin: 4px 0 0; }
@media (max-width: 640px) { .lic-banner { margin: 10px 12px 0; } }

/* ---------- Khung QR chuyển khoản kiểu trang payOS / VietQR (luôn nền trắng kể cả chế độ tối) ---------- */
.pay-v { display: flex; flex-direction: column; gap: 12px; }
.pay-v .row.wrap { flex-wrap: wrap; gap: 8px; }
.vq-deadline { margin: 0; text-align: center; font-size: .92rem; }
.vq-card { background: #ffffff; color: #111111; border: 1px solid #e1e6ee; border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); }
.vq-tip { margin: 0 0 14px; text-align: center; font-size: .86rem; color: #333333; }
.vq-body { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 20px 32px; align-items: center; }
.vq-left { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.vq-logo { font-size: 1.6rem; display: inline-flex; align-items: center; letter-spacing: -.01em; }
.vq-logo b { font-weight: 900; }
.vq-v { color: #da251d; font-size: 1.15em; }
.vq-iet { color: #0a4f9e; }
.vq-pro { color: #0a4f9e; background: #f5c400; padding: 0 6px; margin-left: 5px; border-radius: 3px; }
.vq-qr { width: 100%; max-width: 270px; aspect-ratio: 1; border: 2px solid #0a4f9e; padding: 4px; display: grid; place-items: center; background: #ffffff; box-sizing: border-box; }
.vq-qr img { width: 100%; height: 100%; display: block; }
.vq-official { width: 100%; max-width: 300px; aspect-ratio: 1; display: block; }
.vq-banks { display: flex; align-items: center; gap: 12px; }
.vq-napas { color: #0a4f9e; font-weight: 700; font-size: 1.05rem; }
.vq-napas em { margin-left: 3px; color: #1f7ae0; }
.vq-sep { width: 2px; height: 26px; background: #cbd5e1; }
.vq-bank { color: #006b68; font-weight: 900; font-size: 1.35rem; }
.vq-right { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.vq-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.vq-row > div { display: flex; flex-direction: column; min-width: 0; }
.vq-row small { color: #64748b; font-size: .84rem; }
.vq-row b { font-size: 1.02rem; overflow-wrap: anywhere; }
.vq-bankrow { justify-content: flex-start; }
.vq-bankdot { flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%; background: #006b68; color: #ffffff; display: grid; place-items: center; font-size: .66rem; font-weight: 800; }
.vq-copy { flex-shrink: 0; border: 0; background: #e8f5ee; color: #1f5f45; font: inherit; font-size: .8rem; font-weight: 600; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.vq-copy:hover { background: #d6eee1; }
.vq-note { margin: 16px 0 0; font-size: .86rem; color: #333333; }
@media (max-width: 640px) {
  .vq-card { padding: 14px 12px; }
  .vq-body { grid-template-columns: 1fr; }
  .vq-qr { max-width: 250px; }
}

/* ---------- Bán hàng / Mua hàng: bảng nhập theo từng khách / NCC ---------- */
.pick-row, .sheet-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sheet-bar .combo-wrap { min-width: 200px; }
.xl.sheet-paper { overflow: visible; }
.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; } }

/* ---------- Hiệu ứng Tổng quan: cột biểu đồ mọc dần từ đáy, lần lượt từ trái sang ---------- */
.chart .bar { transform-box: fill-box; transform-origin: 50% 100%; animation: barGrow .75s cubic-bezier(.22, .9, .3, 1) both; animation-delay: var(--d, 0ms); }
@keyframes barGrow { from { transform: scaleY(0); } }
.chart .grid, .chart text { animation: fade .6s ease both; }

/* ---------- Chốt sổ: dòng đã chốt tô hồng (chỉ xem), ghi chú chốt sổ màu đỏ ---------- */
.xf .t-date { position: relative; }
.ck-box { position: absolute; left: 3px; top: 50%; transform: translateY(-50%); display: flex; z-index: 1; }
.ck-box input { width: 15px; height: 15px; margin: 0; cursor: pointer; accent-color: var(--x-neg); opacity: .55; }
.ck-box input:hover { opacity: 1; }
.xf .t-date:has(.ck-box) .inp { padding-left: 20px; }
.xf tbody tr.ck-row td {
  padding: 0 6px; height: 34px; line-height: 34px; vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--x-note); background: color-mix(in srgb, var(--x-neg) 7%, var(--x-bg));
}
.xf tbody tr.ck-note td { border-left: 0; padding: 7px 10px; text-align: left; border-top: 1px solid var(--x-sep); border-bottom: 3px double var(--x-neg); background: color-mix(in srgb, var(--x-neg) 6%, transparent); }
.ck-ink { color: var(--x-neg); font-weight: 600; font-size: .9rem; }
.ck-ink b { font-weight: 700; }
.ck-undo { font-size: .78rem; font-weight: 500; color: var(--x-muted); margin-left: 10px; padding: 0; text-decoration: underline; }
@media (max-width: 699px) {
  .xf tbody tr.ck-note { display: block; border: 0; margin: 0 0 8px; }
  .xf tbody tr.ck-note td { display: block; }
}

/* ---------- Hộp hỏi chốt sổ: bật lên, nét bút vẽ dấu tích, đóng dấu "ĐÃ CHỐT SỔ" ---------- */
.ckd-overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); animation: ckdFade .2s ease both;
}
.ckd-overlay.out { animation: ckdFadeOut .22s ease both; }
.ckd {
  position: relative; width: min(400px, 100%); background: var(--surface); color: var(--text); border-radius: 18px;
  padding: 22px 22px 18px; text-align: center; box-shadow: 0 24px 60px -12px rgba(15, 23, 42, .45);
  animation: ckdPop .38s cubic-bezier(.2, 1.3, .4, 1) both; overflow: hidden;
}
.ckd-overlay.out .ckd { animation: ckdDrop .22s ease both; }
.ckd.stamped { animation: ckdThud .35s ease .12s both; }
.ckd-mark { width: 64px; height: 64px; margin: 0 auto 6px; display: block; }
.ckd-mark circle, .ckd-mark path { fill: none; stroke: var(--bad); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.ckd-mark.undo circle, .ckd-mark.undo path { stroke: var(--primary); }
.ckd-ring { stroke-dasharray: 176; stroke-dashoffset: 176; animation: ckdDraw .55s ease .1s forwards; opacity: .35; }
.ckd-pen { stroke-dasharray: 60; stroke-dashoffset: 60; animation: ckdDraw .45s ease .5s forwards; }
.ckd-title { margin: 4px 0 2px; font-size: 1.12rem; }
.ckd-party { margin: 0 0 12px; color: var(--muted); font-weight: 600; }
.ckd-sum {
  display: flex; flex-direction: column; gap: 2px; align-items: center; padding: 12px; border-radius: 12px;
  background: var(--bad-soft); border: 1px dashed color-mix(in srgb, var(--bad) 45%, transparent);
  animation: ckdRise .4s ease .25s both;
}
.ckd-sum > span { font-size: .8rem; color: var(--muted); }
.ckd-ink { font-weight: 800; font-size: 1.7rem; line-height: 1.2; color: var(--bad); }
.ckd-sum small { font-size: .85rem; }
.ckd-inp { width: 100%; margin-top: 14px; text-align: center; font-weight: 600; animation: ckdRise .4s ease .3s both; }
.ckd-note { margin: 12px 0 0; font-size: .84rem; color: var(--muted); animation: ckdRise .4s ease .35s both; }
.ckd-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.ckd-actions .btn { min-width: 120px; justify-content: center; }
.ckd-go { background: var(--bad); color: #fff; border-color: var(--bad); }
.ckd-go:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--bad) 70%, transparent); }
.ckd-stamp {
  position: absolute; left: 50%; top: 44%; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 18px; border: 4px double var(--bad); border-radius: 10px; color: var(--bad); background: color-mix(in srgb, var(--surface) 70%, transparent);
  font-weight: 800; font-size: 1.5rem; letter-spacing: .08em; white-space: nowrap; pointer-events: none;
  animation: ckdStamp .42s cubic-bezier(.3, 1.6, .5, 1) both;
}
.ckd-stamp small { font-size: .8rem; letter-spacing: .12em; font-weight: 700; }
.ckd-stamp.undo { color: var(--primary); border-color: var(--primary); }
@keyframes ckdFade { from { opacity: 0; } }
@keyframes ckdFadeOut { to { opacity: 0; } }
@keyframes ckdPop { from { opacity: 0; transform: translateY(18px) scale(.86); } }
@keyframes ckdDrop { to { opacity: 0; transform: translateY(10px) scale(.95); } }
@keyframes ckdDraw { to { stroke-dashoffset: 0; } }
@keyframes ckdRise { from { opacity: 0; transform: translateY(8px); } }
@keyframes ckdStamp { from { opacity: 0; transform: translate(-50%, -50%) rotate(-12deg) scale(2.6); } to { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(1); } }
@keyframes ckdThud { 30% { transform: scale(.97); } 60% { transform: scale(1.01) rotate(.4deg); } }
/* Hộp hỏi xác nhận dùng chung (thêm mặt hàng / khách mới …): tông xanh */
.ckd-mark.info circle, .ckd-mark.info path { stroke: var(--primary); }
.ckd-name {
  display: inline-block; margin: 6px 0 2px; padding: 6px 16px; border-radius: 10px; font-size: 1.15rem; font-weight: 700;
  background: var(--primary-soft); color: var(--primary); border: 1px dashed color-mix(in srgb, var(--primary) 45%, transparent);
  animation: ckdRise .4s ease .2s both; max-width: 100%; overflow-wrap: anywhere;
}
.row-gap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Nút Excel: xanh lá đặc trưng của Microsoft Excel */
.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; }

/* ---------- Form chi phí: số tiền to, cộng nhanh, khoản hay dùng, hiệu ứng hiện dần + "Đã lưu" ---------- */
.exf { position: relative; display: flex; flex-direction: column; gap: 14px; }
.exf > * { animation: exfIn .35s ease both; }
.exf > *:nth-child(2) { animation-delay: .05s; } .exf > *:nth-child(3) { animation-delay: .1s; }
.exf > *:nth-child(4) { animation-delay: .15s; } .exf > *:nth-child(5) { animation-delay: .2s; }
.exf-amount {
  display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--primary-soft) 40%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
}
.exf-label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.exf-money { display: flex; align-items: baseline; gap: 6px; border-bottom: 2px solid color-mix(in srgb, var(--primary) 30%, transparent); transition: border-color .2s; }
.exf-money:focus-within { border-bottom-color: var(--primary); }
.exf-money.bump { animation: exfBump .25s ease; }
.exf-money .inp { border: 0; background: transparent; box-shadow: none; padding: 0; height: 48px; font-size: 2rem; font-weight: 800; color: var(--text); text-align: left; }
.exf-money .inp:focus { box-shadow: none; outline: none; }
.exf-cur { font-size: 1.2rem; font-weight: 700; color: var(--muted); }
.exf-quick, .exf-tags, .exf-days { display: flex; flex-wrap: wrap; gap: 6px; }
.exf-chip, .exf-tag {
  border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 99px; padding: 5px 12px;
  font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; transition: transform .15s, background .15s, border-color .15s, color .15s;
  animation: exfPop .3s ease both; animation-delay: calc(var(--i, 0) * 35ms + .1s);
}
.exf-chip:hover, .exf-tag:hover { transform: translateY(-1px); border-color: var(--primary); color: var(--primary); }
.exf-chip:active, .exf-tag:active { transform: scale(.95); }
.exf-chip.on, .exf-tag.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.exf-chip.clear { color: var(--muted); border-style: dashed; }
.exf-tags { margin-top: -6px; }
.exf-daterow { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.exf-daterow .fld { flex: 1 1 160px; }
.exf-days { padding-bottom: 6px; }
.exf-done {
  position: absolute; inset: -8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: color-mix(in srgb, var(--surface) 94%, transparent); border-radius: 14px; animation: exfIn .2s ease both; z-index: 2;
}
.exf-done svg { width: 72px; height: 72px; }
.exf-done circle, .exf-done path { fill: none; stroke: var(--good); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.exf-done circle { stroke-dasharray: 176; stroke-dashoffset: 176; animation: ckdDraw .45s ease forwards; opacity: .35; }
.exf-done path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: ckdDraw .35s ease .25s forwards; }
.exf-done b { font-size: 1.15rem; color: var(--good); }
.exf-done span { color: var(--muted); font-size: .88rem; }
@keyframes exfIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes exfPop { from { opacity: 0; transform: scale(.85); } }
@keyframes exfBump { 50% { transform: scale(1.03); } }
.summary > .summary-act { flex: 0 0 auto; display: flex; align-items: center; }

/* ---------- 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; }

/* ---------- Bảng nhập: nút chèn dòng / xoá dòng cuối mỗi dòng (nhạt, rõ khi rê chuột) ---------- */
.xf td.t-act { padding: 0 2px; vertical-align: middle; }
.ra { display: flex; justify-content: center; gap: 2px; opacity: .28; transition: opacity .15s; }
.xf tbody tr:hover .ra, .xf tbody tr:focus-within .ra { opacity: 1; }
.ra-btn { width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--x-muted); cursor: pointer; padding: 0; }
.ra-btn:hover { background: var(--x-focus-bg); color: var(--x-focus); }
.ra-btn.del:hover { background: var(--x-bad-bg); color: var(--x-neg); }
@media (max-width: 699px) {
  .xf tbody tr { position: relative; }
  .xf td.t-act { position: absolute; right: 2px; top: 4px; border: 0 !important; padding: 0; }
  .ra { opacity: .55; }
  .xf .t-prod .inp { padding-right: 58px; }
}

/* ---------- Tổng quan: dòng tổng cộng đưa lên đầu ---------- */
.tbl tr.sum-top td { font-weight: 700; background: var(--surface-2); border-bottom: 2px solid var(--line); }
.total-row.top { border-top: 0; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); }

/* ---------- Bán / Mua hàng: tổng hợp trong ngày ---------- */
.dsum-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dsum-h h3 { margin: 0; }
.dsum-act { display: flex; align-items: center; gap: 6px; }
.dsum-act .btn.xls { margin-left: 4px; }
.dsum-kpi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dsum-kpi > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; animation: exfPop .3s ease both; min-width: 0; }
.dsum-kpi span { font-size: .78rem; color: var(--muted); }
.dsum-kpi b { font-size: 1.2rem; overflow-wrap: anywhere; }
.dsum-kpi .k1 { background: var(--primary-soft); } .dsum-kpi .k1 b { color: var(--primary); }
.dsum-kpi .k2 { background: var(--good-soft); animation-delay: .05s; } .dsum-kpi .k2 b { color: var(--good); }
.dsum-kpi .k3 { background: var(--surface-2); animation-delay: .1s; }
.dsum-tbl tr.click { cursor: pointer; animation: exfIn .3s ease both; animation-delay: calc(var(--i, 0) * 30ms); }
.dsum-tbl tr.click:hover td { background: var(--surface-2); }
.dsum-tbl td.good { color: var(--good); font-weight: 600; }
.dsum-empty { margin: 4px 0; }
@media (max-width: 640px) { .dsum-tbl .hide-sm { display: none; } .dsum-kpi b { font-size: 1rem; } }

/* ---------- Ô tìm khách / NCC ---------- */
.psearch { position: relative; display: flex; align-items: center; }
.psearch > .ic { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.psearch .inp { padding-left: 40px; padding-right: 40px; height: 46px; font-size: 1rem; border-radius: 12px; }
.psearch-x { position: absolute; right: 6px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.psearch-x:hover { background: var(--surface-2); color: var(--text); }
.psearch-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.psearch-list li.hi > button { background: var(--primary-soft); }
.dsum-kpi b .money { font-size: 1.3rem; font-weight: 800; color: inherit; }
@media (max-width: 640px) { .dsum-kpi b .money { font-size: 1.02rem; } }

/* ---------- Tổng quan: nút Excel nhỏ cạnh ô ngày ---------- */
.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: 1150px) { .range-dates.has-lead { width: 430px; } }

/* ---------- Ghi chú: bảng tính kiểu Excel ---------- */
.nt-page { max-width: none; }
.nt-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.nt-tab { flex: none; height: 34px; padding: 0 14px; border-radius: 10px 10px 4px 4px; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.nt-tab:hover { color: var(--text); background: var(--surface-2); }
.nt-tab.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.nt-tab.add { padding: 0 10px; display: grid; place-items: center; }
.nt { padding: 0; overflow: hidden; gap: 0; }
.nt-bar { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.nt-btn { height: 32px; min-width: 32px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid transparent; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: .85rem; cursor: pointer; }
.nt-btn:hover { background: var(--surface-2); }
.nt-btn.on { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 40%, transparent); color: var(--primary); }
.nt-btn.txt { color: var(--muted); font-weight: 600; }
.nt-btn.danger:hover { background: var(--bad-soft); color: var(--bad); }
.nt-btn.red { flex-direction: column; gap: 0; padding: 2px 8px 3px; }
.nt-btn.red .nt-a { font-weight: 800; line-height: 1; font-size: .95rem; }
.nt-btn.red i { display: block; width: 16px; height: 3px; border-radius: 2px; background: var(--nt-red); margin-top: 2px; }
.nt-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.nt-status { font-size: .78rem; color: var(--muted); margin-right: 4px; white-space: nowrap; }
.nt-status.saving, .nt-status.dirty { color: var(--primary); }
.nt-status.error { color: var(--bad); font-weight: 700; }
.nt-fx { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.nt-ref { flex: none; min-width: 64px; padding: 0 10px; font-size: .8rem; font-weight: 700; color: var(--muted); text-align: center;
  border-right: 1px solid var(--line); line-height: 34px; }
.nt-fx-inp { flex: 1; min-width: 0; height: 34px; border: 0; padding: 0 10px; background: none; color: var(--text); font: inherit; font-size: .9rem; outline: none; }
.nt-wrap { overflow: auto; max-height: calc(100vh - 290px); min-height: 280px; overscroll-behavior: contain; }
.nt-grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: .9rem; }
.nt-grid th { position: sticky; top: 0; z-index: 2; height: 26px; background: var(--nt-head); color: var(--nt-head-tx); font-size: .75rem; font-weight: 600;
  border-right: 1px solid var(--nt-line2); border-bottom: 1px solid var(--nt-line2); text-align: center; user-select: none; cursor: pointer; padding: 0; }
.nt-grid tbody th { position: sticky; left: 0; z-index: 1; top: auto; }
.nt-grid thead th.nt-corner { left: 0; z-index: 3; cursor: default; }
.nt-grid th.hi { background: var(--nt-head-on); color: var(--nt-sel); }
.nt-rs { position: absolute; right: -4px; top: 0; bottom: 0; width: 9px; cursor: col-resize; z-index: 4; touch-action: none; }
.nt-rs::after { content: ''; position: absolute; left: 3px; top: 5px; bottom: 5px; width: 3px; border-radius: 2px; background: transparent; transition: background .15s; }
.nt-grid th:hover .nt-rs::after, .nt-rs:active::after { background: var(--nt-sel); }
.nt-grid td { padding: 0; height: 28px; border-right: 1px solid var(--nt-line); border-bottom: 1px solid var(--nt-line); background: var(--nt-bg); color: var(--nt-tx); position: relative; }
.nt-grid td input { width: 100%; height: 28px; border: 0; padding: 0 6px; background: transparent; color: inherit; font: inherit; outline: none;
  text-overflow: ellipsis; }
.nt-grid td.num input { text-align: right; font-variant-numeric: tabular-nums; }
.nt-grid td.cur input:focus { text-align: left; }
.nt-grid td.fx:not(.cur) input { color: var(--nt-fx); }
.nt-grid td.red, .nt-grid td.red:not(.cur) input { color: var(--nt-red); }
.nt-grid td.bold input { font-weight: 700; }
.nt-grid td.err input, .nt-grid td.err:not(.cur) input { color: var(--bad); font-weight: 600; font-size: .8rem; }
.nt-grid td.in { background: var(--nt-fill); }
.nt-grid td.pick { background: color-mix(in srgb, #2f6fd6 12%, var(--nt-bg)); outline: 1.5px dashed #2f6fd6; outline-offset: -2px; }
.nt-grid td.cur { box-shadow: inset 0 0 0 2px var(--nt-sel); z-index: 1; }
.nt-foot { display: flex; gap: 16px; flex-wrap: wrap; padding: 8px 12px; border-top: 1px solid var(--line); font-size: .82rem; min-height: 36px; align-items: center; }
.nt-foot b { color: var(--nt-sel); }
.nt-hint { color: var(--muted); }
.nt-hint b { color: #2f6fd6; }
.nt-hint code { font-size: .78rem; padding: 1px 4px; border-radius: 4px; background: var(--surface-2); }
:root { --nt-red: #d11a2a; --nt-bg: var(--surface); --nt-line: var(--line); --nt-line2: var(--line); --nt-head: var(--surface-2); --nt-head-on: var(--primary-soft);
  --nt-head-tx: var(--muted); --nt-sel: var(--primary); --nt-fill: color-mix(in srgb, var(--primary) 10%, var(--surface)); --nt-tx: var(--text); --nt-fx: var(--primary); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --nt-red: #ff7b72; } }
:root[data-theme="dark"] { --nt-red: #ff7b72; }
@media (max-width: 640px) { .nt-wrap { max-height: calc(100vh - 330px); } .nt-status { display: none; } }

/* ---------- Đối soát dòng tiền: thẻ file, đối chiếu số dư, bảng xem trước, lịch sử ---------- */
.ds-file-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ds-file-h .grow { display: flex; flex-direction: column; min-width: 0; }
.ds-file-h b { overflow-wrap: anywhere; }
.ds-file-ic { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.ds-lock { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ds-lock .grow { flex: 1 1 220px; }
.ds-lock p { margin: 2px 0 0; }
.ds-check { padding: 12px 14px; border-radius: var(--r-sm); font-size: .9rem; line-height: 1.55; border: 1px solid; }
.ds-check.ok { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.ds-check.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.ds-check b { color: var(--text); }
.ds-tbl td { font-size: .86rem; }
.ds-tbl .ds-desc { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-tbl tbody tr { animation: exfIn .3s ease both; animation-delay: calc(var(--i, 20) * 18ms); }
.ds-tbl tr.moc td { background: var(--primary-soft); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.ds-hist { display: flex; flex-direction: column; }
.ds-hist-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); animation: exfIn .3s ease both; animation-delay: calc(var(--i, 0) * 30ms); }
.ds-hist-row:last-child { border-bottom: 0; }
.ds-hist-row .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ds-hist-row small { font-size: .8rem; }
.ds-name { overflow-wrap: anywhere; }
.ds-hist-act { display: flex; align-items: center; gap: 4px; flex: none; }
@media (max-width: 599px) {
  .ds-hist-row { flex-wrap: wrap; }
  .ds-hist-act { width: 100%; justify-content: flex-end; }
  .ds-file-h > .btn { width: 100%; }
}

/* ---------- Nhân viên & quyền: mỗi loại tài khoản một màu ---------- */
:root { --r-admin: #7c3aed; --r-admin-soft: #f1ebfe; --r-kiem: #0f766e; --r-kiem-soft: #e2f5f1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --r-admin: #b794f6; --r-admin-soft: rgba(183, 148, 246, .15); --r-kiem: #4fd1c5; --r-kiem-soft: rgba(79, 209, 197, .13); } }
:root[data-theme="dark"] { --r-admin: #b794f6; --r-admin-soft: rgba(183, 148, 246, .15); --r-kiem: #4fd1c5; --r-kiem-soft: rgba(79, 209, 197, .13); }
.r-admin { --rc: var(--r-admin); --rs: var(--r-admin-soft); }
.r-soan { --rc: var(--warn); --rs: var(--warn-soft); }
.r-in { --rc: var(--primary); --rs: var(--primary-soft); }
.r-kiem { --rc: var(--r-kiem); --rs: var(--r-kiem-soft); }
.r-none { --rc: var(--muted); --rs: var(--surface-2); }
.nv-ic { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 11px; background: var(--rs); color: var(--rc); font-size: 18px; }
.nv-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-bottom: 14px; }
.nv-stat { display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--rc); border-radius: var(--r); padding: 12px 14px;
  box-shadow: var(--shadow); transition: transform .15s, border-color .15s, background .15s; }
.nv-stat:hover { transform: translateY(-1px); }
.nv-stat.on { background: var(--rs); border-color: var(--rc); }
.nv-stat b { display: block; font-size: .95rem; }
.nv-stat small { display: block; color: var(--muted); font-size: .76rem; }
.nv-stat em { font-style: normal; font-weight: 700; font-size: 1.35rem; color: var(--rc); font-variant-numeric: tabular-nums; }
@media (max-width: 699px) {
  .nv-sum { grid-template-columns: 1fr 1fr; gap: 8px; }
  .nv-stat { padding: 9px 10px; gap: 8px; border-left-width: 3px; }
  .nv-stat small { display: none; }
  .nv-stat .nv-ic { width: 30px; height: 30px; font-size: 15px; border-radius: 9px; }
  .nv-stat b { font-size: .85rem; }
  .nv-stat em { font-size: 1.1rem; }
}
.nv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.nv-card { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; text-align: left; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; cursor: pointer; overflow: hidden;
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s; }
.nv-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: var(--rc); }
.nv-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--rc); }
.nv-av { grid-row: span 2; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--rs); color: var(--rc); font-weight: 700; font-size: .95rem; }
.nv-info { display: flex; flex-direction: column; min-width: 0; }
.nv-info b { font-size: .98rem; }
.nv-info small { font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nv-role { justify-self: start; display: inline-flex; gap: 5px; align-items: center; font-size: .76rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--rs); color: var(--rc); }
.nv-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin-top: 4px; }
.nv-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--r-sm); cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.nv-opt input { position: absolute; opacity: 0; pointer-events: none; }
.nv-opt b { display: block; font-size: .92rem; color: var(--text); }
.nv-opt small { display: block; font-size: .76rem; color: var(--muted); line-height: 1.35; font-weight: 400; }
.nv-opt:has(input:checked) { border-color: var(--rc); background: var(--rs); box-shadow: 0 0 0 3px var(--rs); }
.nv-opt:has(input:checked) b { color: var(--rc); }
.nv-opt:has(input:focus-visible) { outline: 2px solid var(--rc); outline-offset: 2px; }
.nv-opt:has(input:disabled) { cursor: not-allowed; opacity: .6; }
.inp.ro { display: flex; align-items: center; background: var(--surface-2); color: var(--muted); }
/* Đối soát dòng tiền: 2 cấp tài khoản — Quản trị viên (tím) · Người dùng (xanh dương) */
.r-user { --rc: var(--primary); --rs: var(--primary-soft); }
.nv-grid > .nv-card { animation: exfIn .3s ease both; animation-delay: calc(var(--i, 0) * 30ms); }
.nv-card .badge { vertical-align: middle; margin-left: 4px; }
.nv-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.nv-form .full { grid-column: 1 / -1; }
@media (max-width: 599px) { .nv-form { grid-template-columns: 1fr; } }
.fld-err { color: var(--bad); font-size: .8rem; font-weight: 500; animation: exfIn .2s ease both; }
.fld.has-err .inp { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.fld .hint { font-size: .78rem; }
.nv-pass { display: flex; align-items: center; gap: 6px; }
.nv-pass .inp { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.nv-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 6px 0; }
.nv-done h3 { font-size: 1.15rem; }
.nv-done .nv-role { justify-self: auto; animation: exfPop .35s ease .45s both; }
.nv-cred { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 8px 0 0; padding: 14px 18px; width: min(360px, 100%);
  border: 1px dashed var(--line); border-radius: var(--r-sm); background: var(--surface-2); text-align: left; animation: exfPop .35s ease .55s both; }
.nv-cred dt { color: var(--muted); }
.nv-cred dd { margin: 0; font-size: 1.05rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.nv-done p { margin: 4px 0 0; }
.ckd-type { display: block; margin-top: 14px; font-size: .84rem; color: var(--muted); animation: ckdRise .4s ease .3s both; }
.ckd-type b { color: var(--bad); letter-spacing: .08em; }
.ckd-type .ckd-inp { margin-top: 6px; letter-spacing: .12em; font-weight: 800; animation: none; }
@media (max-width: 599px) { .nv-gen-t { display: none; } }
/* Hộp sửa tài khoản trên điện thoại: nút chân hộp xuống dòng, không tràn màn hình */
@media (max-width: 599px) {
  .sheet-f { flex-wrap: wrap; row-gap: 8px; }
  .sheet-f .grow { flex-basis: 100%; height: 0; }
  .sheet-f .grow ~ .btn { flex: 1; }
}
/* Lịch sử: bấm vào dòng để xem chi tiết file */
.ds-hist-row { cursor: pointer; border-radius: var(--r-sm); transition: background .15s; }
.ds-hist-row:hover { background: var(--surface-2); }
.ds-hist-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.ds-hist-go { color: var(--muted); flex: none; transition: transform .15s, color .15s; }
.ds-hist-row:hover .ds-hist-go { color: var(--primary); transform: translateX(3px); }
.ds-back { align-self: flex-start; padding-left: 8px; }
.ds .search, .page .card > .search { flex: none; }
@media (max-width: 599px) { .ds-hist-go { display: none; } }
/* Bảng giao dịch trên điện thoại / máy tính hẹp: mỗi dòng thành 1 thẻ nhỏ (ngày · nội dung · chi/thu · số dư), không phải cuộn ngang */
@media (max-width: 1099px) {
  .ds-tbl thead { display: none; }
  .ds-tbl, .ds-tbl tbody { display: block; }
  .ds-tbl tr {
    display: grid; grid-template-columns: auto 1fr auto; gap: 3px 10px; padding: 10px 2px;
    grid-template-areas: "stt ngay ngay" "nd nd nd" "tien tien sodu"; border-bottom: 1px solid var(--line);
  }
  .ds-tbl td { padding: 0; border: 0; min-width: 0; }
  .ds-tbl tbody tr:hover td { background: none; }
  .ds-tbl tr.moc { background: var(--primary-soft); border-radius: var(--r-sm); }
  .ds-tbl tr.moc td { background: none; }
  .ds-tbl td:nth-child(1) { grid-area: stt; font-size: .78rem; }
  .ds-tbl td:nth-child(2) { grid-area: ngay; font-size: .8rem; color: var(--muted); }
  .ds-tbl td:nth-child(3) { grid-area: nd; white-space: normal; max-width: none; overflow-wrap: anywhere; font-size: .88rem; }
  .ds-tbl td:nth-child(4), .ds-tbl td:nth-child(5) { grid-area: tien; text-align: left; }
  .ds-tbl td:nth-child(6) { grid-area: sodu; }
  .ds-tbl td:nth-child(4):not(:empty)::before { content: 'Chi '; color: var(--muted); font-weight: 400; font-size: .8rem; }
  .ds-tbl td:nth-child(5):not(:empty)::before { content: 'Thu '; color: var(--muted); font-weight: 400; font-size: .8rem; }
  .ds-tbl td:nth-child(6)::before { content: 'Số dư '; color: var(--muted); font-weight: 400; font-size: .8rem; }
}
/* Cột nội dung co giãn theo chỗ trống (cắt bớt …), để các cột số tiền luôn nằm trong màn hình */
@media (min-width: 1100px) {
  .ds-tbl .ds-desc { max-width: 0; width: 100%; min-width: 60px; white-space: normal; overflow-wrap: anywhere; font-size: .82rem; line-height: 1.35; }
  .ds-tbl th, .ds-tbl td { padding-left: 6px; padding-right: 6px; }
}
/* Bảng "Đầy đủ như file": mọi cột của file kết quả, cột số dư (đã tính) tô nhấn; bảng rộng thì cuộn ngang trong thẻ */
.ds-full td { font-size: .84rem; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.ds-full th { white-space: nowrap; }
.ds-full td.ds-bal { color: var(--primary); background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
.ds-full tr.moc td { background: var(--primary-soft); }
.ds-full tbody tr { animation: exfIn .3s ease both; animation-delay: calc(var(--i, 20) * 18ms); }
.card-h .seg { margin-left: auto; }
.card-h .ds-count { flex-basis: 100%; }
