:root {
  color-scheme: light;
  --bg: #f6f7f9; --panel: #fff; --text: #1d2330; --muted: #677085; --line: #e3e6ec; --other: #b4b9c4;
  --accent: #2f6fde; --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --warn: #b77900; --good: #1f8a4c; --good-bg: #e3f4ea; --bad: #c2362f; --bad-bg: #fbe6e4; --warn-bg: #fff4d6;
}
/* Dark colors follow the system setting unless the theme button picked one (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; --bg: #12151b; --panel: #1b1f27; --text: #e6e9ef; --muted: #98a1b3; --line: #2b313c; --other: #59606e;
    --accent: #6b9cff; --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --warn: #e0a526; --good: #5fd08f; --good-bg: #173527; --bad: #ff7b72; --bad-bg: #3a1d1c; --warn-bg: #3a3218; }
}
:root[data-theme="dark"] { color-scheme: dark; --bg: #12151b; --panel: #1b1f27; --text: #e6e9ef; --muted: #98a1b3; --line: #2b313c; --other: #59606e;
    --accent: #6b9cff; --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --warn: #e0a526; --good: #5fd08f; --good-bg: #173527; --bad: #ff7b72; --bad-bg: #3a1d1c; --warn-bg: #3a3218; }
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, Segoe UI, sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 16px; }
nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
nav a { padding: 6px 12px; border-radius: 6px; color: var(--muted); text-decoration: none; }
nav a.active { background: var(--bg); color: var(--text); font-weight: 600; }
main { max-width: 1040px; margin: 24px auto; padding: 0 16px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 24px 0 8px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.big { font-size: 28px; font-weight: 700; }
button, select, input { font: inherit; color: inherit; }
button { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 7px 14px; cursor: pointer; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.link { background: none; color: var(--accent); padding: 0; }
button:disabled { opacity: .5; cursor: default; }
select, input { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.group td { background: var(--bg); font-weight: 600; }
.pos { color: var(--good); }
.pill { display: inline-block; min-width: 84px; text-align: right; padding: 2px 10px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.zero { color: var(--muted); }
.banner { border-radius: 10px; padding: 14px 18px; margin-bottom: 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.banner.good { background: var(--good-bg); }
.banner.bad { background: var(--bad-bg); }
.banner.zero { background: var(--panel); border: 1px solid var(--line); }
td input.assign { width: 110px; text-align: right; }
td select { max-width: 200px; }
.uncat select { border-color: #d9a400; background: var(--warn-bg); }
.bar { height: 10px; border-radius: 5px; background: var(--accent); }
.bar.income { background: var(--good); }
.track { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.track .bar { height: 8px; border-radius: 4px; background: var(--good); }
.track .bar.over { background: var(--bad); }
.status-error { color: var(--bad); }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; display: flex; gap: 12px; align-items: center; max-width: calc(100% - 32px); }
#toast button { background: var(--bg); color: var(--text); }
.empty { text-align: center; padding: 40px; }
a { color: inherit; text-decoration: none; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 4px; }
.card.good .big { color: var(--good); }
.card.bad .big { color: var(--bad); }
.legend { color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 18px; height: 0; border-top: 3px solid var(--accent); }
.swatch.base { border-top: 2px dashed var(--muted); }
.chart-wrap { position: relative; }
#fc-chart { width: 100%; height: auto; display: block; font-size: 13px; }
#fc-chart .grid line { stroke: var(--line); }
#fc-chart .grid text { fill: var(--muted); }
#fc-chart .zero { stroke: var(--bad); stroke-dasharray: 3 3; }
#fc-chart .area { fill: var(--accent); opacity: .08; }
#fc-chart .main-line { fill: none; stroke: var(--accent); stroke-width: 3; }
#fc-chart .base-line { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 6 5; }
#fc-chart .marker line { stroke: var(--muted); stroke-width: 1; opacity: .7; }
#fc-chart .marker circle { fill: var(--panel); stroke: var(--accent); stroke-width: 2; }
#fc-chart .marker rect { fill: var(--bg); stroke: var(--line); }
#fc-chart .marker text { fill: var(--text); font-size: 12px; }
#fc-chart .marker.retire rect { fill: var(--good-bg); stroke: var(--good); }
#fc-chart .marker.out rect { fill: var(--bad-bg); stroke: var(--bad); }
#fc-chart #fc-guide { stroke: var(--muted); stroke-dasharray: 2 3; }
#fc-tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,.12); width: 180px; }
input[type=range] { padding: 0; accent-color: var(--accent); }
.fc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.fields.compact { margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.field input { width: 100%; }
.event { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.inline { color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.small { font-size: 12px; }
a:hover { color: var(--accent); text-decoration: underline; }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  header { gap: 8px; padding: 10px 16px; }
  nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  td input.assign { width: 84px; }
  th, td { padding: 8px 6px; }
  .pill { min-width: 0; padding: 2px 6px; }
  td select { max-width: 104px; }
  main { padding: 0 10px; }
  .fc-grid { grid-template-columns: 1fr; }
  #fc-chart { font-size: 18px; }
}
#toast[hidden], #fc-tip[hidden] { display: none; }

/* ---------- dashboard ---------- */
.dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dash .panel { margin: 0; }
.tile-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.neg { color: var(--bad); }
.ink { color: var(--text); }
.good-text { color: var(--good); } .warn-text { color: var(--warn); } .bad-text { color: var(--bad); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { background: transparent; color: var(--muted); border-radius: 0; padding: 5px 10px; }
.seg button.on { background: var(--bg); color: var(--text); font-weight: 600; }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; }
.chart .axis line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11.5px; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.dashed { stroke-dasharray: 5 4; opacity: .8; }
.chart .line.s1, .chart .dot.s1, .chart .end.s1 { stroke: var(--s1); }
.chart .line.s2, .chart .dot.s2, .chart .end.s2 { stroke: var(--s2); }
.chart .area { opacity: .14; }
.chart .area.s1 { fill: var(--s1); } .chart .area.s2 { fill: var(--s2); }
.chart .end, .chart .dot { fill: var(--panel); stroke-width: 2; }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; line-height: 1.5; box-shadow: 0 4px 14px rgba(0,0,0,.14); white-space: nowrap; z-index: 1; }
.chart-tip[hidden] { display: none; }
.dot-key { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot-key.s1, .box.s1, .bar.s1, .fill.s1 { background: var(--s1); }
.dot-key.s2, .box.s2, .bar.s2, .fill.s2 { background: var(--s2); }
.swatch.s1 { border-top-color: var(--s1); } .swatch.s2 { border-top-color: var(--s2); }
.swatch.dashed { border-top-style: dashed; border-top-width: 2px; }
.box { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.bgroup { padding: 10px 0; border-top: 1px solid var(--line); }
.bgroup:first-of-type { border-top: 0; padding-top: 0; }
.meter { position: relative; height: 10px; background: var(--bg); border-radius: 5px; margin: 8px 0 6px; }
.meter .fill { height: 100%; border-radius: 5px; }
.meter .fill.good { background: var(--good); } .meter .fill.warn { background: var(--warn); } .meter .fill.bad { background: var(--bad); }
.meter .pace { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); border-radius: 1px; box-shadow: 0 0 0 2px var(--panel); }
.hbars { display: flex; flex-direction: column; gap: 2px; }
.hbar { display: grid; grid-template-columns: 140px 1fr 84px 36px; gap: 10px; align-items: center; padding: 5px 4px; border-radius: 6px; text-decoration: none !important; color: inherit !important; }
.hbar:hover { background: var(--bg); }
.hbar .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .track { height: 10px; background: transparent; }
.hbar .fill { display: block; height: 10px; border-radius: 0 4px 4px 0; min-width: 2px; }
.cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; align-items: end; }
.col { text-align: center; }
.col .pair { display: flex; gap: 2px; justify-content: center; align-items: flex-end; height: 140px; border-bottom: 1px solid var(--line); }
.col .bar { width: 38%; max-width: 22px; border-radius: 4px 4px 0 0; min-height: 2px; }
.agroup { padding: 8px 0; border-top: 1px solid var(--line); }
.agroup:first-of-type { border-top: 0; padding-top: 0; }
.arow { display: grid; grid-template-columns: 1fr 96px 120px; gap: 12px; align-items: center; padding: 6px 4px; border-radius: 6px; text-decoration: none !important; color: inherit !important; }
.arow:hover { background: var(--bg); }
.spark { display: block; }
.spark polyline { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; }
table.compact td { padding: 7px 4px; }
@media (max-width: 860px) { .dash { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .hbar { grid-template-columns: 96px 1fr 76px; } .hbar .num.small { display: none; }
  .arow { grid-template-columns: 1fr 112px; } .arow .spark { display: none; }
  .col .bar { width: 42%; }
}

/* ---------- home buying ---------- */
.card .meter { margin: 10px 0 6px; }
.stack { display: flex; gap: 2px; height: 14px; margin: 12px 0 8px; }
.stack span { border-radius: 3px; min-width: 3px; }
.seg-s1 { background: var(--s1); } .seg-s2 { background: var(--s2); } .seg-s3 { background: var(--s3); } .seg-s4 { background: var(--s4); } .seg-s5 { background: var(--s5); }
.stack-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 8px; }
.phase { font-weight: 600; margin: 14px 0 4px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.step { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: start; padding: 8px 6px; border-radius: 8px; cursor: pointer; }
.step:hover { background: var(--bg); }
.step input { margin-top: 3px; }
.step .detail { display: block; margin-top: 2px; }
.step.done .title { text-decoration: line-through; color: var(--muted); }
.step.next { background: var(--bg); box-shadow: inset 3px 0 0 var(--accent); }
.acct-picks { display: flex; flex-direction: column; gap: 6px; }
.pick { display: flex; gap: 8px; align-items: center; }
.home-tile { grid-column: 1 / -1; }
.home-facts { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 12px; }
.home-facts .grow { flex: 1; min-width: 200px; }

/* ---------- goals, bills, debt, investments, settings ---------- */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.goal-grid .panel { margin: 0; }
.meter .fill.s1 { background: var(--s1); }
.chart .line.s3, .chart .dot.s3, .chart .end.s3 { stroke: var(--s3); }
.chart .area.s3 { fill: var(--s3); }
.dot-key.s3, .box.s3 { background: var(--s3); } .dot-key.s4, .box.s4 { background: var(--s4); } .dot-key.s5, .box.s5 { background: var(--s5); }
.swatch.s3 { border-top-color: var(--s3); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .dow { font-size: 11px; color: var(--muted); text-transform: uppercase; text-align: center; padding-bottom: 2px; }
.cal .day { min-height: 76px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 5px; font-size: 12px; overflow: hidden; }
.cal .day.out { border-color: transparent; }
.cal .day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal .day.past .chip { opacity: .55; }
.cal .num { color: var(--muted); font-size: 11px; }
.chip { display: block; margin-top: 3px; padding: 1px 5px; border-radius: 4px; background: var(--bg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--s1); }
.chip.up { border-left-color: var(--warn); }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.good { background: var(--good-bg); color: var(--good); }
.tag.xfer { background: var(--bg); color: var(--s1); }
.alloc { display: flex; height: 16px; gap: 2px; margin: 10px 0 8px; }
.alloc span { border-radius: 3px; min-width: 3px; }
.qr svg { width: 200px; height: 200px; background: #fff; border-radius: 8px; }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.split-row { display: grid; grid-template-columns: minmax(0, 1.4fr) 100px minmax(0, 1fr) 24px; gap: 8px; margin-bottom: 6px; }
.split-row > * { width: 100%; min-width: 0; }
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); padding: 18px; width: min(560px, calc(100% - 24px)); }
dialog::backdrop { background: rgba(0,0,0,.35); }
nav a { padding: 6px 10px; }
@media (max-width: 640px) {
  .cal .day { min-height: 54px; padding: 3px; }
  .cal .chip { font-size: 0; padding: 0; height: 6px; margin-top: 2px; }
  .split-row { grid-template-columns: minmax(0, 1fr) 90px 24px; } .split-row .note { display: none; }
  .goal-grid { grid-template-columns: 1fr; }
}
.alert-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.alert-opts input[type=number], .alert-opts select { padding: 3px 6px; }
.ghost-link { border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; }
button.amt { color: inherit; font-variant-numeric: tabular-nums; }
td.pos button.amt { color: var(--good); }
button.amt:hover { text-decoration: underline; }
@media (max-width: 860px) { .dash { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .tag { white-space: normal; }
  #d-table input.assign { width: 64px; }
  #d-table th { font-size: 10.5px; }
}
@media (max-width: 640px) { .col .small { font-size: 10.5px; } }
@media (max-width: 640px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cards .panel { padding: 12px; margin-bottom: 0; }
  .cards .big { font-size: 21px; }
  .cards + * { margin-top: 12px; }
}

/* ---------- hide amounts ---------- */
#pv-toggle { display: inline-flex; align-items: center; gap: 6px; }
#pv-toggle .slash { display: none; }
#pv-toggle[aria-pressed="true"] { background: var(--text); color: var(--panel); border-color: var(--text); }
#pv-toggle[aria-pressed="true"] .slash { display: inline; }
.pv { letter-spacing: .05em; color: var(--muted) !important; }
body.privacy input[type=number], body.privacy input.assign { -webkit-text-security: disc; }
body.privacy .chart-tip .pv { color: var(--muted); }
@media (max-width: 640px) { #pv-toggle .pv-label { display: none; } #pv-toggle { padding: 7px 10px; } }
@media (max-width: 1400px) { #pv-toggle .pv-label { display: none; } #pv-toggle { padding: 7px 10px; } }
header { gap: 16px; }
nav { gap: 2px; }
nav a { padding: 6px 9px; }

/* --- review inbox, tags, hidden ------------------------------------------------ */
nav a .badge { display: inline-block; min-width: 18px; margin-left: 5px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; line-height: 17px; text-align: center; font-weight: 600; }
.pill-link { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: #fff !important; text-decoration: none !important; }
.review-bar { border-left: 3px solid var(--accent); }
table.txns tr.unrev td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
tr.is-hidden td { opacity: .55; }
button.link.payee { color: inherit; text-align: left; }
button.link.payee:hover { text-decoration: underline; }
.tag.hash { color: var(--accent); text-decoration: none; margin-left: 4px; }
.tag + .tag, td > .tag { margin-left: 4px; }
td .note { margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.small-btn { padding: 2px 9px; font-size: 13px; }
a.button { display: inline-block; background: var(--accent); color: #fff; border-radius: 6px; padding: 7px 14px; text-decoration: none; }
textarea { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; width: 100%; box-sizing: border-box; resize: vertical; }
dialog.txn-dialog { width: min(640px, calc(100% - 24px)); max-height: calc(100vh - 32px); overflow: auto; }
dialog.txn-dialog h2 { font-size: 15px; margin: 18px 0 8px; }
.receipts { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.receipt { position: relative; }
.receipt img, .receipt .pdf { display: flex; align-items: center; justify-content: center; width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); font-weight: 600; color: var(--muted); }
.receipt button { position: absolute; top: -6px; right: -6px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; width: 22px; height: 22px; font-size: 11px; line-height: 1; }
.file-btn { display: inline-block; cursor: pointer; font-size: 14px; }

/* --- cash flow ------------------------------------------------------------------- */
.chart .line.s4, .chart .dot.s4, .chart .end.s4 { stroke: var(--s4); }
.cf-cols { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; }
.cf-cols h2 { font-size: 15px; margin: 14px 0 6px; }
@media (max-width: 760px) { .cf-cols { grid-template-columns: minmax(0, 1fr); gap: 0; } }

/* --- insights ------------------------------------------------------------------------ */
.insights ul { list-style: none; margin: 4px 0 0; padding: 0; }
.insights .tip { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); }
.insights .tip:first-child { border-top: 0; }
.insights .tip > span:nth-child(2) { flex: 1; }
.insights .tip a { white-space: nowrap; }
.insights .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); transform: translateY(-1px); }
.insights .tip.warn .dot { background: var(--warn); } .insights .tip.bad .dot { background: var(--bad); } .insights .tip.good .dot { background: var(--good); } .insights .tip.info .dot { background: var(--s1); }

/* --- reports ---------------------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 8px 12px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.scroll-x { overflow-x: auto; }
.sankey svg { display: block; }
.sankey .link { opacity: .28; } .sankey .link:hover { opacity: .5; }
.sankey .link.s1, .sankey .node.s1 { fill: var(--s1); } .sankey .link.s2, .sankey .node.s2 { fill: var(--s2); }
.sankey .link.s3, .sankey .node.s3 { fill: var(--s3); } .sankey .link.s4, .sankey .node.s4 { fill: var(--s4); } .sankey .link.s5, .sankey .node.s5 { fill: var(--s5); }
.sankey .lbl { font-size: 12px; fill: var(--text); }
.sankey .lbl .v { fill: var(--muted); }
.sankey .lbl.mid { paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; }
.sparkbars { display: block; }
.sparkbars rect { fill: var(--s1); opacity: .45; } .sparkbars rect.hi { opacity: 1; }
table.trends tr.group td { background: var(--bg); }
.year-facts p { margin: 4px 0; }
.year-cols .col .pair { height: 120px; }
@media (max-width: 640px) { table.trends .sparkbars { width: 72px; } }

/* --- categories page ------------------------------------------------------------------------ */
.cat-group h2 { font-size: 17px; }
.cat-table { margin-top: 8px; }
.cat-table select { max-width: 150px; }
@media (max-width: 640px) { .cat-table td, .cat-table th { padding-left: 4px; padding-right: 4px; } }
[hidden] { display: none !important; }
nav a { white-space: nowrap; }
#tx-details { margin-top: 12px; }
.cat-table td.acts { white-space: nowrap; }
@media (max-width: 640px) {
  .cat-table td.acts { white-space: normal; text-align: right; }
  .cat-table td.acts button { margin: 2px 0 2px 6px; }
  table.txns select { max-width: 120px; }
  table.txns td, table.txns th { padding-left: 6px; padding-right: 6px; }
}

.apr-hint { max-width: 150px; margin-left: auto; margin-top: 4px; white-space: normal; line-height: 1.3; }

/* Donut: 2px panel-colored gaps between slices; hovering one fades the rest. */
.donut { position: relative; width: max-content; flex: none; }
.donut svg { display: block; overflow: visible; }
.donut .slice { stroke: var(--panel); stroke-width: 2px; stroke-linejoin: round; cursor: pointer; transition: opacity .12s; }
.donut .slice.s1 { fill: var(--s1); } .donut .slice.s2 { fill: var(--s2); } .donut .slice.s3 { fill: var(--s3); }
.donut .slice.s4 { fill: var(--s4); } .donut .slice.s5 { fill: var(--s5); } .donut .slice.other { fill: var(--other); }
.donut svg.focus .slice:not(.on) { opacity: .35; }
.donut-hole { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
.donut-v { font-size: 20px; font-weight: 650; }
.dot-key.other, .fill.other { background: var(--other); }
.fill.s2 { background: var(--s2); } .fill.s3 { background: var(--s3); } .fill.s4 { background: var(--s4); } .fill.s5 { background: var(--s5); }
.pie-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.pie-row > .hbars, .pie-row > table { flex: 1 1 240px; min-width: 0; }
.hbar.dim { opacity: .4; }
tr.dim { opacity: .4; }
.pie-row .hbar { grid-template-columns: 1fr auto 36px; }
.donut-hole { padding: 0 30px; } .donut-c { max-width: 100%; line-height: 1.35; } .donut-n { display: block; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .pie-row .hbar .num.small { display: inline; } .pie-row { justify-content: center; } }

/* Rewards */
.rw-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.rw-cards > .panel { margin: 0; }
.rw-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.rw-new { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rw-pool { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rw-pool-bal { text-align: right; }
.rw-dialog { width: min(560px, calc(100vw - 32px)); }
.rw-bonus { margin-top: 6px; flex-wrap: wrap; } .rw-bonus select { flex: 1 1 160px; min-width: 0; }
.rw-unit { color: var(--muted); font-size: 13px; }
@media (max-width: 640px) { .rw-cards { grid-template-columns: 1fr; } }
tr.is-current td { background: var(--bg); font-weight: 600; }

#theme-toggle { display: inline-flex; align-items: center; padding: 7px 10px; }
#theme-toggle .sun { display: none; }
:root[data-theme="dark"] #theme-toggle .sun { display: inline; } :root[data-theme="dark"] #theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #theme-toggle .sun { display: inline; } :root:not([data-theme="light"]) #theme-toggle .moon { display: none; } }
@media (max-width: 1400px) and (min-width: 641px) { header { gap: 14px; } nav a { padding: 6px 8px; } }

/* Taxes */
label.button-like { background: var(--accent); color: #fff; border-radius: 6px; padding: 7px 14px; cursor: pointer; white-space: nowrap; }
label.button-like:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
input.missing { border-color: var(--warn); background: var(--warn-bg); }
details.panel > summary { cursor: pointer; }
.pk-list { display: grid; gap: 10px; margin: 8px 0; }
.pk-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.pk-row:first-child { border-top: 0; }
@media (max-width: 640px) { .pk-row { flex-direction: column; align-items: flex-start; } .rw-dialog .fields { grid-template-columns: 1fr; } }
.cr-meter { height: 6px; border-radius: 3px; background: var(--line); margin: 6px 0 4px; max-width: 320px; overflow: hidden; }
.cr-meter > i { display: block; height: 100%; background: var(--good, #2e9e5b); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 28px; }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }
