:root {
  color-scheme: light;
  --paper: #eef1ef;
  --sheet: #ffffff;
  --ink: #17232e;
  --muted: #5d6b76;
  --line: #d5dcd8;
  --field: #b9c3be;
  --track: #e6ebe8;
  --hover: #f7f9f8;
  --focus: #0e6e6a;
  --over: #b42318;
  --over-bg: #fbe9e7;
  --good: #1f7a4d;
  --good-bg: #e3f1ea;
  --good-line: #b8dcc7;
  --warn: #8a5a00;
  --warn-bg: #fff1d6;
  --notice-bg: #fff6e0;
  --info-bg: #f1f6fb;
  --solid: #17232e;      /* strong fills: buttons, the top bar, the pace bar */
  --on-solid: #ffffff;   /* text on those */
  --top: #17232e;
  --top-text: #c9d3da;
  --shadow: 0 1px 2px rgba(23, 35, 46, .06), 0 4px 16px rgba(23, 35, 46, .05);
  --fund-redplumm_sa: #b7791f;
  --fund-o2: #2f5da8;
  --fund-redplumm_uk: #7a3e6d;
  --fund: #0e6e6a;
  /* Chart colours: the fund colours first, then companions in the same weight. */
  --c1: #b7791f; --c2: #2f5da8; --c3: #7a3e6d; --c4: #0e8a83; --c5: #c2536b; --c6: #6f8a2d; --c7: #4f6475; --c8: #d4a85a; --c9: #5b7fc7; --c10: #9b6a95;
  --r-sm: 4px;
  --r-lg: 10px;
}

/* Dark: chosen, or following the device when set to automatic. */
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0f161b; --sheet: #172128; --ink: #e6ebee; --muted: #9aa9b3; --line: #29363f; --field: #3a4954;
  --track: #24313a; --hover: #1d2931; --focus: #4fc1b8; --over: #ff7b6e; --over-bg: #3b1f1c; --good: #5fcb92; --good-bg: #153028;
  --good-line: #23503f; --warn: #f2bb55; --warn-bg: #3a2d12; --notice-bg: #2d2714; --info-bg: #17293a;
  --solid: #e6ebee; --on-solid: #0f161b; --top: #0a1014; --top-text: #9aa9b3;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --fund-redplumm_sa: #dba04a; --fund-o2: #6b97ea; --fund-redplumm_uk: #c482b4; --fund: #4fc1b8;
  --c1: #dba04a; --c2: #6b97ea; --c3: #c482b4; --c4: #3fc2b8; --c5: #ec7f95; --c6: #a7c45a; --c7: #8fa6b8; --c8: #e9c47f; --c9: #8fb0f0; --c10: #d4a6cc;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    color-scheme: dark;
    --paper: #0f161b; --sheet: #172128; --ink: #e6ebee; --muted: #9aa9b3; --line: #29363f; --field: #3a4954;
    --track: #24313a; --hover: #1d2931; --focus: #4fc1b8; --over: #ff7b6e; --over-bg: #3b1f1c; --good: #5fcb92; --good-bg: #153028;
    --good-line: #23503f; --warn: #f2bb55; --warn-bg: #3a2d12; --notice-bg: #2d2714; --info-bg: #17293a;
    --solid: #e6ebee; --on-solid: #0f161b; --top: #0a1014; --top-text: #9aa9b3;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --fund-redplumm_sa: #dba04a; --fund-o2: #6b97ea; --fund-redplumm_uk: #c482b4; --fund: #4fc1b8;
    --c1: #dba04a; --c2: #6b97ea; --c3: #c482b4; --c4: #3fc2b8; --c5: #ec7f95; --c6: #a7c45a; --c7: #8fa6b8; --c8: #e9c47f; --c9: #8fb0f0; --c10: #d4a6cc;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--focus); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Top bar */
.top {
  background: var(--top);
  color: #fff;
}
.top-inner {
  max-width: 1120px; margin: 0 auto; padding: .75rem 1.25rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem;
}
.brand { font-weight: 700; letter-spacing: -.01em; margin-right: auto; color: #fff; text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: .25rem; }
.nav a {
  color: var(--top-text); text-decoration: none; padding: .35rem .65rem; border-radius: var(--r-sm); font-size: .95rem;
}
.nav a[aria-current="page"], .nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.who { font-size: .85rem; color: var(--top-text); display: flex; gap: .75rem; align-items: center; }
.who button { background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; padding: .2rem .6rem; border-radius: var(--r-sm); cursor: pointer; font: inherit; }

main { max-width: 1120px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

/* Month switcher: the page title */
.month {
  display: flex; align-items: baseline; gap: .75rem; margin: .25rem 0 1.5rem;
}
.month h1 { font-size: clamp(1.6rem, 6.5vw, 3.25rem); line-height: 1; margin: 0; font-weight: 800; letter-spacing: -.03em; }
.month .step {
  display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem;
  border: 1px solid var(--line); border-radius: 50%; text-decoration: none; color: var(--ink); background: var(--sheet);
}
.month .step[aria-disabled="true"] { opacity: .35; pointer-events: none; }
.month .sub { color: var(--muted); margin-left: auto; font-size: .95rem; }

h2 { font-size: 1.25rem; margin: 2.5rem 0 .75rem; letter-spacing: -.01em; }
h3 { font-size: 1rem; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.flash { background: var(--good-bg); border-left: 4px solid var(--good); padding: .65rem .9rem; border-radius: var(--r-sm); margin-bottom: 1rem; }
.errors { background: var(--over-bg); border-left: 4px solid var(--over); padding: .65rem .9rem; border-radius: var(--r-sm); margin-bottom: 1rem; }
.errors ul { margin: 0; padding-left: 1.1rem; }
.notice { background: var(--notice-bg); border-left: 4px solid var(--fund-redplumm_sa); padding: .65rem .9rem; border-radius: var(--r-sm); margin-bottom: 1rem; }

/* Fund ledgers: the signature element. Each fund is a running line, never zeroed. */
.fund {
  --c: var(--fund);
  background: var(--sheet); border-radius: var(--r-lg); margin-bottom: 1.25rem; overflow: hidden;
  border: 1px solid var(--line); border-top: 6px solid var(--c);
}
.fund[data-fund="redplumm_sa"] { --c: var(--fund-redplumm_sa); }
.fund[data-fund="o2"] { --c: var(--fund-o2); }
.fund[data-fund="redplumm_uk"] { --c: var(--fund-redplumm_uk); }
.fund-head { padding: 1rem 1.25rem .75rem; display: flex; flex-wrap: wrap; gap: .5rem 2rem; align-items: flex-end; }
.fund-head h3 { font-size: 1.125rem; margin-right: auto; }
.ledger { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .6rem; font-size: .95rem; }
.ledger .op { color: var(--muted); }
.ledger b { font-weight: 600; }
.ledger .result { font-size: 1.25rem; font-weight: 800; }
.ledger .owed { color: var(--over); }
.ledger .ahead { color: var(--good); }

.pot { display: grid; grid-template-columns: minmax(9rem, 15rem) 1fr minmax(8.5rem, auto); gap: .25rem 1.25rem; align-items: center; padding: .7rem 1.25rem; border-top: 1px solid var(--line); }
.pot-name { font-weight: 600; }
.pot-name small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }
.pot-figs { text-align: right; font-size: .9rem; }
.pot-figs strong { display: block; font-size: 1.05rem; }
.pot-figs .over { color: var(--over); }

.bar { position: relative; height: 14px; background: var(--track); border-radius: 7px; overflow: hidden; display: flex; }
.bar .spent { background: var(--c); }
.bar .upcoming {
  background: repeating-linear-gradient(-45deg, var(--c) 0 3px, transparent 3px 7px);
  opacity: .55;
}
.bar .overflow { background: var(--over); }
.bar.nocap { background: none; border: 1px dashed var(--line); }
.bar-legend { font-size: .8rem; color: var(--muted); grid-column: 2; margin-top: -.15rem; }

/* Generic surfaces */
.panel { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; }

.table-wrap { overflow-x: auto; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg); }
table { width: 100%; border-collapse: collapse; font-size: .925rem; }
th, td { padding: .55rem .75rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 600; color: var(--muted); font-size: .8rem; background: var(--hover); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.is-transfer td { color: var(--muted); }
tr.is-transfer td.desc { text-decoration: line-through; }
.tag { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 999px; background: var(--track); color: var(--muted); white-space: nowrap; }
.tag.warn { background: var(--over-bg); color: var(--over); }
.tag.ok { background: var(--good-bg); color: var(--good); }

/* Forms */
form.inline { display: inline; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem 1rem; align-items: end; }
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .2rem; }
label.check { display: flex; gap: .45rem; align-items: center; font-weight: 400; font-size: .925rem; }
input, select, textarea {
  width: 100%; font: inherit; color: inherit; padding: .45rem .6rem;
  border: 1px solid var(--field); border-radius: var(--r-sm); background: var(--sheet); color: var(--ink);
}
input[type="checkbox"] { width: auto; }
select.compact, input.compact { padding: .25rem .4rem; font-size: .875rem; width: auto; max-width: 14rem; }
.btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--solid); color: var(--on-solid); border: 0; border-radius: var(--r-sm); padding: .5rem 1rem;
}
.btn.quiet { background: none; color: var(--ink); border: 1px solid var(--field); font-weight: 500; padding: .3rem .7rem; font-size: .875rem; }
.btn.danger { background: none; color: var(--over); border: 0; padding: .3rem .4rem; font-weight: 500; font-size: .875rem; }
.help { font-size: .825rem; color: var(--muted); margin: .25rem 0 0; }
details.edit > summary { cursor: pointer; color: var(--focus); font-size: .9rem; }
details.edit[open] { padding-bottom: .5rem; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login .panel { width: min(24rem, 100%); padding: 2rem; }
.login h1 { margin: 0 0 1.25rem; font-size: 1.75rem; letter-spacing: -.02em; }
.login .stack > * + * { margin-top: .9rem; }

@media (max-width: 720px) {
  .pot { grid-template-columns: 1fr auto; }
  .pot .bar, .bar-legend { grid-column: 1 / -1; grid-row: 2; }
  .bar-legend { grid-row: 3; }
  .month .sub { width: 100%; margin-left: 0; }
  .month { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: no-preference) {
  .bar > span { transition: width .4s ease; }
}
h2 .small { font-weight: 400; margin-left: .5rem; }
.ledger { margin: 0; }

/* Cards: one tile per budget, with a marker for where spending "should" be today */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1.25rem; }
.card-tile { margin: 0; padding: 1rem 1.25rem 1.1rem; display: flex; flex-direction: column; gap: .6rem; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.card-top h3 { font-size: 1.1rem; }
.card-top p { margin: .1rem 0 0; }
.state { font-size: .8rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; white-space: nowrap; background: var(--good-bg); color: var(--good); }
.state-alert, .state-fast { background: var(--warn-bg); color: var(--warn); }
.state-over { background: var(--over-bg); color: var(--over); }
.state-open { background: var(--track); color: var(--muted); }
.card-tile[data-state="over"] { box-shadow: inset 0 0 0 2px var(--over); }
.card-figure strong { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; margin-right: .35rem; }
.card-figure .owed { color: var(--over); }
.bar.paced { overflow: visible; height: 16px; }
.bar.paced > span:first-child { border-radius: 8px 0 0 8px; }
.bar .pace { position: absolute; top: -5px; bottom: -5px; width: 0; border-left: 2px solid var(--ink); }
.bar .pace::after { content: "today"; position: absolute; top: -1.2rem; left: -1rem; font-size: .7rem; font-style: normal; color: var(--muted); }
.card-line { margin: 0; }
.feed-line { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.live { background: var(--good); }
.dot.stale { background: var(--over); }
.recent { list-style: none; margin: 0; padding: .5rem 0 0; border-top: 1px solid var(--line); font-size: .875rem; }
.recent li { display: grid; grid-template-columns: 3.2rem 1fr auto; gap: .5rem; padding: .15rem 0; }
.recent .what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-edit { margin-top: auto; }

/* Banks */
.bank-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.bank-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
code { background: var(--track); padding: .05rem .35rem; border-radius: 3px; font-size: .875em; overflow-wrap: anywhere; }
.bank-meta { margin: .2rem 0 0; display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: center; }
.email-row { padding: .25rem 0; }

.subnav { display: flex; flex-wrap: wrap; gap: .25rem; margin: -.75rem 0 1.5rem; border-bottom: 1px solid var(--line); }
.subnav a { padding: .5rem .8rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.subnav a:hover { color: var(--ink); }
.status-line { display: flex; gap: .5rem; align-items: baseline; margin: .35rem 0; }
.fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; }
.fieldset legend { font-weight: 700; font-size: 1.05rem; margin-bottom: .6rem; padding: 0; }
.steps { padding-left: 1.2rem; }
.steps li { margin-bottom: .4rem; }
textarea { min-height: 7rem; font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }

/* Goals */
.goal-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem 2rem; }
.goal-summary strong { display: block; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.goal-summary .owed { color: var(--warn); }
.goal { display: flex; flex-direction: column; gap: .6rem; }
.goal-move { padding-top: .75rem; border-top: 1px solid var(--line); }
.suggestions { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .75rem; }
.suggestion { margin: 0; display: flex; flex-direction: column; gap: .35rem; align-items: flex-start; }
.suggestion summary { cursor: pointer; }
.months { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.tx-details { margin-top: .2rem; } .tx-details form { margin-top: .5rem; min-width: 18rem; }

/* Reports */
.chart-wrap { overflow-x: auto; }
.chart { width: 100%; min-width: 420px; height: auto; display: block; }
.legend { display: flex; gap: 1.25rem; flex-wrap: wrap; color: var(--muted); }
.legend i { display: inline-block; width: .8rem; height: .8rem; border-radius: 2px; vertical-align: -1px; margin-right: .3rem; }
.legend i.dash { height: 0; border-top: 2px dashed var(--c1); border-radius: 0; vertical-align: 3px; }
.forecast { width: 100%; margin: .15rem 0 0; }
.forecast .owed { color: var(--over); }
.forecast .ahead { color: var(--good); }
.page-actions { margin: -.75rem 0 1rem; display: flex; gap: .5rem; flex-wrap: wrap; }

/* Banks */
.setup-steps { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; counter-reset: s; }
.setup-steps li { display: flex; align-items: center; gap: .5rem; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg); padding: .6rem .8rem; font-size: .925rem; }
.setup-steps li a { color: var(--ink); text-decoration: none; font-weight: 600; }
.setup-steps .step-dot { flex: none; display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px solid var(--line); font-size: .8rem; font-weight: 700; color: var(--muted); }
.setup-steps li.done { border-color: var(--good-line); background: var(--good-bg); }
.setup-steps li.done .step-dot { background: var(--good); border-color: var(--good); color: var(--on-solid); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.connect-row { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.feed { border-top: 1px solid var(--line); padding: .9rem 0 .4rem; }
.feed-row { display: grid; grid-template-columns: minmax(10rem, 1.2fr) 1fr 1fr auto auto; gap: .5rem 1rem; align-items: end; }
.feed-name { display: flex; flex-direction: column; gap: .15rem; align-self: center; }
select.needs { border-color: var(--c1); box-shadow: 0 0 0 2px var(--warn-bg); }
.cards-map { margin: .9rem 0 .2rem; padding-left: 1rem; border-left: 3px solid var(--line); }
@media (max-width: 760px) {
  .setup-steps { grid-template-columns: 1fr 1fr; }
  .feed-row { grid-template-columns: 1fr; }
}

/* Notifications */
.bell { position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; }
.bell:hover { background: rgba(255,255,255,.12); }
.bell-count { position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.notice-list { list-style: none; margin: 0; padding: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.notice-list li + li { border-top: 1px solid var(--line); }
.notice-list a { display: grid; grid-template-columns: 1fr auto; gap: .15rem 1rem; padding: .8rem 1rem; color: var(--ink); text-decoration: none; }
.notice-list a:hover { background: var(--hover); }
.notice-list li.unread a { background: var(--info-bg); }
.notice-list li.unread .notice-title::before { content: ""; display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: var(--fund-o2); margin-right: .45rem; vertical-align: 1px; }
.notice-title { font-weight: 600; }
.notice-body { grid-column: 1; color: var(--muted); font-size: .9rem; white-space: pre-line; }
.notice-time { grid-column: 2; grid-row: 1; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.who-for { display: flex; gap: .5rem; align-items: center; margin-bottom: 1.25rem; flex-wrap: wrap; }
table.prefs td { vertical-align: top; }
table.prefs th.tick, table.prefs td.tick { width: 6.5rem; text-align: center; }
table.prefs td.tick input { width: 1.25rem; height: 1.25rem; margin-top: .15rem; cursor: pointer; }
.inline-field { display: flex; gap: .4rem; align-items: center; font-weight: 400; margin-top: .4rem; }
.daily-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .2rem 1rem; margin-top: .4rem; }
.level-picks { display: flex; flex-wrap: wrap; gap: .5rem; }
.pick { position: relative; margin: 0; }
.pick input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pick span { display: inline-block; min-width: 4rem; text-align: center; padding: .55rem .7rem; border: 1px solid var(--field); border-radius: 999px; background: var(--sheet); font-weight: 600; font-size: .95rem; }
.pick input:checked + span { background: var(--solid); border-color: var(--solid); color: var(--on-solid); }
.pick.over input:checked + span { background: var(--over); border-color: var(--over); }
.pick input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.pot-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .3rem 1rem; margin-top: .5rem; }
.pot-picks[hidden] { display: none; }

/* Import */
.import-steps li { font-size: .9rem; }
.import-steps li.current { border-color: var(--ink); }
.import-steps li.current .step-dot { border-color: var(--ink); color: var(--ink); }
.import-summary { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.25rem; }
.import-summary > div { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg); padding: .6rem 1rem; display: flex; flex-direction: column; min-width: 8rem; }
.import-summary strong { font-size: 1.4rem; font-weight: 800; }
.import-summary span { font-size: .85rem; color: var(--muted); }
.import-summary .muted-box strong { color: var(--muted); }
.bulk { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; padding: .75rem 1rem; margin-bottom: .75rem; }
.import-rows td { vertical-align: middle; }
.import-rows tr.off td { opacity: .45; }
.import-rows select.compact { max-width: 15rem; }
.commit-bar { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-top: 1rem; position: sticky; bottom: 0; background: var(--paper); padding: .75rem 0; }
.card-picks { padding: .9rem 1rem; }
.card-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .6rem 1rem; }
.card-pick-grid label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; margin: 0; }
.card-pick-grid select { max-width: none; width: 100%; }
.import-summary .owed { color: var(--over); }
table.shops { margin-top: .25rem; }
table.shops th, table.shops td { padding: .3rem .4rem; }
table.shops th { background: none; border-bottom: 1px solid var(--line); }
.link-card { display: flex; gap: .4rem; flex-wrap: wrap; }
.by-account { margin: -.5rem 0 1.25rem; color: var(--muted); }
.by-account a { font-weight: 600; }
.card-pick-list { display: grid; gap: .5rem; }
.card-pick { display: grid; grid-template-columns: minmax(14rem, 1fr) minmax(14rem, 1.2fr); gap: .35rem 1rem; align-items: center; padding: .45rem 0; border-top: 1px solid var(--line); }
.card-pick:first-child { border-top: 0; }
.card-pick select { width: 100%; max-width: none; }
.card-new { grid-column: 2; display: flex; gap: .75rem; flex-wrap: wrap; }
.card-new label { display: flex; gap: .35rem; align-items: center; font-weight: 400; margin: 0; }
.import-rows tr.to-new select.pot { border-style: dashed; }
@media (max-width: 760px) { .card-pick { grid-template-columns: 1fr; } .card-new { grid-column: 1; } }
.card-new[hidden] { display: none; }
[data-mailer][hidden] { display: none; }
.out-split { margin: .25rem 0 0; }
.out-split b { color: var(--ink); }
.pay-back { margin-top: 2rem; }
.pay-back .card-tile h3 a { color: var(--ink); text-decoration: none; }
.pay-back .card-tile { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1rem 1.1rem; }

/* ===== Overview ===== */
.ov-hero { margin: .25rem 0 1.75rem; max-width: 52rem; }
.ov-sentence { font-size: clamp(1.35rem, 1rem + 1.6vw, 2rem); line-height: 1.3; font-weight: 500; letter-spacing: -.01em; margin: 0 0 1rem; }
.ov-sentence b { font-weight: 800; }
.ov-neg { color: var(--over); }
.ov-pos { color: var(--good); }
.ov-pace { position: relative; height: 14px; border-radius: 7px; background: var(--track); overflow: visible; }
.ov-pace-fill { position: absolute; inset: 0 auto 0 0; border-radius: 7px; background: var(--solid); }
.ov-pace-fill.is-ahead { background: var(--c1); }
.ov-pace-fill.is-over { background: var(--over); }
.ov-pace-today { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--paper); box-shadow: 0 0 0 1px var(--solid); }
.ov-pace-note { margin: .6rem 0 0; color: var(--muted); font-size: .95rem; }

.ov-attention { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg); padding: .9rem 1.1rem; margin-bottom: 1.75rem; }
.ov-attention h2 { font-size: 1rem; margin: 0 0 .4rem; }
.ov-attention ul { list-style: none; margin: 0; padding: 0; }
.ov-attention li { display: flex; flex-wrap: wrap; gap: .25rem .75rem; justify-content: space-between; align-items: baseline; padding: .4rem 0 .4rem 1.1rem; position: relative; border-top: 1px solid var(--line); }
.ov-attention li:first-child { border-top: 0; }
.ov-attention li::before { content: ""; position: absolute; left: 0; top: .9rem; width: .5rem; height: .5rem; border-radius: 50%; background: var(--muted); }
.ov-attention li.tone-warn::before { background: var(--warn); }
.ov-attention li.tone-over::before { background: var(--over); }
.ov-attention li a { white-space: nowrap; font-size: .92rem; }

.ov-funds { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1.25rem; align-items: start; }
.ov-fund { --fc: var(--fund); background: var(--sheet); border: 1px solid var(--line); border-top: 4px solid var(--fc); border-radius: var(--r-lg); padding: 1rem 1.1rem .5rem; }
.ov-fund[data-fund="redplumm_sa"] { --fc: var(--fund-redplumm_sa); }
.ov-fund[data-fund="o2"] { --fc: var(--fund-o2); }
.ov-fund[data-fund="redplumm_uk"] { --fc: var(--fund-redplumm_uk); }
.ov-fund header h2 { font-size: 1.1rem; margin: 0; }
.ov-fund-left { margin: .15rem 0 .5rem; color: var(--muted); }
.ov-fund-left b { color: var(--ink); font-size: 1.25rem; font-weight: 800; }
.ov-fund-left b.ov-neg { color: var(--over); }

.ov-pots { list-style: none; margin: 0; padding: 0; }
.ov-pot { display: grid; grid-template-columns: 1fr auto; gap: .35rem .75rem; align-items: baseline; padding: .6rem 0; border-top: 1px solid var(--line); }
.ov-pot > a { color: var(--ink); text-decoration: none; font-weight: 600; }
.ov-pot > a:hover { text-decoration: underline; }
.ov-amount { font-weight: 700; white-space: nowrap; text-align: right; }
.ov-amount small { font-weight: 400; color: var(--muted); font-size: .85em; }
.ov-pot.state-warn .ov-amount { color: var(--warn); }
.ov-pot.state-over .ov-amount { color: var(--over); }
.ov-pot.state-nocap .ov-amount { font-weight: 600; }
.ov-bar { grid-column: 1 / -1; display: flex; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.ov-bar i { display: block; height: 100%; }
.ov-bar .s { background: var(--fc); }
.ov-bar .u { background: repeating-linear-gradient(-45deg, var(--fc) 0 3px, transparent 3px 6px); opacity: .45; }
.ov-bar .o { background: var(--over); }

.ov-money { border-top: 1px solid var(--line); margin-top: .1rem; padding: .55rem 0 .35rem; }
.ov-money summary { cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .92rem; list-style: none; }
.ov-money summary::-webkit-details-marker { display: none; }
.ov-money summary::before { content: "▸"; margin-right: .4rem; }
.ov-money[open] summary::before { content: "▾"; }
.ov-money summary span { margin-left: auto; font-weight: 700; }
.ov-money dl { margin: .6rem 0 .25rem; }
.ov-money dl div { display: flex; justify-content: space-between; gap: 1rem; padding: .2rem 0; font-size: .92rem; }
.ov-money dt { color: var(--muted); }
.ov-money dd { margin: 0; font-weight: 600; }
.ov-money .ov-total { border-top: 1px solid var(--line); margin-top: .2rem; padding-top: .4rem; }
.ov-money .ov-total dt { color: var(--ink); font-weight: 700; }

.ov-payback { margin-top: 2rem; }
.ov-payback h2, .ov-extras h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
.ov-payback ul { list-style: none; margin: 0 0 .5rem; padding: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg); }
.ov-payback li { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; padding: .8rem 1.1rem; border-top: 1px solid var(--line); }
.ov-payback li:first-child { border-top: 0; }
.ov-payback li > a { font-weight: 700; color: var(--ink); text-decoration: none; }
.ov-payback .ov-amount { font-size: 1.15rem; }
.ov-payback-meta { grid-column: 1 / -1; color: var(--muted); font-size: .9rem; }

.ov-extras { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1.25rem 2rem; margin-top: 2rem; }
.ov-list { list-style: none; margin: 0; padding: 0; }
.ov-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .75rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.ov-list li > span:nth-child(2), .ov-list li > a:first-child { flex: 1 1 8rem; }
.ov-when { color: var(--muted); font-size: .9rem; min-width: 5.5rem; }
.ov-note { width: 100%; font-size: .85rem; color: var(--warn); }
.ov-list li.tone-warn .ov-when { color: var(--warn); font-weight: 600; }
.ov-list li.tone-over .ov-when { color: var(--over); font-weight: 600; }
.compact-btn { padding: .2rem .55rem; font-size: .8rem; }

@media (max-width: 520px) {
  .ov-fund { padding: .9rem .9rem .4rem; }
}

/* ===== Depth: panels lift a little off the page, in both themes ===== */
.panel, .ov-fund, .ov-attention, .ov-payback ul, .chart-card, .card-tile, .table-wrap, .notice-list { box-shadow: var(--shadow); }
.table-wrap { background: var(--sheet); }

/* ===== Charts ===== */
.ov-charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 1.25rem; margin-bottom: 1.75rem; }
.chart-card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1rem 1.1rem 1.1rem; min-width: 0; }
.chart-card.chart-pace { grid-column: 1 / -1; }
.chart-card header { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: flex-start; justify-content: space-between; margin-bottom: .75rem; }
.chart-card h2 { font-size: 1.05rem; margin: 0; }
.chart-card header p { margin: .15rem 0 0; color: var(--muted); font-size: .88rem; }
.chart-box { position: relative; height: 290px; }
.chart-pace .chart-box { height: 240px; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); margin: 0; padding: 1rem; border: 1px dashed var(--line); border-radius: var(--r-lg); }
.chart-switch { display: inline-flex; background: var(--track); border-radius: 999px; padding: 3px; gap: 2px; }
.chart-switch button { border: 0; background: none; color: var(--muted); font: inherit; font-size: .8rem; font-weight: 600; padding: .3rem .7rem; border-radius: 999px; cursor: pointer; }
.chart-switch button[aria-pressed="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.chart-switch button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
@media (max-width: 860px) {
  .ov-charts { grid-template-columns: 1fr; }
  .chart-box { height: 300px; }
}
.ov-customise { margin: 2rem 0 0; text-align: center; font-size: .9rem; }
.ov-pots.is-compact .ov-bar { display: none; }
.ov-pots.is-compact .ov-pot { padding: .45rem 0; }

/* Theme toggle in the top bar */
.who .theme-toggle, .theme-toggle { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 0; background: none; color: #fff; cursor: pointer; }
.who .theme-toggle:hover, .theme-toggle:hover { background: rgba(255,255,255,.12); }

/* ===== Display settings ===== */
.theme-picks, .row-picks { display: flex; flex-wrap: wrap; gap: .75rem; }
.theme-pick, .row-pick { position: relative; display: flex; flex-direction: column; gap: .4rem; align-items: center; margin: 0; cursor: pointer; font-weight: 600; font-size: .9rem; }
.theme-pick input, .row-pick input { position: absolute; opacity: 0; }
.swatch { display: grid; grid-template-rows: 10px 1fr; width: 7.5rem; height: 4.5rem; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); padding: 0; }
.swatch i:nth-child(1) { background: #17232e; }
.swatch i:nth-child(2) { margin: 8px; border-radius: 4px; background: #ffffff; }
.swatch i:nth-child(3) { display: none; }
.swatch-light { background: #eef1ef; }
.swatch-dark { background: #0f161b; }
.swatch-dark i:nth-child(1) { background: #0a1014; }
.swatch-dark i:nth-child(2) { background: #172128; }
.swatch-auto { background: linear-gradient(135deg, #eef1ef 50%, #0f161b 50%); }
.swatch-auto i:nth-child(2) { background: linear-gradient(135deg, #ffffff 50%, #172128 50%); }
.theme-pick input:checked + .swatch, .row-pick input:checked + .row-demo { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.theme-pick input:focus-visible + .swatch, .row-pick input:focus-visible + .row-demo { outline: 3px solid var(--focus); outline-offset: 2px; }
.row-demo { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; width: 11rem; padding: 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--sheet); }
.row-demo b { height: 8px; border-radius: 4px; background: var(--ink); opacity: .7; width: 70%; }
.row-demo s { height: 8px; width: 2.2rem; border-radius: 4px; background: var(--ink); opacity: .45; }
.row-demo i { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--c1) 60%, var(--track) 60%); }
.section-order { list-style: none; padding: 0; margin: 0 0 1rem; counter-reset: none; }
.section-order li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); margin-bottom: .4rem; }
.section-order .check { margin: 0; }
.order-buttons { display: inline-flex; gap: .3rem; }
.order-buttons .btn { padding: .15rem .55rem; }
/* Side bars: room for every budget's name. */
.chart-budgets .chart-box { height: calc(var(--rows, 6) * 34px + 50px); min-height: 230px; }
/* Reports */
.report-charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; margin-bottom: 1.25rem; }
.report-charts .report-inout, .report-charts .report-trend { grid-column: 1 / -1; }
.report-charts .chart-box { height: 300px; }
@media (max-width: 860px) { .report-charts { grid-template-columns: 1fr; } }
