/* ProHome — giao diện */
:root {
  --brand: #0e6e5c; --brand-dark: #0a4f42; --brand-2: #e6f4f0; --brand-3: #c9e9e0;
  --ink: #1d2b36; --muted: #6b7a86; --line: #e6ebef; --bg: #f3f6f8;
  --green: #12925f; --green-bg: #e3f6ec; --red: #d43d3d; --red-bg: #fde8e8;
  --amber: #c27a06; --amber-bg: #fff4dc; --blue: #2864c7; --blue-bg: #e7efff;
  --radius: 14px; --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --bs-body-font-family: "Segoe UI", "Inter", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-link-color: var(--brand); --bs-link-hover-color: var(--brand-dark);
  --bs-link-color-rgb: 14, 110, 92;
}
body { background: var(--bg); color: var(--ink); font-size: .94rem; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.bg-brand { background: var(--brand) !important; }

/* ---------- layout: sidebar + content */
.sidebar { --w: 248px; }
@media (min-width: 992px) {
  .has-sidebar .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--w); z-index: 1030; visibility: visible !important; transform: none !important; }
  .has-sidebar .main { margin-left: 248px; }
}
.sidebar, .sidebar.offcanvas-lg { background: linear-gradient(180deg, #0c5a4c 0%, #083f35 100%); color: #d9efe9; border: 0 !important; }
.sidebar-inner { display: flex; flex-direction: column; height: 100%; padding: 18px 14px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 1.15rem; margin: 2px 6px 18px; }
.brand:hover { color: #fff; text-decoration: none; }
.brand small { display: block; font-size: .72rem; opacity: .7; font-weight: 400; margin-top: -2px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: #f6c453; color: #0a4f42; font-size: 1.2rem; flex: none; }
.side-section { font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; opacity: .55; margin: 14px 10px 6px; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: #d9efe9; font-weight: 500; margin-bottom: 2px; }
.side-link i { font-size: 1.08rem; opacity: .9; }
.side-link:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.side-link.active { background: #fff; color: var(--brand-dark); box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.side-link.active i { color: var(--brand); }
.side-badge { margin-left: auto; font-size: .7rem; padding: 2px 7px; border-radius: 999px; font-weight: 700; }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 10px 4px; border-top: 1px solid rgba(255, 255, 255, .12); color: #fff; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #f6c453; color: #0a4f42; display: grid; place-items: center; font-weight: 800; flex: none; }
.icon-btn { background: transparent; border: 0; color: #cfe7e0; font-size: 1.1rem; padding: 4px; border-radius: 8px; }
.icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.min-w-0 { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: #0c5a4c; }
.topbar .brand { margin: 0; font-size: 1.05rem; }
.topbar .brand-mark { width: 30px; height: 30px; font-size: 1rem; }
.main-inner { padding: 22px 26px 40px; max-width: 1680px; margin: 0 auto; }
@media (max-width: 575px) { .main-inner { padding: 14px 12px 30px; } }
.auth-page .main-inner { max-width: none; }
.auth-page { min-height: 100vh; background: radial-gradient(1200px 600px at 20% -10%, #cfeee5 0%, transparent 60%) no-repeat fixed, var(--bg); }
.auth-page .main-inner { margin: 0 auto; }

/* ---------- typography & headings */
.page-title { font-size: 1.45rem; font-weight: 750; margin: 0; letter-spacing: -.01em; }
.page-sub { color: var(--muted); font-size: .9rem; }
.section-title { font-weight: 700; font-size: 1rem; margin: 6px 0 10px; }

/* ---------- cards */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .card-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card-header { background: #fff; font-weight: 650; border-bottom: 1px solid var(--line); padding: .7rem 1rem; }
.card > .table:last-child, .card > .table-responsive:last-child > .table, .card > div:last-child > .table:last-child { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); overflow: hidden; }
.card.border-primary { border-color: var(--brand-3) !important; }
.card.border-danger { border-color: #f3c0c0 !important; }
.card.border-warning { border-color: #f5d79b !important; }

/* stat tiles: .card.p-2 > .stat-label + .stat  (used across pages) */
.stat-label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat { font-size: 1.55rem; font-weight: 750; line-height: 1.15; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.card.p-2 { padding: .85rem 1rem !important; }

/* KPI tiles with icon and colour */
.kpi { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); height: 100%; color: inherit; }
a.kpi:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(16, 24, 40, .08); transition: .15s; }
.kpi-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; flex: none; }
.kpi-label { color: var(--muted); font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 1.5rem; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .8rem; color: var(--muted); }
.kpi-green .kpi-icon { background: var(--green-bg); color: var(--green); } .kpi-green .kpi-value { color: var(--green); }
.kpi-red .kpi-icon { background: var(--red-bg); color: var(--red); } .kpi-red .kpi-value { color: var(--red); }
.kpi-amber .kpi-icon { background: var(--amber-bg); color: var(--amber); } .kpi-amber .kpi-value { color: var(--amber); }
.kpi-blue .kpi-icon { background: var(--blue-bg); color: var(--blue); } .kpi-blue .kpi-value { color: var(--blue); }
.kpi-brand .kpi-icon { background: var(--brand-2); color: var(--brand); }
.kpi-hero { background: linear-gradient(135deg, #0e6e5c 0%, #0a4f42 100%); color: #fff; border: 0; }
.kpi-hero .kpi-label, .kpi-hero .kpi-sub { color: rgba(255, 255, 255, .78); }
.kpi-hero .kpi-icon { background: rgba(255, 255, 255, .16); color: #fff; }
.kpi-hero .kpi-value { color: #fff; font-size: 1.85rem; }
.kpi.kpi-alert { border-color: #f3c0c0; background: linear-gradient(180deg, #fff 0%, #fff7f7 100%); }

/* to-do tiles on the dashboard */
.todo { display: block; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); height: 100%; }
.todo:hover { text-decoration: none; border-color: var(--brand-3); box-shadow: var(--shadow); }
.todo .n { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.todo .t { font-weight: 650; }
.todo .s { font-size: .8rem; color: var(--muted); }
.todo.hot { border-color: #f3c0c0; background: #fff6f6; } .todo.hot .n { color: var(--red); }
.todo.warm { border-color: #f5d79b; background: #fffaf0; } .todo.warm .n { color: var(--amber); }
.todo.calm .n { color: var(--green); }

/* ---------- buttons, pills, tabs, badges */
.btn { border-radius: 9px; font-weight: 550; }
.btn-sm { border-radius: 8px; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: #083f35; --bs-btn-active-border-color: #083f35; --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: #b8ddd3; --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand); }
.btn-success { --bs-btn-bg: var(--green); --bs-btn-border-color: var(--green); }
.nav-pills { gap: 6px !important; }
.nav-pills .nav-link { color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .38rem 1rem; font-weight: 550; }
.nav-pills .nav-link:hover { border-color: var(--brand-3); }
.nav-pills .nav-link.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 6px rgba(14, 110, 92, .25); }
.nav-tabs { border-bottom: 2px solid var(--line); gap: 4px; }
.nav-tabs .nav-link { border: 0; color: var(--muted); font-weight: 600; padding: .55rem .9rem; margin-bottom: -2px; border-bottom: 2px solid transparent; border-radius: 0; }
.nav-tabs .nav-link:hover { color: var(--brand); }
.nav-tabs .nav-link.active { color: var(--brand); background: transparent; border-bottom-color: var(--brand); }
.badge { font-weight: 600; border-radius: 6px; }
.text-bg-success { background-color: var(--green) !important; }
.text-bg-danger { background-color: var(--red) !important; }
.form-control, .form-select { border-radius: 9px; border-color: #d7dee3; }
.form-control:focus, .form-select:focus { border-color: #7cc4b3; box-shadow: 0 0 0 .2rem rgba(14, 110, 92, .12); }
.form-label { font-weight: 600; font-size: .85rem; color: #3b4a55; margin-bottom: .3rem; }
.alert { border-radius: 12px; border-width: 1px; }
.alert-warning { border-left: 4px solid #f0b43c; }
.alert-danger { border-left: 4px solid var(--red); }
.alert-info { border-left: 4px solid #3aa6d8; }
.alert-success { border-left: 4px solid var(--green); }
.modal-content { border-radius: 16px; border: 0; }

/* ---------- tables */
.table { --bs-table-bg: #fff; margin-bottom: 0; }
.table thead th { background: #f6f8f9; color: #4f5d68; font-weight: 650; white-space: nowrap; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); }
.table td { border-color: #eef1f3; }
.table-hover tbody tr:hover > * { background: #f7fbfa; }
.table tfoot td, .table tfoot th { background: #fafbfb; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-responsive { border-radius: var(--radius); }

/* ---------- room map */
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.room-cell { min-height: 96px; border-radius: 12px; padding: 8px 10px; border: 1px solid #d5dde2; background: #fff; color: inherit; display: block; font-size: .8rem; position: relative; transition: .12s; }
.room-cell:hover { box-shadow: 0 6px 14px rgba(16, 24, 40, .1); transform: translateY(-1px); color: inherit; text-decoration: none; }
.room-cell .code { font-weight: 800; font-size: 1.05rem; }
.room-occupied { background: #ecf8f2; border-color: #9fd6bb; }
.room-empty { background: #fff8e6; border-color: #f0cf7b; }
.room-maintenance { background: #fdeceb; border-color: #eba8a4; }
.room-unbuilt { background: #f1f3f5; border-color: #dde2e6; color: #9aa7b1; }
.room-leaving { background: #fff1de; border-color: #f0a04b; }
.room-expiring { outline: 2px dashed #e65100; outline-offset: -3px; }
.room-cell .badge { font-size: .66rem; }
.legend span { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 4px; border: 1px solid #c5ced5; }

/* ---------- Thu tiền */
.bill-grid input { min-width: 70px; text-align: right; padding: .2rem .4rem; border-radius: 7px; }
.bill-grid td, .bill-grid th { vertical-align: middle; padding: .32rem .45rem; }
.bill-grid input[name$="_new"] { background: #fffdf3; border-color: #ecd9a0; }
tr.st-paid td:first-child { border-left: 4px solid var(--green); }
tr.st-partial td:first-child { border-left: 4px solid #f0b43c; }
tr.st-unpaid td:first-child { border-left: 4px solid var(--red); }
tr.st-carried td:first-child { border-left: 4px solid #9e9e9e; }
.sticky-bottom.bg-body { background: rgba(243, 246, 248, .96) !important; backdrop-filter: blur(4px); border-top: 1px solid var(--line); }
.year-grid th, .year-grid td { font-size: .8rem; padding: .25rem .3rem; }
.year-grid .sticky-col { position: sticky; left: 0; background: #fff; z-index: 1; }
.year-grid .now { background: #eaf1ff !important; }
.year-grid .cell { min-width: 74px; }
.yb { display: block; border-radius: 6px; padding: 1px 5px; margin: 1px 0; color: #212529; white-space: nowrap; }
.yb:hover { text-decoration: none; filter: brightness(.96); }
.yb small { font-size: .7rem; }
.yb.st-ok { background: #d8f1e4; }
.yb.st-late { background: #fff1cc; }
.yb.st-no { background: #fbdcdc; color: #8a1f1f; font-weight: 650; }
.yb.st-carry { background: #e7e9eb; color: #6c757d; }
.yb.st-wait { background: #fff; border: 1px solid #d5dbe0; }

/* ---------- misc */
.receipt-thumb { max-width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.cccd-img { max-width: 100%; max-height: 220px; border-radius: 10px; border: 1px solid var(--line); }
.empty-state { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty-state i { font-size: 2rem; display: block; margin-bottom: 6px; opacity: .6; }
.big-money { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
tr.row-hero td { background: var(--brand-2) !important; font-weight: 750; font-size: 1.02rem; }
tr.row-fund td { background: #fff7e0 !important; font-weight: 750; font-size: 1.02rem; color: #7a4f00; }
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .has-sidebar .main { margin-left: 0; }
  body { background: #fff; }
}
.money-md { font-size: clamp(.95rem, 1.2vw, 1.2rem); }
@media (max-width: 991.98px) { .sidebar.offcanvas-lg { --bs-offcanvas-width: 280px; } }

/* grid in its own scroll box: the horizontal scrollbar stays on screen, header and room column stay put */
.grid-scroll { overflow: auto; max-height: calc(100vh - 150px); border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.grid-scroll .bill-grid { border-collapse: separate; border-spacing: 0; }
.grid-scroll thead th { position: sticky; top: 0; z-index: 3; background: #f3f6f8; box-shadow: inset 0 -1px 0 var(--line); }
.grid-scroll tfoot td { position: sticky; bottom: 0; z-index: 2; background: #f3f6f8; box-shadow: inset 0 1px 0 var(--line); }
.grid-scroll .bill-grid td:first-child, .grid-scroll .bill-grid th:first-child { position: sticky; left: 0; z-index: 2; background: #fff; }
.grid-scroll thead th:first-child, .grid-scroll tfoot td:first-child { z-index: 4; background: #f3f6f8; }
.grid-scroll::-webkit-scrollbar { height: 14px; width: 12px; }
.grid-scroll::-webkit-scrollbar-thumb { background: #b9c6cf; border-radius: 8px; border: 3px solid #fff; }
.grid-scroll::-webkit-scrollbar-thumb:hover { background: #8fa1ad; }
.grid-scroll::-webkit-scrollbar-track { background: #eef2f5; }

/* period chips on Thu tiền */
.period-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.period-chip { display: flex; flex-direction: column; padding: 7px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: inherit; text-decoration: none; min-width: 150px; line-height: 1.25; }
.period-chip:hover { border-color: #0c5a4c; text-decoration: none; color: inherit; }
.period-chip .pc-title { font-weight: 700; }
.period-chip .pc-sub { font-size: .76rem; color: #6b7a86; }
.period-chip.is-viewing { background: #0c5a4c; border-color: #0c5a4c; color: #fff; }
.period-chip.is-viewing .pc-sub { color: rgba(255,255,255,.8); }
.period-chip.is-ahead:not(.is-viewing) { background: #fff4d6; border-color: #f0b43c; box-shadow: 0 0 0 3px rgba(240,180,60,.18); }
.period-chip.is-ahead:not(.is-viewing) .pc-title { color: #8a5a00; }
.period-chip.is-missing:not(.is-viewing) { border-style: dashed; color: #6b7a86; }

/* per-property figures on the dashboard */
.prop-stat { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; height: 100%; background: #fbfcfd; }
.prop-stat.prop-hero { background: linear-gradient(135deg, #0c5a4c, #137a66); color: #fff; border-color: transparent; }
.prop-stat.prop-hero .stat-label { color: rgba(255,255,255,.8); }

/* Sơ đồ phòng: chọn nhiều phòng để xóa */
.pick-only { display: none !important; }
body.picking .pick-only { display: inline-flex !important; }
.pick-box { position: absolute; top: -8px; left: -8px; width: 24px; height: 24px; border-radius: 7px; background: #fff; border: 2px solid #b9c6cf; align-items: center; justify-content: center; color: transparent; font-size: .9rem; z-index: 1; }
body.picking .room-cell { cursor: pointer; }
body.picking .room-cell.room-locked { opacity: .55; cursor: not-allowed; }
body.picking .room-cell.room-locked .pick-box { color: #8a98a3; border-color: #d5dde2; background: #f1f3f5; }
.room-cell.picked { outline: 3px solid #d43d3d; outline-offset: -1px; }
.room-cell.picked .pick-box { background: #d43d3d; border-color: #d43d3d; color: #fff; }
.room-cell.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.pick-bar { display: none; position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(720px, calc(100vw - 32px)); z-index: 1030; background: #2b1f1f; color: #fff; border-radius: 14px; padding: 10px 14px; align-items: center; gap: 10px; }
body.picking .pick-bar { display: flex; }

.cccd-preview { max-width: 100%; max-height: 140px; border-radius: 8px; border: 1px solid var(--line); }

.room-pick { background: #f0f7f4; border: 1px solid #cfe5dc; border-radius: 12px; padding: 12px 14px; }

.pay-room { display: inline-flex; gap: 5px; align-items: center; border: 1px solid #d5e3dd; border-radius: 8px; padding: 3px 8px; cursor: pointer; background: #fff; }
.pay-room:has(input:checked) { background: #e3f3ec; border-color: #2f8f6a; }
.pay-room.pay-cash .small { color: #b26a00; }
