/* ============================================================
 * 物业租赁管理系统 · 基础主题
 * ============================================================ */
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #16202c;
  --ink2: #33445a;
  --muted: #6b7a8d;
  --brand: #123a5f;
  --brand-2: #1b5c8f;
  --gold: #c8a45c;
  --ok: #1a9e6b;
  --warn: #d98a00;
  --danger: #d64545;
  --line: #e4e9ef;
  --line-2: #eef2f6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,32,54,.04), 0 6px 20px rgba(16,32,54,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: .2px; }

/* ---------- 布局骨架 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px; flex: 0 0 224px; background: var(--brand); color: #cfe0ef;
  padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.sidebar .brand .logo {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--gold), #e0c483);
  color: #123a5f; font-weight: 800; display: grid; place-items: center; font-size: 15px;
}
.sidebar .brand b { color: #fff; font-size: 14px; display: block; line-height: 1.25; }
.sidebar .brand span { font-size: 11px; color: #8fb0cb; }
.sidebar .navgrp { font-size: 11px; color: #6f95b5; padding: 14px 10px 6px; letter-spacing: 1px; }
.sidebar a.nav {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px;
  color: #cfe0ef; font-size: 13.5px; margin-bottom: 2px; cursor: pointer;
}
.sidebar a.nav:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar a.nav.on { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.sidebar a.nav .ic { width: 18px; text-align: center; opacity: .9; }
.sidebar .foot { padding: 16px 10px; font-size: 11px; color: #6f95b5; border-top: 1px solid rgba(255,255,255,.1); margin-top: 14px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 16px; }
.topbar .sp { flex: 1; }
.topbar .who { font-size: 12.5px; color: var(--muted); }
.content { padding: 22px; flex: 1; }

/* ---------- 卡片 / 表格 ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-hd { padding: 14px 18px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }
.card-hd h3 { font-size: 14.5px; }
.card-hd .sp { flex: 1; }
.card-bd { padding: 16px 18px; }
.card-bd.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px) { .g2,.g3,.g4 { grid-template-columns: 1fr; } }

.kpi { padding: 16px 18px; }
.kpi .lb { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .vl { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi .vl small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi.accent { background: linear-gradient(135deg, #123a5f, #1b5c8f); color: #fff; border-color: transparent; }
.kpi.accent .lb, .kpi.accent .sub { color: #b9d3e8; }

table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th { text-align: left; padding: 10px 14px; background: #fafbfd; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tb td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tb tbody tr:hover { background: #fbfcfe; }
table.tb td.num, table.tb th.num { text-align: right; font-variant-numeric: tabular-nums; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #eef2f6; color: var(--muted); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 8px; font-size: 12px; background: #eef2f6; color: var(--ink2); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }

/* ---------- 控件 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--ink2); font-size: 13px; font-weight: 500; cursor: pointer;
}
.btn:hover { border-color: #cdd8e4; background: #fafbfd; }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.pri:hover { background: var(--brand-2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #402f0c; }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn.danger { color: var(--danger); border-color: #f0d3d3; }

input, select, textarea {
  font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #dbe8f5; border-color: var(--brand-2); }
label.fl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 140px; }

/* ---------- 模态 / 提示 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(16,32,54,.45); display: grid; place-items: center; z-index: 200; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: min(760px, 100%); max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal.wide { width: min(980px, 100%); }
.modal-hd { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-hd h3 { font-size: 15px; }
.modal-hd .modal-x { margin-left: auto; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; }
.modal-bd { padding: 18px; overflow: auto; }
.modal-ft { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 20px);
  background: #16202c; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 300;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 平面图 ---------- */
.fp-wrap { background: #fbfcfe; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; overflow: auto; }
.fp-room { cursor: pointer; transition: .15s; }
.fp-room:hover { filter: brightness(.94); }
.fp-legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 4px 2px; font-size: 12.5px; color: var(--muted); }
.fp-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }

.chart { width: 100%; height: auto; }

.empty { padding: 40px; text-align: center; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* 打印（合同） */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .print-area { position: static; box-shadow: none; border: 0; }
}
.print-area { background: #fff; padding: 26px 30px; font-size: 12.5px; line-height: 1.75; }
.print-area h2 { text-align: center; font-size: 18px; margin-bottom: 2px; }
.print-area .sub { text-align: center; color: var(--muted); font-size: 11.5px; margin-bottom: 16px; }
.print-area .cl { display: grid; grid-template-columns: 26px 1fr; gap: 8px; margin-bottom: 9px; }
.print-area .cl .en { color: #16202c; }
.print-area .cl .cn { color: #40536a; font-size: 12px; }
.print-area .sig { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 22px; }
.print-area .sig div { border-top: 1px solid #333; padding-top: 6px; }
