:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warn: #f59e0b;
  --warn-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 4px 14px rgba(15,23,42,.06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.app { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 220px; flex-shrink: 0;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #cbd5e1; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { padding: 22px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand h1 { font-size: 18px; color: #fff; letter-spacing: 1px; }
.brand p { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; margin-bottom: 4px; border-radius: 10px;
  cursor: pointer; color: #cbd5e1; transition: all .15s; user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.4); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-foot { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #64748b; }

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 16px; position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 17px; }
.topbar-right { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; flex: 1 1 auto; justify-content: flex-end; min-width: 0; }

/* 顶栏楼栋切换：紧凑高度，与标题行对齐 */
.topbar .field label { margin-bottom: 0; font-size: 12px; }
.topbar .sel-wrap { width: auto; min-width: 110px; }
.topbar select {
  padding: 0 10px;
  font-size: 13px;
  border-radius: 7px;
  height: 30px;
}
.topbar .sel-trigger {
  padding: 0 10px;
  font-size: 13px;
  border-radius: 7px;
  height: 30px;
  width: auto;
}
.topbar .btn {
  height: 30px;
  display: inline-flex;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
}
.topbar .top-nav-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.status { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--success); box-shadow: 0 0 0 4px var(--success-bg); }
.dot.bad { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-bg); }
.content { padding: 24px; flex: 1; }

/* ---------- 卡片/网格 ---------- */
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat-card .label { font-size: 12px; color: var(--muted); }
.stat-card .value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat-card .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-card.accent { border-top: 3px solid var(--primary); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 22px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h3 { font-size: 15px; }
.card-body { padding: 20px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #f8fafc; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* ---------- 徽章 ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.green { background: var(--success-bg); color: var(--success); }
.badge.orange { background: var(--warn-bg); color: #b45309; }
.badge.red { background: var(--danger-bg); color: var(--danger); }
.badge.gray { background: #f1f5f9; color: var(--muted); }
.badge.blue { background: #eff6ff; color: var(--primary); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 9px; border: 1px solid transparent;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; background: var(--card);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { border-color: var(--border); color: var(--text); background: #fff; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { border-color: #fecaca; color: var(--danger); background: #fff; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input, .field select {
  width: 100%; min-width: 0;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px;
  font-size: 14px; outline: none; background: #fff;
  transition: border-color .18s, box-shadow .18s, background-color .18s;
}
.field input:hover, .field select:hover { border-color: #cbd5e1; }
.field input:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.field select { appearance: none; -webkit-appearance: none; -moz-appearance: none; cursor: pointer; padding-right: 34px; background-color: #fff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; }
.field select:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.08); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
.field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.14); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
.field select:disabled { background-color: #f8fafc; color: var(--muted); cursor: not-allowed; }
.field select option { background: #fff; color: var(--text); font-size: 13px; padding: 8px 10px; }
.field select option:hover, .field select option:checked { background: #eff6ff; color: var(--primary); font-weight: 600; }
.field input[type="date"], .field input[type="month"] { appearance: none; -webkit-appearance: none; position: relative; padding-right: 34px; background-color: #fff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 15px; }
.field input[type="date"]::-webkit-calendar-picker-indicator, .field input[type="month"]::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.field input[type="date"]:hover, .field input[type="month"]:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.08); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E"); }
.field input[type="date"]:focus, .field input[type="month"]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.14); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E"); }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row .btn { margin-top: 22px; }

/* 楼栋弹窗行：无 label 的输入框行，按钮与输入框同高（去掉 .form-row .btn 的上偏移） */
.bd-row { align-items: stretch; }
.bd-row .btn { margin-top: 0; }

/* 与按钮同高的下拉框：select 带 sel-btn 类时 picker.js 会传播到包装层（.sel-wrap.sel-btn），
   触发器与 .btn 按钮同高（35px）。用于页面筛选行（房间状态筛选、入住退租房间筛选） */
.sel-wrap.sel-btn .sel-trigger {
  height: 35px;
  padding: 0 12px;
  font-size: 13px;
  line-height: 1;
}

/* 收款弹窗金额行：按钮与输入框自动同高、垂直居中（不受 .form-row 的按钮上边距影响） */
.pay-row { display: flex; gap: 8px; align-items: stretch; }
.pay-row input { flex: 1; }
.pay-row .btn {
  margin-top: 0; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px 14px;
}

/* 白名单标签输入（鉴权配置） */
.tag-input {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 9px; padding: 6px 8px;
  background: #fff; cursor: text;
  transition: border-color .18s, box-shadow .18s;
}
.tag-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: #eff6ff; color: var(--primary); border-radius: 999px;
  padding: 3px 10px; font-size: 13px; font-weight: 600;
}
.tag-x {
  cursor: pointer; border: none; background: none; color: var(--primary);
  font-size: 15px; line-height: 1; padding: 0 1px;
}
.tag-x:hover { color: var(--danger); }
.tag-input input {
  flex: 1; min-width: 130px; border: none; outline: none;
  font-size: 14px; padding: 4px 2px; background: transparent;
}

/* ---------- 自定义下拉选择框 ---------- */
.sel-wrap { position: relative; width: 100%; min-width: 0; }
.sel-native { display: none; }
.sel-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px;
  font-size: 14px; color: var(--text); background: #fff; cursor: pointer; text-align: left;
  font-family: inherit; line-height: 1.4;
  transition: border-color .18s, box-shadow .18s, background-color .18s;
}
.sel-trigger:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.sel-trigger:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.sel-trigger.open { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.sel-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-chevron { width: 14px; height: 14px; flex-shrink: 0; color: var(--muted); transition: transform .2s, color .2s; }
.sel-trigger.open .sel-chevron { transform: rotate(180deg); color: var(--primary); }
.sel-menu {
  position: fixed; z-index: 300; max-width: 340px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15,23,42,.16), 0 2px 8px rgba(15,23,42,.06);
  padding: 6px; max-height: 280px; overflow-y: auto;
  animation: pop-in .16s ease;
}
.sel-option {
  display: flex; align-items: center; width: 100%;
  padding: 9px 12px; border: none; border-radius: 8px; background: none;
  font-size: 13px; color: var(--text); text-align: left; cursor: pointer;
  transition: background .12s, color .12s;
}
.sel-option:hover { background: var(--bg); }
.sel-option:focus-visible { outline: none; background: var(--bg); }
.sel-option.selected { background: #eff6ff; color: var(--primary); font-weight: 600; }
.sel-option.disabled { color: var(--muted); opacity: .55; cursor: not-allowed; }
.sel-option.disabled:hover { background: none; }

/* ---------- 日期 / 月份选择弹窗 ---------- */
.picker-popup {
  position: fixed; z-index: 300; width: 280px;
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15,23,42,.18), 0 2px 8px rgba(15,23,42,.06);
  padding: 14px; max-height: calc(100vh - 16px); overflow-y: auto;
  animation: pop-in .16s ease;
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.picker-nav-btn {
  width: 28px; height: 28px; border-radius: 8px; border: none; background: transparent;
  color: var(--muted); font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.picker-nav-btn:hover { background: var(--bg); color: var(--text); }
.picker-title { flex: 1; text-align: center; font-size: 14px; font-weight: 700; }
.picker-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.picker-grid.months { grid-template-columns: repeat(3, 1fr); gap: 4px; }
.picker-week { color: var(--muted); font-size: 11px; text-align: center; padding: 4px 0; font-weight: 600; }
.picker-cell {
  height: 32px; border: none; border-radius: 8px; background: transparent; cursor: pointer;
  font-size: 13px; color: var(--text); font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.picker-cell:hover { background: var(--bg); }
.picker-cell.blank { cursor: default; }
.picker-cell.selected { background: var(--primary); color: #fff; font-weight: 600; }
.picker-cell.today { color: var(--primary); font-weight: 700; }
.picker-cell.today.selected { color: #fff; }
.picker-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
.picker-foot-btn {
  border: none; background: none; font-size: 12px; color: var(--muted); cursor: pointer;
  padding: 6px 8px; border-radius: 7px; font-family: inherit;
  transition: background .12s, color .12s;
}
.picker-foot-btn:hover { background: var(--bg); color: var(--primary); }
.picker-foot-btn.primary { color: var(--primary); font-weight: 600; }
.field input[type="date"].pickable, .field input[type="month"].pickable { cursor: pointer; }

/* ---------- 抄表列表行内度数编辑 ---------- */
.meter-edit-input {
  width: 96px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 13px; outline: none; background: #fff; color: var(--text);
  transition: border-color .18s, box-shadow .18s;
}
.meter-edit-input:hover { border-color: #cbd5e1; }
.meter-edit-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }

/* ---------- 房间卡片网格 ---------- */
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.room-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; position: relative; transition: transform .15s, box-shadow .15s; }
.room-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,23,42,.1); }
.room-card .rname { font-size: 17px; font-weight: 700; }
.room-card .rstatus { position: absolute; top: 16px; right: 16px; }
.room-card .rinfo { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0; font-size: 12px; color: var(--muted); }
.room-card .rtenant { background: #f8fafc; border: 1px dashed var(--border); border-radius: 10px; padding: 10px 12px; margin-top: 8px; font-size: 13px; }
.room-card .raction { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; }
/* 读数面板：水/电两块并排，当前读数大字 + 入住起始读数小字 */
.room-card .rmeters { display: flex; gap: 10px; margin: 10px 0 12px; }
.room-card .rmeter { flex: 1; min-width: 0; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.room-card .rmeter-label { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.room-card .rmeter-val { font-size: 20px; font-weight: 700; line-height: 1.35; font-variant-numeric: tabular-nums; }
.room-card .rmeter.water .rmeter-val { color: var(--primary); }
.room-card .rmeter.electric .rmeter-val { color: var(--warn); }
.room-card .rmeter-init { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------- 模态框 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 20px; backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility 0s linear .25s;
}
.modal-mask.show { opacity: 1; visibility: visible; transition: opacity .25s ease; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; overflow-x: hidden; box-shadow: 0 24px 60px rgba(15,23,42,.3); opacity: 0; transform: translateY(22px) scale(.95); transition: transform .32s cubic-bezier(.34,1.56,.64,1), opacity .26s ease; }
/* 租客弹窗含租约（房间/押金/日期/水表电表起始值/在住/删除），加宽展示 */
#tenant-modal .modal { max-width: 820px; }
.modal-mask.show .modal { opacity: 1; transform: translateY(0) scale(1);}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.confirm-box { max-width: 380px; }
.mval { width: 100%; min-width: 0; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; background: #fff; transition: border-color .18s, box-shadow .18s; }
.mval:disabled { background: #f8fafc; color: var(--muted); cursor: not-allowed; }
.row-muted td { color: var(--muted); }
.mval:hover { border-color: #cbd5e1; }
.mval:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }

/* ---------- 提示 ---------- */
#toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 20px; border-radius: 999px; font-size: 13px; font-weight: 600; color: #fff; box-shadow: 0 8px 24px rgba(15,23,42,.25); animation: toast-in .25s ease; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }

.page { display: none; }
.page.active { display: block; animation: page-in .3s ease; }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.empty { text-align: center; padding: 40px 0; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.mono { font-family: "Consolas", "SFMono-Regular", monospace; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

/* ---------- 租客多房间 ---------- */
.lease-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 16px 0 8px; }
.lease-title { font-size: 14px; font-weight: 700; }
.lease-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  background: var(--bg);
  animation: lease-in .28s ease;
}
@keyframes lease-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.lr-active { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text); white-space: nowrap; padding-bottom: 8px; cursor: pointer; }
.lr-active input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.lr-del { margin-bottom: 6px; }
/* 退租弹窗每房间一行：房间名 + 两个读数输入框 + 退租按钮（不用 .lease-row 的 7 列网格） */
.vr-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  background: var(--bg);
}
.vr-row .vr-name {
  flex: 0 0 auto;
  min-width: 76px;
  max-width: 120px;
  align-self: center;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vr-row .field { flex: 0 1 112px; min-width: 104px; max-width: 132px; }
.vr-row .btn { flex: 0 0 auto; height: 34px; margin-bottom: 0; white-space: nowrap; }
.troom { display: inline-flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; margin: 2px 6px 2px 0; font-size: 13px; flex-wrap: wrap; }

/* 入住弹窗：租客搜索组合框（输入即过滤，焦点不转移） */
.mi-combo { position: relative; }
.mi-combo-menu {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 80;
  background: #fff; border: 1px solid var(--border); border-radius: 9px;
  max-height: 240px; overflow-y: auto; box-shadow: 0 8px 24px rgba(15,23,42,.12);
  padding: 4px;
}
.mi-combo-item { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text); }
.mi-combo-item:hover { background: #eff6ff; color: var(--primary); }
.mi-combo-item.new { color: var(--primary); font-weight: 600; }
.mi-combo-item.empty { color: var(--muted); cursor: default; }
.mi-combo-item .sub { color: var(--muted); font-size: 12px; margin-left: 6px; }
@media (max-width: 700px) {
  .lease-row { grid-template-columns: 1fr 1fr; }
  .lease-row .lr-room { grid-column: 1 / -1; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; }
  .brand { padding: 12px 16px; border-bottom: none; }
  .nav { display: flex; gap: 4px; padding: 8px; overflow-x: auto; }
  .nav-item { white-space: nowrap; padding: 8px 12px; }
  .nav-item span.txt { display: none; }
  .sidebar-foot { display: none; }
  .content { padding: 16px; }
  /* 窄屏（手机）：顶栏换行排列，控件不再挤压叠加 */
  .topbar { padding: 10px 16px; }
  .topbar-right { width: 100%; justify-content: flex-start; }
  .topbar .status { margin-left: auto; }
}
@media (max-width: 640px) {
  .topbar h2 { font-size: 15px; }
  .topbar .sel-wrap { min-width: 0; }
  .topbar .btn { padding-left: 10px; padding-right: 10px; }
}
