:root {
  --bg: #f7f8f6;
  --card: #ffffff;
  --ink: #1d2b27;
  --muted: #6f7b77;
  --line: #e3e8e4;
  --green: #327466;
  --green-soft: #e5f0ed;
  --blue: #6e8eb5;
  --gold: #d79b55;
  --red: #c85f5b;
  --shadow: 0 18px 45px rgba(27, 43, 38, .06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(29, 43, 39, .08);
  background: rgba(247, 248, 246, .88);
  backdrop-filter: blur(18px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--ink);
  color: white;
}
nav {
  display: flex;
  gap: 24px;
}
nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
nav a:hover { color: var(--ink); }
.icon-button {
  margin-left: auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
}
.icon-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

main, footer {
  width: min(1440px, calc(100% - 40px));
  margin-inline: auto;
}
.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  padding: 46px 0 24px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}
h2 {
  margin-bottom: 0;
  font-size: clamp(20px, 2vw, 27px);
  letter-spacing: 0;
}
h3 {
  margin-bottom: 14px;
  font-size: 15px;
}
.updated, .hero-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}
.hero-note {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, 1fr);
  gap: 14px;
}
.metric-card, .panel, .account-card {
  border: 1px solid rgba(29, 43, 39, .08);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.metric-card {
  min-width: 0;
  padding: 22px;
}
.metric-card.primary {
  background: var(--ink);
  color: white;
}
.metric-card span {
  color: var(--muted);
  font-size: 13px;
}
.metric-card.primary span { color: #b7c4bf; }
.metric-card strong {
  display: block;
  margin: 18px 0 12px;
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1;
}
.metric-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}
.metric-card.primary p { color: #b7c4bf; }

.overview-grid, .insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.trend-panel {
  margin-top: 14px;
}
.trend-chart-wrap {
  width: 100%;
  min-height: 280px;
  overflow: hidden;
}
.trend-chart {
  display: block;
  width: 100%;
  height: 280px;
}
.trend-grid line {
  stroke: var(--line);
  stroke-width: 1;
}
.trend-grid text, .trend-labels text {
  fill: var(--muted);
  font-size: 12px;
}
.trend-area {
  fill: url(#trendFill);
}
.trend-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.trend-points circle {
  fill: white;
  stroke: var(--green);
  stroke-width: 3;
}
.trend-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.trend-summary article {
  min-width: 0;
  padding: 13px 14px;
  border-radius: 8px;
  background: #f5f8f6;
}
.trend-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.trend-summary strong {
  display: block;
  margin-top: 7px;
  font-size: 18px;
}
.panel {
  min-width: 0;
  padding: 24px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 22px;
}
.panel-stat {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.donut-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}
.donut {
  position: relative;
  width: 180px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e7ebe7;
}
.donut::after {
  content: "";
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  background: var(--card);
}
.donut span {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-weight: 700;
}
.legend-list {
  display: grid;
  gap: 10px;
}
.legend-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.legend-item:last-child { border-bottom: 0; }
.legend-item span {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.legend-item i, .mini-legend i {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 3px;
}
.legend-item b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.legend-item small {
  color: var(--muted);
  font-size: 11px;
}
.legend-item strong {
  color: var(--green);
  font-size: 13px;
}
.legend-item em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.account-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.account-card {
  position: relative;
  min-height: 154px;
  padding: 20px;
  text-align: left;
  overflow: hidden;
}
.account-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}
.account-card.active {
  border-color: var(--accent);
  background: linear-gradient(180deg, white, #f7fbf9);
}
.account-card span, .account-card i, .account-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}
.account-card strong {
  display: block;
  margin-top: 8px;
  font-size: 17px;
}
.account-card em {
  display: block;
  margin: 18px 0 10px;
  color: var(--ink);
  font-size: clamp(20px, 2vw, 27px);
  font-style: normal;
  font-weight: 800;
}
.account-card small {
  width: max-content;
  margin-top: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff0df;
  color: #a35d1c;
  font-weight: 700;
}

.account-detail-panel { margin-top: 14px; }
.tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.tab-row button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  padding: 7px 12px;
  font-size: 12px;
}
.tab-row button.active {
  border-color: var(--green);
  background: var(--green);
  color: white;
}
.detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.detail-summary article {
  padding: 16px;
  border-radius: 8px;
  background: #f5f8f6;
}
.detail-summary span {
  color: var(--muted);
  font-size: 12px;
}
.detail-summary strong {
  display: block;
  margin-top: 10px;
  font-size: 22px;
}
.notice {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #efd0a9;
  border-radius: 8px;
  background: #fff7eb;
  color: #8b5c25;
  font-size: 13px;
}
.detail-grid {
  display: grid;
  grid-template-columns: .85fr 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}
.detail-grid section {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}
.mini-legend {
  display: grid;
  gap: 10px;
}
.mini-legend p {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 9px;
  align-items: center;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.mini-legend strong {
  color: var(--green);
}
.mini-legend em {
  color: var(--ink);
  font-style: normal;
}

.bar-list {
  display: grid;
  gap: 12px;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.bar-row div {
  min-width: 0;
}
.bar-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.bar-row span {
  color: var(--muted);
  font-size: 11px;
}
.bar-row b {
  font-size: 13px;
}
.bar-row i {
  grid-column: 1 / -1;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1ee;
}
.bar-row em {
  display: block;
  height: 100%;
  border-radius: inherit;
}
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.holdings-panel {
  margin-top: 14px;
}
.holdings-head {
  align-items: center;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
}
.search svg {
  width: 15px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
}
.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: left;
  font-weight: 700;
  white-space: nowrap;
}
td {
  padding: 14px 12px;
  border-bottom: 1px solid #edf1ee;
  color: var(--muted);
  white-space: nowrap;
}
td strong {
  display: block;
  color: var(--ink);
}
td span {
  display: block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 11px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 44px;
  color: var(--muted);
  font-size: 12px;
}

.privacy-mode .private-value {
  position: relative;
  color: transparent !important;
  user-select: none;
}
.privacy-mode .private-value::after {
  content: "••••••";
  position: absolute;
  left: 0;
  color: var(--ink);
}
.privacy-mode .primary .private-value::after {
  color: white;
}

@media (max-width: 1100px) {
  .metric-grid, .account-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid, .insight-grid, .detail-grid { grid-template-columns: 1fr; }
  .detail-summary, .trend-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .topbar {
    height: auto;
    min-height: 62px;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }
  .brand span:last-child { display: none; }
  nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    gap: 18px;
    padding-bottom: 2px;
  }
  nav a {
    flex: 0 0 auto;
    font-size: 13px;
  }
  main, footer { width: min(100% - 24px, 1440px); }
  .hero {
    align-items: start;
    flex-direction: column;
    padding: 32px 0 20px;
  }
  h1 { font-size: 36px; }
  .metric-grid, .account-cards, .detail-summary, .trend-summary { grid-template-columns: 1fr; }
  .overview-grid, .insight-grid { grid-template-columns: 1fr; }
  .panel, .metric-card { padding: 18px; }
  .trend-chart-wrap, .trend-chart { height: 230px; min-height: 230px; }
  .panel-head {
    flex-direction: column;
    gap: 12px;
  }
  .donut-row {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .legend-list {
    width: 100%;
  }
  .legend-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .legend-item em {
    grid-column: 1 / -1;
  }
  .tab-row {
    justify-content: flex-start;
  }
  .holdings-head {
    align-items: stretch;
  }
  .search {
    min-width: 0;
    width: 100%;
  }
  footer {
    flex-direction: column;
  }
}
