@font-face {
  font-family: "DM Sans";
  src: url("/fonts/dm-sans-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   Genesis theme for 掌宿房源
   Tokens from designmd.ai/chef/genesis (light)
   ============================================================ */
:root {
  --bg: #fafafa;
  --bg-alt: #f3f3f3;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --panel: #ffffff;
  --ink: #0a0a0a;
  --ink-2: #6b6b6b;
  --muted: #9c9c9c;
  --line: #dfdfe3;
  --line-subtle: #e8e8ec;
  --brand: #016f48;
  --brand-hover: #015c3c;
  --brand-soft: #e7f5ee;
  --brand-text: #016f48;
  --secondary: #6366f1;
  --secondary-hover: #4f46e5;
  --secondary-soft: #eef2ff;
  --secondary-text: #4f46e5;
  --good: #10b981;
  --warn: #d97706;
  --bad: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(9, 9, 11, .04);
  --shadow-md: 0 12px 32px rgba(9, 9, 11, .08);
  --font-sans: "DM Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 var(--font-sans);
  font-feature-settings: "ss01" on, "cv11" on;
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--surface);
  color: var(--ink);
  border-right: 1px solid var(--line-subtle);
  padding: 26px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 18px;
  box-shadow: 0 6px 18px rgba(1, 111, 72, .24);
}
.brand strong {
  display: block; font-size: 18px; font-weight: 700;
  letter-spacing: -.02em; line-height: 1.2;
}
.brand small {
  color: var(--muted); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase;
}

nav { display: flex; flex-direction: column; gap: 3px; }
nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: 14px; font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
nav a svg {
  width: 18px; height: 18px; flex: none;
  stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
nav a:hover { background: var(--bg-alt); color: var(--ink); }
nav a.active {
  background: var(--brand-soft); color: var(--brand-text);
  box-shadow: inset 3px 0 0 var(--brand);
}

.sidebar-foot {
  margin-top: auto; color: var(--muted); font-size: 11px;
  display: flex; flex-direction: column; gap: 8px; padding: 0 10px;
  letter-spacing: .04em;
}
button.link {
  background: none; color: var(--ink-2); padding: 0; text-align: left;
  font-size: 12px; font-weight: 500;
}
button.link:hover { color: var(--brand-text); }

/* ---------- Main / topbar ---------- */
main {
  padding: 24px 40px 64px;
  max-width: 1360px;
  width: 100%;
}

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 18px; margin-bottom: 28px;
}
.topbar input[type="search"] {
  width: min(460px, 100%);
  background: var(--bg-alt);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 13px;
  color: var(--ink);
}
.topbar input[type="search"]::placeholder { color: var(--muted); }
.topbar input[type="search"]:focus {
  background: var(--surface);
  border-color: var(--line);
  outline: 3px solid var(--brand-soft);
}
#topbar-asof {
  font-size: 11px; color: var(--muted); white-space: nowrap;
  letter-spacing: .04em; text-transform: uppercase;
}

/* ---------- Page head ---------- */
.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 20px; margin-bottom: 24px; flex-wrap: wrap;
}
h1 {
  font-size: 34px; line-height: 1.1; margin: 0 0 6px;
  font-weight: 700; letter-spacing: -.035em;
}
h2 {
  font-size: 18px; line-height: 1.3; margin: 0 0 4px;
  font-weight: 600; letter-spacing: -.01em;
}
.page-head .muted { font-size: 13px; color: var(--ink-2); }
.muted { color: var(--muted); }
.asof { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Buttons ---------- */
button {
  font: inherit; font-weight: 600; font-size: 13px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--brand); color: #fff;
  padding: 9px 16px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(1, 111, 72, .22);
  transition: background .12s ease, transform .12s ease, box-shadow .12s ease;
}
button:hover { background: var(--brand-hover); box-shadow: 0 4px 12px rgba(1, 111, 72, .18); }
button.ghost {
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--line); box-shadow: none;
}
button.ghost:hover { background: var(--bg-alt); color: var(--ink); box-shadow: none; }
button.danger { background: var(--bad); box-shadow: 0 1px 2px rgba(239, 68, 68, .25); }
button.danger:hover { background: #dc2626; }
button.small { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
button:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
a.button {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; padding: 9px 16px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
}
a.button.ghost { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); }
a.button:hover { background: var(--brand-hover); }

/* ---------- Cards ---------- */
.cards {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px; margin-bottom: 20px;
}
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius);
  padding: 22px 24px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.cards > .card::before {
  content: "房";
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 700;
  background: var(--brand-soft); color: var(--brand-text);
  margin-bottom: 18px;
}
.cards > .card:nth-child(2)::before { content: "¥"; background: var(--secondary-soft); color: var(--secondary-text); }
.cards > .card:nth-child(3)::before { content: "!"; background: #fef2f2; color: var(--bad); }
.cards > .card:nth-child(4)::before { content: "◷"; background: #fffbeb; color: var(--warn); }
.cards.money > .card::before { content: "¥"; background: var(--brand-soft); color: var(--brand-text); }
.cards.money > .card:nth-child(2)::before { content: "✓"; background: #ecfdf5; color: #059669; }
.cards.money > .card:nth-child(3)::before { content: "!"; background: #fef2f2; color: var(--bad); }
.cards.money > .card:nth-child(4)::before { content: "Σ"; background: var(--secondary-soft); color: var(--secondary-text); }
.card .label {
  color: var(--muted); font-size: 11px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
}
.card .big {
  font-size: 32px; line-height: 1.15; font-weight: 700;
  letter-spacing: -.035em; margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}
.card .big small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.card .sub { font-size: 12px; color: var(--ink-2); }
.card .tag {
  display: inline-block; margin-top: 12px; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-text);
}
.card.disabled { opacity: .55; }
.card.clickable { cursor: pointer; }
.card.clickable:hover {
  border-color: #d4d4d8; box-shadow: var(--shadow-md); transform: translateY(-2px);
}
.card.bad-card { border-color: #fecaca; background: #fffafa; }
.tag-bad { background: #fef2f2 !important; color: var(--bad) !important; }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; margin-bottom: 16px; flex-wrap: wrap;
}
.panel-head h2 { margin: 0; }
.panel-head .muted { font-size: 12px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left; padding: 12px 12px;
  border-bottom: 1px solid var(--line-subtle);
  white-space: nowrap;
}
th {
  color: var(--muted); font-weight: 600; font-size: 11px;
  letter-spacing: .07em; text-transform: uppercase;
  background: var(--surface); position: sticky; top: 0; z-index: 1;
  border-bottom: 1px solid var(--line);
}
tbody tr { transition: background .1s ease; }
tbody tr:hover { background: #fafafa; cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow: auto; max-height: 68vh; border-radius: 12px; }
.bill-expand-row > td {
  padding: 0 12px 18px;
  background: #fafafa;
  white-space: normal;
}
.bill-pay-detail {
  background: var(--surface);
  border: 1px solid var(--line-subtle);
  border-radius: 12px;
  padding: 14px 16px;
}
.bill-pay-detail .section-title {
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.empty { padding: 36px; text-align: center; color: var(--muted); font-size: 13px; }
.loading { padding: 48px; color: var(--muted); text-align: center; }

/* ---------- Pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  width: fit-content; max-width: 100%;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; line-height: 18px;
  letter-spacing: .01em;
}
.pill.active, .pill.paid, .pill.leased { background: #ecfdf5; color: #059669; }
.pill.closed, .pill.void, .pill.vacant { background: #f4f4f5; color: #71717a; }
.pill.pending, .pill.partial, .pill.paused, .pill.renovating { background: #fffbeb; color: #b45309; }
.pill.overdue { background: #fef2f2; color: #dc2626; }
.pill.share, .pill.entrust { background: var(--secondary-soft); color: var(--secondary-text); }
.pill.legacy { background: #f4f4f5; color: #71717a; }
.pill.risk-critical { background: #fef2f2; color: #dc2626; }
.pill.risk-high { background: #fff7ed; color: #c2410c; }
.pill.risk-watch { background: #fffbeb; color: #b45309; }
.pill.risk-normal { background: #ecfdf5; color: #059669; }

.risk-panel { border-left: 4px solid var(--bad); }
.risk-panel.risk-high { border-left-color: #f97316; }
.risk-panel.risk-watch { border-left-color: var(--warn); }
.risk-panel.risk-normal { border-left-color: var(--good); }
.risk-head { margin-bottom: 10px; }
.risk-note {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 22px; background: var(--bg-alt);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.risk-note span { display: block; color: var(--muted); font-size: 11px; }
.risk-note strong { font-size: 13px; font-weight: 500; }

/* ---------- Toolbars / forms ---------- */
.toolbar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 14px;
}
.filter-board {
  background: var(--bg-alt);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.filter-row {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 10px;
}
.filter-row:last-child { margin-bottom: 0; }
.filter-top { margin-bottom: 12px; }
.filter-actions { margin-left: auto; display: flex; gap: 6px; }
button.icon {
  width: 36px; height: 36px; padding: 0;
  display: grid; place-items: center;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--line); box-shadow: none;
}
.filter-item {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 0 10px; height: 38px;
}
.filter-item > span {
  color: var(--muted); font-size: 11px; white-space: nowrap;
  letter-spacing: .04em;
}
.filter-item select, .filter-item input {
  border: 0; box-shadow: none; background: transparent;
  padding: 0 2px; height: 34px; min-width: 86px; font-size: 12px;
}
.filter-item select:focus, .filter-item input:focus {
  box-shadow: none; border: 0;
}
.filter-item.range input { min-width: 128px; }
.chip-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; flex: 0 0 auto; }
button.chip, a.chip {
  display: inline-flex; align-items: center;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-2); box-shadow: none;
  padding: 6px 12px; border-radius: 999px; font-size: 12px;
}
button.chip:hover, a.chip:hover { background: var(--bg-alt); color: var(--ink); }
button.chip.active {
  background: var(--brand-soft); color: var(--brand-text);
  border-color: transparent;
}
.chip.static {
  display: inline-flex; align-items: center;
  padding: 6px 12px; border-radius: 999px; font-size: 12px;
  background: var(--surface); color: var(--muted);
  border: 1px dashed var(--line); cursor: default;
  width: max-content;
  white-space: nowrap; flex: 0 0 auto;
}
.contract-table th, .contract-table td { padding: 11px 10px; font-size: 12px; }
input, select, textarea {
  font: inherit; font-size: 13px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input[type="search"] { min-width: 240px; }
.tabs { display: flex; gap: 4px; background: var(--bg-alt); padding: 3px; border-radius: 999px; }
.tabs button {
  background: transparent; color: var(--ink-2); box-shadow: none;
  padding: 6px 14px; border-radius: 999px; font-size: 12px;
}
.tabs button:hover { background: transparent; color: var(--ink); box-shadow: none; }
.tabs button.active {
  background: var(--surface); color: var(--brand-text);
  box-shadow: 0 1px 3px rgba(9, 9, 11, .08);
}
.toolbar-label { color: var(--muted); font-size: 12px; }

.sort-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: -2px 0 14px;
}
.sort-label { color: var(--muted); font-size: 12px; margin-right: 2px; }
.sort-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-2);
  box-shadow: none;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}
.sort-btn:hover { background: var(--bg-alt); color: var(--ink); }
.sort-btn.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-text);
}
.sort-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.bill-current { background: var(--brand-soft) !important; }
.bill-current:hover { background: var(--brand-soft) !important; }

/* ---------- 付款弹窗 ---------- */
.pay-drawer { display: flex; flex-direction: column; gap: 14px; }
.pay-head {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px; padding: 12px 16px; background: var(--bg-alt);
  border-radius: var(--radius-sm);
}
.pay-head span { display: block; color: var(--muted); font-size: 11px; }
.pay-head strong { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.pay-amount input { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pay-table-wrap { overflow-x: auto; border: 1px solid var(--line-subtle); border-radius: var(--radius-sm); }
.pay-table { font-size: 12px; min-width: 860px; }
.pay-table th, .pay-table td { padding: 9px 10px; }
.pay-table td { white-space: nowrap; }
.pay-table .neg { color: var(--warn); font-variant-numeric: tabular-nums; }
.pay-total {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--brand-soft); border-radius: var(--radius-sm);
}
.pay-total span { color: var(--ink-2); font-size: 13px; }
.pay-total strong { color: var(--warn); font-size: 22px; font-variant-numeric: tabular-nums; }
.pay-total small { color: var(--muted); font-size: 12px; }
.pay-meta {
  display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line-subtle); border-radius: var(--radius-sm);
}
.pay-meta .field { margin: 0; }
.pay-method { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; }
.pay-method > span { color: var(--muted); }
.pay-method label { display: inline-flex; align-items: center; gap: 4px; }
.pay-method label.disabled { opacity: .45; }
.pay-payee {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--bg-alt); border-radius: var(--radius-sm);
}
.pay-payee span { color: var(--muted); font-size: 12px; }
.pay-payee strong { font-size: 14px; }
.proof-upload {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  min-height: 120px;
  padding: 16px;
  display: grid;
  place-items: center;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.proof-upload:hover, .proof-upload.dragover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.proof-upload strong { display: block; font-size: 13px; margin-bottom: 2px; }
.proof-upload small { display: block; color: var(--muted); font-size: 11px; }
.proof-upload img { max-width: 100%; max-height: 220px; border-radius: 8px; }
.proof-meta {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-top: 6px; color: var(--muted); font-size: 12px;
}
.proof-thumb {
  width: 54px; height: 54px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--line);
  display: block;
}

/* ---------- Key-value grids ---------- */
.kv {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px 22px;
}
.kv div span {
  display: block; color: var(--muted); font-size: 11px;
  letter-spacing: .06em; text-transform: uppercase; margin-bottom: 2px;
}
.kv div strong { font-size: 15px; font-weight: 600; }

.room-head {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px;
  background: var(--surface); border: 1px solid var(--line-subtle);
  border-radius: var(--radius); padding: 20px 24px;
  margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.room-head span {
  display: block; color: var(--muted); font-size: 11px;
  letter-spacing: .06em; text-transform: uppercase; margin-bottom: 2px;
}
.room-head strong {
  display: block; font-size: 17px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.room-head small {
  display: block; color: var(--muted); font-size: 11px; font-weight: 400;
  margin-top: 2px;
}
.contract-hero {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line-subtle);
  border-radius: var(--radius); padding: 18px 22px;
  margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.contract-owner { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.contract-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-text);
  display: grid; place-items: center; font-size: 20px; font-weight: 700;
}
.contract-owner strong { display: block; font-size: 17px; }
.contract-owner span { color: var(--muted); font-size: 12px; }
.contract-room {
  flex: 1; min-width: 260px; border-left: 1px solid var(--line-subtle);
  padding-left: 20px;
}
.contract-room strong { display: block; font-size: 18px; }
.contract-room span { display: block; color: var(--muted); font-size: 12px; }
.contract-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.contract-summary { margin-bottom: 10px; }
.contract-tabs { margin-bottom: 16px; }

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.room-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.room-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.room-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.room-card-head strong { display: block; font-size: 18px; letter-spacing: -.01em; }
.room-card-head > div > span { color: var(--muted); font-size: 12px; }
.room-card-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.room-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.room-card-metrics span { display: block; color: var(--muted); font-size: 11px; }
.room-card-metrics strong { display: block; margin-top: 1px; font-size: 14px; }
.room-card-facility { font-size: 12px; }
.room-card-facility > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 2px;
}
.room-card-facility p {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.room-card-foot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
  border-top: 1px solid var(--line-subtle);
  padding-top: 10px;
  font-size: 12px;
}
.room-card-foot span {
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-card-foot b { color: var(--muted); font-weight: 400; margin-right: 5px; }

.money-strip {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--line-subtle);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 16px;
}
.money-strip > div { padding: 16px 20px; border-right: 1px solid var(--line-subtle); }
.money-strip > div:last-child { border-right: 0; }
.money-strip span {
  display: block; color: var(--muted); font-size: 11px;
  letter-spacing: .06em; text-transform: uppercase;
}
.money-strip strong {
  display: block; font-size: 20px; font-weight: 600; margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.money-strip.vertical { grid-template-columns: 1fr; }
.money-strip.vertical > div { border-right: 0; border-bottom: 1px solid var(--line-subtle); }
.money-strip.vertical > div:last-child { border-bottom: 0; }

.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pager {
  display: flex; gap: 8px; justify-content: flex-end; align-items: center;
  margin-top: 14px; color: var(--muted); font-size: 12px;
}

/* ---------- Alerts ---------- */
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  background: #fffbeb; border: 1px solid #fde68a;
  font-size: 13px;
}
.alert.bad { background: #fef2f2; border-color: #fecaca; }
.alert strong { font-weight: 600; }

/* ---------- Drawer / modal / toast ---------- */
.drawer {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(9, 9, 11, .38);
  display: flex; justify-content: flex-end;
  backdrop-filter: blur(2px);
}
.drawer-box {
  width: min(560px, 100vw); height: 100%;
  background: var(--surface);
  display: flex; flex-direction: column;
  box-shadow: -24px 0 60px rgba(9, 9, 11, .16);
  animation: drawer-in .18s cubic-bezier(.16, 1, .3, 1);
}
.drawer-box.pay-wide { width: min(1000px, 100vw); }
@keyframes drawer-in {
  from { transform: translateX(28px); opacity: .7; }
  to { transform: none; opacity: 1; }
}
.drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid var(--line-subtle);
}
.drawer-head h3 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.drawer-body { padding: 22px 24px; overflow: auto; flex: 1; }
.drawer-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 16px 24px; border-top: 1px solid var(--line-subtle);
  background: var(--bg);
}
.btn-row { display: flex; gap: 8px; }

.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(9, 9, 11, .4);
  display: grid; place-items: center;
  backdrop-filter: blur(2px);
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 28px; width: min(440px, 92vw);
  box-shadow: var(--shadow-md);
}
.modal-box h3 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.02em; }
.modal-box input { width: 100%; margin: 12px 0 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: #09090b; color: #fafafa;
  padding: 11px 18px; border-radius: 12px;
  z-index: 60; font-size: 13px; font-weight: 500;
  box-shadow: 0 16px 40px rgba(9, 9, 11, .25);
}

/* ---------- Fields ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span {
  display: block; color: var(--ink-2); font-size: 12px;
  font-weight: 500; margin-bottom: 6px;
}
.field input, .field select, .field textarea { width: 100%; }
.field.check { display: flex; align-items: center; gap: 9px; }
.field.check input { width: auto; }
.settle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.hint-box {
  background: var(--brand-soft); border: 1px solid #e0e7ff;
  color: var(--brand-text); border-radius: 12px;
  padding: 11px 14px; font-size: 12px; margin: 4px 0 16px;
}
.section-title { font-weight: 600; margin-bottom: 8px; }
.panel-inline { border-top: 1px solid var(--line-subtle); padding-top: 16px; margin-top: 4px; }

/* ---------- Charts ---------- */
.bar-chart {
  display: flex; align-items: flex-end; gap: 8px;
  min-height: 140px; padding-top: 20px;
}
.bar-col {
  flex: 1; min-width: 26px; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; gap: 6px;
  cursor: pointer; height: 100%;
}
.bar-fill {
  width: 100%; max-width: 46px; border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #a5b4fc, var(--secondary));
  transition: filter .12s ease;
}
.bar-col:hover .bar-fill { filter: brightness(.95); }
.bar-col > span { font-size: 10px; color: var(--muted); white-space: nowrap; }
.bar-val { font-size: 10px; color: var(--muted); white-space: nowrap; }
.bar-chart.mini { min-height: 120px; gap: 4px; }
.bar-chart.large { min-height: 240px; gap: 10px; }

/* ---------- Timeline / wall ---------- */
.timeline { border-left: 2px solid var(--line-subtle); margin-left: 7px; padding-left: 20px; }
.tl-year {
  font-weight: 700; margin: 18px 0 10px; color: var(--muted);
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
}
.tl-year:first-child { margin-top: 0; }
.tl-item {
  display: grid; grid-template-columns: minmax(0, 1fr) 120px 90px auto;
  gap: 14px; align-items: center; padding: 11px 0;
  border-bottom: 1px solid var(--line-subtle); position: relative;
}
.tl-dot {
  position: absolute; left: -26px; top: 18px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--brand); border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}
.tl-item.overdue .tl-dot { background: var(--bad); }
.tl-amount { text-align: right; }
.tl-amount span { display: block; }
.tl-status { text-align: right; }

.wall { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.wall-col { min-width: 170px; flex: 1; }
.wall-month {
  font-weight: 600; font-size: 11px; padding: 8px 0;
  border-bottom: 1px solid var(--line); margin-bottom: 10px;
  display: flex; justify-content: space-between;
  color: var(--ink-2); letter-spacing: .06em; text-transform: uppercase;
}
.wall-month small { color: var(--muted); font-weight: 400; }
.wall-card {
  border: 1px solid var(--line-subtle); border-left: 3px solid var(--brand);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
  display: flex; flex-direction: column; gap: 3px; font-size: 12px;
  cursor: pointer; background: var(--surface); transition: box-shadow .12s ease;
}
.wall-card:hover { box-shadow: var(--shadow-sm); }
.wall-card.soon { border-left-color: var(--warn); }
.wall-card.urgent { border-left-color: var(--bad); background: #fffafa; }
.wall-card span { color: var(--muted); }
.wall-empty { color: var(--muted); font-size: 12px; padding: 8px; text-align: center; }

/* ---------- Steps / wizard ---------- */
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.step {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; background: var(--bg-alt); color: var(--ink-2);
  border-radius: 999px; font-size: 12px; font-weight: 500;
}
.step b {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); display: grid; place-items: center;
  font-size: 11px; box-shadow: var(--shadow-sm);
}
.step.active { background: var(--brand); color: #fff; }
.step.active b { color: var(--brand-text); }
.step.done { background: var(--brand-soft); color: var(--brand-text); }

.wizard-grid {
  display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  gap: 18px; align-items: start;
}
.wizard-aside { position: sticky; top: 18px; }
.wizard-actions {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--line-subtle); padding-top: 16px; margin-top: 10px;
}
.summary-list { display: flex; flex-direction: column; gap: 10px; }
.summary-list > div { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.summary-list span { color: var(--muted); white-space: nowrap; }
.summary-list strong { text-align: right; font-size: 12px; }

.radio-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.radio-card {
  border: 1px solid var(--line-subtle); border-radius: 12px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px; cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.radio-card input { display: none; }
.radio-card small { color: var(--muted); font-size: 11px; }
.radio-card.on { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- Search ---------- */
.search-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.search-card {
  border: 1px solid var(--line-subtle); border-radius: 12px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 3px; font-size: 12px;
  transition: box-shadow .12s ease;
}
.search-card:hover { box-shadow: var(--shadow-sm); }
.search-card span { color: var(--muted); }

/* ---------- Allocation / preview ---------- */
.alloc-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 100px 100px;
  gap: 10px; align-items: center; padding: 10px 0;
  border-bottom: 1px solid var(--line-subtle); font-size: 12px;
}
.alloc-row.on { background: #fafaff; }
.alloc-list { max-height: 320px; overflow: auto; }
.preview-total {
  display: flex; gap: 24px; flex-wrap: wrap;
  background: var(--brand-soft); border-radius: 12px;
  padding: 12px 16px; margin-bottom: 12px;
}
.preview-total span {
  display: block; color: var(--brand-text); font-size: 11px;
  letter-spacing: .05em; text-transform: uppercase;
}
.preview-total strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.preview-table { max-height: 320px; }

/* ---------- Statement ---------- */
.statement-head {
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding-bottom: 16px; margin-bottom: 18px; border-bottom: 2px solid var(--ink);
}
.statement-head strong { display: block; font-size: 22px; letter-spacing: -.02em; }
.statement-head > div > span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.statement-meta {
  display: grid; grid-template-columns: repeat(2, auto); gap: 5px 22px;
  text-align: right; font-size: 12px; color: var(--muted);
}
.stmt-contract { border-top: 1px solid var(--line-subtle); margin-top: 20px; padding-top: 16px; }
.stmt-contract-head {
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.stmt-contract-head strong { font-size: 15px; }
.stmt-contract-head span { display: block; color: var(--muted); font-size: 12px; }
.stmt-contract-head .num { color: var(--muted); font-size: 12px; }
.stmt-payments { margin-top: 26px; }
.stmt-total { text-align: right; font-weight: 600; margin-top: 10px; }
.statement-foot {
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line-subtle);
  color: var(--muted); font-size: 11px;
}

/* ---------- Misc ---------- */
.hidden { display: none !important; }
.text-bad { color: var(--bad); }
.text-warn { color: var(--warn); }
.text-good { color: var(--good); }
.tiny { font-size: 11px; }
.mini-tag {
  display: inline-block; padding: 1px 7px; border-radius: 6px;
  background: var(--bg-alt); color: var(--ink-2); font-size: 10px;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-tabs { margin-bottom: 16px; }
.check-col { width: 34px; padding-right: 0; }
.check-col input { width: 15px; height: 15px; }
.bulk-footer {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 12px 16px; margin-top: 12px;
  background: var(--brand-soft); border-radius: 12px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  body { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center;
    padding: 14px 18px; gap: 18px; border-right: 0;
    border-bottom: 1px solid var(--line-subtle);
  }
  .sidebar nav { flex-direction: row; overflow: auto; min-width: 0; }
  .sidebar-foot { display: none; }
  main { padding: 20px 20px 48px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .wizard-grid { grid-template-columns: 1fr; }
  .wizard-aside { position: static; }
  .room-head { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .money-strip { grid-template-columns: 1fr; }
  .money-strip > div { border-right: 0; border-bottom: 1px solid var(--line-subtle); }
  .money-strip > div:last-child { border-bottom: 0; }
  .settle-grid, .form-grid { grid-template-columns: 1fr; }
  .search-grid, .radio-row { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .topbar input[type="search"] { width: 100%; }
  .drawer-box { width: 100vw; }
  .pay-meta { grid-template-columns: 1fr; }
  .tl-item { grid-template-columns: minmax(0, 1fr) auto; }
  .tl-status { display: none; }
  th, td { padding: 10px 10px; }
}

@media (max-width: 620px) {
  h1 { font-size: 27px; }
  .cards { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }
  .room-head { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .statement-meta { text-align: left; grid-template-columns: 1fr; }
  .risk-note { grid-template-columns: 1fr; }
  .contract-hero { flex-direction: column; align-items: flex-start; }
  .contract-room { border-left: 0; padding-left: 0; }
  .contract-actions { width: 100%; margin-left: 0; }
  .sidebar { overflow-x: auto; }
  .brand small { display: none; }
}

/* ---------- Print ---------- */
@media print {
  body { display: block; background: #fff; }
  .sidebar, .topbar, .toolbar, .asof, .pager, .page-actions,
  .page-head, .drawer, .toast, .bulk-footer { display: none !important; }
  main { max-width: none; padding: 0; }
  .panel { border: 0; box-shadow: none; padding: 0 0 12px; }
  .page-head { margin-bottom: 12px; }
  .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .card { border: 1px solid #ddd; box-shadow: none; }
  .card::before { display: none; }
  .stmt-contract, .card { break-inside: avoid; }
  .table-wrap { max-height: none; overflow: visible; }
  th { background: #fff; }
}
