/* 出租房管理系统 - 样式（参考 V2.html） */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  height: 100%;
}
body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  background: #f5f7fb;
  color: #1e293b;
  line-height: 1.5;
  height: 100vh;
  height: 100dvh;
  display: flex;
  font-size: 14px;
  overflow: hidden;
  -webkit-tap-highlight-color: rgba(15, 23, 42, 0.08);
}
.sidebar-backdrop {
  display: none;
}
.menu-toggle {
  display: none;
}
.mobile-tabbar {
  display: none;
}
.sidebar {
  width: 260px;
  background: #0f172a;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0,0,0,0.06);
  flex-shrink: 0;
}
.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #334155;
}
.sidebar-header i { font-size: 28px; color: #38bdf8; }
.sidebar-header span { font-size: 18px; font-weight: 700; color: white; letter-spacing: 0.5px; }
.sidebar-menu {
  flex: 1;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 500;
  color: #cbd5e1;
  transition: all 0.15s;
  cursor: pointer;
}
.menu-item i { width: 22px; text-align: center; font-size: 1.1rem; }
.menu-item.active { background: #1e293b; color: white; }
.menu-item:not(.active):hover { background: #1e293b; color: #f1f5f9; }
.menu-group { border-radius: 12px; }
.menu-group-toggle {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.menu-group-toggle > span { display: flex; align-items: center; gap: 12px; }
.menu-group-toggle > span > i { width: 22px; text-align: center; }
.menu-group-toggle:hover,
.menu-group.open > .menu-group-toggle { background: #172033; color: #fff; }
.menu-chevron { font-size: 12px; transition: transform 0.15s; }
.menu-group.open .menu-chevron { transform: rotate(180deg); }
.submenu {
  display: none;
  padding: 4px 0 4px 26px;
}
.menu-group.open .submenu { display: flex; flex-direction: column; gap: 4px; }
.submenu-item {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 10px;
  font-weight: 500;
}
.submenu-item::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #64748b;
}
.submenu-item.active::before { background: #38bdf8; }
.sidebar-footer {
  padding: 24px 20px;
  border-top: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #94a3b8;
}
.footer-name { color: white; font-weight: 500; display: block; }
.footer-desc { font-size: 12px; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: #f8fafc;
}
.top-nav {
  background: white;
  padding: 0 32px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 40;
}
.page-title { font-size: 20px; font-weight: 600; color: #0f172a; display: flex; align-items: center; gap: 12px; }
.page-title i { color: #2563eb; }
.user-area { display: flex; align-items: center; }
.avatar {
  width: 40px;
  height: 40px;
  background: #e2e8f0;
  border-radius: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1e293b;
  font-weight: 600;
}
.content { padding: 28px 32px; display: flex; flex-direction: column; gap: 28px; min-width: 0; }

.page { display: none; flex-direction: column; gap: 24px; min-width: 0; }
.page.active { display: flex; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.stat-card {
  background: white;
  border-radius: 20px;
  padding: 22px 20px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.02);
  border: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stat-left h4 { font-size: 14px; font-weight: 500; color: #64748b; margin-bottom: 8px; }
.stat-left .number { font-size: 32px; font-weight: 700; color: #0f172a; }
.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.quick-actions {
  background: white;
  border-radius: 20px;
  padding: 20px 28px;
  display: flex;
  align-items: center;
  gap: 40px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 4px 8px rgba(0,0,0,0.02);
  flex-wrap: wrap;
}
.action-item {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 500;
  color: #1e293b;
  padding: 6px 12px;
  border-radius: 40px;
  cursor: pointer;
  transition: 0.1s;
}
.action-item i {
  width: 38px;
  height: 38px;
  background: #eef2ff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4f46e5;
  font-size: 1.1rem;
}
.action-item:hover { background: #f1f5f9; }
.divider { width: 1px; height: 30px; background: #e2e8f0; }

.row-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.panel {
  background: white;
  border-radius: 20px;
  padding: 20px 0;
  border: 1px solid #f1f5f9;
  box-shadow: 0 4px 8px rgba(0,0,0,0.02);
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 16px 20px;
  border-bottom: 1px solid #f1f5f9;
}
.panel-header h3 { font-weight: 600; font-size: 16px; color: #0f172a; display: flex; align-items: center; gap: 8px; }
.panel-header h3 i { color: #4f46e5; }
.more-link { color: #64748b; font-size: 13px; font-weight: 500; cursor: pointer; }
.more-link:hover { color: #0f172a; }

.list-row {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid #f8fafc;
}
.list-row:last-child { border-bottom: none; }
.room-badge {
  background: #f1f5f9;
  border-radius: 40px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}
.status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 40px;
  font-weight: 600;
}
.status.rented, .status.paid { background: #dcfce7; color: #166534; }
.status.free, .status.vacant { background: #ffe4e6; color: #b91c1c; }
.status.maintenance { background: #e0e7ff; color: #3730a3; }
.status.pending { background: #fff3cd; color: #856404; }
.status.overdue { background: #fee2e2; color: #b91c1c; }
.status.partial { background: #fef3c7; color: #92400e; }
.status.upcoming { background: #ede9fe; color: #5b21b6; }

.btn {
  background: #0f172a;
  color: white;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 40px;
  font-size: 13px;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: 0.1s;
  text-decoration: none;
}
.btn:hover { background: #1e293b; }
.btn-outline { background: white; color: #0f172a; border: 1px solid #cbd5e1; }
.btn-outline:hover { background: #f8fafc; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-danger { background: #b91c1c; }
.btn-danger:hover { background: #991b1b; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 14px 20px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  background: #f8fafc;
}
.data-table td {
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}
.data-table tr:hover td { background: #fafafa; }
.badge {
  padding: 4px 12px;
  border-radius: 40px;
  font-size: 12px;
  font-weight: 600;
}
.badge.success { background: #dcfce7; color: #166534; }
.badge.warning { background: #fff3cd; color: #856404; }
.badge.secondary { background: #f1f5f9; color: #334155; }
.badge.danger { background: #fee2e2; color: #b91c1c; }

.action-link { color: #2563eb; cursor: pointer; font-weight: 500; }
.action-link:hover { text-decoration: underline; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.toolbar label { font-weight: 500; color: #475569; }
.toolbar input[type="text"],
.toolbar input[type="number"],
.toolbar input[type="date"],
.toolbar input[type="month"],
.toolbar select {
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 14px;
}
.filter-group { display: flex; gap: 8px; align-items: center; }

.toolbar-utility {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar-utility .toolbar-label {
  font-weight: 600;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.toolbar-utility .toolbar-label i { color: #2563eb; }
.toolbar-utility .form-control-inline {
  min-width: 88px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 14px;
  background: #fff;
  cursor: pointer;
}
.toolbar-utility .form-control-inline:hover { border-color: #94a3b8; }
.toolbar-utility .toolbar-sep {
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
}
.toolbar-utility .form-control-month {
  min-width: 140px;
}
.utility-unit-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid #e2e8f0;
}
.utility-unit-group .utility-unit-input {
  width: 92px;
  min-width: 92px;
  cursor: text;
}
.toolbar-bills {
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
}
.toolbar-bills .view-tabs {
  flex-shrink: 0;
  margin-bottom: 2px;
}
.toolbar-bills .view-tab i {
  margin-right: 6px;
}
.toolbar-bills .filter-sheet {
  flex: 1 1 520px;
  min-width: 0;
}
.toolbar-bills .filter-group {
  flex-wrap: wrap;
  min-width: 0;
  flex: 1 1 520px;
  align-items: flex-end;
  gap: 12px;
}
.bills-compact-bar,
.bills-active-chips,
.filter-sheet-backdrop,
.filter-sheet-handle,
.filter-sheet-header,
.filter-sheet-footer,
.filter-item-presets {
  display: none;
}
.filter-item-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  line-height: 1.2;
}
.filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 1 auto;
}
.filter-item label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  line-height: 1.2;
}
.filter-item select,
.filter-item .month-picker-trigger {
  min-width: 120px;
  width: 148px;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 14px;
  background: #fff;
  color: #1e293b;
  box-sizing: border-box;
}
.filter-item .month-picker-trigger {
  text-align: left;
  cursor: pointer;
}
.filter-item-action .btn {
  min-width: 88px;
}
.table-scroll {
  overflow-x: auto;
}
.bill-table.data-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}
.bill-table th,
.bill-table td {
  white-space: nowrap;
  vertical-align: middle;
}
.bill-table thead th.col-actions,
.bill-table .col-actions {
  position: sticky;
  right: 0;
  background: #f8fafc;
  box-shadow: -6px 0 8px -6px rgba(15, 23, 42, 0.12);
}
.bill-table tbody td.col-actions {
  background: #fff;
}
.bill-table tbody tr:hover td.col-actions {
  background: #fafafa;
}
.bill-list-wrap {
  padding: 0 16px;
}
.bill-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bill-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 24px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
}
.bill-item-who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  position: relative;
}
.bill-item-who .room-badge {
  flex-shrink: 0;
}
.bill-item-tenant {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  word-break: break-word;
}
.bill-item-who .bill-type-tag {
  margin-left: 0;
}
.bill-item-meta {
  margin-top: 6px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.6;
  word-break: break-word;
}
.bill-item-fees {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  font-size: 13px;
  color: #334155;
}
.bill-item-fees span {
  white-space: nowrap;
}
.bill-item-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px 18px;
}
.bill-item-money {
  text-align: right;
  min-width: 108px;
}
.bill-item-money .bill-item-total {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}
.bill-item-money .bill-item-total-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}
.bill-item-money .bill-item-paid {
  font-size: 12px;
  color: #64748b;
}
.bill-item-flags {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.bill-item-overdue {
  font-size: 12px;
  font-weight: 600;
  color: #b91c1c;
}
.bill-item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-width: 72px;
}
.bill-item-actions .bill-pay-btn {
  min-height: 36px;
  padding: 8px 16px;
}
.bill-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.bill-void-btn,
.bill-void-voucher-btn,
.bill-adjust-btn {
  color: #475569;
  border-color: #cbd5e1;
  background: #fff;
  min-height: 36px;
  padding: 8px 14px;
}
.bill-void-btn:hover,
.bill-void-voucher-btn:hover {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}
.bill-adjust-btn:hover {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}
.bill-table .col-actions {
  white-space: nowrap;
}
.bill-table .bill-void-btn,
.bill-table .bill-adjust-btn {
  min-height: 32px;
  padding: 4px 12px;
}
@media (max-width: 900px) {
  .bill-item {
    grid-template-columns: 1fr;
    position: relative;
  }
  .bill-item-side {
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
  }
  .bill-item-money,
  .bill-item-flags {
    text-align: left;
    align-items: flex-start;
  }
  .bill-item-actions {
    width: 100%;
    margin-left: 0;
    justify-content: stretch;
  }
  .bill-item-actions .bill-pay-btn,
  .bill-item-actions .bill-void-btn,
  .bill-item-actions .bill-void-voucher-btn,
  .bill-item-actions .bill-adjust-btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }
}
.utility-table-wrap {
  overflow-x: auto;
}
.utility-table {
  min-width: 860px;
}
.toolbar-hint {
  font-size: 12px;
  color: #94a3b8;
  margin-left: 8px;
}
.bill-pay-summary {
  margin: 0 0 16px 0;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 13px;
  color: #334155;
}
.bill-pay-summary p {
  margin: 0 0 6px 0;
}
.bill-pay-summary p:last-child {
  margin-bottom: 0;
  font-weight: 600;
  color: #0f172a;
}
.pay-layout, .checkout-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}
.pay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}
.pay-grid .form-group { margin-bottom: 0; }
.settle-box {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}
.settle-box h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: #475569;
}
.settle-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 4px 0;
  color: #334155;
}
.settle-row.total {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed #cbd5e1;
  font-weight: 700;
  color: #0f172a;
}
.settle-row.emphasis { color: #b91c1c; font-weight: 700; }
.settle-row.refund { color: #15803d; font-weight: 700; }
.receipt-preview-card {
  background: #fff8f6;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}
.receipt-preview-card canvas {
  width: 100%;
  height: auto;
  background: #fff;
  border-radius: 6px;
}
.receipt-preview-card p {
  margin: 8px 0 0;
  font-size: 12px;
  color: #9f1239;
}
.meter-hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.55;
}
.meter-entry-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 14px;
  font-size: 13px;
}
.meter-entry-table th,
.meter-entry-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #e2e8f0;
  text-align: right;
}
.meter-entry-table th:first-child,
.meter-entry-table td:first-child {
  text-align: left;
  white-space: nowrap;
}
.meter-entry-table th {
  color: #64748b;
  font-weight: 600;
  font-size: 12px;
}
.meter-entry-table .form-control {
  width: 100%;
  min-width: 72px;
  padding: 4px 6px;
}
.meter-entry-table .meter-ro {
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.voucher-view { text-align: center; }
.voucher-view img {
  max-width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}
.voucher-paid-badge {
  margin: 0 0 10px;
  color: #15803d;
  font-weight: 600;
}
.receipt-preview-card img {
  max-width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}
.voucher-actions { margin-top: 12px; }
.bill-type-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  background: #eef2ff;
  color: #4338ca;
  font-weight: 600;
}
.bill-type-tag.checkout { background: #fff7ed; color: #c2410c; }
.checkout-bills-mini {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}
.checkout-bills-mini th, .checkout-bills-mini td {
  padding: 4px 6px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}
.bill-util-hint {
  font-size: 12px;
  color: #b45309;
  margin-left: 4px;
}
.panel-utility .panel-header {
  padding: 0 20px 16px 20px;
}
.utility-month-label {
  font-size: 14px;
  font-weight: 600;
  color: #2563eb;
}
.utility-table .form-control {
  width: 100%;
  max-width: 120px;
}
.toolbar-dates .toolbar-label { font-weight: 600; color: #475569; }
.toolbar-dates .form-control-inline { min-width: 140px; }
.toolbar-dates .toolbar-sep { color: #64748b; font-weight: 500; }
.toolbar-single-row { flex-wrap: nowrap; align-items: center; gap: 12px; }
.toolbar-single-row .toolbar-label { white-space: nowrap; min-width: 5em; }
.toolbar-single-row .month-picker-wrap { flex-shrink: 0; }
.toolbar-single-row .form-control-inline { flex-shrink: 0; }
.toolbar-single-row input[type="date"] { width: 130px; min-width: 130px; max-width: 140px; box-sizing: border-box; }
.toolbar-single-row .month-picker-trigger { min-width: 108px; }
.toolbar-single-row select.form-control-inline { min-width: 88px; width: 88px; }
.toolbar-single-row .report-room-select { min-width: 88px; width: auto; }

/* 月份选择器：触发器 + 弹层（年+箭头+3×4 网格） */
.month-picker-wrap { position: relative; display: inline-block; }
.month-picker-trigger {
  min-width: 140px;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 14px;
  background: #fff;
  color: #1e293b;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s;
}
.month-picker-trigger:hover { border-color: #94a3b8; }
.month-picker-trigger:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2); }
.month-picker-trigger[aria-expanded="true"] { border-color: #2563eb; }

.month-picker-popover {
  position: fixed;
  z-index: 1100;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  border: 1px solid #e2e8f0;
  padding: 16px;
  min-width: 280px;
}
.month-picker-popover[hidden] { display: none !important; }
.month-picker-year-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.month-picker-year-text {
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
}
.month-picker-nav {
  width: 32px;
  height: 32px;
  border: none;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 16px;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.month-picker-nav:hover { background: #e2e8f0; color: #0f172a; }
.month-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.month-picker-cell {
  padding: 10px 8px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
  background: #f8fafc;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.month-picker-cell:hover { background: #e2e8f0; color: #0f172a; }
.month-picker-cell.selected { background: #2563eb; color: #fff; }
.month-picker-cell.selected:hover { background: #1d4ed8; color: #fff; }

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.show { display: flex; }
.modal-content {
  background: white;
  border-radius: 28px;
  width: 480px;
  max-width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 32px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.modal-content.modal-wide { width: 720px; }
.modal-content.modal-xl { width: 920px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { font-size: 20px; font-weight: 700; }
.close-btn { font-size: 24px; cursor: pointer; color: #64748b; }
.close-btn:hover { color: #0f172a; }
.form-section { margin-bottom: 24px; }
.form-section:last-of-type { margin-bottom: 20px; }
.form-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-section-title i { color: #2563eb; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 8px; color: #1e293b; }
.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  font-size: 14px;
}
.form-actions { display: flex; justify-content: flex-end; gap: 16px; margin-top: 28px; }

/* 入住分步向导 */
.checkin-wizard { min-height: 360px; }
.wizard-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}
.wizard-step {
  position: relative;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
}
.wizard-step-number {
  width: 34px;
  height: 34px;
  margin: 0 auto 6px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wizard-step.active { color: #1d4ed8; }
.wizard-step.active .wizard-step-number { border-color: #2563eb; background: #2563eb; color: #fff; }
.wizard-step.done { color: #166534; }
.wizard-step.done .wizard-step-number { border-color: #16a34a; background: #dcfce7; color: #166534; }
.wizard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.wizard-grid .form-group.full { grid-column: 1 / -1; }
.wizard-tip {
  padding: 12px 14px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: #eff6ff;
  color: #1e40af;
  font-size: 14px;
}
.wizard-review {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.wizard-review-item {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
}
.wizard-review-item strong { display: block; margin-bottom: 4px; color: #475569; font-size: 12px; }
.wizard-back { margin-top: 12px; }

@media (max-width: 760px) {
  .wizard-grid, .wizard-review { grid-template-columns: 1fr; }
  .wizard-grid .form-group.full { grid-column: auto; }
  .wizard-step { font-size: 11px; }
  .modal-content.modal-wide,
  .modal-content.modal-xl { width: 95%; padding: 22px 20px; }
  .pay-layout, .checkout-layout { grid-template-columns: 1fr; }
}

.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.toast {
  background: #0f172a;
  color: white;
  padding: 14px 24px;
  border-radius: 40px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  animation: slideIn 0.2s ease;
}
.toast i { color: #38bdf8; }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.text-muted { color: #64748b; font-size: 13px; }
.empty-tip { padding: 40px 20px; text-align: center; color: #94a3b8; }

/* 经营报表：缩小扇形图、优化展示 */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.analytics-panel {
  display: flex;
  flex-direction: column;
}
.analytics-panel-header {
  flex-shrink: 0;
}
.analytics-panel-header h3 { font-size: 15px; }
.analytics-summary {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}
.analytics-hint {
  margin: 0 20px 16px;
  padding-top: 8px;
  font-size: 12px;
  color: #94a3b8;
  border-top: 1px solid #f1f5f9;
}
.chart-wrap {
  padding: 12px 20px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chart-wrap-small {
  min-height: 0;
  width: 220px;
  height: 220px;
  margin: 0 auto;
  padding: 8px 0 16px;
}
.chart-wrap-small canvas {
  display: block;
  margin: 0 auto;
}
.chart-wrap canvas { max-width: 100%; }
.drilldown-panel {
  margin-top: 24px;
  border: 1px solid #e2e8f0;
}
.drilldown-panel .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drilldown-tabs {
  display: flex;
  gap: 4px;
  padding: 0 20px 12px;
  border-bottom: 1px solid #f1f5f9;
}
.drilldown-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 14px;
  cursor: pointer;
  border-radius: 8px;
}
.drilldown-tab:hover { color: #0f172a; background: #f8fafc; }
.drilldown-tab.active { color: #4f46e5; font-weight: 600; background: #eef2ff; }
.drilldown-content {
  padding: 20px;
  max-height: 360px;
  overflow: auto;
}
.btn-sm { padding: 6px 12px; font-size: 13px; }

.rent-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.rent-legend-item {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.rent-matrix-wrap { overflow-x: auto; }
.rent-matrix {
  border-collapse: separate;
  border-spacing: 4px;
  min-width: 100%;
}
.rent-matrix th {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
  padding: 6px 4px;
  text-align: center;
  white-space: nowrap;
}
.rent-matrix th.room-col,
.rent-matrix td.room-cell {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  text-align: left;
  min-width: 72px;
  padding: 6px 8px;
}
.rent-matrix td.room-cell {
  font-weight: 600;
  cursor: pointer;
  color: #334155;
}
.rent-matrix td.room-cell:hover,
.rent-matrix td.room-cell.is-active { color: #4f46e5; }
.rent-matrix .cell {
  min-width: 76px;
  height: 54px;
  border-radius: 8px;
  font-size: 11px;
  text-align: center;
  padding: 6px 4px;
  cursor: pointer;
  line-height: 1.35;
  vertical-align: middle;
}
.rent-matrix .cell strong { display: block; font-size: 12px; }
.rent-matrix .cell.is-active { outline: 2px solid #4f46e5; }
.cell-paid { background: #dcfce7; color: #166534; }
.cell-partial { background: #fef3c7; color: #92400e; }
.cell-overdue { background: #fee2e2; color: #b91c1c; }
.cell-pending { background: #e0f2fe; color: #075985; }
.cell-upcoming { background: #ede9fe; color: #5b21b6; }
.cell-vacant { background: #f1f5f9; color: #94a3b8; }
.chart-wrap-bar {
  min-height: 220px;
  height: 240px;
  padding: 8px 16px 16px;
}
.chart-wrap-line {
  min-height: 280px;
  height: 320px;
  padding: 8px 16px 8px;
}
.chart-wrap-hbar {
  min-height: 200px;
  height: 260px;
  padding: 8px 16px 16px;
}
.util-row,
#rentDrilldownTable tr[data-bill-id] { cursor: pointer; }
.util-row.is-active td { background: #eef2ff; }
.util-incomplete { color: #b91c1c; font-weight: 600; }

/* 历史台账导入 */
.import-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}
.import-guide,
.import-upload {
  padding-bottom: 22px;
}
.import-guide > p,
.import-upload > p {
  margin: 0 20px 18px;
  color: #64748b;
  line-height: 1.7;
}
.import-guide > .btn,
.import-upload > .form-control,
.import-upload > .import-actions {
  margin-left: 20px;
  margin-right: 20px;
}
.import-upload > .form-control {
  width: calc(100% - 40px);
}
.import-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.import-result-panel {
  overflow: hidden;
}
.import-status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.import-status.is-ready { color: #15803d; background: #dcfce7; }
.import-status.has-error { color: #b91c1c; background: #fee2e2; }
.import-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  margin: 0 20px 18px;
  background: #e2e8f0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}
.import-summary-grid > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: #fff;
}
.import-summary-grid span { color: #64748b; font-size: 12px; }
.import-summary-grid strong { color: #0f172a; font-size: 16px; }
.import-message {
  margin: 0 20px 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
}
.import-message ul { margin: 6px 0 0; padding-left: 20px; }
.import-message.warning { color: #854d0e; background: #fef9c3; }
.import-message.error { color: #991b1b; background: #fee2e2; }
.import-table-title {
  margin: 20px 20px 10px;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}
#historyImportPreviewTable {
  overflow-x: auto;
  padding-bottom: 8px;
}
#historyImportPreviewTable .data-table {
  min-width: 1050px;
}

#occupancyListView:not([hidden]),
#occupancyTenantView:not([hidden]),
#roomListView:not([hidden]),
#roomLedgerView:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: #f1f5f9;
  border-radius: 12px;
}
.view-tab {
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
}
.view-tab.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.tenant-ledger {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.tenant-profile-panel {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.tenant-profile-main {
  display: flex;
  align-items: center;
  gap: 16px;
}
.tenant-profile-main h3 {
  margin: 0 0 4px;
  font-size: 20px;
  color: #0f172a;
}
.tenant-avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #eef2ff;
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}
.tenant-profile-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.tenant-profile-meta div {
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 12px;
}
.tenant-profile-meta span {
  display: block;
  color: #64748b;
  font-size: 12px;
  margin-bottom: 4px;
}
.tenant-profile-meta strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
  word-break: break-all;
}
.tenant-ledger-stats .number {
  font-size: 26px;
}
.tenant-ledger-stats .number.is-danger {
  color: #b91c1c;
}
.tenant-ledger-hint {
  margin: -8px 2px 0;
  color: #64748b;
  font-size: 13px;
}
.occupancy-tenant-table,
.occupancy-bill-table {
  min-width: 980px;
}
.text-danger { color: #b91c1c; font-weight: 600; }

.login-overlay {
  position: fixed;
  inset: 0;
  background: #0f172a;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-overlay[hidden] { display: none; }
.login-box {
  width: 360px;
  max-width: calc(100% - 32px);
  background: #fff;
  border-radius: 12px;
  padding: 24px;
}
.login-box h2 { margin-bottom: 8px; font-size: 18px; }
.login-box .form-control { margin: 12px 0; }
.login-box .btn { width: 100%; }

@media (max-width: 900px) {
  .stats-grid,
  .tenant-ledger-stats,
  .tenant-profile-meta { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .tenant-profile-meta { grid-template-columns: 1fr; }
}

/* ========== 手机 / 窄屏适配 ========== */
@media (max-width: 900px) {
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
  }
  .menu-toggle:hover { background: #e2e8f0; }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.46);
    z-index: 1100;
  }
  body.nav-open .sidebar-backdrop {
    display: block;
  }
  body.nav-open .main,
  body.bill-filter-open .main {
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 86vw);
    z-index: 1200;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  body.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(15, 23, 42, 0.28);
  }

  .main {
    width: 100%;
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  .top-nav {
    height: calc(56px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
  }
  .page-title {
    font-size: 16px;
    gap: 8px;
    min-width: 0;
    flex: 1;
  }
  .page-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .page-title i { font-size: 16px; }
  .avatar { width: 32px; height: 32px; font-size: 13px; }

  .content {
    padding: 14px 12px 20px;
    gap: 16px;
  }
  .page.active { gap: 16px; }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat-card {
    padding: 14px 12px;
    border-radius: 16px;
  }
  .stat-left h4 { font-size: 12px; margin-bottom: 4px; }
  .stat-left .number { font-size: 20px; }
  .stat-icon { width: 40px; height: 40px; font-size: 18px; border-radius: 12px; }

  .quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
    border-radius: 16px;
  }
  .quick-actions .divider { display: none; }
  .action-item {
    padding: 10px 8px;
    gap: 10px;
    min-height: 44px;
  }
  .action-item i { width: 34px; height: 34px; }

  .row-grid-2 {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .panel { border-radius: 16px; padding: 14px 0; }
  .panel-header { padding: 0 14px 12px; }
  .panel-header h3 { font-size: 15px; }

  .list-row-head { display: none; }
  .list-row {
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 12px 14px;
  }
  .list-row > [data-label] {
    flex: 1 1 calc(50% - 10px);
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .list-row > [data-label]::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
  }
  .list-row > [data-label="操作"] {
    flex: 1 1 100%;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .toolbar,
  .toolbar-utility,
  .toolbar-bills,
  .toolbar-dates,
  .toolbar-single-row {
    flex-wrap: wrap;
    align-items: stretch;
    gap: 10px;
  }
  .toolbar-single-row .toolbar-label,
  .toolbar-single-row .month-picker-wrap,
  .toolbar-single-row .form-control-inline,
  .toolbar-single-row input[type="date"],
  .toolbar-single-row select.form-control-inline,
  .toolbar-single-row .report-room-select {
    min-width: 0;
    width: auto;
    flex: 1 1 auto;
  }
  .toolbar-single-row input[type="date"] {
    width: auto;
    min-width: 0;
    max-width: none;
    flex: 1 1 140px;
  }
  .filter-group,
  .toolbar-bills .filter-group,
  .utility-unit-group {
    width: 100%;
    flex: 1 1 100%;
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    flex-wrap: wrap;
  }
  .filter-item {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
  }
  .filter-item select,
  .filter-item .month-picker-trigger,
  .toolbar input[type="text"],
  .toolbar input[type="number"],
  .toolbar input[type="date"],
  .toolbar select,
  .form-control-inline {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  .toolbar .btn,
  .toolbar-utility .btn,
  .toolbar-dates .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
  .view-tabs {
    width: 100%;
    justify-content: stretch;
  }
  .view-tab {
    flex: 1;
    text-align: center;
    min-height: 40px;
  }
  .toolbar-bills .view-tabs { display: none; }
  .toolbar-bills {
    position: sticky;
    top: calc(56px + env(safe-area-inset-top));
    z-index: 30;
    background: #f8fafc;
    padding: 2px 0 8px;
    gap: 8px;
  }
  body.bill-filter-open .toolbar-bills {
    z-index: 1040;
  }
  .toolbar-bills .filter-item-status { display: none; }
  .bills-compact-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
  }
  .status-chips {
    display: flex;
    flex: 1;
    min-width: 0;
    gap: 2px;
    padding: 3px;
    background: #f1f5f9;
    border-radius: 12px;
  }
  .status-chip {
    flex: 1;
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 4px;
    min-height: 40px;
    border-radius: 10px;
    cursor: pointer;
  }
  .status-chip.active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  }
  .bills-filter-btn {
    position: relative;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
  }
  .bills-filter-btn.has-filters {
    border-color: #2563eb;
    color: #1d4ed8;
    background: #eff6ff;
  }
  .bills-filter-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #2563eb;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
  }
  .bills-active-chips:not([hidden]) {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  .bills-active-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 4px 8px 4px 10px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 600;
  }
  .bills-active-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 62vw;
  }
  .bills-active-chip button {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
    min-width: 22px;
    min-height: 22px;
    cursor: pointer;
  }
  .toolbar-bills .filter-sheet {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1040;
    flex: none;
    width: auto;
    min-width: 0;
  }
  .toolbar-bills .filter-sheet.is-open { display: block; }
  .filter-sheet-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.46);
  }
  .filter-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    max-height: min(86vh, 640px);
    padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.12);
  }
  .filter-sheet-handle {
    display: block;
    width: 36px;
    height: 4px;
    margin: 4px auto 10px;
    border-radius: 4px;
    background: #cbd5e1;
  }
  .filter-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }
  .filter-sheet-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
  }
  .filter-sheet-reset {
    border: 0;
    background: transparent;
    color: #2563eb;
    font-size: 14px;
    font-weight: 600;
    min-height: 40px;
    padding: 0 8px;
    cursor: pointer;
  }
  .filter-sheet-panel .filter-group {
    overflow-y: auto;
    width: 100%;
    flex: 1 1 auto;
    align-items: stretch;
  }
  .filter-sheet-panel .filter-item-presets {
    display: flex;
    flex: 1 1 100%;
  }
  .filter-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .filter-presets button {
    flex: 1 1 calc(50% - 8px);
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #fff;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
  }
  .filter-presets button.active {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
  }
  .filter-sheet-footer {
    display: block;
    padding-top: 12px;
  }
  .filter-sheet-footer .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
  .utility-unit-group .utility-unit-input {
    width: 88px;
    min-width: 72px;
    flex: 1 1 72px;
  }
  .toolbar-hint {
    margin-left: 0;
    width: 100%;
    line-height: 1.5;
  }
  .toolbar-utility {
    position: sticky;
    top: calc(56px + env(safe-area-inset-top));
    z-index: 30;
    background: #f8fafc;
    padding: 8px 0 10px;
  }

  /* 宽表在手机上改为卡片行，避免左右狂滑 */
  .table-scroll,
  .utility-table-wrap,
  #historyImportPreviewTable {
    overflow-x: visible;
  }
  .occupancy-tenant-table,
  .occupancy-bill-table,
  .utility-table,
  .bill-table.data-table,
  #historyImportPreviewTable .data-table {
    min-width: 0;
    width: 100%;
  }
  .bill-table {
    width: 100%;
  }
  .bill-table thead th.col-actions,
  .bill-table .col-actions,
  .bill-table tbody td.col-actions {
    position: static;
    box-shadow: none;
  }
  table.data-table thead { display: none; }
  table.data-table,
  table.data-table tbody,
  table.data-table tr,
  table.data-table td {
    display: block;
    width: 100%;
  }
  table.data-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }
  table.data-table tr {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }
  table.data-table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    white-space: normal;
    word-break: break-word;
  }
  table.data-table td:last-child { border-bottom: none; }
  table.data-table td::before {
    content: attr(data-label);
    flex: 0 0 5.5em;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
  }
  table.data-table td.cell-full,
  table.data-table td.empty-tip {
    display: block;
    text-align: center;
    border: none;
  }
  table.data-table td.cell-full::before,
  table.data-table td.empty-tip::before,
  table.data-table td:not([data-label])::before { content: none; }
  table.data-table td[data-label="操作"],
  table.data-table td.col-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px 14px;
    padding-top: 10px;
  }
  table.data-table .form-control {
    max-width: 160px;
    min-height: 40px;
    font-size: 16px;
  }
  .utility-table .form-control { max-width: 160px; }

  .action-link {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  input, select, textarea, .month-picker-trigger, .form-control, .btn {
    font-size: 16px;
  }

  .analytics-grid,
  .import-layout {
    grid-template-columns: 1fr;
  }
  .chart-wrap-small {
    width: 180px;
    height: 180px;
  }
  .drilldown-content { padding: 12px; max-height: none; }
  .drilldown-tabs { padding: 0 12px 10px; overflow-x: auto; }
  .rent-matrix .cell { min-width: 68px; height: 50px; }
  .chart-wrap-bar { height: 200px; }
  .chart-wrap-line { height: 240px; min-height: 220px; }
  .chart-wrap-hbar { height: 220px; }

  .wizard-steps { gap: 4px; }
  .wizard-step { font-size: 10px; }
  .wizard-step-number { width: 28px; height: 28px; font-size: 12px; }
  .pay-layout, .checkout-layout { grid-template-columns: 1fr; }

  .modal {
    align-items: flex-end;
    padding: 0;
  }
  .modal-content,
  .modal-content.modal-wide,
  .modal-content.modal-xl {
    width: 100%;
    max-width: 100%;
    max-height: min(92dvh, 92vh);
    border-radius: 20px 20px 0 0;
    padding: 18px 16px calc(12px + env(safe-area-inset-bottom));
  }
  .modal-header h3 { font-size: 17px; }
  .modal-content .form-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding-top: 12px;
    margin-top: 16px;
    gap: 10px;
  }
  .modal-content .form-actions .btn {
    flex: 1;
    justify-content: center;
    min-height: 44px;
  }

  .month-picker-popover {
    left: 50% !important;
    top: 50% !important;
    right: auto;
    transform: translate(-50%, -50%);
    width: min(320px, calc(100vw - 32px));
    min-width: 0;
  }
  .month-picker-cell { min-height: 44px; }

  .toast-container {
    top: auto;
    right: 12px;
    left: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    align-items: stretch;
  }
  .toast {
    border-radius: 14px;
    justify-content: center;
  }

  .login-box {
    width: calc(100% - 32px);
    padding: 22px 18px;
  }

  .mobile-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    height: calc(56px + env(safe-area-inset-bottom));
    padding: 4px 4px env(safe-area-inset-bottom);
    background: #fff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
  }
  .tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
    min-height: 48px;
    cursor: pointer;
  }
  .tabbar-item i { font-size: 16px; }
  .tabbar-item.active { color: #2563eb; }

  .tenant-profile-main { align-items: flex-start; }
  .tenant-profile-panel { padding: 14px; }
  .import-guide > .btn { width: calc(100% - 40px); justify-content: center; }
  .import-actions { flex-direction: column; }
  .import-actions .btn { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-left .number { font-size: 18px; }
  .filter-item { flex: 1 1 100%; }
  .filter-sheet-panel .filter-item:not(.filter-item-presets) {
    flex: 1 1 calc(50% - 8px);
  }
  .filter-sheet-panel .filter-item-presets {
    flex: 1 1 100%;
  }
}
