:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #657087;
  --line: #dfe5ee;
  --accent: #1769e0;
  --accent-dark: #0f4fae;
  --positive: #c43b31;
  --positive-bg: #fff0ee;
  --negative: #13855b;
  --negative-bg: #eaf8f2;
  --pending: #8a6500;
  --pending-bg: #fff7d6;
  --shadow: 0 16px 45px rgba(28, 45, 79, .08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 34px max(24px, calc((100vw - 1500px) / 2));
  background: linear-gradient(135deg, #102b55, #174b91 62%, #1b6cc7);
  color: white;
}
h1 { margin: 4px 0 8px; font-size: clamp(28px, 3vw, 44px); letter-spacing: -.04em; }
h2 { margin: 0; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .18em; opacity: .76; }
.subtitle { margin: 0; opacity: .82; }
.top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
button {
  border: 1px solid rgba(23, 32, 51, .16);
  border-radius: 10px;
  padding: 10px 15px;
  background: white;
  color: var(--ink);
  transition: .16s ease;
}
button:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(20, 40, 80, .12); }
button.primary { background: #ffda57; border-color: #ffda57; color: #1d2e48; font-weight: 800; }
button.primary:hover { background: #ffe37b; }
main { max-width: 1500px; margin: 0 auto; padding: 22px 24px 40px; }
.notice {
  padding: 13px 16px;
  border: 1px solid #efd583;
  border-radius: 12px;
  background: #fff9df;
  color: #6e5712;
  line-height: 1.65;
}
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.stats article { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.stats span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.stats strong { font-size: 24px; }
.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  padding: 14px 16px;
}
.toolbar label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
select, input {
  width: 100%;
  border: 1px solid #cfd7e3;
  border-radius: 9px;
  padding: 10px 11px;
  background: white;
}
.status-line { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 220px; color: var(--muted); font-size: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #a8b1c0; flex: none; }
.dot.loading { background: #e0a400; box-shadow: 0 0 0 5px rgba(224,164,0,.12); }
.dot.ok { background: #1e9f68; box-shadow: 0 0 0 5px rgba(30,159,104,.12); }
.dot.error { background: #cf4137; box-shadow: 0 0 0 5px rgba(207,65,55,.12); }
.text-button { border: 0; padding: 8px; color: var(--accent); background: transparent; box-shadow: none !important; }
.table-wrap { position: relative; overflow-x: auto; background: white; border: 1px solid var(--line); border-radius: 0 0 14px 14px; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 1250px; }
th, td { padding: 12px 11px; border-bottom: 1px solid #edf0f5; text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; background: #f7f9fc; color: #526078; font-size: 12px; }
th small { display: block; color: #9aa4b5; font-size: 9px; letter-spacing: .1em; }
th.key-col { background: #edf5ff; color: #174f96; }
td { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.fund-name { max-width: 250px; overflow: hidden; text-overflow: ellipsis; }
.heat { border-radius: 6px; font-weight: 800; }
.positive { color: var(--positive); background: var(--positive-bg); }
.negative { color: var(--negative); background: var(--negative-bg); }
.flat { color: #566176; background: #f2f4f7; }
.pending { color: var(--pending); background: var(--pending-bg); }
.status-pill { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 11px; background: #eef2f7; color: #5a667b; }
.status-pill.error { background: #fff0ee; color: #b93329; }
.delete-btn { padding: 5px 8px; border: 0; color: #9b3a35; background: transparent; box-shadow: none !important; }
.empty { padding: 70px 24px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: 8px; }
dialog { width: min(520px, calc(100vw - 32px)); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 28px 90px rgba(10,27,58,.3); }
dialog::backdrop { background: rgba(8, 20, 42, .52); backdrop-filter: blur(3px); }
dialog form { padding: 22px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.dialog-head .eyebrow { color: var(--accent); opacity: 1; margin-bottom: 5px; }
dialog label { display: block; color: #4c596f; font-size: 13px; margin: 13px 0; }
dialog label input { margin-top: 6px; }
.icon-button { border: 0; padding: 4px 8px; font-size: 28px; background: transparent; box-shadow: none !important; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
footer { max-width: 1500px; margin: 0 auto; padding: 0 24px 30px; color: var(--muted); font-size: 12px; }
@media (max-width: 900px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { justify-content: flex-start; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .toolbar { align-items: stretch; flex-direction: column; }
}
@media (max-width: 520px) {
  .top-actions button { flex: 1 1 calc(50% - 5px); }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats strong { font-size: 18px; }
}
