:root {
  --bg: #f4f6f8; --card: #ffffff; --ink: #1a2433; --muted: #66727f; --line: #e3e7ec;
  --brand: #0f6e66; --brand-ink: #ffffff; --brand-soft: #e3f2f0;
  --green: #17803d; --green-bg: #e5f5ea; --amber: #a15c00; --amber-bg: #fff2dc;
  --red: #b42318; --red-bg: #fde8e6; --blue: #1d5fbf; --blue-bg: #e6eefb; --gray-bg: #eef0f3;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --side: 252px; --top: 58px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.08rem; margin: 0 0 .75rem; }
h3 { font-size: .98rem; margin: 0 0 .5rem; }
.mt { margin-top: 1.25rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.neg { color: var(--red); font-weight: 600; }
.warn-text { color: var(--amber); }
code { background: var(--gray-bg); padding: 1px 5px; border-radius: 5px; }

/* Shell */
.topbar { position: fixed; inset: 0 0 auto 0; height: var(--top); background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 18px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--ink); }
.brand small { font-weight: 500; color: var(--muted); font-size: .78rem; }
.brand:hover { text-decoration: none; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 800; }
.logo.big { width: 48px; height: 48px; font-size: 1.4rem; border-radius: 12px; }
.who { margin-left: auto; font-size: .88rem; color: var(--muted); }
.menu-btn { display: none; border: 0; background: none; font-size: 1.4rem; cursor: pointer; padding: 4px 6px; color: var(--ink); }
.sidebar { position: fixed; top: var(--top); bottom: 0; left: 0; width: var(--side); background: var(--card); border-right: 1px solid var(--line); padding: 14px 10px; overflow-y: auto; z-index: 20; }
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--ink); font-weight: 500; margin-bottom: 2px; }
.sidebar a:hover { background: var(--gray-bg); text-decoration: none; }
.sidebar a.on { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.ni { width: 22px; text-align: center; }
.count { margin-left: auto; background: var(--red); color: #fff; border-radius: 999px; font-size: .72rem; padding: 1px 8px; font-weight: 700; }
.scrim { display: none; }
.main { margin-left: var(--side); padding: calc(var(--top) + 24px) 28px 48px; max-width: calc(1280px + var(--side)); }
.main.bare { margin: 0; padding: 24px 16px; max-width: none; }

/* Cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 480px; }
.card.empty { color: var(--muted); text-align: center; padding: 36px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.actions, .btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid2.wide-left { grid-template-columns: 1.5fr 1fr; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .grid2 + .grid2 { margin-top: 20px; }
.welcome ol { margin: 0; padding-left: 1.2rem; line-height: 2; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border-top: 3px solid var(--line); }
.card .stat { box-shadow: none; }
.stat.good { border-top-color: var(--green); }
.stat.bad { border-top-color: var(--red); }
.stat.warn { border-top-color: #e8a33a; }
.stat-label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat-value { font-size: 1.45rem; font-weight: 750; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: .82rem; color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--gray-bg); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); border-color: #f2c4bf; }
.btn.danger:hover { background: var(--red-bg); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--brand); }
.btn.sm { padding: 4px 10px; font-size: .8rem; border-radius: 7px; }
.btn.block { width: 100%; padding: 11px; }
form.inline { display: inline-flex; gap: 4px; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn, .row-actions form { margin-left: 4px; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 650; white-space: nowrap; }
.b-green { background: var(--green-bg); color: var(--green); }
.b-amber { background: var(--amber-bg); color: var(--amber); }
.b-red { background: var(--red-bg); color: var(--red); }
.b-blue { background: var(--blue-bg); color: var(--blue); }
.b-gray { background: var(--gray-bg); color: var(--muted); }

/* Flash */
.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; }
.flash-ok { background: var(--green-bg); color: var(--green); }
.flash-err { background: var(--red-bg); color: var(--red); }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .87rem; margin-bottom: 5px; }
.req { color: var(--red); }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=month], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cfd6de; border-radius: 9px; font: inherit; background: #fff; color: var(--ink); min-height: 40px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type=file] { font: inherit; font-size: .88rem; max-width: 100%; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.static { padding: 9px 0; font-weight: 600; }
.money-in { display: flex; align-items: stretch; }
.money-in span { padding: 0 11px; display: grid; place-items: center; background: var(--gray-bg); border: 1px solid #cfd6de; border-right: 0; border-radius: 9px 0 0 9px; color: var(--muted); }
.money-in input { border-radius: 0 9px 9px 0; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
label.check input { width: 18px; height: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
.form-grid .wide, .form-grid .field.wide { grid-column: 1 / -1; }
.narrow-form { max-width: 760px; }
.form-actions { display: flex; gap: 8px; padding-top: 6px; }
.danger-zone { margin-top: -6px; text-align: right; }
.preview { display: none; max-width: 220px; max-height: 260px; margin-top: 10px; border-radius: 10px; border: 1px solid var(--line); }
.preview.show { display: block; }

/* Filters */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters input[type=search] { max-width: 240px; }
.filters select { width: auto; max-width: 220px; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcfd; }
.table.compact td, .table.compact th { padding: 6px 10px; }
.card > .table-wrap .table th:first-child, .card > .table-wrap .table td:first-child { padding-left: 4px; }
.card.flush .table th:first-child, .card.flush .table td:first-child { padding-left: 18px; }
.pager { display: flex; gap: 4px; flex-wrap: wrap; }
.pager a { padding: 5px 11px; border-radius: 7px; border: 1px solid var(--line); background: var(--card); }
.pager a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.file-link { white-space: nowrap; }

/* Lists */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.mini-list li:last-child { border-bottom: 0; }
.doc-list { padding-left: 1.1rem; margin: 0 0 12px; line-height: 1.9; }
.info { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0; font-size: .92rem; }
.info dt { color: var(--muted); }
.info dd { margin: 0; }
.avatar { width: 84px; height: 84px; object-fit: cover; border-radius: 50%; float: right; border: 1px solid var(--line); }
.pre { white-space: pre-wrap; background: #fafbfc; border: 1px solid var(--line); border-radius: 9px; padding: 12px; font-size: .9rem; }
.note { background: var(--amber-bg); padding: 6px 9px; border-radius: 7px; margin: 6px 0; }
details summary { cursor: pointer; font-weight: 600; color: var(--brand); margin: 6px 0 10px; }

/* Review cards */
.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.review { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.review img { width: 100%; height: 240px; object-fit: cover; object-position: top; display: block; background: var(--gray-bg); }
.review .noimg { height: 90px; display: grid; place-items: center; background: var(--gray-bg); }
.review-body { padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.review-body .big { font-size: 1.35rem; font-weight: 750; }
.review-body form { margin-top: 8px; display: grid; gap: 8px; }

/* Report bars */
.legend { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-left: 10px; }
.sw.inc, .bar.inc { background: var(--brand); }
.sw.exp, .bar.exp { background: #e8a33a; }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; height: 200px; align-items: end; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.bar-col { display: flex; flex-direction: column; height: 100%; justify-content: flex-end; }
.bar-pair { display: flex; gap: 2px; align-items: flex-end; height: calc(100% - 20px); }
.bar { flex: 1; border-radius: 4px 4px 0 0; min-height: 1px; }
.bar-lbl { font-size: .72rem; color: var(--muted); text-align: center; height: 20px; padding-top: 3px; }

/* Login */
.login-wrap { min-height: calc(100vh - 48px); display: grid; place-items: center; }
.login-card { width: 100%; max-width: 400px; padding: 28px; }
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.login-brand h1 { margin: 0; }
.login-brand p { margin: 0; font-size: .88rem; }

/* Mobile */
@media (max-width: 900px) {
  .menu-btn { display: block; }
  .who { font-size: .8rem; }
  .brand small { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 4px 0 20px rgba(0,0,0,.08); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: var(--top) 0 0 0; background: rgba(0,0,0,.25); z-index: 15; }
  .main { margin-left: 0; padding: calc(var(--top) + 16px) 16px 40px; }
  .grid2, .grid2.wide-left, .form-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-value { font-size: 1.15rem; }
  .card { padding: 16px; }
  .filters input[type=search], .filters select { max-width: none; flex: 1 1 140px; }

  /* Stack table rows into cards */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .card.flush .table tr { padding: 8px 14px; }
  .table td { border: 0; padding: 3px 0 !important; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; text-align: left; flex-shrink: 0; }
  .table td.row-actions { justify-content: flex-end; flex-wrap: wrap; gap: 6px; padding-top: 8px !important; }
  .table td.row-actions::before { content: none; }
  .info { grid-template-columns: 120px 1fr; }
}
@media (max-width: 420px) { .who .acct { display: none; } }

@media print {
  .topbar, .sidebar, .actions, .filters, .btn, .row-actions, .danger-zone { display: none !important; }
  .main { margin: 0; padding: 0; }
  .card, .stat { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* ---------- v2 additions ---------- */
.nav-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 14px 12px 4px; }
.flash-warn { background: var(--amber-bg); color: var(--amber); }
.flash-warn a { color: inherit; text-decoration: underline; }
.tag { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--gray-bg); color: var(--muted); padding: 1px 6px; border-radius: 5px; margin-right: 4px; }
.owner-switch select { min-height: 34px; padding: 4px 8px; font-size: .85rem; max-width: 220px; }
.inline-card { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.inline-card select, .inline-card .money-in { width: auto; max-width: 360px; flex: 1 1 200px; }
.copy-input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; background: var(--gray-bg); flex: 1 1 300px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.pre-line { white-space: pre-line; }
.calc { background: var(--brand-soft); color: var(--brand); border-radius: 10px; padding: 12px 14px; font-weight: 650; }
.big-calc { margin: 16px 0; font-size: 1.02rem; line-height: 1.7; }
.sticky-save { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 35%); padding: 18px 0 10px; }
.settings .card h2 { margin-bottom: 4px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* announcements */
.announce { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 10px; padding: 12px 16px; margin-bottom: 12px; }
.announce.pinned { border-left-color: #e8a33a; background: #fffaf0; }

/* ticket */
.steps { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.step { flex: 1 1 120px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--muted); font-weight: 600; font-size: .88rem; display: flex; align-items: center; gap: 8px; }
.step span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--gray-bg); font-size: .78rem; }
.step.on { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.step.on span { background: var(--brand); color: #fff; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding: 8px 0; position: relative; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 5px; top: 24px; bottom: -8px; width: 2px; background: var(--line); }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line); margin-top: 6px; flex-shrink: 0; }
.tl-dot.st { background: var(--brand); }
.stars { color: #e8a33a; letter-spacing: 1px; }
.stars-input { display: inline-flex; flex-direction: row-reverse; gap: 2px; margin: 6px 0 10px; }
.stars-input input { display: none; }
.stars-input label { font-size: 2rem; color: #d5dae0; cursor: pointer; line-height: 1; }
.stars-input input:checked ~ label, .stars-input label:hover, .stars-input label:hover ~ label { color: #e8a33a; }
.rate-form textarea { margin-bottom: 10px; }

/* inspections */
.insp-rows { display: grid; gap: 8px; margin-bottom: 10px; }
.insp-row { display: grid; grid-template-columns: 1.1fr 1.6fr .9fr 1.6fr auto auto; gap: 6px; align-items: center; }
.insp-row input, .insp-row select { min-height: 38px; padding: 6px 9px; }
.ir-photo { position: relative; display: inline-grid; place-items: center; min-width: 46px; height: 38px; border: 1px dashed #cfd6de; border-radius: 9px; cursor: pointer; }
.ir-photo input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ir-photo.has { border-style: solid; border-color: var(--green); background: var(--green-bg); }
.insp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.insp-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 4px; align-content: start; }
.insp-item img { width: 100%; height: 150px; object-fit: cover; border-radius: 7px; background: var(--gray-bg); }
.ded-row { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; margin-bottom: 8px; }

/* public application */
.apply-wrap { max-width: 820px; margin: 0 auto; }
.apply-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.apply-head h1 { margin: 0; }
.apply-head p { margin: 2px 0 0; }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.unit-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 3px; }
.unit-card .big { font-size: 1.25rem; font-weight: 750; color: var(--brand); margin-top: 4px; }

/* printable pages: receipt, statement, lease, settlement */
.print-page { background: #e9edf1; }
.print-bar { position: sticky; top: 0; display: flex; gap: 8px; justify-content: center; padding: 12px; background: rgba(233,237,241,.92); backdrop-filter: blur(4px); z-index: 5; }
.paper { background: #fff; max-width: 820px; margin: 0 auto 40px; padding: 48px 56px; box-shadow: 0 4px 24px rgba(0,0,0,.08); border-radius: 4px; color: #111; }
.rc-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--brand); padding-bottom: 14px; margin-bottom: 20px; }
.rc-biz { font-size: 1.35rem; font-weight: 800; color: var(--brand); }
.rc-no { text-align: right; }
.rc-no .big { font-size: 1.2rem; font-weight: 750; }
.rc-line { font-size: 1.05rem; line-height: 1.8; }
.rc-table { width: 100%; border-collapse: collapse; margin: 12px 0 18px; font-size: .93rem; }
.rc-table td, .rc-table th { padding: 7px 8px; border-bottom: 1px solid #eee; text-align: left; vertical-align: top; }
.rc-table td:first-child { color: #555; width: 30%; }
.rc-table.lined td:first-child { width: auto; color: inherit; }
.rc-table th { font-size: .75rem; text-transform: uppercase; color: #666; letter-spacing: .04em; }
.rc-table .num { text-align: right; }
.rc-table tr.tot td { font-weight: 700; border-top: 2px solid #ddd; }
.rc-sign { display: flex; justify-content: flex-end; margin: 44px 0 20px; text-align: center; }
.rc-sign.two { justify-content: space-between; }
.soa h3 { margin-top: 22px; border-bottom: 1px solid #ddd; padding-bottom: 4px; }
.soa-total { background: var(--brand-soft); border-radius: 10px; padding: 14px 18px; margin: 10px 0 6px; }
.soa-total .big { font-size: 1.7rem; font-weight: 800; color: var(--brand); }
.lease { font-family: Georgia, "Times New Roman", serif; font-size: 1rem; line-height: 1.75; white-space: normal; outline: none; }
.lease[contenteditable]:focus { box-shadow: 0 0 0 2px var(--brand-soft); }

@media (max-width: 900px) {
  .insp-row { grid-template-columns: 1fr 1fr; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
  .insp-row .ir-note { grid-column: 1 / -1; }
  .owner-switch { display: none; }
  .paper { padding: 22px 18px; }
  .rc-head { flex-direction: column; }
  .rc-no { text-align: left; }
}
@media print {
  .print-bar, .no-print, .owner-switch { display: none !important; }
  .print-page { background: #fff; }
  .paper { box-shadow: none; margin: 0; padding: 0; max-width: none; }
  .flash { display: none; }
}

/* ---------- v3: form sections, credits, rent-to-own ---------- */
.form-section { margin: 14px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .95rem; color: var(--brand); }
.form-grid > .form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.credit { display: inline-block; font-size: .78rem; font-weight: 650; padding: 1px 7px; border-radius: 6px; margin: 1px 0 1px 4px; white-space: nowrap; }
.credit.adv { background: var(--blue-bg); color: var(--blue); }
.credit.dep { background: #efe8fb; color: #6b3fb5; }
.rto { border-left: 4px solid var(--brand); }
.rto-bar { height: 14px; background: var(--gray-bg); border-radius: 999px; overflow: hidden; margin: 6px 0 8px; }
.rto-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #2aa198); border-radius: 999px; min-width: 2px; }
.rto-legend { font-size: .92rem; margin-bottom: 14px; }
.compact-stats { margin-bottom: 0; }
.compact-stats .stat-value { font-size: 1.15rem; }
.rto-tag { margin-top: 6px; font-size: .8rem; font-weight: 650; color: var(--brand); background: var(--brand-soft); border-radius: 7px; padding: 4px 8px; }

/* ---------- v4: subscription ---------- */
.trial-banner { background: #fff7d6; border: 1px solid #f4d774; color: #6b5200; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: .92rem; }
.trial-banner.warn { background: var(--red-bg); border-color: #f2c4bf; color: var(--red); }
.trial-banner a { font-weight: 700; color: inherit; text-decoration: underline; margin-left: 6px; }
.sub-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-bottom: 12px; max-width: 760px; }
.sub-plan { margin: 0; display: flex; flex-direction: column; gap: 6px; position: relative; }
.sub-plan h2 { margin: 0; }
.sub-plan.best { border: 2px solid #f5b800; }
.sub-plan.best::before { content: "Best value"; position: absolute; top: -12px; right: 16px; background: #f5b800; color: #1a1300; font-size: .74rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.sub-plan.chosen { box-shadow: 0 0 0 3px var(--brand-soft); border-color: var(--brand); }
.sub-price { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.sub-price small { font-size: .9rem; color: var(--muted); font-weight: 600; margin-left: 2px; }
.sub-plan ul { padding-left: 1.1rem; margin: 4px 0 10px; color: var(--muted); }
.sub-plan button { margin-top: auto; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- v5: short stays ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--brand); border-color: var(--brand); }
.quote-card { position: sticky; top: calc(var(--top) + 16px); align-self: start; }
.q-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.q-row small { color: var(--muted); display: block; }
.q-row.q-tot { font-size: 1.1rem; border-bottom: 2px solid var(--ink); }
.q-row.muted { border-bottom: 0; }
.q-ok { margin-top: 10px; color: var(--green); font-weight: 700; }
.q-err { margin-top: 10px; color: var(--red); font-weight: 600; }
.q-warn { margin-top: 8px; color: var(--amber); font-weight: 600; font-size: .9rem; }
.quote-box { background: var(--brand-soft); border-radius: 12px; padding: 12px 16px; }
.quote-box.bad { background: var(--red-bg); }
.stays-card { border-left: 4px solid var(--brand); }

/* availability calendar (units × days) */
.cal-wrap { overflow-x: auto; }
.cal { display: grid; grid-template-columns: 190px repeat(var(--days), minmax(30px, 1fr)); min-width: calc(190px + var(--days) * 30px); position: relative; }
.cal-head { font-size: .72rem; text-align: center; padding: 6px 0; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); background: #fafbfc; line-height: 1.2; }
.cal-head span { display: block; font-weight: 600; font-size: .64rem; }
.cal-head.we, .cal-cell.we { background: #f6f7fb; }
.cal-head.today { color: #fff; background: var(--brand); }
.cal-unit { grid-column: 1; padding: 8px 12px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); background: #fff; position: sticky; left: 0; z-index: 3; font-weight: 600; font-size: .9rem; }
.cal-unit span { display: block; font-weight: 500; }
.cal-cell { border-bottom: 1px solid var(--line); border-right: 1px dashed #eef0f3; min-height: 54px; transition: background .15s; }
.cal-cell:hover { background: var(--brand-soft); }
.cal-cell.today { box-shadow: inset 2px 0 0 var(--brand); }
.cal-bar { align-self: center; z-index: 2; margin: 0 3px; height: 30px; border-radius: 8px; padding: 0 8px; display: flex; align-items: center; font-size: .76rem; font-weight: 700;
           white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.12); transition: transform .15s, box-shadow .15s; }
.cal-bar:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.cal-bar.cont-l { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-bar.cont-r { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-bar::before { content: ""; flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.85); margin-right: 6px; }
.cal-bar.b-confirmed, .cal-bar.b-checked_in { background: var(--green); }
.cal-bar.b-reserved { background: #e8a33a; }
.cal-bar.b-inquiry { background: var(--blue); }
.cal-bar.b-checked_out { background: #94a3b8; }
.cal-bar.b-blocked { background: repeating-linear-gradient(45deg, #64748b, #64748b 6px, #74839a 6px, #74839a 12px); }
.cal-legend { display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; color: var(--muted); }
.lg { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.lg.b-confirmed { background: var(--green); } .lg.b-reserved { background: #e8a33a; } .lg.b-inquiry { background: var(--blue); } .lg.b-checked_out { background: #94a3b8; } .lg.b-blocked { background: #64748b; }

/* public booking page */
.book-wrap { max-width: 1080px; margin: 0 auto; }
.book-wrap.narrow { max-width: 920px; }
.book-head { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.book-head h1 { margin: 0; }
.book-head p { margin: 2px 0 0; }
.unit-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin-bottom: 24px; }
.ucard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; transition: transform .25s, box-shadow .25s, border-color .25s; }
.ucard:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(16,24,40,.12); }
.ucard.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.ucard img, .ucard .uph { width: 100%; height: 180px; object-fit: cover; display: block; background: linear-gradient(135deg, var(--brand-soft), #fff2dc); }
.ucard .uph { display: grid; place-items: center; font-size: 3rem; }
.ubody { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.ubody h2 { margin: 0; font-size: 1.15rem; }
.utype { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); font-weight: 700; }
.uprice { margin-top: 6px; font-size: .95rem; } .uprice b { font-size: 1.3rem; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 4px; }
.chips span { font-size: .74rem; background: var(--gray-bg); border-radius: 999px; padding: 2px 9px; color: var(--muted); font-weight: 600; }
.ubody .pick { margin-top: auto; align-self: flex-start; }
.reserve { scroll-margin-top: 20px; }
.reserve-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 26px; align-items: start; }
.big-btn { padding: 13px 22px; font-size: 1rem; }
.rules { margin: 8px 0; }
.mini-cal { user-select: none; }
.mc-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.mc-nav button { border: 1px solid var(--line); background: #fff; border-radius: 8px; width: 34px; height: 34px; font-size: 1.2rem; cursor: pointer; }
.mc-grids { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mc-title { font-weight: 700; text-align: center; margin-bottom: 6px; }
.mc-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.mc-dow { text-align: center; font-size: .7rem; color: var(--muted); font-weight: 700; }
.mc-d { aspect-ratio: 1; border: 0; border-radius: 8px; background: var(--green-bg); color: var(--green); font: 600 .82rem inherit; font-family: inherit; cursor: pointer; transition: transform .1s, background .15s; }
.mc-d:hover:not(.past):not(.busy) { transform: scale(1.08); }
.mc-d.busy { background: var(--red-bg); color: #c98a84; text-decoration: line-through; cursor: not-allowed; }
.mc-d.past { background: transparent; color: #c7ccd3; cursor: default; }
.mc-d.sel { background: var(--brand-soft); color: var(--brand); }
.mc-d.sel.s, .mc-d.sel.e { background: var(--brand); color: #fff; }
.cal-key { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.cal-key .k { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 3px; vertical-align: -2px; }
.k.free { background: var(--green-bg); border: 1px solid #b7e1c3; } .k.busy { background: var(--red-bg); } .k.pick { background: var(--brand); }
.stay-hero h1 { margin: 2px 0 12px; }
.stay-dates { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.stay-dates > div { display: flex; flex-direction: column; }
.stay-dates b { font-size: 1.15rem; }
.stay-dates .arrow { font-size: 1.4rem; color: var(--muted); }
@media (max-width: 900px) {
  .reserve-grid, .mc-grids { grid-template-columns: 1fr; }
  .quote-card { position: static; }
}

/* ---------- v5.1 grouped, collapsible menu ---------- */
.sidebar { display: flex; flex-direction: column; padding: 0; overflow: hidden; transition: width .22s ease, transform .2s ease; }
.nav-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 10px 16px; scrollbar-width: thin; }
.sidebar a.nlink { padding: 8px 12px; font-size: .93rem; white-space: nowrap; position: relative; }
.sidebar a.nlink .nl, .ngroup-head .nl, .nav-tool .nl { overflow: hidden; text-overflow: ellipsis; }
.sidebar a.nlink.on::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }

.ngroup { margin-top: 4px; }
.ngroup + .nlink, .nav-scroll > .nlink + .ngroup { margin-top: 10px; }
.ngroup-head { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border-radius: 9px;
  cursor: pointer; font-size: .86rem; font-weight: 650; color: #4a5664; white-space: nowrap; }
.ngroup-head:hover { background: var(--gray-bg); color: var(--ink); }
.ngroup-head:focus-visible, .nav-tool:focus-visible, .sidebar a.nlink:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.ngroup-head .ni { font-size: .95rem; }
.ngroup.closed .ngroup-head { color: var(--muted); }
.ngroup.has-on .ngroup-head { color: var(--brand); }
.ngroup-head .chev { width: 16px; height: 16px; margin-left: auto; flex-shrink: 0; transition: transform .22s ease; }
.ngroup-head .gsum { margin-left: auto; display: none; }
.ngroup-head .gsum + .chev { margin-left: 6px; }
.ngroup.closed .ngroup-head .chev { transform: rotate(-90deg); }
.ngroup.closed .ngroup-head .gsum { display: inline-block; }

.ngroup-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .24s ease, opacity .2s ease; }
.ngroup-body > div { overflow: hidden; min-height: 0; margin-left: 22px; padding-left: 6px; border-left: 1px solid var(--line); }
.ngroup-body .nlink.on::before { left: -7px; }
.ngroup.closed .ngroup-body { grid-template-rows: 0fr; opacity: 0; }
.ngroup-body .ni { font-size: .9rem; }

.nav-foot { border-top: 1px solid var(--line); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; background: var(--card); }
.nav-tool { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 9px; cursor: pointer;
  font-size: .84rem; color: var(--muted); white-space: nowrap; }
.nav-tool:hover { background: var(--gray-bg); color: var(--ink); }
.main { transition: margin-left .22s ease; }

/* Icon rail (desktop) */
@media (min-width: 901px) {
  body.nav-rail { --side: 68px; }
  body.nav-rail .nl, body.nav-rail .chev, body.nav-rail .gsum { display: none !important; }
  body.nav-rail .nav-scroll { padding: 10px 8px; }
  body.nav-rail .sidebar a.nlink, body.nav-rail .nav-tool { justify-content: center; padding: 9px 0; }
  body.nav-rail .ngroup { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
  body.nav-rail .ngroup-head { display: none; }
  body.nav-rail .ngroup-body, body.nav-rail .ngroup.closed .ngroup-body { grid-template-rows: 1fr; opacity: 1; }
  body.nav-rail .ngroup-body > div { margin: 0; padding: 0; border: 0; }
  body.nav-rail .sidebar a.nlink.on::before { left: -8px; }
  body.nav-rail .sidebar .count { position: absolute; top: 3px; right: 6px; margin: 0; font-size: .62rem; padding: 0 5px; }
  body.nav-rail .rail-btn .ni { transform: scaleX(-1); }
  body.nav-rail [data-nav="toggle-all"] { display: none; }
}
@media (max-width: 900px) {
  .rail-btn { display: none; }
  .sidebar { width: min(290px, 84vw); }
}
@media (prefers-reduced-motion: reduce) {
  .ngroup-body, .ngroup-head .chev, .sidebar, .main { transition: none; }
}
