/* 结算台（财务2）样式。只用台账已有的变量（--panel/--line/--ink/--ink-soft/--brand…），随主题走。 */
.f3 .f3-sec { font-weight: 700; font-size: 13px; color: var(--ink-soft); margin: 8px 0 6px; letter-spacing: .02em; }
.f3 .f3-acts { gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.f3 .f3-acts .btn, .f3 .f3-acts a.btn { text-decoration: none; }
.f3 .panel { margin-bottom: 12px; }
.f3 .num, .f3 th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.f3 .neg { color: #b7322c; }
.f3 .warn-t { color: #b3771e; font-weight: 700; }
.f3 .f3-void { opacity: .5; text-decoration: line-through; }
.f3 .f3-total td { font-weight: 700; border-top: 2px solid var(--line); }
.f3 .table-wrap { overflow-x: auto; }
.f3 .f3-tbl th { white-space: nowrap; }
.f3 .f3-th-in { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.f3 .f3-th-out { background: color-mix(in srgb, #1f6f6b 10%, transparent); }
.f3 .f3-out { font-weight: 600; }
.f3 .f3-draft td { color: var(--ink-soft); }
.f3 .f3-hl td, .f3 p.f3-hl, .f3 tr.f3-hl td { background: color-mix(in srgb, #e0a24e 25%, transparent); }
.f3 .f3-hl-cell { outline: 2px solid #b7322c; }
.f3 .f3-acts td { white-space: nowrap; }
.f3 td.f3-acts { display: flex; gap: 4px; flex-wrap: wrap; }
.f3 td.f3-acts .btn.mini + .btn.mini { margin-left: 0 !important; }

/* 状态条 */
.f3 .f3-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--line); background: var(--panel); margin-bottom: 12px; border-radius: 10px; overflow: hidden; }
.f3 .f3-step { padding: 10px 12px; border-right: 1px solid var(--line); border-top: 3px solid transparent; }
.f3 .f3-step:last-child { border-right: 0; }
.f3 .f3-step.ok { border-top-color: #2e7d4f; }
.f3 .f3-step.warn { border-top-color: #b3771e; }
.f3 .f3-step.bad { border-top-color: #b7322c; }
.f3 .f3-step-h { font-weight: 700; font-size: 13px; }
.f3 .f3-step-d { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

/* KPI */
.f3 .f3-kpis { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.f3 .f3-kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; min-width: 140px; }
.f3 .f3-kpi-v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.f3 .f3-kpi-l { font-size: 12px; color: var(--ink-soft); }

/* 缺什么 */
.f3 .f3-issue { padding: 4px 0; font-size: 13px; }
.f3 .f3-issue.error { color: #b7322c; }
.f3 .f3-issue.warn { color: #b3771e; }
.f3 .f3-issue.info { color: var(--ink-soft); }

/* chips */
.f3 .f3-chip { display: inline-block; font-size: 11.5px; line-height: 1; padding: 4px 8px; border-radius: 999px; background: var(--panel-soft, #eef2ee); color: var(--ink-soft); white-space: nowrap; vertical-align: .1em; }
.f3 .f3-chip.ok { background: #ddefe3; color: #2e7d4f; }
.f3 .f3-chip.warn { background: #f7ebd6; color: #b3771e; }
.f3 .f3-chip.bad { background: #f6e3e1; color: #b7322c; }
.f3 .f3-chip.muted { opacity: .8; }
.f3 .f3-chip.link { cursor: pointer; border-bottom: 1px dashed currentColor; }
html[data-theme="dark"] .f3 .f3-chip.ok { background: #1e3428; color: #6fcf97; }
html[data-theme="dark"] .f3 .f3-chip.warn { background: #3a2e1a; color: #e0a24e; }
html[data-theme="dark"] .f3 .f3-chip.bad { background: #3a2523; color: #e26a62; }

/* 分录 */
.f3 .f3-row-click { cursor: pointer; }
.f3 .f3-entries { display: grid; gap: 6px; padding: 6px 0; }
.f3 .f3-entry { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--panel); }
.f3 .f3-entry.reversed { opacity: .6; }
.f3 .f3-entry-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.f3 .f3-amt { font-variant-numeric: tabular-nums; font-weight: 700; margin-left: auto; }
.f3 .f3-entry-t { font-size: 13px; margin-top: 4px; line-height: 1.6; }
.f3 .f3-entry-s { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.f3 .f3-explain { max-width: 520px; white-space: normal; }

/* 12 个月 */
.f3 .f3-months { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.f3 .f3-month { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; cursor: pointer; background: var(--panel); }
.f3 .f3-month.cur { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 25%, transparent); }
.f3 .f3-month.locked { border-left: 3px solid #2e7d4f; }
.f3 .f3-month.run { border-left: 3px solid #b3771e; }
.f3 .f3-month-p { font-size: 12px; color: var(--ink-soft); }
.f3 .f3-month-v { font-weight: 700; font-variant-numeric: tabular-nums; }

/* 规则表 */
.f3 .f3-rules { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; }
@media (max-width: 900px) { .f3 .f3-rules { grid-template-columns: 1fr; } }
.f3 .f3-rules-nav { border-right: 1px solid var(--line); padding-right: 10px; }
.f3 .f3-rules-item { padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 4px; }
.f3 .f3-rules-item:hover { background: var(--panel-soft, #eef2ee); }
.f3 .f3-rules-item.on { background: var(--brand); color: var(--brand-ink); }
.f3 .f3-rules-item.on .mini { color: inherit; opacity: .85; }
.f3 .f3-short { font-family: ui-monospace, Consolas, monospace; font-size: 11px; opacity: .7; }
.f3 .f3-cnt { margin-left: auto; white-space: nowrap; }
.f3 .f3-rules-main { min-width: 0; }

/* 表单 */
.f3-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.f3-form .f3-form-sec { grid-column: 1 / -1; font-weight: 700; font-size: 12.5px; color: var(--ink-soft); margin-top: 6px; }
.f3-form .f3-field { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.f3-form .f3-field.f3-wide { grid-column: 1 / -1; }
.f3-form .f3-field > span { color: var(--ink-soft); font-size: 12px; }
.f3-form .f3-range { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 6px; align-items: center; }
.f3-form .f3-range label { white-space: nowrap; display: flex; gap: 3px; align-items: center; }
.f3-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.f3-grid2 .f3-field { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.f3-grid2 .f3-field > span { color: var(--ink-soft); font-size: 12px; }
.f3-check { display: flex; gap: 6px; align-items: flex-start; padding: 4px 0; font-size: 13px; }
.f3-facts .table-wrap { overflow-x: auto; max-height: 55vh; overflow-y: auto; }
.f3-facts .tbl input.input, .f3-facts .tbl select.input { min-width: 110px; padding: 4px 6px; }

/* 文档 */
.f3 .f3-doc { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr); gap: 14px; }
@media (max-width: 1000px) { .f3 .f3-doc { grid-template-columns: 1fr; } }
.f3 .f3-doc-text { max-height: 75vh; overflow: auto; font-size: 13.5px; line-height: 1.7; }
.f3 .f3-doc-text p { margin: 0 0 6px; }
.f3 .f3-bid { font-family: ui-monospace, Consolas, monospace; font-size: 10.5px; color: var(--ink-soft); margin-right: 6px; opacity: .7; white-space: nowrap; }
.f3 .f3-doctbl { border-collapse: collapse; margin: 6px 0 10px; width: 100%; font-size: 12.5px; }
.f3 .f3-doctbl td { border: 1px solid var(--line); padding: 3px 6px; vertical-align: top; }
.f3 .f3-doc-side .panel { margin-bottom: 10px; }
.f3 .f3-doc-side .input { width: 100%; margin: 4px 0; }
.f3 .f3-prow { border-top: 1px solid var(--line); padding: 8px 0; font-size: 13px; }
.f3 .f3-prow.bad { opacity: .75; }
.f3 .f3-quote { display: inline-block; max-width: 100%; }
.f3 .f3-contrib { padding: 4px 0; font-size: 12.5px; cursor: pointer; border-top: 1px solid var(--line); }

/* ── 三页签改版：月度表网格 / 折叠区 ── */
.f3-fold { padding: 0; overflow: hidden; }
.f3-fold-head { width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; font: inherit; font-weight: 600; cursor: pointer; color: inherit; }
.f3-fold-head:hover { background: rgba(127, 127, 127, .08); }
.f3-fold-body { padding: 0 12px 12px; }
.f3-sheet th, .f3-sheet td { white-space: nowrap; }
.f3-sheet .f3-col-aside { background: rgba(127, 127, 127, .07); color: #6b7280; }
.f3-sheet .f3-col-total { font-weight: 700; }
.f3-sheet .f3-cell-click { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.f3-sheet .f3-cell-click:hover { background: rgba(37, 99, 235, .10); }
.f3-sheet tr.f3-total td { border-top: 2px solid rgba(127, 127, 127, .35); font-weight: 700; }

/* ── 逐单明细 / 说明页 ── */
.f3-viewsel { margin: 4px 0 10px; }
.f3-help-sec { margin-bottom: 12px; }
.f3-help-sec p { margin: 0 0 8px; line-height: 1.75; }
.f3-help-row { display: grid; gap: 2px 16px; padding: 8px 0; border-top: 1px solid var(--line); }
.f3-help-row:first-of-type { border-top: 0; }
@media (min-width: 720px) { .f3-help-row { grid-template-columns: 12rem 1fr; } }
.f3-help-q { font-weight: 600; }
.f3-help-a { color: var(--ink-soft); line-height: 1.7; }
.f3-calcbox { border-left: 3px solid var(--brand, #2563eb); background: rgba(127,127,127,.06); padding: 10px 14px; margin: 6px 0 10px; line-height: 1.9; }
.f3-calcbox .f3-calc-sum { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; font-weight: 700; }

/* 核对与追溯：金额优先，原文和处理记录按需展开。 */
.f3-review-clause,.f3-review-change { padding: 12px; margin: 8px 0; border: 1px solid var(--border, #dce3eb); border-radius: 8px; }
.f3-review-clause .f3-quote { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; max-height: 160px; overflow: auto; }
.f3-entry-detail summary,.f3-issue summary,.f3-proposal summary { cursor: pointer; padding: 8px 0; font-size: 13px; }
.f3-review-change .btn { margin-top: 8px; }

.f3-business-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:12px; margin:12px 0; }
.f3-business-grid>div { padding:10px; background:var(--bg, #f7f9fc); border-radius:8px; overflow-wrap:anywhere; }
.f3-review-clause .f3-quote { display:block; }

/* 合同 → 规则 → 月度结算：一屏先看到当前状态和下一步。 */
.f3-basis-head { display:flex; justify-content:space-between; align-items:flex-start; gap:14px; flex-wrap:wrap; }
.f3-basis-head h3,.f3-document-card h3 { font-size:16px; line-height:1.5; margin:0 0 5px; overflow-wrap:anywhere; }
.f3-basis-head p,.f3-doc-summary p,.f3-document-card p,.f3-legacy-document p { margin:5px 0; line-height:1.65; }
.f3-basis-status,.f3-document-meta { display:flex; align-items:center; flex-wrap:wrap; gap:7px; margin:6px 0; }
.f3-basis-sources { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr)); gap:8px; margin:10px 0; }
.f3-basis-source { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px; border:1px solid var(--line); padding:10px 12px; border-radius:8px; background:var(--panel); }
.f3-basis-source b { display:block; margin:5px 0; overflow-wrap:anywhere; }
.f3-basis-pending { border-top:1px solid var(--line); padding-top:9px; font-size:12.5px; line-height:1.7; color:var(--ink-soft); }
.f3-basis-notes { margin-top:10px; }
.f3-basis-notes summary,.f3-review-fold>summary,.f3-advanced>summary,.f3-basis-quote>summary { cursor:pointer; line-height:1.65; font-weight:600; }
.f3-basis-notes p { margin:6px 0; }
.f3-document-list { display:grid; gap:0; }
.f3-document-counts { display:flex; gap:6px 16px; flex-wrap:wrap; font-size:13px; margin:10px 0; }
.f3-doc-journey { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:14px 0; }
.f3-doc-journey>div { padding:10px 12px; border:1px solid var(--line); border-radius:8px; }
.f3-doc-journey b { font-size:13px; }
.f3-review-fold { padding:12px; }
.f3-review-fold[open]>summary { margin-bottom:12px; }
.f3-review-fold .f3-business-grid { margin-bottom:10px; }
.f3 .f3-contrib { padding:10px 0; cursor:default; line-height:1.7; }
.f3-contrib .btn { margin-top:6px; }
.f3 .f3-doc-side { min-width:0; }
.f3 .f3-doc-side .btn.primary { min-height:38px; white-space:normal; }
.f3-advanced { margin-top:16px; padding-top:12px; border-top:1px solid var(--line); }
.f3-advanced p { line-height:1.7; }
.f3-advanced-export { font-size:12px; padding:6px; }
.f3-advanced-export summary { cursor:pointer; }
.f3-rule-basis { border-left:3px solid var(--line); padding:8px 12px; margin:8px 0; font-size:13px; line-height:1.75; overflow-wrap:anywhere; }
.f3-entry-basis { padding-top:10px; margin-top:10px; border-top:1px solid var(--line); }
.f3-basis-quote { margin-top:8px; }
.f3-basis-quote blockquote { margin:8px 0; padding:10px 12px; border-left:3px solid var(--brand); background:var(--panel-soft,rgba(127,127,127,.06)); white-space:pre-wrap; overflow-wrap:anywhere; }
.f3-entry-basis .f3-chip,.f3-basis .f3-chip,.f3-review-clause .f3-chip { white-space:normal; line-height:1.4; }
.f3-legacy-document { border-top:1px solid var(--line); padding:12px 0 4px; display:flex; justify-content:space-between; gap:10px; align-items:flex-start; flex-wrap:wrap; }
.f3-legacy-document>div:first-child { flex:1 1 240px; min-width:0; overflow-wrap:anywhere; }
.f3-legacy-text { white-space:pre-wrap; overflow-wrap:anywhere; max-height:55vh; overflow:auto; line-height:1.8; padding:12px 0; }
.f3-upload>label { display:flex; flex-direction:column; gap:6px; margin:10px 0; }
.f3-upload .input,.f3-upload input[type=file] { width:100%; max-width:100%; box-sizing:border-box; }
.f3-upload .f3-grid2>label { display:flex; flex-direction:column; gap:6px; }
.f3-upload p { line-height:1.65; }
.f3-upload summary { cursor:pointer; margin:10px 0; }
.f3 button:focus-visible,.f3 summary:focus-visible,.f3 a:focus-visible { outline:2px solid var(--brand); outline-offset:3px; }
@media (max-width:1000px) {
  .f3 .f3-doc-side { order:-1; }
  .f3 .f3-doc-text { max-height:50vh; }
}
@media (max-width:640px) {
  .f3 .f3-steps { grid-template-columns:1fr; }
  .f3 .f3-step { border-right:0; border-bottom:1px solid var(--line); padding:9px 12px; }
  .f3 .f3-step:last-child { border-bottom:0; }
  .f3-doc-journey { grid-template-columns:1fr; gap:7px; }
  .f3-basis-head>.btn { width:100%; min-height:38px; }
  .f3-document-card .f3-basis-head { gap:6px; }
  .f3 .f3-rules-nav { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:3px 8px; border-right:0; padding-right:0; }
  .f3 .f3-rules-nav>.f3-sec,.f3 .f3-rules-nav>.f3-advanced { grid-column:1 / -1; }
  .f3 .f3-rules-item { align-items:flex-start; flex-direction:column; }
  .f3 .f3-rules-item .f3-cnt { margin-left:0; }
  .f3-business-grid { grid-template-columns:1fr; }
  .f3-grid2,.f3-form { grid-template-columns:1fr; }
  .f3-rule-basis { padding:8px; }
  .f3 .f3-acts .btn { min-height:36px; white-space:normal; }
  .f3-document-counts { gap:6px 12px; }
  .f3-legacy-document .f3-acts { width:100%; }
}

.f3-more-actions { font-size:12.5px; color:var(--ink-soft); padding:6px 4px; }
.f3-more-actions summary { cursor:pointer; }
.f3-more-actions[open] .btn { margin-top:8px; }
.f3-legacy-batch { padding:10px 0; }
.f3-legacy-batch p { margin:6px 0; line-height:1.7; }
