* { box-sizing: border-box; }
body {
  margin: 0; font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: #f4f6fa; color: #1f2733; font-size: 13px;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
  background: #0f2742; color: #fff; padding: 12px 20px; position: sticky; top: 0; z-index: 10;
}
.brand { font-size: 18px; font-weight: 700; }
.brand .sub { font-size: 11px; opacity: .6; font-weight: 400; letter-spacing: 2px; margin-left: 6px; }
.controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.controls label { color: #cdd8e8; }
input[type=date] { padding: 5px 8px; border-radius: 6px; border: none; }
.rate { color: #cdd8e8; font-size: 12px; }
.rateInput { width: 92px; padding: 4px 6px; border-radius: 6px; border: none; }
button { cursor: pointer; border-radius: 6px; padding: 6px 12px; border: 1px solid transparent; font-size: 13px; }
button.primary { background: #2d8cff; color: #fff; }
button.ghost { background: rgba(255,255,255,.12); color: #fff; }
button.primary:hover { background: #1a78ec; }
button.ghost:hover { background: rgba(255,255,255,.22); }
.hidden { display: none !important; }

.summary { display: flex; gap: 14px; flex-wrap: wrap; padding: 16px 20px 4px; }
.card {
  background: #fff; border-radius: 12px; padding: 14px 18px; min-width: 160px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06); border-left: 4px solid #ccc;
}
.card .lab { color: #7a8699; font-size: 12px; }
.card .val { font-size: 20px; font-weight: 700; margin-top: 4px; }
.card.asset { border-color: #2e7d32; }
.card.liab { border-color: #c62828; }
.card.recv { border-color: #1565c0; }
.card.pay { border-color: #ef6c00; }
.card.net { border-color: #6a1b9a; background: #faf5ff; }
.card.net .val { color: #6a1b9a; font-size: 24px; }

.note { padding: 0 20px; color: #c0392b; font-size: 12px; min-height: 16px; }

main { padding: 8px 20px 60px; }
.block { background: #fff; border-radius: 10px; margin-bottom: 14px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.block-head { display: flex; gap: 10px; align-items: center; padding: 8px 14px; border-bottom: 1px solid #eef1f5; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; color: #fff; }
.tag.资产 { background: #2e7d32; } .tag.负债 { background: #c62828; }
.tag.应收 { background: #1565c0; } .tag.应付 { background: #ef6c00; }
.block-head .org { font-weight: 700; }
.block-head .acc { color: #667; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 6px 14px; text-align: right; border-bottom: 1px solid #f3f5f8; white-space: nowrap; }
th { color: #8a94a6; font-weight: 600; font-size: 11px; background: #fafbfd; }
td.item, th.item { text-align: left; color: #33415c; }
tr.subtotal td { font-weight: 700; background: #f7f9fc; border-top: 1px solid #e6eaf0; }
td .cell-input { width: 110px; text-align: right; padding: 3px 5px; border: 1px solid #cfd8e6; border-radius: 5px; }
.eq { color: #0f2742; font-weight: 600; }
.neg { color: #c62828; }
.foot { position: fixed; bottom: 0; left: 0; right: 0; background: #eef1f5; color: #667; font-size: 11px; padding: 6px 20px; text-align: center; }

@media print {
  .topbar, .foot, .note { display: none; }
  body { background: #fff; }
  .block { box-shadow: none; border: 1px solid #ddd; }
}

/* 增减 */
.up { color: #2e7d32; font-weight: 600; }
.down { color: #c62828; font-weight: 600; }
.na { color: #c3cad6; }

a.btn-link { text-decoration: none; display: inline-flex; align-items: center; }

/* ===== 后台 ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #0f2742; }
.login-box { background: #fff; padding: 32px 28px; border-radius: 14px; width: 320px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.login-box h2 { margin: 0 0 18px; font-size: 18px; }
.login-box input { width: 100%; padding: 10px 12px; margin-bottom: 12px; border: 1px solid #cfd8e6; border-radius: 8px; font-size: 14px; }
.login-box button { width: 100%; padding: 10px; font-size: 15px; }
.login-box .err { color: #c62828; font-size: 13px; margin-top: 8px; min-height: 18px; }

.tab { background: rgba(255,255,255,.12); color: #fff; }
.tab.active { background: #2d8cff; }
.tab-panel { padding: 8px 20px 60px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 0 6px; }
.toolbar label { color: #33415c; }
.toolbar .rateInput { border: 1px solid #cfd8e6; }
.toolbar .rate { color: #33415c; }
.msg { color: #2d8cff; font-size: 12px; }
.admin .summary { padding: 10px 0 4px; }

td .cell-input { width: 120px; text-align: right; padding: 4px 6px; border: 1px solid #cfd8e6; border-radius: 5px; font-size: 13px; }
td .name-input { width: 100%; min-width: 180px; padding: 4px 6px; border: 1px solid transparent; border-radius: 5px; font-size: 13px; background: transparent; }
td .name-input:hover { border-color: #e0e6ef; }
td .name-input:focus { border-color: #2d8cff; background: #fff; outline: none; }
td .src-input { padding: 4px 6px; border: 1px solid #cfd8e6; border-radius: 5px; font-size: 12px; }
.admin tr.disabled td { opacity: .45; }
.flat { color: #99a; }
.admin table th, .admin table td { text-align: left; }
.admin table th:not(.item), .admin table td:not(.item):not(.ops) { text-align: right; }
.admin .ops { white-space: nowrap; }

.struct-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.struct-table th { background: #fafbfd; color: #8a94a6; font-size: 11px; text-align: left; padding: 8px 12px; }
.struct-table td { text-align: left; padding: 7px 12px; border-bottom: 1px solid #f3f5f8; }
.struct-table tr.disabled { opacity: .5; }
.struct-table .on { color: #2e7d32; } .struct-table .off { color: #c62828; }
.struct-table .ops button { padding: 3px 8px; margin-right: 4px; background: #eef2f8; font-size: 12px; }
.struct-table .ops button.danger { background: #fde8e8; color: #c62828; }

.modal { position: fixed; inset: 0; background: rgba(15,39,66,.55); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-box { background: #fff; border-radius: 14px; padding: 24px; width: 420px; max-height: 90vh; overflow: auto; }
.modal-box h3 { margin: 0 0 16px; }
.modal-box label { display: block; margin-bottom: 12px; font-size: 13px; color: #33415c; }
.modal-box input[type=text], .modal-box input:not([type]), .modal-box select { width: 100%; padding: 8px 10px; margin-top: 4px; border: 1px solid #cfd8e6; border-radius: 7px; font-size: 14px; }
.modal-box .cks { display: flex; gap: 16px; margin-top: 6px; }
.modal-box label.ck { display: inline-flex; align-items: center; gap: 5px; margin: 0; }
.modal-box label.ck input { width: auto; margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }

/* ===== 报表表格·财务排版（纯显示层，2026-06-11） ===== */
.z { color: #c7cedb; }                                                   /* 空/零占位「–」 */
.report-block th, .report-block td { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; padding-top: 8px; padding-bottom: 8px; }
/* 固定列宽：所有区块表格列几何一致 → 金额、币种跨区块上下对齐 */
.report-block table { table-layout: fixed; }
.report-block th:not(.item), .report-block td:not(.item) { white-space: nowrap; }
.report-block th:nth-child(1), .report-block td:nth-child(1) { width: 24%; }  /* 细项 */
.report-block th:nth-child(2), .report-block td:nth-child(2) { width: 16%; }  /* CNY */
.report-block th:nth-child(3), .report-block td:nth-child(3) { width: 14%; }  /* HKD */
.report-block th:nth-child(4), .report-block td:nth-child(4) { width: 13%; }  /* USD */
.report-block th:nth-child(5), .report-block td:nth-child(5) { width: 17%; }  /* 换算CNY */
.report-block th:nth-child(6), .report-block td:nth-child(6) { width: 16%; }  /* 较前日 */
.report-block tbody tr:nth-child(even):not(.subtotal) td { background: #fbfcff; }   /* 斑马纹 */
.report-block tbody tr:hover:not(.subtotal) td { background: #eef5ff; }
.report-block td.eq { color: #0f2742; font-weight: 700; background: #f5f9ff; }      /* 换算CNY 强调列 */
.report-block tr.subtotal td { background: #f5f8fc; }
.report-block tr.subtotal td.eq { background: #e9f1fc; }
@media print { .report-block td.eq, .report-block tr.subtotal td { background: transparent !important; } }

/* ===== 银行现金视图（只读·资金分布，2026-06-11） ===== */
.bc-toggle { display: inline-flex; background: #eef2f8; border-radius: 9px; padding: 3px; margin-left: auto; }
.bc-toggle button { border: none; background: transparent; padding: 6px 16px; border-radius: 7px; font-size: 13px; color: #5a6b86; cursor: pointer; }
.bc-toggle button.on { background: #fff; color: #0f2742; font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.bc-kpis { grid-template-columns: repeat(4, 1fr); }
.bc-cur { display: flex; gap: 18px; margin: 2px 0 16px; flex-wrap: wrap; }
.bc-cur .seg { font-size: 12px; color: #5a6b86; }
.bc-cur b { color: #0f2742; font-variant-numeric: tabular-nums; }
.bc-main { display: flex; gap: 26px; align-items: center; background: #fff; border-radius: 14px; padding: 22px 26px; box-shadow: 0 1px 4px rgba(0,0,0,.05); margin-bottom: 18px; }
.bc-donut { width: 200px; height: 200px; flex: none; }
.bc-d-total { font-size: 21px; font-weight: 800; fill: #0f2742; }
.bc-d-lab { font-size: 11px; fill: #8a94a6; }
.bc-bars { flex: 1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.bc-row { display: flex; align-items: center; gap: 12px; }
.bc-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.bc-name { width: 110px; flex: none; font-weight: 600; color: #33415c; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-track { flex: 1; height: 14px; background: #eef1f5; border-radius: 8px; overflow: hidden; }
.bc-fill { display: block; height: 14px; border-radius: 8px; }
.bc-pct { width: 52px; text-align: right; font-variant-numeric: tabular-nums; color: #5a6b86; font-size: 13px; }
.bc-amt { width: 150px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: #0f2742; }
.bc-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.bc-table th { background: #fafbfd; color: #8a94a6; font-size: 11px; text-align: right; padding: 10px 14px; white-space: nowrap; }
.bc-table th:first-child, .bc-table td:first-child { text-align: left; }
.bc-table td { padding: 9px 14px; border-top: 1px solid #f3f5f8; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bc-table tr:hover td { background: #f7faff; }
.bc-table td.bc-eq { font-weight: 700; color: #0f2742; }
.bc-table .bk { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: #33415c; }
@media (max-width: 1100px) { .bc-kpis { grid-template-columns: repeat(2, 1fr); } .bc-main { flex-direction: column; } }

/* ===== 上手情况视图（只读分析，2026-06-11） ===== */
.bk-tblwrap { overflow-x: auto; }
.bk-table th, .bk-table td { padding: 9px 12px; }
.bk-sumrow { cursor: pointer; }
.bk-sumrow:hover td { background: #f1f6ff; }
.bk-lbl { font-weight: 600; color: #33415c; }
.bk-stale { font-size: 10px; color: #b45309; background: #fff7ed; border-radius: 6px; padding: 1px 6px; margin-left: 6px; }
.bk-exp { color: #9aa7bd; width: 28px; }
.bk-use { font-weight: 700; border-radius: 6px; padding: 1px 8px; font-size: 12px; }
.bk-use.g { color: #16794a; background: #e7f6ee; }
.bk-use.a { color: #b45309; background: #fff4e5; }
.bk-use.r { color: #c62828; background: #fdecec; }
.bk-posrow td { border-top: none; }
.bk-pos { background: #f7faff; padding: 6px 14px 14px; border-bottom: 2px solid #e6eaf0; }
.bk-empty { color: #9aa7bd; padding: 12px; }
.bk-postbl { width: 100%; border-collapse: collapse; }
.bk-postbl th { background: transparent; color: #8a94a6; font-size: 11px; text-align: right; padding: 6px 10px; border-bottom: 1px solid #e6eaf0; white-space: nowrap; }
.bk-postbl th:nth-child(1), .bk-postbl th:nth-child(2), .bk-postbl td:nth-child(1), .bk-postbl td:nth-child(2) { text-align: left; }
.bk-postbl td { padding: 5px 10px; border-bottom: 1px solid #f3f5f8; text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; white-space: nowrap; }
.bk-nm { color: #33415c; }
.bk-dir { font-size: 11px; border-radius: 5px; padding: 0 6px; }
.bk-dir.l { color: #16794a; background: #e7f6ee; }
.bk-dir.s { color: #c62828; background: #fdecec; }
/* 🔍核对 按钮 + 溯源弹窗 */
.bk-chk { border: 1px solid #cfe0f7; background: #eef4fd; color: #2d6cd0; border-radius: 6px; padding: 3px 9px; font-size: 12px; cursor: pointer; }
.bk-chk:hover { background: #e0ecfb; }
.dlg.bk-srcdlg { width: 880px; max-width: 94vw; }
.bk-srchd { display: flex; align-items: center; justify-content: space-between; }
.bk-srchd h3 { margin: 0; }
.bk-srcmeta { margin: 6px 0 14px; }
.bk-srcsec { font-size: 13px; font-weight: 700; color: #33415c; margin: 14px 0 8px; }
.bk-bdtbl { width: 100%; border-collapse: collapse; }
.bk-bdtbl td { padding: 7px 10px; border-bottom: 1px solid #f0f3f8; font-size: 13px; }
.bk-bdtbl .bv { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bk-bdtbl .bc { color: #8a94a6; width: 44px; }
.bk-bdtbl .bn { color: #8a94a6; font-size: 12px; }
.bk-bdtbl tr.bsum td { background: #f4f8ff; font-weight: 700; color: #0f2742; border-top: 1px solid #d8e6fb; }
.bk-srcwrap { max-height: 320px; overflow: auto; border: 1px solid #eef1f5; border-radius: 8px; }
.bk-srctbl { border-collapse: collapse; font-size: 12px; }
.bk-srctbl td { padding: 4px 8px; border: 1px solid #f0f3f8; white-space: nowrap; font-variant-numeric: tabular-nums; color: #475569; }
.srchl { background: #d6f5e3 !important; color: #0f5132 !important; font-weight: 700; outline: 2px solid #34c77b; }
.srchl-lgd { color: #16a34a; font-weight: 700; }
