:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--app-bg);
  font-synthesis: none;
  --app-bg: #10151d;
  --nav-bg: #17212c;
  --nav-selected: #25474f;
  --nav-selected-ink: #c2eeed;
  --status-bg: #253b3c;
  --status-line: #395554;
  --status-ink: #c2e2dc;
  --hero-line: #394f61;
  --hero-start: #1c2b3e;
  --hero-end: #1c3540;
  --live-surface: #182a32;
  --live-line: #3a6168;
  --live-accent: #63aeac;
  --live-ink: #b2e4df;
  --secondary-bg: #233b49;
  --secondary-line: #416173;
  --secondary-ink: #d1ebeb;
  --hover-bg: #2e4655;
  --coin-bg: #223c4f;
  --coin-ink: #c4dfec;
  --live-pill: #273f41;
  --live-pill-ink: #c4e6e2;
  --input-line: #516577;
  --toast-bg: #293d50;
  --ink: #ecf2f7;
  --muted: #aebcca;
  --line: #334352;
  --surface: #19232e;
  --paper: #121b25;
  --primary: #24565b;
  --link: #a5e0da;
  --primary-hover: #30656a;
  --focus: #edc572;
  --positive: #87d3ae;
  --negative: #f5a8b1;
  --nav-height: 78px;
}
:root[data-theme="midnight"] {
  --app-bg: #101522;
  --surface: #1c263a;
  --paper: #151e31;
  --line: #364664;
  --nav-bg: #172137;
  --nav-selected: #304a72;
  --nav-selected-ink: #deeaff;
  --status-bg: #233b60;
  --status-line: #405d86;
  --status-ink: #d3e4ff;
  --primary: #344e80;
  --primary-hover: #405d95;
  --link: #b5ceff;
  --hero-line: #465c88;
  --hero-start: #202e4c;
  --hero-end: #283b60;
  --live-surface: #192a46;
  --live-line: #435f8f;
  --live-accent: #8daff4;
  --live-ink: #c2d8ff;
  --secondary-bg: #26395b;
  --secondary-line: #4d638c;
  --secondary-ink: #dce7fd;
  --hover-bg: #34496d;
  --live-pill: #2e4266;
  --live-pill-ink: #d6e5ff;
  --coin-bg: #2a426b;
  --coin-ink: #d0e2ff;
  --input-line: #566d96;
  --toast-bg: #293e62;
}

:root[data-theme="forest"] {
  --app-bg: #101b17;
  --surface: #1b2c25;
  --paper: #14221b;
  --line: #344d40;
  --nav-bg: #192b22;
  --nav-selected: #2d503d;
  --nav-selected-ink: #d0f3da;
  --status-bg: #2b4838;
  --status-line: #476752;
  --status-ink: #d0efda;
  --primary: #315843;
  --primary-hover: #3c6b50;
  --link: #b8e9c5;
  --hero-line: #466750;
  --hero-start: #21392e;
  --hero-end: #294536;
  --live-surface: #192f24;
  --live-line: #406651;
  --live-accent: #82c89c;
  --live-ink: #bdebc8;
  --secondary-bg: #294738;
  --secondary-line: #496d57;
  --secondary-ink: #d7f2de;
  --hover-bg: #355640;
  --live-pill: #304d3b;
  --live-pill-ink: #d0ebd8;
  --coin-bg: #2b4a3a;
  --coin-ink: #d1efdc;
  --input-line: #597660;
  --toast-bg: #2b493a;
}

:root[data-theme="plum"] {
  --app-bg: #1a1420;
  --surface: #2a2034;
  --paper: #21182b;
  --line: #493958;
  --nav-bg: #251c30;
  --nav-selected: #543d6b;
  --nav-selected-ink: #f2dfff;
  --status-bg: #4b365f;
  --status-line: #6a5281;
  --status-ink: #eedbff;
  --primary: #593d70;
  --primary-hover: #6a4b83;
  --link: #e3c5ff;
  --hero-line: #644e78;
  --hero-start: #372944;
  --hero-end: #463354;
  --live-surface: #32243f;
  --live-line: #624a76;
  --live-accent: #bf9edb;
  --live-ink: #e8d0fb;
  --secondary-bg: #473453;
  --secondary-line: #6e557e;
  --secondary-ink: #f1defc;
  --hover-bg: #554062;
  --live-pill: #4e3b5d;
  --live-pill-ink: #ecd8fb;
  --coin-bg: #4b365e;
  --coin-ink: #ebd8fb;
  --input-line: #745f83;
  --toast-bg: #49385d;
}


*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .62; cursor: wait; }
:where(button, a, summary, input, select, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
a { color: var(--link); text-underline-offset: 3px; }
p { line-height: 1.6; }

.shell {
  max-width: 760px;
  margin: auto;
  padding: 0 clamp(14px, 4vw, 32px) calc(var(--nav-height) + env(safe-area-inset-bottom) + 28px);
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; font-size: 12px; font-weight: 800; letter-spacing: .07em; }
.brand small { display: block; margin-top: 3px; letter-spacing: 0; font-size: 12px; font-weight: 500; color: var(--muted); }
.logo {
  flex: 0 0 43px;
  height: 43px;
  border-radius: 12px;
  background: #000 url("bitcoin-192.png") center / cover no-repeat;
  color: transparent;
}
.local {
  flex-shrink: 0;
  padding: 6px 9px;
  border: 1px solid var(--status-line);
  border-radius: 999px;
  background: var(--status-bg);
  color: var(--status-ink);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

h1 { margin: 0 0 7px; font-size: clamp(27px, 5.8vw, 36px); line-height: 1.18; letter-spacing: -.045em; }
h2 { margin: 0; font-size: clamp(17px, 4.1vw, 21px); line-height: 1.25; letter-spacing: -.025em; }
h3 { margin: 0 0 7px; font-size: 15px; line-height: 1.35; }
.sub { margin: 0 0 21px; color: var(--muted); font-size: 14px; }
.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.45;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.sectionhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 27px 0 12px; }
.sectionhead .purchase-filter { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0; font-size: 14px; cursor: pointer; }
.note, .error { margin: 12px 0 0; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.note { color: var(--muted); }
.error { color: var(--negative); }

.card, .stat {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 2px 4px #00000020;
}
.card { margin: 14px 0; padding: clamp(15px, 4vw, 24px); border-radius: 17px; }
.hero {
  margin: 14px 0;
  padding: clamp(19px, 4.6vw, 29px);
  border: 1px solid var(--hero-line);
  border-radius: 20px;
  background: linear-gradient(133deg, var(--hero-start), var(--hero-end));
  color: #f1f6fa;
}
.hero .eyebrow, .hero .caption, .herorow small { color: #c5d4df; }
.hero .caption { font-size: 13px; line-height: 1.5; }
.amount, .live-value {
  margin: 9px 0 5px;
  font-size: clamp(28px, 7.4vw, 44px);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
}
.live-card { border-color: var(--live-line); border-top: 3px solid var(--live-accent); background: var(--live-surface); }
.live-card .exithead { flex-wrap: wrap; }
.live-value { color: var(--live-ink); margin-top: 13px; }
.herorow, .stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.herorow { border-top: 1px solid #d7eef23d; margin-top: 15px; padding-top: 13px; }
.herorow strong, .stat strong, .scenario-values strong {
  display: block;
  font-size: clamp(16px, 4.4vw, 22px);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.herorow small, .coin-average { grid-column: 1 / -1; }
.stat small, .scenario-values small {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  line-height: 1.4;
}

.stat { padding: clamp(11px, 3.6vw, 17px); border-radius: 14px; min-width: 0; }
.stat small, .scenario-values small { color: var(--muted); }
.scenario-values { margin-top: 13px; }
.scenario-values > div { min-width: 0; padding: clamp(10px, 3.2vw, 14px); border-radius: 11px; background: var(--paper); }
.amount-positive, .buyline b.amount-positive { color: var(--positive); }
.amount-negative, .buyline b.amount-negative { color: var(--negative); }

.primary, .secondary, .textbtn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}
.primary { background: var(--primary); color: #f1f6fa; }
.secondary { background: var(--secondary-bg); border-color: var(--secondary-line); color: var(--secondary-ink); }
.textbtn { background: transparent; color: var(--link); }
.textbtn.danger { color: var(--negative); }
.full { width: 100%; margin-top: 10px; }
.back { padding-left: 0; margin-bottom: 7px; }
.actions, .filter { display: flex; align-items: stretch; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.filter { margin: 16px 0; }
.filter .selected { background: var(--primary); border-color: var(--primary); color: #f1f6fa; }
@media (hover: hover) {
  .primary:hover:not(:disabled), .filter .selected:hover { background: var(--primary-hover); }
  .secondary:hover:not(.selected), .textbtn:hover, .clickable:hover { background: var(--hover-bg); }
  .textbtn.danger:hover { background: #492b37; }
}

.row, .buyline, .exithead, .modalhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.row { border-bottom: 1px solid var(--line); padding: 13px 4px; }
.row:last-child { border: 0; }
.row strong { display: block; font-size: 15px; }
.row small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.right { min-width: 0; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.clickable { cursor: pointer; }
.coinleft { display: flex; align-items: center; min-width: 0; gap: 9px; overflow-wrap: anywhere; }
.coinicon {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--coin-bg);
  color: var(--coin-ink);
  font-size: 12px;
  font-weight: 800;
}
.pill {
  flex-shrink: 0;
  padding: 5px 8px;
  border-radius: 999px;
  background: #483a25;
  color: #f2d69d;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
}
.pill.done { background: #263e35; color: #afe0c4; }
.pill.warn { background: #503527; color: #f8d2ab; }
.live-card .pill:not(.warn) { background: var(--live-pill); color: var(--live-pill-ink); }
.buyline { align-items: baseline; margin: 8px 0; font-size: 13px; color: var(--muted); }
.buyline span { min-width: 0; }
.buyline b { flex-shrink: 0; max-width: 57%; text-align: right; color: var(--ink); font-weight: 700; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.exithead :is(h2, h3) { min-width: 0; overflow-wrap: anywhere; }
.exit, .mapping { border-top: 1px solid var(--line); padding-top: 13px; margin-top: 13px; }
.buy-exits { margin-top: 13px; border-top: 1px solid var(--line); }
.buy-exits > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  color: var(--link);
  font-size: 13px;
  font-weight: 750;
}
summary { cursor: pointer; }
.buy-exits > summary::-webkit-details-marker { display: none; }
.buy-exit-arrow { display: inline-block; width: 7px; height: 7px; margin: 0 4px 0 3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); }
.buy-exits[open] > summary .buy-exit-arrow { transform: rotate(45deg) translateY(-2px); }
.buy-exits > .exit:first-of-type { margin-top: 0; }

.donut {
  --diameter: clamp(148px, 40vw, 186px);
  width: var(--diameter);
  height: var(--diameter);
  display: grid;
  place-items: center;
  margin: 0 auto 17px;
  border-radius: 50%;
}
.hole { width: 76%; height: 76%; display: grid; place-content: center; border-radius: 50%; background: var(--surface); text-align: center; }
.hole strong { font-size: 28px; font-weight: 750; line-height: 1.1; }
.hole small { font-size: 12px; color: var(--muted); }
.legend { display: grid; gap: 7px 16px; font-size: 13px; }
.legendline { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; padding: 4px 0; }
.legendline span { overflow-wrap: anywhere; }
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; }
.allocation-preview {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: center;
  gap: 12px;
  margin: 12px -48px 3px 0;
}
.allocation-preview, .allocation-detail { font-family: system-ui, sans-serif; letter-spacing: normal; }
.allocation-preview .allocation-donut {
  --diameter: min(100%, clamp(96px, 30vw, 152px));
  height: auto;
  aspect-ratio: 1;
}
.allocation-donut { margin: 0 auto; }
.allocation-donut .hole { width: 78%; height: 78%; padding: 4px; border-radius: 50%; }
.allocation-donut .hole strong { font-size: clamp(12px, 3.3vw, 16px); overflow-wrap: anywhere; }
.allocation-donut .hole small { margin-top: 2px; font-size: 11px; }
.allocation-summary-legend { gap: 0; }
.allocation-summary-legend .legendline { border-bottom: 1px solid var(--line); font-weight: 500; }
.allocation-summary-legend .legendline:last-child { border-bottom: 0; }
.allocation-coin { display: flex; align-items: baseline; min-width: 0; }
.allocation-coin .dot { flex: 0 0 8px; }
.allocation-summary-legend b, .allocation-detail-legend b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.allocation-detail { display: grid; gap: 12px; }
.allocation-detail .allocation-donut .hole strong { font-size: clamp(16px, 4.5vw, 22px); }
.allocation-detail-legend { gap: 0; }
.allocation-detail-legend .legendline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content minmax(7em, max-content);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.allocation-detail-legend .legendline b { text-align: end; }
.allocation-detail-legend small { display: block; color: var(--muted); }
.allocation-detail .note { margin: 0; }
.allocation-empty { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.overview-panel:is([open], [data-title-only]) .allocation-preview { display: none; }

label { display: block; margin: 13px 0 6px; color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1.45; }
input, select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--input-line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
}
input[type="file"] { font-size: 13px; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; margin: 0 4px 0 0; vertical-align: middle; accent-color: var(--primary); }
input::placeholder { color: #a3b3c2; }
.exit-slider { margin: 5px 0 13px; }
.exit-slider-heading, .exit-slider-scale {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.exit-slider-heading label { margin: 0; font-size: 12px; font-weight: 550; }
.exit-slider-heading output { color: var(--link); font-size: 13px; font-weight: 700; }
.exit-slider input[type="range"] {
  display: block;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--link);
  cursor: pointer;
}
.exit-slider input:disabled { opacity: .5; cursor: default; }
.exit-slider-scale { color: var(--muted); font-size: 11px; }
.exit-slider-presets { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin-top: 8px; }
.exit-slider-presets button { min-height: 44px; padding: 6px; font-size: 13px; }
.search { margin: 5px 0 10px; }
.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
dialog {
  width: min(calc(100% - 24px), 470px);
  max-height: 90dvh;
  padding: clamp(15px, 4vw, 23px);
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--surface);
  color: var(--ink);
  overflow: auto;
}
dialog::backdrop { background: #080d15bd; }
.modalhead button { min-width: 44px; min-height: 44px; border: 0; border-radius: 50%; background: var(--paper); color: var(--ink); }

nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 760px);
  min-height: var(--nav-height);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  align-items: start;
  padding: 6px max(8px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: var(--nav-bg);
  box-shadow: 0 -4px 20px #00000047;
  z-index: 5;
}
nav button {
  min-height: 53px;
  padding: 5px 2px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 21px;
  line-height: 1.1;
}
nav span { display: block; margin-top: 5px; font-size: 11px; font-weight: 650; }
nav button[data-tab="backup"] span { font-size: clamp(8.5px, 2.75vw, 11px); }
nav button[data-tab="backup"] .settings-icon { font-size: 21px; margin-top: 0; }
nav button.active { background: var(--nav-selected); color: var(--nav-selected-ink); font-weight: 800; }
nav button.active span { font-weight: 800; }
#toast {
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: none;
  max-width: min(90%, 480px);
  padding: 12px 15px;
  border-radius: 11px;
  background: var(--toast-bg);
  color: #f1f6fa;
  font-size: 13px;
  box-shadow: 0 4px 15px #00000044;
}
.empty { padding: 25px 12px; text-align: center; color: var(--muted); font-size: 14px; }
@media (max-width: 355px) {
  .brand small { font-size: 11px; }
  .local { padding-inline: 6px; font-size: 9px; }
  .pill { white-space: normal; }
  .actions .primary, .actions .secondary { padding-inline: 9px; }
}
nav button[data-tab="exits"] { font-size: 0; }
nav button[data-tab="exits"]::before {
  content: "";
  display: block;
  width: 13px;
  height: 13px;
  margin: 2px auto 4px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  background: linear-gradient(135deg, transparent 43%, currentColor 44% 55%, transparent 56%);
}

.profit-section { margin-top: 15px; }
.profit-section + .profit-section { padding-top: 15px; border-top: 1px solid var(--line); }
.profit-section h3 { margin-bottom: 0; }
.profit-section > .note { margin-top: 5px; }
.sale-totals small { display: block; margin-top: 3px; }
.profit-note { border-top: 1px solid var(--line); padding-top: 11px; }
.profit-details { margin-top: 12px; border-top: 1px solid var(--line); }
.profit-details > summary { min-height: 44px; padding: 12px 0; color: var(--link); font-weight: 650; }
.profit-details > .profit-section { margin-top: 3px; }
.history-ranges { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 2px; padding: 3px; margin-top: 13px; border-radius: 11px; background: var(--paper); }
.history-range { min-height: 44px; padding: 4px 1px; border: 0; border-radius: 8px; background: transparent; font-size: 12px; color: var(--muted); }
.history-range[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 750; }
.history-value strong { color: var(--ink); }
.history-plot { display: block; width: 100%; height: auto; margin-top: 8px; color: var(--positive); }
.history-plot.history-falling { color: var(--negative); }
.history-plot line { stroke: var(--line); }
.history-plot text { fill: var(--muted); font-size: 10px; }
.history-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; padding-top: 5px; }
.exit-distance { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 12px; }
.exit-distance small { color: var(--muted); }
.import-review { border-top: 1px solid var(--line); padding-top: 13px; margin: 13px 0; }
.review-items { padding-left: 20px; }
.review-items > li { margin: 8px 0; }
.review-items ul { padding-left: 16px; }

.exit-preview { margin: 16px 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.exit-preview h3 { margin: 0 0 8px; font-size: 15px; }
.upcoming-exits-list { margin: 8px 0 0; padding: 0; list-style: none; }
.upcoming-exits-list li + li { border-top: 1px solid var(--line); }
.upcoming-exits-list .upcoming-exit-link {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: start;
  gap: 6px 10px;
  padding: 10px 0;
}
.target-coin-icon { width: 38px; height: 38px; border-radius: 50%; }
.target-coin-info { min-width: 0; overflow-wrap: anywhere; }
.target-coin-info strong { display: block; font-size: 15px; }
.target-prices { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); font-size: 13px; }
.target-prices b { color: var(--ink); font-weight: 550; }
.target-quantity { display: block; color: var(--muted); font-size: 12px; }
.target-progress { display: grid; grid-column: 2; gap: 2px; color: var(--live-accent); }
.target-progress-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px; }
.target-progress-row b { font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.target-progress-track { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.target-progress-track > span { display: block; height: 100%; border-radius: inherit; background: currentColor; }
.target-progress.is-reached { color: var(--positive); }
.target-progress small { text-align: end; font-size: 12px; }
@media (min-width: 630px) {
  .upcoming-exits-list .upcoming-exit-link { grid-template-columns: 38px minmax(0, 1fr) minmax(126px, 29%); align-items: center; }
  .target-progress { grid-column: 3; }
}
.annual-sales-list { padding: 0; margin: 14px 0 0; list-style: none; }
.annual-sales-list li { padding: 10px 0 4px; border-top: 1px solid var(--line); }

.portfolio-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 18px;
}
.portfolio-switch button span, .brand small { min-width: 0; overflow-wrap: anywhere; }
.portfolio-switch [aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--link);
  color: var(--ink);
}

.help-topic, .coin-mapping { padding-block: 0; }
.help-topic > summary, .coin-mapping > summary {
  padding-block: 13px;
  min-height: 44px;
  font-weight: 750;
  line-height: 1.4;
  cursor: pointer;
}
.help-content {
  padding-bottom: 15px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.help-content strong { color: var(--ink); }
.help-content > :first-child { margin-top: 0; }
.help-content > :last-child { margin-bottom: 0; }
.help-content ul { padding-left: 20px; }
.help-content li + li { margin-top: 7px; }

.coin-mapping { scroll-margin-top: 12px; }
.coin-mapping-content { padding-bottom: 15px; }
.coin-mapping-content > :first-child { margin-top: 0; }

.overview-customize { margin: 0 0 14px; }
.overview-order { display: grid; gap: 6px; padding: 0; list-style: none; }
.overview-order li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 5px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.overview-order.has-visibility li { grid-template-columns: auto minmax(0, 1fr) auto auto auto; }
.overview-order li button { min-width: 40px; padding-inline: 6px; }
.overview-order li button:disabled { cursor: default; }
.overview-drag { display: grid; place-items: center; width: 36px; min-height: 44px; font-size: 22px; color: var(--muted); cursor: grab; touch-action: none; user-select: none; }
.overview-dragging { opacity: .6; }
.overview-order li.overview-drop-target { border-color: var(--link); background: var(--primary); }
.overview-order-status { margin: 0; color: var(--muted); font-size: 13px; }

.overview-panel { padding: 0; overflow: clip; }
.overview-panel[data-overview-section="value"] { background: var(--live-surface); border-color: var(--live-line); border-top: 3px solid var(--live-accent); }
.overview-panel > summary { min-height: 48px; padding: 13px 16px; font-weight: 750; }
.overview-panel > summary:focus-visible { outline-offset: -4px; }
.tax-filter-summary { margin-inline-start: .5em; color: var(--muted); font: 500 .875rem system-ui, sans-serif; }
.tax-panel[open] > summary .tax-filter-summary { display: none; }
.overview-body { padding: 0 16px 16px; }
.overview-body > :is(.card, .hero) { margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.overview-body > .sectionhead { margin: 0 0 7px; }
.overview-body > :is(.card, .hero, .sectionhead) > :is(h2, .eyebrow) { display: none; }
.overview-basis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.overview-basis-grid > div {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  padding: 9px clamp(8px, 2.5vw, 16px);
  border: 1px solid var(--hero-line);
  border-radius: 12px;
  background: linear-gradient(133deg, var(--hero-start), var(--hero-end));
}
.overview-basis-grid dt {
  color: var(--muted);
  font-size: clamp(.8125rem, 3.6vw, .9375rem);
  font-weight: 650;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.overview-basis-grid dd {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1rem, 4.7vw, 1.5rem);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.overview-hidden-label { display: block; color: var(--muted); }
.overview-visibility { font-size: 18px; }

.overview-panel .live-summary { display: block; margin-top: 12px; }
.overview-panel .live-summary > .pill:not(.warn) { background: var(--live-pill); color: var(--live-pill-ink); }
.live-value-row { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-top: 13px; margin-inline-end: -48px; }
.live-value-row > .live-value { margin: 0; min-width: 0; }
.live-change24h { display: grid; gap: 3px; max-width: 53%; flex-shrink: 0; padding-bottom: 2px; text-align: end; color: var(--muted); }
.live-change24h small { font-size: 11px; color: var(--muted); }
.live-change24h-values { display: flex; flex-wrap: wrap; justify-content: flex-end; column-gap: 9px; row-gap: 3px; }
.live-change24h-values b { font-size: clamp(13px, 3.7vw, 18px); font-variant-numeric: tabular-nums; white-space: nowrap; }
.live-change24h.is-positive { color: var(--positive); }
.live-change24h.is-negative { color: var(--negative); }
.overview-panel[data-overview-section="value"] .overview-body > :first-child { margin-top: 0; }

.overview-value-panel, .overview-allocation-panel { position: relative; }
:is(.overview-value-panel, .overview-allocation-panel) > .overview-panel > summary { padding-right: 64px; }
.overview-value-toggle {
  position: absolute;
  inset-block-start: 5px;
  inset-inline-end: 9px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}
.overview-panel[data-title-only] .live-summary { display: none; }

.theme-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 8px; margin-top: 12px; }
.theme-option { display: flex; align-items: center; gap: 6px; min-height: 46px; margin: 0; padding: 6px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.theme-option:has(:checked) { border-color: var(--link); color: var(--ink); }
.theme-option input { width: 15px; height: 15px; min-height: 0; margin: 0; accent-color: var(--link); }
.theme-option input:focus-visible { outline-offset: 2px; }
.theme-swatch { flex: 0 0 13px; height: 13px; border-radius: 50%; background: var(--swatch); }
.theme-option > span:last-child { overflow-wrap: anywhere; min-width: 0; }

.header-actions { display: flex; align-items: center; gap: 4px; }
#privacy-toggle { display: grid; place-items: center; width: 44px; height: 44px; border: 0; padding: 0; background: transparent; color: var(--muted); }
#privacy-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
#privacy-toggle .privacy-slash { display: none; }
#privacy-toggle[aria-pressed="true"] { color: var(--link); }
#privacy-toggle[aria-pressed="true"] .privacy-slash { display: block; }
.live-quote-status { display: inline-block; color: var(--muted); font-size: 12px; font-weight: 550; margin-inline-start: 5px; }
.upcoming-exit-link { display: block; width: 100%; padding: 0; border: 0; border-radius: 6px; background: transparent; text-align: start; color: var(--ink); }
.upcoming-exit-link:hover { background: var(--hover-bg); }
[data-plan-exit] { scroll-margin-top: 12px; }
[data-plan-exit]:focus { border-color: var(--link); }
.history-plot[data-history-interactive] { touch-action: pan-y; cursor: crosshair; }
.history-plot [data-history-guide] { stroke: var(--muted); stroke-dasharray: 3 3; }
.history-value { font-weight: 700; color: var(--ink); }

.live-change24h { min-height: 44px; padding: 2px 0; border: 0; background: transparent; }
.live-quick-actions { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.live-quick-actions button { min-width: 44px; min-height: 44px; padding: 0; font-size: 22px; }
.change-detail-content .buyline { flex-wrap: wrap; }

.live-background-status { display: block; margin: 5px -48px 0 0; color: var(--muted); font-size: 13px; font-weight: 400; }
#exit-alerts input[type="checkbox"] { width: 18px; min-height: 18px; margin: 0 5px 0 0; vertical-align: middle; accent-color: var(--link); }

.overview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-bottom: 14px;
}
.overview-heading h1, .overview-heading .overview-customize { margin: 0; }

:root[data-theme="gold"] {
  --app-bg: #121110;
  --surface: #1b1a18;
  --paper: #161513;
  --ink: #f6eddd;
  --muted: #bfb7a9;
  --line: #403a31;
  --nav-bg: #151413;
  --nav-selected: #241e15;
  --nav-selected-ink: #f1c66e;
  --status-bg: #211d17;
  --status-line: #483d2b;
  --status-ink: #e4c690;
  --primary: #e9b748;
  --primary-hover: #f0c66c;
  --link: #edc575;
  --focus: #f2cb7e;
  --positive: #8bd6a5;
  --negative: #f2a2a8;
  --hero-line: #463b2d;
  --hero-start: #231f19;
  --hero-end: #1b1916;
  --live-surface: #201c16;
  --live-line: #56452e;
  --live-accent: #e9b748;
  --live-ink: #fff2da;
  --secondary-bg: #27231d;
  --secondary-line: #5b4c35;
  --secondary-ink: #f0e2c8;
  --hover-bg: #332a1d;
  --coin-bg: #392b19;
  --coin-ink: #f0c774;
  --live-pill: #34291b;
  --live-pill-ink: #edc981;
  --input-line: #71624c;
  --toast-bg: #3b2e1d;
  --display-face: "Crimson Text", Georgia, "Noto Serif", serif;
}

[data-theme="gold"] header { border-bottom-color: var(--line); margin-bottom: 16px; }
[data-theme="gold"] .logo { border: 1px solid var(--hero-line); border-radius: 50%; }
[data-theme="gold"] .brand {
  font: 700 clamp(16px, 4.3vw, 23px)/1.12 var(--display-face);
  letter-spacing: -.02em;
}
[data-theme="gold"] .brand small { font-family: system-ui, sans-serif; }
[data-theme="gold"] :is(h1, h2, .overview-panel > summary) {
  font-family: var(--display-face);
  letter-spacing: -.02em;
}
[data-theme="gold"] .overview-panel > summary { font-size: clamp(18px, 4.6vw, 22px); }
[data-theme="gold"] .live-summary { font-family: system-ui, sans-serif; letter-spacing: 0; }
[data-theme="gold"] .live-value-row > .live-value {
  font-family: var(--display-face);
  font-size: clamp(29px, 8.2vw, 52px);
  letter-spacing: -.045em;
}
[data-theme="gold"] .live-value-row { align-items: center; }
[data-theme="gold"] .live-quick-actions button { margin-inline-start: -9px; }
[data-theme="gold"] .live-background-status { padding-top: 7px; border-top: 1px solid var(--live-line); }
.recent-value {
  display: block;
  margin: 10px -48px 0 0;
  color: var(--live-accent);
}
.recent-value small { display: block; color: var(--muted); font-size: 12px; font-weight: 550; }
.recent-value svg { display: block; width: 100%; height: 48px; }
[data-theme="gold"] .overview-panel[data-overview-section="value"] {
  border-top-width: 1px;
  background: radial-gradient(ellipse at top right, #3a2b19 0%, transparent 65%), var(--live-surface);
}
[data-theme="gold"] .overview-panel > summary::marker { color: var(--link); }
[data-theme="gold"] .portfolio-switch { gap: 10px; }
[data-theme="gold"] .portfolio-switch button { border-radius: 13px; font-size: 14px; }
[data-theme="gold"] .portfolio-switch [aria-pressed="true"] {
  background: #322716;
  color: var(--link);
}
[data-theme="gold"] .primary, [data-theme="gold"] .filter .selected { color: #211709; }
[data-theme="gold"] .hero { color: var(--ink); }
[data-theme="gold"] :is(.hero .eyebrow, .hero .caption, .herorow small) { color: var(--muted); }
[data-theme="gold"] .herorow { border-color: var(--line); }
[data-theme="gold"] .history-plot:not(.history-falling) { color: var(--live-accent); }
[data-theme="gold"] .overview-customize .secondary { background: transparent; }
[data-theme="gold"] nav button.active { box-shadow: inset 0 2px 0 var(--live-accent); }
@media (max-width: 420px) {
  [data-theme="gold"] .brand { gap: 8px; }
  [data-theme="gold"] .logo { flex-basis: 36px; height: 36px; }
}

[data-theme="gold"] nav button[data-tab="backup"] .settings-icon {
  width: 17px;
  height: 17px;
  margin: 2px auto 4px;
  padding: 0;
  font-size: 0;
  background: currentColor;
  clip-path: polygon(40% 1%, 60% 1%, 63% 16%, 73% 20%, 86% 12%, 98% 26%, 87% 38%, 88% 47%, 100% 54%, 96% 73%, 80% 73%, 72% 81%, 72% 96%, 53% 100%, 47% 87%, 37% 85%, 25% 95%, 11% 82%, 18% 68%, 14% 60%, 0 58%, 0 40%, 15% 35%, 21% 27%, 14% 13%, 29% 7%, 37% 19%, 43% 15%);
  mask-image: radial-gradient(circle, transparent 0 23%, #000 26%);
}
[data-theme="gold"] .live-value-row { flex-wrap: wrap; }
[data-theme="gold"] .live-value-row > .live-value { flex: 1 1 auto; max-width: 100%; }
@media (max-width: 470px) {
  [data-theme="gold"] .live-change24h { max-width: 100%; }
  [data-theme="gold"] .live-change24h-values { flex-direction: column; align-items: flex-end; }
}

.overview-panel[open] .recent-value { display: none; }
.value-details { margin-top: 13px; border-top: 1px solid var(--live-line); }
.value-details > summary { min-height: 44px; padding: 12px 0; color: var(--link); font-weight: 650; }
.live-history .history-value { margin-top: 0; min-height: 42px; }
.live-history .history-plot { color: var(--live-accent); overflow: visible; }
.live-history .history-plot line:not([data-history-guide]) { stroke-dasharray: 3 3; }
.live-history [data-history-marker] { stroke: var(--live-surface); stroke-width: 1.5; }
.live-history .history-ranges { grid-template-columns: repeat(6, minmax(0,1fr)); }
.live-history .history-range[aria-pressed="true"] { background: var(--live-pill); color: var(--live-pill-ink); }
[data-theme="gold"] .live-history .history-range[aria-pressed="true"] { background: var(--primary); color: #211709; }

.live-history .history-axis { padding-inline-end: 17.2%; }

[hidden] { display: none !important; }
.portfolio-login { width: min(100% - 2rem, 420px); margin: clamp(2rem, 12vh, 7rem) auto; }
.portfolio-login form { display: grid; gap: .7rem; }
.portfolio-login h1 { margin: 0 0 1rem; }
.portfolio-login [role='status']:empty { display: none; }
