/* Claude-inspired theme: ivory paper, clay accent, serif display, quiet chrome. */
:root {
  color-scheme: light;
  --bg: #FAF9F5;
  --bg-2: #F0EEE6;
  --surface: #FFFFFF;
  --surface-2: #F7F6F1;
  --text: #141413;
  --text-2: #5E5D59;
  --muted: #87867F;
  --hair: #E8E6DC;
  --border: rgba(31, 30, 29, 0.12);
  --border-strong: rgba(31, 30, 29, 0.22);
  --accent: #C96442;
  --accent-hover: #B5583A;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(201, 100, 66, 0.10);
  --gain: #2E7D46;
  --loss: #B42318;
  --warn-bg: #FBF3E4;
  --warn-ink: #7A4E0B;
  --shadow: 0 1px 2px rgba(20, 20, 19, 0.04), 0 4px 16px rgba(20, 20, 19, 0.04);
  /* charts — validated categorical set (CVD-safe adjacent order), surface #FFFFFF */
  --grid: #EFEDE6;
  --axis: #D4D1C5;
  --s1: #C45E39;
  --s2: #2063B0;
  --s3: #CB9317;
  --s4: #795DBA;
  --s5: #54A859;
  --s-other: #B4B2A9;
  --line-muted: #A3A198;
  --serif: "Source Serif 4", "Tiempos Text", Georgia, "Times New Roman", serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-lg: 16px;
  --r-md: 10px;
  --r-sm: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #262624;
    --bg-2: #1F1E1D;
    --surface: #30302E;
    --surface-2: #2B2B29;
    --text: #FAF9F5;
    --text-2: #C2C0B6;
    --muted: #9C9A92;
    --hair: #3D3D3A;
    --border: rgba(222, 220, 209, 0.13);
    --border-strong: rgba(222, 220, 209, 0.24);
    --accent: #D97757;
    --accent-hover: #E38B6D;
    --accent-ink: #1F1E1D;
    --accent-soft: rgba(217, 119, 87, 0.14);
    --gain: #6CC08A;
    --loss: #F08573;
    --warn-bg: #3A3226;
    --warn-ink: #E9C98A;
    --shadow: none;
    --grid: #3A3A37;
    --axis: #4C4B47;
    --s1: #CD6E4C;
    --s2: #3772BB;
    --s3: #BB881A;
    --s4: #6F57AB;
    --s5: #47944C;
    --s-other: #6E6D68;
    --line-muted: #85837B;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #262624;
  --bg-2: #1F1E1D;
  --surface: #30302E;
  --surface-2: #2B2B29;
  --text: #FAF9F5;
  --text-2: #C2C0B6;
  --muted: #9C9A92;
  --hair: #3D3D3A;
  --border: rgba(222, 220, 209, 0.13);
  --border-strong: rgba(222, 220, 209, 0.24);
  --accent: #D97757;
  --accent-hover: #E38B6D;
  --accent-ink: #1F1E1D;
  --accent-soft: rgba(217, 119, 87, 0.14);
  --gain: #6CC08A;
  --loss: #F08573;
  --warn-bg: #3A3226;
  --warn-ink: #E9C98A;
  --shadow: none;
  --grid: #3A3A37;
  --axis: #4C4B47;
  --s1: #CD6E4C;
  --s2: #3772BB;
  --s3: #BB881A;
  --s4: #6F57AB;
  --s5: #47944C;
  --s-other: #6E6D68;
  --line-muted: #85837B;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.gain { color: var(--gain); }
.loss { color: var(--loss); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.top-inner {
  max-width: 1200px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand svg { width: 26px; height: 26px; color: var(--accent); }
.brand span { font-family: var(--serif); font-size: 21px; letter-spacing: -0.02em; }
.top .spacer { flex: 1; }
.live { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--gain); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gain) 20%, transparent); }
.live.stale i { background: var(--muted); box-shadow: none; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap;
  font-weight: 500; font-size: 13.5px; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--bg-2); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-2); color: var(--text); }
.btn.icon { width: 34px; padding: 0; justify-content: center; }
.btn.danger { color: var(--loss); }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- layout ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 32px 24px 80px; }
.greet { margin: 8px 0 28px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.greet h1 { font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
.greet h1 .spark { display: inline-block; width: 30px; height: 30px; color: var(--accent); vertical-align: -2px; margin-right: 10px; }
.greet p { margin: 8px 0 0; color: var(--text-2); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 22px 24px;
}
.card + .card, .grid2 + .card, .card + .grid2, .filters + .card { margin-top: 20px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.card-head h2 { font-family: var(--serif); font-weight: 400; font-size: 21px; margin: 0; letter-spacing: -0.01em; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grid2 > .card { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; margin-top: 20px; }

/* ---------- hero + tiles ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr); gap: 0; padding: 0; overflow: hidden; }
.hero-main { padding: 26px 28px; border-right: 1px solid var(--border); background: linear-gradient(160deg, var(--accent-soft), transparent 70%); }
.label { font-size: 12.5px; color: var(--muted); font-weight: 500; letter-spacing: .01em; }
.hero-value { font-size: 46px; line-height: 1.1; font-weight: 500; letter-spacing: -0.03em; margin: 8px 0 10px; }
.hero-value + .hero-kwd { margin: -4px 0 12px; }
.hero-kwd { color: var(--accent); font-size: 17px; font-weight: 500; letter-spacing: -0.01em; }
.hero-value .cents { color: var(--muted); font-size: 0.55em; letter-spacing: -0.01em; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; font-size: 13.5px; }
.delta svg { width: 12px; height: 12px; }
.hero-sub { margin-top: 18px; color: var(--text-2); font-size: 13px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.tile:nth-child(odd) { border-right: 1px solid var(--border); }
.tile:nth-last-child(-n+2) { border-bottom: 0; }
.tile .v { font-size: 24px; font-weight: 500; letter-spacing: -0.02em; margin-top: 4px; }
.tile .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- filters ---------- */
.filters { display: flex; align-items: center; gap: 14px; margin: 28px 0 0; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--bg-2); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 5px 13px; border-radius: 6px; cursor: pointer;
  color: var(--text-2); font-weight: 500; font-size: 13px;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.filters .hint { color: var(--muted); font-size: 12.5px; }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text, .chart text.tick { fill: var(--muted); font-size: 11.5px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .endlabel { fill: var(--text); font-size: 12px; font-weight: 600; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.chart .endlabel.sub { fill: var(--text-2); font-weight: 500; }
.chart .xhair { stroke: var(--border-strong); stroke-width: 1; }
.chart .bar { transition: opacity .12s; }
.chart .bar.dim { opacity: .45; }
.chart.loading { opacity: .5; transition: opacity .2s; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.key-line { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }
.key-rect { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.tooltip {
  position: fixed; z-index: 50; pointer-events: none; min-width: 150px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  box-shadow: 0 6px 24px rgba(0,0,0,.12); padding: 9px 11px; font-size: 12.5px;
  opacity: 0; transform: translateY(4px); transition: opacity .1s, transform .1s;
}
.tooltip.on { opacity: 1; transform: none; }
.tooltip .tt-title { color: var(--muted); font-size: 11.5px; margin-bottom: 5px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tooltip .tt-row + .tt-row { margin-top: 3px; }
.tooltip .tt-row b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.tooltip .tt-row span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }

/* allocation */
.strip { display: flex; gap: 2px; height: 14px; margin: 4px 0 20px; }
.strip div { height: 100%; min-width: 3px; cursor: default; transition: opacity .12s; }
.strip div:first-child { border-radius: 4px 0 0 4px; }
.strip div:last-child { border-radius: 0 4px 4px 0; }
.strip div:only-child { border-radius: 4px; }
.strip.hovering div:not(.hot) { opacity: .4; }
.alloc-list { list-style: none; margin: 0; padding: 0; }
.alloc-list li { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--hair); font-size: 13.5px; }
.alloc-list li:first-child { border-top: 0; }
.alloc-list .pct { color: var(--text-2); width: 56px; text-align: right; }
.alloc-list .val { font-weight: 500; min-width: 92px; text-align: right; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 0 12px 10px; white-space: nowrap; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--hair); white-space: nowrap; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
th.r, td.r { text-align: right; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th .arrow { opacity: .7; margin-left: 3px; }
tbody tr:hover td { background: var(--surface-2); }
.asset { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.asset .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.asset small { font-weight: 400; color: var(--muted); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; }
.pill.buy { background: color-mix(in srgb, var(--gain) 13%, transparent); color: var(--gain); }
.pill.sell { background: color-mix(in srgb, var(--loss) 12%, transparent); color: var(--loss); }
.pill.fiat { background: var(--accent-soft); color: var(--accent); }
.pill.xfer { background: var(--bg-2); color: var(--text-2); }
.bar-cell { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.bar-cell i { display: block; height: 6px; border-radius: 3px; background: var(--accent); opacity: .85; }
.bar-cell .track { width: 64px; height: 6px; border-radius: 3px; background: var(--bg-2); overflow: hidden; }
.row-actions { opacity: 0; transition: opacity .12s; }
tr:hover .row-actions, .row-actions:focus-within { opacity: 1; }
.empty { padding: 40px 0; text-align: center; color: var(--muted); }

.tx-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.input, select.input {
  height: 34px; padding: 0 11px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); min-width: 0;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; color: var(--muted); font-size: 13px; }

/* ---------- notices ---------- */
.notice { display: flex; gap: 14px; background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--r-md); padding: 14px 16px; font-size: 13.5px; align-items: flex-start; }
.notice + .notice { margin-top: 10px; }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice b { font-weight: 600; }
.notice .btn { height: 30px; margin-top: 8px; }
.notice.info { background: var(--bg-2); color: var(--text-2); }

/* ---------- dialogs ---------- */
dialog {
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: 0; width: min(460px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(20, 20, 19, .35); backdrop-filter: blur(2px); }
dialog form { padding: 24px; }
dialog h3 { font-family: var(--serif); font-weight: 400; font-size: 22px; margin: 0 0 4px; }
dialog .sub { color: var(--muted); margin: 0 0 18px; font-size: 13px; }
.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field .input { width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.form-error { color: var(--loss); font-size: 13px; min-height: 18px; }
.drop {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); padding: 28px; text-align: center;
  color: var(--text-2); cursor: pointer; transition: background .15s, border-color .15s;
}
.drop:hover, .drop.over { background: var(--accent-soft); border-color: var(--accent); }
.drop strong { color: var(--text); display: block; margin-bottom: 4px; font-weight: 500; }
.result { margin-top: 14px; font-size: 13.5px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--r-sm); font-size: 13.5px;
  transition: opacity .2s, transform .2s; z-index: 60; pointer-events: none;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

footer { max-width: 1200px; margin: 0 auto; padding: 0 24px 40px; color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-main { border-right: 0; border-bottom: 1px solid var(--border); }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .top-inner { padding: 10px 12px; gap: 4px; }
  .top .btn { padding: 0 10px; }
  .top .btn.icon { width: 30px; padding: 0; }
  .card.hero { padding: 0; }
  .live, .top .label-text { display: none; }
  main { padding: 20px 16px 60px; }
  .greet h1 { font-size: 30px; }
  .hero-value { font-size: 38px; }
  .card { padding: 18px 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile { padding: 16px; }
  .tile .v { font-size: 19px; }
  .row2 { grid-template-columns: 1fr; }
}

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; margin-left: 18px; background: var(--bg-2); padding: 3px; border-radius: var(--r-sm); }
.tabs a {
  text-decoration: none; color: var(--text-2); font-weight: 500; font-size: 13.5px;
  padding: 5px 14px; border-radius: 6px; transition: background .15s, color .15s;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
body[data-tab="portfolio"] .only-watchlist, body[data-tab="watchlist"] .only-portfolio,
body:not([data-tab="money"]) .only-money, body[data-tab="money"] :is(.only-portfolio, .only-watchlist) { display: none !important; }

/* ---------- watchlist ---------- */
.wgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; }
.wcard {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 2px;
  transition: border-color .15s, transform .15s;
}
.wcard:hover { border-color: var(--border-strong); }
.wcard.err { opacity: .8; }
.whead { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-width: 0; }
.wlogo {
  width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center;
  font-weight: 600; font-size: 12.5px; letter-spacing: -.02em; background: var(--bg-2); color: var(--text-2);
}
.wlogo.crypto { background: var(--accent-soft); color: var(--accent); }
.wlogo.metal { background: color-mix(in srgb, var(--s3) 16%, transparent); color: var(--s3); }
.wname { min-width: 0; flex: 1; display: grid; }
.wname b { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.wname span { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill.kind { background: var(--bg-2); color: var(--text-2); font-weight: 500; }
.wx {
  position: absolute; top: 10px; right: 10px; opacity: 0; width: 28px; height: 28px;
  background: var(--surface); transition: opacity .12s;
}
.wcard:hover .wx, .wx:focus-visible { opacity: 1; }
.wcard:hover .pill.kind { visibility: hidden; }
.wprice { font-size: 28px; font-weight: 500; letter-spacing: -.03em; line-height: 1.15; }
.wdelta { font-size: 13px; display: flex; flex-wrap: wrap; column-gap: 8px; row-gap: 1px; align-items: center; }
.wdelta .delta { white-space: nowrap; }
.wspark { position: relative; height: 72px; margin: 14px 0 10px; }
.wspark svg { width: 100%; height: 100%; display: block; overflow: visible; }
.wspark .wdot {
  position: absolute; width: 9px; height: 9px; border-radius: 50%; transform: translate(-50%, -50%);
  border: 2px solid var(--surface); pointer-events: none; display: none;
}
.wspark .wline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border-strong); pointer-events: none; display: none; }
.wfoot { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--hair); padding-top: 10px; }
.wfoot b { font-weight: 500; color: var(--text-2); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.whold { margin-top: 10px; font-size: 12.5px; color: var(--accent); background: var(--accent-soft); padding: 6px 10px; border-radius: 8px; }
.wempty {
  grid-column: 1 / -1; border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
  padding: 48px 24px; text-align: center; color: var(--text-2);
}
.wempty h3 { font-family: var(--serif); font-weight: 400; font-size: 22px; margin: 0 0 6px; color: var(--text); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.chip {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 5px 12px;
  cursor: pointer; font-size: 13px; font-weight: 500;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.wresults { display: grid; gap: 2px; max-height: 320px; overflow-y: auto; margin: 4px -8px 0; }
.wresult {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; text-align: left;
  border: 0; background: transparent; padding: 9px 8px; border-radius: 8px; cursor: pointer;
}
.wresult:hover, .wresult:focus-visible { background: var(--bg-2); }
.wresult .wlogo { width: 30px; height: 30px; font-size: 11px; border-radius: 8px; }
.wresult small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wresult b { font-weight: 600; }
.wmsg { color: var(--muted); font-size: 13px; padding: 10px 0; }

@media (max-width: 600px) {
  /* three tabs plus the actions don't fit one row on a phone: tabs get their own row */
  .top-inner { flex-wrap: wrap; row-gap: 8px; }
  .tabs { order: 10; flex: 1 0 100%; margin-left: 0; }
  .tabs a { flex: 1; text-align: center; padding: 6px 8px; }
  .brand span { display: none; }
  .wgrid { grid-template-columns: 1fr; }
  .wx { opacity: 1; }
  .wcard .pill.kind { visibility: hidden; }
}

/* ---------- portfolio layout switch ---------- */
.vseg button { padding: 5px 9px; display: grid; place-items: center; }
.vseg svg { width: 16px; height: 16px; display: block; }
.p-value { margin-top: 14px; }
.notice-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.notice-chip:hover { color: var(--warn-ink); border-color: var(--warn-ink); }
.notice-chip svg { width: 14px; height: 14px; }

/* Overview: compact cards, edge-to-edge. Desktop only; phones always get the detailed layout. */
@media (max-width: 999px) { #pview { display: none !important; } }
@media (min-width: 1000px) {
  body[data-pview="overview"] .top-inner { max-width: none; padding-left: 14px; padding-right: 14px; }
  body[data-pview="overview"] main { max-width: none; padding: 12px 14px 16px; }
  body[data-pview="overview"] #view-portfolio .p-greet,
  body[data-pview="overview"] #view-portfolio #notices,
  body[data-pview="overview"] #view-portfolio .card-head p,
  body[data-pview="overview"] #view-portfolio .hero-sub,
  body[data-pview="overview"] #view-portfolio .filters .hint,
  body[data-pview="overview"] #view-portfolio .p-tx .card-tools,
  body[data-pview="overview"] #view-portfolio .p-tx .pager,
  body[data-pview="overview"] #view-portfolio .p-hold .card-tools,
  body[data-pview="overview"] footer.only-portfolio { display: none; }
  body[data-pview="overview"] #view-portfolio .card { padding: 14px 16px; }
  body[data-pview="overview"] #view-portfolio .card-head { margin-bottom: 8px; align-items: center; }
  body[data-pview="overview"] #view-portfolio .card-head h2 { font-size: 17px; }
  body[data-pview="overview"] #view-portfolio .filters { margin: 0; }
  body[data-pview="overview"] #view-portfolio .p-value { margin-top: 12px; }
  body[data-pview="overview"] #view-portfolio .hero { padding: 0; grid-template-columns: minmax(0, 1.25fr) minmax(0, 4fr); margin-top: 12px; }
  body[data-pview="overview"] #view-portfolio .hero-main { padding: 14px 20px; }
  body[data-pview="overview"] #view-portfolio .hero-value { font-size: 34px; margin: 2px 0 2px; }
  body[data-pview="overview"] #view-portfolio .hero-value + .hero-kwd { margin: 0 0 4px; font-size: 15px; }
  body[data-pview="overview"] #view-portfolio .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body[data-pview="overview"] #view-portfolio .tile { padding: 14px 18px; border-bottom: 0; border-right: 1px solid var(--border); }
  body[data-pview="overview"] #view-portfolio .tile:last-child { border-right: 0; }
  body[data-pview="overview"] #view-portfolio .tile .v { font-size: 21px; }
  body[data-pview="overview"] #view-portfolio table { font-size: 12.5px; }
  body[data-pview="overview"] #view-portfolio td { padding: 7px 8px; }
  body[data-pview="overview"] #view-portfolio th { padding: 0 8px 7px; }
  body[data-pview="overview"] #view-portfolio .alloc-list li { padding: 6px 0; font-size: 13px; }
  body[data-pview="overview"] #view-portfolio .strip { margin: 2px 0 10px; }
  /* fewer columns: holdings keep asset/price/24h/value/unrealized; transactions keep date/type/asset/total */
  body[data-pview="overview"] #holdings tr > :is(:nth-child(2), :nth-child(3), :nth-child(8), :nth-child(9)),
  body[data-pview="overview"] #tx tr > :is(:nth-child(4), :nth-child(5), :nth-child(7), :nth-child(8)) { display: none; }
}

/* On a big enough screen the overview fills exactly one window: no page scroll */
@media (min-width: 1000px) and (min-height: 620px) {
  body[data-pview="overview"][data-tab="portfolio"] { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
  body[data-pview="overview"][data-tab="portfolio"] main { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; }
  body[data-pview="overview"] #view-portfolio {
    flex: 1; min-height: 0; display: grid; gap: 12px;
    grid-template-columns: minmax(0, 5fr) minmax(0, 4fr) minmax(0, 3fr);
    grid-template-rows: auto auto minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "f f f" "h h h" "v v a" "hd ac tx";
  }
  @media (max-width: 1599px) {
    body[data-pview="overview"] #view-portfolio { grid-template-columns: minmax(0, 4.4fr) minmax(0, 3.4fr) minmax(0, 4.2fr); }
  }
  body[data-pview="overview"] #view-portfolio .grid2 { display: contents; }
  body[data-pview="overview"] #view-portfolio .card,
  body[data-pview="overview"] #view-portfolio .hero { margin: 0 !important; }
  body[data-pview="overview"] .p-filters { grid-area: f; }
  body[data-pview="overview"] .p-hero { grid-area: h; }
  body[data-pview="overview"] .p-value { grid-area: v; }
  body[data-pview="overview"] .p-alloc { grid-area: a; }
  body[data-pview="overview"] .p-activity { grid-area: ac; }
  body[data-pview="overview"] .p-hold { grid-area: hd; }
  body[data-pview="overview"] .p-tx { grid-area: tx; }
  body[data-pview="overview"] :is(.p-value, .p-alloc, .p-activity, .p-hold, .p-tx) { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
  body[data-pview="overview"] :is(.p-value, .p-activity) .chart { flex: 1; min-height: 0; }
  /* svg sized from the cell, absolutely placed so it never feeds back into the grid's height */
  body[data-pview="overview"] :is(.p-value, .p-activity) .chart svg { position: absolute; inset: 0; }
  body[data-pview="overview"] :is(.p-value, .p-activity, .p-hold, .p-tx) .table-wrap { flex: 1; min-height: 0; overflow: auto; margin: 0; padding: 0; }
  body[data-pview="overview"] #alloc { flex: 1; min-height: 0; overflow: auto; }
  body[data-pview="overview"] #view-portfolio thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
}
@media (max-width: 380px) {
  .tabs { margin-left: 0; }
}

/* ---------- money tab ---------- */
#view-money .card + .card, #view-money .mgrid + .card, #view-money .card + .mgrid, #view-money .mgrid + .mgrid { margin-top: 20px; }
.mgrid { display: grid; gap: 20px; }
.mgrid > .card, .mstack > .card { margin-top: 0 !important; }
.mstack { display: grid; gap: 20px; align-content: start; }
.g-7-5 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.g-6-6 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.g-4-4-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles.t3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles.t3 .tile { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.tiles.t3 .tile:nth-child(3n) { border-right: 0; }
.tiles.t3 .tile:nth-last-child(-n+3) { border-bottom: 0; }
.m-hero .hero-value .cents { font-size: .45em; }
.m-headline { font-family: var(--serif); font-size: 18px; line-height: 1.5; margin: 0 0 18px; color: var(--text); max-width: 70em; }
.ins { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.ins li { display: grid; gap: 8px; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--hair); align-content: start; }
.ins li b { font-weight: 600; font-size: 14.5px; letter-spacing: -.01em; }
.ins li p { margin: 3px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.5; }
.ins-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.ins-tag svg { width: 14px; height: 14px; }
.ins-alert .ins-tag { color: var(--loss); }
.ins-alert { border-color: color-mix(in srgb, var(--loss) 35%, transparent) !important; }
.ins-warn .ins-tag { color: var(--warn-ink); }
.ins-tip .ins-tag { color: var(--accent); }
.ins-good .ins-tag { color: var(--gain); }
.fc-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: -4px 0 14px; }
.fc-stats b { display: block; font-size: 19px; font-weight: 500; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.key-line.dashed { height: 0; background: none !important; border-top: 2px dashed; }
.chart .endlabel.pos { fill: var(--gain); }
.chart .endlabel.neg { fill: var(--loss); }
.chart .bar.partial { opacity: .5; }
.foot-note { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }
.mlist { list-style: none; margin: 0; padding: 0; }
.mlist li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--hair); font-size: 13.5px; }
.mlist li:first-child { border-top: 0; padding-top: 0; }
.mlist li.off { opacity: .55; }
.mlist li.click { cursor: pointer; }
.mlist li.click:hover b { color: var(--accent); }
.mlist .when { color: var(--muted); font-size: 12.5px; min-width: 46px; font-variant-numeric: tabular-nums; }
.mlist .what { display: grid; min-width: 0; }
.mlist .what b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mlist .what small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mlist .amt { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
#m-rec .mlist li, .m-rec .mlist li { grid-template-columns: minmax(0, 1fr) auto; }
.catlist { list-style: none; margin: 0; padding: 0; }
.catlist li { display: grid; grid-template-columns: minmax(120px, 1.3fr) minmax(60px, 2fr) 52px 40px 64px; gap: 10px; align-items: center; padding: 7px 6px; margin: 0 -6px; border-radius: 6px; font-size: 13.5px; cursor: pointer; }
.catlist li:hover, .catlist li:focus-visible { background: var(--surface-2); }
.cname { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cname .dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.cbar { height: 8px; border-radius: 4px; background: var(--bg-2); overflow: hidden; }
.cbar i { display: block; height: 100%; border-radius: 4px; }
.cval { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.cshare { text-align: right; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.minibars { display: inline-flex; align-items: flex-end; gap: 2px; height: 18px; width: 64px; justify-content: flex-end; vertical-align: middle; }
.minibars i { display: block; flex: 1; max-width: 9px; border-radius: 2px 2px 0 0; opacity: .8; }
.blegend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin: -6px 0 12px; }
.blegend span { display: inline-flex; align-items: center; gap: 6px; }
.blegend i { display: inline-block; width: 14px; height: 8px; border-radius: 3px; }
.blegend .k-fill { background: var(--s2); }
.blegend .k-cap { background: var(--bg-2); border: 1px solid var(--border-strong); }
.blegend .k-pace { width: 2px; height: 12px; background: var(--text); border-radius: 1px; }
.blist { list-style: none; margin: 0; padding: 0; }
.blist li { display: grid; grid-template-columns: minmax(110px, 1.2fr) minmax(80px, 2fr) 84px 68px; gap: 10px; align-items: center; padding: 7px 0; font-size: 13.5px; border-top: 1px solid var(--hair); }
.blist li:first-child { border-top: 0; }
.bprog { position: relative; height: 10px; }
.bprog .cap { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bg-2); border-radius: 5px; box-shadow: inset 0 0 0 1px var(--border); }
.bprog .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--s2); border-radius: 5px; min-width: 2px; }
.bprog .fill.risk { background: var(--warn-ink); }
.bprog .fill.over { background: var(--loss); }
.bprog .pace { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 1px; }
.bnum { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2); }
.bnum b { color: var(--text); font-weight: 500; }
.bstat { font-size: 11.5px; font-weight: 600; text-align: center; padding: 2px 6px; border-radius: 999px; white-space: nowrap; }
.bstat.ok { color: var(--gain); background: color-mix(in srgb, var(--gain) 12%, transparent); }
.bstat.risk { color: var(--warn-ink); background: var(--warn-bg); }
.bstat.over { color: var(--loss); background: color-mix(in srgb, var(--loss) 12%, transparent); }
.bstat.none { color: var(--muted); }
.budget-form { display: grid; gap: 8px; max-height: 52vh; overflow: auto; padding-right: 4px; }
.bf-row { display: grid; grid-template-columns: 1fr 120px; gap: 12px; align-items: center; font-size: 13.5px; }
.bf-row small { display: block; color: var(--muted); font-size: 12px; }
#dlg-budgets { width: min(520px, calc(100vw - 32px)); }
table.mer td, table.mtx td { padding-top: 9px; padding-bottom: 9px; }
tr.click { cursor: pointer; }
.mname { display: grid; }
.mname b { font-weight: 500; }
.mname small, .mdesc small { color: var(--muted); font-size: 12px; }
.mbar { display: block; height: 3px; background: var(--bg-2); border-radius: 2px; margin-top: 5px; max-width: 220px; overflow: hidden; }
.mbar i { display: block; height: 100%; background: var(--s1); border-radius: 2px; }
.mdesc { display: grid; max-width: 360px; }
.mdesc b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.mdesc small { overflow: hidden; text-overflow: ellipsis; }
.cat { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); background: var(--bg-2); border: 1px solid transparent; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.cat.edit { cursor: pointer; font: inherit; font-size: 12.5px; }
.cat.edit:hover { border-color: var(--border-strong); color: var(--text); }
.how { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 0 5px; border-radius: 4px; }
.how.ml { color: var(--accent-ink); background: var(--accent); }
.how.you { color: var(--text-2); background: var(--surface); }
.cat-select { height: 28px; font-size: 12.5px; padding: 0 8px; }
.pname { display: inline-flex; align-items: center; gap: 8px; white-space: normal; min-width: 150px; }
.pname svg { width: 15px; height: 15px; color: var(--muted); }
.big { font-size: 32px; font-weight: 500; letter-spacing: -.03em; margin: -4px 0 12px; }
.big small { font-size: 14px; color: var(--muted); letter-spacing: 0; font-weight: 400; }
.facts { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; font-size: 13.5px; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.save { display: flex; gap: 8px; align-items: center; margin-top: 14px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 500; }
.save svg { width: 16px; height: 16px; flex: none; }
.split { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.srow { display: flex; justify-content: space-between; gap: 10px; align-items: flex-end; margin-bottom: 6px; font-size: 13.5px; }
.srow small { display: block; color: var(--muted); font-size: 12px; }
.srow b { font-weight: 500; }
.sv { text-align: right; white-space: nowrap; }
.sv b { font-size: 16px; font-variant-numeric: tabular-nums; }
.strack { position: relative; display: block; height: 8px; border-radius: 4px; background: var(--bg-2); }
.strack i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; max-width: 100%; }
.strack em { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 1px; }
.trips { display: grid; gap: 16px; }
.trow { display: flex; justify-content: space-between; font-size: 15px; }
.trow b { font-weight: 600; }
.small { font-size: 12.5px; }
.strip.thin { height: 8px; margin: 10px 0 8px; }
.legend.small { gap: 10px; font-size: 12px; }
@media (max-width: 1100px) { .g-4-4-4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .g-4-4-4 > :last-child { grid-column: 1 / -1; } }
@media (max-width: 900px) {
  .g-7-5, .g-6-6, .g-4-4-4 { grid-template-columns: minmax(0, 1fr); }
  .g-4-4-4 > :last-child { grid-column: auto; }
  .tiles.t3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles.t3 .tile { border-right: 1px solid var(--border) !important; border-bottom: 1px solid var(--border) !important; }
  .tiles.t3 .tile:nth-child(2n) { border-right: 0 !important; }
  .tiles.t3 .tile:nth-last-child(-n+2) { border-bottom: 0 !important; }
  .fc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .m-headline { font-size: 16px; }
  .ins { grid-template-columns: 1fr; }
  .catlist li { grid-template-columns: minmax(0, 1.4fr) minmax(40px, 1fr) 44px 36px; }
  .catlist .minibars { display: none; }
  .blist li { grid-template-columns: minmax(0, 1.2fr) minmax(50px, 1fr) 72px; }
  .blist .bstat { display: none; }
  .bf-row { grid-template-columns: 1fr 96px; }
}

/* =====================================================================
   Exchange theme: near-black trading-terminal look. Dark only.
   Monochrome chrome, white pill CTA, colour reserved for direction.
   ===================================================================== */
:root[data-skin="exchange"] {
  color-scheme: dark;
  --bg: #0E0F13;
  --bg-2: #1B1C22;
  --surface: #15161B;
  --surface-2: #1A1B21;
  --text: #F2F3F5;
  --text-2: #A1A3AB;
  --muted: #6E717B;
  --hair: #22232A;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --accent: #F2F3F5;
  --accent-hover: #FFFFFF;
  --accent-ink: #0E0F13;
  --accent-soft: rgba(255, 255, 255, 0.06);
  --hl: #F5B544;
  --gain: #3DD68C;
  --loss: #F26D6D;
  --warn-bg: #241F14;
  --warn-ink: #F2C46D;
  --shadow: none;
  --grid: #1F2026;
  --axis: #2C2D35;
  /* validated vs #15161B (dark, adjacent CVD ΔE 20.8); no red/green: those mean down/up here */
  --s1: #408DEA;
  --s2: #B55000;
  --s3: #C76AC0;
  --s4: #925D00;
  --s5: #8968D4;
  --s-other: #4A4C55;
  --line-muted: #5F626C;
  --serif: var(--sans);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 9px;
}
:root { --series-value: var(--s1); --hl: var(--accent); }

[data-skin="exchange"] body { font-variant-numeric: tabular-nums; }
[data-skin="exchange"] .top { background: color-mix(in srgb, var(--bg) 92%, transparent); border-bottom-color: var(--border); }
[data-skin="exchange"] .brand svg { color: var(--text); }
[data-skin="exchange"] .brand span { font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }
[data-skin="exchange"] :is(.greet h1, .card-head h2, dialog h3, .wempty h3) { font-weight: 600; letter-spacing: -0.015em; }
[data-skin="exchange"] .greet h1 { font-size: 30px; }
[data-skin="exchange"] .greet h1 .spark { display: none; }
[data-skin="exchange"] .card-head h2 { font-size: 16px; }

/* controls: dark rounded buttons, white pill primary, pill-in-track segments */
[data-skin="exchange"] .btn { background: var(--bg-2); border-color: transparent; border-radius: 10px; }
[data-skin="exchange"] .btn:hover { background: #24252C; }
[data-skin="exchange"] .btn.ghost { background: transparent; }
[data-skin="exchange"] .btn.ghost:hover { background: var(--bg-2); }
[data-skin="exchange"] .btn.primary { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-weight: 600; }
[data-skin="exchange"] .btn.primary:hover { background: #FFFFFF; }
[data-skin="exchange"] :is(.seg, .tabs) { background: transparent; padding: 0; gap: 4px; }
[data-skin="exchange"] :is(.seg button, .tabs a) { border-radius: 8px; color: var(--text-2); }
[data-skin="exchange"] :is(.seg button[aria-pressed="true"], .tabs a[aria-current="page"]) { background: var(--bg-2); color: var(--text); box-shadow: none; }
[data-skin="exchange"] .input { background: var(--bg-2); border-color: transparent; }
[data-skin="exchange"] .input:focus { border-color: var(--border-strong); box-shadow: none; }
[data-skin="exchange"] .chip { background: var(--bg-2); border-color: transparent; }
[data-skin="exchange"] .chip:hover { color: var(--text); border-color: var(--border-strong); }

/* panels */
[data-skin="exchange"] .card, [data-skin="exchange"] .wcard { background: var(--surface); border-color: var(--border); box-shadow: none; }
[data-skin="exchange"] .hero-main { background: none; }
[data-skin="exchange"] .hero-value { font-weight: 600; letter-spacing: -0.02em; }
[data-skin="exchange"] .hero-value .cents { color: var(--text-2); }
[data-skin="exchange"] .hero-kwd { color: var(--hl); }
[data-skin="exchange"] .label, [data-skin="exchange"] th { color: var(--muted); font-weight: 500; }
[data-skin="exchange"] .tile .v, [data-skin="exchange"] .wprice { font-weight: 600; }
[data-skin="exchange"] tbody tr:hover td { background: #1A1B21; }
[data-skin="exchange"] .pill.buy { background: rgba(61, 214, 140, 0.12); }
[data-skin="exchange"] .pill.sell { background: rgba(242, 109, 109, 0.12); }
[data-skin="exchange"] .pill.fiat { background: rgba(245, 181, 68, 0.12); color: var(--hl); }
[data-skin="exchange"] .whold { color: var(--hl); background: rgba(245, 181, 68, 0.08); }
[data-skin="exchange"] .wlogo.crypto { background: rgba(245, 181, 68, 0.12); color: var(--hl); }
[data-skin="exchange"] .wlogo { border-radius: 999px; }
[data-skin="exchange"] .live i { box-shadow: none; }
[data-skin="exchange"] dialog { background: var(--surface); border-color: var(--border-strong); }
[data-skin="exchange"] dialog::backdrop { background: rgba(0, 0, 0, .6); }
[data-skin="exchange"] .tooltip { background: #1E1F26; border-color: var(--border-strong); box-shadow: 0 8px 28px rgba(0, 0, 0, .5); }
[data-skin="exchange"] .toast { background: var(--accent); color: var(--accent-ink); }

/* charts: Claude themes use a flat 10% wash; Exchange keeps the svg's gradient fill attribute */
:root:not([data-skin="exchange"]) .chart .area { fill: var(--series-value); opacity: .10; }
:root:not([data-skin="exchange"]) .wspark .area { fill: var(--c); opacity: .10; }
/* the value line takes the colour of the P&L (green above cost, red below), like a price chart */
[data-skin="exchange"] .p-value { --series-value: var(--trend, var(--s1)); }

/* ---------- ticker tape (Exchange theme) ---------- */
.ticker { display: none; }
[data-skin="exchange"] .ticker {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 8px 24px;
  border-bottom: 1px solid var(--border); background: var(--bg); max-width: 100%;
}
[data-skin="exchange"] .ticker::-webkit-scrollbar { display: none; }
[data-skin="exchange"][data-pview="overview"] .ticker { padding: 8px 14px; }
.tick-item {
  display: inline-flex; align-items: center; gap: 8px; flex: none; padding: 5px 11px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none;
  font: 500 12px/1 var(--mono, var(--sans)); white-space: nowrap;
}
.tick-item:hover { border-color: var(--border-strong); }
.tick-item b { font-weight: 600; font-family: var(--sans); letter-spacing: .01em; }
.tick-item .d { font-size: 11px; }
.tick-item i { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font: 600 8.5px/1 var(--sans); font-style: normal; background: var(--bg-2); color: var(--text-2); }
.tick-item i.crypto { background: rgba(245, 181, 68, 0.14); color: var(--hl); }
.tick-item i.metal { background: color-mix(in srgb, var(--s4) 25%, transparent); color: #E3B562; }

/* ---------- theme picker ---------- */
.theme-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 210px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: 0 12px 36px rgba(0,0,0,.18);
}
.menu button {
  width: 100%; display: grid; grid-template-columns: 34px 1fr 16px; gap: 10px; align-items: center; text-align: left;
  border: 0; background: transparent; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 13.5px;
}
.menu button:hover { background: var(--bg-2); }
.menu button small { display: block; color: var(--muted); font-size: 11.5px; }
.menu .sw { width: 34px; height: 24px; border-radius: 6px; border: 1px solid var(--border-strong); display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.menu .sw span:first-child { background: var(--a); }
.menu .sw span:last-child { background: var(--b); }
.menu .check { visibility: hidden; color: var(--text); }
.menu button[aria-checked="true"] .check { visibility: visible; }
@media (max-width: 600px) {
  [data-skin="exchange"] .ticker { padding: 8px 12px; }
}
.menu svg.check { width: 16px; height: 16px; }
[data-skin="exchange"] .m-headline { font-weight: 500; font-size: 16px; }
[data-skin="exchange"] .ins li { background: var(--bg-2); border-color: transparent; }
[data-skin="exchange"] .ins-tip .ins-tag, [data-skin="exchange"] .save { color: var(--hl); }
[data-skin="exchange"] .save { background: rgba(245, 181, 68, 0.08); }
[data-skin="exchange"] .how.ml { background: var(--hl); color: #0E0F13; }
[data-skin="exchange"] .big, [data-skin="exchange"] .fc-stats b { font-weight: 600; }
.m-anom .mlist .what small { white-space: normal; }
