:root {
  color-scheme: light;
  --ink: #18221e;
  --muted: #69766f;
  --line: #dde5df;
  --canvas: #f5f7f4;
  --surface: #ffffff;
  --forest: #176b4d;
  --forest-dark: #0d4f37;
  --mint: #e6f4ed;
  --amber: #b66a14;
  --amber-soft: #fff1db;
  --red: #b7423a;
  --red-soft: #fdebea;
  --blue: #276e9c;
  --blue-soft: #e7f2f8;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 14px; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { background: #122b22; color: #dce8e1; padding: 22px 14px; display: flex; flex-direction: column; gap: 25px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px; color: #fff; font-size: 17px; font-weight: 700; letter-spacing: 0; }
.brand-mark { width: 32px; height: 32px; border-radius: 7px; display: grid; place-items: center; background: #d6f0a3; color: #173c2b; }
.brand-mark i { width: 19px; height: 19px; }
.workspace-label { color: #9eb3a8; font-size: 11px; padding: 4px 10px; }
.nav { display: grid; gap: 4px; }
.nav-button { width: 100%; border: 0; background: transparent; color: #c4d3ca; display: flex; align-items: center; gap: 12px; text-align: left; border-radius: 6px; padding: 11px 10px; }
.nav-button i { width: 18px; height: 18px; }
.nav-button:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-button.active { background: #22533d; color: #fff; font-weight: 600; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.11); padding: 16px 9px 0; display: flex; gap: 10px; color: #b5c6bd; align-items: center; }
.avatar { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 50%; background: #32664d; color: #fff; font-weight: 700; font-size: 12px; }
.sidebar-footer small { display: block; color: #7f998d; margin-top: 2px; font-size: 11px; }

.content { min-width: 0; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-date { color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--ink); border-radius: 6px; }
.icon-button:hover { border-color: var(--forest); color: var(--forest); }
.icon-button i { width: 18px; height: 18px; }
.main { max-width: 1560px; margin: 0 auto; padding: 30px 32px 42px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 25px; line-height: 1.25; letter-spacing: 0; }
h2 { font-size: 18px; letter-spacing: 0; }
h3 { font-size: 14px; letter-spacing: 0; }
.page-subtitle { margin-top: 7px; color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.primary-button, .secondary-button, .text-button { border: 0; border-radius: 6px; min-height: 36px; padding: 0 13px; display: inline-flex; gap: 8px; align-items: center; justify-content: center; white-space: nowrap; }
.primary-button { background: var(--forest); color: #fff; font-weight: 600; }
.primary-button:hover { background: var(--forest-dark); }
.secondary-button { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.secondary-button:hover { border-color: var(--forest); color: var(--forest); }
.text-button { color: var(--forest); background: transparent; padding: 0; min-height: auto; }
.primary-button i, .secondary-button i { width: 16px; height: 16px; }

.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--surface); border-radius: 7px; overflow: hidden; margin-bottom: 24px; }
.metric { padding: 18px; border-right: 1px solid var(--line); min-width: 0; }
.metric:last-child { border-right: 0; }
.metric-label { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.metric-label i { width: 14px; height: 14px; }
.metric-value { margin-top: 9px; font-size: 24px; font-weight: 700; letter-spacing: 0; }
.metric-note { margin-top: 7px; color: var(--muted); font-size: 12px; }
.metric-note.positive { color: var(--forest); }
.metric-note.warning { color: var(--amber); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .8fr); gap: 20px; }
.section { border: 1px solid var(--line); background: var(--surface); border-radius: 7px; min-width: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 18px; border-bottom: 1px solid var(--line); gap: 12px; }
.section-head p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.section-body { padding: 10px 18px 18px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 620px; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 11px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 8px; border-bottom: 1px solid #edf1ee; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f8faf8; }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.small-muted { color: var(--muted); font-size: 12px; }
.badge { display: inline-flex; align-items: center; border-radius: 20px; padding: 3px 8px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.green { background: var(--mint); color: var(--forest); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.mini-list { display: grid; }
.mini-item { display: flex; gap: 11px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid #edf1ee; }
.mini-item:last-child { border-bottom: 0; }
.mini-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; flex: 0 0 auto; background: var(--mint); color: var(--forest); }
.mini-icon.amber { background: var(--amber-soft); color: var(--amber); }
.mini-icon.red { background: var(--red-soft); color: var(--red); }
.mini-icon i { width: 16px; height: 16px; }
.mini-copy { min-width: 0; flex: 1; }
.mini-copy p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.mini-item time { color: var(--muted); font-size: 11px; white-space: nowrap; }

.toolbar { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-bottom: 15px; }
.filter-button { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 7px 12px; color: var(--muted); font-size: 12px; }
.filter-button.active { background: var(--mint); color: var(--forest); border-color: #a9d5bd; font-weight: 600; }
.search { flex: 1 1 220px; max-width: 310px; min-height: 36px; border: 1px solid var(--line); border-radius: 6px; padding: 0 11px; outline: none; }
.search:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(23,107,77,.1); }
.property-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.property-card { text-align: left; padding: 0; border: 1px solid var(--line); background: #fff; border-radius: 7px; overflow: hidden; color: var(--ink); }
.property-card:hover { border-color: #90b6a0; box-shadow: 0 8px 20px rgba(20,52,37,.07); }
.property-image { height: 92px; background: linear-gradient(135deg, #dbe5df 0%, #b4cabb 50%, #e9ddd0 50%, #c9b19a 100%); position: relative; overflow: hidden; }
.property-image::before { content: ""; position: absolute; left: 16%; bottom: 0; width: 23%; height: 75%; background: rgba(255,255,255,.52); box-shadow: 38px 0 0 rgba(255,255,255,.35), 76px 0 0 rgba(255,255,255,.25); }
.property-image::after { content: ""; position: absolute; right: 13%; bottom: 0; width: 28%; height: 86%; border-left: 9px solid rgba(24,34,30,.25); border-right: 9px solid rgba(24,34,30,.17); background: repeating-linear-gradient(0deg, rgba(255,255,255,.42) 0 6px, transparent 6px 18px); transform: skewY(-10deg); }
.property-card-body { padding: 14px; }
.property-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.property-name { margin-top: 8px; font-weight: 700; }
.property-address { color: var(--muted); font-size: 12px; margin-top: 4px; }
.property-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 13px; border-top: 1px solid #edf1ee; padding-top: 12px; }
.property-stats span { font-size: 12px; color: var(--muted); }
.property-stats strong { display: block; color: var(--ink); margin-top: 4px; font-size: 14px; }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(290px, .74fr); gap: 20px; }
.contract-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 18px; }
.contract { border: 1px solid var(--line); border-radius: 6px; padding: 15px; }
.contract.inbound { border-top: 3px solid var(--blue); }
.contract.outbound { border-top: 3px solid var(--forest); }
.contract-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.contract-meta { display: grid; gap: 9px; margin-top: 15px; }
.contract-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; gap: 12px; }
.contract-row strong { color: var(--ink); font-size: 13px; text-align: right; }
.profit-band { margin: 0 18px 18px; background: #183e2e; color: #fff; border-radius: 6px; padding: 16px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
.profit-band p { color: #bbd3c5; font-size: 12px; margin-top: 4px; }
.profit-value { text-align: right; font-size: 26px; font-weight: 700; }
.risk-list { padding: 4px 18px 18px; display: grid; gap: 9px; }
.risk { background: #fafbf9; border: 1px solid #edf1ee; border-radius: 6px; padding: 12px; display: flex; gap: 10px; align-items: center; }
.risk i { color: var(--amber); width: 18px; height: 18px; }
.risk p { margin-top: 3px; color: var(--muted); font-size: 12px; }

.split-page { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(330px, .75fr); gap: 20px; }
.bill-amount { display: grid; gap: 3px; }
.meter-form { padding: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
input, select { width: 100%; min-height: 36px; border-radius: 6px; border: 1px solid var(--line); padding: 0 9px; color: var(--ink); background: #fff; outline: none; }
input:focus, select:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(23,107,77,.1); }
.form-note { margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }

.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); padding: 0 18px; }
.tab { padding: 13px 0 10px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); }
.tab.active { border-color: var(--forest); color: var(--forest); font-weight: 600; }
.work-body { padding: 4px 18px 18px; }
.work-row { display: grid; grid-template-columns: minmax(0, 1fr) 94px 86px 86px 85px; gap: 8px; align-items: center; padding: 14px 0; border-bottom: 1px solid #edf1ee; }
.work-row:last-child { border-bottom: 0; }
.work-title { font-weight: 600; }
.work-title span { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 4px; }
.select-compact { min-height: 31px; font-size: 12px; }

.timeline { padding: 6px 18px 18px; }
.timeline-item { display: grid; grid-template-columns: 84px 18px 1fr; gap: 8px; padding: 11px 0; }
.timeline-time { color: var(--muted); font-size: 12px; }
.timeline-dot { position: relative; width: 10px; height: 10px; background: var(--forest); border-radius: 50%; margin-top: 3px; }
.timeline-dot::after { content: ""; position: absolute; width: 1px; height: 37px; left: 4px; top: 13px; background: var(--line); }
.timeline-item:last-child .timeline-dot::after { display: none; }
.timeline-copy { font-size: 13px; }
.timeline-copy p { color: var(--muted); font-size: 12px; margin-top: 3px; }

.viewing-list { padding: 4px 18px 18px; display: grid; }
.viewing-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(190px, 1.5fr) 100px 100px 110px; gap: 10px; align-items: center; padding: 14px 0; border-bottom: 1px solid #edf1ee; }
.viewing-row:last-child { border-bottom: 0; }
.lead-name { font-weight: 600; }
.lead-name span { color: var(--muted); display: block; font-size: 12px; font-weight: 400; margin-top: 3px; }
.lead-actions { display: flex; gap: 5px; }

.analysis-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(330px, .88fr); gap: 20px; }
.chart { padding: 18px; height: 290px; display: grid; grid-template-columns: 38px 1fr; gap: 10px; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; color: var(--muted); font-size: 11px; padding: 2px 0 27px; text-align: right; }
.bar-area { display: grid; grid-template-columns: repeat(6, 1fr); gap: 13px; align-items: end; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0 61px, #edf1ee 61px 62px); padding: 0 5px 26px; }
.bar-set { height: 100%; display: flex; gap: 3px; align-items: end; justify-content: center; position: relative; }
.bar-set::after { content: attr(data-label); position: absolute; bottom: -21px; color: var(--muted); font-size: 11px; }
.bar { width: min(17px, 38%); border-radius: 3px 3px 0 0; }
.bar.income { background: #2d9270; }
.bar.cost { background: #9fc1ae; }
.bar.loss { background: #e2a25c; }
.legend { display: flex; gap: 15px; color: var(--muted); font-size: 12px; padding: 0 18px 18px; }
.legend span { display: flex; gap: 6px; align-items: center; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.rank-list { padding: 5px 18px 18px; }
.rank-row { display: grid; grid-template-columns: 20px minmax(0,1fr) 70px; gap: 9px; padding: 13px 0; align-items: center; border-bottom: 1px solid #edf1ee; }
.rank-row:last-child { border-bottom: 0; }
.rank-num { color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-name span { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.rank-value { text-align: right; font-weight: 700; color: var(--forest); }

.modal-layer { position: fixed; inset: 0; background: rgba(18,34,27,.4); z-index: 12; display: grid; place-items: center; padding: 20px; }
.modal { width: min(480px, 100%); background: #fff; border-radius: 8px; box-shadow: 0 18px 65px rgba(12,37,26,.27); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; }
.modal-body p { color: var(--muted); line-height: 1.65; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 18px; border-top: 1px solid var(--line); }
.toast { position: fixed; right: 25px; bottom: 25px; z-index: 20; background: #173c2b; color: #fff; padding: 12px 15px; border-radius: 7px; box-shadow: 0 8px 24px rgba(0,0,0,.18); display: flex; align-items: center; gap: 9px; animation: rise .22s ease-out; }
.toast i { width: 17px; height: 17px; color: #d7ef9c; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (max-width: 1150px) { .metric-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } .metric:nth-child(3) { border-right: 0; } .metric:nth-child(-n+3) { border-bottom: 1px solid var(--line); } .property-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } .dashboard-grid, .split-page, .detail-layout, .analysis-grid { grid-template-columns: 1fr; } }
@media (max-width: 840px) { .shell { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; padding: 12px 14px; display: grid; grid-template-columns: auto 1fr; gap: 8px; } .workspace-label, .sidebar-footer { display: none; } .nav { grid-auto-flow: column; grid-auto-columns: minmax(max-content, 1fr); overflow-x: auto; gap: 5px; } .nav-button { width: auto; padding: 8px 10px; font-size: 12px; } .nav-button i { width: 16px; height: 16px; } .topbar { padding: 0 18px; height: 57px; } .main { padding: 23px 18px 35px; } .topbar-date { display: none; } .page-head { margin-bottom: 18px; } .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } .metric { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); } .metric:nth-child(2n) { border-right: 0; } .metric:last-child { border-bottom: 0; } .metric-value { font-size: 21px; } .property-grid { grid-template-columns: 1fr; } .contract-pair { grid-template-columns: 1fr; } .work-row, .viewing-row { grid-template-columns: 1fr; gap: 7px; } .work-row > :not(:first-child), .viewing-row > :not(:first-child) { justify-self: start; } }
@media (max-width: 520px) { .sidebar { grid-template-columns: 1fr; padding: 10px 14px; gap: 10px; } .brand { font-size: 15px; } .brand-mark { width: 28px; height: 28px; } .nav { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-flow: initial; grid-auto-columns: initial; overflow-x: visible; gap: 5px; } .nav-button span { display: none; } .nav-button { width: 100%; justify-content: center; padding: 8px; } .page-head { display: block; } .head-actions { justify-content: flex-start; margin-top: 13px; } h1 { font-size: 22px; } .form-grid { grid-template-columns: 1fr; } }
