/* Layout: sticky header with account filter, one content column (max 1120px),
   tabs along the top on a laptop and along the bottom on a phone. */
:root {
  --bg: #f3f5f2; --surface: #ffffff; --surface-2: #f8faf8; --ink: #14201c; --muted: #5b6964; --line: #dde3df;
  --accent: #0e5a4b; --accent-ink: #ffffff; --accent-soft: #e0eee9;
  --up: #0a7443; --up-soft: #e1f3e9; --down: #b3261e; --down-soft: #fbe6e4;
  --warn: #8a5200; --warn-soft: #fff1d6; --track: #e4e9e6;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --grid: #e4e8e5; --axis: #bcc5c0;
  --radius: 14px; --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1412; --surface: #161e1b; --surface-2: #1b2421; --ink: #e7eeea; --muted: #94a29c; --line: #27322e;
    --accent: #62cbb2; --accent-ink: #06241d; --accent-soft: #15322b;
    --up: #53c990; --up-soft: #12301f; --down: #ff8279; --down-soft: #3a1917;
    --warn: #f0b653; --warn-soft: #3a2b0e; --track: #26312d;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --grid: #232d29; --axis: #3a4641;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.loading { padding: 48px 16px; text-align: center; color: var(--muted); }

.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.top-row { display: flex; align-items: center; gap: 12px; padding-block: 10px 6px; }
.brand { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.status { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; text-align: right; min-width: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--up); flex: none; }
.dot.stale { background: var(--warn); } .dot.off { background: var(--down); }
.icon-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
.icon-btn:hover { border-color: var(--accent); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-block: 4px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 13px; font-size: 13.5px; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.tabs { display: flex; gap: 2px; }
.tab { border: 0; background: none; padding: 9px 14px; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }

main { padding-block: 18px 40px; display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card h2 { font-size: 15px; font-weight: 650; margin-bottom: 12px; }
.card h2 small { font-weight: 400; color: var(--muted); font-size: 12.5px; margin-left: 6px; }
.label { color: var(--muted); font-size: 12.5px; letter-spacing: 0.02em; }
.sub { color: var(--muted); font-size: 13px; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--muted); }
.num { text-align: right; white-space: nowrap; }

.hero { display: flex; flex-wrap: wrap; gap: 14px 32px; align-items: flex-end; }
.hero .big { font-size: clamp(34px, 7vw, 50px); font-weight: 680; letter-spacing: -0.025em; line-height: 1.05; }
.hero .side { margin-left: auto; text-align: right; }
.hero .side .val { font-size: 19px; font-weight: 620; }
.hero .sides { margin-left: auto; display: flex; flex-wrap: wrap; gap: 14px 32px; }
.hero .sides .side { margin-left: 0; }
td.strong { font-weight: 650; background: var(--surface-2); }
/* stocks (filled) against cash (unfilled) */
.split { height: 8px; border-radius: 4px; background: var(--s4); overflow: hidden; max-width: 420px; margin: 10px 0 6px; }
.split i { display: block; height: 100%; background: var(--accent); border-right: 2px solid var(--surface); }
.split.sm { width: 84px; height: 6px; margin: 0 0 4px auto; }
.ink { color: var(--ink); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.tile .val { font-size: 25px; font-weight: 660; letter-spacing: -0.015em; margin-block: 4px 2px; }
.tile .pill { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 13px; font-weight: 600; margin-left: 6px; vertical-align: 3px; }
.pill.up { background: var(--up-soft); } .pill.down { background: var(--down-soft); } .pill.flat { background: var(--track); }

.table-scroll { overflow-x: auto; margin-inline: -18px; padding-inline: 18px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.num { text-align: right; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td:first-child, th:first-child { padding-left: 0; } td:last-child, th:last-child { padding-right: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); }
tfoot td { font-weight: 650; border-top: 1px solid var(--line); border-bottom: 0; }
.hname { font-weight: 600; } .hmeta { color: var(--muted); font-size: 12.5px; }
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 11.5px; color: var(--muted); margin-right: 4px; white-space: nowrap; }

.range { min-width: 130px; }
.range .track { position: relative; height: 6px; border-radius: 3px; background: var(--track); }
.range .fill { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--accent); opacity: 0.35; }
.range .mark { position: absolute; top: -3px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.range .ends { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.spark { display: block; width: 96px; height: 30px; }

.hcards { display: none; gap: 12px; }
.hcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; }
.hcard .row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.hcard .v { font-size: 19px; font-weight: 650; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv div span { display: block; color: var(--muted); font-size: 12px; }

.banner { border-radius: var(--radius); padding: 12px 14px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.info { background: var(--accent-soft); color: var(--ink); }
.banner b { font-weight: 650; }
.banner .go { margin-left: auto; flex: none; background: none; border: 0; text-decoration: underline; color: inherit; padding: 0; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 12px; font-size: 13.5px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.toolbar .grow { flex: 1; min-width: 160px; }
input[type="search"], input[type="text"], input[type="password"] { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 12px; }
.form { display: grid; gap: 10px; margin-top: 14px; max-width: 440px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
button:disabled { opacity: 0.55; cursor: default; }
a { color: var(--accent); }
.btn { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 8px 14px; font-weight: 600; font-size: 14px; }
.btn.ghost { background: none; color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 20px; }
.stats .val { font-size: 19px; font-weight: 640; }
.stats .big { grid-column: span 2; }
.stats .big .val { font-size: 25px; white-space: nowrap; }
.note { color: var(--muted); font-size: 13px; max-width: 75ch; }
.note + .note { margin-top: 8px; }
ul.plain { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.ok { color: var(--up); font-weight: 600; } .bad { color: var(--warn); font-weight: 600; }
.acct-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.files { font-size: 12.5px; color: var(--muted); display: grid; gap: 2px; margin-top: 8px; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 1.3fr) 3fr 112px; gap: 12px; align-items: center; font-size: 13.5px; }
.bar-row .bar { height: 10px; background: var(--track); border-radius: 5px; overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.bar-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bottom { display: none; }
@media (max-width: 1060px) { .hide-md { display: none; } .htable td, .htable th { padding-inline: 7px; } .range { min-width: 104px; } }
@media (max-width: 760px) {
  body { font-size: 15px; }
  .tabs { display: none; }
  .bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line);
    padding: 4px max(6px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px)); }
  .bottom button { flex: 1; border: 0; background: none; padding: 8px 2px; font-size: 12px; color: var(--muted); border-radius: 10px; display: grid; gap: 2px; justify-items: center; }
  .bottom button svg { width: 20px; height: 20px; }
  .bottom button[aria-selected="true"] { color: var(--accent); font-weight: 650; background: var(--accent-soft); }
  main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .htable { display: none; } .hcards { display: grid; }
  .hero .side { margin-left: 0; text-align: left; }
  .status .long { display: none; }
  .card { padding: 15px; } .table-scroll { margin-inline: -15px; padding-inline: 15px; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: no-preference) { .chip, .tab, .seg button, .icon-btn { transition: background-color .12s, border-color .12s, color .12s; } }

/* ---- added: chart, drill-down, forms, drop zone ---- */
.chart { position: relative; margin-top: 6px; touch-action: pan-y; }
.chart svg { display: block; max-width: 100%; }
.chart .tick { font-size: 11.5px; fill: var(--muted); }
.chart .endname { font-size: 12px; fill: var(--muted); }
.chart .endval { font-size: 13px; fill: var(--ink); font-weight: 650; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.legend .key i, .tip-row i, .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: absolute; z-index: 5; pointer-events: none; min-width: 170px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12); }
.tip-date { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 4px; padding: 1px 0; }
.tip-row span { flex: 1; color: var(--muted); }
.tip-row b { font-weight: 650; }
.tip-sum { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
details.more { margin-top: 10px; font-size: 13.5px; }
details.more summary, details.adv summary { cursor: pointer; color: var(--accent); }
details.adv summary { color: var(--ink); list-style-position: outside; }
details.more[open] summary { margin-bottom: 8px; }
.h3 { font-size: 14px; font-weight: 650; margin: 18px 0 8px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font-size: inherit; }
button.bar-row { width: 100%; background: none; border: 0; padding: 2px 0; text-align: left; border-radius: 6px; }
button.bar-row:hover { background: var(--surface-2); }
.bar-row .bar { display: block; } .bar-row .nm { display: block; }
.hcard.click { cursor: pointer; }
.hcard .row { display: flex; }
.hcard .kv > span { display: block; }
.hcard .kv > span > span:first-child { display: block; color: var(--muted); font-size: 12px; }
.hcard .v { display: block; }
select, input[type="date"], input[type="number"] { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 10px; }
td select { min-width: 150px; }
.form.wide { max-width: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.two label, .three label, .form > div > label { display: block; margin-bottom: 4px; }
.drop { margin-top: 12px; border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px 16px; text-align: center; display: grid; place-items: center; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .sub { margin: 4px 0 8px; }
.tiles { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 1080px) { .tiles { grid-template-columns: repeat(4, 1fr); } .tile .val { font-size: 22px; } }
@media (max-width: 760px) { .two { grid-template-columns: 1fr; } .tiles { grid-template-columns: 1fr; } }

/* ---- Accessible Money ---- */
.split.wide { max-width: none; height: 10px; margin: 14px 0 16px; }
.groups { gap: 18px 28px; }
.grp .val { font-size: 25px; font-weight: 660; letter-spacing: -0.015em; margin: 4px 0 2px; }
.grp .val .pill { font-size: 13px; font-weight: 600; margin-left: 8px; vertical-align: 3px; display: inline-block; border-radius: 999px; padding: 1px 9px; }
.chipwrap { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chipwrap .chip { font-size: 12.5px; padding: 4px 10px; }
.hcards-title { display: none; font-size: 15px; font-weight: 650; margin: 6px 0 -6px; }
@media (max-width: 760px) { .hcards-title { display: block; } }table.mini { font-size: 13.5px; }
table.mini th { padding: 4px 8px; }
table.mini td { padding: 6px 8px; }
table.mini td:first-child, table.mini th:first-child { padding-left: 0; }
table.mini td:last-child, table.mini th:last-child { padding-right: 0; }
/* ---- headline and key figures ---- */
.card.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px 40px; align-items: center; padding: 22px; }
.hero .big { font-size: clamp(40px, 7.5vw, 58px); }
.hero .today { margin-top: 6px; font-size: 15px; color: var(--muted); }
.hero .today b { font-size: 17px; font-weight: 650; margin-right: 4px; }
.hero-side .split.wide { margin: 8px 0 10px; height: 12px; border-radius: 6px; }
.keys { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; color: var(--muted); }
.keys b { color: var(--ink); font-weight: 650; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 18px 20px; }
.kpi .label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.kpi .val { font-size: clamp(28px, 3.4vw, 34px); font-weight: 680; letter-spacing: -0.02em; line-height: 1.15; margin-top: 6px; }
.kpi-pill { margin: 6px 0 8px; }
.kpi-pill .pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 600; }
.kpi .sub { font-size: 13px; }
.tag.ext { border-color: var(--warn); color: var(--warn); margin: 0 0 0 4px; }
.dot.ext { background: var(--s1); }
.card h2 { font-size: 16px; }
@media (max-width: 720px) { .card.hero { grid-template-columns: 1fr; } .kpis { grid-template-columns: 1fr; } }.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats.three .big { grid-column: auto; }
@media (max-width: 760px) { .stats.three { grid-template-columns: 1fr; } }
.benchline { margin: 10px 0 0; font-size: 14.5px; }
.benchline b { font-weight: 650; }

.pbar { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; min-width: 90px; }
.pbar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar-row .num b { font-weight: 650; }
