:root {
  --bg: #f4f6fb;
  --side: #0f172a;
  --side-2: #111c33;
  --accent: #4f46e5;
  --accent-d: #4338ca;
  --accent-tint: rgba(79, 70, 229, 0.12);
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e6e8ef;
  --line-2: #eef0f6;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 18px rgba(16, 24, 40, 0.06);
  --shadow-2: 0 10px 30px rgba(16, 24, 40, 0.10);
  /* 房源状态色板：房态图卡片、图例、列表徽标统一引用，改一处即全站同步 */
  --st-free: #10b981;
  --st-busy: #4f46e5;
  --st-repair: #f59e0b;
  --st-off: #9ca3af;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
    "PingFang SC", "Hiragino Sans GB", Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--side); color: #cbd5e1;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px;
  color: #fff; border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; color: #fff; box-shadow: 0 4px 10px rgba(79, 70, 229, 0.5);
}
.brand .name { font-size: 15.5px; font-weight: 700; letter-spacing: .3px; }
.brand .sub { font-size: 11px; color: #7c8aa5; margin-top: 1px; }
.nav { padding: 12px 12px; overflow-y: auto; flex: 1; }
.nav .group { font-size: 11px; color: #5b6b86; padding: 12px 10px 6px; letter-spacing: .12em; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; margin: 3px 0;
  border-radius: 9px; color: #cbd5e1; font-size: 13.5px; transition: .15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav a.active { background: var(--accent-tint); color: #fff; }
.nav a.active .chip { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25); }
.chip {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 26px;
  position: sticky; top: 0; z-index: 5;
}
.crumb .t { font-size: 15px; font-weight: 600; }
.crumb .s { font-size: 12px; color: var(--muted); margin-top: 1px; }
.account { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.account .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.account a { color: var(--accent); margin-left: 8px; }
.content { padding: 26px; }

/* ---------- page head ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 19px; }
.page-actions { display: flex; gap: 10px; align-items: center; }

/* ---------- buttons ---------- */
.btn {
  height: 36px; display: inline-flex; align-items: center; gap: 6px; padding: 0 16px;
  border: 1px solid var(--line); background: #fff; border-radius: 9px; cursor: pointer;
  color: var(--text); font-size: 13.5px; font-weight: 500; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #cdd2de; background: #fafbff; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-d); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }

.search { display: flex; gap: 8px; }
.search input {
  height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; width: 220px; font-size: 13.5px;
  transition: .15s; background: #fff;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }

/* ---------- stat cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px;
  transition: .18s; text-decoration: none; color: inherit;
}
.card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); border-color: #d9dcec; }
.card .ic {
  width: 48px; height: 48px; flex: 0 0 48px; border-radius: 12px; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800;
}
.card-num { font-size: 28px; font-weight: 700; line-height: 1.1; color: #111827; }
.card-label { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- panel / table ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { padding: 15px 18px; border-bottom: 1px solid var(--line-2); font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.panel-head .more { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { padding: 13px 18px; text-align: left; font-size: 13.5px; border-bottom: 1px solid var(--line-2); }
.grid th { background: #fafbfe; font-weight: 600; color: #475067; font-size: 12.5px; letter-spacing: .02em; }
.grid tbody tr { transition: .12s; }
.grid tbody tr:hover { background: #f7f9ff; }
.grid tbody tr:last-child td { border-bottom: none; }
.grid .empty { text-align: center; color: var(--muted); padding: 38px; }
.grid .ops a { color: var(--accent); margin-right: 14px; font-size: 13px; }
.grid .ops a.del { color: #e11d48; }

/* ---------- badge ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.8; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.off { background: #f1f5f9; color: #475569; }
.badge.info { background: #dbeafe; color: #1e40af; }

/* ---------- form ---------- */
.form-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 26px; max-width: 760px; }
.form-row { display: flex; align-items: flex-start; padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.form-row:last-child { border-bottom: none; }
.form-row > label { width: 140px; flex: 0 0 140px; padding-top: 9px; color: #475067; font-size: 13.5px; font-weight: 500; }
.form-row .req { color: #e11d48; margin-left: 3px; font-style: normal; }
.form-control { flex: 1; min-width: 0; }
.form-control input[type=text], .form-control input[type=number], .form-control input[type=date],
.form-control select, .form-control textarea {
  width: 100%; max-width: 460px; height: 40px; border: 1px solid #d1d5db; border-radius: 9px;
  padding: 0 12px; font-size: 14px; font-family: inherit; background: #fff; transition: .15s;
}
.form-control textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.form-control input:focus, .form-control select:focus, .form-control textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint);
}
.form-control select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%236b7280' stroke-width='1.6'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-actions { padding: 18px 0; display: flex; gap: 12px; }

/* toggle switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--muted); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 44px; height: 24px; border-radius: 999px; background: #cbd5e1; position: relative; transition: .2s; flex: 0 0 44px; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); }

/* ---------- pager ---------- */
.pager { margin-top: 16px; display: flex; gap: 10px; align-items: center; }
.pager a, .pager .disabled, .pager .info { padding: 7px 13px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.pager a { color: var(--accent); }
.pager a:hover { background: var(--accent-tint); }
.pager .disabled { color: var(--muted); background: #fafbfe; }
.pager .info { border: none; color: var(--muted); }

/* ---------- login (split) ---------- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #eaeef6; padding: 20px; }
.login-wrap { width: 880px; max-width: 100%; height: 540px; display: flex; background: #fff; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-2); }
.login-aside { width: 340px; flex: 0 0 340px; background: var(--side); color: #fff; padding: 44px 36px; display: flex; flex-direction: column; }
.login-aside .logo { width: 46px; height: 46px; border-radius: 12px; background: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px; box-shadow: 0 6px 16px rgba(79,70,229,.5); }
.login-aside .bname { font-size: 22px; font-weight: 700; margin-top: 18px; }
.login-aside .btag { font-size: 13px; color: #93a1bd; margin-top: 6px; line-height: 1.7; }
.login-aside .feats { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.login-aside .feats div { display: flex; align-items: center; gap: 10px; color: #cbd5e1; font-size: 13px; }
.login-aside .feats .dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; flex: 0 0 7px; }
.login-main { flex: 1; padding: 50px 56px; display: flex; flex-direction: column; justify-content: center; }
.login-main h1 { font-size: 24px; }
.login-main .desc { color: var(--muted); margin: 8px 0 28px; }
.login-error { background: #fef2f2; color: #b91c1c; padding: 10px 14px; border-radius: 9px; margin-bottom: 16px; font-size: 13px; border: 1px solid #fecaca; }
.login-main input[type=text], .login-main input[type=password] {
  width: 100%; height: 46px; border: 1px solid #d1d5db; border-radius: 10px; padding: 0 14px; margin-bottom: 16px;
  font-size: 14.5px; transition: .15s;
}
.login-main input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.login-main button {
  width: 100%; height: 46px; border: none; border-radius: 10px; background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer; transition: .15s;
}
.login-main button:hover { background: var(--accent-d); }
.login-tip { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 18px; }

/* ---------- misc ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .big { font-size: 15px; color: #475067; margin-bottom: 6px; }
@media (max-width: 720px) {
  .sidebar { display: none; }
  .login-aside { display: none; }
  .login-wrap { height: auto; }
}

/* ---------- 分组侧边导航 ---------- */
.nav { overflow-y: auto; flex: 1; padding-bottom: 20px; }
.nav-group { margin-top: 6px; }
.nav-group > .nav-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px 6px; font-size: 11.5px; color: #64748b;
  cursor: pointer; user-select: none;
}
.nav-group > .nav-title .caret { font-size: 9px; transition: transform .15s; color: #475569; }
.nav-group.collapsed > .nav-title .caret { transform: rotate(-90deg); }
.nav-group.collapsed > .nav-items { display: none; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 20px; color: #cbd5e1; font-size: 13.5px; }
.nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav a.active { background: rgba(79, 70, 229, .18); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav a .nav-dot {
  width: 22px; height: 22px; border-radius: 6px; flex: 0 0 22px; display: grid; place-items: center;
  font-size: 12px; color: #fff; background: #334155; font-weight: 600;
}
.nav a.active .nav-dot { background: var(--accent); }

/* ---------- 徽标 ---------- */
.badge.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge.ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge.warn { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge.off { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }
.badge.info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.num { font-variant-numeric: tabular-nums; font-family: "SF Mono", Menlo, Consolas, monospace; }
.mono { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---------- 表单两列网格 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.form-grid .field { display: flex; flex-direction: column; gap: 6px; }
.form-grid .field.full { grid-column: 1 / -1; }
.form-grid label { font-size: 12.5px; color: #4b5563; font-weight: 500; }
.form-grid label i { color: #dc2626; font-style: normal; margin-left: 3px; }
.form-grid input, .form-grid select, .form-grid textarea {
  height: 38px; border: 1px solid #d7dae3; border-radius: 8px; padding: 0 11px;
  font-size: 13.5px; font-family: inherit; background: #fff; color: var(--text); width: 100%;
}
.form-grid textarea { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.6; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint);
}
.form-grid input[readonly] { background: #f8fafc; color: #64748b; }
.form-actions { margin-top: 22px; display: flex; gap: 10px; }
.hint { font-size: 12px; color: #6b7280; margin-top: 4px; }

/* ---------- 行内操作 ---------- */
form.inline { display: inline; }
.linkbtn { border: none; background: none; padding: 0; cursor: pointer; font-size: inherit; color: #2563eb; font-family: inherit; }
.linkbtn.danger { color: #dc2626; }
.linkbtn:hover { text-decoration: underline; }

/* ---------- 统计卡片 ---------- */
/* 说明1：.card 默认 display:flex 横排（给「图标+文字」卡用），stat-card 必须改为纵向堆叠，
   否则标题被压成「竖排单字」、数字被截断（影响 账单/首页/入住/统计/资金流量 5 个页面）。
   说明2：内部必须用 align-items:stretch 而非 flex-start —— 用 flex-start 会让
   .rate-bar（出租率进度条）宽度塌陷为 0，进度条彻底看不见。 */
.stat-card {
  padding: 16px 18px; display: flex; flex-direction: column;
  align-items: stretch; gap: 6px; min-width: 0;
  container-type: inline-size;
}
.stat-card > .card-label {
  font-size: 12.5px; color: var(--muted); min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat-card > .card-num {
  font-size: 22px;                      /* 不支持容器查询时的兜底 */
  font-size: clamp(16px, 12cqw, 22px);  /* 跟随卡片宽度自适应，长金额不撑破卡片 */
  font-weight: 650; margin-top: 2px; line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; max-width: 100%;
}
.stat-card > .card-num small { font-size: .62em; font-weight: 500; color: var(--muted); margin-left: 3px; }
/* 进度条撑满卡片宽度（stretch 之外的双保险） */
.stat-card > .rate-bar { width: 100%; align-self: stretch; }
/* 末尾副标题贴底：卡片等高时各行基线一致，视觉更整齐 */
.stat-card > .card-label:last-child { margin-top: auto; padding-top: 2px; }
.stat-card.alert > .card-num { color: #b91c1c; }
.stat-card.good > .card-num { color: #047857; }

/* ---------- 面板与工具栏 ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.panel-head h3 { font-size: 14.5px; }
.panel-body { padding: 16px 18px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-2); background: #fbfcfe; }
.toolbar input, .toolbar select { height: 34px; border: 1px solid #d7dae3; border-radius: 8px; padding: 0 10px; font-size: 13px; font-family: inherit; background: #fff; }
.toolbar label { font-size: 12.5px; color: var(--muted); }
/* 横向滚动容器：滚动条常驻可见（macOS 默认 overlay 会隐藏），并在可滚动时给出边缘渐隐提示 */
.table-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #c3c8d4 #f1f3f9;
}
.table-scroll::-webkit-scrollbar { height: 10px; }
.table-scroll::-webkit-scrollbar-track { background: #f1f3f9; }
.table-scroll::-webkit-scrollbar-thumb { background: #c3c8d4; border-radius: 6px; border: 2px solid #f1f3f9; }
.table-scroll::-webkit-scrollbar-thumb:hover { background: #98a2b6; }
/* 右侧可继续滚动时的渐隐提示：背景画在滚动容器上，用 local 附着跟随内容滚动，
   滚动到边缘时阴影自然被自身底色遮住，无需 JS 计算 */
.table-scroll {
  background:
    linear-gradient(to right, #fff 40%, rgba(255,255,255,0)) left center / 24px 100% no-repeat local,
    linear-gradient(to left, #fff 40%, rgba(255,255,255,0)) right center / 24px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(16,24,40,.14), rgba(16,24,40,0)) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(16,24,40,.14), rgba(16,24,40,0)) right center / 12px 100% no-repeat scroll;
}

/* ---------- 紧凑表格 ---------- */
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { background: #fafbfd; text-align: left; padding: 10px 12px; font-weight: 600; color: #4b5563;
  border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12.5px; }
table.grid td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.grid tbody tr:hover { background: #fafbfd; }
table.grid td.ops { white-space: nowrap; }
table.grid td.ops a, table.grid td.ops form { margin-right: 10px; }
table.grid td.ops a:last-child, table.grid td.ops form:last-child { margin-right: 0; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.muted { color: var(--muted); }
.danger-text { color: #b91c1c; }
.ok-text { color: #047857; }

/* ---------- 预警列表 ---------- */
.warn-list { list-style: none; margin: 0; padding: 0; }
.warn-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; min-width: 0; }
.warn-list li:last-child { border-bottom: none; }
.warn-list .tag { font-size: 11.5px; padding: 2px 7px; border-radius: 5px; background: #fef2f2; color: #b91c1c; flex: 0 0 auto; white-space: nowrap; }
/* who / meta 必须允许收缩（min-width:0），否则「楼栋+房间+日期」这类长文本
   不会压缩、直接撑破 li，与右侧金额叠在一起。meta 吃掉剩余空间并省略截断。 */
.warn-list .who { font-weight: 500; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warn-list .meta { color: var(--muted); font-size: 12.5px; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warn-list .go { flex: 0 0 auto; white-space: nowrap; margin-left: auto; color: #2563eb; font-size: 12.5px; }
/* 一行里可能有多个 .go（金额 + 操作链接）：只有第一个吃 auto 外边距，
   否则剩余空间被平分，金额与链接之间裂开一道随机空隙。 */
.warn-list .go ~ .go { margin-left: 0; }
.warn-list .go.num { font-variant-numeric: tabular-nums; }

/* ---------- 房态图 ---------- */
.roommap { display: flex; flex-direction: column; gap: 18px; }
.building-block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.building-head { padding: 12px 18px; background: #fafbfd; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.building-head h3 { font-size: 14.5px; }
.building-head .cnt { font-size: 12.5px; color: var(--muted); }
.floor-row { display: flex; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.floor-row:last-child { border-bottom: none; }
.floor-tag { flex: 0 0 62px; font-size: 12.5px; color: var(--muted); padding-top: 8px; }
.rooms { display: flex; flex-wrap: wrap; gap: 10px; flex: 1; }
.room { width: 136px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; background: #fff; transition: .15s; }
.room:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.room.free { border-left: 3px solid var(--st-free); }
.room.rented { border-left: 3px solid var(--st-busy); background: #f8f9ff; }
.room.repair { border-left: 3px solid var(--st-repair); background: #fffbeb; }
.room.disabled { border-left: 3px solid var(--st-off); background: #f3f4f6; opacity: .75; }
.room .rno { font-weight: 600; font-size: 13.5px; display: flex; justify-content: space-between; align-items: center; }
.room .rmeta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.room .rtenant { font-size: 12px; margin-top: 5px; color: #3730a3; font-weight: 500; }
.beds { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; margin-top: 7px; }
.bed { font-size: 11px; text-align: center; padding: 3px 2px; border-radius: 5px; border: 1px solid var(--line); background: #fff; color: #4b5563; }
.bed.rented { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }
.bed.repair { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.legend { display: flex; gap: 16px; align-items: center; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- 详情键值对 ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 20px; }
.kv .item { display: flex; flex-direction: column; gap: 3px; }
.kv .k { font-size: 12px; color: var(--muted); }
.kv .v { font-size: 13.5px; }

/* ---------- 条形图 ---------- */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 12px; font-size: 13px; min-width: 0; }
.bar-row .bl { flex: 0 0 96px; color: #4b5563; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 轨道吃掉剩余空间；min-width 保证窄屏下不会被压成一条线 */
.bar-track { flex: 1 1 auto; min-width: 60px; height: 18px; background: #f1f3f9; border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 5px; }
.bar-fill.warn { background: #f59e0b; }
.bar-fill.err { background: #ef4444; }
/* 金额列固定宽但可省略：超出 120px 的长金额不再挤压/压过进度条 */
.bar-row .bv {
  flex: 0 0 120px; max-width: 120px; text-align: right;
  font-variant-numeric: tabular-nums; color: #374151;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 打印单据 ---------- */
.print-doc { max-width: 720px; margin: 0 auto; background: #fff; padding: 40px 44px; font-size: 14px; }
.print-doc h1 { text-align: center; font-size: 22px; margin-bottom: 6px; letter-spacing: .04em; }
.print-doc .doc-no { text-align: center; color: #6b7280; font-size: 12.5px; margin-bottom: 26px; }
.print-doc table { width: 100%; border-collapse: collapse; }
.print-doc td, .print-doc th { border: 1px solid #d1d5db; padding: 9px 12px; font-size: 13.5px; }
.print-doc th { background: #f8fafc; text-align: left; width: 130px; color: #4b5563; font-weight: 500; }
.print-doc .sign { display: flex; justify-content: space-between; margin-top: 56px; font-size: 13px; color: #374151; }
.print-doc .amount-cn { font-size: 15px; font-weight: 600; }
.no-print { text-align: center; margin: 18px 0; }

/* ---------- 结算预演 ---------- */
.settle-box { background: #fbfcfe; border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.settle-line { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13.5px; border-bottom: 1px dashed var(--line); }
.settle-line:last-child { border-bottom: none; }
.settle-line.total { font-weight: 650; font-size: 15px; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 12px; }
.settle-line .val { font-variant-numeric: tabular-nums; }

@media print {
  .no-print { display: none; }
  body { background: #fff; }
  .sidebar, .topbar { display: none; }
}
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- 顶栏角色标签 ---------- */
.role-tag {
  padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--accent-tint); color: var(--accent); border: 1px solid rgba(79, 70, 229, .25);
}
.account a.role-link { color: var(--muted); font-size: 13px; }

/* ---------- 驾驶舱 ---------- */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
/* grid-auto-rows:1fr 让所有行等高（此前第 2 行卡片比第 1 行矮一截） */
.dash-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; grid-auto-rows: 1fr; align-items: stretch; }
.dash-cards .card { padding: 14px 16px; margin: 0; height: 100%; box-sizing: border-box; min-width: 0; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.mini-list li:last-child { border-bottom: none; }
.mini-list .grow { flex: 1; min-width: 0; }
.mini-list .sub { font-size: 12px; color: var(--muted); }

/* ---------- 进度条（出租率） ---------- */
.rate-bar { height: 8px; background: #eef0f6; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.rate-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.rate-bar > i.high { background: #10b981; }
.rate-bar > i.low { background: #f59e0b; }

/* ---------- 空态 ---------- */
.tip-line { padding: 10px 14px; background: #f8fafc; border: 1px dashed var(--line); border-radius: 8px; font-size: 12.5px; color: var(--muted); }

/* ---------- 步骤条 ---------- */
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.steps .step { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); padding: 5px 12px; border-radius: 999px; background: #f1f3f9; }
.steps .step.on { background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.steps .step i { font-style: normal; font-weight: 700; }

/* ---------- 操作列吸附右侧 ----------
   宽表横向滚动时，「收款 / 编辑」等高频操作始终可见，不会被挤出视口 */
table.grid th.ops, table.grid td.ops {
  position: sticky; right: 0; z-index: 2;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 10px -8px rgba(16, 24, 40, .18);
}
table.grid th.ops { background: #fafbfd; z-index: 3; }
table.grid tbody tr:hover td.ops { background: #fafbfd; }
/* 容器未溢出时不需要分隔阴影 */
.table-scroll:not(.scroll-left):not(.scroll-right) th.ops,
.table-scroll:not(.scroll-left):not(.scroll-right) td.ops { box-shadow: none; border-left-color: transparent; }

/* ---------- 房源状态统一色板 ----------
   空闲=绿 / 已租=主色 / 维修=橙 / 停用=灰，房态图与列表共用同一语义 */
.badge.free { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge.busy { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; }
.badge.repair { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
/* 图例色块直接引用色板变量，杜绝房态图与列表各写一份十六进制值而走样 */
.legend i.st-free { background: var(--st-free); }
.legend i.st-busy { background: var(--st-busy); }
.legend i.st-repair { background: var(--st-repair); }
.legend i.st-off { background: var(--st-off); }
.legend i.st-base { background: #dbe2f2; }

/* ---------- 房态图卡片等高 ---------- */
.room {
  width: 136px; min-height: 118px;
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; background: #fff; transition: .15s;
}
.room .beds { margin-top: auto; padding-top: 7px; }
.bed.empty { opacity: .5; border-style: dashed; color: #9aa3b6; }
.bed .bed-tip { display: block; font-size: 10px; opacity: .85; }

/* ---------- 双柱对比图（应收为底、实收为前） ---------- */
.bar-track { position: relative; }
.bar-track .bar-fill { position: absolute; left: 0; top: 0; transition: width .25s ease; }
.bar-track .bar-base { position: absolute; left: 0; top: 0; height: 100%; background: #dbe2f2; border-radius: 5px; }
.bar-track .bar-fill.real { background: var(--accent); }
.bar-track .bar-fill.real.low { background: #f59e0b; }
/* 零值占位条：保证"实收为 0"的月份也有可见标记，而不是整格空白 */
.bar-zero { position: absolute; left: 0; top: 0; width: 3px; height: 100%; background: #94a3b8; border-radius: 2px; }

/* ---------- 增强分页 ---------- */
.pager { flex-wrap: wrap; }
.pager .pages { display: flex; gap: 6px; }
.pager .pages a, .pager .pages .cur, .pager .pages .gap {
  min-width: 32px; text-align: center; padding: 7px 9px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 13px; color: var(--accent); background: #fff;
}
.pager .pages .cur { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pager .pages .gap { border: none; color: var(--muted); background: transparent; cursor: default; }
.pager .pages a:hover { background: var(--accent-tint); }
.pager .size { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.pager .size select { height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-size: 13px; background: #fff; color: var(--text); }
.pager .jump { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.pager .jump input {
  width: 56px; height: 32px; border: 1px solid var(--line); border-radius: 8px;
  padding: 0 8px; font-size: 13px; text-align: center; font-family: inherit;
}

/* ---------- 表格数字列 ---------- */
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td .sub { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }

/* ---------- 窄屏紧凑模式 ----------
   1024 宽度下内容区仅约 998px，默认 12px 单元格内边距会让 10 列表格溢出。
   这里收窄内边距、压缩卡片与工具栏，换取一屏内看全主要列 */
@media (max-width: 1200px) {
  table.grid th, table.grid td { padding-left: 8px; padding-right: 8px; }
  .content { padding: 20px 18px; }
  .toolbar { padding: 12px; gap: 8px; }
  .dash-cards { gap: 10px; }
  .dash-cards .card { padding: 12px 13px; }
  .stat-card .card-num { font-size: 21px; }
  .room { width: 124px; }
  .bar-row .bv { flex: 0 0 96px; font-size: 12.5px; }
}
@media (max-width: 1100px) {
  table.grid th, table.grid td { padding-left: 6px; padding-right: 6px; }
  table.grid .mono { font-size: 12px; }
}
