/* Giao dien: chu to, nut lon, trang thai luon co chu di kem mau. Mot bo ma cho ca may tinh va dien thoai. */
:root {
  --ink: #0F1E2E; --muted: #4A5B6E; --line: #DCE2EA; --bg: #F4F6F9; --card: #FFFFFF;
  --nav: #237E49; --nav-2: #1B663A; --nav-text: #FFFFFF;
  --blue: #237E49; --blue-d: #1B663A; --blue-l: #E7F4EC;
  --info: #1468E0; --info-d: #0B4AA8; --info-l: #EAF2FE;
  --ok: #237E49; --ok-d: #14532F; --ok-l: #E7F4EC;
  --debt: #B45309; --debt-d: #7A3600; --debt-l: #FDEEDC;
  --radius: 12px; --shadow: 0 1px 2px rgba(15, 30, 46, .06), 0 2px 8px rgba(15, 30, 46, .04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif; }
h1 { margin: 0; font-size: 28px; line-height: 1.2; letter-spacing: -.01em; }
h2 { margin: 26px 0 10px; font-size: 20px; }
h3 { margin: 0; } p { margin: 6px 0; } a { color: var(--blue); }
.muted { color: var(--muted); font-size: 15.5px; }
.lg { font-size: 19px; } .r { text-align: right; }
.t-ok { color: var(--ok-d); } .t-debt { color: var(--debt-d); }
[hidden] { display: none !important; }

/* ---------- Bo cuc ---------- */
.layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.topbar { display: none; }
.side { background: var(--nav); color: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; flex-direction: column; gap: 2px; padding: 0 8px 14px; border-bottom: 1px solid rgba(255, 255, 255, .14); }
.brand strong { font-size: 19px; line-height: 1.25; } .brand span { color: var(--nav-text); font-size: 14.5px; }
.group { display: flex; flex-direction: column; gap: 4px; }
.group > span { color: #FFFFFF; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 0 10px 4px; }
.group a { min-height: 46px; display: flex; align-items: center; padding: 0 12px; border-radius: 10px; color: var(--nav-text);
  text-decoration: none; font-weight: 600; font-size: 16.5px; }
.group a:hover { background: var(--nav-2); color: #fff; }
.group a.on { background: #fff; color: var(--nav); font-weight: 700; }
.sw span { color: var(--nav-text); } .sw select { border: 0; }
.who { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255, 255, 255, .14); display: flex; flex-direction: column; gap: 8px; }
.who span { color: var(--nav-text); font-size: 15px; overflow-wrap: anywhere; }
main { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 48px; max-width: none; width: 100%; }
main.solo { margin: 0 auto; }
.head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.head > div:first-child { flex: 1 1 320px; min-width: 0; }
.back { display: inline-block; padding: 4px 0 8px; font-weight: 600; text-decoration: none; font-size: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions.tight { gap: 6px; justify-content: flex-end; }

/* ---------- Nut ---------- */
.btn { min-height: 46px; padding: 0 18px; font-size: 16px; border-radius: 10px; border: 1.5px solid #B9C4D2; background: #fff; color: var(--ink);
  font-family: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 700; }
.btn.primary:hover { background: var(--blue-d); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 700; }
.btn.danger { border-color: #D9A070; color: var(--debt-d); } .btn.danger:hover { border-color: var(--debt); color: var(--debt-d); }
.btn.big { min-height: 52px; font-size: 17px; padding: 0 24px; }
.btn.sm { padding: 0 14px; }
.btn.link { border: 0; background: none; color: var(--blue); }
.btn.ghost-dark { background: transparent; border-color: rgba(255, 255, 255, .35); color: #fff; }
.btn.ghost-dark:hover { border-color: #fff; color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }
.btn:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #F2B705; outline-offset: 2px; }

/* ---------- The, o nhap ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 14px 0; box-shadow: var(--shadow); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; align-items: end; }
.cols > * { min-width: 0; }
.f { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 15.5px; color: #24364A; min-width: 0; }
.f > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f input[type=date] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; text-align: left; }
.f input::placeholder { color: #7A8898; font-weight: 400; }
.f.inline { flex-direction: row; align-items: center; gap: 8px; }
.f input, .f select, .inline select, .inline input { min-height: 46px; border: 1.5px solid #8A99AB; border-radius: 10px; padding: 0 12px;
  font: inherit; font-size: 16px; font-weight: 500; background: #fff; color: var(--ink); width: 100%; }
.f input:hover, .f select:hover { border-color: var(--blue); }
.inline { display: flex; gap: 6px; align-items: center; } .inline select, .inline input { width: auto; }
.f input.xl { min-height: 56px; font-size: 26px; font-weight: 700; text-align: center; border: 2px solid var(--blue); }
.f input[readonly] { background: #EEF1F5; color: var(--muted); }
.chk { display: flex; align-items: center; gap: 10px; min-height: 44px; } .chk input { width: 24px; height: 24px; accent-color: var(--blue); }
summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; color: var(--blue); }
details[open] > summary { margin-bottom: 10px; }
.banner { border: 1.5px solid var(--blue); background: var(--blue-l); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 16px; font-weight: 600; }
.banner.warn { border-color: var(--debt); background: var(--debt-l); color: var(--debt-d); }
.empty { border: 1.5px dashed #B6C0CC; border-radius: var(--radius); padding: 20px; color: var(--muted); text-align: center; background: #FAFBFC; }

/* Chon loai tai khoan */
.pick { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.pick legend { font-weight: 700; font-size: 15.5px; padding: 0 0 6px; }
.pick label { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid #B9C4D2; border-radius: 10px; cursor: pointer; }
.pick label:has(input:checked) { border-color: var(--blue); background: var(--blue-l); }
.pick input { width: 22px; height: 22px; margin-top: 3px; accent-color: var(--blue); }
.pick span { display: flex; flex-direction: column; } .pick small { color: var(--muted); font-size: 14.5px; }

/* ---------- So lieu, so do phong ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stats div { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.stats span { color: var(--muted); font-size: 14.5px; } .stats b { font-size: 24px; line-height: 1.3; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.tile { height: 86px; border-radius: var(--radius); border: 1.5px solid; display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; transition: transform .08s; }
.tile:hover { transform: translateY(-2px); }
.tile b { font-size: 25px; line-height: 1.1; } .tile span { font-size: 13.5px; font-weight: 600; }
.tile.ok, .tag.ok { background: var(--ok-l); border-color: var(--ok); color: var(--ok-d); }
.tile.debt, .tag.debt { background: var(--debt-l); border-color: var(--debt); color: var(--debt-d); }
.tile.wait, .tag.wait { background: var(--info-l); border-color: var(--info); color: var(--info-d); }
.tile.empty, .tag.empty { background: #fff; border: 1.5px solid #B6C0CC; color: var(--muted); padding: 0; }
.tag { font-style: normal; font-size: 13.5px; font-weight: 700; border: 1px solid; border-radius: 999px; padding: 3px 10px !important; white-space: nowrap; }

/* ---------- Danh sach, bang ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.row { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; color: inherit; text-decoration: none; }
a.row:hover { border-color: var(--blue); }
.tablebox { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tablebox.flat { border: 0; box-shadow: none; border-radius: 0; margin: 0 -20px -18px; }
.tb { width: 100%; border-collapse: collapse; font-size: 16.5px; }
.tb th { text-align: left; color: var(--muted); font-size: 13.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; white-space: nowrap; background: #F7F9FB; }
.tb th.r { text-align: right; }
.tb td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.tb tbody tr:hover { background: #FAFBFD; }
.block { padding-bottom: 18px; overflow: hidden; }
.block-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.block-head h2 { margin: 0; }
.lines { width: 100%; border-collapse: collapse; } .lines td { padding: 8px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.lines .muted { font-weight: 400; } .lines .sum td { font-size: 22px; font-weight: 700; border-bottom: 0; border-top: 2px solid var(--ink); }

/* ---------- Goi dich vu ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.plan { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.plan.on { border: 2px solid var(--blue); background: var(--blue-l); }
.plan-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-name { font-size: 22px; }
.price { font-size: 26px; font-weight: 700; color: var(--blue); } .price small { font-size: 15px; font-weight: 500; color: var(--muted); }
.plan ul { margin: 4px 0 0; padding-left: 20px; } .plan li { margin: 4px 0; }

/* ---------- Phieu thu ---------- */
.receipt { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; max-width: 520px; margin: 0 0 16px; box-shadow: var(--shadow); }
.receipt h3 { text-align: center; font-size: 21px; margin-bottom: 4px; letter-spacing: .02em; }
.rc-block { text-align: center; font-size: 16.5px; font-weight: 600; margin-bottom: 2px; }
.rc-room { text-align: center; font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; align-items: start; }
.sheet .receipt { max-width: none; margin: 0; }
.rc-top, .rc-sign { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rc-sign { margin-top: 14px; padding-bottom: 50px; }
.lines td.r { white-space: nowrap; vertical-align: top; padding-left: 12px; }
.lines .sum td { vertical-align: baseline; }
.rc-pay { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 14px; padding: 12px; border: 1.5px dashed #8A99AB; border-radius: 10px; font-size: 15.5px; }
.rc-pay img { width: 150px; height: 150px; image-rendering: pixelated; }

/* ---------- Dang nhap ---------- */
.auth { max-width: 460px; margin: 0 auto; padding: 40px 16px; }
.auth-brand { display: inline-block; background: var(--nav); color: #fff; font-weight: 700; padding: 6px 12px; border-radius: 8px; margin-bottom: 18px; font-size: 15px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 14px 20px; border-radius: 12px; font-weight: 600; max-width: 92vw; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }
.toast.show { opacity: 1; } .toast.err { background: #8A1C1C; }

/* ---------- Co gian theo man hinh ---------- */
.tabbar { display: none; }
/* Phan trang */
.pager { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin: 12px 0 4px; font-size: 15px; color: var(--muted); }
.pg-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pg { min-width: 42px; height: 42px; padding: 0 12px; border: 1.5px solid #C5CFDB; border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-size: 15.5px; font-weight: 600; cursor: pointer; }
.pg:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.pg.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.pg:disabled { opacity: .45; cursor: default; }
.pg-gap { padding: 0 4px; }
.pg-size { display: flex; align-items: center; gap: 8px; } .pg-size select { height: 42px; border: 1.5px solid #C5CFDB; border-radius: 10px; padding: 0 8px; font: inherit; background: #fff; }
/* Danh sach co nhom, lien ket ten */
.tb tr.grp td { background: var(--blue-l); color: var(--blue-d); font-weight: 700; font-size: 15px; padding: 8px 14px; }
a.name { font-weight: 700; color: var(--ink); text-decoration: none; } a.name:hover { color: var(--blue); text-decoration: underline; }
.row.big { padding: 16px 18px; } .chev { color: var(--blue); font-weight: 700; white-space: nowrap; }
.filters .actions { margin-top: 12px; }
.print-only { display: none; }
/* Lap phieu thang */
.brow { margin: 0; } .brow .cols { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.brow-head { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.brow-total { font-size: 19px; color: var(--muted); white-space: nowrap; }
.brow-total.ok { color: var(--blue-d); } .brow-total.err { color: #8A1C1C; font-size: 16px; white-space: normal; }
.savebar { position: sticky; bottom: 0; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 -4px 16px rgba(15, 30, 46, .10);
  padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.savebar .muted { font-weight: 600; color: var(--ink); }
.plan.on .price { color: var(--blue-d); }
.steps { margin: 0; padding-left: 22px; } .steps li { margin: 4px 0; }
.side .sw select { min-height: 46px; }
.f input[data-num="money"] { text-align: right; font-variant-numeric: tabular-nums; }
.f input.xl[data-num] { text-align: center; }

/* May tinh man hinh vua, may tinh bang ngang: menu hep lai */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 220px minmax(0, 1fr); }
  .side { padding: 16px 10px; }
  .group a { font-size: 16px; padding: 0 10px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

/* Dien thoai, may tinh bang doc: menu thanh thanh dieu huong duoi cung */
@media (max-width: 880px) {
  .layout { display: block; }
  .topbar { display: flex; flex-direction: column; background: var(--nav); color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 10; }
  .topbar strong { font-size: 18px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar span { font-size: 14px; }
  main { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
  h1 { font-size: 24px; }
  .head .actions, .head .actions .btn { width: 100%; }
  .card { padding: 16px; } .tablebox.flat { margin: 0 -16px -18px; }
  .row .actions.tight { width: 100%; justify-content: flex-start; }
  .cols { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -2px 12px rgba(15, 30, 46, .08); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a, .tabbar button { min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; padding: 6px 2px; }
  .tabbar .on { color: var(--blue); font-weight: 700; box-shadow: inset 0 3px 0 var(--blue); }

  /* Nut "Them": mo bang menu day du phia tren thanh dieu huong */
  .side { display: none; position: fixed; left: 0; right: 0; top: 0; bottom: calc(62px + env(safe-area-inset-bottom)); height: auto; z-index: 25; padding: 18px 16px; overflow-y: auto; }
  .side.open { display: flex; }
  .group a { min-height: 52px; font-size: 18px; }
  .toast { bottom: calc(78px + env(safe-area-inset-bottom)); }
  .savebar { bottom: calc(62px + env(safe-area-inset-bottom)); padding: 10px 12px; gap: 8px; } .savebar .muted { font-size: 14.5px; }
  .savebar .btn { width: 100%; min-height: 46px; font-size: 16px; }
  .brow .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #fbl { padding-bottom: 8px; }
}

/* ---------- In: giay A4, noi dung phieu nam gon trong khung A5 (148 x 210 mm) o goc tren ben trai ---------- */
@page { size: A4 portrait; margin: 0; }
@page wide { size: A4 landscape; margin: 0; }
.print-only { page: wide; }
@media print {
  html, body { background: #fff; margin: 0; }
  body { font-size: 11pt; line-height: 1.35; }
  .no-print, .toast, .tabbar, .topbar { display: none !important; }
  .print-only { display: block; margin: 10mm; } .print-only h2 { font-size: 13pt; margin: 0 0 4mm; text-align: center; }
  body:has(.print-only table) { }
  .layout { display: block; } main { padding: 0; max-width: none; width: auto; }

  .receipt { width: 148mm; height: 210mm; box-sizing: border-box; padding: 9mm 10mm; margin: 0; overflow: hidden;
    border: 0; border-right: 1px dashed #999; border-bottom: 1px dashed #999; border-radius: 0; box-shadow: none; max-width: none;
    break-inside: avoid; page-break-inside: avoid; }
  .receipt h3 { font-size: 15pt; margin-bottom: 1mm; }
  .rc-block { font-size: 11pt; margin-bottom: .5mm; }
  .rc-room { font-size: 14pt; margin-bottom: 3mm; }
  .receipt .muted { font-size: 9.5pt; color: #333; }
  .lines td { padding: 1.6mm 0; }
  .lines .sum td { font-size: 14pt; }
  .rc-pay { margin-top: 3mm; padding: 2.5mm; gap: 4mm; font-size: 9.5pt; border-color: #666; }
  .rc-pay img { width: 34mm; height: 34mm; }
  .rc-sign { margin-top: 4mm; padding-bottom: 14mm; }

  /* In hang loat: 4 phieu kho A6 (105 x 148 mm) tren mot to A4, xep 2 x 2 */
  .sheet { display: grid; grid-template-columns: 105mm 105mm; grid-template-rows: 148mm 148mm; gap: 0; margin: 0; width: 210mm; height: 296mm;
    break-after: page; page-break-after: always; break-inside: avoid; page-break-inside: avoid; }
  .sheet:last-child { break-after: auto; page-break-after: auto; }
  .sheet .receipt { width: 105mm; height: 148mm; padding: 5mm 6mm; font-size: 8pt; line-height: 1.3; }
  .sheet .receipt h3 { font-size: 11pt; margin-bottom: .5mm; }
  .sheet .rc-block { font-size: 8.5pt; margin-bottom: 0; }
  .sheet .rc-room { font-size: 10pt; margin-bottom: 1.5mm; }
  .sheet .receipt .muted { font-size: 7pt; }
  .sheet .receipt .nil { display: none; }
  .sheet .lines td { padding: .8mm 0; }
  .sheet .lines .sum td { font-size: 10.5pt; }
  .sheet .rc-pay { margin-top: 2mm; padding: 1.5mm; gap: 2.5mm; font-size: 7pt; flex-wrap: nowrap; }
  .sheet .rc-pay img { width: 24mm; height: 24mm; }
  .sheet .rc-sign { margin-top: 2mm; padding-bottom: 6mm; }

  /* Trang in khac (danh sach tam tru, bao cao): le 10 mm, dung ca kho A4 */
  main > .head, main > .tablebox, main > h2, main > .stats, main > p { margin-left: 10mm; margin-right: 10mm; }
  main > .head { margin-top: 10mm; }
  .tablebox { border: 0; box-shadow: none; overflow: visible; } .tb { font-size: 10pt; } .tb th { background: none; }
  .tb td, .tb th { border: 1px solid #000; padding: 1.5mm 2mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Quet CCCD */
.scanbtn { align-self: flex-start; }
.scan { position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 42, .72); display: grid; place-items: center; padding: 16px; }
.scan-in { background: #fff; border-radius: 16px; padding: 20px; width: min(460px, 100%); display: grid; gap: 14px; }
.scan-view { position: relative; aspect-ratio: 1; background: #000; border-radius: 12px; overflow: hidden; }
.scan-view[hidden] { display: none; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; }
.scan-view i { position: absolute; inset: 18%; border: 3px solid #fff; border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }
.scan-msg { margin: 0; color: var(--muted, #5b6472); }
@media print { .scan { display: none; } }
.gg { width: 100%; margin-top: 12px; }
.qr2fa { width: 220px; height: 220px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.narrow { max-width: 460px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }

/* Dieu khoan, bieu do quan tri */
.terms { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin: 12px 0 8px; }
.chart { margin: 0; padding: 14px 16px; }
.chart figcaption { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 6px; }
.chart figcaption span { color: var(--muted); font-size: 14px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { font-size: 12px; fill: var(--muted); font-family: inherit; }
.chart .bar { fill: var(--blue); } .chart .hit { fill: transparent; } .chart g:hover .hit { fill: rgba(35, 126, 73, .10); }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 3; } .chart .axis { stroke: #B9C4D2; }

/* ===== Khung trang moi: menu co bieu tuong, thanh tren co menu nguoi dung ===== */
.content { min-width: 0; display: flex; flex-direction: column; }
.brand { flex-direction: row; align-items: center; gap: 12px; }
.brand > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand strong { overflow-wrap: anywhere; }
.logo { flex: none; width: 44px; height: 44px; border-radius: 12px; background: #fff; color: var(--nav); display: grid; place-items: center; }
.group a { gap: 12px; }
.group a svg { flex: none; width: 22px; height: 22px; }
.topbar { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  margin: 16px clamp(16px, 3vw, 40px) 0; padding: 8px 12px; position: sticky; top: 12px; z-index: 12; }
.topbar .ttl { display: none; }
.icbtn { width: 46px; height: 46px; border: 0; background: none; border-radius: 10px; color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.icbtn:hover { background: var(--bg); }
.uwrap { position: relative; margin-left: auto; }
.ubtn { min-height: 46px; display: flex; align-items: center; gap: 10px; border: 0; background: none; border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; color: var(--ink); font: inherit; font-weight: 600; }
.ubtn:hover { background: var(--bg); }
.ubtn i { width: 38px; height: 38px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-style: normal; font-weight: 700; }
.ubtn span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.umenu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 30, 46, .18); padding: 8px; z-index: 40; }
.umenu[hidden] { display: none; }
.uinfo { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.uinfo span { color: var(--muted); font-size: 14.5px; overflow-wrap: anywhere; }
.umenu a, .umenu button { display: flex; align-items: center; width: 100%; min-height: 46px; padding: 0 10px; border: 0; background: none; border-radius: 8px; color: var(--ink); font: inherit; text-decoration: none; cursor: pointer; text-align: left; }
.umenu a:hover, .umenu button:hover { background: var(--bg); }
main { padding-top: 22px; }
.ph { display: flex; align-items: center; gap: 16px; }
.phi { flex: none; width: 60px; height: 60px; border-radius: 50%; background: var(--blue-l); color: var(--blue); display: grid; place-items: center; }
.phi svg { width: 30px; height: 30px; }
.ph h1 { margin: 0; }
.ph .muted { margin: 4px 0 0; }

/* Hop ky cam ket lan dau dang nhap */
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(15, 23, 42, .6); display: grid; place-items: center; padding: 16px; }
.modal-in { background: #fff; border-radius: 16px; width: min(720px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; gap: 12px; padding: 22px; }
.modal-in h2 { margin: 0; }
.modal-in > .muted { margin: 0; }
.modal-body, .termsbox { overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px 14px; background: var(--bg); }
.modal-body { flex: 1 1 auto; min-height: 120px; }
.termsbox { max-height: 420px; margin-top: 10px; }
.modal-body h3, .termsbox h3 { font-size: 17px; margin: 14px 0 8px; }

/* Xac thuc 2 buoc */
.twofa { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: center; max-width: 900px; }
.art2fa { width: 100%; height: auto; }
.charts.one { grid-template-columns: minmax(0, 1fr); }
.charts.one .chart { max-width: 900px; }

@media (min-width: 881px) {
  .layout.collapsed { grid-template-columns: minmax(0, 1fr); }
  .layout.collapsed .side { display: none; }
}
@media (max-width: 880px) {
  .topbar { flex-direction: row; margin: 0; border: 0; border-radius: 0; box-shadow: none; background: var(--nav); color: #fff; padding: 8px 12px 8px 16px; top: 0; }
  .topbar #sideBtn { display: none; }
  .topbar .ttl { display: block; flex: 1 1 auto; min-width: 0; }
  .ubtn { padding: 4px; } .ubtn span { display: none; }
  .ubtn i { background: #fff; color: var(--nav); }
  .ubtn:hover { background: none; }
  main { padding-top: 16px; }
  .phi { width: 48px; height: 48px; } .phi svg { width: 24px; height: 24px; }
  .twofa { grid-template-columns: minmax(0, 1fr); gap: 12px; } .art2fa { max-width: 150px; margin: 0 auto; }
  .modal { padding: 0; } .modal-in { border-radius: 0; width: 100%; height: 100%; max-height: none; padding: 16px; }
}
@media print { .modal { display: none !important; } }

/* So do phong: o phong co ten nguoi dung ten */
.grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.tile { height: auto; min-height: 100px; padding: 8px 6px; gap: 2px; text-align: center; }
.tile.empty { padding: 8px 6px; }
.tname { font-style: normal; font-size: 13.5px; font-weight: 600; line-height: 1.25; color: var(--ink); max-width: 100%;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* Trang phong: chi so dang nho, nut xo xuong */
.meters { display: flex; flex-wrap: wrap; gap: 6px 28px; font-size: 17px; }
summary { list-style: none; gap: 8px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: ""; width: 9px; height: 9px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg); margin: -4px 4px 0 auto; transition: transform .15s; }
details[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
details.dd > summary { border: 1.5px solid var(--blue); border-radius: 10px; padding: 0 14px; min-height: 46px; background: var(--blue-l); }
details.dd > summary:hover { background: #D7EBDF; }

/* Lap phieu: gon trong mot khung */
.billbox { max-width: 760px; display: flex; flex-direction: column; gap: 0; padding: 6px 18px 18px; }
.bsec { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.bsec > b { font-size: 16.5px; }
.bsec .muted { font-size: 14.5px; }
.billbox > .btn { margin-top: 16px; }
#preview.bsec { border-bottom: 0; padding-bottom: 0; }
.blockhd { margin: 14px 0 0; padding: 8px 14px; background: var(--blue-l); color: var(--nav-2, #1B663A); border-radius: 10px; font-size: 17px; display: flex; gap: 10px; align-items: baseline; }
.blockhd .muted { font-size: 14.5px; font-weight: 500; }
.blockhd { justify-content: space-between; align-items: center; flex-wrap: wrap; }
.blk[hidden] { display: none; }
.blk { gap: 12px; }

/* Anh cua day tro */
.blkh { position: relative; }
.blkname { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; border-bottom: 2px dotted var(--blue); }
.blkname svg { width: 20px; height: 20px; color: var(--blue); }
.blkpop { display: none; position: absolute; left: 0; top: calc(100% + 8px); z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 12px 32px rgba(15, 30, 46, .22); }
.blkpop img { display: block; width: min(420px, 78vw); max-height: 60vh; object-fit: cover; border-radius: 8px; }
.blkname:hover + .blkpop, .blkname:focus + .blkpop, .blkpop:hover { display: block; }
.bphoto { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.bphoto img { width: min(320px, 100%); border-radius: 10px; border: 1px solid var(--line); }
@media print { .blkpop { display: none !important; } }

/* Thiet bi do */
.code { display: block; margin-top: 6px; padding: 10px 12px; background: #0F1E2E; color: #E6F3EB; border-radius: 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; white-space: pre-wrap; word-break: break-all; }
.tokbox { border: 2px solid var(--blue); }
.devtag { font-style: normal; font-weight: 600; font-size: 12.5px; color: var(--blue); background: var(--blue-l); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }

/* O chon (dropdown) cao bang o nhap chu */
.f input, .f select, .inline select, .inline input { box-sizing: border-box; height: 46px; min-height: 46px; line-height: 1.2; }
.f input.xl { height: 56px; min-height: 56px; }
.cols:has(input.xl) select { height: 56px; min-height: 56px; }
.f select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2324364A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }

/* So do phong: chon thang, loc tinh trang */
.monthbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 14px 16px; }
.monthbar .f { min-width: 180px; flex: 0 1 220px; }
.monthbar .btn { height: 46px; }
.oldebt { font-style: normal; font-size: 12px; font-weight: 600; color: var(--debt-d); }
@media (max-width: 880px) { .monthbar .f { flex: 1 1 100%; } .monthbar .btn { flex: 1 1 40%; } }

/* "Chua thu": chu va so tien mau cam dam tren nen sang. "Chua lap phieu": giu mau xanh duong nhat. */
.tile.wait { background: #fff; border-color: #C2410C; color: var(--ink); }
.tile.wait b, .tile.wait .tname { color: var(--ink); }
.tile.wait span { color: #C2410C; font-weight: 700; }
.tag.wait { background: #FFF1E6; border-color: #C2410C; color: #C2410C; }
.tile.none { background: var(--info-l); border-color: var(--info); color: var(--info-d); }

/* ===== Man hinh dang nhap: khung nam giua man hinh ===== */
.authpage { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  padding: 28px 16px; background: linear-gradient(160deg, #E6F3EB 0%, #F4F7FA 55%, #E9F1F8 100%); }
.authcard { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 28px 26px; box-shadow: 0 18px 50px rgba(15, 30, 46, .12); display: grid; gap: 16px; }
.authlogo { display: flex; align-items: center; justify-content: center; gap: 12px; }
.authlogo .logo { background: var(--blue); color: #fff; width: 48px; height: 48px; border-radius: 14px; }
.authlogo strong { font-size: 21px; color: var(--nav); }
.authcard h1 { margin: 0; text-align: center; font-size: 26px; }
.authalt { text-align: center; color: var(--muted); }
.authalt .btn.link { font-weight: 700; padding: 0 4px; min-height: 0; }
.authplans { width: 100%; max-width: 760px; }
.authplans h2 { margin: 0 0 10px; text-align: center; font-size: 18px; }
.plancards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.plancard { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 6px; }
.plancard.free { border: 2px solid var(--blue); }
.plancard b { font-size: 17px; }
.pprice { font-weight: 700; color: var(--blue); font-size: 16.5px; }
.plancard ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14.5px; display: grid; gap: 2px; }
/* Trang kich hoat, dat lai mat khau: cung can giua */
body > .auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; }

/* O mat khau co nut con mat */
.pw { position: relative; display: block; }
.pw input { width: 100%; padding-right: 50px; }
.eye { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 44px; height: 42px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; border-radius: 8px; }
.eye:hover { color: var(--blue); background: var(--bg); }
.eye svg { width: 22px; height: 22px; }
@media (max-width: 480px) { .authcard { padding: 22px 18px; border-radius: 16px; } }
.f > span.pw { overflow: visible; white-space: normal; }

/* Bieu tuong thuong hieu */
.logo { background: none; padding: 0; overflow: hidden; }
.logo .brandmark { width: 100%; height: 100%; display: block; }
.authlogo .logo { background: none; width: 52px; height: 52px; border-radius: 14px; }
.side .logo { box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); border-radius: 12px; }

/* Tinh nang theo goi */
.btn.locked { color: var(--muted); border-style: dashed; gap: 8px; }
.btn.locked em { font-style: normal; font-size: 12.5px; font-weight: 700; color: #7A4B00; background: #FFE9B8; border-radius: 6px; padding: 1px 7px; white-space: nowrap; }
.upsell { max-width: 560px; }
.trialnote { text-align: center; margin: 12px 0 0; color: var(--ink); font-weight: 600; }

/* ===== Man che dang tai: giua man hinh ===== */
.loader { position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: rgba(244, 246, 249, .72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s ease, visibility 0s linear .2s; }
.loader.on { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .2s ease; cursor: progress; }
.loader.first { background: linear-gradient(160deg, #E6F3EB 0%, #F4F7FA 55%, #E9F1F8 100%); }
.ldbox { position: relative; width: 92px; height: 92px; display: grid; place-items: center; }
.ldring { position: absolute; inset: 0; border-radius: 50%; border: 4px solid rgba(35, 126, 73, .16); border-top-color: var(--blue); border-right-color: var(--blue); animation: ldspin .9s cubic-bezier(.55, .15, .45, .85) infinite; }
.ldmark { width: 52px; height: 52px; border-radius: 14px; box-shadow: 0 8px 22px rgba(35, 126, 73, .28); animation: ldpulse 1.8s ease-in-out infinite; }
.loader p { margin: 0; font-weight: 600; color: var(--nav); letter-spacing: .01em; }
.loader p i { display: inline-block; width: 5px; height: 5px; margin-left: 4px; border-radius: 50%; background: var(--blue); animation: lddot 1.2s ease-in-out infinite; }
.loader p i:nth-child(2) { animation-delay: .15s; } .loader p i:nth-child(3) { animation-delay: .3s; }
@keyframes ldspin { to { transform: rotate(360deg); } }
@keyframes ldpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(.92); } }
@keyframes lddot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .ldring { animation-duration: 2.4s; } .ldmark, .loader p i { animation: none; } }
@media print { .loader { display: none; } }

/* ===== Trang chon goi luc dang ky ===== */
.authplans { max-width: 940px; }
.authplans h1 { text-align: center; font-size: 26px; margin: 0 0 18px; }
.authpage .plancards { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; align-items: stretch; }
.authpage .plancard { position: relative; padding: 22px 20px 18px; border-radius: 18px; gap: 10px; grid-template-rows: auto auto 1fr auto auto; box-shadow: 0 10px 30px rgba(15, 30, 46, .08); }
.authpage .plancard.hot { border: 2px solid var(--blue); }
.hottag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 12.5px; font-weight: 700; color: #fff; background: var(--blue); border-radius: 999px; padding: 3px 12px; white-space: nowrap; }
.authpage .plancard b { font-size: 20px; }
.authpage .plancard .btn { width: 100%; margin-top: 6px; }
.authpage .plancard small { text-align: center; color: var(--muted); font-size: 13px; }
.pickplan { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; background: var(--blue-l); border-radius: 10px; padding: 8px 12px; font-weight: 600; color: var(--ok-d); }
.pickplan .btn.link { min-height: 0; padding: 0 4px; }
.authpage .plancard ul { align-content: start; }

/* So do phong: thanh chon thang, day, tinh trang ghim lai khi cuon */
.monthbar { position: sticky; top: 84px; z-index: 11; box-shadow: 0 6px 18px rgba(15, 30, 46, .10); }
@media (max-width: 880px) {
  .monthbar { top: 62px; margin: 0 -14px 14px; border-radius: 0; border-left: 0; border-right: 0; padding: 10px 14px; gap: 8px; }
  .monthbar .f { flex: 1 1 40%; min-width: 0; }
  .monthbar .f > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .monthbar .btn { flex: none; min-width: 46px; padding: 0 12px; font-size: 22px; }
  .monthbar .btn span { display: none; }
  .monthbar .btn.locked { font-size: inherit; }
}
@media print { .monthbar { position: static; } }
.monthbar .btn span { margin: 0 5px; }
@media (min-width: 881px) { .monthbar { padding: 10px 14px; } .monthbar .f { flex: 1 1 150px; min-width: 140px; max-width: 240px; } }

/* Chi ghim phan chon thang; loc day va tinh trang nam o thanh rieng, khong ghim */
.monthbar { width: fit-content; max-width: 100%; margin-bottom: 0; }
.filterbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 10px 14px; box-shadow: none; }
.filterbar .f { flex: 1 1 180px; min-width: 150px; max-width: 260px; }
@media (max-width: 880px) {
  .monthbar { width: auto; flex-wrap: nowrap; margin-bottom: 0; }
  .monthbar .f { flex: 1 1 auto; }
  .filterbar { gap: 8px; } .filterbar .f { flex: 1 1 40%; min-width: 0; max-width: none; }
}
@media (max-width: 880px) { .monthbar { max-width: none; } }

/* Bao hong, sua chua */
.issue { display: grid; gap: 8px; }
.issue p { margin: 0; }
.issue-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.issuebar { position: static; width: auto; box-shadow: var(--shadow); margin-bottom: 14px; }
/* Huong dan su dung */
.helpsec summary { font-weight: 700; font-size: 18px; cursor: pointer; }
.helpsec ol { margin: 12px 0 0; padding-left: 22px; display: grid; gap: 8px; }

/* Gia tra theo nam */
.yearnote { font-size: 14.5px; color: var(--ok-d); background: var(--blue-l); border-radius: 8px; padding: 6px 10px; }

/* Xoa, phuc hoi co so; yeu cau nang cap */
.rowline { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.plan .upg { margin-top: 4px; }
.paygrid { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.paygrid img { border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: #fff; }
