:root {
  --navy: #0c2746;
  --blue: #1f5fae;
  --blue-2: #4c83c9;
  --ink: #172538;
  --muted: #64748b;
  --bg: #f4f7fb;
  --card: #ffffff;
  --line: #dce5ef;
  --green: #168a5b;
  --green-bg: #e7f7f0;
  --amber: #a96500;
  --amber-bg: #fff5dd;
  --red: #c23934;
  --red-bg: #fff0ed;
  --shadow: 0 10px 28px rgba(21, 52, 86, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
button, input, select { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 70px;
  padding: 12px max(24px, calc((100vw - 1440px) / 2));
  color: #fff;
  background: rgba(12, 39, 70, .97);
  box-shadow: 0 8px 24px rgba(0, 22, 48, .16);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-weight: 800;
  background: linear-gradient(135deg, #7eb5ff, #2b6fc2);
}
.brand strong { display: block; font-size: 17px; letter-spacing: .02em; }
.brand small { color: #a9bfd8; }
.nav { display: flex; gap: 6px; }
.nav button {
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  color: #bad0e6;
  background: transparent;
  cursor: pointer;
}
.nav button.active, .nav button:hover { color: #fff; background: rgba(255,255,255,.11); }
.refresh { text-align: right; color: #b9cde1; font-size: 12px; }
.refresh strong { display: block; color: #fff; font-size: 13px; }

.shell { max-width: 1440px; margin: 0 auto; padding: 28px 24px 50px; }
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}
.eyebrow { margin: 0 0 5px; color: var(--blue); font-weight: 700; font-size: 13px; letter-spacing: .06em; }
h1 { margin: 0; font-size: clamp(26px, 3vw, 38px); line-height: 1.2; letter-spacing: -.03em; }
.subtitle { margin: 9px 0 0; color: var(--muted); }
.verdict {
  flex: 0 0 340px;
  border: 1px solid #bfe8d7;
  border-radius: 16px;
  padding: 15px 17px;
  background: var(--green-bg);
}
.verdict .label { color: var(--green); font-size: 12px; font-weight: 800; }
.verdict strong { display: block; margin: 2px 0 3px; font-size: 18px; }
.verdict p { margin: 0; color: #486759; font-size: 13px; }

.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: .4; transform: translateY(4px); } }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi, .panel {
  border: 1px solid rgba(211, 223, 235, .95);
  border-radius: 17px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.kpi { min-height: 125px; padding: 17px; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; inset: auto -25px -40px auto; width: 90px; height: 90px; border-radius: 50%; background: #eaf2fb; }
.kpi.positive::after { background: #ddf5e9; }
.kpi.caution::after { background: #fff0c7; }
.kpi .label { display: block; min-height: 40px; color: var(--muted); font-size: 13px; }
.kpi strong { display: block; position: relative; z-index: 1; font-size: clamp(20px, 2vw, 28px); letter-spacing: -.025em; }
.kpi small { color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: 1.35fr .9fr; gap: 18px; margin-bottom: 18px; }
.panel { padding: 20px; }
.panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 17px; }
.panel h2 { margin: 0; font-size: 18px; }
.panel-note { color: var(--muted); font-size: 12px; }

.expense-list { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 110px; gap: 12px; align-items: center; }
.bar-label { font-size: 13px; }
.bar-track { height: 9px; border-radius: 10px; background: #edf2f7; overflow: hidden; }
.bar-fill { height: 100%; min-width: 3px; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #71a4e5); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 700; }

.donut-layout { display: grid; grid-template-columns: 190px 1fr; align-items: center; gap: 16px; }
.donut {
  width: 176px;
  height: 176px;
  border-radius: 50%;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
}
.donut::after { content: ""; position: absolute; inset: 30px; border-radius: 50%; background: white; }
.donut-center { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; text-align: center; }
.donut-center strong { font-size: 20px; }
.donut-center span { color: var(--muted); font-size: 12px; }
.legend { display: grid; gap: 8px; }
.legend-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; font-size: 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; }

.action-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.action {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px;
  background: #fbfcfe;
}
.action-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 800; }
.pill.high { color: var(--red); background: var(--red-bg); }
.pill.mid, .pill.watch { color: var(--amber); background: var(--amber-bg); }
.pill.ok { color: var(--green); background: var(--green-bg); }
.date { color: var(--muted); font-size: 11px; }
.action strong { font-size: 14px; }
.action p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }

.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.summary-card { padding: 18px 20px; border-radius: 15px; color: #fff; background: linear-gradient(135deg, #123b68, #245d9b); }
.summary-card:nth-child(2) { background: linear-gradient(135deg, #145f50, #22856d); }
.summary-card:nth-child(3) { background: linear-gradient(135deg, #7b5010, #a67521); }
.summary-card span { opacity: .72; font-size: 12px; }
.summary-card strong { display: block; margin-top: 3px; font-size: 24px; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; min-width: 860px; background: #fff; }
th, td { padding: 13px 14px; border-bottom: 1px solid #e8eef5; text-align: left; white-space: nowrap; }
th { color: #51667d; background: #f2f6fa; font-size: 12px; font-weight: 800; }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.filters input, .filters select {
  min-height: 40px;
  border: 1px solid #cfdbe7;
  border-radius: 10px;
  padding: 8px 11px;
  color: var(--ink);
  background: #fff;
  outline: none;
}
.filters input { min-width: 260px; }
.filters input:focus, .filters select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,95,174,.1); }
.count { margin-left: auto; align-self: center; color: var(--muted); font-size: 12px; }

.fund-name { min-width: 190px; }
.end-balance { font-weight: 800; }
.negative { color: var(--red); }
.positive-text { color: var(--green); }
.coverage { width: 110px; height: 6px; border-radius: 99px; overflow: hidden; background: #edf2f7; }
.coverage i { display: block; height: 100%; border-radius: 99px; background: var(--green); }

.timeline { position: relative; display: grid; gap: 12px; }
.plan-row { display: grid; grid-template-columns: 105px 8px minmax(190px, 1fr) minmax(210px, 1.2fr) 120px 90px; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid #e8eef5; }
.plan-row:last-child { border-bottom: 0; }
.flow-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.flow-dot.out { background: var(--red); }
.flow-dot.transfer { background: var(--amber); }
.flow-amount { text-align: right; font-weight: 800; }

.disclosure { margin-top: 18px; padding: 14px 16px; border-left: 4px solid var(--amber); border-radius: 8px; color: #6e531e; background: #fff7e7; font-size: 13px; }
footer { max-width: 1440px; margin: 0 auto; padding: 0 24px 34px; color: var(--muted); font-size: 12px; }

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .action-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .topbar { align-items: flex-start; padding: 12px 16px; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around; padding: 8px; background: var(--navy); }
  .nav button { padding: 9px 10px; font-size: 12px; }
  .refresh { display: none; }
  .shell { padding: 20px 14px 78px; }
  .hero { display: block; }
  .verdict { margin-top: 16px; width: 100%; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { min-height: 110px; padding: 14px; }
  .kpi strong { font-size: 20px; }
  .donut-layout { grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
  .bar-row { grid-template-columns: 90px 1fr; }
  .bar-value { grid-column: 2; margin-top: -9px; }
  .action-list, .summary-strip { grid-template-columns: 1fr; }
  .panel { padding: 15px; border-radius: 14px; }
  .filters input { min-width: 100%; }
  .count { width: 100%; margin-left: 0; }
  .plan-row { grid-template-columns: 85px 8px 1fr auto; gap: 9px; }
  .plan-row .plan-account { grid-column: 3 / 5; color: var(--muted); font-size: 12px; }
  .plan-row .certainty { display: none; }
}
@media print {
  .topbar, .filters { display: none; }
  body { background: #fff; }
  .shell { max-width: none; padding: 10px; }
  .view { display: block !important; page-break-before: always; }
  .view:first-of-type { page-break-before: auto; }
  .kpi, .panel { box-shadow: none; }
}
