/* ============ 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: #0d9488;
  --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ảng dữ liệu: tiêu đề cột, dòng sọc, dòng tổng · ô nhập trong hộp */
  --th-bg: #1e3a6e; --th-text: #ffffff; --th-line: #15295a; --row-alt: #f9fbfe; --row-hover: #edf3ff;
  --sum-bg: #fff6dc; --sum-text: #6b4500; --inp-bg: #f8fafc; --inp-line: #d5dde9;
  --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: #3b82f6;
    --buy: #0d9488;
    --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;
    --th-bg: #33467a; --th-text: #ffffff; --th-line: #4a5f96; --row-alt: rgba(255, 255, 255, .025); --row-hover: rgba(110, 168, 254, .11);
    --sum-bg: rgba(250, 204, 21, .1); --sum-text: #fde68a; --inp-bg: #2b3344; --inp-line: #3f4a60;
    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: #3b82f6;
  --buy: #0d9488;
  --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;
  --th-bg: #33467a; --th-text: #ffffff; --th-line: #4a5f96; --row-alt: rgba(255, 255, 255, .025); --row-hover: rgba(110, 168, 254, .11);
  --sum-bg: rgba(250, 204, 21, .1); --sum-text: #fde68a; --inp-bg: #2b3344; --inp-line: #3f4a60;
  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; }
.login-card .fld small { display: block; margin-top: 4px; font-size: .78rem; }
.login-card small.good { color: var(--good); font-weight: 600; }
.login-card .inp.bad { border-color: var(--bad); }
.pw-box { position: relative; }
.pw-box .inp { width: 100%; padding-right: 64px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--primary);
  font-weight: 600; font-size: .85rem; padding: 6px 8px; cursor: pointer; }
.login-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; margin-top: 4px; }
.login-or::before, .login-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.trial-cta { border-color: var(--primary); color: var(--primary); font-weight: 700; }
.reg-card { max-width: 420px; gap: 12px; }
.reg-perks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.reg-perks li { background: var(--good-soft); color: var(--good); font-size: .78rem; font-weight: 600; padding: 4px 10px; border-radius: 99px; }
/* Lời chào khi mở app */
.welcome { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); border-radius: 16px; padding: 10px 18px 10px 10px;
  max-width: calc(100vw - 32px); cursor: pointer; animation: welcomeIn .45s cubic-bezier(.2, .9, .3, 1.2) both, welcomeOut .4s ease 3.1s both; }
.welcome-av { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.1rem;
  color: #fff; background: linear-gradient(135deg, var(--primary), #3b6fd8); }
.welcome-t { display: flex; flex-direction: column; min-width: 0; }
.welcome-t b { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.welcome-t small { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes welcomeIn { from { opacity: 0; transform: translate(-50%, -24px) scale(.96); } }
@keyframes welcomeOut { to { opacity: 0; transform: translate(-50%, -16px); } }
@media (prefers-reduced-motion: reduce) { .welcome { animation: none; } }

/* ============ 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.trial { background: var(--primary-soft); color: var(--text); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }
.lic-banner.trial.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(--good); color: var(--surface); 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; } }

/* ---------- Phân quyền: Người xem + tab Tài khoản ---------- */
.row:disabled { cursor: default; color: inherit; opacity: 1; }
.row:disabled:hover { background: none; }
.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; } }
.nt-ro { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; color: var(--muted); padding: 0 6px; }
.icon-btn.danger:hover { background: var(--bad-soft); color: var(--bad); }
}

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

/* ============ Đăng ký sử dụng (từ bản dùng thử) ============ */
.su { max-width: 760px; margin: 0 auto; }
.su-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.su-head h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.01em; }
/* Thanh bước: 3 chấm nối bằng vạch, vạch chạy theo tiến độ */
.su-steps { --p: 0; position: relative; list-style: none; margin: 0; padding: 0; display: flex; gap: 0; min-width: 300px; }
.su-steps::before, .su-steps::after { content: ""; position: absolute; top: 13px; left: 14px; right: 14px; height: 2px; border-radius: 2px; background: var(--line); }
.su-steps::after { right: auto; width: calc((100% - 28px) * var(--p)); background: var(--primary); transition: width .6s cubic-bezier(.4, 0, .2, 1); }
.su-steps li { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.su-steps li:first-child { align-items: flex-start; } .su-steps li:last-child { align-items: flex-end; }
.su-steps li span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700;
  background: var(--surface); color: var(--muted); border: 2px solid var(--line); transition: all .35s ease; }
.su-steps li em { font-style: normal; font-size: .76rem; font-weight: 600; color: var(--muted); }
.su-steps li.on span { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 5px color-mix(in srgb, var(--primary) 16%, transparent); }
.su-steps li.on em { color: var(--primary); }
.su-steps li.done span { background: var(--primary); border-color: var(--primary); color: #fff; }
.su-body { display: flex; flex-direction: column; gap: 14px; animation: suIn .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes suIn { from { opacity: 0; transform: translateY(14px); } }
.su-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 18px; }
.su-t { margin: 0; font-size: 1.1rem; }
/* Ô nhập: nhãn trên, ghi chú chỉ hiện khi đang gõ ô đó hoặc khi sai, đúng thì hiện ✓ */
.su-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.su-f { display: flex; flex-direction: column; gap: 6px; min-width: 0; animation: suIn .45s ease both; }
.su-f:nth-child(2) { animation-delay: .04s; } .su-f:nth-child(3) { animation-delay: .08s; } .su-f:nth-child(4) { animation-delay: .12s; }
.su-f:nth-child(5) { animation-delay: .16s; } .su-f:nth-child(6) { animation-delay: .2s; }
.su-f.wide { grid-column: 1 / -1; }
.su-l { font-size: .85rem; font-weight: 600; color: var(--text); }
.su-inp { position: relative; display: flex; align-items: center; height: 48px; padding: 0 10px 0 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface-2); transition: border-color .2s, box-shadow .2s, background .2s; }
.su-inp input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 1rem; }
.su-f:focus-within .su-inp { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); }
.su-f.bad .su-inp { border-color: var(--bad); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 12%, transparent); }
.su-tick { font-style: normal; font-weight: 800; color: var(--good); opacity: 0; transform: scale(.4); transition: opacity .25s, transform .3s cubic-bezier(.3, 1.6, .5, 1); margin-left: 6px; }
.su-f.ok:not(.bad) .su-tick { opacity: 1; transform: scale(1); }
.su-eye { order: 2; border: 0; background: none; color: var(--primary); font: inherit; font-size: .82rem; font-weight: 600; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.su-eye:hover { background: var(--primary-soft); }
.su-tick { order: 1; }
.su-h { display: block; font-size: .76rem; color: var(--muted); max-height: 0; opacity: 0; overflow: hidden; transform: translateY(-4px);
  transition: max-height .25s ease, opacity .2s ease, transform .25s ease, margin .25s; margin-top: -4px; }
.su-f:focus-within .su-h, .su-f.bad .su-h { max-height: 2.4em; opacity: 1; transform: none; margin-top: 0; }
.su-f.bad .su-h { color: var(--bad); font-weight: 600; }
.su-f:not(.bad) .su-h:empty { display: none; }
/* Bước 2: tóm tắt thông tin */
.su-sum { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 28px; padding: 16px 20px; }
.su-sum > div { display: flex; flex-direction: column; font-size: .92rem; }
.su-sum small { color: var(--muted); font-size: .74rem; }
.su-sum .btn { margin-left: auto; }
/* Bước 3: thành công */
.su-done { align-items: center; text-align: center; gap: 10px; padding: 32px 20px; }
.su-done h2 { margin: 0; }
.su-done p { margin: 0; }
.su-done .su-cred { max-width: 380px; text-align: left; }
.su-done .auth-btn { min-width: 220px; }
@media (max-width: 640px) {
  .su-head { flex-direction: column; align-items: stretch; }
  .su-steps { min-width: 0; }
  .su-grid { grid-template-columns: 1fr; }
  .su-card { padding: 18px 16px; border-radius: 16px; }
  .su-sum .btn { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .su-body, .su-f { animation: none; } }

/* ============ Màn đăng nhập: cảnh biển chuyển động ============ */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--bg); }
.auth-hero { position: relative; overflow: hidden; color: #fff; display: flex; align-items: center; padding: 48px;
  background: linear-gradient(180deg, #0c3b73 0%, #0a2f5c 45%, #071f3f 100%); }
.auth-brand { position: relative; z-index: 3; max-width: 440px; animation: gtFadeInUp .7s ease both; }
.auth-logo { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; color: #fff;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .25); backdrop-filter: blur(6px); margin-bottom: 18px; }
.auth-brand h2 { font-size: 2rem; line-height: 1.2; margin: 0 0 10px; letter-spacing: -.01em; }
.auth-brand p { margin: 0 0 18px; color: rgba(255, 255, 255, .82); line-height: 1.55; }
.auth-brand ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.auth-brand li { display: flex; align-items: center; gap: 10px; color: rgba(255, 255, 255, .9); font-size: .95rem; }
.auth-brand li svg { flex: none; width: 24px; height: 24px; padding: 4px; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.auth-main { --auth-bg: linear-gradient(155deg, #e9f1ff 0%, #d6e4ff 55%, #c7dafc 100%);
  display: grid; place-items: center; padding: 32px 24px; position: relative; overflow: hidden; background: var(--auth-bg); }
.auth-main::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: radial-gradient(circle at 15% 20%, rgba(255, 255, 255, .9), transparent 35%),
    radial-gradient(circle at 85% 85%, rgba(37, 99, 235, .18), transparent 40%),
    repeating-radial-gradient(circle at 100% 0%, transparent 0 22px, rgba(37, 99, 235, .05) 22px 23px); }
.auth-main > * { position: relative; }
:root[data-theme="dark"] .auth-main { --auth-bg: linear-gradient(155deg, #172338 0%, #121c2e 60%, #0f1726 100%); }
:root[data-theme="dark"] .auth-main::before { opacity: .25; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-main { --auth-bg: linear-gradient(155deg, #172338 0%, #121c2e 60%, #0f1726 100%); }
  :root:not([data-theme="light"]) .auth-main::before { opacity: .25; }
}
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; padding: 32px 28px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg);
  animation: gtFadeInUp .55s ease both .1s; }
.auth-card > * { animation: gtFadeInUp .5s ease both; }
.auth-card > :nth-child(2) { animation-delay: .15s; } .auth-card > :nth-child(3) { animation-delay: .22s; }
.auth-card > :nth-child(4) { animation-delay: .29s; } .auth-card > :nth-child(n+5) { animation-delay: .36s; }
.auth-head h1 { margin: 0; font-size: 1.6rem; letter-spacing: -.01em; }
.auth-head p { margin: 0; font-size: .92rem; }
.auth-fld { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .88rem; }
.auth-inp { display: flex; align-items: center; gap: 6px; padding: 0 6px 0 14px; height: 50px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface-2); color: var(--muted); transition: border-color .2s, box-shadow .2s, background .2s; }
.auth-inp:focus-within { border-color: var(--primary); background: var(--surface); color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
.auth-inp.bad { border-color: var(--bad); }
.auth-inp input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-weight: 500; font-size: 1rem; }
.auth-eye { border: 0; background: none; color: var(--primary); padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; font-size: .85rem; font-weight: 600; }
.auth-eye:hover { color: var(--primary); background: var(--primary-soft); }
.auth-err { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); border-radius: 10px; padding: 10px 12px;
  font-size: .88rem; font-weight: 500; animation: authShake .4s ease; }
@keyframes authShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.auth-btn { height: 50px; font-size: 1rem; border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, #2563eb, #1e4fd0); box-shadow: 0 8px 20px -8px rgba(37, 99, 235, .7); transition: transform .15s, box-shadow .2s; }
.auth-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 24px -8px rgba(37, 99, 235, .8); }
.auth-btn .spin.sm { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .82rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-trial { height: 48px; border-radius: 12px; border: 1.5px solid var(--primary); color: var(--primary); font-weight: 700; font-size: 1rem; background: var(--surface); }
.auth-trial:hover { background: var(--primary-soft); }
.auth-help { margin: 0; text-align: center; font-size: .8rem; color: var(--muted); line-height: 1.5; }

/* Cảnh biển */
.sea { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.sea-rays i { position: absolute; top: -20%; width: 18%; height: 120%; background: linear-gradient(180deg, rgba(255, 255, 255, .12), transparent 70%);
  transform: rotate(18deg); transform-origin: top; animation: rays 7s ease-in-out infinite alternate; }
.sea-rays i:nth-child(1) { left: 10%; } .sea-rays i:nth-child(2) { left: 42%; width: 10%; animation-delay: 2s; } .sea-rays i:nth-child(3) { left: 70%; animation-delay: 4s; }
@keyframes rays { from { opacity: .25; } to { opacity: .9; transform: rotate(14deg); } }
.sea-wave { position: absolute; top: 0; left: 0; width: 200%; height: 46px; transform: scaleY(-1); }
.sea-wave path { fill: rgba(255, 255, 255, .07); }
.sea-wave.w1 { animation: wave 14s linear infinite; }
.sea-wave.w2 { top: 8px; animation: wave 22s linear infinite reverse; }
.sea-wave.w2 path { fill: rgba(255, 255, 255, .05); }
@keyframes wave { to { transform: scaleY(-1) translateX(-50%); } }
.bubble { position: absolute; bottom: -20px; width: var(--s); height: var(--s); border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .55); background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .6), rgba(255, 255, 255, .05) 60%);
  animation: bubble var(--t) ease-in infinite; animation-delay: var(--d); opacity: 0; }
@keyframes bubble { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: .9; } 50% { transform: translate(12px, -50vh); }
  100% { transform: translate(-6px, -105vh); opacity: 0; } }
.swim { position: absolute; left: 105%; animation: swim var(--sw, 22s) linear infinite; animation-delay: var(--sd, 0s); }
.swim svg { display: block; animation: bob 2.6s ease-in-out infinite; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .25)); }
.swim .fish-tail { transform-origin: 50px 17px; animation: tail .5s ease-in-out infinite alternate; }
.swim.s1 { top: 30%; --sw: 20s; }
.swim.s2 { top: 52%; --sw: 15s; --sd: -6s; }
.swim.s3 { top: 66%; --sw: 26s; --sd: -14s; }
.swim.s4 { top: 22%; --sw: 12s; --sd: -3s; }
.swim.s5 { top: 42%; --sw: 24s; --sd: -9s; }
.swim.rev { left: auto; right: 105%; animation-name: swimRev; }
.swim.rev svg { animation-name: bobRev; }
@keyframes swim { to { left: -15%; } }
@keyframes swimRev { to { right: -15%; } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-10px) rotate(-3deg); } }
@keyframes bobRev { 0%, 100% { transform: scaleX(-1) translateY(0); } 50% { transform: scaleX(-1) translateY(-10px) rotate(-3deg); } }
@keyframes tail { from { transform: scaleY(1) skewY(6deg); } to { transform: scaleY(.85) skewY(-6deg); } }
.sea-floor { position: absolute; left: 0; right: 0; bottom: 0; height: 140px; display: flex; align-items: flex-end; gap: 4px; padding: 0 4%;
  background: linear-gradient(180deg, transparent 60%, rgba(4, 20, 42, .7)); }
.sea-floor::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 22px;
  background: radial-gradient(ellipse at 20% 100%, #c9a86a 0 40%, transparent 41%), radial-gradient(ellipse at 70% 100%, #b8975a 0 45%, transparent 46%), linear-gradient(#a8884f, #8d7140);
  border-radius: 50% 50% 0 0 / 14px 14px 0 0; opacity: .85; }
.weed { position: relative; z-index: 1; transform-origin: bottom center; animation: sway 4s ease-in-out infinite alternate; animation-delay: var(--d); }
@keyframes sway { from { transform: rotate(-6deg) skewX(-4deg); } to { transform: rotate(6deg) skewX(4deg); } }
.crab { position: absolute; bottom: 10px; left: 8%; z-index: 2; animation: crabWalk 16s ease-in-out infinite alternate; }
.crab svg { animation: crabStep .35s ease-in-out infinite alternate; }
.crab .crab-claw-l { transform-origin: 24px 24px; animation: clawL 1.2s ease-in-out infinite alternate; }
.crab .crab-claw-r { transform-origin: 56px 24px; animation: clawR 1.2s ease-in-out infinite alternate; }
@keyframes crabWalk { 0%, 10% { left: 8%; } 45%, 55% { left: 55%; } 90%, 100% { left: 30%; } }
@keyframes crabStep { from { transform: translateY(0); } to { transform: translateY(-3px); } }
@keyframes clawL { to { transform: rotate(-14deg); } }
@keyframes clawR { to { transform: rotate(14deg); } }
.shrimp { position: absolute; top: 78%; left: 70%; animation: shrimp 9s ease-in-out infinite; }
@keyframes shrimp { 0%, 100% { transform: translate(0, 0) rotate(0); } 40% { transform: translate(-40px, -18px) rotate(-8deg); }
  45% { transform: translate(-60px, -20px) rotate(-4deg); } 70% { transform: translate(-20px, 6px) rotate(4deg); } }

/* Điện thoại: cảnh biển thành dải trên, thẻ đăng nhập nổi lên */
@media (max-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-hero { min-height: 250px; padding: 28px 22px 70px; align-items: flex-start; }
  .auth-brand h2 { font-size: 1.45rem; margin-bottom: 6px; }
  .auth-brand p { font-size: .88rem; margin: 0; }
  .auth-brand ul, .auth-logo { display: none; }
  .auth-main { align-items: start; padding: 0 16px 28px; margin-top: -54px; position: relative; z-index: 4; overflow: visible;
    background: linear-gradient(180deg, transparent 0 54px, #dfe9ff 54px, #cfe0fd 100%); }
  .auth-main::before { display: none; }
  :root[data-theme="dark"] .auth-main { background: linear-gradient(180deg, transparent 0 54px, #141e31 54px, #0f1726 100%); }
  .auth-card { padding: 26px 20px; }
  .sea-floor { height: 90px; }
  .sea-floor .weed { height: 70px; }
  .crab { bottom: 6px; }
  .crab svg { width: 52px; height: 33px; }
  .shrimp { top: 58%; }
}
@media (prefers-reduced-motion: reduce) {
  .sea *, .auth-card, .auth-card > *, .auth-brand { animation: none !important; }
  .swim { left: auto; right: 12%; } .swim.s2 { right: 55%; } .swim.s3 { right: 30%; } .swim.s4, .swim.s5 { display: none; }
}

/* ---------- Băng dùng thử gọn (một dòng, chữ chạy lần lượt) ---------- */
.trial-bar {
  position: relative; z-index: 25; display: flex; align-items: center; gap: 10px; margin: 12px 16px 0; min-height: 44px; padding: 5px 6px 5px 6px;
  border-radius: 999px; font-size: .88rem; color: var(--text);
  background: linear-gradient(90deg, var(--primary-soft), color-mix(in srgb, var(--primary-soft) 30%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent); box-shadow: var(--shadow);
  animation: tbDrop .5s cubic-bezier(.2, .8, .2, 1) both;
}
.tb-tag {
  position: relative; overflow: hidden; flex-shrink: 0; padding: 5px 12px; border-radius: 999px;
  background: var(--primary); color: var(--on-primary); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.tb-tag::after {   /* vệt sáng lướt qua nhãn */
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .55) 50%, transparent 80%);
  animation: tbShine 3.8s ease-in-out 1s infinite;
}
.tb-ticker { position: relative; flex: 1; min-width: 0; height: 22px; overflow: hidden; }
.tb-msg {
  display: block; line-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500;
  animation: tbIn .55s cubic-bezier(.2, .8, .2, 1) both;
}
.tb-days { flex-shrink: 0; font-size: .82rem; font-weight: 700; color: var(--primary); white-space: nowrap; }
.tb-more { flex-shrink: 0; }   /* menu canh theo mép phải của cả băng */
.tb-btn {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 0; background: none;
  color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.tb-btn:hover, .tb-btn[aria-expanded="true"] { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.tb-menu {
  position: absolute; right: 8px; top: calc(100% + 8px); z-index: 40; min-width: 210px; padding: 6px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  animation: tbPop .18s ease-out both; transform-origin: top right;
}
.tb-menu button { text-align: left; padding: 10px 12px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; }
.tb-menu button:hover { background: var(--surface-2); }
.tb-menu button.neg { color: var(--bad); }
.tb-cta {
  flex-shrink: 0; display: inline-flex; align-items: center; height: 34px; padding: 0 16px; border-radius: 999px; white-space: nowrap;
  background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: .86rem; text-decoration: none;
  box-shadow: 0 4px 12px -4px var(--cta-shadow, rgba(37, 99, 235, .45)); transition: transform .15s, box-shadow .15s;
}
.tb-cta:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -6px var(--cta-shadow, rgba(37, 99, 235, .55)); }
.tb-cta.ghost { background: var(--surface); color: var(--primary); box-shadow: none; border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); }
.trial-bar.over { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.trial-bar.over .tb-tag { background: var(--bad); }
.trial-bar.over .tb-msg { color: var(--bad); font-weight: 600; }
@keyframes tbDrop { from { opacity: 0; transform: translateY(-10px); } }
@keyframes tbIn { from { opacity: 0; transform: translateY(100%); } }
@keyframes tbShine { 0% { transform: translateX(-120%); } 35%, 100% { transform: translateX(120%); } }
@keyframes tbPop { from { opacity: 0; transform: scale(.94); } }
@media (max-width: 640px) {
  .trial-bar { margin: 10px 12px 0; gap: 6px; font-size: .82rem; }
  .tb-tag { padding: 5px 9px; font-size: .66rem; }
  .tb-days, .tb-long { display: none; }
  .tb-cta.ghost .tb-long { display: none; }
  .tb-cta { padding: 0 13px; height: 32px; }
}
@media (prefers-reduced-motion: reduce) { .trial-bar, .tb-msg, .tb-tag::after, .tb-menu { animation: none; } }

/* Đăng ký: nút quay lại + bấm bước đã qua */
.su-back {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin-bottom: -4px; padding: 6px 12px 6px 8px;
  border: 0; border-radius: 999px; background: none; color: var(--primary); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: background .15s, transform .15s;
}
.su-back span { font-size: 1.1rem; transition: transform .2s; }
.su-back:hover { background: var(--primary-soft); }
.su-back:hover span { transform: translateX(-3px); }
.su-steps li > button { all: unset; display: flex; flex-direction: column; align-items: inherit; gap: 6px; cursor: pointer; border-radius: 10px; }
.su-steps li:first-child > button { align-items: flex-start; }
.su-steps li.can > button:hover span { transform: scale(1.1); box-shadow: 0 0 0 5px color-mix(in srgb, var(--primary) 18%, transparent); }
.su-steps li.can > button:hover em { color: var(--primary); text-decoration: underline; }
.su-steps li.can > button:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.su-steps li span { transition: transform .2s, box-shadow .2s; }
.su-body.back { animation-name: suBack; }
@keyframes suBack { from { opacity: 0; transform: translateX(-18px); } }
@media (prefers-reduced-motion: reduce) { .su-body.back { animation: none; } }
/* ============ Tổng quan (bản gọn 10/10/2026) ============ */
.dash-h h1 { margin: 0; }
.dash-h { flex-wrap: nowrap; align-items: center; }
@media (max-width: 640px) { .dash-h h1 { font-size: 1.3rem; } .dash-h .btn { padding: 0 12px; } }
@media (max-width: 999px) { .kpi-row > .kpi2:last-child { grid-column: 1 / -1; } }
/* Việc cần làm: hàng viên thuốc bấm được, trượt ngang trên điện thoại */
.todo { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 4px; }
.todo::-webkit-scrollbar { display: none; }
.todo-i {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px 8px 12px; border-radius: 999px;
  font-size: .86rem; font-weight: 500; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); text-decoration: none; animation: gtFadeInUp .4s ease both; animation-delay: calc(var(--i, 0) * 60ms + .05s);
  transition: transform .15s, border-color .15s;
}
.todo-i b { font-size: 1rem; font-variant-numeric: tabular-nums; }
.todo-i .ic { color: var(--muted); transition: transform .15s; }
a.todo-i:hover { transform: translateY(-2px); border-color: currentColor; }
a.todo-i:hover .ic { transform: translateX(2px); }
.todo-i.bad b { color: var(--bad); } .todo-i.bad { border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.todo-i.warn b { color: var(--warn); } .todo-i.warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.todo-i.info b { color: var(--primary); }
.todo-i.ok { color: var(--good); background: var(--good-soft); border-color: transparent; box-shadow: none; padding-right: 14px; }
@media (min-width: 900px) { .todo { margin: 0; padding: 2px 0 4px; flex-wrap: wrap; overflow: visible; } }

/* Thẻ số liệu */
.kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 1000px) { .kpi-row { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.kpi2 {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); color: var(--text);
  text-decoration: none; transition: transform .18s, box-shadow .18s, border-color .18s;
}
a.kpi2:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.kpi2-l { display: flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 500; color: var(--muted); }
.kpi2-l .ic { color: var(--primary); }
.kpi2-v { font-size: clamp(1.15rem, 4.6vw, 1.45rem); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi2-v small { font-size: .78rem; font-weight: 500; color: var(--muted); }
.kpi2-s { font-size: .76rem; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; position: relative; }
.kpi2.hero {
  grid-column: 1 / -1; border-color: transparent; color: #fff; padding-bottom: 46px;
  background: linear-gradient(135deg, var(--hero-a) 0%, var(--hero-b) 100%); box-shadow: var(--shadow-lg);
}
@media (min-width: 1000px) { .kpi2.hero { grid-column: auto; } }
.kpi2.hero .kpi2-l, .kpi2.hero .kpi2-s, .kpi2.hero .kpi2-v small { color: rgba(255, 255, 255, .82); }
.kpi2.hero .kpi2-v { font-size: clamp(1.5rem, 6vw, 1.85rem); position: relative; }
.spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 42px; }
.spark-a { fill: rgba(255, 255, 255, .12); stroke: none; animation: fade 1.2s ease both; }
.spark-l { fill: none; stroke: rgba(255, 255, 255, .85); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; animation: sparkDraw 1.4s .2s cubic-bezier(.4, 0, .2, 1) forwards; }
@keyframes sparkDraw { to { stroke-dashoffset: 0; } }
.meter { display: block; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 2px; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--good); transition: width 1s cubic-bezier(.2, .8, .2, 1); }
/* Ô chờ tải (thay dấu …) */
.skel { display: inline-block; width: 7em; height: .9em; border-radius: 6px; vertical-align: middle;
  background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: skel 1.2s linear infinite; }
.kpi2.hero .skel { background: linear-gradient(90deg, rgba(255,255,255,.15) 25%, rgba(255,255,255,.3) 50%, rgba(255,255,255,.15) 75%); background-size: 200% 100%; }
@keyframes skel { to { background-position: -200% 0; } }
/* Số đếm nhỏ cạnh tiêu đề */
.count { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 99px; font-size: .72rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); vertical-align: middle; }

/* Vòng tròn tình trạng khách */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { position: relative; width: 150px; height: 150px; flex-shrink: 0; margin: 0 auto; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 4.2; }
.donut-bg { stroke: var(--surface-2); }
.donut-seg { stroke-linecap: round; transition: stroke-dasharray .9s cubic-bezier(.2, .8, .2, 1); stroke: var(--muted); }
.donut-seg.ok { stroke: var(--good); } .donut-seg.warn { stroke: var(--warn); }
.donut-seg.grace { stroke: color-mix(in srgb, var(--bad) 55%, var(--surface)); } .donut-seg.readonly { stroke: var(--bad); }
.donut-seg.none { stroke: color-mix(in srgb, var(--muted) 55%, var(--surface)); } .donut-seg.stopped { stroke: var(--line); }
.donut-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-c b { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.donut-c span { font-size: .78rem; color: var(--muted); }
.donut-wrap .sb-list { flex: 1 1 180px; margin: 0; }
@media (prefers-reduced-motion: reduce) { .spark-l { stroke-dashoffset: 0; } .todo-i { animation: none; } }
/* ============ Bảng: cột phụ tự ẩn (quy chuẩn mục 31) ============ */
.show-sm { display: block; font-size: .78rem; }
@media (min-width: 721px) { .show-sm-grid { display: none !important; } }
.os-edit.show-sm-grid { border-top: 0; padding-top: 0; }
@media (max-width: 720px) { .hide-sm { display: none; } }
@media (min-width: 721px) { .show-sm { display: none; } }
@media (max-width: 420px) { .hide-xs { display: none; } }
/* 4 ô số liệu: 2 cột điện thoại, 4 cột máy tính (không để ô lẻ) */
.kpis.k4 { grid-template-columns: 1fr 1fr; }
@media (min-width: 1100px) { .kpis.k4 { grid-template-columns: repeat(4, 1fr); } }
.kpis.k2 { grid-template-columns: 1fr 1fr; }
.kpis.k3 { grid-template-columns: 1fr 1fr; }
@media (min-width: 700px) { .kpis.k3 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 699px) { .kpis.k3 > .kpi:first-child { grid-column: 1 / -1; } }
.kpi2-v { white-space: nowrap; font-size: clamp(1rem, 1.7vw, 1.35rem); overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 999px) { .kpi2-v { font-size: clamp(1.05rem, 4.6vw, 1.35rem); } }
.kpi2.hero .kpi2-v { font-size: clamp(1.4rem, 3.2vw, 1.85rem); }
.card.flush .tbl-wrap { margin: 0; padding: 0; }
.tbl th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.tbl.click tbody tr:not(.sum-top) { cursor: pointer; }
.tbl tr.dim td { opacity: .5; }
.tbl td small { font-size: .78rem; }
.card.flush > .card-h.pad { padding: 12px 14px 4px; }
.pad { padding: 10px 14px; }
.badge.info { background: var(--primary-soft); color: var(--primary); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.money.warn { color: var(--warn); font-weight: 700; }

/* ============ Form gọn: 2 cột trên máy tính, 1 cột trên điện thoại ============ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-grid .inp, .form-grid .combo { width: 100%; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
details.hint { padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); }
details.hint summary { cursor: pointer; font-weight: 600; color: var(--primary); }
details.hint[open] summary { margin-bottom: 6px; }
.fld.inline { flex-direction: row; align-items: center; gap: 8px; }
.fld.inline > span { font-size: .85rem; }
.sm-inp { width: 70px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline dotted; }
.icon-btn.sm { width: 32px; height: 32px; }

/* ============ Màn nhập đơn ============ */
.ord-top { display: flex; align-items: center; gap: 10px; }
.ord-who { flex: 1; min-width: 0; }
.ord-who h1 { margin: 0; font-size: clamp(1.15rem, 4.5vw, 1.45rem); line-height: 1.25; overflow-wrap: anywhere; }
.ord-who p { margin: 2px 0 0; font-size: .86rem; }
.ord-sum {
  display: flex; flex-direction: column; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow);
}
.os-due { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--r-sm); color: #fff;
  background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); }
.os-due.out { background: linear-gradient(135deg, #9a3412, #c2410c); }
.os-due span { font-size: .82rem; opacity: .88; }
.os-due b { font-size: clamp(1.6rem, 7vw, 2.1rem); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.os-due small { font-size: .8rem; opacity: .88; }
.os-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 14px; }
@media (min-width: 640px) { .os-grid { grid-template-columns: repeat(4, 1fr); } }
.os-grid > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.os-grid span { font-size: .76rem; color: var(--muted); }
.os-grid b { font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.os-grid b.good { color: var(--good); } .os-grid b.warn { color: var(--warn); }
.os-edit { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding-top: 12px; border-top: 1px dashed var(--line); }
.os-edit label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.os-edit span { font-size: .76rem; color: var(--muted); font-weight: 500; }
.os-edit .inp { width: 100%; }
@media (max-width: 420px) { .os-edit { grid-template-columns: 1fr 1fr; } .os-edit label:last-child { grid-column: 1 / -1; } }

/* Nhập nhanh một dòng */
.qa { gap: 10px; border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.qa-row { display: grid; grid-template-columns: 1.4fr 1.2fr .8fr 1fr auto; gap: 10px; align-items: end; }
.qa-row label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.qa-row label > span { font-size: .76rem; color: var(--muted); font-weight: 500; }
.qa-row .inp { width: 100%; }
.qa-amt .inp { font-size: 1.15rem; font-weight: 700; }
.qa-go { min-width: 92px; }
@media (max-width: 720px) {
  .qa-row { grid-template-columns: 1fr 1fr; }
  .qa-amt { grid-column: 1 / -1; }
  .qa-go { grid-column: 1 / -1; }
}
.lines2 { gap: 14px; }
@media (min-width: 1000px) { .lines2 { grid-template-columns: 1.4fr 1fr; } }
.lines-tbl td { padding: 6px 8px; vertical-align: middle; }
.inp.cell { width: 130px; max-width: 100%; height: 36px; min-height: 36px; text-align: right; padding: 0 8px; }
.ord-more summary { cursor: pointer; font-weight: 600; }
.ord-more[open] summary { margin-bottom: 4px; }

/* Thẻ ngân hàng của khách */
.card-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.ctile {
  position: relative; display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 14px 16px; border: 0; cursor: pointer;
  border-radius: 14px; color: #fff; font: inherit; background: linear-gradient(135deg, #1e3a8a, #2563eb); box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.ctile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.ctile.dim { filter: grayscale(.8); opacity: .65; }
.ct-bank { font-weight: 800; letter-spacing: .04em; display: flex; justify-content: space-between; }
.ct-bank small { font-weight: 600; opacity: .85; }
.ct-num { font-size: 1.15rem; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.ct-holder { font-size: .82rem; text-transform: uppercase; opacity: .9; }
.ct-meta { font-size: .76rem; opacity: .85; }
.ct-due { font-size: .76rem; font-weight: 600; align-self: flex-start; padding: 2px 8px; border-radius: 99px; background: rgba(255, 255, 255, .18); }
.ct-due.soon { background: #fbbf24; color: #3b2300; }
.ct-kept { position: absolute; top: 12px; right: 50%; transform: translateX(50%); font-size: .7rem; font-weight: 700; padding: 2px 8px;
  border-radius: 99px; background: rgba(0, 0, 0, .25); }

/* Bill đơn gửi khách */
.ob-h { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; padding: 0 4px 10px; border-bottom: 2px solid var(--x-head-text); margin-bottom: 10px; }
.ob-h > div { display: flex; flex-direction: column; gap: 1px; }
.ob-h small { font-size: .75rem; color: var(--x-muted); }
.ob-h b { font-size: 1.15rem; }
.ob-h span { font-size: .82rem; color: var(--x-note); }
.ob-h .r { text-align: right; }
.ob-tbl td.neg-t { color: var(--x-neg); font-weight: 600; }
.ob-tbl tfoot .ob-sum td { background: var(--x-hl); color: var(--x-hl-text); }
.ob-total { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-top: 12px; padding: 0 4px; }
.ob-total > div { display: flex; gap: 16px; justify-content: space-between; min-width: min(320px, 100%); }
.ob-total span { color: var(--x-note); }
.ob-total b { font-variant-numeric: tabular-nums; }
.ob-due { margin-top: 4px; padding: 8px 10px; border-radius: 6px; background: var(--x-head); font-size: 1.1rem; }
.ob-due span { color: var(--x-head-text); font-weight: 700; }
.ob-note { margin: 10px 4px 0; font-size: .85rem; color: var(--x-note); }
.xl.ob.capture .ob-h b { font-size: 1.35rem; }
.chart-skel { width: 100%; height: 220px; }

/* ============ Màn đăng nhập: thẻ quẹt qua máy POS ============ */
.auth-hero { background: linear-gradient(180deg, #0f2a57 0%, #0b1f42 50%, #07142c 100%); }
.dr-scene { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.dr-grid { position: absolute; inset: 0; opacity: .35;
  background-image: linear-gradient(rgba(143, 211, 255, .12) 1px, transparent 1px), linear-gradient(90deg, rgba(143, 211, 255, .12) 1px, transparent 1px);
  background-size: 40px 40px; }
.dr-line { position: absolute; left: 0; right: 0; bottom: 40px; width: 100%; height: 45%; opacity: .7; }
.dr-line path { fill: none; stroke: #60a5fa; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 900; stroke-dashoffset: 900; animation: drDraw 3.5s .4s ease forwards; vector-effect: non-scaling-stroke; }
@keyframes drDraw { to { stroke-dashoffset: 0; } }
.dr-coin { position: absolute; top: -40px; left: max(var(--l), 470px); animation: drFall var(--t, 9s) linear infinite; animation-delay: var(--d, 0s); }
.dr-coin svg { width: 28px; animation: drFlip 1.8s ease-in-out infinite; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .3)); }
@keyframes drFall { to { transform: translateY(115vh); } }
@keyframes drFlip { 50% { transform: scaleX(.2); } }
.dr-pos { position: absolute; right: 9%; bottom: 8%; width: 230px; height: 240px; }
.dr-term { position: absolute; right: 0; bottom: 0; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .45)); }
.dr-amt { animation: drBlink 4.5s ease-in-out infinite; }
@keyframes drBlink { 0%, 40% { opacity: .2; } 55%, 100% { opacity: .8; } }
.dr-card { position: absolute; right: 70px; bottom: 120px; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .4)); }
.dr-card.c1 { animation: drSwipe 4.5s ease-in-out infinite; }
.dr-card.c2 { right: 120px; bottom: 40px; transform: rotate(-14deg); opacity: .9; animation: drFloat 6s ease-in-out infinite; }
@keyframes drSwipe {
  0% { transform: translate(-40px, -24px) rotate(-8deg); opacity: 0; }
  12% { opacity: 1; }
  40% { transform: translate(10px, 22px) rotate(0); }
  55% { transform: translate(10px, 22px) rotate(0); }
  80% { transform: translate(-40px, -30px) rotate(-10deg); opacity: 1; }
  100% { transform: translate(-50px, -36px) rotate(-12deg); opacity: 0; }
}
@keyframes drFloat { 50% { transform: rotate(-10deg) translateY(-8px); } }
.dr-receipt { position: absolute; right: 25px; bottom: 165px; width: 60px; padding: 6px 6px 8px; background: #fff; border-radius: 3px 3px 0 0;
  display: flex; flex-direction: column; gap: 4px; transform-origin: bottom; animation: drPrint 4.5s ease-in-out infinite; }
.dr-receipt i { display: block; height: 3px; border-radius: 2px; background: #cbd5e1; }
.dr-receipt i:nth-child(2) { width: 70%; }
.dr-receipt b { font-size: 7px; color: #15803d; letter-spacing: .04em; }
@keyframes drPrint { 0%, 50% { transform: scaleY(0); opacity: 0; } 62%, 88% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }
/* Không để cảnh đè lên chữ: màn vừa → bỏ đồng xu, đẩy máy POS xuống góc */
@media (max-width: 1280px) { .dr-coin { display: none; } .dr-pos { right: 4%; bottom: 2%; transform: scale(.85); transform-origin: bottom right; } }
@media (max-width: 899px) {
  .dr-pos { right: 4%; bottom: -30px; transform: scale(.62); transform-origin: bottom right; }
  .dr-line { height: 55%; bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dr-scene * { animation: none !important; }
  .dr-line path { stroke-dashoffset: 0; }
  .dr-coin { display: none; }
}
/* Thẻ (tab) trong trang khách */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin: 0 -16px; padding: 0 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  position: relative; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px 12px; border: 0; background: none;
  font: inherit; font-size: .9rem; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; transition: color .15s;
}
.tabs button::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0;
  background: var(--primary); transform: scaleX(0); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--primary); }
.tabs button.on::after { transform: scaleX(1); }
.tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.tab-dot.warn { background: var(--warn); }
.tab-body { display: flex; flex-direction: column; gap: 14px; animation: gtFadeInUp .35s ease both; }
@media (min-width: 900px) { .tabs { margin: 0; padding: 0; } }
/* Điện thoại: 4 ô số liệu không để ô lẻ; bảng gọn hơn để không tràn ngang */
@media (max-width: 699px) { .kpis.k4 > .kpi:last-child { grid-column: 1 / -1; } }
@media (max-width: 420px) {
  .tbl { font-size: .8rem; }
  .tbl td, .tbl th { padding: 8px 5px; }
  .tbl th { font-size: .66rem; letter-spacing: 0; }
}
@media (max-width: 699px) { .kpis.k2 > .kpi:last-child { grid-column: 1 / -1; } }

/* =====================================================================
   Nâng cấp 11/10/2026: bảng có tiêu đề rõ + hộp nhập liệu kiểu mới (quy chuẩn mục 18, 27, 31)
   ===================================================================== */

/* ---------- Bảng dữ liệu ---------- */
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .tbl-wrap { margin: 0; padding: 0; }
.tbl { font-size: .9rem; }
.tbl thead th {
  position: sticky; top: 0; z-index: 2; background: var(--th-bg); color: var(--th-text);
  font-size: .72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap;
  padding: 11px 10px; border-bottom: 2px solid var(--th-line);
}
.tbl thead th:first-child, .tbl td:first-child { padding-left: 14px; }
.tbl thead th:last-child, .tbl td:last-child { padding-right: 14px; }
.tbl td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; transition: background .12s; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: transparent; }
.tbl tbody tr:nth-child(even):not(.sum-top) td { background: var(--row-alt); }
.tbl.click tbody tr:not(.sum-top):hover td { background: var(--row-hover); }
.tbl.click tbody tr:not(.sum-top) td:first-child { box-shadow: inset 3px 0 0 transparent; transition: box-shadow .15s, background .12s; }
.tbl.click tbody tr:not(.sum-top):hover td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.tbl td b { font-weight: 650; }
.tbl .r { font-variant-numeric: tabular-nums; }
/* Dòng tổng cộng (đưa lên đầu) */
.tbl tr.sum-top td { background: var(--sum-bg); color: var(--sum-text); font-weight: 800; border-bottom: 2px solid var(--th-line); }
.tbl tr.sum-top td:first-child { font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; }
.tbl tr.sum-top td .money { color: inherit; }
/* Dòng hiện lần lượt (20 dòng đầu) */
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } }
.tbl tbody tr:nth-child(-n+20) { animation: rowIn .32s ease backwards; }
.tbl tbody tr:nth-child(2) { animation-delay: 22ms; } .tbl tbody tr:nth-child(3) { animation-delay: 44ms; }
.tbl tbody tr:nth-child(4) { animation-delay: 66ms; } .tbl tbody tr:nth-child(5) { animation-delay: 88ms; }
.tbl tbody tr:nth-child(6) { animation-delay: 110ms; } .tbl tbody tr:nth-child(7) { animation-delay: 132ms; }
.tbl tbody tr:nth-child(8) { animation-delay: 154ms; } .tbl tbody tr:nth-child(9) { animation-delay: 176ms; }
.tbl tbody tr:nth-child(10) { animation-delay: 198ms; } .tbl tbody tr:nth-child(11) { animation-delay: 220ms; }
.tbl tbody tr:nth-child(12) { animation-delay: 242ms; } .tbl tbody tr:nth-child(13) { animation-delay: 264ms; }
.tbl tbody tr:nth-child(14) { animation-delay: 286ms; } .tbl tbody tr:nth-child(15) { animation-delay: 308ms; }
.tbl tbody tr:nth-child(16) { animation-delay: 330ms; } .tbl tbody tr:nth-child(17) { animation-delay: 352ms; }
.tbl tbody tr:nth-child(18) { animation-delay: 374ms; } .tbl tbody tr:nth-child(19) { animation-delay: 396ms; }
.tbl tbody tr:nth-child(20) { animation-delay: 418ms; }
/* Dòng vừa thêm: loé xanh */
@keyframes rowFlash { 0%, 30% { background: color-mix(in srgb, var(--good) 24%, transparent); } }
.tbl tbody tr.flash td { animation: rowFlash 1.6s ease; }
@media (prefers-reduced-motion: reduce) { .tbl tbody tr, .tbl tbody tr.flash td { animation: none; } }

/* Đầu bảng: tên bảng + số dòng + tổng / nút */
.tbl-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tbl-h h3 { display: flex; align-items: center; gap: 9px; font-size: 1rem; font-weight: 700; margin: 0; }
.tbl-h-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.tbl-h-ic.good { background: var(--good-soft); color: var(--good); }
.tbl-h-ic.warn { background: var(--warn-soft); color: var(--warn); }
.tbl-h-ic.bad { background: var(--bad-soft); color: var(--bad); }
.tbl-h .count { font-size: .74rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-variant-numeric: tabular-nums; }
.tbl-h .tot { font-size: .84rem; color: var(--muted); white-space: nowrap; }
.tbl-h .tot b { color: var(--text); font-size: 1rem; font-variant-numeric: tabular-nums; margin-left: 4px; }
.tbl-h .grow { flex: 1; }
.card.flush > p.muted { padding: 14px; margin: 0; }
@media (max-width: 420px) {
  .tbl thead th { font-size: .64rem; letter-spacing: .02em; padding: 10px 6px; }
  .tbl td { padding: 9px 6px; }
  .tbl thead th:first-child, .tbl td:first-child { padding-left: 10px; }
  .tbl thead th:last-child, .tbl td:last-child { padding-right: 10px; }
  .tbl-h { padding: 10px 12px; }
}

/* Cột phụ ẩn khi vùng nội dung hẹp (điện thoại, hoặc máy tính cửa sổ nhỏ có menu trái) — chữ phụ hiện dưới tên thay thế */
.show-md { display: none; }
@media (max-width: 720px), (min-width: 900px) and (max-width: 1180px) { .hide-md { display: none; } .show-md { display: block; font-size: .78rem; } }
.tbl td b + .badge { margin-left: 4px; }

/* ---------- Hộp nhập liệu (modal / bottom sheet) ---------- */
.overlay { background: rgba(9, 18, 36, .46); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .18s ease; }
.sheet { position: relative; animation: sheetUp .24s cubic-bezier(.2, .9, .3, 1); }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
@keyframes sheetPop { from { transform: translateY(8px) scale(.97); opacity: 0; } 70% { transform: translateY(-1px) scale(1.005); } }
@media (min-width: 700px) { .sheet { animation: sheetPop .22s cubic-bezier(.2, .9, .3, 1); width: 560px; } }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 8px auto 0; flex-shrink: 0; }
@media (min-width: 700px) { .sheet-grip { display: none; } }
.sheet-h { gap: 12px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.sheet-h h2 { font-size: 1.08rem; font-weight: 700; }
.sheet-h .grow { display: flex; flex-direction: column; min-width: 0; }
.sheet-h small { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary); animation: icPop .35s cubic-bezier(.3, 1.6, .5, 1) .05s backwards; }
.sheet-ic.good { background: var(--good-soft); color: var(--good); }
.sheet-ic.warn { background: var(--warn-soft); color: var(--warn); }
.sheet-ic.bad { background: var(--bad-soft); color: var(--bad); }
@keyframes icPop { from { transform: scale(.5) rotate(-12deg); opacity: 0; } }
.sheet-b { padding: 16px 20px 18px; gap: 16px; }
.sheet-b > * { flex-shrink: 0; }
.sheet-f { background: var(--surface-2); border-top: 1px solid var(--line); border-radius: 0 0 20px 20px; }
@media (max-width: 699px) { .sheet-f { border-radius: 0; } }
.sheet-f .btn { min-width: 96px; }
.sheet-f .btn.primary { box-shadow: 0 6px 16px -6px var(--cta-shadow); }

/* Nhóm ô trong hộp: tiêu đề nhỏ + vạch kẻ */
.form-sec { display: flex; align-items: center; gap: 10px; margin: 2px 0 -4px; font-size: .72rem; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--primary); }
.form-sec::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.form-grid { gap: 14px; }
.form-grid > * { animation: fldIn .3s ease backwards; }
.form-grid > :focus-within { position: relative; z-index: 5; }
.form-grid > :nth-child(2) { animation-delay: 25ms; } .form-grid > :nth-child(3) { animation-delay: 50ms; }
.form-grid > :nth-child(4) { animation-delay: 75ms; } .form-grid > :nth-child(5) { animation-delay: 100ms; }
.form-grid > :nth-child(6) { animation-delay: 125ms; } .form-grid > :nth-child(7) { animation-delay: 150ms; }
.form-grid > :nth-child(8) { animation-delay: 175ms; } .form-grid > :nth-child(n+9) { animation-delay: 200ms; }
@keyframes fldIn { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .form-grid > *, .sheet, .sheet-ic { animation: none; } }

/* Ô nhập: nhãn trên (đổi màu khi đang gõ), * đỏ = bắt buộc, ✓ khi hợp lệ, viền đỏ + câu ngắn khi sai */
.sheet .fld > span, .fld-l { font-size: .8rem; font-weight: 600; color: var(--muted); transition: color .15s; display: flex; align-items: center; gap: 4px; }
.sheet .fld:focus-within > span, .fld:focus-within > .fld-l { color: var(--primary); }
.fld-l i { font-style: normal; color: var(--bad); }
.fld-l .tick { color: var(--good); font-weight: 800; opacity: 0; transform: scale(.4); transition: opacity .25s, transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.fld.ok .fld-l .tick { opacity: 1; transform: scale(1); }
.sheet .inp { min-height: 46px; border-radius: 11px; background: var(--inp-bg); border-color: var(--inp-line); }
.sheet .inp:hover:not(:focus):not(:disabled) { border-color: color-mix(in srgb, var(--primary) 40%, var(--inp-line)); }
.sheet .inp:focus { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
.sheet .inp:disabled { opacity: .65; }
.fld.bad .inp { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.fld-msg { font-size: .76rem; color: var(--muted); max-height: 0; opacity: 0; overflow: hidden; transform: translateY(-4px); margin-top: -4px;
  transition: max-height .25s ease, opacity .2s ease, transform .25s ease, margin .25s; }
.fld:focus-within .fld-msg, .fld.bad .fld-msg { max-height: 3em; opacity: 1; transform: none; margin-top: 0; }
.fld.bad .fld-msg { color: var(--bad); font-weight: 600; }
/* Đơn vị trong ô: đ / % */
.unit { position: relative; display: block; min-width: 0; }
.unit .inp { padding-right: 32px; }
.unit::after { content: attr(data-u); position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: .86rem; font-weight: 600;
  color: var(--muted); pointer-events: none; }
.unit .inp.num { font-weight: 600; }
/* Công tắc bật / tắt (thay ô tích) */
.toggle input[type=checkbox] { appearance: none; -webkit-appearance: none; position: relative; width: 40px; height: 23px; border-radius: 99px; flex-shrink: 0;
  background: var(--line); cursor: pointer; transition: background .2s; margin: 0; }
.toggle input[type=checkbox]::after { content: ''; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .22s cubic-bezier(.3, 1.4, .5, 1); }
.toggle input[type=checkbox]:checked { background: var(--primary); }
.toggle input[type=checkbox]:checked::after { transform: translateX(17px); }
.toggle input[type=checkbox]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.toggle.small input[type=checkbox] { width: 34px; height: 20px; }
.toggle.small input[type=checkbox]::after { width: 14px; height: 14px; }
.toggle.small input[type=checkbox]:checked::after { transform: translateX(14px); }
.switches { display: flex; gap: 4px 22px; flex-wrap: wrap; padding: 2px 12px; border-radius: 12px; background: var(--surface-2); }
/* Chip chọn trong hộp (thẻ của khách, loại thẻ) */
.sheet .chip { transition: background .15s, border-color .15s, color .15s, transform .12s, box-shadow .15s; }
.sheet .chip:hover:not(.on) { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.sheet .chip:active { transform: scale(.96); }
.sheet .chip.on { box-shadow: 0 4px 12px -6px var(--cta-shadow); }
.sheet .seg { width: 100%; }
.sheet .seg button { flex: 1; }
.sheet details.hint { border: 1px dashed var(--line); }
/* Nút đang lưu: vòng quay nhỏ */
.btn .spin.sm { width: 16px; height: 16px; border-width: 2px; border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
.btn:not(.primary) .spin.sm { border-color: var(--line); border-top-color: var(--primary); }

/* ---------- Nhập nhanh trong đơn ---------- */
.qa { position: relative; overflow: hidden; }
.qa::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(var(--hero-a), var(--hero-b)); }
.qa-row label > span { font-weight: 600; }
.qa .inp { min-height: 46px; border-radius: 11px; background: var(--inp-bg); border-color: var(--inp-line); }
.qa .inp:focus { background: var(--surface); box-shadow: 0 0 0 4px var(--focus); }
.qa-amt .unit .inp { font-size: 1.25rem; font-weight: 800; }
.qa-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.qa-key { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; color: var(--muted); }
.qa-key kbd { font: inherit; font-weight: 700; font-size: .7rem; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); border-bottom-width: 2px; background: var(--surface); color: var(--text); }
@keyframes addPulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 50%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }
.qa-go.pulse { animation: addPulse .6s ease; }

/* ---------- Máy POS chưa có % phí ---------- */
.badge.mute { background: var(--surface-2); color: var(--muted); }
.fee-zero { color: var(--warn); font-weight: 700; }

/* ---------- Báo cáo ---------- */
.rp-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .rp-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .rp-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.rp-k { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); min-width: 0; animation: kpiPop .3s ease backwards; }
.rp-k:nth-child(2) { animation-delay: 40ms; } .rp-k:nth-child(3) { animation-delay: 80ms; } .rp-k:nth-child(4) { animation-delay: 120ms; }
.rp-k:nth-child(5) { animation-delay: 160ms; } .rp-k:nth-child(6) { animation-delay: 200ms; }
@keyframes kpiPop { from { opacity: 0; transform: scale(.85); } }
.rp-k > span { font-size: .76rem; color: var(--muted); font-weight: 600; }
.rp-k b { font-size: clamp(1rem, 2.2vw, 1.25rem); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-k > small { font-size: .74rem; color: var(--muted); }
.rp-k.hero { background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); color: #fff; border-color: transparent; }
.rp-k.hero > span, .rp-k.hero > small { color: rgba(255, 255, 255, .85); }
.rp-k.good b { color: var(--good); }
.rp-k b .money { font-size: inherit; font-weight: inherit; }
.tbl tr.sum-top td:first-child { white-space: nowrap; }
.bar-cell { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 104px; }
.bar-cell i { display: block; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--primary) 45%, transparent); transform-origin: right;
  animation: barGrowX .6s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes barGrowX { from { transform: scaleX(0); } }
.switches.retro { flex-direction: column; gap: 6px; padding: 6px 12px 10px; background: var(--warn-soft); }
.switches.retro .fld.inline { flex-wrap: wrap; padding-left: 50px; }
.switches.retro .fld.inline > span { white-space: nowrap; font-weight: 600; }
.switches.retro .inp { width: 170px; min-height: 38px; }

/* ---------- Biểu đồ kiểu mới (charts.js): Quẹt xanh dương · Đáo xanh ngọc — đã kiểm tra mù màu + tương phản ---------- */
.ch { position: relative; width: 100%; min-height: 40px; }
.ch svg { display: block; overflow: visible; }
.ch-grid line { stroke: var(--line); stroke-dasharray: 2 4; }
.ch-grid line.base { stroke: color-mix(in srgb, var(--muted) 45%, transparent); stroke-dasharray: none; }
.ch text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.ch-x { font-size: 11px; }
.ch-hit { fill: transparent; cursor: pointer; transition: fill .15s; }
.ch-col.on .ch-hit { fill: color-mix(in srgb, var(--primary) 8%, transparent); }
.ch-col.off .ch-bar { opacity: .45; }
.ch-bar { transform-box: fill-box; transform-origin: 50% 100%; animation: chGrow .7s cubic-bezier(.22, .9, .3, 1) backwards; animation-delay: var(--d, 0ms);
  transition: opacity .15s; }
@keyframes chGrow { from { transform: scaleY(0); } }
.ch-bar.s-sale, .dot.sale { fill: var(--sale); background: var(--sale); }
.ch-bar.s-buy, .dot.buy { fill: var(--buy); background: var(--buy); }
.ch-bar.s-main { fill: var(--primary); }
.ch-line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: chDraw 1.1s ease .1s forwards; }
@keyframes chDraw { to { stroke-dashoffset: 0; } }
.ch-line.s-main { stroke: var(--sale); }
.ch-line.s-good { stroke: var(--good); }
.ch-stop1.s-main { stop-color: var(--sale); stop-opacity: .28; } .ch-stop2.s-main { stop-color: var(--sale); stop-opacity: 0; }
.ch-stop1.s-good { stop-color: var(--good); stop-opacity: .28; } .ch-stop2.s-good { stop-color: var(--good); stop-opacity: 0; }
.ch-area { animation: fade .8s ease .3s backwards; }
.ch-cross { stroke: color-mix(in srgb, var(--muted) 60%, transparent); stroke-dasharray: 3 3; }
.ch-dot { stroke: var(--surface); stroke-width: 2; }
.ch-dot.s-main { fill: var(--sale); } .ch-dot.s-good { fill: var(--good); }
.ch-tip { position: absolute; top: 0; transform: translate(-50%, -8px); z-index: 3; pointer-events: none; min-width: 160px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px 10px;
  font-size: .8rem; display: flex; flex-direction: column; gap: 3px; animation: fade .12s ease; }
.ch-tip b { font-weight: 700; }
.ch-tip > b:first-child { font-size: .82rem; margin-bottom: 2px; }
.ch-tip .r { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.ch-tip .r span { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.ch-tip .sw { width: 9px; height: 9px; border-radius: 3px; }
.ch-tip .sw.sale { background: var(--sale); } .ch-tip .sw.buy { background: var(--buy); } .ch-tip .sw.good { background: var(--good); }
.ch-sum { display: flex; gap: 18px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.ch-sum b { display: block; font-size: 1.05rem; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-grid { display: grid; gap: 14px; }
@media (min-width: 1100px) { .chart-grid { grid-template-columns: 1.6fr 1fr; align-items: stretch; } }
@media (prefers-reduced-motion: reduce) { .ch-bar, .ch-line, .ch-area { animation: none; stroke-dashoffset: 0; } }

/* Thanh xếp hạng */
.rk { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rk li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "n v" "b b"; align-items: center; gap: 5px 10px; padding: 6px 8px; border-radius: 8px;
  animation: rowIn .3s ease backwards; animation-delay: calc(var(--i) * 30ms); }
.rk li.click { cursor: pointer; } .rk li.click:hover { background: var(--row-hover); }
.rk-n { grid-area: n; font-size: .86rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rk-n small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.rk-bar { grid-area: b; height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.rk-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--hero-a), var(--sale));
  transform-origin: left; animation: barGrowL .7s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--i) * 40ms); }
@keyframes barGrowL { from { transform: scaleX(0); } }
.rk-v { grid-area: v; font-size: .86rem; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* Khách & thẻ: ô số liệu tổng hợp + các khung báo cáo */
.ck-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 760px) and (max-width: 899px), (min-width: 1200px) { .ck-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ck-k { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); min-width: 0; animation: kpiPop .3s ease backwards; text-decoration: none; color: var(--text);
  transition: transform .18s, box-shadow .18s, border-color .18s; }
a.ck-k:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.ck-k:nth-child(2) { animation-delay: 50ms; } .ck-k:nth-child(3) { animation-delay: 100ms; } .ck-k:nth-child(4) { animation-delay: 150ms; }
.ck-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; background: var(--primary-soft); color: var(--primary); }
.ck-ic.good { background: var(--good-soft); color: var(--good); } .ck-ic.warn { background: var(--warn-soft); color: var(--warn); }
.ck-ic.bad { background: var(--bad-soft); color: var(--bad); }
.ck-k > div { display: flex; flex-direction: column; min-width: 0; }
.ck-k span { font-size: .76rem; color: var(--muted); font-weight: 600; }
.ck-k b { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ck-k small { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ck-row { display: grid; gap: 14px; }
@media (min-width: 1000px) { .ck-row { grid-template-columns: 1fr 1fr; align-items: start; } }
.ck-row > .card { gap: 10px; }
/* Lịch thanh toán thẻ trong tháng: 31 ô ngày, cao theo số thẻ */
.cal { display: grid; grid-template-columns: repeat(31, minmax(0, 1fr)); gap: 3px; align-items: end; height: 120px; padding-top: 18px; }
.cal button { position: relative; border: 0; padding: 0; background: none; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; cursor: pointer; }
.cal i { display: block; width: 100%; min-height: 3px; border-radius: 4px 4px 1px 1px; background: color-mix(in srgb, var(--sale) 75%, transparent);
  transform-origin: bottom; animation: chGrow .6s cubic-bezier(.22, .9, .3, 1) backwards; animation-delay: calc(var(--i) * 15ms); }
.cal button.zero i { background: var(--surface-2); }
.cal button.today i { background: var(--warn); }
.cal button.soon i { background: color-mix(in srgb, var(--warn) 70%, transparent); }
.cal button.on i { outline: 2px solid var(--primary); outline-offset: 1px; }
.cal button b { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: .66rem; color: var(--text); }
.cal-x { display: grid; grid-template-columns: repeat(31, minmax(0, 1fr)); gap: 3px; font-size: .62rem; color: var(--muted); text-align: center; margin-top: 4px; }
.cal-x span:not(:nth-child(5n+1)) { visibility: hidden; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .76rem; color: var(--muted); align-items: center; }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* =====================================================================
   Ô số liệu có màu (Tổng quan, Đơn, Khách & thẻ, Máy POS, Công nợ, Báo cáo) + bảng viền màu chủ đạo
   Mỗi ô một màu nhấn (--ac): nền chuyển màu nhạt, vạch màu bên trái, vòng tròn mờ ở góc, rê chuột thì nhấc lên + loé sáng
   ===================================================================== */
:root {
  --ac-blue: #2563eb; --ac-teal: #0d9488; --ac-green: #16a34a; --ac-amber: #d97706; --ac-violet: #7c3aed; --ac-rose: #e11d48;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ac-blue: #60a5fa; --ac-teal: #2dd4bf; --ac-green: #4ade80; --ac-amber: #fbbf24; --ac-violet: #a78bfa; --ac-rose: #fb7185; }
}
:root[data-theme="dark"] { --ac-blue: #60a5fa; --ac-teal: #2dd4bf; --ac-green: #4ade80; --ac-amber: #fbbf24; --ac-violet: #a78bfa; --ac-rose: #fb7185; }

.kpi:not(.hero), .kpi2:not(.hero), .rp-k:not(.hero), .ck-k {
  --ac: var(--ac-blue);
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(135deg, color-mix(in srgb, var(--ac) 14%, var(--surface)) 0%, color-mix(in srgb, var(--ac) 4%, var(--surface)) 70%);
  border: 1px solid color-mix(in srgb, var(--ac) 30%, var(--line));
  box-shadow: 0 1px 2px rgba(15, 36, 71, .04), 0 8px 22px -14px color-mix(in srgb, var(--ac) 60%, transparent);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
/* Vạch màu bên trái + vòng tròn mờ ở góc */
.kpi:not(.hero)::before, .kpi2:not(.hero)::before, .rp-k:not(.hero)::before, .ck-k::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ac); z-index: -1;
}
.kpi:not(.hero)::after, .kpi2:not(.hero)::after, .rp-k:not(.hero)::after, .ck-k::after {
  content: ''; position: absolute; width: 120px; height: 120px; right: -42px; top: -52px; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, color-mix(in srgb, var(--ac) 22%, transparent) 0%, transparent 70%);
  transition: transform .4s ease;
}
.kpi:not(.hero):hover, .kpi2:not(.hero):hover, .rp-k:not(.hero):hover, .ck-k:hover {
  transform: translateY(-4px); border-color: color-mix(in srgb, var(--ac) 55%, var(--line));
  box-shadow: 0 14px 30px -14px color-mix(in srgb, var(--ac) 70%, transparent);
}
.kpi:not(.hero):hover::after, .kpi2:not(.hero):hover::after, .rp-k:not(.hero):hover::after, .ck-k:hover::after { transform: scale(1.35); }
/* Số liệu theo màu nhấn (đậm hơn để dễ đọc) */
.kpi:not(.hero) b, .kpi2:not(.hero) .kpi2-v, .rp-k:not(.hero) b, .ck-k b { color: color-mix(in srgb, var(--ac) 70%, var(--text)); }
.kpi:not(.hero) > span, .rp-k:not(.hero) > span, .ck-k span { color: color-mix(in srgb, var(--ac) 45%, var(--muted)); font-weight: 700; }
.kpi2:not(.hero) .kpi2-l, .kpi2:not(.hero) .kpi2-l .ic { color: color-mix(in srgb, var(--ac) 60%, var(--muted)); font-weight: 700; }
.ck-k .ck-ic { background: color-mix(in srgb, var(--ac) 16%, var(--surface)); color: var(--ac); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ac) 25%, transparent); }
.ck-k:hover .ck-ic { transform: rotate(-6deg) scale(1.06); }
.ck-ic { transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
/* Ô nổi bật (nền xanh đậm): loé sáng chạy qua khi rê chuột */
.kpi.hero, .kpi2.hero, .rp-k.hero { position: relative; overflow: hidden; transition: transform .2s ease, box-shadow .2s ease; }
.kpi.hero:hover, .kpi2.hero:hover, .rp-k.hero:hover { transform: translateY(-4px); box-shadow: 0 16px 32px -14px var(--cta-shadow); }
.rp-k.hero::after, .kpi2.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .18) 50%, transparent 65%); transform: translateX(-120%);
}
.rp-k.hero:hover::after, .kpi2.hero:hover::after { transform: translateX(120%); transition: transform .8s ease; }
/* Hiện lần lượt */
.kpis > .kpi, .kpi-row > .kpi2 { animation: kpiPop .35s cubic-bezier(.3, 1.3, .5, 1) backwards; }
.kpis > .kpi:nth-child(2), .kpi-row > .kpi2:nth-child(2) { animation-delay: 60ms; }
.kpis > .kpi:nth-child(3), .kpi-row > .kpi2:nth-child(3) { animation-delay: 120ms; }
.kpis > .kpi:nth-child(4), .kpi-row > .kpi2:nth-child(4) { animation-delay: 180ms; }

/* Gán màu: Đơn / Máy POS / Công nợ (.kpis) */
.kpis > .kpi:nth-child(2) { --ac: var(--ac-teal); }
.kpis > .kpi:nth-child(3) { --ac: var(--ac-violet); }
.kpis > .kpi:nth-child(4) { --ac: var(--ac-amber); }
.kpis > .kpi.good { --ac: var(--ac-green); }
.kpis > .kpi.bad { --ac: var(--ac-rose); }
.kpi.good b, .kpi.bad b { color: var(--ac); }
/* Tổng quan (.kpi-row) */
.kpi-row > .kpi2:nth-child(2) { --ac: var(--ac-teal); }
.kpi-row > .kpi2:nth-child(3) { --ac: var(--ac-green); }
.kpi-row > .kpi2:nth-child(4) { --ac: var(--ac-amber); }
/* Báo cáo (.rp-kpis) */
.rp-kpis > .rp-k:nth-child(2) { --ac: var(--ac-violet); }
.rp-kpis > .rp-k:nth-child(3) { --ac: var(--ac-amber); }
.rp-kpis > .rp-k:nth-child(4) { --ac: var(--ac-blue); }
.rp-kpis > .rp-k:nth-child(5) { --ac: var(--ac-teal); }
.rp-kpis > .rp-k:nth-child(6) { --ac: var(--ac-rose); }
/* Khách & thẻ (.ck-kpis) */
.ck-kpis > .ck-k:nth-child(2) { --ac: var(--ac-teal); }
.ck-kpis > .ck-k:nth-child(3) { --ac: var(--ac-amber); }
.ck-kpis > .ck-k:nth-child(4) { --ac: var(--ac-rose); }
/* Khung số liệu trong trang đơn / trang khách: mỗi ô nhỏ cũng có nền nhạt */
.os-grid > div { padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 14%, var(--line)); }
.os-grid > div:has(b.good) { background: color-mix(in srgb, var(--good) 9%, var(--surface)); border-color: color-mix(in srgb, var(--good) 25%, var(--line)); }
.os-due { position: relative; overflow: hidden; }
.os-due::after { content: ''; position: absolute; width: 180px; height: 180px; right: -60px; top: -80px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
@media (prefers-reduced-motion: reduce) { .kpis > .kpi, .kpi-row > .kpi2 { animation: none; } }

/* ---------- Bảng: viền màu chủ đạo, nền xanh rất nhạt (khác nền trang) ---------- */
.card.flush {
  --row-alt: color-mix(in srgb, var(--primary) 7%, var(--surface));
  --row-hover: color-mix(in srgb, var(--primary) 15%, var(--surface));
  background: color-mix(in srgb, var(--primary) 3%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 38%, var(--line));
  box-shadow: 0 1px 2px rgba(15, 36, 71, .05), 0 10px 26px -16px color-mix(in srgb, var(--primary) 55%, transparent);
}
.card.flush > .tbl-h { background: color-mix(in srgb, var(--primary) 10%, var(--surface)); border-bottom-color: color-mix(in srgb, var(--primary) 25%, var(--line)); }
.card.flush .tbl td { border-bottom-color: color-mix(in srgb, var(--primary) 12%, var(--line)); }
.card.flush .tbl thead th + th { box-shadow: inset 1px 0 0 rgba(255, 255, 255, .12); }
@media (min-width: 1000px) and (max-width: 1300px) { .kpi2.hero .kpi2-v { font-size: clamp(1.15rem, 2.3vw, 1.6rem); } }
.tbl td.t-name { min-width: 140px; }
