:root {
  color-scheme: light;
  --bg: #f3f6f6;
  --card: #ffffff;
  --line: #e3e8ef;
  --line-2: #eef1f6;
  --ink: #16202e;
  --ink-2: #5b6778;
  --ink-3: #8a95a5;
  --brand: #0e7c6b;
  --brand-2: #0a5f52;
  --brand-soft: #e2f4f0;
  --side: #0d2b29;
  --side-ink: #b8cfcb;
  --ok: #0f7b3f;
  --ok-soft: #e3f5ea;
  --warn: #9a5b00;
  --warn-soft: #fff3d9;
  --bad: #c62828;
  --bad-soft: #fdeaea;
  --gray-soft: #eef1f5;
  --violet: #5b3fd0;
  --violet-soft: #efebff;
  --series-1: #257de0;
  --series-2: #f47230;
  --series-3: #00b894;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 14.5px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 21px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14.5px; font-weight: 650; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.boot { padding: 40px; text-align: center; color: var(--ink-2); }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ------------------------------------------------ nút, ô nhập */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap;
  text-decoration: none !important;
}
.btn:hover { background: #f7f9fc; border-color: #cfd7e3; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); border-color: #f0c4c4; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--gray-soft); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn .i { width: 16px; height: 16px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid #d3dbe6; border-radius: 8px;
  padding: 7px 10px; min-height: 36px; width: 100%;
}
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox] { width: 17px; height: 17px; min-height: 0; padding: 0; accent-color: var(--brand); vertical-align: -3px; }
input[disabled], select[disabled] { background: #f4f6f9; color: var(--ink-2); }
label.f, div.f { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); font-weight: 550; }
label.f > span em, div.f > span em { font-style: normal; color: var(--ink-3); font-weight: 400; }
label.chk { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.span2 { grid-column: span 2; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.stack { display: grid; gap: 14px; }

/* ------------------------------------------------ khung trang */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-ink); padding: 14px 10px; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 14px; color: #fff; }
.brand img { width: 34px; height: 34px; }
.brand b { display: block; font-size: 14px; line-height: 1.2; }
.brand small { color: var(--side-ink); font-size: 11.5px; }
.nav a {
  display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--side-ink);
  text-decoration: none; font-weight: 500;
}
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.on { background: var(--brand); color: #fff; }
.nav .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #6f9590; padding: 12px 10px 4px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 10px 22px; background: rgba(243, 246, 246, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
}
.top .menu { display: none; }
.me-chip { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; color: var(--ink); }
.me-chip .av { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.me-chip small { display: block; color: var(--ink-2); font-size: 11.5px; line-height: 1.1; }
.me-chip b { display: block; font-size: 13px; line-height: 1.2; font-weight: 600; text-align: left; }
.pop { position: absolute; right: 22px; top: 54px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 30, 54, .15); padding: 6px; min-width: 200px; z-index: 30; }
.pop button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 8px 10px; border: 0; background: none; font: inherit; color: var(--ink); border-radius: 6px; cursor: pointer; text-align: left; }
.pop button:hover { background: var(--gray-soft); }
#view { padding: 20px 22px 60px; max-width: 1280px; width: 100%; }
.head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.head h1 { margin-right: auto; }
.head.tight h1 { margin-right: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 13px; margin-bottom: 6px; }

/* ------------------------------------------------ thẻ, bảng */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .ch { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.card > .ch h2 { margin-right: auto; }
.card > .cb { padding: 14px 16px; }
.card + .card { margin-top: 16px; }
.cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.cols > div > .card + .card { margin-top: 16px; }
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.go { cursor: pointer; }
table.t tr.go:hover td { background: #f4faf8; }
table.t td.r, table.t th.r { text-align: right; }
table.t .sub { color: var(--ink-2); font-size: 12.5px; }
table.t tfoot td { font-weight: 600; background: #fafbfd; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-2); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.filters input[type=search] { max-width: 280px; }
.filters select { width: auto; min-width: 150px; }
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 9px 14px; color: var(--ink-2); font-weight: 550; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.chip.on { background: var(--brand-soft); border-color: #a9dccf; color: var(--brand-2); font-weight: 600; }

/* trạng thái */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--gray-soft); color: var(--ink-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-dat, .b-moi, .b-ban { background: var(--warn-soft); color: var(--warn); }
.b-nhan, .b-dang_don { background: var(--brand-soft); color: var(--brand-2); }
.b-tra, .b-xong, .b-sach { background: var(--ok-soft); color: var(--ok); }
.b-huy, .b-vang { background: var(--gray-soft); color: var(--ink-3); }
.b-hong, .b-low { background: var(--bad-soft); color: var(--bad); }
.b-info { background: var(--violet-soft); color: var(--violet); }
.debt { color: var(--bad); font-weight: 600; }
.okc { color: var(--ok); font-weight: 600; }

/* ô số liệu */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile .k { color: var(--ink-2); font-size: 12.5px; font-weight: 550; }
.tile .v { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile .s { color: var(--ink-3); font-size: 12px; }
.tile.hero { grid-column: span 2; }
.tile.hero .v { font-size: 34px; }
a.tile { color: inherit; text-decoration: none; }
a.tile:hover { border-color: #a9dccf; }

/* danh sách gọn */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 16px; border-bottom: 1px solid var(--line-2); display: flex; gap: 10px; align-items: flex-start; }
.list li:last-child { border-bottom: 0; }
.list li .grow { flex: 1; min-width: 0; }

/* thông tin dạng lưới */
dl.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--ink-2); font-size: 13px; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 24px; justify-content: end; padding: 12px 16px; border-top: 1px solid var(--line-2); max-width: 380px; margin-left: auto; }
.totals .big { font-size: 18px; font-weight: 700; }

/* ô chọn có gợi ý */
.pick { position: relative; }
.pick .drop {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 12px 30px rgba(15, 30, 54, .14); max-height: 320px; overflow-y: auto; z-index: 15;
}
.pick .drop button { display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line-2); background: none; font: inherit; color: var(--ink); cursor: pointer; }
.pick .drop button:hover, .pick .drop button.hl { background: var(--brand-soft); }
.pick .drop button .grow { flex: 1; min-width: 0; }
.pick .drop .none { padding: 10px 12px; color: var(--ink-2); }
.lines input { min-height: 32px; padding: 4px 8px; }
.lines .qty { width: 72px; text-align: right; }
.lines .price { width: 130px; text-align: right; }
.sel-cust { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid #c4e5dc; background: #f4fbf9; border-radius: 10px; }
.sel-cust .grow { flex: 1; }

/* biểu đồ cột */
.chart { position: relative; padding: 8px 4px 0 52px; }
.chart svg { display: block; width: 100%; height: 240px; overflow: visible; }
.chart .grid line { stroke: #e7ebf1; stroke-width: 1; shape-rendering: crispEdges; }
.chart .ax { fill: var(--ink-2); font-size: 11px; }
.chart .bar { fill: var(--series-1); pointer-events: none; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar.on { fill: #1b64be; }
.chart .peak { fill: var(--ink); font-size: 11.5px; font-weight: 600; }
.tip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(15, 30, 54, .15); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; white-space: nowrap; transform: translate(-50%, -100%); z-index: 5; }
.tip b { display: block; }

/* phân quyền */
table.perm th.role { text-align: center; text-transform: none; letter-spacing: 0; font-size: 12.5px; min-width: 104px; vertical-align: bottom; }
table.perm td.c { text-align: center; }
table.perm tr.grp td { background: #f6f8fb; font-weight: 650; font-size: 12.5px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
table.perm td.lbl { min-width: 260px; }
table.perm td.lbl small { display: block; color: var(--ink-3); font-size: 11.5px; }
table.perm .dirty { background: #fffbe8; }

/* hộp thoại */
dialog#dlg { border: 0; padding: 0; border-radius: 14px; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 30px 80px rgba(15, 30, 54, .35); }
dialog#dlg.wide { width: min(900px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(15, 30, 54, .45); }
.dh { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.dh h2 { margin-right: auto; }
.db { padding: 16px 18px; display: grid; gap: 12px; }
.df { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fafbfd; position: sticky; bottom: 0; }
.err { color: var(--bad); background: var(--bad-soft); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; }
.err:empty { display: none; }
.note { background: var(--brand-soft); color: #134a41; border-radius: 8px; padding: 10px 12px; font-size: 13.5px; }

#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; }
#toast div { background: #12302d; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-size: 14px; animation: tin .2s ease; }
#toast div.bad { background: var(--bad); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* đăng nhập */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; grid-template-columns: minmax(0, 1fr); background: linear-gradient(160deg, #0d2b29 0%, #12564c 60%, #0e7c6b 140%); }
.login .card { width: min(400px, 100%); padding: 26px; justify-self: center; }
.login .logo { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.login .logo img { width: 44px; height: 44px; }
.login form { display: grid; gap: 12px; }

/* tổng quan: lưới 2 cột, cột ngang, thanh chia phần */
.dash { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.dash > div > * + * { margin-top: 16px; }
.dash .two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash .two > .card { margin: 0; }
.head .chips { margin-left: auto; }
.tiles.kpi { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.tile .s .up { color: var(--ok); font-weight: 600; }
.tile .s .down { color: var(--bad); font-weight: 600; }
.hb { display: grid; gap: 10px; }
.hb-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr; gap: 10px; align-items: center; font-size: 13px; }
.hb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.hb-track { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hb-bar { height: 14px; background: var(--series-1); border-radius: 0 4px 4px 0; flex: none; }
.hb-row:hover .hb-bar { background: #1b64be; }
.hb-val { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12.5px; }
.seg { display: flex; gap: 2px; height: 28px; }
.seg span { border-radius: 4px; min-width: 3px; }
.legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.legend li { display: flex; gap: 8px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .grow { flex: 1; }
.todo li { align-items: center; }
.todo a { color: var(--ink); }
.todo .cnt { min-width: 30px; text-align: center; padding: 1px 8px; border-radius: 999px; background: var(--gray-soft); color: var(--ink-3); font-size: 13px; }
.todo .cnt.has { background: var(--brand-soft); color: var(--brand-2); }
.tip.fixed { position: fixed; z-index: 90; }
@media (max-width: 960px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .dash .two { grid-template-columns: 1fr; }
  .head .chips { margin-left: 0; }
}

/* ------------------------------------------------ in phiếu */
#print { display: none; }
@media print {
  body > *:not(#print) { display: none !important; }
  #print { display: block; color: #000; font-size: 12.5pt; }
  #print table { width: 100%; border-collapse: collapse; margin: 10px 0; }
  #print th, #print td { border: 1px solid #999; padding: 5px 7px; vertical-align: top; }
  #print th { background: #eee; }
  #print .r { text-align: right; }
  #print .hd { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #000; padding-bottom: 8px; }
  #print h1 { text-align: center; margin: 16px 0 4px; font-size: 18pt; }
  #print .sig { display: grid; grid-template-columns: 1fr 1fr; text-align: center; margin-top: 26px; min-height: 110px; }
  @page { margin: 14mm; }
}

/* ------------------------------------------------ điện thoại */
@media (max-width: 960px) {
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  .shell.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(15, 30, 54, .45); }
  .top { padding: 8px 12px; }
  .top .menu { display: inline-flex; }
  .me-chip small, .me-chip b { display: none; }
  #view { padding: 14px 12px 70px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .hide-sm { display: none; }
  .tile.hero { grid-column: auto; }
  .tile.hero .v { font-size: 28px; }
  dl.kv { grid-template-columns: 110px 1fr; }
  .filters input[type=search], .filters select { max-width: none; flex: 1 1 140px; }
  .jobs { grid-template-columns: 1fr; }
  h1 { font-size: 19px; }
  .pop { right: 12px; }
}

/* ================================================ phần riêng của quản lý lưu trú */
.banner { padding: 9px 22px; font-size: 13.5px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner.warn { background: var(--warn-soft); color: #6d4100; }
.banner.bad { background: var(--bad-soft); color: #8a1c1c; }
.login .tabs { margin: -4px 0 14px; }
.login .tabs a { cursor: pointer; }
.hint { font-size: 12.5px; color: var(--ink-3); }
.kbd { font-variant-numeric: tabular-nums; font-weight: 600; }

/* sơ đồ phòng hôm nay */
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.room {
  position: relative; display: grid; gap: 3px; align-content: start; min-height: 104px; padding: 10px 12px 10px 15px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none !important; cursor: pointer; overflow: hidden;
}
.room::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--ok); }
.room:hover { border-color: #a9dccf; }
.room .nm { font-size: 18px; font-weight: 750; line-height: 1.1; }
.room .ty { font-size: 12px; color: var(--ink-3); }
.room .st { font-size: 12.5px; font-weight: 650; margin-top: 4px; }
.room .gs { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room .mn { font-size: 12px; color: var(--ink-2); }
.room.occ::before { background: var(--brand); }
.room.occ .st { color: var(--brand-2); }
.room.arr::before { background: #d48806; }
.room.arr .st { color: var(--warn); }
.room.leave::before { background: var(--violet); }
.room.leave .st { color: var(--violet); }
.room.dirty .hks { color: var(--warn); }
.room.broken::before { background: var(--bad); }
.room.broken .hks { color: var(--bad); }
.room .hks { font-size: 12px; font-weight: 600; color: var(--ok); }
.room.free .st { color: var(--ok); }
.legend-row { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); margin: 0 0 10px; }
.legend-row i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* lịch phòng (timeline) */
.cal-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.cal-bar input[type=date] { width: auto; }
.cal-wrap { overflow: auto; max-height: calc(100vh - 210px); position: relative; overscroll-behavior: contain; }
.cal { --rw: 92px; --cw: 62px; position: relative; width: calc(var(--rw) + var(--n) * var(--cw)); user-select: none; -webkit-user-select: none; }
.cal .r { display: grid; grid-template-columns: var(--rw) repeat(var(--n), var(--cw)); position: relative; min-height: 46px; }
.cal .r > div { border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.cal .rh { position: sticky; left: 0; z-index: 3; background: #fff; padding: 6px 10px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line) !important; }
.cal .rh b { font-size: 14px; line-height: 1.15; }
.cal .rh small { color: var(--ink-3); font-size: 11px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .rh .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 5px; vertical-align: 2px; background: var(--ok); }
.cal .rh .dot.ban, .cal .rh .dot.dang_don { background: #d48806; }
.cal .rh .dot.hong { background: var(--bad); }
.cal .hd { position: sticky; top: 0; z-index: 5; background: #fafbfc; min-height: 44px; }
.cal .hd > div { text-align: center; font-size: 11.5px; color: var(--ink-2); padding: 4px 0; line-height: 1.25; }
.cal .hd > div b { display: block; font-size: 14px; color: var(--ink); }
.cal .hd .rh { z-index: 6; background: #fafbfc; font-size: 12px; font-weight: 600; }
.cal .we { background: #fbf8f1; }
.cal .hd .we { background: #f7f0e1; }
.cal .td { background: #eef8f5; }
.cal .hd .td { background: var(--brand); }
.cal .hd .td, .cal .hd .td b { color: #fff; }
.cal .c { cursor: cell; }
.cal .c:hover { background: #e9f5f2; }
.cal .grp > div { background: #f6f8f8; min-height: 0; padding: 3px 10px; font-size: 11.5px; font-weight: 650; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.cal .grp { min-height: 0; }
.cal .grp .rh { background: #f6f8f8; white-space: nowrap; overflow: visible; }
.cal .ft > div { font-size: 12px; text-align: center; color: var(--ink-2); padding: 6px 0; background: #fafbfc; }
.cal .ft .rh { font-weight: 600; color: var(--ink-2); font-size: 11.5px; }
.cal .ft .full { color: var(--bad); font-weight: 700; }
.bk {
  position: absolute; top: 6px; height: calc(100% - 12px); z-index: 2; border-radius: 6px; padding: 3px 8px; overflow: hidden;
  font-size: 12px; line-height: 1.25; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; box-shadow: 0 0 0 2px #fff;
  background: #fff3d9; color: #6d4100; border: 1px solid #f0cf8a; display: flex; flex-direction: column; justify-content: center;
}
.bk b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.bk small { opacity: .8; font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.bk.nhan { background: var(--brand); color: #fff; border-color: var(--brand-2); }
.bk.tra { background: #eef1f2; color: var(--ink-2); border-color: #d9dfe1; }
.bk.debt::after { content: ""; position: absolute; right: 5px; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px #fff; }
.bk.cl { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.bk.cr { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.bk.drag { opacity: .85; z-index: 8; box-shadow: 0 8px 24px rgba(13, 43, 41, .3); cursor: grabbing; }
.bk.bad-drop { outline: 2px solid var(--bad); }
.bk .rz { position: absolute; right: 0; top: 0; bottom: 0; width: 9px; cursor: ew-resize; }
@media (hover: none) { .bk .rz { display: none; } }

/* đặt phòng mới */
.bform { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.bform .sum { position: sticky; top: 70px; }
.rlist { display: grid; gap: 0; }
.rlist label { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.rlist label:last-child { border-bottom: 0; }
.rlist label.off { opacity: .55; cursor: not-allowed; }
.rlist label.on { background: #f2faf8; }
.rlist .rn { font-weight: 650; }
.rlist .rs { font-size: 12px; color: var(--ink-2); }
.rlist .rp { text-align: right; }
.rlist .rp input { width: 130px; text-align: right; min-height: 32px; padding: 4px 8px; }
.rlist .gh { padding: 6px 16px; background: #f6f8f8; font-size: 11.5px; font-weight: 650; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line-2); }
.nights { display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; min-height: 36px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-2); font-weight: 650; white-space: nowrap; }

/* chi tiết đặt phòng */
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.paybox { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 12px 16px; }
.paybox .big { font-size: 20px; font-weight: 750; }
.paybox .due { color: var(--bad); }
.paybox .over { color: var(--ok); }
.occ-list li .tag { font-size: 11.5px; }
.qrbox { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: center; }
.qrbox .qr { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.qrbox .qr svg, .qrbox .qr img { display: block; width: 100%; height: auto; }
.qrbox dl.kv { grid-template-columns: 96px 1fr; }
.methods { display: flex; flex-wrap: wrap; gap: 6px; }
.methods label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 13.5px; }
.methods input { width: 15px; height: 15px; }
.methods label:has(input:checked) { background: var(--brand-soft); border-color: #a9dccf; color: var(--brand-2); font-weight: 600; }
.svc-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.svc-pick button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.svc-pick button small { display: block; color: var(--ink-3); font-size: 11.5px; }
.svc-pick button.on { border-color: var(--brand); background: var(--brand-soft); }
.gblock { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 10px; background: #fcfdfd; }
.gblock .gh { display: flex; align-items: center; gap: 8px; }
.gblock .gh b { margin-right: auto; }

/* buồng phòng */
.hk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.hk { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 8px; box-shadow: var(--shadow); }
.hk .top2 { display: flex; align-items: center; gap: 8px; }
.hk .top2 b { font-size: 18px; margin-right: auto; }
.hk .info { font-size: 12.5px; color: var(--ink-2); display: grid; gap: 2px; }
.hk .info .warn { color: var(--warn); font-weight: 600; }
.hk .acts2 { display: flex; flex-wrap: wrap; gap: 6px; border-top: 1px solid var(--line-2); padding-top: 9px; }
.hk.mine { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.thumb { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); flex: none; }

/* quét CCCD */
dialog#scan { border: 0; padding: 0; border-radius: 14px; width: min(480px, calc(100vw - 16px)); background: #000; color: #fff; }
dialog#scan::backdrop { background: rgba(0, 0, 0, .7); }
#scan .vid { position: relative; aspect-ratio: 3 / 4; max-height: 70vh; background: #111; overflow: hidden; }
#scan video { width: 100%; height: 100%; object-fit: cover; display: block; }
#scan .frame { position: absolute; inset: 18% 14%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
#scan .bar2 { display: flex; gap: 8px; padding: 10px; align-items: center; flex-wrap: wrap; }
#scan .bar2 p { flex: 1 1 100%; font-size: 13px; color: #d7e4e2; margin: 0; }
#scan .btn { background: #fff; }

/* thanh toán công khai */
.paypage { max-width: 460px; margin: 0 auto; padding: 20px 14px 40px; }
.ppqr svg { display: block; width: 100%; height: auto; }

/* in phiếu */
@media print {
  #print .muted { color: #444; }
  #print .tot td { font-weight: 700; }
}

@media (max-width: 960px) {
  .bform { grid-template-columns: 1fr; }
  .bform .sum { position: static; }
}
@media (max-width: 860px) {
  .banner { padding: 8px 12px; }
  .cal { --rw: 70px; --cw: 50px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 10px 12px; }
  .tile .v { font-size: 19px; white-space: normal; }
  .head { gap: 8px; }
  .cal-wrap { max-height: calc(100vh - 190px); }
  .rooms { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .room { min-height: 96px; padding: 8px 10px 8px 13px; }
  .qrbox { grid-template-columns: 1fr; justify-items: center; }
  .qrbox .qr { width: 220px; }
  .hk-grid { grid-template-columns: 1fr; }
  .acts .btn { flex: 1 1 auto; }
}
@media (max-width: 420px) {
  .login { padding: 14px; }
  .login .card { padding: 20px 18px; }
  .login .tabs a { padding: 9px 10px; }
}

/* ------------------------------------------------ giai đoạn 2: bán phòng, kho, sổ thuế */
.chtag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 650; color: var(--c); white-space: nowrap; }
.chtag::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.alerts .al { align-items: center; }
.alerts .ali { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--warn-soft); color: var(--warn); }
.alerts .al-trung .ali, .alerts .al-huy .ali { background: var(--bad-soft); color: var(--bad); }
.alerts .al-moi .ali { background: var(--brand-soft); color: var(--brand-2); }
.alerts .ali .i { width: 16px; height: 16px; }
.alerts .row { flex-wrap: wrap; justify-content: flex-end; }
.roomfeeds { flex-direction: column; gap: 6px !important; }
.rf-h { display: flex; align-items: center; gap: 8px; width: 100%; flex-wrap: wrap; }
.feed { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 0 4px 10px; border-left: 2px solid var(--line); }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.note.warn { background: var(--warn-soft); color: #6d4100; }
.note.ok { background: var(--ok-soft); color: #0b5a2e; display: flex; gap: 8px; align-items: center; }
.note .i, .banner .i { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.banner .btn { margin-left: auto; }
/* chữ dài: chữ chiếm phần giữa, biểu tượng và nút giữ nguyên một hàng (điện thoại thì nút xuống dòng) */
.banner > span { flex: 1 1 320px; min-width: 0; }
.guide ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.guide code, .zapp code { background: var(--gray-soft); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; word-break: break-all; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details summary { cursor: pointer; }
.bk.ota { background: repeating-linear-gradient(135deg, #fff 0 6px, color-mix(in srgb, var(--c) 14%, #fff) 6px 12px); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 45%, #fff); cursor: pointer; }
.bk.ota.clash { top: auto; bottom: 3px; height: 17px; z-index: 3; padding: 0 6px; font-size: 11px; color: var(--bad); border: 1.5px solid var(--bad); background: repeating-linear-gradient(135deg, #fff 0 5px, #ffe1e1 5px 10px); }
.ota-sw { background: repeating-linear-gradient(135deg, #fff 0 3px, #ffd3dc 3px 6px) !important; border: 1px solid #ff9fb2; }
.webqr { width: 180px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.webqr svg { display: block; width: 100%; height: auto; }
.thumb.ph { display: grid; place-items: center; background: var(--gray-soft); color: var(--ink-3); }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.ph-item { position: relative; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--gray-soft); }
.ph-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-item .btn { position: absolute; right: 4px; top: 4px; padding: 4px 6px; }
.ph-item.add { display: grid; place-items: center; align-content: center; gap: 4px; color: var(--ink-2); cursor: pointer; border-style: dashed; font-size: 13px; }
.sub-h { font-size: 15px; margin-top: 6px; }
.zev { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.zcfg { margin-top: 8px; }
.zmap { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.zmap input { flex: 1 1 40%; min-width: 0; }
.zmap select { flex: 1 1 50%; min-width: 0; }
.zt { margin-bottom: 12px; }
.zt textarea { margin-top: 6px; width: 100%; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; margin-bottom: 16px; }
.pos .card { margin: 0; }
.pos .sum { position: sticky; top: 74px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.pos-item { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 12px 10px; font: inherit; text-align: left; cursor: pointer; display: grid; gap: 2px; min-height: 76px; }
.pos-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.pos-item:active { transform: scale(.98); }
.pos-item .num { color: var(--brand-2); font-weight: 600; }
.pos-item small { font-size: 12px; }
.pos-item.other { place-items: center; align-content: center; color: var(--ink-2); border-style: dashed; }
.cart-row { display: grid; grid-template-columns: auto auto 1fr; gap: 4px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.cart-row > .grow { grid-column: 1 / -1; font-weight: 600; }
.cart-row > b.num { justify-self: end; }
.cart-row .qty { display: inline-flex; align-items: center; gap: 4px; }
.cart-row .qty b { min-width: 22px; text-align: center; }
.taxst { border-left: 4px solid var(--ok); }
.taxst.warn { border-left-color: #d48806; }
.taxst.bad { border-left-color: var(--bad); }
.taxst p { margin: 8px 0 0; }
.meter { position: relative; height: 12px; border-radius: 999px; background: var(--gray-soft); margin: 12px 0 2px; overflow: visible; }
.meter span { display: block; height: 100%; border-radius: 999px; background: var(--ok); }
.taxst.warn .meter span { background: #d48806; }
.taxst.bad .meter span { background: var(--bad); }
.meter i { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 1px; }
.meter-l { position: relative; height: 18px; }
.meter-l span { position: absolute; transform: translateX(-50%); }
.meter-l span:first-child { transform: none; }
.t tr.grp td { background: var(--line-2); }
@media (max-width: 960px) {
  .pos { grid-template-columns: 1fr; }
  .pos .sum { position: static; }
}

/* ------------------------------------------------ giai đoạn 3: nhiều cơ sở, nhân sự, khóa cửa, hóa đơn */
button.brand.sw { border: 0; background: none; font: inherit; text-align: left; cursor: pointer; border-radius: 10px; width: 100%; padding: 6px 8px 10px; margin-bottom: 4px; }
button.brand.sw:hover { background: rgba(255, 255, 255, .07); }
button.brand.sw > div { flex: 1; min-width: 0; }
button.brand.sw b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.brand.sw .i { color: var(--side-ink); flex: none; }
.props-pop { left: 10px; right: auto; top: 62px; width: 216px; }
.props-pop button span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.props-pop button.on { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }
.props-pop hr { border: 0; border-top: 1px solid var(--line-2); margin: 4px 0; }
.spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 28px; width: 84px; }
.spark span { flex: 1; background: var(--series-1); border-radius: 2px 2px 0 0; min-height: 2px; }
.spark span.cur { opacity: .45; }
.spark span:hover { background: var(--brand-2); opacity: 1; }
.occbar { height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; margin: 4px 0 2px; }
.occbar span { display: block; height: 100%; background: var(--series-1); border-radius: 999px; }
.punch { padding: 18px 12px; border: 1px dashed var(--line); border-radius: 12px; }
.punch.on { border: 1px solid #a9dccf; background: var(--brand-soft); }
.punch .big { font-size: 34px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.btn.xl { font-size: 17px; padding: 14px 22px; min-height: 54px; justify-content: center; width: 100%; }
table.roster th.today, table.roster td.today { background: #f2faf8; }
table.roster td.cell { cursor: pointer; min-width: 96px; }
table.roster td.cell:hover, table.roster td.cell:focus { background: var(--brand-soft); outline: none; }
.who { display: inline-block; font-size: 12.5px; padding: 2px 7px; margin: 0 4px 4px 0; border-radius: 999px; background: var(--gray-soft); }
.who.done { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }
.picklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 14px; }
.list.compact li { padding: 7px 0; }
.doorcode { font-size: 24px; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
table.slip td { padding: 7px 4px; }
table.slip tr.sum td { border-top: 1px solid var(--line); background: #fafbfd; }
table.slip .big { font-size: 18px; }
@media (max-width: 720px) {
  .btn.xl { font-size: 16px; }
  table.roster td.cell { min-width: 84px; }
}
