:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #687084;
  --line: #e1e6ef;
  --paper: #ffffff;
  --blue: #1f5ed6;
  --blue-soft: #eef4ff;
  --red: #c63c3c;
  --amber: #9a6500;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: #f3f6fa;
  color: var(--ink);
  font: 14px/1.5 "Microsoft YaHei", "PingFang SC", sans-serif;
}
main { max-width: 1320px; margin: 0 auto; padding: 42px 28px 60px; }
header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}
.eyebrow { margin: 0; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 5px 0 6px; font-size: clamp(28px, 4vw, 40px); line-height: 1.2; }
.subtitle, .panel-heading p { margin: 0; color: var(--muted); }
.sync-state {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  white-space: nowrap;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #28a36a; box-shadow: 0 0 0 4px #daf4e7; }
#cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.balance-card {
  min-height: 160px;
  display: grid;
  gap: 9px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 8px 24px rgba(20, 39, 75, .04);
}
.balance-card h2 { margin: 0; font-size: 16px; }
.provider-link {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.provider-link:hover { color: #154ba8; }
.provider-link:focus-visible {
  border-radius: 2px;
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
.balance-card strong { font-size: 30px; letter-spacing: -.02em; }
.balance-card span { color: var(--muted); }
.balance-card small { color: #9299a8; }
.balance-card.error { border-color: #efb3b3; }
.balance-card.error span { color: var(--red); }
.total-card { color: #fff; border-color: #194fae; background: linear-gradient(135deg, #194fae, #276bdd); }
.total-card span, .total-card small { color: #dce9ff; }
.total-card.partial { background: linear-gradient(135deg, #8a5a00, #b57909); border-color: #8a5a00; }
.reports { border: 1px solid var(--line); border-radius: 16px; background: var(--paper); overflow: hidden; }
.tabs { display: flex; gap: 4px; padding: 12px 14px 0; border-bottom: 1px solid var(--line); }
.tab {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 10px 16px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tab.is-active { color: var(--blue); border-bottom-color: var(--blue); }
.panel { display: none; padding: 22px; }
.panel.is-active { display: block; }
.panel-heading { display: flex; justify-content: space-between; margin-bottom: 16px; }
.panel-heading h2 { margin: 0 0 3px; font-size: 20px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; min-width: 900px; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
thead th { position: sticky; top: 0; z-index: 1; background: #f7f9fc; color: var(--muted); font-size: 12px; }
th:first-child { position: sticky; left: 0; z-index: 2; text-align: left; background: #f7f9fc; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcff; }
td small { display: block; color: var(--amber); font-size: 11px; }
.total-cell { background: var(--blue-soft); color: #154ba8; font-weight: 800; }
.failed { color: var(--red); }
.muted { color: #9aa1af; }
.empty { padding: 38px; color: var(--muted); text-align: center; }
.page-error { min-height: 22px; margin: 14px 0 0; color: var(--red); }

@media (max-width: 860px) {
  main { padding: 26px 16px 40px; }
  header { align-items: flex-start; flex-direction: column; }
  #cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  #cards { grid-template-columns: 1fr; }
  .panel { padding: 15px; }
}
