:root {
  --bg: #f1f5fb;
  --card: #ffffff;
  --line: #e3e8f0;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-soft: #e8f0ff;
  --green: #16a34a;
  --green-soft: #e8f8ee;
  --red: #dc2626;
  --red-soft: #fdecec;
  --orange: #ea7a12;
  --orange-soft: #fff4e5;
  --purple: #7c3aed;
  --yellow-soft: #fff6d6;
  --teal: #0f766e;
}

html { font-size: 15px; }
body { background: var(--bg); color: var(--text); font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }

/* ---------- Header ---------- */
.app-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1020; }
.app-header .inner { display: flex; align-items: center; gap: 12px; padding: 10px 18px; }
.brand { font-weight: 700; font-size: 1.15rem; white-space: nowrap; color: var(--text); }
.brand small { display: block; font-weight: 400; font-size: .75rem; color: var(--muted); }
.nav-pills-app { display: flex; gap: 8px; margin-left: auto; overflow-x: auto; scrollbar-width: thin; padding: 2px; }
.nav-pills-app a, .nav-pills-app button { background: #eef0f3; color: #222; border: 0; border-radius: 12px; padding: 9px 15px; white-space: nowrap; font-size: .93rem; transition: .15s; }
.nav-pills-app a:hover { background: #e2e6ec; }
.nav-pills-app a.active { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.35); }
.nav-pills-app .logout { background: var(--red); color: #fff; }
.nav-pills-app .logout:hover { background: #b91c1c; }
.prop-select { max-width: 220px; border-radius: 10px; }
.m-page { display: none; }
.tabbar, .more-sheet { display: none; }
main.container-app { padding: 18px; max-width: 1600px; margin: 0 auto; }
h1.page-title { font-size: 1.45rem; font-weight: 500; margin: 6px 0 16px; }

/* ---------- Cards ---------- */
.card-app { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; height: 100%; border-left: 4px solid var(--line); }
.kpi .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 1.15rem; flex: none; }
.kpi .lb { font-size: .8rem; color: var(--muted); }
.kpi .vl { font-size: 1.35rem; font-weight: 600; }
.kpi .sub { font-size: .8rem; font-weight: 600; color: var(--green); }
.kpi.red { border-left-color: var(--red); } .kpi.red .ic { background: var(--red-soft); }
.kpi.green { border-left-color: var(--green); } .kpi.green .ic { background: var(--green-soft); }
.kpi.orange { border-left-color: var(--orange); } .kpi.orange .ic { background: var(--orange-soft); }
.kpi.blue { border-left-color: #0ea5e9; } .kpi.blue .ic { background: #e0f2fe; }
.kpi.purple { border-left-color: var(--purple); } .kpi.purple .ic { background: #f1e9ff; }
.kpi.plain { border-left: 1px solid var(--line); display: block; }

.page-head { background: linear-gradient(90deg, #f5f9ff, #fff); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.page-head h2 { font-size: 1.3rem; margin: 0; }
.page-head .meta { color: var(--muted); font-size: .85rem; }
.page-head .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Period tabs ---------- */
.period-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: -1px; }
.period-tabs a { background: #eef1f6; border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; padding: 9px 26px; color: #333; }
.period-tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.period-tabs a .lock { font-size: .75rem; }

/* ---------- Buttons ---------- */
.btn { border-radius: 9px; }
.btn-purple { background: var(--purple); color: #fff; } .btn-purple:hover { background: #6d28d9; color: #fff; }
.btn-xs { padding: 3px 10px; font-size: .82rem; border-radius: 7px; }
.btn-big { padding: 12px 26px; font-size: 1.05rem; border-radius: 12px; }

/* ---------- Tables ---------- */
.table-app { width: 100%; background: #fff; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table-app th { background: #eaf1fb; font-weight: 600; font-size: .86rem; padding: 10px 8px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 2; }
.table-app th.sortable { cursor: pointer; user-select: none; }
.table-app th.sortable::after { content: " ⇅"; color: #9aa4b2; font-size: .75rem; }
.table-app td { padding: 8px; border-bottom: 1px solid #eef1f5; vertical-align: middle; font-size: .9rem; }
.table-app tr:last-child td { border-bottom: 0; }
.table-app tbody tr:hover td { background: #fafcff; }
.table-app tr.paid td { background: #f2fbf4; }
.table-app th.hl-yellow, .table-app td.hl-yellow { background: #fff7d9; }
.table-app th.hl-blue, .table-app td.hl-blue { background: #e7f3ff; }
.table-app td.total { font-weight: 700; border-left: 2px solid #f0b46b; border-right: 2px solid #f0b46b; white-space: nowrap; }
.table-wrap { overflow-x: auto; border-radius: 12px; } /* không giới hạn chiều cao: cả trang chỉ 1 thanh cuộn */
.table-app input.form-control, .table-app select.form-select { min-width: 90px; padding: 5px 8px; font-size: .9rem; text-align: right; border-radius: 8px; }
.table-app input.money { text-align: right; }
.table-app input.dirty { background: #fffbe6; border-color: #f59e0b; }
.table-app input.saved { background: #ecfdf3; border-color: #22c55e; }

.meter-input { width: 120px; margin: 0 auto; text-align: center !important; border: 2px solid #22c55e !important; border-radius: 10px !important; font-weight: 600; }
.meter-input.warn { border-color: #f59e0b !important; background: #fffbe6; }
.meter-input.err { border-color: var(--red) !important; background: var(--red-soft); }
.meter-prev { width: 120px; margin: 0 auto; background: #f3f4f6; border-radius: 10px; padding: 7px; color: #9aa0a8; text-align: center; }
.meter-note { font-size: .78rem; color: #b45309; margin-top: 3px; }
.meter-note.err { color: var(--red); }

/* ---------- Badges ---------- */
.badge-soft { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: .78rem; font-weight: 600; }
.badge-paid { background: var(--green-soft); color: var(--green); }
.badge-issued { background: var(--primary-soft); color: var(--primary); }
.badge-draft { background: #f3f4f6; color: #4b5563; }
.badge-overdue { background: var(--red-soft); color: var(--red); }
.badge-partial { background: var(--orange-soft); color: var(--orange); }
.badge-cancel { background: #f3f4f6; color: #9ca3af; text-decoration: line-through; }
.tag-main { background: #e0f2fe; color: #0369a1; border-radius: 6px; padding: 1px 7px; font-size: .75rem; }
.tag-sub { background: #e0f2fe; color: #0369a1; border-radius: 6px; padding: 1px 7px; font-size: .75rem; }
.role-main { color: var(--green); } .role-sub { color: #c2410c; }

.st-select { border-radius: 999px !important; font-weight: 600; text-align: left !important; min-width: 150px; }
.st-vacant { background: #f3f4f6 !important; color: #374151; }
.st-occupied { background: #e8f8ee !important; color: #15803d; }
.st-reserved { background: #e8f0ff !important; color: #1d4ed8; }
.st-cleaning { background: #fff4e5 !important; color: #c2410c; }
.st-maint { background: #fdecec !important; color: #b91c1c; }
.st-locked { background: #e5e7eb !important; color: #6b7280; }

/* ---------- Room map / cards ---------- */
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.room-tile { border-radius: 12px; padding: 12px; border: 1px solid var(--line); cursor: pointer; min-height: 92px; transition: .15s; color: inherit; display: block; }
.room-tile:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.room-tile .code { font-size: 1.15rem; font-weight: 700; }
.room-tile .who { font-size: .82rem; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.info-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; height: 100%; }
.info-box .lb { font-size: .78rem; color: var(--muted); }
.info-box .vl { font-weight: 600; word-break: break-word; }
.member-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fff; height: 100%; }
.member-card.primary { border-color: #93c5fd; box-shadow: 0 0 0 2px #dbeafe; }
.masked { filter: blur(0); letter-spacing: 1px; color: #6b7280; }

/* ---------- Forms ---------- */
.form-label { font-size: .86rem; margin-bottom: 3px; }
.form-control, .form-select { border-radius: 9px; }
.hl-input { background: #fff6c8 !important; border: 2px solid #f0a35b !important; box-shadow: 0 0 0 4px #fff1e0; }
.hint-red { color: #b42318; font-style: italic; font-weight: 600; font-size: .9rem; }

/* ---------- Toast ---------- */
#toastBox { position: fixed; right: 16px; bottom: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; max-width: 92vw; }
.toast-app { background: #111827; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.2); font-size: .92rem; animation: tin .2s; max-width: 420px; }
.toast-app.ok { background: #15803d; } .toast-app.err { background: #b91c1c; } .toast-app.warn { background: #b45309; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.empty-state { text-align: center; color: var(--muted); padding: 36px 10px; }
.loading { opacity: .55; pointer-events: none; }

/* ---------- Printable invoice (A5) ---------- */
.print-toolbar { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 12px; position: sticky; top: 0; background: #e5e7eb; z-index: 5; }
.print-body { background: #e5e7eb; min-height: 100vh; }
.invoice-sheet { background: #fff; width: 148mm; min-height: 200mm; margin: 12px auto; padding: 9mm 10mm; box-shadow: 0 2px 10px rgba(0,0,0,.12); color: #111; font-size: 12.5px; }
.invoice-sheet .ih { display: flex; gap: 14px; align-items: center; border-bottom: 2px solid var(--teal); padding-bottom: 8px; margin-bottom: 10px; }
.invoice-sheet .ih img { width: 64px; height: 64px; object-fit: contain; }
.invoice-sheet .logo-fallback { width: 64px; height: 64px; border-radius: 12px; background: #e6f4f1; display: grid; place-items: center; font-size: 28px; }
.invoice-sheet h3 { color: var(--teal); font-weight: 800; font-size: 20px; margin: 0; letter-spacing: .3px; }
.invoice-sheet .sub { font-size: 14px; }
.invoice-sheet .cust { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; flex-wrap: wrap; gap: 6px; }
.invoice-sheet table { width: 100%; border-collapse: collapse; }
.invoice-sheet th, .invoice-sheet td { border: 1px solid #222; padding: 5px 7px; }
.invoice-sheet th { background: #eef5ff; text-align: center; }
.invoice-sheet td.r { text-align: right; white-space: nowrap; }
.invoice-sheet td.c { text-align: center; }
.invoice-sheet .tot td { color: #c62828; font-size: 16px; font-weight: 600; }
.bank-box { margin-top: 10px; background: #fff7d6; border: 1.5px solid #f2c94c; border-radius: 10px; padding: 8px 10px; display: flex; gap: 10px; align-items: center; }
.bank-box .lines { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.bank-box .ln { background: #fff; border: 1px dashed #f2c94c; border-radius: 7px; padding: 3px 8px; font-size: 12px; }
.bank-box .ln b { color: #8a4b0f; }
.bank-box h4 { color: #ea7a12; text-align: center; font-size: 15px; margin: 0 0 6px; font-weight: 700; }
.bank-box .qr { text-align: center; font-size: 11px; }
.bank-box .qr img { width: 120px; height: 120px; background: #fff; border-radius: 8px; padding: 4px; }
.sheet-note { text-align: center; color: #b42318; font-style: italic; font-weight: 600; margin-top: 8px; }
.id-card-img { width: 100%; max-width: 330px; border-radius: 10px; border: 1px solid #ddd; }

@media print {
  @page { size: A5 portrait; margin: 5mm; }
  body, .print-body { background: #fff !important; }
  .no-print, .print-toolbar, .app-header, #toastBox { display: none !important; }
  .invoice-sheet { box-shadow: none; margin: 0 auto; width: auto; min-height: auto; padding: 0; page-break-after: always; }
  .invoice-sheet:last-child { page-break-after: auto; }
  .bank-box, .table-app th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  main.container-app { padding: 0; }
}
.print-a4 { }
@media print { .print-a4 { } body.a4 @page { size: A4; } }

/* ---------- Mobile: tables → cards ---------- */
@media (max-width: 991.98px) {
  main.container-app { padding: 10px; }
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 6px 10px; background: #fff; }
  .table-cards td { border: 0 !important; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 0; text-align: right; }
  .table-cards td::before { content: attr(data-label); font-weight: 600; color: var(--muted); font-size: .82rem; text-align: left; }
  .table-cards td.total { border: 0 !important; }
  .table-app.table-cards { border: 0; background: transparent; }
  .meter-input, .meter-prev { width: 110px; margin: 0; }
  .invoice-sheet { width: 100% !important; max-width: 100%; padding: 12px; overflow-wrap: anywhere; }
  .invoice-sheet img { max-width: 100%; height: auto; }
  .btn-big { width: 100%; }
}

/* Bảng rộng: không xuống dòng tên / badge, cuộn ngang trong khung */
.badge-soft { white-space: nowrap; }
@media (min-width: 768px) { #invTable td, #invTable th { white-space: nowrap; } #invTable input.form-control { min-width: 96px; } }


/* =====================================================================
   ĐIỆN THOẠI (≤ 991px): 1 thanh cuộn duy nhất, điều hướng bằng ngón cái
   ===================================================================== */
@media (max-width: 991.98px) {
  :root { --tabbar-h: 62px; }
  html { font-size: 16px; }
  body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px); }

  /* Đầu trang gọn 1 dòng: tên cơ sở + tên trang */
  .app-header .inner { padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top)); gap: 8px; flex-wrap: nowrap; }
  .brand { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .brand small { display: none; }
  .m-page { display: block; margin-left: auto; color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }

  /* Thanh điều hướng đáy */
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; background: rgba(255,255,255,.97); backdrop-filter: blur(8px);
            border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(0,0,0,.06); }
  .tabbar a, .tabbar button { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
            height: 54px; border: 0; background: none; color: #4b5563; font-size: .72rem; border-radius: 12px; padding: 0 2px; white-space: nowrap; }
  .tabbar .ti { font-size: 1.35rem; line-height: 1.2; filter: grayscale(.6); }
  .tabbar a.active, .tabbar button.active { color: var(--primary); font-weight: 600; background: var(--primary-soft); }
  .tabbar a.active .ti, .tabbar button.active .ti { filter: none; }

  /* Ngăn "Thêm" trượt từ dưới lên */
  .more-sheet { display: flex; height: auto !important; max-height: 85vh; border-radius: 20px 20px 0 0; }
  .more-sheet .offcanvas-body { padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); }
  .sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: #d1d5db; margin: 10px auto 6px; flex: none; }
  .sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .sheet-grid a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 84px; border-radius: 14px;
            background: #f3f5f9; color: var(--text); font-size: .9rem; text-align: center; padding: 6px; }
  .sheet-grid a .ti { font-size: 1.6rem; }
  .sheet-grid a.active { background: var(--primary); color: #fff; }

  /* Nội dung */
  main.container-app { padding: 10px 12px; }
  h1.page-title { font-size: 1.25rem; margin: 2px 0 12px; }
  .card-app { padding: 14px; border-radius: 16px; margin-bottom: 12px; }
  .page-head { padding: 12px; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions > * { flex: 1 1 auto; }

  /* Ô nhập ≥ 16px: iPhone không tự phóng to khi chạm; nút/ô cao ≥ 44px dễ bấm */
  .form-control, .form-select, .form-control-sm, .form-select-sm { font-size: 16px !important; min-height: 44px; }
  .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
  .btn-sm, .btn-xs { min-height: 38px; padding-left: 12px; padding-right: 12px; font-size: .9rem; }
  .form-check-input { width: 1.4em; height: 1.4em; }
  .table-app input.form-control, .table-app select.form-select { font-size: 16px !important; }

  /* Tab kỳ (tháng): 1 hàng chia đều, không cuộn ngang */
  .period-tabs { flex-wrap: wrap; gap: 6px; }
  .period-tabs a { flex: 1 1 22%; text-align: center; padding: 10px 4px; border-radius: 10px; border-bottom: 1px solid var(--line); font-size: .9rem; }
  .period-tabs + .card-app, .period-tabs + div { border-top-left-radius: 16px; }

  /* Không có khung cuộn ngang/dọc riêng */
  .table-wrap, .table-responsive { overflow: visible !important; max-height: none !important; }
  .table-cards td[data-label="STT"] { display: none !important; }
  .table-cards tr { padding: 8px 12px; border-radius: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
  .table-cards td { min-height: 36px; }
  .table-cards td:first-child { font-weight: 600; }

  /* Bảng thường không chuyển thẻ: chữ nhỏ lại, cho xuống dòng để vừa màn hình */
  .table-app:not(.table-cards) { table-layout: auto; }
  .table-app:not(.table-cards) th, .table-app:not(.table-cards) td { white-space: normal; padding: 6px 4px; font-size: .82rem; word-break: break-word; }
  table.table:not(.table-cards) td, table.table:not(.table-cards) th { white-space: normal; word-break: break-word; }

  /* Lịch đặt phòng nhà nghỉ: mỗi phòng 1 thẻ, chỉ hiện ngày có khách */
  .cal-cards td.cal-empty { display: none !important; }

  /* Nút lưu chính luôn nằm ngay trên thanh đáy */
  .m-sticky-action { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 6px); z-index: 1010; }
  .m-sticky-action.btn, .m-sticky-action .btn { box-shadow: 0 6px 18px rgba(0,0,0,.18); }

  #toastBox { left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); }
  .toast-app { max-width: none; }
  .modal-dialog { margin: .5rem; }
}
@media print { .tabbar, .more-sheet { display: none !important; } body.has-tabbar { padding-bottom: 0; } }
@media (max-width: 991.98px) {
  .kpi { padding: 12px; gap: 10px; }
  .kpi .vl { font-size: 1.12rem; white-space: nowrap; }
  .kpi .ic { width: 32px; height: 32px; font-size: 1rem; }
}
@media (min-width: 992px) {
  .nav-pills-app { flex-wrap: wrap; justify-content: flex-end; overflow: visible; }
  .nav-pills-app a, .nav-pills-app button { padding: 8px 12px; }
  .inv-actions { flex-wrap: nowrap !important; }
}
.d-contents { display: contents; }
/* SaaS: thông tin chuyển khoản + header quản trị */
.pay-rows { background: #fff7d6; border: 1.5px solid #f2c94c; border-radius: 12px; padding: 6px 12px; }
.pay-rows > div { gap: 10px; border-bottom: 1px dashed #f2c94c; min-height: 44px; }
.pay-rows > div:last-child { border-bottom: 0; }
.pay-rows b { word-break: break-all; }
.app-header.saas .brand, .app-header.saas .m-page { color: #fff; }
.app-header.saas .nav-pills-app a { color: #e2e8f0; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15); }
.app-header.saas .nav-pills-app a.active { color: #fff; background: var(--primary); }
.app-header.saas .nav-pills-app a:not(.active):hover { background: rgba(255,255,255,.16); }
/* Nhà nghỉ: cả ô phòng bấm được */
.room-tile.tile-link { cursor: pointer; transition: transform .1s, box-shadow .1s; }
.room-tile.tile-link:hover { box-shadow: 0 4px 14px rgba(15,23,42,.12); }
.room-tile.tile-link:active { transform: scale(.98); }
.room-tile.tile-link:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
/* Cấu hình dịch vụ: nút xóa mức giá đủ lớn để chạm */
.rate-del { min-height: 32px; min-width: 32px; text-decoration: none; }

/* Hóa đơn: bảng gọn (điện/nước gộp, thao tác trong menu ⋯) + ghim cột Phòng / Thao tác khi màn hình hẹp */
.meter-cell { text-align: center; line-height: 1.25; white-space: nowrap; }
.meter-cell .idx { display: block; font-size: .78rem; color: var(--muted); }
.act-more { min-width: 34px; font-weight: 700; letter-spacing: 1px; }
@media (min-width: 992px) {
  #invTable { overflow: visible; }
  #invTable .col-room, #invTable .col-act { position: sticky; z-index: 1; background: #fff; }
  #invTable th.col-room, #invTable th.col-act { z-index: 3; background: #eaf1fb; }
  #invTable .col-room { left: 0; box-shadow: 1px 0 0 var(--line); }
  #invTable .col-act { right: 0; box-shadow: -1px 0 0 var(--line); }
  #invTable tr.paid td.col-room, #invTable tr.paid td.col-act { background: #f2fbf4; }
}
@media (max-width: 991.98px) {
  #invTable .meter-cell { text-align: right; }
  #invTable .meter-cell .idx { display: inline; margin-right: 6px; }
}
@media (min-width: 992px) { #invTable td.col-cust { min-width: 110px; max-width: 150px; white-space: normal; } }
/* Ô đang mở menu ⋯ nổi trên các ô ghim của dòng dưới */
#invTable td.col-act.menu-open { z-index: 6; }
/* jquery-confirm: hộp thoại xác nhận / nhập liệu thống nhất, dễ bấm trên điện thoại */
.jconfirm .jconfirm-box { border-radius: 16px !important; padding: 18px 18px 12px !important; font-family: inherit; }
.jconfirm .jconfirm-box .jconfirm-title-c .jconfirm-title { font-size: 1.15rem !important; font-weight: 700; }
.jconfirm .jconfirm-box div.jconfirm-content { font-size: .98rem; color: #334155; overflow-wrap: anywhere; }
.jconfirm .jconfirm-box .jconfirm-buttons { display: flex; gap: 8px; float: none !important; padding-top: 8px; }
.jconfirm .jconfirm-box .jconfirm-buttons button { flex: 1; min-height: 44px; margin: 0 !important; border-radius: 10px !important; font-size: 1rem !important; text-transform: none !important; font-weight: 600 !important; }
.jconfirm .jconfirm-box .jconfirm-buttons button.btn-default { background: #eef1f6 !important; color: #334155 !important; }
.jconfirm .jc-input { font-size: 16px; }
.jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-title-c { padding-bottom: 6px; }
/* Hóa đơn: ô tick "Tất cả đã thu" */
.js-paid-all { width: 1.15em; height: 1.15em; cursor: pointer; }
.paid-all-m { min-height: 44px; font-weight: 600; white-space: nowrap; }
/* Loại phòng (dưới mã phòng) */
.room-type { font-size: .75rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.room-tile .room-type { opacity: .8; margin: -2px auto 2px; }
/* Cấu hình: danh sách khu nhà / tầng / loại phòng có Sửa · Xóa */
.struct-list { list-style: none; padding: 0; margin: 0 0 8px; }
.struct-list li { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.struct-list li form { margin: 0; }
.struct-list .sl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.struct-list .sl-sub { font-size: .78rem; color: var(--muted); }
.struct-list .btn { min-height: 32px; }
/* Hóa đơn: bộ lọc khu / tầng / phòng / trạng thái */
.inv-filters .form-select { width: auto; min-width: 0; max-width: 200px; flex: 0 1 auto; }
@media (max-width: 991.98px) { .inv-filters .form-select { flex: 1 1 calc(50% - 8px); max-width: none; } }
/* Màn khóa khi hết hạn gói dịch vụ: popup bắt buộc trên nền phần mềm bị làm mờ */
.lock-body { margin: 0; min-height: 100vh; background: #e9eef6; overflow: hidden; }
.lock-bg { position: fixed; inset: 0; padding: 16px; filter: blur(6px); opacity: .7; pointer-events: none; }
.lock-bg .lb-head { display: flex; gap: 10px; align-items: center; background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.lock-bg .lb-head span { width: 160px; height: 18px; border-radius: 6px; background: #2563eb; }
.lock-bg .lb-head i { width: 70px; height: 26px; border-radius: 13px; background: #e2e8f0; }
.lock-bg .lb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; }
.lock-bg .lb-kpi { height: 86px; border-radius: 12px; background: linear-gradient(135deg, #fff, #dbeafe); }
.lock-bg .lb-table { background: #fff; border-radius: 12px; padding: 10px; }
.lock-bg .lb-row { display: grid; grid-template-columns: 1fr 2fr 1fr 1fr; gap: 12px; padding: 10px 4px; border-bottom: 1px solid #eef2f7; }
.lock-bg .lb-row i { height: 12px; border-radius: 6px; background: #e2e8f0; }
.lock-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(15, 23, 42, .55); display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto; }
.lock-dialog { background: #fff; border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.35); width: 100%; max-width: 520px; padding: 24px 20px;
  margin: auto; max-height: none; }
.lock-dialog .card-app { box-shadow: none; border: 0; padding: 0; margin: 0; }
.lock-icon { font-size: 52px; line-height: 1; margin-bottom: 6px; }
.lock-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.lock-plan { display: flex; flex-direction: column; align-items: center; padding: 12px 8px; min-height: 84px; border-width: 2px; }
/* Nhà nghỉ: giá đang áp dụng trên từng ô phòng */
.room-price { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: .78rem; margin: 2px 0 4px; color: #334155; }
.room-price small { opacity: .75; margin-left: 1px; }
.room-price.own { color: #9a3412; font-weight: 600; }
.room-price .price-edit { text-decoration: none; line-height: 1; min-height: 24px; }
/* Hướng dẫn: lưới video YouTube (ảnh thumbnail 16:9 + nút phát) */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.guide-card { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 4px rgba(15,23,42,.08); display: flex; flex-direction: column; }
.guide-card.off { opacity: .6; }
.guide-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #0f172a; border: 0; padding: 0; width: 100%; cursor: pointer; }
.guide-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.guide-thumb .play { position: absolute; inset: 0; margin: auto; width: 64px; height: 44px; border-radius: 12px; background: rgba(220, 38, 38, .92);
  display: grid; place-items: center; transition: transform .15s; }
.guide-thumb .play::after { content: ""; border-left: 18px solid #fff; border-top: 11px solid transparent; border-bottom: 11px solid transparent; margin-left: 4px; }
.guide-thumb:hover .play, .guide-thumb:focus-visible .play { transform: scale(1.1); }
.guide-body { padding: 10px 12px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.guide-body h3 { font-size: 1rem; font-weight: 700; margin: 0; line-height: 1.3; }
.guide-body p { font-size: .85rem; color: var(--muted); margin: 0; white-space: pre-line; }
.video-frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
