/* =============================================================================
 * 婚前经济风险评估系统 · 样式
 * ========================================================================== */
:root {
  --bg: #f2f4f8;
  --panel: #ffffff;
  --panel-2: #fafbfd;
  --line: #e3e7ef;
  --line-2: #ccd4e2;
  --text: #131a28;
  --text-2: #3b4557;
  --muted: #6b7688;
  --brand: #2b5bd7;
  --brand-dk: #1d43a5;
  --brand-soft: #edf2ff;
  --ok: #159a5a;
  --ok-soft: #e8f7ef;
  --warn: #c68a12;
  --warn-soft: #fdf4e3;
  --bad: #cf4d23;
  --bad-soft: #fdeee8;
  --crit: #a51e1e;
  --crit-soft: #fbeaea;
  --shadow: 0 1px 2px rgba(19,26,40,.05), 0 8px 24px -12px rgba(19,26,40,.16);
  --radius: 12px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.62 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 88px; /* 给底部固定操作条留空间，避免盖住页脚备案号/赞赏链接 */
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
a { color: var(--brand); }
button { font-family: inherit; }

/* ------------------------------------------------------------- 顶部栏 */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1180px; margin: 0 auto; padding: 10px 22px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: linear-gradient(140deg, #2b5bd7, #1d3f96);
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; letter-spacing: -.5px;
  box-shadow: 0 4px 12px -4px rgba(43,91,215,.6);
}
.brand-t { min-width: 0; }
.brand-t b { display: block; font-size: 15px; line-height: 1.25; }
.brand-t span { display: block; font-size: 11px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.topbar .spacer { flex: 1 1 auto; }

.steps { display: flex; gap: 4px; background: var(--panel-2); border: 1px solid var(--line); padding: 3px; border-radius: 10px; }
.step-chip {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 6px 13px; border-radius: 7px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.step-chip i {
  width: 17px; height: 17px; border-radius: 50%; background: #dfe4ee; color: #59637a;
  font-style: normal; font-size: 10.5px; display: grid; place-items: center; font-weight: 700;
}
.step-chip.active { background: #fff; color: var(--brand); box-shadow: var(--shadow); }
.step-chip.active i { background: var(--brand); color: #fff; }
.step-chip.done i { background: var(--ok); color: #fff; }

/* ------------------------------------------------------------- 容器 */
.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 22px 120px; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden;
}
.card-hd {
  padding: 15px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--panel-2);
}
.card-hd h2 { font-size: 15.5px; }
.card-hd .idx {
  width: 24px; height: 24px; border-radius: 7px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none;
}
.card-hd .desc { font-size: 12.5px; color: var(--muted); flex: 1 1 260px; }
.card-bd { padding: 20px; }

.hint { font-size: 12.5px; color: var(--muted); }
.note {
  background: var(--brand-soft); border: 1px solid #d6e2ff; color: #23407f;
  border-radius: 9px; padding: 10px 13px; font-size: 12.5px; line-height: 1.7;
}
.note.warn { background: var(--warn-soft); border-color: #f0dcb4; color: #7c5a08; }

/* ------------------------------------------------------------- 表单 */
.grid { display: grid; gap: 13px 16px; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.field > label .tag {
  font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px;
  background: var(--brand-soft); color: var(--brand); letter-spacing: .02em;
}
.field .ctl {
  width: 100%; padding: 8px 10px; font-size: 13.5px; color: var(--text);
  background: #fff; border: 1px solid var(--line-2); border-radius: 8px; outline: 0;
  transition: border-color .15s, box-shadow .15s;
}
.field .ctl:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43,91,215,.13); }
.field select.ctl { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7688'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field input[type=range] { width: 100%; accent-color: var(--brand); }

.subhd {
  margin: 4px 0 12px; font-size: 12.5px; font-weight: 700; color: var(--muted);
  letter-spacing: .06em; text-transform: uppercase; display: flex; align-items: center; gap: 10px;
}
.subhd::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.split { display: grid; gap: 22px; grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------- 按钮 */
.btn {
  border: 1px solid var(--line-2); background: #fff; color: var(--text-2);
  padding: 8px 15px; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background .14s, border-color .14s, color .14s, transform .08s;
}
.btn:hover { background: #f6f8fc; border-color: #b6c1d4; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px -5px rgba(43,91,215,.75); }
.btn.primary:hover { background: var(--brand-dk); border-color: var(--brand-dk); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ------------------------------------------------------------- 上传区 */
.drop {
  border: 1.6px dashed var(--line-2); border-radius: var(--radius); background: var(--panel-2);
  padding: 26px 20px; text-align: center; cursor: pointer; transition: all .16s;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop .big { font-size: 14.5px; font-weight: 700; margin-bottom: 4px; }
.drop .sm { font-size: 12.5px; color: var(--muted); }
.drop .ico { font-size: 26px; line-height: 1; margin-bottom: 8px; opacity: .75; }

.log { margin-top: 14px; }
.log-box {
  background: #0f1626; color: #c6d2e6; border-radius: 9px; padding: 12px 14px;
  font: 12px/1.75 var(--mono); max-height: 240px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}
.log-box .ok { color: #6ee7a8; }
.log-box .warn2 { color: #ffd27d; }

/* ------------------------------------------------------------- 金额网格 */
.mtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.mtable th, .mtable td { border: 1px solid var(--line); padding: 7px 9px; }
.mtable th { background: var(--panel-2); font-weight: 700; font-size: 12.5px; color: var(--text-2); text-align: center; white-space: nowrap; }
.mtable td.cat { font-weight: 600; color: var(--text-2); white-space: nowrap; background: var(--panel-2); }
.mtable td.hintc { font-size: 11.5px; color: var(--muted); }
.mtable input {
  width: 100%; border: 0; background: transparent; padding: 4px 2px; font-size: 13.5px;
  text-align: right; font-family: var(--mono); color: var(--text); outline: 0;
}
.mtable input:focus { background: var(--brand-soft); border-radius: 4px; }
.mtable td.num { text-align: right; font-family: var(--mono); font-weight: 700; background: #fbfcfe; }
.mtable tr.total td { background: var(--brand-soft); font-weight: 700; }

/* ------------------------------------------------------------- 结论横幅 */
.verdict {
  border-radius: var(--radius); padding: 22px 24px; color: #fff; position: relative; overflow: hidden;
  box-shadow: var(--shadow);
}
.verdict::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px;
  border-radius: 50%; background: rgba(255,255,255,.09);
}
.verdict .top { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; position: relative; z-index: 1; }
.verdict .lvs { display: flex; flex-direction: column; gap: 4px; }
.verdict .lvname { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.verdict .lvcode { font-size: 12px; opacity: .82; letter-spacing: .1em; }
.verdict .vd { font-size: 14.5px; font-weight: 600; margin-top: 2px; }
.verdict .act { font-size: 12.8px; opacity: .9; margin-top: 6px; max-width: 620px; line-height: 1.65; }
.verdict .kpis { margin-left: auto; display: flex; gap: 26px; flex-wrap: wrap; }
.verdict .kpi { text-align: right; }
.verdict .kpi b { display: block; font-size: 21px; font-weight: 800; line-height: 1.2; font-family: var(--mono); }
.verdict .kpi span { font-size: 11.5px; opacity: .85; }
.vetos { margin-top: 16px; position: relative; z-index: 1; display: flex; flex-direction: column; gap: 7px; }
.veto {
  background: rgba(0,0,0,.18); border: 1px solid rgba(255,255,255,.24); border-radius: 8px;
  padding: 8px 12px; font-size: 12.5px;
}
.veto b { font-family: var(--mono); }
.portrait { font-size: 13px; color: var(--text-2); line-height: 1.85; }

/* ------------------------------------------------------------- 数据表 */
.dtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.dtable th {
  text-align: left; font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 8px 10px; border-bottom: 1.5px solid var(--line-2); white-space: nowrap;
}
.dtable th.num, .dtable td.num { text-align: right; font-family: var(--mono); }
.dtable td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dtable tr:hover td { background: #fafbfd; }
.dtable tr.sum td { border-top: 1.6px solid var(--line-2); background: var(--brand-soft); font-weight: 700; }
.dtable tr.sum:hover td { background: var(--brand-soft); }
.dtable td .sub { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; font-family: inherit; }
.dtable .bar { height: 4px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 6px; }
.dtable .bar i { display: block; height: 100%; background: var(--brand); }
details > summary { cursor: pointer; font-size: 12.5px; color: var(--brand); font-weight: 600; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; }
details[open] > summary::before { content: "▾ "; }
details .dbody { margin-top: 8px; }
.mini { width: 100%; border-collapse: collapse; font-size: 12px; }
.mini th, .mini td { padding: 4px 8px; border-bottom: 1px dashed var(--line); }
.mini th { color: var(--muted); text-align: left; font-weight: 600; }
.mini td.num { text-align: right; font-family: var(--mono); }

/* ------------------------------------------------------------- 评分卡 */
.score-hd { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.ring { width: 92px; height: 92px; flex: none; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring .in {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
}
.ring .in b { font-size: 25px; font-weight: 800; font-family: var(--mono); line-height: 1; }
.ring .in span { font-size: 10.5px; color: var(--muted); }
.sc { display: flex; flex-direction: column; gap: 11px; flex: 1 1 380px; }
.sc-row { font-size: 12.8px; }
.sc-row .ln { display: flex; align-items: baseline; gap: 8px; }
.sc-row .ln b { font-weight: 600; }
.sc-row .ln .v { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.sc-row .ln .g { font-family: var(--mono); font-weight: 700; width: 54px; text-align: right; }
.sc-row .trk { height: 6px; border-radius: 4px; background: #eaeef5; margin-top: 5px; overflow: hidden; }
.sc-row .trk i { display: block; height: 100%; border-radius: 4px; }
.sc-row .hint { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ------------------------------------------------------------- 旗标 */
.flag { border: 1px solid var(--line); border-left-width: 3px; border-radius: 8px; padding: 9px 13px; margin-bottom: 8px; background: #fff; }
.flag .fh { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.flag .fc { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.flag .fd { font-size: 12.5px; color: var(--text-2); margin-top: 3px; line-height: 1.7; }
.flag.high { border-left-color: var(--crit); background: var(--crit-soft); }
.flag.high .fh { color: var(--crit); }
.flag.mid { border-left-color: var(--warn); background: var(--warn-soft); }
.flag.mid .fh { color: #8c6209; }
.flag.good { border-left-color: var(--ok); background: var(--ok-soft); }
.flag.good .fh { color: var(--ok); }
.sev { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: rgba(0,0,0,.07); }

/* ------------------------------------------------------------- 建议 */
.adv { counter-reset: a; display: flex; flex-direction: column; gap: 9px; }
.adv-item {
  counter-increment: a; position: relative; padding: 11px 14px 11px 42px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; font-size: 13px; line-height: 1.75;
}
.adv-item::before {
  content: counter(a); position: absolute; left: 12px; top: 11px;
  width: 20px; height: 20px; border-radius: 6px; background: var(--brand); color: #fff;
  font-size: 11.5px; font-weight: 700; display: grid; place-items: center;
}

/* ------------------------------------------------------------- 图表 */
.chart { width: 100%; overflow: visible; }
.chart text { font-size: 10.5px; fill: var(--muted); font-family: inherit; }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line-2); stroke-width: 1.2; }

/* ------------------------------------------------------------- 档案 */
.archive { width: 100%; border-collapse: collapse; font-size: 12.8px; }
.archive th, .archive td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.archive th { font-size: 11.5px; color: var(--muted); font-weight: 700; background: var(--panel-2); }
.archive td.num { text-align: right; font-family: var(--mono); }
.taglv { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11px; font-weight: 700; color: #fff; }

/* ------------------------------------------------------------- 底部操作条 */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  background: rgba(255,255,255,.95); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding: 11px 22px;
}
.actionbar-in { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.actionbar .sum { font-size: 12.8px; color: var(--muted); font-family: var(--mono); }
.actionbar .sum b { color: var(--text); }
.actionbar .spacer { flex: 1 1 auto; }

footer.foot { max-width: 1180px; margin: 8px auto 0; padding: 0 22px 18px; font-size: 11.5px; color: var(--muted); line-height: 1.8; }

/* 页脚链接行（赞赏 / 邮箱 / 备案号） */
.foot-links {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line);
  font-size: 12px;
}
.foot-link {
  color: var(--text-2, #44506a); text-decoration: none; background: none;
  border: 0; padding: 0; font: inherit; cursor: pointer;
}
a.foot-link:hover, button.foot-link:hover { color: #2b5bd7; text-decoration: underline; }
.foot-sep { color: var(--line-2); }
.reward-trigger { color: #b8860b; font-weight: 600; }

/* 赞赏码弹层 */
.reward-modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; }
.reward-modal[hidden] { display: none; }
.reward-mask { position: absolute; inset: 0; background: rgba(15,20,32,.55); backdrop-filter: blur(3px); }
.reward-panel {
  position: relative; z-index: 1; background: #17181c; border-radius: 14px;
  padding: 26px 26px 20px; max-width: 340px; width: calc(100vw - 48px);
  box-shadow: 0 18px 60px rgba(0,0,0,.4); text-align: center;
}
.reward-img { width: 100%; border-radius: 8px; display: block; }
.reward-close {
  position: absolute; top: 8px; right: 12px; z-index: 2;
  background: none; border: 0; color: #9aa0ab; font-size: 24px; line-height: 1;
  cursor: pointer; padding: 4px;
}
.reward-close:hover { color: #fff; }

.hidden { display: none !important; }
.sec-anchor { scroll-margin-top: 76px; }

/* ------------------------------------------------------------- 打印 */
@media print {
  body { background: #fff; }
  .topbar, .actionbar, .noprint, footer.foot .np { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; border-color: #ccc; }
  .btn { display: none !important; }
  .verdict { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
