/* The Ledger. A household's books on one screen.
   Light, cool paper; deep blue ink; one yellow highlighter for the thing to
   look at next; orange only for over plan and past due. Everything runs the
   full width of the window. Type is Red Hat Display for figures and headings,
   Red Hat Text for the rest, both on disk. */

@font-face { font-family: "Red Hat Display"; src: url("fonts/RedHatDisplay-latin.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }
@font-face { font-family: "Red Hat Text"; src: url("fonts/RedHatText-latin.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }

:root {
  --ink: #0A1A2F;            /* text, the top bar, the month strip */
  --ink-2: #2B3A52;          /* second line of a row: still dark, never washed out */
  --ink-3: #56647C;          /* the quietest text allowed; 5.9:1 on white */
  --paper: #F1F4F8;
  --card: #FFFFFF;
  --line: #DCE2EB;
  --line-2: #EAEEF4;
  --tint: #EDF1F7;           /* behind a line icon, a tag, a table group */
  --out: #1E63D8;            /* money out, and the one data color */
  --in: #12A37F;             /* money in */
  --in-ink: #0B7A5E;
  --track: #DDE4EE;          /* the plan, under the spend */
  --hi: #FFCB05;             /* the highlighter */
  --hi-soft: #FFF5CC;
  --warn: #D9480F;           /* over plan, past due */
  --warn-ink: #9A3412;
  --warn-soft: #FDEBE2;
  --pad: clamp(16px, 2.2vw, 44px);
  --gap: clamp(14px, 1.25vw, 24px);
  --r: 16px;
  --r-sm: 10px;
  --display: "Red Hat Display", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text: "Red Hat Text", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.45 var(--text); min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--out); text-decoration: none; }
a:hover { text-decoration: underline; }
b, strong { font-weight: 700; }
em { font-style: normal; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--out); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.flip { transform: rotate(180deg); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.soft { color: var(--ink-3); }
.late { color: var(--warn-ink); font-weight: 700; }
code { font: 500 14px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--tint); border-radius: 6px; padding: 2px 7px; }

/* ---------------------------------------------------------------- top bar */
.bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: clamp(12px, 2vw, 36px); min-height: 64px; padding: 0 var(--pad); background: var(--ink); color: #fff; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 800 21px/1 var(--display); letter-spacing: -.01em; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--hi); position: relative; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; left: 5px; right: 5px; height: 2.5px; border-radius: 2px; background: var(--ink); }
.brand-mark::before { top: 7px; }
.brand-mark::after { top: 12.5px; right: 9px; }
.nav { display: flex; align-items: stretch; gap: 2px; align-self: stretch; flex: 1; min-width: 0; }
.nav a { display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; color: #fff; font-weight: 500; font-size: 15.5px; opacity: .78; border-bottom: 3px solid transparent; border-top: 3px solid transparent; white-space: nowrap; }
.nav a:hover { opacity: 1; text-decoration: none; background: rgba(255,255,255,.06); }
.nav a[aria-current="page"] { opacity: 1; font-weight: 700; border-bottom-color: var(--hi); }
.nav .ic { width: 19px; height: 19px; }
.bar-end { display: flex; align-items: center; gap: 12px; }
.pill { background: var(--hi); color: var(--ink); font-weight: 700; font-size: 13px; padding: 5px 11px; border-radius: 99px; white-space: nowrap; }
.attn { display: flex; align-items: center; gap: 10px; padding: 12px var(--pad); background: var(--warn-soft); color: var(--warn-ink); font-weight: 500; }
.attn a { margin-left: auto; font-weight: 700; color: var(--warn-ink); text-decoration: underline; }

/* ---------------------------------------------------------------- page frame */
.page { flex: 1; padding: 0 var(--pad) var(--gap); display: grid; gap: var(--gap); align-content: start; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: clamp(18px, 2vw, 30px); }
.head h1 { font: 800 clamp(26px, 2.3vw, 38px)/1.1 var(--display); letter-spacing: -.02em; }
.head-ctl { display: flex; align-items: center; gap: 12px; }
.head-ctl .field { grid-auto-flow: column; align-items: center; gap: 10px; }
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; padding: 18px var(--pad) 28px; color: var(--ink-2); font-size: 14px; }
.foot span { display: inline-flex; align-items: center; gap: 7px; }
.foot .ic { width: 16px; height: 16px; }
.foot a { font-weight: 600; }
.flash { background: var(--hi-soft); border: 1px solid #EBD67A; border-radius: var(--r-sm); padding: 12px 16px; font-weight: 500; }

/* ---------------------------------------------------------------- controls */
.field { display: grid; gap: 6px; }
.field label { font-size: 13.5px; font-weight: 600; }
select, input[type="text"], input[type="search"], input[type="number"], input[type="date"] { height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); font-size: 15.5px; font-weight: 500; min-width: 0; }
select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230A1A2F' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; cursor: pointer; }
select:hover, input:hover { border-color: #B9C3D3; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); color: var(--ink); font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #B9C3D3; text-decoration: none; }
.btn .ic { width: 18px; height: 18px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #142A49; }
.btn.onbar { background: transparent; border-color: rgba(255,255,255,.32); color: #fff; height: 40px; }
.btn.onbar:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.6); }
.btn.icon { width: 44px; padding: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; height: 44px; font-weight: 500; font-size: 15px; cursor: pointer; white-space: nowrap; }
.check.small { height: auto; font-size: 13.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); margin: 0; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 14px; }
.filters .grow { flex: 1 1 150px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper input { width: 104px; text-align: center; font-weight: 700; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* ---------------------------------------------------------------- the picture beside a line */
.mark { display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 10px; overflow: hidden; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mark.pad img { padding: 5px; }
.mark.gen { background: var(--tint); box-shadow: none; color: var(--ink); }
.mark.sm { width: 26px; height: 26px; border-radius: 7px; }
.mark.sm.pad img { padding: 3px; }
.mark.sm .ic { width: 15px; height: 15px; }
.mark.lg { width: 46px; height: 46px; border-radius: 12px; }
.mark.lg .ic { width: 24px; height: 24px; }

/* ---------------------------------------------------------------- the month on a calendar */
.calcard { background: var(--card); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; }
.cal-top { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px clamp(16px, 2.4vw, 40px); padding: clamp(16px, 1.5vw, 24px) clamp(18px, 1.9vw, 30px); background: var(--ink); color: #fff; }
.hero-l { font-size: 15.5px; font-weight: 500; }
.hero-v { font: 800 clamp(38px, 3.4vw, 58px)/1 var(--display); letter-spacing: -.025em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.hero-v .c { font-size: .5em; font-weight: 700; margin-left: 2px; }
.hero-s { font-size: 16px; padding-bottom: 5px; }
.hero-s { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.hero-warn { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 9px; border-radius: 99px; background: var(--warn); color: #fff; font-size: 14.5px; font-weight: 700; white-space: nowrap; }
.hero-warn .ic { width: 16px; height: 16px; }
.hero-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.hero-form label { font-weight: 600; }
.hero-form input { width: 150px; height: 40px; color: var(--ink); }
.cal-ctl { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 18px; padding-bottom: 2px; }
.cal-key { display: flex; gap: 16px; font-size: 13.5px; font-weight: 600; }
.cal-key span { display: inline-flex; align-items: center; gap: 7px; }
.cal-key .k { width: 12px; height: 12px; border-radius: 4px; }
.cal-key .k.paid { background: rgba(255,255,255,.34); }
.cal-key .k.due { background: #fff; }
.cal-key .k.next { background: var(--hi); }
.cal-key .k.in { background: var(--in); }
.cal-h, .cal-w { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-h span { padding: 10px 12px; font-size: 13.5px; font-weight: 700; border-bottom: 1px solid var(--line); }
.cal-d { display: grid; gap: 4px; align-content: start; min-width: 0; min-height: 112px; padding: 7px 7px 10px; border-top: 1px solid var(--line-2); border-left: 1px solid var(--line-2); }
.cal-w > .cal-d:first-child { border-left: 0; }
.cal-h + .cal-w > * { border-top: 0; }
.cal-d.out { background: var(--paper); }
.cal.open .cal-d.past { background: #FAFBFD; }
.cal-dh { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 28px; }
.cal-n { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 99px; font: 700 14.5px/1 var(--display); font-variant-numeric: tabular-nums; }
/* the estimated checking balance at the end of the day: heavier on a day something moves it */
.cal-b { padding: 4px 7px; border-radius: 7px; font: 600 14.5px/1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; cursor: default; }
.cal-b.mv { font-weight: 800; background: var(--tint); }
.cal-b.neg { color: var(--warn-ink); }
.cal-b.neg.mv { background: var(--warn-soft); }
.cal-b:focus-visible { outline: 2px solid var(--out); outline-offset: 1px; }
.cal.open .cal-d.past .cal-n { color: var(--ink-3); }
.cal-d.today { box-shadow: inset 0 0 0 2px var(--hi); }
.cal-d.today .cal-n { background: var(--hi); font-weight: 800; }
.bill { all: unset; box-sizing: border-box; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; padding: 3px 9px 3px 3px; border-radius: 9px; background: var(--tint); font-size: 14px; line-height: 1.2; cursor: default; }
.bill .mark { box-shadow: none; }
.bill-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bill b { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.bill.paid, .bill.assumed { background: transparent; color: var(--ink-3); }
.bill.paid .mark, .bill.assumed .mark { opacity: .55; }
.bill.paid b, .bill.assumed b { font-weight: 600; }
/* a bill that goes on a card does not leave checking that day: an outline, not a fill */
.bill.oncard:not(.paid):not(.assumed) { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.bill.in { background: #E2F5EF; }
.bill.in b::before { content: "+"; }
.bill.next { background: var(--hi-soft); box-shadow: inset 0 0 0 1.5px var(--hi); }
.bill.late { background: var(--warn-soft); color: var(--warn-ink); }
.bill:hover, .bill:focus-visible { outline: 2px solid var(--out); outline-offset: 1px; }
.bill-more { padding-left: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
/* the calendar's own settings: a checking balance by hand, and the money that comes in each month */
.cal-top .pop-in { color: var(--ink); }
.pop-in.fc-pop { grid-template-columns: minmax(0, 1fr); width: min(480px, calc(100vw - 2 * var(--pad))); }
.fc-row { grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: end; }
.fc-row label { grid-column: 1 / -1; }
.pop-in.fc-pop .btn { grid-column: auto; }
.fc-h { font-size: 13.5px; font-weight: 700; margin-bottom: 6px; }
.fc-list { display: grid; gap: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.fc-in { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 12px; font-size: 15px; font-variant-numeric: tabular-nums; }
.fc-n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-add { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) 76px auto; gap: 8px; align-items: end; }
.btn.icon.sm { width: 34px; height: 34px; }
.btn.onbar.here { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.6); }

/* ---------------------------------------------------------------- the four numbers */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--gap); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px 18px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.kpi-h { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 600; }
.kpi-h .ic { width: 19px; height: 19px; }
.kpi-v { font: 800 clamp(30px, 2.5vw, 40px)/1.05 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-v .c { font-size: .52em; font-weight: 700; margin-left: 1px; }
.kpi-v .u { font: 600 15px/1 var(--text); letter-spacing: 0; margin-left: 6px; }
.kpi-s { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-height: 22px; font-size: 14.5px; font-weight: 500; color: var(--ink-2); }
.kpi-s > span { white-space: nowrap; }
.kpi-s .meter { flex: 1; min-width: 40px; }
.kpi.warn .kpi-v { color: var(--warn-ink); }
.kpis.slim .kpi { padding: 16px 20px 14px; gap: 6px; }
.kpis.slim .kpi-v { font-size: clamp(24px, 1.9vw, 30px); }
.spark { flex: none; overflow: visible; }
.spark path { fill: none; stroke: var(--out); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--out); stroke: var(--card); stroke-width: 2; }

/* ---------------------------------------------------------------- cards */
.cards { display: grid; gap: var(--gap); align-items: start; }
.cards.four { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: stretch; }
.cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
.cards.auto { grid-template-columns: repeat(auto-fill, minmax(min(460px, 100%), 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 24px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-h { padding: 20px 24px 6px; margin: 0; }
.card.narrow { max-width: 680px; }
.card.narrow p + p { margin-top: 14px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; min-height: 28px; }
.card-h h2, .grp-t h2, .inst-t h2 { font: 700 19px/1.2 var(--display); letter-spacing: -.01em; }
.more { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 14.5px; white-space: nowrap; }
.more .ic { width: 16px; height: 16px; }
.chip { font-size: 13.5px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--tint); white-space: nowrap; }
.card-f { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.card-f .grow { flex: 1; }
.card-f b { font-weight: 800; }
.card-f span:last-child { color: var(--ink-2); font-weight: 500; }
.empty { padding: 18px 0; color: var(--ink-2); font-size: 15.5px; }
td.empty { padding: 28px 24px; }

/* ---------------------------------------------------------------- a row: picture, name, amount */
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.rows > .row:first-child { border-top: 0; }
.rows.tight .row { padding: 10px 0; }
.row-t { display: grid; gap: 7px; min-width: 0; }
.row-n { font-size: 15.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.row-n a { color: var(--ink); }
.row-m { font-size: 14px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-v { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-v b { display: block; font-size: 16px; font-weight: 700; }
.row-v span { display: block; font-size: 13.5px; color: var(--ink-2); }
.row.idle .row-v b { color: var(--ink-3); font-weight: 600; }
.row.next { background: var(--hi-soft); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 12px; border-top-color: transparent; }
.row.next + .row { border-top-color: transparent; }
.tag { flex: none; font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--tint); color: var(--ink); white-space: nowrap; }
.tag.over { background: var(--warn-soft); color: var(--warn-ink); }
.mask { color: var(--ink-3); font-size: 13.5px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* spend against plan */
.meter { position: relative; display: block; height: 8px; border-radius: 99px; overflow: hidden; }
.meter i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 99px; }
.meter .track { background: var(--track); }
.meter .fill { background: var(--out); }
.meter .cap { background: var(--warn); border-radius: 0 99px 99px 0; }
.meter.over .fill { border-radius: 99px 0 0 99px; }
.meter.idle .track { background: var(--line-2); }
.meter.none .hatch { right: 0; background: repeating-linear-gradient(135deg, var(--track) 0 4px, transparent 4px 8px); }

/* budget: one ledger of every line, flowing across as many even columns as fit */
.ledger { column-width: 420px; column-gap: clamp(28px, 3vw, 56px); column-rule: 1px solid var(--line); padding-bottom: 6px; }
.lg { padding-bottom: 18px; }
.lg .row { break-inside: avoid; }
.grp-h { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px 14px; margin: 0 -14px 4px; border-radius: 12px; background: var(--tint); break-inside: avoid; break-after: avoid; }
.grp-h .mark.gen { background: #fff; }
.grp-t { display: grid; gap: 9px; min-width: 0; }
.grp-v { text-align: right; font-variant-numeric: tabular-nums; }
.grp-v b { display: block; font: 800 19px/1.1 var(--display); }
.grp-v span { font-size: 13.5px; color: var(--ink-2); }

/* net worth rows: the row itself opens its edit forms */
.inst { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding-bottom: 16px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.inst-t { display: grid; gap: 3px; min-width: 0; }
.acct { border-top: 1px solid var(--line-2); }
.rows > .acct:first-child { border-top: 0; }
.acct summary.row { grid-template-columns: auto minmax(0, 1fr) auto auto; border-top: 0; cursor: pointer; list-style: none; border-radius: 10px; }
.acct summary.row::-webkit-details-marker { display: none; }
.acct summary .row-n { display: block; }
.edit-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--ink-3); }
.edit-ic .ic { width: 17px; height: 17px; }
.acct summary:hover .edit-ic, .acct details[open] .edit-ic { background: var(--tint); color: var(--ink); }
.edit-in { display: grid; gap: 14px; padding: 4px 0 18px 52px; justify-items: start; }
.edit-in .field { width: 100%; column-gap: 8px; align-items: end; }
.edit-in .field label { grid-column: 1 / -1; }
.edit-in .field.three { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.edit-in .field.two { grid-template-columns: minmax(0, 1fr) auto; }

/* net worth: section headings, the add form that drops from its button, the edit forms */
.sect { font: 800 22px/1.2 var(--display); letter-spacing: -.01em; margin-top: 6px; }
.mason { column-width: 520px; column-gap: var(--gap); margin-bottom: calc(-1 * var(--gap)); }
.mason > .card { display: block; break-inside: avoid; margin-bottom: var(--gap); }
.mason + .sect { margin-top: 20px; }
.pop { position: relative; }
.pop > summary { list-style: none; }
.pop > summary::-webkit-details-marker { display: none; }
.pop-in { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: min(520px, calc(100vw - 2 * var(--pad))); display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 18px 48px rgba(10,26,47,.18); }
.pop-in .btn { grid-column: 1 / -1; }
.head-ctl .pop-in .field { grid-auto-flow: row; align-items: stretch; gap: 6px; }
.home-line { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.row-v b.soft { font-weight: 500; font-size: 14.5px; }

/* ---------------------------------------------------------------- tables */
.t-wrap { overflow-x: auto; }
.t { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.t th, .t td { padding: 13px 16px; text-align: left; vertical-align: middle; }
.t th:first-child, .t td:first-child { padding-left: 24px; }
.t th:last-child, .t td:last-child { padding-right: 24px; }
.t thead th { font-size: 13.5px; font-weight: 700; white-space: nowrap; border-bottom: 1px solid var(--line); background: var(--card); }
.t tbody td, .t tbody th { border-top: 1px solid var(--line-2); font-weight: 400; }
.t tbody tr:first-child td, .t tbody tr:first-child th { border-top: 0; }
.t th.num, .t td.num { text-align: right; }
.t tfoot th, .t tfoot td { border-top: 1px solid var(--line); font-weight: 700; }
.t .tot { font-weight: 700; }
.t tr.quiet td, .t tr.quiet th { color: var(--ink-3); }
.t tr.next td { background: var(--hi-soft); }
.t tr.todo td { background: var(--hi-soft); }
.card:not(.flush) .t th:first-child, .card:not(.flush) .t td:first-child { padding-left: 0; }
.card:not(.flush) .t th:last-child, .card:not(.flush) .t td:last-child { padding-right: 0; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who > div { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.who-n { font-weight: 600; }
.who-m { flex-basis: 100%; font-size: 13.5px; color: var(--ink-2); }
.tdate { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 500; }
.tacct { color: var(--ink-2); white-space: nowrap; }
.tcat form { display: flex; align-items: center; gap: 12px; }
.tcat select { height: 40px; font-size: 15px; width: min(260px, 100%); }
.t td.tamt { font-weight: 700; font-size: 16px; }
.t td.tamt.in { color: var(--in-ink); }
.t.tx td { padding-top: 10px; padding-bottom: 10px; }

/* the year: twelve months across, the line names pinned */
.t.wide { font-size: 15px; table-layout: fixed; min-width: 1180px; }
.t.wide thead th:first-child { width: 250px; }
.t.wide thead th:last-child { width: 110px; }
.t.wide th, .t.wide td { padding: 10px 12px; }
.t.wide tbody th, .t.wide tfoot th { position: sticky; left: 0; z-index: 1; background: var(--card); white-space: nowrap; font-weight: 500; padding-left: 24px; }
.t.wide tbody th > span { display: flex; align-items: center; gap: 10px; }
.t.wide thead th:first-child { position: sticky; left: 0; z-index: 2; }
.t.wide tr.band th { background: var(--tint); font-weight: 700; font-size: 14px; border-top: 0; position: static; }
.t.wide tr.band .mark.gen { background: #fff; }
.t.wide th.cur, .t.wide td.cur { background: var(--hi-soft); }
.t.wide tfoot th { font-weight: 700; }
.t-wrap[data-more="1"] { mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }

/* ---------------------------------------------------------------- charts */
.chart-wrap { position: relative; }
svg.chart { display: block; width: 100%; height: auto; max-height: 460px; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--ink-3); stroke-width: 1; }
.chart .tick { font: 500 12px var(--text); fill: var(--ink); font-variant-numeric: tabular-nums; }
.chart .tick.x { font-weight: 600; }
.chart .col-in { fill: var(--in); }
.chart .col-out { fill: var(--out); }
.chart .plan-tick { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.chart .band-hit { fill: transparent; }
.chart .colgrp:hover .band-hit, .chart .colgrp:focus .band-hit { fill: var(--tint); }
.chart .colgrp { outline: none; }
.chart .ln { fill: none; stroke: var(--out); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--out); opacity: .1; }
.chart .hdot { fill: var(--out); stroke: var(--card); stroke-width: 2; }
.chart .xhair { stroke: var(--ink-3); stroke-width: 1; }
.chart .endlabel { font: 700 13px var(--text); fill: var(--ink); }
.key { display: flex; gap: 14px; font-size: 13.5px; font-weight: 600; }
.key span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.sw.in { background: var(--in); }
.sw.out { background: var(--out); }
.sw.plan { height: 3px; width: 14px; background: var(--ink); border-radius: 2px; }
.card.stack { display: flex; flex-direction: column; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: auto 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.stats div { display: grid; gap: 2px; }
.stats dt { font-size: 13.5px; font-weight: 600; }
.stats dd { margin: 0; font: 800 20px/1.15 var(--display); font-variant-numeric: tabular-nums; }
.card.stack .chart-wrap { margin-bottom: 14px; }
.nw { white-space: nowrap; }
.tv { margin-top: 10px; }
.tv summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--out); width: max-content; }
.tv .t { margin-top: 8px; font-size: 14.5px; }
.tv .t th, .tv .t td { padding: 8px 10px; }
.tip { position: absolute; top: 4px; transform: translateX(-50%); z-index: 5; background: var(--ink); color: #fff; border-radius: 10px; padding: 9px 12px; font-size: 13.5px; line-height: 1.4; pointer-events: none; white-space: nowrap; box-shadow: 0 8px 24px rgba(10,26,47,.25); }
.tip b { display: block; font-weight: 700; }
.tip span { display: block; }
.tip .row { display: flex; justify-content: space-between; gap: 18px; padding: 0; border: 0; }
.tip .row span { display: inline-flex; align-items: center; gap: 6px; }
.tip .k { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.tip.float { position: fixed; top: 0; left: 0; transform: none; z-index: 60; }
.only-phone { display: none; }

/* ---------------------------------------------------------------- narrower windows */
@media (max-width: 1599px) {
  .cards.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1499px) {
  /* narrower days: the logo and the amount carry the bill; its name is in the hover */
  .bill-n { display: none; }
  .bill { grid-template-columns: auto minmax(0, 1fr); }
}
@media (max-width: 1239px) {
  .nav a { padding: 0 11px; }
  .nav a span { display: none; }
  .nav a[aria-current="page"] span { display: inline; }
  .cards.two { grid-template-columns: minmax(0, 1fr); }
  .cards.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 899px) {
  .cards.four, .cards.three { grid-template-columns: minmax(0, 1fr); }
  /* a narrow window gets the month as a list of the days that have a bill */
  .cal-h { display: none; }
  .cal-w { display: block; }
  .cal-d { display: none; }
  .cal-d.has, .cal-d.today { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; border-left: 0; border-top: 1px solid var(--line-2); padding: 8px 12px; }
  .cal-ctl { margin-left: 0; justify-content: flex-start; }
  .cal-top .pop-in { left: 0; right: auto; }
  .fc-add { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .bill-n { display: block; }
  .bill { grid-template-columns: auto minmax(0, 1fr) auto; }
}
@media (max-width: 720px) {
  .bar { flex-wrap: wrap; padding-top: 10px; row-gap: 6px; }
  .brand { flex: 1; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; min-height: 46px; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad); scrollbar-width: none; }
  .nav a span { display: inline; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 16px; }
  .kpi-v { font-size: 26px; }
  .kpi-s { white-space: normal; flex-wrap: wrap; gap: 6px 10px; }
  .card { padding: 18px 16px; }
  .filters .field { flex: 1 1 140px; }
  .ledger { column-width: auto; columns: 1; }
  .only-desk { display: none; }
  .only-phone { display: block; }
  .t th, .t td { padding: 11px 10px; }
  .t th:first-child, .t td:first-child { padding-left: 16px; }
  .t th:last-child, .t td:last-child { padding-right: 16px; }
  .t.tx thead { display: none; }
  .t.tx tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 16px; border-top: 1px solid var(--line-2); }
  .t.tx td { padding: 0 !important; border: 0 !important; }
  .t.tx td:nth-child(1) { grid-area: 1 / 1; font-size: 13.5px; color: var(--ink-2); }
  .t.tx td:nth-child(2) { grid-area: 2 / 1; }
  .t.tx td:nth-child(3) { display: none; }
  .t.tx td:nth-child(4) { grid-area: 3 / 1 / 4 / 3; }
  .t.tx td:nth-child(5) { grid-area: 2 / 2; align-self: center; }
  .tcat select { width: 100%; flex: 1; }
  .edit-in { padding-left: 0; }
  .edit-in .field.three { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .edit-in .field.three .btn { grid-column: 1 / -1; }
  .pop-in { grid-template-columns: 1fr; left: 0; right: auto; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .nav a, .bill, select, input { transition: background-color .15s, border-color .15s, opacity .15s; }
}
@media print {
  .bar, .foot, .head-ctl, .filters { display: none; }
  body { background: #fff; }
}

/* ---------------------------------------------------------------- statements uploaded by hand */
.hbar { display: block; height: 8px; margin-top: 7px; border-radius: 99px; background: var(--tint); overflow: hidden; }
.hbar i { display: block; height: 100%; border-radius: 99px; background: var(--out); }
a.row-n { color: inherit; }
.drop { display: grid; justify-items: center; gap: 8px; padding: clamp(28px, 4vw, 56px) 20px; background: var(--card); border: 2px dashed #B9C3D3; border-radius: 22px; text-align: center; }
.drop.over { border-color: var(--out); background: #F3F7FF; }
.drop.busy { opacity: .7; pointer-events: none; }
.drop-ic { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: var(--ink); color: #fff; }
.drop-ic .ic { width: 28px; height: 28px; }
.drop-t { font: 800 clamp(24px, 2.2vw, 32px)/1.15 var(--display); letter-spacing: -.015em; margin-top: 6px; }
.drop-s { font-size: 16px; color: var(--ink-2); margin-bottom: 10px; }
.fine { display: flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--ink-2); }
.fine .ic { width: 16px; height: 16px; }
.rv-list { display: grid; gap: var(--gap); }
.rv-h { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.rv-t { display: grid; gap: 3px; min-width: 0; margin-right: auto; }
.rv-t h2 { font: 700 20px/1.2 var(--display); letter-spacing: -.01em; }
.rv-t > span { font-size: 14.5px; color: var(--ink-2); }
.rv-n { display: flex; gap: 26px; }
.rv-n dt { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.rv-n dd { font: 700 18px/1.2 var(--display); font-variant-numeric: tabular-nums; }
.rv-ok, .rv-bad { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 9px; border-radius: 99px; font-size: 14.5px; font-weight: 700; white-space: nowrap; }
.rv-ok { background: #E2F5EF; color: var(--in-ink); }
.rv-bad { background: var(--warn-soft); color: var(--warn-ink); }
.rv-ok .ic, .rv-bad .ic { width: 17px; height: 17px; }
.rv-warn, .rv-note { margin-top: 14px; padding: 10px 14px; border-radius: var(--r-sm); font-weight: 500; }
.rv-warn { background: var(--warn-soft); color: var(--warn-ink); }
.rv-note { background: var(--tint); }
.rv-f { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; align-items: end; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.rv-rows { max-height: 420px; overflow: auto; }
@media (max-width: 720px) {
  .rv-n { gap: 16px; flex-wrap: wrap; }
  .fc-in { grid-template-columns: minmax(0, 1fr) auto auto; }
}

/* ---------------------------------------------------------------- insights */
.ins-grid { column-width: 460px; }
.ins { display: grid; gap: 12px; }
.ins-h { display: flex; align-items: center; gap: 12px; }
.ins-h h2 { font: 700 19px/1.2 var(--display); letter-spacing: -.01em; }
.ins-ic { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 11px; background: var(--tint); color: var(--ink); }
.ins-ic .ic { width: 20px; height: 20px; }
.ins-v { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.ins-v b { font: 800 clamp(30px, 2.4vw, 38px)/1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ins-v span { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.ins .rows { margin-top: 2px; }
.ins .row-m { font-size: 13.5px; color: var(--ink-2); }
.ins-more { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.ins-a { display: flex; align-items: flex-start; gap: 8px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--hi-soft); font-weight: 700; font-size: 15.5px; }
.ins-a .ic { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.ins-s { font-size: 13.5px; color: var(--ink-2); }
.ins.warn { border-color: #F3B79B; background: linear-gradient(var(--warn-soft), var(--card) 140px); margin-bottom: var(--gap); }
.ins.warn .ins-ic { background: var(--warn); color: #fff; }
.ins.warn .ins-v b { color: var(--warn-ink); }
.ins.info .ins-a { background: var(--tint); }
.gaps { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }
.gaps-h { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; margin-right: 4px; }
.gaps-h .ic { width: 18px; height: 18px; }
a.chip { color: var(--ink); }
a.chip:hover { background: #DDE4EE; text-decoration: none; }
/* the Overview's row of three */
.tips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: var(--gap); }
.tip-c { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "ic t" "ic v" "ic u"; column-gap: 14px; row-gap: 2px; align-items: center; padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); }
.tip-c:hover { border-color: #B9C3D3; text-decoration: none; }
.tip-c .ins-ic { grid-area: ic; width: 46px; height: 46px; border-radius: 13px; align-self: start; }
.tip-t { grid-area: t; font-weight: 700; font-size: 15px; }
.tip-v { grid-area: v; font: 800 26px/1.1 var(--display); letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.tip-u { grid-area: u; font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
.tip-all { display: flex; align-items: center; gap: 8px; padding: 0 22px; border-radius: var(--r); background: var(--ink); color: #fff; font-weight: 700; white-space: nowrap; }
.tip-all:hover { background: #142A49; text-decoration: none; }
.tip-all .ic { width: 18px; height: 18px; }
/* the New category dialog */
.dlg { padding: 0; border: 0; border-radius: var(--r); box-shadow: 0 24px 64px rgba(10,26,47,.28); width: min(440px, calc(100vw - 2 * var(--pad))); color: var(--ink); }
.dlg::backdrop { background: rgba(10,26,47,.42); }
.dlg-in { display: grid; gap: 14px; padding: 24px; }
.dlg-in h2 { font: 800 22px/1.2 var(--display); letter-spacing: -.01em; }
.dlg-b { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.rule-f { display: grid; gap: 14px; }
.rule-f .btn { justify-self: start; }
@media (max-width: 1099px) {
  .tips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tip-all { justify-content: center; min-height: 52px; }
}
@media (max-width: 720px) {
  .tips { grid-template-columns: minmax(0, 1fr); }
  .ins-grid { column-width: auto; columns: 1; }
}
.rows.mine .row { grid-template-columns: auto minmax(0, 1fr) auto auto; }

/* ---------------------------------------------------------------- the sign-in page (the website only) */
body.signin { min-height: 100vh; background: var(--ink); color: #fff; }
.si { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 22px; padding: 24px var(--pad); }
.si-card { width: min(420px, calc(100vw - 2 * var(--pad))); display: grid; gap: 14px; padding: 32px 30px; background: var(--card); color: var(--ink); border-radius: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.si-brand { color: var(--ink); margin-bottom: 8px; }
.si-card h1 { font: 800 34px/1.05 var(--display); letter-spacing: -.025em; }
.si-s { font-size: 16px; color: var(--ink-2); }
.si-go { height: 52px; font-size: 16px; margin-top: 6px; }
.si-go .g { background: #fff; border-radius: 50%; padding: 2px; width: 24px; height: 24px; }
.si-err { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn-ink); font-weight: 600; }
.si-err .ic { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.si-f { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; opacity: .8; }
.si-f .ic { width: 16px; height: 16px; }
.bar-end .signout { display: inline; }
