* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --blue: #2563eb; --red: #dc2626; --orange: #ea580c; --green: #16a34a;
  --bg: #f4f5f7; --card: #fff; --line: #e5e7eb; --text: #111827; --muted: #6b7280;
}
html { font-size: 17px; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  padding-bottom: 76px;
}
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--blue); color: #fff;
  padding: 14px 16px; display: flex; justify-content: space-between; align-items: center;
}
.topbar-title { font-size: 1.15rem; font-weight: 700; }
.topbar-user { color: #dbeafe; font-size: .85rem; text-decoration: none; }
.page { padding: 12px; max-width: 720px; margin: 0 auto; }
.flash {
  background: #fef3c7; border: 1px solid #fcd34d; color: #92400e;
  padding: 12px 14px; margin: 10px 12px 0; border-radius: 10px; font-size: .95rem;
}
.card {
  background: var(--card); border-radius: 14px; padding: 14px 16px;
  margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.card h2 { font-size: 1.02rem; margin-bottom: 10px; }
.statgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.stat {
  background: var(--card); border-radius: 14px; padding: 14px; text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.05); text-decoration: none; color: var(--text);
}
.stat b { display: block; font-size: 1.7rem; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.warn b { color: var(--orange); }
.stat.bad b { color: var(--red); }
.stat.good b { color: var(--green); }
.item {
  display: block; background: var(--card); border-radius: 12px;
  padding: 13px 14px; margin-bottom: 9px; text-decoration: none; color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.item .t { font-weight: 600; font-size: 1.02rem; }
.item .d { color: var(--muted); font-size: .88rem; margin-top: 3px; }
.badge {
  display: inline-block; font-size: .78rem; border-radius: 999px;
  padding: 2px 10px; font-weight: 600; margin-left: 6px; vertical-align: 2px;
}
.badge.在租, .badge.已收 { background: #dcfce7; color: #166534; }
.badge.空闲 { background: #e0e7ff; color: #3730a3; }
.badge.快到期, .badge.待核对, .badge.部分收款 { background: #ffedd5; color: #9a3412; }
.badge.欠费, .badge.逾期 { background: #fee2e2; color: #991b1b; }
.badge.停用, .badge.待收, .badge.已退租, .badge.已作废, .badge.未到期 { background: #e5e7eb; color: #374151; }
.badge.预订 { background: #ede9fe; color: #5b21b6; }
.btn {
  display: block; width: 100%; text-align: center; border: none; cursor: pointer;
  background: var(--blue); color: #fff; font-size: 1.05rem; font-weight: 600;
  padding: 14px; border-radius: 12px; text-decoration: none; margin-top: 10px;
}
.btn.secondary { background: #fff; color: var(--blue); border: 2px solid var(--blue); }
.btn.danger { background: var(--red); }
.btn.small { display: inline-block; width: auto; padding: 8px 16px; font-size: .9rem; margin: 4px 4px 0 0; }
form label { display: block; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=tel], input[type=number], input[type=date],
input[type=password], select, textarea {
  width: 100%; font-size: 1.05rem; padding: 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff;
}
textarea { min-height: 70px; }
.checkline { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: .95rem; }
.checkline input { width: 22px; height: 22px; }
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
  flex: 1; text-align: center; padding: 8px 0 6px; text-decoration: none;
  color: var(--muted); font-size: 1.25rem; line-height: 1.15;
}
.bottomnav a span { display: block; font-size: .72rem; }
.bottomnav a.on { color: var(--blue); font-weight: 700; }
.filterbar { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; }
.filterbar a {
  white-space: nowrap; padding: 8px 14px; border-radius: 999px; font-size: .9rem;
  background: #fff; color: var(--text); text-decoration: none; border: 1px solid var(--line);
}
.filterbar a.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
.searchbar input { flex: 1; }
.searchbar button { border: none; background: var(--blue); color: #fff; border-radius: 10px; padding: 0 18px; font-size: 1rem; }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .97rem; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.money { font-weight: 700; }
.money.bad { color: var(--red); }
.money.good { color: var(--green); }
.section-title { font-size: .92rem; color: var(--muted); margin: 16px 0 8px; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }
.report { white-space: pre-wrap; line-height: 1.7; font-size: .98rem; }
.portal-owed { text-align: center; padding: 22px 0 10px; }
.portal-owed b { font-size: 2.2rem; color: var(--red); }
.qr { width: 100%; max-width: 300px; display: block; margin: 10px auto; border-radius: 10px; }
a.tel { color: var(--blue); text-decoration: none; font-weight: 600; }
