:root {
  --bg: #0b0e14;
  --card: #131824;
  --card-2: #1a2030;
  --line: #232a3b;
  --text: #e8ecf4;
  --muted: #8a93a6;
  --up: #34d399;
  --down: #f87171;
  --warn: #fbbf24;
  --accent: #34d399;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  font-variant-numeric: tabular-nums;
}
main { max-width: 560px; margin: 0 auto; padding: 0 16px 32px; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.banner {
  position: sticky; top: 0; z-index: 5;
  background: var(--warn); color: #1a1300;
  text-align: center; font-weight: 700; font-size: 12px; letter-spacing: .02em;
  padding: 6px 12px;
}

.top {
  max-width: 560px; margin: 0 auto; padding: 14px 16px 4px;
  display: flex; align-items: center; justify-content: space-between;
}
.title { font-weight: 700; font-size: 17px; }
.icon-btn { font-size: 20px; width: 40px; height: 40px; border-radius: 12px; background: var(--card); }
.icon-btn.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hero { padding: 18px 0 10px; }
.label { color: var(--muted); font-size: 13px; }
.total { font-size: 44px; font-weight: 750; letter-spacing: -.02em; margin: 2px 0 6px; }
.pnl-row { display: flex; gap: 4px 16px; flex-wrap: wrap; font-weight: 600; font-size: 14px; }
.pnl-label { color: var(--muted); font-weight: 500; margin-right: 2px; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
#updated { margin-top: 6px; }

.chart-card { background: var(--card); border-radius: 18px; padding: 12px 12px 10px; margin: 8px 0 18px; }
.readout { font-size: 13px; color: var(--muted); min-height: 18px; padding: 0 4px; }
.chart { height: 190px; position: relative; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: 100%; }
.ranges { display: flex; gap: 6px; justify-content: space-between; margin-top: 8px; }
.ranges button, .tabs button {
  flex: 1; padding: 8px 0; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 13px;
}
.ranges button.on, .tabs button.on { background: var(--card-2); color: var(--text); }

.tabs { display: flex; gap: 6px; background: var(--card); padding: 4px; border-radius: 14px; margin-bottom: 10px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  background: var(--card); border-radius: 16px; padding: 14px;
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center;
}
.row .name { font-weight: 650; display: flex; align-items: center; gap: 8px; min-width: 0; }
.row .name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .value { font-weight: 700; text-align: right; }
.row .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .share { color: var(--muted); font-size: 12px; text-align: right; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--up); flex: none; }
.dot.error { background: var(--down); }
.row.error .value { color: var(--muted); font-weight: 600; }
.bar { grid-column: 1 / -1; height: 4px; background: var(--card-2); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.holdings { grid-column: 1 / -1; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; display: none; }
.row.open .holdings { display: block; }
.hold { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; gap: 12px; }
.hold .muted { font-size: 12px; }

.card { background: var(--card); border-radius: 16px; padding: 14px; margin-top: 18px; }
.card-title { font-weight: 650; margin-bottom: 4px; }
.foot { text-align: center; margin-top: 24px; }
