:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --income: #047857;
  --expense: #b91c1c;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --flag-row: #fff7ed;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .05);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
h1, h2 { margin: 0; font-weight: 600; }
h1 { font-size: 20px; }
h1 span { color: var(--muted); font-weight: 400; font-size: 14px; margin-left: 6px; }
h2 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.income { color: var(--income); }
.expense { color: var(--expense); }
.warn { color: var(--warn); }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.top-actions, .batch-actions, .filter-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

main { max-width: 1440px; margin: 0 auto; padding: 18px 24px 60px; display: grid; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.dot.income { background: #10b981; }
.dot.expense { background: #ef4444; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.filters { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.filters label, .adjust-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input, select, button { font: inherit; }
input, select {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: #fff; color: var(--text);
  min-width: 120px;
}
input[type="search"] { min-width: 220px; }
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 8px;
  padding: 7px 12px; cursor: pointer; transition: .15s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #0b5f59; color: #fff; }
.btn.small { padding: 5px 9px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); }
.card-label { color: var(--muted); font-size: 12px; }
.card-value { font-size: 22px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

.chart { min-height: 220px; overflow-x: auto; }
.chart svg { display: block; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.table-wrap.short { max-height: 280px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
#tbl-txns { min-width: 1080px; table-layout: fixed; }
#tbl-findings { min-width: 620px; table-layout: fixed; }
#tbl-findings td:nth-child(1), #tbl-findings td:nth-child(2) { white-space: nowrap; }
#tbl-txns td, #tbl-txns th { overflow-wrap: anywhere; }
#tbl-txns td:nth-child(2), #tbl-txns td:nth-child(3),
#tbl-txns td:nth-child(5), #tbl-txns td:nth-child(6),
#tbl-txns td:nth-child(7), #tbl-txns td:nth-child(8) { white-space: nowrap; }
#tbl-txns td:nth-child(4) { overflow-wrap: break-word; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f9fafb; color: var(--muted); font-weight: 600; font-size: 12px; position: sticky; top: 0; z-index: 1; }
tbody tr:hover { background: #fafafa; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.flagged { background: var(--flag-row); }
.check { width: 34px; }
.check input { min-width: 0; }

.badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; background: #f3f4f6; color: var(--muted); }
.badge.flag { background: var(--warn-soft); color: var(--warn); }
.badge.manual { background: var(--accent-soft); color: var(--accent); }
.desc-main { font-weight: 500; }
.desc-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.amount { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.adjust-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.adjust-form .wide { grid-column: span 2; }
.adjust-form button { grid-column: span 2; justify-self: start; }

.toast {
  position: fixed; right: 20px; bottom: 20px; max-width: 420px; padding: 12px 14px; border-radius: 10px;
  background: #111827; color: #fff; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px);
  pointer-events: none; transition: .2s ease; z-index: 50; font-size: 13px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #991b1b; }

.empty { padding: 18px; color: var(--muted); text-align: center; }

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  main { padding: 12px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .filters { align-items: stretch; }
  .filters label { width: 100%; }
  input, select, input[type="search"] { width: 100%; min-width: 0; }
  .adjust-form { grid-template-columns: 1fr; }
  .adjust-form .wide, .adjust-form button { grid-column: span 1; }
}

/* ---- 导入弹窗 ---- */
.hidden { display: none !important; }
.modal {
  border: 0; border-radius: 16px; padding: 0; width: min(94vw, 560px);
  box-shadow: 0 24px 80px rgba(15, 23, 42, .28); background: var(--panel); color: var(--text);
}
.modal::backdrop { background: rgba(15, 23, 42, .45); }
.modal form { display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 18px 0; }
.modal-head h2 { font-size: 17px; }
.modal-head p { margin-top: 4px; }
.modal-body { display: grid; gap: 12px; padding: 16px 18px; max-height: 70vh; overflow-y: auto; }
.modal-body label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 18px 18px; }
.icon-btn {
  border: 0; background: transparent; color: var(--muted); font-size: 26px; line-height: 1;
  cursor: pointer; padding: 0 4px;
}
.icon-btn:hover { color: var(--text); }
.import-result { font-size: 13px; }
.import-result:empty { display: none; }
.import-ok { color: var(--income); font-weight: 600; margin-bottom: 6px; }
.import-error { color: var(--expense); white-space: pre-wrap; }
.import-list { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.import-list b { color: var(--text); font-weight: 500; }
.import-progress { color: var(--muted); }

/* 图表跟随容器宽度 */
.chart svg { max-width: 100%; height: auto; }

@media (max-width: 820px) {
  .top-actions { width: 100%; }
  .top-actions .btn { flex: 1; }
  #tbl-accounts, #tbl-findings { min-width: 0; table-layout: auto; }
}

@media (max-width: 700px) {
  html, body { overflow-x: hidden; max-width: 100%; }
  body { font-size: 14px; }
  .topbar { padding: 12px; }
  .topbar, main { width: 100%; max-width: 100vw; }
  .top-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
  .top-actions .btn { width: 100%; flex: none; }

  .table-wrap, #tbl-accounts, #tbl-accounts tbody, #tbl-accounts tr, #tbl-accounts td,
  #tbl-findings, #tbl-findings tbody, #tbl-findings tr, #tbl-findings td,
  #tbl-txns, #tbl-txns tbody, #tbl-txns tr, #tbl-txns td {
    width: 100% !important; min-width: 0 !important; max-width: 100vw !important;
    box-sizing: border-box;
  }
  #tbl-accounts td > *, #tbl-findings td > * { min-width: 0; }
  .chart, .chart svg { width: 100% !important; max-width: 100% !important; }
  .panel { overflow: hidden; }
  h1 { font-size: 18px; }
  main { padding: 10px; gap: 12px; }
  .panel { padding: 12px; border-radius: 10px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card { padding: 10px; }
  .card-value { font-size: 18px; }
  .filters { gap: 8px; }
  .filters label { width: 100%; }
  .filter-actions { width: 100%; }
  .filter-actions .btn { flex: 1; }
  .chart { min-height: 180px; }

  /* 流水表 → 卡片 */
  .table-wrap { border: 0; overflow: visible; }
  #tbl-txns { min-width: 0; display: block; table-layout: auto; }
  #tbl-txns colgroup { display: none; }
  #tbl-txns thead { display: none; }
  #tbl-txns tbody { display: block; }
  #tbl-txns tr {
    display: block; border: 1px solid var(--line); border-radius: 10px;
    margin-bottom: 10px; padding: 8px 10px; background: #fff;
  }
  #tbl-txns td {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    border: 0; padding: 4px 0; white-space: normal !important; overflow-wrap: anywhere;
  }
  #tbl-txns td::before {
    content: attr(data-label); flex: 0 0 64px; color: var(--muted); font-size: 12px;
  }
  #tbl-txns td.check { justify-content: flex-start; padding-bottom: 6px; border-bottom: 1px dashed var(--line); }
  #tbl-txns td.check::before { content: ""; flex: 0 0 0; }
  #tbl-txns td:nth-child(4) { flex-direction: column; }
  #tbl-txns td:nth-child(4)::before { flex-basis: auto; }
  #tbl-txns td:nth-child(9) { justify-content: flex-end; gap: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
  #tbl-txns td:nth-child(9)::before { flex: 0 0 0; content: ""; }

  /* 账户 / 审计表 → 卡片 */
  #tbl-accounts, #tbl-accounts thead, #tbl-accounts tbody, #tbl-accounts tr, #tbl-accounts td,
  #tbl-findings, #tbl-findings thead, #tbl-findings tbody, #tbl-findings tr, #tbl-findings td {
    display: block; width: 100%;
  }
  #tbl-accounts thead, #tbl-findings thead { display: none; }
  #tbl-accounts tr, #tbl-findings tr {
    border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 8px 10px;
  }
  #tbl-accounts td, #tbl-findings td {
    display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 3px 0;
    white-space: normal !important; text-align: left;
  }
  #tbl-accounts td::before, #tbl-findings td::before {
    content: attr(data-label); flex: 0 0 72px; color: var(--muted); font-size: 12px;
  }
  #tbl-accounts td.num, #tbl-findings td.num { text-align: right; }

  .modal { width: 96vw; max-height: 90vh; }
  .modal-head, .modal-body, .modal-foot { padding-left: 14px; padding-right: 14px; }
  .modal-foot .btn { flex: 1; }
}

/* ---- 登录页 ---- */
.login-body {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1000px 500px at 20% 0%, #e0f2fe 0%, transparent 60%), var(--bg);
}
.login-card {
  width: min(92vw, 380px); background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 26px 24px; box-shadow: var(--shadow);
}
.login-card h1 { margin-bottom: 20px; }
.login-card h1 span { font-size: 13px; }
.login-form { display: grid; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.login-form input { min-width: 0; }
.login-form button { margin-top: 4px; padding: 9px; }
.login-error {
  color: var(--expense); background: #fef2f2; border: 1px solid #fecaca;
  border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-bottom: 12px;
}
.login-card > .muted { margin-top: 16px; line-height: 1.6; }

/* ---- 账户核对 ---- */
.reconcile-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.reconcile-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.reconcile-form .wide { grid-column: span 3; }
.reconcile-form button { grid-column: span 3; justify-self: start; }
.reconcile-result:empty { display: none; }
.reconcile-result { margin: 6px 0 16px; }
.recon-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fafafa; }
.recon-status { font-weight: 650; font-size: 15px; margin-bottom: 8px; }
.recon-status.ok { color: var(--income); }
.recon-status.bad { color: var(--expense); }
.recon-stats { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.recon-stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.recon-detail { margin-top: 10px; max-height: 320px; overflow: auto; }
.recon-detail table { min-width: 620px; }
.recon-detail tr[data-from] { cursor: pointer; }
.recon-detail tr[data-from]:hover { background: var(--accent-soft); }
.sub-head { margin-top: 16px; }

@media (max-width: 700px) {
  .panel-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .reconcile-form { grid-template-columns: 1fr; }
  .reconcile-form .wide, .reconcile-form button { grid-column: span 1; }
  .reconcile-form button { width: 100%; }
  #tbl-recon, #tbl-recon tbody, #tbl-recon tr, #tbl-recon td { display: block; width: 100% !important; min-width: 0 !important; }
  #tbl-recon thead { display: none; }
  #tbl-recon tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 8px 10px; }
  #tbl-recon td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 3px 0; white-space: normal !important; }
  #tbl-recon td::before { content: attr(data-label); flex: 0 0 72px; color: var(--muted); font-size: 12px; }
  .recon-detail table { min-width: 0; width: 100%; font-size: 12px; }
  .recon-detail th, .recon-detail td { padding: 6px 4px; }
}

/* ---- 独立核对页：高密度流水 ---- */
.txn-head, .txn-row {
  display: grid;
  grid-template-columns: 62px 86px 38px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  padding: 5px 8px;
  font-variant-numeric: tabular-nums;
}
.txn-head {
  position: sticky; top: 0; z-index: 2;
  background: #f8fafc; border: 1px solid var(--line); border-bottom: 0;
  border-radius: 8px 8px 0 0;
  color: var(--muted); font-size: 12px;
}
.txn-head span:nth-child(2), .txn-head span:nth-child(4) { text-align: right; }
.txn-head span:nth-child(3) { text-align: center; }
.txn-list { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px; overflow: hidden; }
.txn-day {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; padding: 4px 8px; background: #f1f5f9;
  color: var(--muted); font-size: 12px; border-top: 1px solid var(--line);
}
.txn-day:first-child { border-top: 0; }
.txn-row { border-top: 1px solid #eef2f7; font-size: 13px; line-height: 1.25; }
.txn-row:hover { background: #f8fafc; }
.txn-time { color: var(--muted); font-size: 12px; }
.txn-amt { text-align: right; font-weight: 600; white-space: nowrap; }
.txn-amt.income { color: var(--income); }
.txn-amt.expense { color: var(--expense); }
.txn-kind { text-align: center; color: var(--muted); font-size: 12px; white-space: nowrap; }
.txn-bal { text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-more { display: flex; justify-content: center; padding-top: 10px; }
.txn-empty { padding: 20px; color: var(--muted); text-align: center; }
.txn-hint { color: var(--muted); font-size: 12px; margin-top: 6px; }

@media (max-width: 700px) {
  .txn-head, .txn-row { grid-template-columns: 60px 84px 36px minmax(0, 1fr); gap: 5px; padding: 4px 7px; }
  .txn-list { border-radius: 0 0 8px 8px; }
  .panel#history-panel { margin-top: 0; }
}

/* ---- 核对页：读优先 ---- */
.reconcile-filters { display: grid; width: 100%; grid-template-columns: 1.6fr 1fr 1fr; gap: 10px; }
.reconcile-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.mismatch-banner {
  border-radius: 10px; padding: 10px 12px; font-size: 13px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
}
.mismatch-banner.ok { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.mismatch-banner.bad { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.reconcile-settings > summary, #history-panel > summary {
  cursor: pointer; font-weight: 600; list-style: none;
}
.reconcile-settings > summary::-webkit-details-marker, #history-panel > summary::-webkit-details-marker { display: none; }
.reconcile-settings > summary::before, #history-panel > summary::before { content: "▸ "; color: var(--muted); }
.reconcile-settings[open] > summary::before, #history-panel[open] > summary::before { content: "▾ "; }
.reconcile-settings > summary { margin-bottom: 12px; }
#history-panel > summary { margin-bottom: 10px; }
.txn-row.mismatch { background: #fff5f5; box-shadow: inset 3px 0 0 #ef4444; }
.txn-row.mismatch .txn-bal { color: #b91c1c; font-weight: 650; }
.txn-row.mismatch .txn-bal::after { content: " ⚠"; font-size: 11px; }
.txn-delta { display: block; font-size: 10px; font-weight: 500; color: #b91c1c; line-height: 1.1; }
.txn-day .day-diff { color: var(--expense); }
@media (max-width: 700px) {
  .reconcile-filters { grid-template-columns: 1fr 1fr; gap: 8px; }
  .reconcile-filters label:first-child { grid-column: span 2; }
  .mismatch-banner { padding: 8px 10px; }
  .mismatch-banner .btn { padding: 3px 8px; font-size: 12px; margin-top: 6px; }
}

/* ewallet 负余额风险 */
.mismatch-banner.warn { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.txn-row.risk { background: #fffbeb; box-shadow: inset 3px 0 0 #f59e0b; }
.txn-row.risk .txn-bal { color: #b45309; font-weight: 650; }
.txn-bal.risk { white-space: normal; }

/* ---- 核对页：月/年汇总 ---- */
.summary-tabs { display: flex; gap: 6px; }
.summary-tabs .btn { padding: 4px 10px; font-size: 12px; }
.summary-tabs .btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.summary-wrap { max-height: 240px; overflow: auto; }
#tbl-summary { min-width: 0; width: 100%; font-size: 12px; }
#tbl-summary th, #tbl-summary td { padding: 5px 4px; white-space: nowrap; }
#tbl-summary tbody tr { cursor: pointer; }
#tbl-summary tbody tr:hover { background: var(--accent-soft); }
#tbl-summary td.negative { color: #b45309; font-weight: 600; }
@media (max-width: 700px) {
  .summary-wrap { max-height: 260px; overflow: auto; }
  .reconcile-page .top-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .transactions-page .top-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .transactions-page .top-actions .btn { font-size: 12px; padding-left: 2px; padding-right: 2px; }
  #tbl-summary { font-size: 11px; }
  #tbl-summary th, #tbl-summary td { padding: 4px 2px; }
}

.inline-check { display: flex; flex-direction: row; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); align-self: center; }
.inline-check input { width: auto; min-width: 0; }
tr.skipped-row { background: #f8fafc; opacity: .58; }
tr.skipped-row .amount { color: var(--muted); }
.badge.skipped { background: #e2e8f0; color: #475569; }

/* ---- 主页 / 独立页 ---- */
.quick-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.quick-link {
  display: flex; flex-direction: column; gap: 4px; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--text); text-decoration: none;
}
.quick-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.quick-link strong { font-size: 14px; }
.quick-link span { font-size: 12px; color: var(--muted); }

/* 转账 / 补差 / 余额统一灰色金额 */
.amount.transfer, .txn-amt.transfer, .flow-amount.transfer { color: #64748b !important; }
.amount.refund, .flow-amount.refund { color: #2563eb !important; }

/* 亮眼标签 */
.tag {
  display: inline-flex; align-items: center; white-space: nowrap;
  padding: 1px 6px; border-radius: 6px; font-size: 11px; line-height: 1.6;
  font-weight: 500;
}
.tag-income { background: #dcfce7; color: #166534; }
.tag-expense { background: #fee2e2; color: #991b1b; }
.tag-transfer { background: #e2e8f0; color: #475569; }
.tag-refund { background: #dbeafe; color: #1d4ed8; }
.tag-balance { background: #fef3c7; color: #92400e; }
.tag-writeoff { background: #fde68a; color: #92400e; }
.tag-skipped { background: #e2e8f0; color: #64748b; }
.tag-account { background: #e0f2fe; color: #075985; }
.tag-status { background: #f1f5f9; color: #475569; }
.tag-flag { background: #fee2e2; color: #b91c1c; }
.tag-manual { background: #ede9fe; color: #5b21b6; }

/* 全量流水页：桌面表格，手机高密度卡片 */
#txn-mobile { display: none; }
@media (max-width: 700px) {
  .txns-table-wrap { display: none; }
  #txn-mobile { display: flex; flex-direction: column; gap: 4px; }
  .flow-card {
    border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px;
    background: #fff; box-shadow: 0 1px 0 rgba(15,23,42,.02);
  }
  .flow-card.is-skip { background: #f8fafc; opacity: .58; }
  .flow-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
  .flow-when { color: var(--muted); font-size: 11px; }
  .flow-amount { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
  .flow-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
  .flow-desc { font-size: 12px; color: var(--text); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .flow-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 3px; color: var(--muted); font-size: 11px; }
  .flow-check { display: inline-flex; align-items: center; gap: 3px; }
  .flow-check input { width: auto; min-width: 0; }
  .flow-actions { display: inline-flex; gap: 4px; }
  .flow-actions .btn.small { padding: 1px 6px; font-size: 11px; }
  .quick-links { grid-template-columns: 1fr; }
}

.amount.muted { color: var(--muted); }

.filter-details > summary { cursor: pointer; font-weight: 600; font-size: 13px; list-style: none; }
.filter-details > summary::-webkit-details-marker { display: none; }
.filter-details > summary::before { content: "▸ "; color: var(--muted); }
.filter-details[open] > summary::before { content: "▾ "; }
.filter-details[open] > summary { margin-bottom: 10px; }
.home-page .top-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) {
  .flow-card { padding: 4px 7px; }
  .flow-top { line-height: 1.2; }
  .flow-tags { margin-top: 1px; }
  .flow-desc { margin-top: 1px; }
  .flow-foot { margin-top: 1px; }
}

.skip-summary { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; }
.skip-title { font-size: 12px; color: #475569; }
.skip-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.skip-chip { font-size: 11px; background: #e2e8f0; color: #475569; border-radius: 6px; padding: 2px 7px; }
.skip-chip b { color: #1e293b; }

.txn-row.skip { opacity: .55; }
.txn-amt.skipped { color: var(--muted); }
.tag-skipped { background: #e2e8f0; color: #64748b; }

.txn-skip-mark { color: #64748b; font-size: 11px; white-space: nowrap; }
.txn-skip-reason { display: block; color: #94a3b8; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- 流水详情 / raw / 修改记录 ---- */
.detail-modal { width: min(96vw, 760px); max-height: 92vh; }
.detail-modal .modal-body { display: block; max-height: 78vh; }
.detail-hero { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.detail-hero .amount { font-size: 22px; font-weight: 700; }
.detail-section { border-top: 1px solid var(--line); padding: 12px 0 2px; }
.detail-section:first-child { border-top: 0; padding-top: 0; }
.detail-section h3 { font-size: 14px; margin-bottom: 8px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 14px; }
.detail-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.detail-field span { color: var(--muted); font-size: 11px; }
.detail-field strong { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.detail-json { margin-top: 8px; }
.detail-json pre {
  margin: 4px 0 0; padding: 8px; border-radius: 8px; background: #f8fafc;
  border: 1px solid var(--line); max-height: 240px; overflow: auto;
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; line-height: 1.5;
}
.detail-events { display: flex; flex-direction: column; gap: 8px; }
.detail-event { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.detail-event-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.detail-event-head span { color: var(--muted); font-size: 11px; }
.txn-row[data-id] { cursor: pointer; }
@media (max-width: 700px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-modal { width: 96vw; }
}

/* ---- 账户流水页：可折叠月/年汇总 ---- */
#summary-panel > summary {
  cursor: pointer; font-weight: 600; font-size: 14px; list-style: none;
}
#summary-panel > summary::-webkit-details-marker { display: none; }
#summary-panel > summary::before { content: "▸ "; color: var(--muted); }
#summary-panel[open] > summary::before { content: "▾ "; }
#summary-panel[open] > summary { margin-bottom: 10px; }
.summary-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }

/* ---- 账户流水：全部 / 精简模式 ---- */
.head-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.view-mode { display: inline-flex; gap: 4px; }
.view-mode .btn { padding: 3px 9px; font-size: 12px; }
.view-mode .btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.txn-row.full { row-gap: 2px; padding-top: 6px; padding-bottom: 6px; }
.txn-row.full .txn-time { font-weight: 600; color: var(--text); }
.txn-extra {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 8px;
  padding-top: 2px; min-width: 0;
  color: var(--muted); font-size: 11px;
}
.txn-extra .txn-desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.txn-extra .txn-status { white-space: nowrap; }
.txn-extra .btn.small { padding: 1px 7px; font-size: 11px; flex: none; }
@media (max-width: 700px) {
  .head-tools { width: 100%; justify-content: space-between; }
  .txn-extra { flex-wrap: wrap; }
  .txn-extra .txn-desc { flex-basis: 100%; }
}
.import-warn { color: #b45309; font-weight: 600; }

.reconcile-skip { white-space: nowrap; font-size: 12px; color: var(--muted); }

/* ---- 账户流水：按月/按年折叠明细 ---- */
.txn-group { border-bottom: 1px solid var(--line); }
.txn-group > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; background: #f8fafc; border-bottom: 1px solid transparent;
}
.txn-group[open] > summary { border-bottom-color: var(--line); }
.txn-group > summary::-webkit-details-marker { display: none; }
.txn-group > summary::before { content: "▸"; color: var(--muted); font-size: 11px; }
.txn-group[open] > summary::before { content: "▾"; }
.group-period { font-size: 13px; font-weight: 650; white-space: nowrap; }
.group-stats { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; }
.group-caret { display: none; }
.txn-group > summary.warn .group-period { color: #b45309; }
.txn-group-body { padding: 0; }
.txn-group-body > .txn-empty { padding: 10px; }
@media (max-width: 700px) {
  .txn-group > summary { padding: 6px 7px; }
  .group-stats { white-space: normal; line-height: 1.4; }
}

/* ---- 数据流状态机 ---- */
.pipeline-flow { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 12px 4px 16px; }
.pipeline-step { display: flex; align-items: center; flex: none; }
.pipeline-node {
  width: 150px; min-height: 106px; padding: 10px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px; text-align: left;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.pipeline-node:hover { border-color: var(--accent); background: var(--accent-soft); }
.pipeline-node.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.pipeline-node-label { font-size: 13px; font-weight: 650; line-height: 1.3; }
.pipeline-node-count { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pipeline-node-status { font-size: 11px; color: var(--muted); }
.pipeline-node.status-warn { border-color: #fcd34d; }
.pipeline-node.status-fail { border-color: #fca5a5; }
.pipeline-node.status-pending { opacity: .65; }
.pipeline-node-review { margin-top: auto; font-size: 10px; border-radius: 5px; padding: 1px 5px; }
.pipeline-node-review.ok { color: #166534; background: #dcfce7; }
.pipeline-node-review.bad { color: #991b1b; background: #fee2e2; }
.pipeline-arrow { padding: 0 6px; color: #94a3b8; font-size: 18px; }
.review-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 10px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.review-box.ok { background: #f0fdf4; border-color: #bbf7d0; }
.review-box.bad { background: #fef2f2; border-color: #fecaca; }
.review-status { font-size: 12px; }
.review-controls { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.review-controls input { width: 220px; max-width: 45vw; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 12px; }
.stage-actions { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.stage-body { max-height: 62vh; overflow: auto; }
.stage-table { width: 100%; min-width: 680px; font-size: 12px; }
.stage-table th, .stage-table td { padding: 5px 6px; border-bottom: 1px solid #eef2f7; text-align: left; white-space: nowrap; }
.stage-table th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: #fff; }
.stage-table td.num, .stage-table th.num { text-align: right; }
.stage-table tr.skip { opacity: .55; background: #f8fafc; }
.path-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) {
  .pipeline-flow { flex-direction: column; align-items: stretch; overflow: visible; }
  .pipeline-step { flex-direction: column; align-items: stretch; }
  .pipeline-node { width: 100%; min-height: 0; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .pipeline-node-label { flex: 0 0 100%; }
  .pipeline-node-count { flex: 1; font-size: 20px; }
  .pipeline-node-review { margin-top: 0; }
  .pipeline-arrow { padding: 2px 0; text-align: center; transform: rotate(90deg); }
  .stage-table { min-width: 560px; }
}
