:root {
  /* 2026-11-03 v2：强调色自藏蓝迁到站点 mint，圆角归 12/8 */
  --bg: #f5f6f6;
  --surface: #ffffff;
  --surface-2: #f1f3f3;
  --surface-3: #e9ebeb;
  --text: #1a1a1a;
  --text-2: #4a5250;
  --text-3: #8a928f;
  --border: #e9e9e9;
  --border-strong: #d2d6d5;
  --accent: #0a6d57;
  --accent-soft: #eaf6f2;
  --accent-line: #009273;
  --pos: #17795a;
  --pos-soft: #e6f4ee;
  --neg: #b93b2f;
  --neg-soft: #fbecea;
  --warn: #9a6b00;
  --warn-soft: #fbf3dd;
  --retire: #c47a2b;
  --shadow: 0 1px 2px rgba(16, 24, 32, .05), 0 4px 14px rgba(16, 24, 32, .04);
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0e1012;
  --surface: #15181b;
  --surface-2: #1b1f22;
  --surface-3: #202528;
  --text: #eef1f3;
  --text-2: #cdd4d9;
  --text-3: #9aa3a9;
  --border: #262b2f;
  --border-strong: #394045;
  --accent: #3dd6a8;
  --accent-soft: #12241f;
  --accent-line: #6fe3c0;
  --pos: #4fbf94;
  --pos-soft: #16281f;
  --neg: #e5756a;
  --neg-soft: #2b1a18;
  --warn: #d8a63a;
  --warn-soft: #2a2314;
  --retire: #d99a52;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  height: 58px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { font-size: 15px; font-weight: 600; letter-spacing: .2px; }
.brand .tag {
  font-size: 11px;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-variant-numeric: tabular-nums;
}

.topbar .spacer { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-line); border-color: var(--accent-line); color: #fff; }
[data-theme="dark"] .btn-primary { color: #0d1216; }

.layout {
  display: grid;
  grid-template-columns: 392px minmax(0, 1fr);
  gap: 20px;
  padding: 20px 22px 60px;
  max-width: 1560px;
  margin: 0 auto;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-panel {
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 98px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.form-panel::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 1px;
  height: 26px;
  background: linear-gradient(to bottom, transparent, var(--surface));
  pointer-events: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

.form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.form-head h2 { font-size: 13px; font-weight: 600; letter-spacing: .3px; }
.form-head .tag { margin-left: 8px; }

.seg {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 6px;
  padding: 2px;
}
.seg button {
  border: 0;
  background: transparent;
  padding: 4px 11px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 500; }

.form-body { overflow-y: auto; padding: 6px 0 18px; flex: 1; }
.form-body::-webkit-scrollbar { width: 10px; }
.form-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; border: 2px solid var(--surface); }
.form-body::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

.group { border-bottom: 1px solid var(--border); }
.group:last-child { border-bottom: 0; }

.group > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  user-select: none;
}
.group > summary::-webkit-details-marker { display: none; }
.group > summary::after {
  content: "";
  margin-left: auto;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--text-3);
  border-bottom: 1.5px solid var(--text-3);
  transform: rotate(-45deg);
  transition: transform .18s;
}
.group[open] > summary::after { transform: rotate(45deg); }
.group > summary:hover { background: var(--surface-2); }

.gnum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.fields { padding: 2px 16px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 11px 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.wide { grid-column: span 2; }

.field label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.field label .hint {
  font-size: 10px;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
  line-height: 14px;
  cursor: help;
}

.igroup { position: relative; display: flex; align-items: center; }
.igroup input, .igroup select { width: 100%; }
.igroup .unit {
  position: absolute;
  right: 9px;
  font-size: 11px;
  color: var(--text-3);
  pointer-events: none;
  background: var(--surface);
  padding-left: 2px;
}

input[type="number"], input[type="text"], input[type="month"], select {
  height: 33px;
  padding: 0 9px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  font-variant-numeric: tabular-nums;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
input:focus, select:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-line) 16%, transparent);
}
input.has-unit { padding-right: 36px; }
input.has-unit-lg { padding-right: 48px; }
select { cursor: pointer; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 26px; }

.field-note { font-size: 11px; color: var(--text-3); line-height: 1.4; }
.field-note.warn { color: var(--warn); }

/* ---------- 负债明细卡片 ---------- */

.debt-cards { padding: 2px 16px 16px; display: flex; flex-direction: column; gap: 10px; }

.debt-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 9px 11px 10px;
}

.debt-head { display: flex; align-items: center; gap: 6px; }

.debt-name {
  flex: 1;
  height: 28px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  border-color: transparent;
  background: transparent;
  padding-left: 3px;
}
input.debt-name { border-color: transparent; background: transparent; }
input.debt-name:hover { border-color: var(--border-strong); }
input.debt-name:focus { background: var(--surface); border-color: var(--accent-line); }

.debt-del {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-3);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.debt-del:hover { color: var(--neg); border-color: var(--neg); }

.debt-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.debt-f.full { grid-column: span 2; }
.debt-f > span { font-size: 11.5px; color: var(--text-2); }

.debt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 8px; margin-top: 9px; }

.debt-sum {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-strong);
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}
.debt-sum .muted { color: var(--text-3); }

.debt-add {
  width: 100%;
  height: 32px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.debt-add:hover {
  border-color: var(--accent-line);
  color: var(--accent-line);
  background: color-mix(in srgb, var(--accent-line) 7%, transparent);
}

.debt-empty { font-size: 11.5px; color: var(--text-3); line-height: 1.6; padding: 2px 0; }

/* 公积金冲还商贷设置 */
.debt-offset {
  margin: 2px 16px 16px;
  padding: 10px 12px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-line) 4%, transparent);
}
.debt-offset-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.debt-offset-head span {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--text-3);
}
.debt-offset .fields { padding: 9px 0 0; }
.debt-offset-note {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 10.5px;
  color: var(--text-3);
  line-height: 1.6;
}

.debt-tag {
  display: block;
  margin-top: 1px;
  font-size: 10px;
  color: var(--text-3);
  font-weight: 400;
  letter-spacing: .2px;
}

.muted { color: var(--text-3); }

.results { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 15px 13px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.kpi .k-label { font-size: 11.5px; color: var(--text-3); margin-bottom: 6px; letter-spacing: .2px; }
.kpi .k-value {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -.4px;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.kpi .k-value small { font-size: 13px; font-weight: 400; color: var(--text-2); margin-left: 3px; }
.kpi .k-sub { font-size: 11.5px; color: var(--text-3); margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi.pos .k-value { color: var(--pos); }
.kpi.neg .k-value { color: var(--neg); }
.kpi.accent .k-value { color: var(--accent); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 13px; font-weight: 600; }
.card-head .sub { font-size: 11.5px; color: var(--text-3); margin-left: auto; }
.card-body { padding: 16px; }

.bar-row { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-top { display: flex; justify-content: space-between; font-size: 12px; }
.bar-top .lab { color: var(--text-2); }
.bar-top .val { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 500; }
.bar-track { height: 7px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width .5s cubic-bezier(.2,.7,.3,1); }

.chart-wrap { position: relative; width: 100%; }
#assetChart { display: block; width: 100%; height: 340px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 0 16px 14px; font-size: 11.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.box { width: 9px; height: 9px; border-radius: 2px; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 12px; text-align: right; font-size: 12.5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-weight: 500; color: var(--text-3); font-size: 11.5px; background: var(--surface-2); position: sticky; top: 0; }
th:first-child, td:first-child { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.neg { color: var(--neg); }
td.pos { color: var(--pos); }

.table-scroll { max-height: 560px; overflow: auto; }
.table-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.alert {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.5;
  border: 1px solid transparent;
}
.alert + .alert { margin-top: 8px; }
.alert .ico { flex-shrink: 0; font-weight: 600; font-size: 12px; line-height: 1.5; }
.alert.error { background: var(--neg-soft); color: var(--neg); border-color: color-mix(in srgb, var(--neg) 22%, transparent); }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.alert.info { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 20%, transparent); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.detail-list { display: flex; flex-direction: column; gap: 1px; }
.detail-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 12.5px; border-bottom: 1px dashed var(--border); }
.detail-row:last-child { border-bottom: 0; padding-bottom: 0; }
.detail-row .dl { color: var(--text-2); }
.detail-row .dv { font-variant-numeric: tabular-nums; font-weight: 500; }
.detail-row.total { border-top: 1px solid var(--border-strong); border-bottom: 0; margin-top: 6px; padding-top: 10px; font-weight: 600; }
.detail-row.total .dl { color: var(--text); font-weight: 600; }
.detail-row.sub { padding: 4px 0; border-bottom: 0; font-size: 11.5px; }
.detail-row.sub .dl { padding-left: 10px; color: var(--text-3); }
.detail-row.sub .dv { font-weight: 400; }
.detail-row .pos { color: var(--pos); }

.note { font-size: 11.5px; color: var(--text-3); line-height: 1.6; }

.footer-note {
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 22px 40px;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.7;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  background: var(--text);
  color: var(--bg);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1180px) {
  .layout { grid-template-columns: 1fr; }
  .form-panel { position: static; max-height: none; }
  .form-body { overflow: visible; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { padding: 9px 12px; gap: 6px; height: auto; flex-wrap: wrap; row-gap: 8px; }
  .brand { flex: 1 0 100%; }
  .brand h1 { font-size: 14px; }
  .brand .tag, .btn .btxt { display: none; }
  .topbar .spacer { display: none; }
  .btn { padding: 0 11px; height: 30px; font-size: 12.5px; }
  .layout { padding: 14px 12px 40px; gap: 14px; }
  .fields { grid-template-columns: 1fr 1fr; }
  .kpi .k-value { font-size: 21px; }
  .kpi-grid { gap: 9px; }
}

@media print {
  .topbar, .form-panel, .toast { display: none !important; }
  .layout { display: block; padding: 0; }
  body { background: #fff; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
  .results { gap: 12px; }
}

/* ============================================================
   返回首页 · 通用组件（源 _design/back-home.css）
   本页尚未接入全站令牌，这里只补 .back-home 需要的变量子集，
   不触碰本页 --accent / --surface 那套配色。
   ============================================================ */
:root{
  --c-brand-600:#009273; --c-brand-400:#5DCAA5;
  --c-brand-300:#9FE1CB; --c-brand-50:#EAF6F2;
  --c-surface:#FFFFFF; --c-border:#E9E9E9;
  --c-text-1:#1A1A1A; --c-text-2:#3D3D3D;
  --r-pill:999px; --fs-m:13px; --fs-s:12px;
}
[data-theme="dark"]{
  --c-brand-600:#3DD6A8; --c-brand-400:#6FE3C0;
  --c-brand-300:#4E7D72; --c-brand-50:#12241F;
  --c-surface:#15181B; --c-border:#262B2F;
  --c-text-1:#EEF1F3; --c-text-2:#CDD4D9;
}

.back-home,.back-home *{box-sizing:border-box}
.back-home{
  display:inline-flex;align-items:center;gap:7px;
  height:36px;padding:0 14px 0 5px;
  border:1px solid var(--c-border);border-radius:var(--r-pill);
  background:var(--c-surface);
  color:var(--c-text-2);text-decoration:none;white-space:nowrap;
  font-size:var(--fs-m);font-weight:500;letter-spacing:.02em;vertical-align:middle;
  flex:none;
  transition:background .16s ease,border-color .16s ease,color .16s ease,box-shadow .16s ease;
}
/* 高度 36 = 图标 24 + 上下各 5（含 1px 边框），与左内边距相等，才是同心嵌入 */
.back-home .bh-mark{
  flex:none;width:24px;height:24px;display:block;border-radius:7px;
  filter:drop-shadow(0 2px 4px rgba(0,146,115,.24));
  transition:transform .16s ease;
}
.back-home .bh-gt{transition:transform .16s ease}
.back-home:hover{
  background:var(--c-brand-50);border-color:var(--c-brand-300);
  color:var(--c-text-1);box-shadow:0 1px 3px rgba(0,146,115,.07);
}
/* 提示符 > 右移 1.2px：终端里按下回车后光标前移 */
.back-home:hover .bh-mark{transform:translateY(-1px)}
.back-home:hover .bh-gt{transform:translateX(1.2px)}
.back-home:active{transform:translateY(.5px)}
.back-home:active .bh-mark{transform:translateY(0)}
.back-home:focus-visible{outline:2px solid var(--c-brand-400);outline-offset:2px}
[data-theme="dark"] .back-home .bh-mark{filter:drop-shadow(0 2px 6px rgba(0,0,0,.5))}
[data-theme="dark"] .back-home:hover{box-shadow:none}

/* 小尺寸：与本页 32px 的 .btn 同高（32 = 图标 22 + 上下各 4） */
.back-home.sm{height:32px;padding:0 12px 0 4px;gap:6px;font-size:var(--fs-s)}
.back-home.sm .bh-mark{width:22px;height:22px;border-radius:6px}

/* 顶栏紧凑时（窄屏）压在 30px，仍保留文字 */
@media (max-width:640px){
  .back-home.sm{padding:0 11px 0 4px;gap:5px}
}
