:root {
  --pos: #c0392b;      /* 涨红 */
  --neg: #1e8449;      /* 跌绿 */
  --nav: #1f4e79;
  --bench: #7f7f7f;
  --target: #e8a33d;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f6f7f9;
  --card: #ffffff;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.5;
}
.topnav {
  position: sticky; top: 0; z-index: 40;
  background: #14263c; color: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.15);
}
.nav-inner { max-width: 980px; margin: 0 auto; padding: 0 16px; height: 52px; display: flex; align-items: center; gap: 24px; }
.brand { font-weight: 700; font-size: 16px; letter-spacing: .5px; }
.nav-tabs { display: flex; gap: 6px; margin: 0 auto; }
.nav-tab {
  color: #cbd5e1; font-size: 14px; padding: 6px 14px; border-radius: 6px; cursor: pointer; user-select: none;
}
.nav-tab:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-tab.active { color: #fff; background: rgba(255,255,255,.16); font-weight: 600; }
#app { max-width: 980px; margin: 0 auto; padding: 18px 16px 40px; }

.topbar { margin-bottom: 16px; }
.pick-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.pick-row label { color: var(--muted); font-size: 13px; }
#po-select {
  font-size: 14px; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink); min-width: 320px; max-width: 100%;
}
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.title-row h1 { font-size: 20px; margin: 0; }
.code-tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.live-badge { font-size: 12px; color: #fff; background: var(--nav); border-radius: 4px; padding: 2px 8px; }
.sub { color: var(--muted); margin-top: 4px; }
.meta { color: var(--muted); font-size: 12.5px; margin-top: 6px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.card h2 { font-size: 16px; margin: 0 0 12px; }
.card-head h2 { margin-bottom: 0; }
.muted { color: var(--muted); font-weight: normal; font-size: 13px; }
.controls { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 6px; padding: 4px 12px; cursor: pointer; font-size: 13px; }
.tab:hover { border-color: var(--nav); }
.tab.active { background: var(--nav); color: #fff; border-color: var(--nav); }
.tab.toggle.active { background: #eef3f8; color: var(--nav); border-color: var(--nav); }

.chart { width: 100%; height: 380px; margin-top: 10px; }
.ind-chart { width: 100%; height: 320px; }
.chart-note { color: var(--muted); font-size: 12px; margin-top: 2px; }

.grid-title { font-weight: 600; margin: 16px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 14px; }
@media (max-width: 640px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } }
.metric { background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.metric .label { color: var(--muted); font-size: 12px; }
.metric .value { font-size: 17px; font-weight: 600; margin-top: 2px; }
.metric .note { color: var(--muted); font-size: 11px; margin-top: 1px; }

.pos { color: var(--pos); }
.neg { color: var(--neg); }

.dd-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.dd-item { display: flex; gap: 10px; align-items: baseline; font-size: 13px; border-top: 1px dashed var(--line); padding-top: 6px; }
.dd-item:first-child { border-top: none; }
.dd-item .dd-label { color: var(--muted); min-width: 84px; }
.dd-item .dd-depth { font-weight: 600; min-width: 72px; text-align: right; }

table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--muted); font-weight: 600; background: #fafbfc; }
.num { font-variant-numeric: tabular-nums; }

.alloc-wrap { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.pie { width: 300px; height: 260px; }
.alloc-legend { flex: 1; min-width: 240px; }
.alloc-legend .grp { margin-bottom: 8px; }
.alloc-legend .grp-name { font-weight: 600; }
.alloc-legend .sub-item { color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; }
.risk-line { margin-top: 12px; color: var(--muted); font-size: 13px; }

.ladder { display: flex; gap: 8px; margin-top: 6px; }
.ladder-card { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #f9fafb; cursor: pointer; }
.ladder-card:hover { border-color: var(--nav); }
.lc-title { font-size: 14px; font-weight: 600; color: #111827; }
.lc-label { font-size: 11px; color: #6b7280; margin: 4px 0 2px; }
.lc-bar { height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.lc-bar span { display: block; height: 100%; }
.ladder-axis { display: flex; justify-content: space-between; color: #9ca3af; font-size: 12px; margin: 8px 0 4px; }

#overview-table table.ov-summary th,
#overview-table table.ov-summary td { text-align: center; }

.adj { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.adj:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.adj-date { font-weight: 600; }
.adj-view { background: #f8fafc; border-left: 3px solid var(--nav); padding: 8px 10px; margin: 6px 0; border-radius: 0 6px 6px 0; color: #374151; }
.pkg-title { font-size: 13px; color: var(--muted); margin: 8px 0 4px; }
details.funds { margin-top: 6px; }
details.funds summary { cursor: pointer; color: var(--nav); font-size: 13px; }
.arrow { font-weight: 700; }

.help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--muted);
  color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer;
  vertical-align: middle; user-select: none;
}
.help:hover { border-color: var(--nav); color: var(--nav); }
.help-pop {
  position: fixed; max-width: 340px; background: #1f2933; color: #f3f4f6;
  font-size: 12.5px; line-height: 1.6; padding: 10px 12px; border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 50;
}
.foot { color: var(--muted); font-size: 12px; text-align: center; margin-top: 24px; }

.mat-search { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; min-width: 220px; }
.mat-item { display: flex; gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); }
.mat-item .mat-date { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mat-item .mat-freq { color: var(--nav); background: #eef3f8; border-radius: 4px; padding: 1px 7px; font-size: 12px; white-space: nowrap; }
.mat-item .mat-body { flex: 1; }
.mat-item .mat-summary { color: var(--muted); font-size: 12px; margin-top: 2px; }
.mat-pager { display: flex; gap: 6px; justify-content: center; margin-top: 14px; }
