@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #eef0f3;
  --surface: #ffffff;
  --sunk: #f5f6f8;
  --line: #dde1e7;
  --line-strong: #c4cad3;
  --ink: #14171c;
  --ink-2: #3a414c;
  --muted: #5b6370;
  --accent: #2a45c2;
  --accent-soft: #e8ecfb;
  --pos: #1a7343;
  --neg: #b42318;
  --r-lg: 12px;
  --r-sm: 5px;
  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--font); }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
a { color: var(--accent); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: var(--r-sm); z-index: 20; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--ink); color: #f3f4f6; }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; height: 56px; display: flex; align-items: center; gap: 32px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand svg { color: #9db0ff; }
.sections { display: flex; gap: 4px; }
.sections a { color: #c9ced6; text-decoration: none; font-weight: 500; font-size: 14px; padding: 6px 10px; border-radius: var(--r-sm); transition: background-color .2s, color .2s; }
.sections a:hover { background: #262b33; color: #fff; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; color: #c9ced6; }
.initials { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: #343b46; color: #fff; font-weight: 600; font-size: 12px; letter-spacing: .02em; }

/* page */
.page { max-width: 1280px; margin: 0 auto; padding: 28px 24px 40px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.sub { color: var(--ink-2); margin-top: 4px; max-width: 65ch; }
.months { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.months button { font: 500 14px var(--font); color: var(--ink-2); background: none; border: 0; padding: 6px 14px; border-radius: var(--r-sm); cursor: pointer; transition: background-color .2s, color .2s; }
.months button:hover { background: var(--sunk); }
.months button:active { transform: translateY(1px); }
.months button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.txns { grid-column: 1 / -1; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px 22px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.005em; }
.big { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.link-btn { font: 500 13px var(--font); color: var(--accent); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* spending */
.spend-summary { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.pace { color: var(--ink-2); font-size: 14px; text-align: right; max-width: 34ch; }
.pace strong { font-weight: 600; color: var(--ink); }
.pace-chart { margin: 14px 0 6px; }
.pace-chart svg { display: block; width: 100%; height: auto; }
.grid-l { stroke: #edf0f3; stroke-width: 1; }
.ax { fill: #7a828e; font-size: 11px; font-family: var(--font); }
.budget-l { stroke: var(--neg); stroke-width: 1.25; stroke-dasharray: 2 4; opacity: .7; }
.prev-l { fill: none; stroke: #a8b0bc; stroke-width: 1.75; stroke-dasharray: 5 4; }
.now-l { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.now-dot { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 18px; height: 0; border-top: 2.5px solid var(--accent); }
.key-prev { border-top: 2px dashed #a8b0bc; }
.key-budget { border-top: 1.5px dotted var(--neg); }

.cats { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px solid var(--line); }
.cats li { border-bottom: 1px solid var(--line); }
.cats li:last-child { border-bottom: 0; }
.cat { width: 100%; display: grid; grid-template-columns: minmax(0, 1.2fr) auto 92px; grid-template-areas: "name amt status" "bar bar bar"; align-items: center; gap: 6px 16px; padding: 11px 8px; margin: 0 -8px; width: calc(100% + 16px); background: none; border: 0; border-radius: var(--r-sm); font: inherit; color: inherit; text-align: left; cursor: pointer; transition: background-color .2s; }
.cat:hover { background: var(--sunk); }
.cat[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.cat-name { grid-area: name; display: flex; align-items: center; gap: 9px; font-weight: 500; }
.cat-amt { grid-area: amt; font-size: 14px; }
.cat-status { grid-area: status; font-size: 13px; text-align: right; }
.sw { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 3px; }
.bar { grid-area: bar; position: relative; height: 6px; background: #eceff3; border-radius: 3px; }
.fill { position: absolute; inset: 0 auto 0 0; border-radius: 3px; }
.limit { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }

/* accounts */
.networth { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.networth .big { margin: 2px 0 4px; }
.acct-group { padding-top: 16px; }
.acct-group h3 { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--muted); padding-bottom: 6px; }
.acct-group ul { list-style: none; margin: 0; padding: 0; }
.acct { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid #eef0f3; }
.acct-name { font-weight: 500; }
.acct-bal { font-weight: 600; white-space: nowrap; }
.acct-bal.owed { color: var(--neg); }
.due { color: var(--ink-2); margin-top: 3px; }

/* transactions */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.field { position: relative; display: flex; align-items: center; }
.field.search { flex: 1 1 260px; }
.field.search svg { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
input[type="search"], select { font: 400 14px var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px; height: 38px; transition: border-color .2s; }
input[type="search"] { width: 100%; padding: 0 12px 0 34px; }
select { padding: 0 32px 0 12px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%235b6370' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; cursor: pointer; }
input[type="search"]:hover, select:hover { border-color: #9aa2ae; }
.table-wrap { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
.ledger th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); background: var(--sunk); padding: 9px 14px; border-bottom: 1px solid var(--line); }
.ledger td { padding: 11px 14px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
.ledger tr:last-child td { border-bottom: 0; }
.ledger tbody tr:hover td { background: #fafbfc; }
.ledger .r { text-align: right; }
.ledger .d { color: var(--ink-2); white-space: nowrap; width: 84px; }
.merchant { font-weight: 500; }
.note { display: block; }
.pending { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 600; color: #8a5a00; background: #fdf3dc; border-radius: 3px; padding: 1px 6px; vertical-align: 1px; }
.ledger .c { white-space: nowrap; }
.ledger .c .sw { margin-right: 8px; vertical-align: 0; }
.ledger .a { white-space: nowrap; font-size: 13px; }
.amt { font-weight: 600; white-space: nowrap; }
.empty { padding: 36px 20px; text-align: center; }
.empty p { margin-bottom: 6px; }
.btn { margin-top: 10px; font: 600 14px var(--font); color: #fff; background: var(--ink); border: 0; border-radius: 7px; padding: 9px 16px; cursor: pointer; transition: background-color .2s; }
.btn:hover { background: #2b313a; }
.btn:active { transform: translateY(1px); }
.more-btn { display: block; width: 100%; margin-top: 12px; font: 600 14px var(--font); color: var(--ink-2); background: var(--sunk); border: 1px solid var(--line); border-radius: 7px; padding: 10px 16px; cursor: pointer; transition: background-color .2s; }
.more-btn:hover { background: #eceff3; }
.more-btn:active { transform: translateY(1px); }

.foot { max-width: 1280px; margin: 0 auto; padding: 0 24px 40px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.foot a { margin-left: 14px; color: var(--ink-2); }
.legal { max-width: 70ch; }
.legal h1 { margin: 16px 0 12px; }

@media (max-width: 1023px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .accounts #account-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); column-gap: 24px; }
}

@media (max-width: 720px) {
  .topbar-inner { padding: 0 16px; gap: 16px; }
  .who-name { display: none; }
  .who { display: none; }
  .ax { font-size: 12px; }
  .sections a { padding: 6px 7px; font-size: 13px; }
  .page { padding: 20px 14px 32px; }
  h1 { font-size: 22px; }
  .page-head { align-items: flex-start; }
  .panel { padding: 16px 16px 18px; }
  .big { font-size: 26px; }
  .pace { text-align: left; }
  .toolbar select { width: 100%; }
  .toolbar .field:not(.search) { flex: 1 1 140px; }
  .cat { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name amt" "bar bar" "status status"; }
  .cat-status { text-align: left; }
  .table-wrap { border: 0; border-radius: 0; }
  .ledger thead { display: none; }
  .ledger, .ledger tbody { display: block; }
  .ledger tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "m amt" "c d"; gap: 2px 12px; padding: 11px 0; border-bottom: 1px solid #eef0f3; }
  .ledger td { padding: 0; border: 0; }
  .ledger tbody tr:hover td { background: none; }
  .ledger .m { grid-area: m; }
  .ledger .r { grid-area: amt; }
  .ledger .c { grid-area: c; font-size: 13px; color: var(--muted); }
  .ledger .d { grid-area: d; width: auto; text-align: right; font-size: 13px; color: var(--muted); }
  .ledger .a { display: none; }
  .note { font-size: 12px; }
  .foot { padding: 0 14px 32px; }
  .foot a:first-child { margin-left: 0; }
}

@media (max-width: 360px) {
  .sections a:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

