/* Eagles Budget: design direction E, Fjord theme (design/theme-fjord/) with Kontor's
   table-header rule on desktop. Change the tokens first. Font: IBM Plex Sans, SIL OFL
   (public/fonts/IBM-Plex-Sans-OFL.txt). */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700 800; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }
:root {
  --bg: #f1f4f6; --surface: #ffffff; --sunk: #e4eaee; --ink: #13232c; --muted: #4c5d67; --line: #cfd9df; --line2: #e2e9ed;
  --accent: #0b5c73; --accent-ink: #ffffff; --link: #0b5c73; --accent-soft: #dcebf0; --sel: #cde4eb;
  --in: #17703d; --in-soft: #ddf1e4; --late: #b3261e; --late-soft: #fbe5e3; --warn: #0b5c73;
  --bar: #0b5c73; --bar-soft: #d2dde3; --scrim: rgb(10 25 33 / .45); --shadow: rgb(10 30 40 / .14);
  --pick: #0b5c73; --pick-ink: #ffffff; --pick-line: #0b5c73; --pick-neg: #ffd2cc;
  --card-shadow: 0 1px 2px var(--shadow); --card-line: var(--line2);
  --r: 12px; --r-sm: 10px; --r-key: 12px; --r-lg: 18px; --r-pill: 10px;
  --font: "IBM Plex Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: var(--font); --font-num: var(--font);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d151a; --surface: #142028; --sunk: #1b2a33; --ink: #e3ecf0; --muted: #9db0ba; --line: #2a3c46; --line2: #1f303a;
    --accent: #6cc6dc; --accent-ink: #05222b; --link: #7fd1e5; --accent-soft: #123440; --sel: #163f4d;
    --in: #7fd99c; --in-soft: #123222; --late: #ff978c; --late-soft: #3d1d1b; --warn: #7fd1e5;
    --bar: #6cc6dc; --bar-soft: #2a3c46; --scrim: rgb(0 0 0 / .6); --shadow: rgb(0 0 0 / .5);
    --pick: #6cc6dc; --pick-ink: #05222b; --pick-line: #6cc6dc; --pick-neg: #8a1c14;
    --card-shadow: none; --card-line: var(--line);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0d151a; --surface: #142028; --sunk: #1b2a33; --ink: #e3ecf0; --muted: #9db0ba; --line: #2a3c46; --line2: #1f303a;
    --accent: #6cc6dc; --accent-ink: #05222b; --link: #7fd1e5; --accent-soft: #123440; --sel: #163f4d;
    --in: #7fd99c; --in-soft: #123222; --late: #ff978c; --late-soft: #3d1d1b; --warn: #7fd1e5;
    --bar: #6cc6dc; --bar-soft: #2a3c46; --scrim: rgb(0 0 0 / .6); --shadow: rgb(0 0 0 / .5);
    --pick: #6cc6dc; --pick-ink: #05222b; --pick-line: #6cc6dc; --pick-neg: #8a1c14;
    --card-shadow: none; --card-line: var(--line);
    color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
fieldset { min-width: 0; }
body { margin: 0; font: 16px/1.45 var(--font); background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; border-radius: 6px; }
h1, h2 { margin: 0; line-height: 1.2; } h1 { font-size: 1.2rem; } h2 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0 0 8px; }
.num, .amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt { font-weight: 600; text-align: right; }
.inpill { display: inline-block; color: var(--in); background: var(--in-soft); border-radius: var(--r-pill); padding: 0 8px; line-height: 1.6; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg, .amt.neg { color: var(--late); }
.muted { color: var(--muted); } .small { font-size: .86rem; } .strong { font-weight: 700; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd { font: 600 .72rem var(--font); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; color: var(--muted); background: var(--surface); }
.btn { min-height: 44px; padding: 0 16px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; justify-content: center; font-weight: 600; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.dark { background: var(--pick); color: var(--pick-ink); border-color: var(--pick-line); }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.btn kbd { background: transparent; border-color: currentColor; color: inherit; }
.icon-btn { width: 44px; height: 44px; border-radius: var(--r-pill); border: 0; background: var(--sunk); display: inline-grid; place-items: center; cursor: pointer; color: var(--ink); flex: none; text-decoration: none; padding: 0; }

/* shell */
.side { display: none; }
main { padding: 14px 16px 110px; max-width: 640px; margin: 0 auto; }
.tabs { position: fixed; inset: auto 0 0 0; background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding: 4px 6px max(6px, env(safe-area-inset-bottom)); z-index: 10; }
.tabs a { min-height: 52px; display: grid; place-items: center; align-content: center; gap: 1px; font-size: .74rem; font-weight: 600; color: var(--muted); text-decoration: none; position: relative; }
.tabs [aria-current="page"] { color: var(--ink); }
.tabs .add span { width: 60px; height: 46px; border-radius: var(--r); background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.tabs .dot { position: absolute; top: 4px; left: calc(50% + 6px); font-size: .66rem; background: var(--accent-soft); color: var(--warn); border-radius: var(--r-pill); padding: 0 5px; }
.top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; min-height: 44px; flex-wrap: wrap; }
.top h1 { flex: 1; }

/* cards and lists */
.hero { background: var(--surface); border-radius: var(--r); padding: 16px 18px; margin-bottom: 12px; border: 1px solid var(--line); }
.hero .label { font-weight: 600; color: var(--muted); font-size: .92rem; }
.hero .big { font-size: 2.4rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; margin: 2px 0 4px; display: block; }
.hero .big small, .hero .mid small { font-size: 1.1rem; font-weight: 600; }
.hero .mid { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; display: block; }
.hero .block + .block { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.track { height: 10px; border-radius: var(--r-pill); background: var(--bar-soft); overflow: hidden; margin: 10px 0 6px; position: relative; }
.track i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--bar); border-radius: var(--r-pill); }
.track b { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--late); }
.row2 { display: flex; justify-content: space-between; gap: 4px 10px; font-size: .86rem; color: var(--muted); flex-wrap: wrap; }
.numbtn { display: block; cursor: pointer; list-style: none; border-radius: 8px; }
.numbtn::-webkit-details-marker { display: none; }
.numbtn .label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.numbtn .q { white-space: nowrap; font-size: .76rem; font-weight: 700; color: var(--link); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0 7px; }
.explain-wrap .when-open, .explain-wrap[open] .when-closed { display: none; }
.explain-wrap[open] .when-open { display: inline; }
.explain { background: var(--sunk); border-radius: var(--r-sm); padding: 10px 12px; margin: 8px 0 4px; font-size: .9rem; }
.explain p { margin: 0 0 6px; } .explain p:last-child { margin: 6px 0 0; }
dl.wf { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; margin: 10px 0 0; padding-top: 10px; border-top: 1px dashed var(--line); font-size: .92rem; }
.explain dl.wf { border-top: 0; padding-top: 0; margin-top: 4px; }
.wf dt { color: var(--muted); } .wf dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wf .tot { font-weight: 800; color: var(--ink); border-top: 1px solid var(--line); padding-top: 4px; }
.strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0 0 12px; }
.strip a { min-height: 58px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); padding: 6px 8px; text-decoration: none; color: var(--ink); display: block; min-width: 0; }
.strip [aria-current="true"] { background: var(--pick); color: var(--pick-ink); border-color: var(--pick-line); }
.strip .m { font-weight: 700; display: block; font-size: .8rem; }
.strip .v { font-variant-numeric: tabular-nums; font-size: .86rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip [aria-current="true"] .neg { color: var(--pick-neg); }
.sec { margin: 18px 0 8px; display: flex; align-items: baseline; gap: 8px; } .sec h2 { flex: 1; }
.todo { display: grid; gap: 8px; }
.todo a, .todo button { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px 10px 10px; min-height: 64px; text-decoration: none; color: var(--ink); text-align: left; cursor: pointer; width: 100%; }
.todo .ic { width: 44px; height: 44px; border-radius: var(--r-key); display: grid; place-items: center; background: var(--accent-soft); color: var(--warn); }
.todo .ic.late { background: var(--late-soft); color: var(--late); } .todo .ic.in { background: var(--in-soft); color: var(--in); }
.todo .t { min-width: 0; } .todo .t strong { display: block; } .todo .t span { display: block; font-size: .86rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo .t strong .num { display: inline; color: inherit; font-size: inherit; }
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.list li { border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 10px 14px; min-height: 58px; text-decoration: none; color: inherit; }
.list a.li:hover { background: var(--bg); }
.list .cell { min-width: 0; }
.list .name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .name.link { color: var(--link); }
.list .sub { display: block; font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .r { text-align: right; }
.day { font-size: .8rem; font-weight: 700; color: var(--muted); margin: 14px 4px 6px; text-transform: uppercase; letter-spacing: .04em; }
.pill { display: inline-flex; align-items: center; gap: 3px; font-size: .74rem; font-weight: 700; padding: 0 7px; border-radius: var(--r-pill); background: var(--sunk); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.pill svg { width: 13px; height: 13px; }
.pill.paid { background: var(--in-soft); color: var(--in); } .pill.late { background: var(--late-soft); color: var(--late); } .pill.plan { background: var(--accent-soft); color: var(--warn); }
.empty { text-align: center; padding: 24px 12px; color: var(--muted); background: var(--surface); border-radius: var(--r); border: 1px dashed var(--line); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chipb { min-height: 44px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); white-space: nowrap; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; flex: none; }
.chipb svg { width: 18px; height: 18px; }
.chipb[aria-pressed="true"], .chipb.toggle:has(input:checked) { background: var(--pick); color: var(--pick-ink); border-color: var(--pick-line); }
.chipb.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chipb.toggle:has(input:focus-visible) { outline: 3px solid var(--link); outline-offset: 2px; }
.chipb.datepick { padding: 0 8px 0 12px; flex: 1 1 auto; min-width: 0; max-width: 13em; }
.chipb.datepick:has(input:focus-visible) { outline: 3px solid var(--link); outline-offset: 2px; }
.chipb.datepick input { border: 0; background: transparent; color: inherit; font: inherit; min-height: 40px; font-variant-numeric: tabular-nums; width: 100%; min-width: 0; }
.chipb.datepick input:focus { outline: none; }
.dates { align-items: center; flex-wrap: nowrap; overflow: visible; }
.dates:not(:has(input[name=dpick]:checked)) .datepick { background: var(--pick); color: var(--pick-ink); border-color: var(--pick-line); }
.entry .display .future { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.entry .display .future[hidden] { display: none; }
.cols > * { min-width: 0; }
.in { min-height: 46px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 12px; background: var(--surface); width: 100%; }
.in.r { text-align: right; font-variant-numeric: tabular-nums; }
.small-in { width: 7.5em; min-height: 40px; }
.lead { margin: -6px 0 8px; }
.signout { margin-top: 12px; }

/* keypad entry: full screen on phones, a side panel on desktop */
.entry { position: fixed; inset: 0; background: var(--bg); z-index: 30; display: none; padding: 8px 14px max(10px, env(safe-area-inset-bottom)); }
.entry.open { display: block; }
.entryform { display: flex; flex-direction: column; height: 100%; gap: 6px; }
.entry .bar { display: flex; align-items: center; gap: 8px; flex: none; }
.entry .fields { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 6px; padding: 2px 1px; }
/* Rows keep their natural height; when the panel is short the field area scrolls instead of clipping a row. */
.entry .fields > * { flex-shrink: 0; }
.entryform[data-kind="spend"] [data-for="in"], .entryform[data-kind="in"] [data-for="spend"] { display: none; }
.entryform[data-kind="spend"] .display .sign { display: none; }
.icon-btn.file { position: relative; overflow: hidden; }
.icon-btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.icon-btn.file .ok, .entryform.has-receipt .icon-btn.file .cam { display: none; }
.entryform.has-receipt .icon-btn.file .ok { display: grid; }
.display .rc { display: none; } .entryform.has-receipt .display .rc { display: block; }
.seg2 { display: flex; background: var(--sunk); border-radius: var(--r-pill); padding: 3px; flex: 1; max-width: 240px; margin: 0 auto; }
.seg2 button { flex: 1; min-height: 38px; border: 0; border-radius: var(--r-pill); background: transparent; font-weight: 700; cursor: pointer; color: var(--muted); }
.seg2 button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.display { text-align: center; padding: 4px 0; flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; min-height: 84px; }
.display .expr { font-size: .9rem; color: var(--muted); min-height: 1.3em; font-variant-numeric: tabular-nums; }
.display .val { font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.1; white-space: nowrap; }
.display .val small { font-size: 1.2rem; font-weight: 600; color: var(--muted); }
.display .err { color: var(--late); font-weight: 600; font-size: .9rem; min-height: 1.3em; }
.shopin input { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0 16px; background: var(--surface); }
.catgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; flex: none; }
.catgrid button, .catgrid label span { min-height: 44px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: .84rem; cursor: pointer; padding: 2px 4px; line-height: 1.15; display: grid; place-items: center; text-align: center; }
.catgrid label { position: relative; display: block; }
.catgrid label input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.catgrid button[aria-pressed="true"], .catgrid label input:checked + span { background: var(--pick); color: var(--pick-ink); border-color: var(--pick-line); }
.catgrid label input:focus-visible + span { outline: 3px solid var(--link); outline-offset: 2px; }
.keys { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, clamp(40px, 7.2vh, 54px)); gap: 6px; flex: none; }
.keys button { border: 0; border-radius: var(--r-key); background: var(--surface); font-size: 1.5rem; font-weight: 600; cursor: pointer; color: var(--ink); display: grid; place-items: center; touch-action: manipulation; }
.keys .op { background: var(--sunk); font-size: 1.2rem; }
.keys .save { grid-row: span 2; background: var(--accent); color: var(--accent-ink); font-size: 1.05rem; font-weight: 800; }
.entry .hint { margin: 0; flex: none; }
.segrow { display: flex; align-items: center; gap: 10px; flex: none; }
.segrow > span { font-size: .84rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.segrow .seg3 { flex: 1; }
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--r-pill); overflow: hidden; background: var(--surface); }
.seg3.n2 { grid-template-columns: repeat(2, 1fr); } .seg3.n4 { grid-template-columns: repeat(4, 1fr); }
.seg3 label { position: relative; text-align: center; }
.seg3 input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg3 span { display: grid; place-items: center; min-height: 44px; font-weight: 700; font-size: .9rem; border-left: 1px solid var(--line); }
.seg3 label:first-child span { border-left: 0; }
.seg3 input:checked + span { background: var(--pick); color: var(--pick-ink); box-shadow: inset 0 0 0 1px var(--pick-line); }
.seg3 input:focus-visible + span { outline: 3px solid var(--link); outline-offset: -3px; }
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 29; display: none; }
body:has(.entry.open) .scrim { display: block; }
body:has(.entry.open) { overflow: hidden; }

/* desktop table, popover, plan grid */
.sumstrip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); margin-bottom: 12px; overflow: hidden; }
.sumstrip div { padding: 8px 12px; border-left: 1px solid var(--line2); border-top: 1px solid var(--line2); min-width: 0; margin: 0 0 -1px -1px; }
.sumstrip .l { font-size: .76rem; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sumstrip .v { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.filters { margin-bottom: 8px; align-items: center; }
.fchip { min-height: 36px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); font-size: .86rem; font-weight: 600; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; white-space: nowrap; flex: none; }
.fchip[aria-pressed="true"] { background: var(--pick); color: var(--pick-ink); border-color: var(--pick-line); }
.fchip svg { width: 14px; height: 14px; margin-right: 5px; }
.filters .count { margin-left: auto; }
.mnav { display: flex; align-items: center; gap: 4px; }
.mnav a { width: 40px; height: 40px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; display: grid; place-items: center; color: var(--ink); }
.mnav span { min-width: 132px; text-align: center; font-weight: 700; }
.reg { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); font-size: .9rem; }
.reg th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); background: var(--sunk); position: sticky; top: 0; z-index: 1; }
.reg td { padding: 0 8px; height: 38px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.reg .r { text-align: right; } .reg .date { width: 70px; white-space: nowrap; }
.reg tr:focus { outline: none; }
.reg tr.focus td { background: var(--accent-soft); }
.reg tr.sel td { background: var(--sel); }
.reg tr.focus td:first-child { box-shadow: inset 3px 0 0 var(--link); }
.reg tr.grp td { height: 28px; background: var(--bg); font-size: .76rem; color: var(--muted); font-weight: 700; }
.reg .what { max-width: 0; width: 40%; } .reg .what > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reg .what small { color: var(--muted); font-size: .82rem; margin-left: 6px; }
.reg .whatlink { color: inherit; text-decoration: none; } .reg .whatlink:hover { text-decoration: underline; }
.reg input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.reg .cb { width: 34px; } .reg .cb label { display: grid; place-items: center; width: 34px; height: 38px; cursor: pointer; margin: 0 -8px; }
.catbtn { border: 0; background: none; padding: 3px 6px; border-radius: 6px; cursor: pointer; text-align: left; margin-left: -6px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catbtn:hover { background: var(--sunk); }
.catbtn.none { color: var(--warn); border: 1px dashed var(--warn); }
.st { font-size: .78rem; display: inline-flex; gap: 3px; align-items: center; color: var(--muted); white-space: nowrap; }
.st svg { width: 13px; height: 13px; } .st.plan { color: var(--warn); }
.bulk { position: sticky; bottom: 10px; margin-top: 10px; background: var(--ink); color: var(--bg); border-radius: var(--r-sm); padding: 8px 10px 8px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; z-index: 5; }
.bulk > span { flex: 1; }
.bulk .btn { background: var(--bg); color: var(--ink); border: 0; min-height: 36px; }
.pop { position: fixed; z-index: 45; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: 0 12px 40px var(--shadow); width: 280px; padding: 6px; display: none; }
.pop.open { display: block; } .pop.center { top: 14vh; left: 50%; transform: translateX(-50%); width: min(520px, calc(100vw - 24px)); }
.pop input { width: 100%; min-height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--bg); margin-bottom: 4px; }
.pop ul { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; }
.pop li button { width: 100%; text-align: left; min-height: 34px; border: 0; background: none; border-radius: 6px; padding: 0 10px; cursor: pointer; }
.pop li button.hi, .pop li button:hover { background: var(--accent-soft); }
.help { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; padding: 10px; font-size: .9rem; }
.pop .close { text-align: right; margin: 0 8px 8px; }
.gridwrap { overflow-x: auto; border-radius: var(--r-sm); border: 1px solid var(--line); }
.grid { border-collapse: separate; border-spacing: 0; background: var(--surface); font-size: .88rem; min-width: 760px; width: 100%; }
.grid th, .grid td { padding: 0 10px; height: 34px; border-bottom: 1px solid var(--line2); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.grid th:first-child, .grid td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; max-width: 260px; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--line2); }
.grid thead th { font-size: .78rem; color: var(--muted); font-weight: 700; background: var(--sunk); }
.grid tr.gsec td, .grid tr.gsec td:first-child { border-right: 0; background: var(--bg); font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); height: 30px; }
.grid .past { color: var(--muted); background: repeating-linear-gradient(135deg, transparent 0 6px, var(--line2) 6px 7px); }
.grid .now { box-shadow: inset 1px 0 0 var(--accent), inset -1px 0 0 var(--accent); }
.grid input { width: 104px; min-height: 30px; border: 1px solid transparent; border-radius: 6px; background: transparent; text-align: right; font: inherit; font-variant-numeric: tabular-nums; padding: 0 6px; }
.grid input:hover { border-color: var(--line); } .grid input:focus { border-color: var(--ink); background: var(--bg); outline: none; box-shadow: 0 0 0 2px var(--accent); }
.grid input.just { box-shadow: 0 0 0 2px var(--in); }
.grid input.bad, .list input.bad { box-shadow: 0 0 0 2px var(--late); }
.grid .tot td { font-weight: 800; border-top: 2px solid var(--line); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; justify-content: space-between; }
.evlist { margin-bottom: 12px; }
#toast { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r-pill); display: none; gap: 12px; align-items: center; z-index: 50; max-width: calc(100vw - 24px); font-weight: 600; }
#toast.show { display: flex; }
body:has(.entry.open) #toast { bottom: auto; top: 16px; }
.desk-only { display: none !important; }

@media (min-width: 900px) {
  body.app { display: grid; grid-template-columns: 228px minmax(0, 1fr); }
  .tabs { display: none; } .desk-only { display: revert !important; } .phone-only { display: none !important; }
  .side { display: flex; flex-direction: column; gap: 2px; padding: 18px 10px; position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); overflow-y: auto; }
  .side .brand { font-weight: 800; padding: 0 12px 12px; color: var(--ink); text-decoration: none; }
  .side .addbtn { margin: 0 4px 12px; }
  .side a:not(.btn), .side button.link { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: var(--r-pill); color: var(--ink); text-decoration: none; font-weight: 600; border: 0; background: none; cursor: pointer; font-size: .93rem; text-align: left; width: 100%; }
  .side a[aria-current="page"] { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
  .side .grow { flex: 1; } .side svg { width: 18px; height: 18px; flex: none; }
  main { max-width: 860px; width: 100%; padding: 20px 28px 40px; }
  main.wide { max-width: 1240px; }
  .entry { inset: 0 0 0 auto; width: 420px; border-left: 1px solid var(--line); background: var(--surface); padding: 18px 20px; }
  .entry .keys button, .entry .keys .op, .entry .catgrid button, .entry .catgrid label span, .entry .chipb, .entry .shopin input { background: var(--bg); }
  .entry .catgrid button[aria-pressed="true"], .entry .catgrid label input:checked + span, .entry .chipb.toggle:has(input:checked) { background: var(--pick); }
  .entry .keys .save { background: var(--accent); }
  .entry .seg2 button[aria-pressed="true"] { background: var(--bg); }
  .cols { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .sumstrip { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .sumstrip div { border-top: 0; }
  .sumstrip div:first-child { border-left: 0; }
  .top .keyhint { flex-basis: auto; }
  .reg th, .grid thead th { border-bottom: 2px solid var(--ink); }
  #toast { bottom: 24px; }
}
@media (max-height: 760px) {
  .display { min-height: 60px; flex-grow: 0; } .display .val { font-size: 2.4rem; }
  .keys { grid-template-rows: repeat(4, clamp(38px, 6.2vh, 54px)); }
  .entry .hint { display: none !important; }
}
@media (min-width: 900px) and (max-height: 760px) {
  .entry { padding: 12px 20px; }
  .entry .chipb, .entry .catgrid button, .entry .catgrid label span, .entry .seg3 span, .entry .shopin input { min-height: 38px; }
  .entry .bar .icon-btn { width: 40px; height: 40px; }
}
@media (max-width: 899px) { .sumstrip div:last-child { grid-column: 1 / -1; } }
@media (max-width: 360px) { .catgrid { grid-template-columns: repeat(3, 1fr); } .hero .big { font-size: 2rem; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Fjord theme layer: petrol for action and selection, soft hairline cards on cool mist, a tab indicator line */
h1, h2, .side .brand { font-family: var(--font-head); }
.hero .big, .hero .mid, .display .val { font-family: var(--font-num); }
.btn.dark { background: var(--accent-soft); color: var(--link); border-color: transparent; }
.tabs [aria-current="page"] { color: var(--link); }
.tabs a[aria-current="page"]:not(.add)::before { content: ""; position: absolute; top: -4px; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.tabs .add span { border-radius: 14px; }
.side a[aria-current="page"] { background: var(--accent-soft); color: var(--link); box-shadow: none !important; }
.side .brand .mark { display: inline-block; vertical-align: -1px; margin-right: 8px; width: 14px; height: 14px; border-radius: 4px; background: var(--accent); box-shadow: 4px 4px 0 var(--accent-soft); }
.grid thead th.now { color: var(--link); }
.reg tr.sel td { color: var(--ink); }
.bulk { background: var(--accent); color: var(--accent-ink); }
.bulk .btn { background: var(--surface); color: var(--ink); }
.bulk :focus-visible { outline-color: var(--accent-ink); }
.hero, .list, .todo a, .todo button, .strip a { box-shadow: var(--card-shadow); border-color: var(--card-line); }
.strip [aria-current="true"] { border-color: var(--pick-line); }
.hero .big { font-weight: 700; letter-spacing: -.025em; }
.hero .mid { font-weight: 700; }
.keys .save { font-weight: 700; font-size: 1.1rem; letter-spacing: .01em; }
.keys button { box-shadow: 0 1px 0 var(--line); }
.keys .save { box-shadow: none; }
.todo .ic { border-radius: 10px; }
.day { letter-spacing: .07em; }

/* older pages (bills, events, funds, owed, reports, bank check, entry details), on the same tokens */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 16px; }
.card h1 { margin: 0 0 .5rem; font-size: 1.2rem; }
.card h2 { margin: 0 0 .5rem; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card > h2:not(:first-child) { margin-top: 1.25rem; }
main > h1 { margin: 0 0 12px; }
.card.narrow { max-width: 360px; margin: 10vh auto; }
.total { font-weight: 600; }
.note, .card .empty, main > .empty { color: var(--muted); font-size: .875rem; margin: .5rem 0 0; }
.card .empty { text-align: left; padding: 0; background: none; border: 0; }
.error { color: var(--late); font-weight: 600; }
.months { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.months h1 { margin: 0; }
.months a { font-size: 1.75rem; text-decoration: none; padding: 4px 14px; }
.summary .big { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.5rem; font-weight: 600; margin-bottom: .5rem; }
.summary .big span:first-child { font-size: 1rem; font-weight: 500; color: var(--muted); }
.card dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; }
.card dt { color: var(--muted); }
.card dd { margin: 0; text-align: right; }
details.cat { border-top: 1px solid var(--line); }
.card details { border-top: 1px solid var(--line); }
.card details summary { display: flex; justify-content: space-between; padding: 10px 0; cursor: pointer; list-style: none; font-weight: 500; }
.card details summary::-webkit-details-marker { display: none; }
.card details summary > span:first-child::before { content: "▸ "; color: var(--muted); }
.card details[open] summary > span:first-child::before { content: "▾ "; }
ul.items, ul.lines, ul.receipts { list-style: none; margin: 0; padding: 0; }
ul.items li a { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "what amt" "when amt"; gap: 0 12px; padding: 8px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); min-height: 44px; }
ul.items .what { grid-area: what; overflow-wrap: anywhere; }
ul.items .when { grid-area: when; color: var(--muted); font-size: .8125rem; }
ul.items .amt { grid-area: amt; align-self: center; }
ul.lines li { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--line); }
ul.receipts { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 16px; }
ul.receipts img { width: 100%; height: 120px; object-fit: cover; border-radius: 8px; display: block; }
ul.receipts span { font-size: .8125rem; color: var(--muted); overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: .6875rem; padding: 1px 6px; border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.badge.planned { background: var(--accent-soft); color: var(--warn); border-color: transparent; }
.card label { display: block; margin-bottom: 12px; font-weight: 600; }
.card input, .card select, .card textarea { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; min-height: 44px; }
.card input[type="file"] { padding: 8px; }
.card label.check, .card fieldset.choice label { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.card label.check input, .card fieldset.choice input, .card fieldset.months input { width: auto; min-height: 0; margin: 0; }
.card fieldset { border: 0; padding: 0; margin: 0 0 12px; }
.card legend { font-weight: 600; margin-bottom: 4px; }
.card button { padding: 10px 16px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-height: 44px; cursor: pointer; font-weight: 600; }
.card button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); width: 100%; }
.card button.danger { color: var(--late); }
.card button.link { background: none; border: 0; color: var(--muted); padding: 4px 8px; min-height: 32px; }
.actions form { margin-bottom: 8px; }
form.inline { display: flex; gap: 8px; align-items: center; }
form.inline input { margin: 0; }
.kindtabs { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; }
.kindtabs a { padding: 8px 14px; font-size: .9375rem; border-radius: var(--r-pill); text-decoration: none; color: var(--ink); border: 1px solid var(--line); background: var(--surface); white-space: nowrap; font-weight: 600; }
.kindtabs a[aria-current="page"] { background: var(--pick); color: var(--pick-ink); border-color: var(--pick-line); }
.table-wrap { overflow-x: auto; }
table.numbers { border-collapse: collapse; width: 100%; font-size: .9375rem; }
table.numbers th, table.numbers td { padding: 6px 8px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.numbers th:first-child { text-align: left; font-weight: 400; color: var(--muted); white-space: normal; }
table.numbers thead th { border-top: 0; font-weight: 600; }
table.numbers tr.strong th, table.numbers tr.strong td { font-weight: 600; color: var(--ink); }
.card fieldset.months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.card fieldset.months label { display: flex; gap: 6px; align-items: center; font-weight: 400; margin: 0; min-height: 44px; }
ul.checks { list-style: none; margin: 0 0 12px; padding: 0; }
ul.checks label.check { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); margin: 0; min-height: 44px; }
ul.checks .when { display: block; color: var(--muted); font-size: .8125rem; }
.pre { white-space: pre-wrap; }
.guest-counts { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
form.inline-mini { display: inline; }
.guest-form { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 8px; align-items: end; margin-top: 12px; }
.guest-form label { margin: 0; font-size: .875rem; }
.guest-form button { grid-column: 1 / -1; }
@media (max-width: 480px) { .guest-form { grid-template-columns: repeat(3, 1fr); } .guest-form label:first-child { grid-column: 1 / -1; } }
