:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --card: #ffffff;
  --text: #0b0b0c;
  --muted: #6f7479;
  --line: #ececee;
  --accent: #0b0b0c;
  --up: #008a52;
  --down: #d1332b;
  --up-bg: #e5f6ee;
  --down-bg: #fdebe9;
  --warn-bg: #fff4d6;
  --warn-text: #6b4a00;
  --chip: #f2f2f4;
  --cash: #2f6fed;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #000000;
    --text: #ffffff;
    --muted: #8e9196;
    --line: #1e1f22;
    --accent: #ffffff;
    --up: #22d18b;
    --down: #ff6a5f;
    --up-bg: #0d2a1f;
    --down-bg: #331512;
    --warn-bg: #3a2f10;
    --warn-text: #f3d98b;
    --chip: #17181b;
    --cash: #6ea4ff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0 auto;
  max-width: 760px;
  padding: 0 14px 36px;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
p { margin: 0; }
button { font: inherit; border: 0; cursor: pointer; }

/* ---------- total */
.hero { padding: calc(20px + env(safe-area-inset-top)) 6px 6px; }
.hero-row { display: flex; justify-content: space-between; align-items: center; }
.label { font-size: 15px; color: var(--muted); font-weight: 600; }
.total { font-size: 42px; font-weight: 700; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; margin-top: 2px; line-height: 1.15; }
.change { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; min-height: 30px; }
.change:empty { display: none; }
.pill { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; padding: 5px 10px; border-radius: 999px; background: var(--chip); }
.pill.up { color: var(--up); background: var(--up-bg); }
.pill.down { color: var(--down); background: var(--down-bg); }
.hero-sub { margin-top: 12px; font-size: 13px; color: var(--muted); }
.round { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--text); background: var(--chip); }
.round:disabled svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- tabs */
.tabs { display: flex; gap: 6px; padding: 14px 0 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 16px; border-radius: 999px; white-space: nowrap;
  background: var(--chip); color: var(--muted); font-weight: 600; font-size: 14px;
}
.tab.active { background: var(--text); color: var(--bg); }
.tabs { padding-left: 6px; }

/* ---------- cards */
.card { padding: 18px 6px 4px; margin-top: 10px; border-top: 1px solid var(--line); }
.card h2 { margin: 0 0 12px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.notice, .badge { background: var(--warn-bg); color: var(--warn-text); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-top: 12px; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }

/* ---------- composition chart */
.segments { display: flex; background: var(--chip); border-radius: 12px; padding: 3px; gap: 2px; }
.segment { flex: 1; padding: 7px 4px; border-radius: 9px; background: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.segment.active { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.chart { margin-top: 14px; display: grid; grid-template-columns: minmax(96px, 34%) 1fr auto; gap: 9px 10px; align-items: center; font-size: 13px; }
.chart-row { display: contents; }
.chart-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-track { height: 10px; border-radius: 5px; background: var(--chip); overflow: hidden; }
.chart-fill { display: block; height: 100%; border-radius: 5px; background: var(--text); }
.chart-fill.up { background: var(--up); }
.chart-fill.down { background: var(--down); }
.chart-fill.muted { background: var(--muted); }
.chart-value { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; text-align: right; }
.chart-note { margin-top: 12px; font-size: 12px; color: var(--muted); }

/* ---------- positions */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); cursor: pointer; }
.row:first-child { border-top: 0; padding-top: 2px; }
.logo { width: 36px; height: 36px; border-radius: 50%; background: var(--chip); display: grid; place-items: center; overflow: hidden; font-size: 13px; font-weight: 700; color: var(--muted); }
.logo img { width: 100%; height: 100%; object-fit: cover; }
.row .title { font-weight: 600; font-size: 15px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.row .meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row .right { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .value { font-weight: 650; font-size: 15px; }
.row .delta { font-size: 13px; font-weight: 600; }
.row .more { grid-column: 1 / 4; display: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row.open .more { display: block; }
.row.open .title { -webkit-line-clamp: 3; }
.row.stale { opacity: 0.6; }
.weight { height: 3px; border-radius: 2px; background: var(--chip); margin-top: 6px; overflow: hidden; }
.weight span { display: block; height: 100%; background: var(--muted); opacity: 0.6; }

button.connect { margin-top: 12px; padding: 11px 16px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 600; }
button.link { background: none; color: var(--muted); padding: 0; text-decoration: underline; }
footer { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 16px; padding: 0 4px; }

/* ---------- line charts */
.plot-slot { min-height: 176px; }
.plot-slot.small { min-height: 112px; }
.plot svg { display: block; width: 100%; height: 150px; touch-action: pan-y; }
.plot-slot.small .plot svg { height: 90px; }
.plot-info { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 20px; margin-bottom: 4px; }
.plot-empty { font-size: 13px; color: var(--muted); padding: 28px 0; }
.line .main { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.line .area { stroke: none; opacity: 0.1; }
.line.up .main { stroke: var(--up); } .line.up .area { fill: var(--up); }
.line.down .main { stroke: var(--down); } .line.down .area { fill: var(--down); }
.line .second { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.line .cursor { stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; display: none; }
.ranges { display: flex; gap: 4px; margin-top: 8px; }
.range { flex: 1; padding: 7px 0; border-radius: 999px; background: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.range.active { background: var(--chip); color: var(--text); }
.asset-chart { margin-top: 10px; cursor: default; }

/* ---------- plain text pages */
.legal { max-width: 640px; padding: 28px 20px 48px; }
.legal h1 { font-size: 26px; margin: 28px 0 12px; }
.legal h2 { font-size: 17px; margin: 22px 0 6px; }
.legal p, .legal li { color: var(--text); margin: 8px 0; }
.legal hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0 8px; }

/* ---------- net worth, accounts and their movements */
.stack { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; margin-bottom: 4px; }
.stack span { min-width: 3px; }
.stack .cash, .dot.cash, .chart-fill.cash { background: var(--cash); }
.stack .invest, .dot.invest { background: var(--text); }
.group-head { display: flex; align-items: baseline; gap: 8px; margin-top: 18px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.dot { width: 10px; height: 10px; border-radius: 50%; align-self: center; }
.group-label { font-weight: 700; font-size: 15px; }
.group-share { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.group-sum { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.group-head + .rows .row:first-child { padding-top: 11px; }
.row .right.nav { display: flex; align-items: center; gap: 10px; }
.chev { color: var(--muted); font-size: 20px; line-height: 1; }
.manage { margin-top: 14px; padding: 4px 12px 10px; border-radius: 12px; background: var(--chip); }
.manage-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.chart-divider { grid-column: 1 / 4; margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--cash); }
.chart-label.cash { color: var(--cash); font-weight: 700; }
button.back { margin: 12px 6px 0; padding: 8px 14px 8px 10px; border-radius: 999px; background: var(--chip); color: var(--text); font-weight: 600; font-size: 14px; }
.month { display: flex; justify-content: space-between; margin-top: 16px; padding-bottom: 6px; font-size: 13px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); }
.month:first-child { margin-top: 0; }
.month .group-sum { font-weight: 600; }
.tx { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.tx:first-child { border-top: 0; }
.tx .title { font-size: 15px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.tx .meta { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.tx .value { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx.pending { opacity: 0.6; }
.more-link { margin-top: 12px; font-size: 14px; }
.upload { display: grid; gap: 4px; margin-top: 12px; font-size: 14px; }
.upload input { font: inherit; color: var(--muted); }
