:root {
  color-scheme: light;
  --ink: #182749;
  --muted: #465b75;
  --background: #f0f4fa;
  --line: #cfdaea;
  --accent: #1e40af;
  --accent-hover: #193588;
  --surface: #fff;
  font: 16px/1.5 Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--background);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.topbar { background: #12244a; color: white; }
.topbar-inner { max-width: 1216px; margin: 0 auto; padding: 12px 24px; min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.brand-mark { display: inline-block; flex: 0 0 24px; height: 23px; background: linear-gradient(130deg,#92caff 49%,#5d8aff 50%); clip-path: polygon(7% 0,100% 50%,7% 100%); }
.brand-label { font-weight: 500; color: #d5e0f2; border-left: 1px solid #5f739a; padding-left: 12px; }
main { max-width: 1216px; margin: 0 auto; padding: 36px 24px 56px; }
h1 { margin: 0 0 22px; font-size: clamp(1.65rem, 4vw, 2.15rem); line-height: 1.2; }
h2 { margin: 0; font-size: 1.15rem; }
.workspace-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.panel { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 24px; min-width: 0; }
.report { grid-column: 1 / -1; }
.grant-list { display: grid; gap: 12px; margin-top: 20px; }
.grant-item { border-top: 1px solid var(--line); padding-top: 16px; min-width: 0; }
.grant-item h3 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.grant-meta { margin: 4px 0 12px; font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.grant-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.grant-name-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 10px; }
.grant-name-form label { grid-column: 1 / -1; }
.metrics-filters { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(130px, 1fr) auto; gap: 12px; align-items: end; margin-top: 20px; }
.metrics-filters input, .metrics-filters select { margin-top: 6px; }
.accounts-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 12px; }
.accounts-toolbar p { margin: 0; flex: 1 1 220px; }
.metrics-progress { background: #eef3fb; border-radius: 8px; padding: 12px; margin-bottom: 16px; }
.metrics-progress progress { width: 100%; height: 10px; accent-color: var(--accent); }
.metrics-progress p { font-size: .9rem; margin: 8px 0; }
.accounts-table { min-width: 900px; }
.accounts-table th:nth-child(2), .accounts-table td:nth-child(2), .accounts-table th:nth-child(5), .accounts-table td:nth-child(5), .accounts-table th:nth-child(6), .accounts-table td:nth-child(6) { text-align: left; }
.accounts-table td:nth-child(2) { min-width: 120px; max-width: 180px; white-space: normal; overflow-wrap: anywhere; }
.account-name { display: block; max-width: 200px; white-space: normal; overflow-wrap: anywhere; font-weight: 650; }
.account-id, .account-stamp { display: block; font-size: .8rem; color: var(--muted); }
.account-error { display: block; color: #941e26; white-space: normal; max-width: 220px; font-size: .85rem; }
.wallet-balances { min-width: 145px; }
.wallet-balances > span { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.wallet-label { font-size: .8rem; color: var(--muted); }
.pagination { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 14px; font-size: .9rem; }
.status.attention { color: #805012; background: #fff0ce; }
.login { max-width: 420px; margin: 36px auto; }
.login form { display: grid; gap: 8px; }
.login button { margin-top: 8px; }
.muted { color: var(--muted); font-size: .935rem; }
.notice { color: #193978; border: 1px solid #a6bce7; border-radius: 8px; background: #e9f1ff; margin: 0 0 18px; padding: 12px 16px; overflow-wrap: anywhere; }
.notice.error { color: #941e26; background: #fff0f0; border-color: #e7b4b7; }
.section-head, .actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.actions { justify-content: flex-start; }
.status { display: inline-block; border-radius: 20px; background: #e7eef8; color: #374c6c; padding: 3px 11px; font-size: .85rem; font-weight: 650; }
.status.connected { color: #126354; background: #d9f3ea; }
.callback-block { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.callback-block button { justify-self: start; }
.code { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: .85rem; }
label { display: block; font-size: .9rem; font-weight: 650; }
input, select, button { min-height: 44px; border-radius: 8px; font: inherit; }
input, select { width: 100%; min-width: 0; color: var(--ink); border: 1px solid #9aaec8; padding: 8px 11px; background: var(--surface); }
input[readonly] { background: #f5f7fb; }
button { color: white; background: var(--accent); border: 1px solid var(--accent); padding: 8px 14px; font-weight: 650; cursor: pointer; transition: background-color 160ms ease, border-color 160ms ease; }
button:hover:not(:disabled) { background: var(--accent-hover); }
button.secondary { background: white; color: #294470; border-color: #a5b7ce; }
button.secondary:hover:not(:disabled) { background: #eaf1fb; }
button:disabled, input:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 3px solid #3375dd; outline-offset: 2px; }
.report form { margin-top: 18px; }
.account-field { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 16px; }
.account-field select { flex: 1 1 245px; }
.report-filters { display: grid; gap: 12px; grid-template-columns: minmax(120px, 1fr) minmax(170px, 1.2fr) auto; align-items: end; }
.report-filters input, .report-filters select { margin-top: 6px; }
.report-note { margin: 20px 0 10px; }
.table-wrap { border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
th, td { padding: 11px 12px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: #324968; background: #eef3fb; }
td { border-top: 1px solid var(--line); }
.more-report { margin-top: 12px; }
@media (max-width: 820px) { .workspace-grid { grid-template-columns: 1fr; } }
@media (max-width: 540px) {
  .topbar-inner, main { padding-inline: 16px; }
  .brand { font-size: .92rem; gap: 8px; }
  .brand-label { padding-left: 8px; }
  .panel { padding: 16px; }
  .report-filters, .metrics-filters { grid-template-columns: 1fr; }
  .accounts-toolbar { align-items: stretch; }
  .accounts-toolbar button { width: 100%; }
  th, td { padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) { button { transition: none; } }
