:root {
  color-scheme: dark;
  --bg: #0b1020;
  --surface: #141b2e;
  --surface-alt: #1a2540;
  --text: #e7edf8;
  --muted: #9fb0cb;
  --border: #2a395a;
  --accent: #78a9ff;
  --buy: #48c78e;
  --sell: #ff7b8b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; }
.site-header { background: rgba(20, 27, 46, .92); border-bottom: 1px solid var(--border); }
.header-content { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { color: var(--text); font-size: 1.15rem; font-weight: 750; }
nav { display: flex; flex-wrap: wrap; gap: 1rem; }
main { padding: 2.25rem 0 3rem; }
.hero { padding: .75rem 0 1.8rem; }
.hero.compact { padding-bottom: 1.4rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .45rem; font-size: clamp(1.8rem, 4vw, 2.65rem); }
h2 { margin-bottom: .2rem; font-size: 1.35rem; }
h3 { margin: 1.6rem 0 .65rem; font-size: 1.05rem; }
.eyebrow { margin-bottom: .3rem; color: var(--accent); font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 2.5rem; }
.card, .form-card, .empty-state { padding: 1.2rem; border: 1px solid var(--border); border-radius: .7rem; background: var(--surface); }
.card-label, .muted { color: var(--muted); }
.metric { margin-bottom: .9rem; font-size: 1.7rem; font-weight: 750; }
.metric-details, .inline-metrics { display: grid; gap: .4rem; margin: 0; }
.metric-details div, .inline-metrics div { display: flex; justify-content: space-between; gap: 1rem; }
dt { color: var(--muted); } dd { margin: 0; font-variant-numeric: tabular-nums; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 2.3rem 0 .85rem; }
.inline-metrics { grid-template-columns: repeat(3, minmax(110px, 1fr)); text-align: right; }
.inline-metrics div { display: block; }
.inline-metrics dd { font-weight: 700; }
.account-section + .account-section { border-top: 1px solid var(--border); margin-top: 2.5rem; padding-top: 1rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: .7rem; background: var(--surface); }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: .72rem .82rem; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); background: var(--surface-alt); font-size: .8rem; font-weight: 650; }
tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; border-radius: 99px; padding: .12rem .5rem; color: var(--bg); font-size: .78rem; font-weight: 750; }
.tag.buy { background: var(--buy); } .tag.sell { background: var(--sell); } .tag.history { background: var(--yellow, #f6c85f); color: #081225; }
.form-card { max-width: 620px; }
form p { display: grid; gap: .35rem; }
input[type="file"] { color: var(--muted); }
button { border: 0; border-radius: .45rem; padding: .62rem .9rem; background: var(--accent); color: #081225; cursor: pointer; font-weight: 750; }
button.secondary { background: var(--surface-alt); color: var(--text); }
.inline-form { display: flex; gap: .7rem; margin-top: 1rem; }
.messages { margin-bottom: 1rem; }
.message { padding: .7rem .9rem; border-radius: .45rem; background: #24416c; }
.message.error { background: #642a3a; }
.site-footer { padding: 1.5rem 0 2.5rem; color: var(--muted); font-size: .86rem; }
.dashboard-hero { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.button-link { display: inline-block; border: 1px solid var(--accent); border-radius: .45rem; padding: .58rem .8rem; font-weight: 700; }
.dashboard-chart-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 1.25rem 0 2.5rem; }
.portfolio-card { grid-column: 1 / -1; }
.portfolio-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.9fr); gap: 1rem; align-items: center; }
.chart-card { min-width: 0; padding: 1.1rem; border: 1px solid var(--border); border-radius: .7rem; background: var(--surface); }
.chart-heading { display: flex; justify-content: space-between; gap: 1rem; }
.chart-heading h2 { font-size: 1.1rem; }
.chart-heading > span { color: var(--muted); font-size: .82rem; }
.chart { display: block; width: 100%; min-height: 220px; overflow: visible; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis-label { fill: var(--muted); font-size: 12px; }
.chart-tooltip { fill: var(--text); font-size: 13px; font-weight: 700; }
.chart-empty-text { fill: var(--muted); font-size: 15px; }
.chart circle:focus, .chart rect:focus { outline: none; stroke: var(--text); stroke-width: 2; }
.allocation-layout { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(140px, 1fr); align-items: center; gap: .75rem; }
.donut-chart { min-height: 200px; }
.chart-donut-value { fill: var(--text); font-size: 18px; font-weight: 750; }
.allocation-legend { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.allocation-legend li { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: .45rem; color: var(--muted); font-size: .84rem; }
.allocation-legend strong { color: var(--text); font-variant-numeric: tabular-nums; }
.legend-swatch { width: 10px; height: 10px; border-radius: 50%; }
.snapshot-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.snapshot-form-grid .full-width { grid-column: 1 / -1; }
.snapshot-form-grid input, .snapshot-form-grid select, .snapshot-form-grid textarea { width: 100%; border: 1px solid var(--border); border-radius: .35rem; padding: .55rem; background: var(--bg); color: var(--text); }
@media (max-width: 680px) {
  .header-content, .section-heading { align-items: flex-start; flex-direction: column; }
  .inline-metrics { width: 100%; text-align: left; }
  .dashboard-hero { align-items: flex-start; flex-direction: column; }
  .dashboard-chart-grid { grid-template-columns: 1fr; }
  .portfolio-layout { grid-template-columns: 1fr; }
  .allocation-layout { grid-template-columns: 1fr; }
  .snapshot-form-grid { grid-template-columns: 1fr; }
}
