:root {
  /* Apple system colours: grouped background, labels, fills and separators */
  --bg: #f2f2f7; --card: #fff; --raised: #fff; --ink: #000; --muted: rgb(60 60 67 / .6); --line: rgb(120 120 128 / .16); --sep: rgb(60 60 67 / .22); --field: rgb(118 118 128 / .12);
  --accent: #1f8a3c; --accent-soft: rgb(52 199 89 / .15); --on-accent: #fff;
  --good: #1f8a3c; --good-fill: #34c759; --warn: #b25000; --warn-fill: #ff9500; --warn-soft: rgb(255 149 0 / .14);
  --bad: #d70015; --bad-fill: #ff3b30; --bad-soft: rgb(255 59 48 / .12);
  --s1: #007aff; --s2: #ff9500; --s3: #30b0c7; --radius: 22px; --shadow: none;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000; --card: #1c1c1e; --raised: #2c2c2e; --ink: #fff; --muted: rgb(235 235 245 / .6); --line: rgb(120 120 128 / .3); --sep: rgb(84 84 88 / .6); --field: rgb(118 118 128 / .24);
    --accent: #30d158; --accent-soft: rgb(48 209 88 / .18); --on-accent: #fff;
    --good: #30d158; --good-fill: #30d158; --warn: #ff9f0a; --warn-fill: #ff9f0a; --warn-soft: rgb(255 159 10 / .18);
    --bad: #ff453a; --bad-fill: #ff453a; --bad-soft: rgb(255 69 58 / .18);
    --s1: #0a84ff; --s2: #ff9f0a; --s3: #40c8e0; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
main { max-width: 640px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); }
h1 { font-size: 28px; letter-spacing: -.02em; margin: 8px 0 16px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 4px 8px; font-weight: 600; }
h3 { margin: 0 0 4px; font-size: 17px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.hero { padding: 20px; }
.hero .big { font-size: 40px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin: 4px 0; }
.row { display: flex; align-items: center; gap: 12px; }
.row > .grow { flex: 1; min-width: 0; }
.between { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .card { margin: 0; }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.bar.warn > i { background: var(--warn); }
.bar.over > i { background: var(--bad); }

.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; box-shadow: var(--shadow); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; color: inherit; font: inherit; text-align: left; }
.item:first-child { border-top: 0; }
button.item { cursor: pointer; border-radius: 0; font-weight: inherit; }
button.item:active { background: var(--accent-soft); }
.item .grow { flex: 1; min-width: 0; }
.item .sub { font-size: 13px; color: var(--muted); }
.date-h { font-size: 13px; color: var(--muted); padding: 14px 4px 6px; font-weight: 600; }

.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.plain { background: var(--line); color: var(--muted); }

button { font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 12px 16px; background: var(--accent); color: var(--on-accent); cursor: pointer; }
button.secondary { background: var(--accent-soft); color: var(--accent); }
button.ghost { background: transparent; color: var(--accent); padding: 8px; }
button.danger { background: var(--bad-soft); color: var(--bad); }
button.block { width: 100%; }
button:disabled { opacity: .5; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: 100%; }
textarea { min-height: 110px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; font-weight: 600; }
.check { display: flex; gap: 10px; align-items: center; color: var(--ink); font-weight: 500; font-size: 15px; }
.check input { width: 20px; height: 20px; }
.stack > * + * { margin-top: 10px; }

.month { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.month button { background: transparent; color: var(--accent); font-size: 22px; padding: 4px 14px; }
.month strong { font-size: 17px; }

nav#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px calc(4px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) calc(4px + env(safe-area-inset-left)); z-index: 5;
}
nav#tabs button { background: none; color: var(--muted); font-size: 12px; padding: 8px 4px; flex: 1; border-radius: 10px; }
nav#tabs button[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

#sheet { position: fixed; inset: 0; background: rgb(0 0 0 / .35); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
#sheet[hidden] { display: none; }
.sheet-card { background: var(--card); width: 100%; max-width: 640px; border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 88vh; overflow: auto; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 20; max-width: calc(100% - 32px); }
.notice { background: var(--warn-soft); color: var(--ink); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 12px; }
.notice.bad { background: var(--bad-soft); }
.center { text-align: center; }
.lock { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; }
.budget-input { width: 96px; text-align: right; padding: 6px 8px; }
ol.steps { padding-left: 20px; margin: 0 0 8px; } ol.steps li { margin: 6px 0; }
a { color: var(--accent); }

.secret { -webkit-text-security: disc; text-security: disc; }
nav#tabs[hidden] { display: none; }

/* ---- v2 ---- */
hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.hint { margin: -2px 4px 8px; }
.strike { text-decoration: line-through; }
h2.between { align-items: center; }
h2 .num { text-transform: none; letter-spacing: 0; font-weight: 500; }
.back { padding: 4px 0; margin-bottom: -4px; font-weight: 500; }
.linklike { background: none; color: inherit; padding: 0; font-weight: 500; border-radius: 4px; text-align: left; }
.as-button { display: block; width: 100%; padding: 0; text-align: left; color: inherit; font: inherit; font-weight: inherit; cursor: pointer; }
button.card.as-button { padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
button.list.as-button { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.as-button:active { background: var(--accent-soft); }
a.item { text-decoration: none; }
label.item { margin: 0; font-size: inherit; font-weight: inherit; color: inherit; cursor: pointer; }
.item input[type=checkbox] { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.badge { flex: none; width: 22px; height: 22px; border-radius: 99px; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--line); color: var(--muted); font-style: italic; font-family: Georgia, serif; }
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; background: none; color: var(--muted); padding: 8px; border-radius: 9px; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.split-row { margin-top: 8px; gap: 8px; }
.split-amt { width: 96px; text-align: right; flex: none; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; text-overflow: ellipsis; }
input[type=date] { min-height: 46px; }
input[type=checkbox] { accent-color: var(--accent); }

.chart { width: 100%; height: auto; display: block; margin-top: 8px; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart path.s1, .chart .dot.s1 { fill: var(--s1); } .chart path.s2, .chart .dot.s2 { fill: var(--s2); }
.chart .line { fill: none !important; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s1 { stroke: var(--s1); } .chart .line.s2 { stroke: var(--s2); }
.chart .line.muted-line { stroke: var(--muted); stroke-dasharray: 3 4; } .chart .dot.muted-line { fill: var(--muted); }
.chart .dot { stroke: var(--card); stroke-width: 2; }
.chart .refline { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .cross { stroke: var(--muted); stroke-width: 1; }
.chart-wrap { position: relative; }
.chart-tip { position: absolute; top: 0; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 12px; display: flex; gap: 10px; align-items: center; pointer-events: none; }
.chart-tip[hidden] { display: none; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.sw.s1 { background: var(--s1); } .sw.s2 { background: var(--s2); } .sw.muted-line { background: var(--muted); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.table th { color: var(--muted); font-weight: 600; text-align: right; padding: 6px 4px; }
.table td { padding: 7px 4px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
.table td:first-child, .table th:first-child { text-align: left; }
.scroll-x { overflow-x: auto; }
@media (min-width: 700px) and (max-width: 899px) { nav#tabs { left: 50%; right: auto; transform: translateX(-50%); width: 640px; border: 1px solid var(--line); border-radius: 18px; bottom: 12px; } }
.chart [hidden] { display: none; }
.acct { display: inline-flex; align-items: center; gap: 5px; vertical-align: middle; max-width: 100%; }
.bank { flex: none; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 5px; color: #fff; font-size: 9.5px; font-weight: 700; letter-spacing: .02em; display: inline-grid; place-items: center; line-height: 1; }
.acct-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-num { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.item .sub .chip { vertical-align: middle; }
.meta { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; }
.meta .chip { flex: none; }
.meta .acct { min-width: 64px; flex: 0 1 auto; }
.meta .rest { flex: 0 1000 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.bank-img { flex: none; width: 18px; height: 18px; border-radius: 5px; object-fit: contain; background: #fff; display: inline-block; vertical-align: middle; }

/* ---- desktop / wide web view ---- */
.desk-only { display: none !important; }
.dash > section > h2:first-child { margin-top: 24px; }
@media (min-width: 900px) {
  .desk-only { display: revert !important; }
  div.desk-only { display: flex !important; }
  .phone-only { display: none !important; }
  body { padding: 0 0 0 232px; }
  main { max-width: 1120px; padding: max(28px, calc(12px + env(safe-area-inset-top))) max(36px, env(safe-area-inset-right)) 48px 36px; }
  nav#tabs {
    top: 0; bottom: 0; left: 0; right: auto; width: 232px; flex-direction: column; justify-content: flex-start; gap: 2px;
    padding: max(20px, calc(8px + env(safe-area-inset-top))) 12px 20px; border-top: 0; border-right: 1px solid var(--line); background: var(--card); backdrop-filter: none; overflow-y: auto;
  }
  nav#tabs button { flex: none; text-align: left; font-size: 15px; padding: 10px 12px; font-weight: 500; }
  nav#tabs button:hover { background: var(--bg); }
  nav#tabs button[aria-current="page"] { font-weight: 650; background: var(--accent-soft); }
  .brand { align-items: center; gap: 10px; font-size: 20px; font-weight: 700; letter-spacing: -.02em; padding: 0 10px 18px; }
  .nav-gap { height: 1px; background: var(--line); margin: 10px 8px; }
  .back { display: none; }
  h1 { font-size: 32px; margin-top: 0; }
  .month { justify-content: flex-start; gap: 8px; margin-bottom: 16px; }
  .month strong { font-size: 22px; min-width: 190px; text-align: center; }
  .lock { max-width: 420px; margin: 0 auto; }

  /* pages flow into two columns; sections stay whole */
  .dash { columns: 2; column-gap: 28px; }
  .dash > section { break-inside: avoid; padding-top: 20px; }
  .dash > section > h2:first-child { margin-top: 0; }
  .dash { margin-top: -8px; }
  main:has(.date-h) { max-width: 860px; }          /* activity reads best as one column */
  main > .card.hero { display: grid; grid-template-columns: auto 1fr; column-gap: 32px; align-items: center; padding: 24px 28px; }
  main > .card.hero > .big { grid-row: span 1; font-size: 48px; }
  main > .card.hero > * { grid-column: 1; }
  main > .card.hero > .bar { grid-column: 2; grid-row: 1 / span 3; margin: 0; height: 12px; }
  .item, button.item { padding: 11px 18px; }
  button.item:hover, .as-button:hover, a.item:hover { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
  button:not(.item):not(.as-button):not(.ghost):not(.linklike):hover { filter: brightness(1.06); }
  .linklike:hover { text-decoration: underline; }

  /* sheets become centered dialogs */
  #sheet { align-items: center; padding: 24px; }
  .sheet-card { max-width: 520px; border-radius: 20px; padding: 24px; box-shadow: 0 20px 60px rgb(0 0 0 / .25); }
  #toast { bottom: 28px; left: calc(50% + 116px); }
  .scroll-x { overflow-x: visible; }
}
@media (min-width: 1500px) { main { max-width: 1400px; } .dash { columns: 3; } }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: var(--line); padding: 1px 5px; border-radius: 5px; }
.stack-bar { display: flex; gap: 2px; height: 14px; margin: 6px 0 14px; }
.stack-bar i { display: block; height: 100%; border-radius: 4px; min-width: 0; }
.stack-bar .s1, .sw.s3, .stack-bar .s3 { background: var(--s3); } .stack-bar .s1 { background: var(--s1); } .stack-bar .s2 { background: var(--s2); }
.table td:first-child { white-space: normal; }
.seg.wrap { flex-wrap: wrap; } .seg.wrap button { flex: 1 0 auto; padding: 8px 10px; font-size: 14px; }
.item.dim > :not(.inc) { opacity: .45; }
.stat .sub { margin-top: 2px; }
input[type=range] { padding: 0; border: 0; background: transparent; height: 32px; accent-color: var(--accent); width: 100%; }
input[type=range]:focus { outline: none; } input[type=range]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.row.wrap { flex-wrap: wrap; gap: 8px; } .row.wrap button { padding: 8px 12px; font-size: 14px; }
.card.sticky { position: sticky; top: calc(8px + env(safe-area-inset-top)); z-index: 4; box-shadow: 0 6px 20px rgb(0 0 0 / .12); }
@media (min-width: 900px) { .back.always { display: inline-block; } }
.chart path.faded { opacity: .45; }
.tick { flex: none; width: 22px; height: 22px; border-radius: 99px; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--on-accent); }
.item.picked .tick { background: var(--accent); border-color: var(--accent); }
.item.picked { background: var(--accent-soft); }
.bulkbar { position: sticky; bottom: calc(84px + env(safe-area-inset-bottom)); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: 0 8px 28px rgb(0 0 0 / .22); z-index: 4; margin-top: 12px; }
.bulkbar button.secondary { padding: 10px 12px; font-size: 14px; white-space: nowrap; }
@media (min-width: 900px) { .bulkbar { bottom: 16px; } }
.kind { font-size: 10.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; margin-left: 4px; vertical-align: 1px; }
.kind.pin { color: var(--accent); border-color: var(--accent); }
.tick.on { background: var(--accent); border-color: var(--accent); }
.tick { color: var(--muted); } .tick.on, .item.picked .tick { color: var(--on-accent); }
.card.guide { border-color: var(--accent); }
details.card summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.card summary::after { content: '+'; color: var(--muted); font-size: 20px; line-height: 1; }
details.card[open] summary::after { content: '−'; }
details.card summary::-webkit-details-marker { display: none; }
button.item:disabled { opacity: 1; cursor: default; }
.small-btn { padding: 7px 10px; font-size: 13px; flex: none; }
@media (min-width: 900px) { .chart { max-width: 640px; } .chart-wrap { max-width: 640px; } }
.budget-input.pinned { border-color: var(--accent); }
.seg button { font-size: 14px; }
#offline { position: sticky; top: 0; z-index: 6; background: var(--warn-soft); color: var(--ink); font-size: 13px; text-align: center; padding: calc(6px + env(safe-area-inset-top)) 12px 6px; }
#offline + main { padding-top: 12px; }
@media (display-mode: standalone) {
  html { overscroll-behavior-y: none; }
  nav button, .seg button, .item, .card.as-button { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; user-select: none; }
}

/* Liquid Glass tab bar (phones and small tablets): a floating capsule of clear, lightly frosted glass that the page shows
   through, with a bright rim where light catches the edge. Colour is kept for the selected tab only. */
@media (max-width: 899px) {
  nav#tabs {
    --rim: rgb(255 255 255 / .5); --rim-soft: rgb(255 255 255 / .14); --tint: color-mix(in srgb, var(--card) 34%, transparent);
    border: 0; border-radius: 999px; padding: 5px; gap: 2px;
    background:
      radial-gradient(120% 90% at 18% -10%, rgb(255 255 255 / .22), transparent 55%),
      radial-gradient(90% 70% at 85% 115%, rgb(255 255 255 / .1), transparent 60%),
      var(--tint);
    -webkit-backdrop-filter: blur(14px) saturate(190%) brightness(1.08); backdrop-filter: blur(14px) saturate(190%) brightness(1.08);
    box-shadow:
      inset 0 0 0 1px var(--rim-soft),
      inset 1.5px 1.5px 1px -1px var(--rim), inset -1.5px -1.5px 1px -1px rgb(255 255 255 / .28),
      inset 0 0 14px rgb(255 255 255 / .06),
      0 10px 30px rgb(0 0 0 / .26), 0 1px 3px rgb(0 0 0 / .18);
    transition: transform .25s cubic-bezier(.3, 1.4, .5, 1);
  }
  nav#tabs button { color: var(--ink); font-weight: 600; border-radius: 999px; transition: transform .2s cubic-bezier(.3, 1.6, .5, 1), background .2s; }
  nav#tabs button:active { transform: scale(.92); }
  nav#tabs button[aria-current="page"] {
    color: var(--accent); background: rgb(255 255 255 / .13);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / .1), inset 1px 1px 1px -.5px rgb(255 255 255 / .45), 0 1px 4px rgb(0 0 0 / .12);
  }
}
@media (max-width: 899px) and (prefers-color-scheme: light) {
  nav#tabs { --rim: rgb(255 255 255 / .95); --rim-soft: rgb(0 0 0 / .06); --tint: color-mix(in srgb, var(--card) 28%, transparent);
    box-shadow: inset 0 0 0 1px var(--rim-soft), inset 1.5px 1.5px 1px -1px var(--rim), inset -1.5px -1.5px 1px -1px rgb(255 255 255 / .7), 0 10px 28px rgb(0 0 0 / .13), 0 1px 3px rgb(0 0 0 / .08); }
  nav#tabs button[aria-current="page"] { background: rgb(0 0 0 / .06); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .04), inset 1px 1px 1px -.5px rgb(255 255 255 / .9); }
}
/* along the bottom it floats clear of the edges */
@media (max-width: 699px) {
  nav#tabs { left: 12px; right: 12px; bottom: max(10px, calc(env(safe-area-inset-bottom) - 10px)); }
}
/* Side rail: on a phone with a status column down one edge, the capsule turns vertical and sits inside that column. */
@media (max-width: 899px) {
  html.rail body { padding-bottom: env(safe-area-inset-bottom); }
  html.rail main { padding-right: max(16px, var(--side)); }
  html.rail.rail-left main { padding-right: 16px; padding-left: max(16px, var(--side)); }
  html.rail nav#tabs {
    --w: min(76px, calc(var(--side) - 14px));
    left: auto; right: calc((var(--side) - var(--w)) / 2); top: auto; bottom: calc(18px + env(safe-area-inset-bottom)); width: var(--w); transform: none;
    flex-direction: column; justify-content: flex-start; gap: 4px; padding: 6px; border-radius: 34px;
  }
  html.rail.rail-left nav#tabs { right: auto; left: calc((var(--side) - var(--w)) / 2); }
  html.rail nav#tabs button { flex: none; padding: 14px 2px; font-size: 11px; border-radius: 28px; }
  html.rail #toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
  html.rail .bulkbar { bottom: calc(16px + env(safe-area-inset-bottom)); }
  /* floating: the same capsule over the page's right edge, for phones that do not let the app into their status column */
  html.rail.float body { padding-bottom: 280px; }
  html.rail.float main { padding-right: 16px; }
  html.rail.float nav#tabs { --w: 64px; right: 8px; bottom: calc(14px + env(safe-area-inset-bottom)); }
  html.rail.float nav#tabs button { padding: 13px 0; font-size: 10.5px; }
}

/* =====================================================================================================
   Apple look. System colours and type, grouped inset lists with hairline separators, capsule controls,
   rounded numerals for money, no borders or drop shadows on content.
   ===================================================================================================== */
body { font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", sans-serif; letter-spacing: -.01em; }
h1 { font-size: 34px; font-weight: 700; letter-spacing: -.022em; line-height: 1.12; margin: 6px 0 14px; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; text-transform: none; color: var(--ink); margin: 30px 4px 10px; line-height: 1.2; }
h2 .num, h2 .muted { font-size: 15px; font-weight: 400; color: var(--muted); letter-spacing: -.01em; }
h2 .num.neg { color: var(--bad); }
h3 { font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.small { font-size: 13px; letter-spacing: 0; }
.hint { margin: -4px 4px 10px; }
.big, .stat .value { font-family: var(--rounded); }
.hero .big { font-size: 48px; font-weight: 700; letter-spacing: -.02em; }
.stat .value { font-size: 24px; font-weight: 600; }
.date-h { font-size: 15px; font-weight: 600; color: var(--muted); padding: 18px 4px 8px; }

.card, .list, button.card.as-button, button.list.as-button { border: 0; box-shadow: none; border-radius: var(--radius); }
.card { padding: 18px; }
.hero { padding: 22px; }
.card.guide { box-shadow: inset 0 0 0 1.5px var(--accent); }
.card.sticky { box-shadow: 0 8px 24px rgb(0 0 0 / .14); }
hr { border-top: .5px solid var(--sep); }

/* grouped list rows: 44pt tall, separator inset to the text */
.item { position: relative; border-top: 0; padding: 11px 16px; min-height: 44px; }
.item:not(:first-child)::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--sep); }
.item .sub { font-size: 13px; letter-spacing: 0; margin-top: 1px; }
button.item:active, .as-button:active { background: var(--line); }
.item.picked { background: var(--accent-soft); }

.bar { height: 6px; background: var(--line); }
.bar > i { background: var(--good-fill); }
.bar.warn > i { background: var(--warn-fill); }
.bar.over > i { background: var(--bad-fill); }

.chip { font-size: 12px; padding: 3px 9px; letter-spacing: 0; }
.chip.plain { background: var(--line); }
.kind { border: 0; background: var(--line); border-radius: 99px; padding: 2px 7px; font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: capitalize; vertical-align: 2px; }
.kind.pin { background: var(--accent-soft); color: var(--accent); }
.badge.info { background: var(--line); }

/* controls: capsules; tinted fill for the main action, grey fill for the rest, plain tint for text buttons */
button { border-radius: 999px; padding: 13px 20px; letter-spacing: -.01em; transition: transform .18s cubic-bezier(.3, 1.5, .5, 1), opacity .15s, background .15s; }
button:not(.item):not(.as-button):not(.linklike):active { transform: scale(.97); opacity: .8; }
button.secondary { background: var(--line); color: var(--accent); }
button.ghost { font-weight: 400; background: transparent; }
button.ghost.small { font-size: 13px; }
button.danger { background: var(--line); color: var(--bad); }
button.item, .linklike, .as-button { border-radius: 0; }
.linklike { border-radius: 6px; font-weight: 400; }
button.card.as-button, button.list.as-button { border-radius: var(--radius); }
.small-btn { padding: 7px 13px; font-size: 14px; }
.row.wrap button { padding: 8px 14px; font-size: 15px; }

input, select, textarea { border: 0; background-color: var(--field); border-radius: 12px; padding: 11px 12px; }
input:focus, select:focus, textarea:focus { outline: 0; box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--accent) 32%, transparent); }
.budget-input { border-radius: 10px; padding: 7px 10px; font-family: var(--rounded); font-weight: 500; }
.budget-input.pinned { box-shadow: inset 0 0 0 1.5px var(--accent); }
label { font-size: 13px; font-weight: 400; letter-spacing: 0; margin: 14px 4px 6px; }
.check { font-size: 17px; font-weight: 400; }
input[type=range] { background: transparent; box-shadow: none; }
input[type=checkbox] { box-shadow: none; }

/* segmented control */
.seg { background: var(--line); border: 0; border-radius: 999px; padding: 2px; }
.seg button { color: var(--ink); font-size: 14px; font-weight: 500; padding: 7px 8px; border-radius: 999px; }
.seg button.on { background: var(--raised); font-weight: 600; box-shadow: 0 2px 8px rgb(0 0 0 / .12), 0 0 0 .5px rgb(0 0 0 / .04); }
@media (prefers-color-scheme: dark) { .seg button.on { background: #636366; } }
.seg.wrap { border-radius: 18px; } .seg.wrap button { font-size: 14px; }

/* month switcher: centred title between two round chevron buttons */
.month { margin: 2px 0 14px; }
.month button { width: 36px; height: 36px; padding: 0; border-radius: 50%; background: var(--line); color: var(--accent); font-size: 22px; line-height: 1; display: grid; place-items: center; padding-bottom: 3px; }
.month strong { font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.back { font-size: 17px; font-weight: 400; padding: 6px 0; margin-bottom: 0; }

.notice { border-radius: 16px; padding: 13px 16px; font-size: 15px; }
.notice.small { font-size: 13px; }
code { background: var(--line); border-radius: 6px; }
.table td { border-top: .5px solid var(--sep); }
.tick { border: 1.5px solid var(--sep); }
details.card summary::after { content: '›'; font-size: 22px; transform: rotate(90deg); transition: transform .2s; color: var(--muted); }
details.card[open] summary::after { content: '›'; transform: rotate(-90deg); }

/* sheets: tall rounded corners and a grabber */
#sheet { background: rgb(0 0 0 / .4); }
.sheet-card { border-radius: 34px 34px 0 0; padding-top: 26px; position: relative; }
.sheet-card::before { content: ''; position: absolute; top: 8px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--sep); }
#toast { border-radius: 999px; padding: 11px 18px; font-size: 15px; font-weight: 500; background: color-mix(in srgb, var(--raised) 78%, transparent); color: var(--ink);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); box-shadow: inset 0 0 0 .5px var(--sep), 0 8px 28px rgb(0 0 0 / .2); }
.bulkbar { border: 0; border-radius: 26px; background: color-mix(in srgb, var(--raised) 80%, transparent); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 0 0 .5px var(--sep), 0 10px 30px rgb(0 0 0 / .2); }
#offline { font-weight: 500; }

/* charts */
.chart .line { stroke-width: 2.5; }
.chart .grid { stroke: var(--sep); stroke-width: .5; }
.chart-tip { border: 0; border-radius: 12px; background: var(--raised); box-shadow: 0 4px 16px rgb(0 0 0 / .14), 0 0 0 .5px var(--sep); }
.stack-bar i { border-radius: 5px; }

/* tab bar: a symbol over a small label */
nav#tabs .ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
@media (max-width: 899px) {
  nav#tabs button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 5px; font-size: 10px; font-weight: 600; letter-spacing: 0; }
  body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  html.rail nav#tabs button, html.rail.float nav#tabs button { padding: 9px 0 8px; font-size: 10px; }
  html.rail.float body { padding-bottom: 330px; }
}

/* Mac and iPad: a floating sidebar panel, symbols beside labels, grey lozenge on the current page */
@media (min-width: 900px) {
  body { padding-left: 252px; }
  nav#tabs { top: 10px; bottom: 10px; left: 10px; width: 236px; border: 0; border-radius: 22px; padding: 16px 10px; gap: 1px;
    background: color-mix(in srgb, var(--card) 72%, transparent); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
    box-shadow: inset 0 0 0 .5px var(--sep), inset 1px 1px 0 rgb(255 255 255 / .35), 0 8px 30px rgb(0 0 0 / .08); }
  nav#tabs button { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 400; padding: 7px 10px; border-radius: 10px; color: var(--ink); }
  nav#tabs .ic { width: 20px; height: 20px; color: var(--accent); stroke-width: 1.8; }
  nav#tabs button:hover { background: var(--line); }
  nav#tabs button[aria-current="page"] { background: var(--line); font-weight: 600; color: var(--ink); }
  .brand { font-size: 22px; padding: 4px 10px 16px; }
  .brand img { border-radius: 7px; }
  .nav-gap { height: .5px; background: var(--sep); margin: 8px 10px; }
  h1 { font-size: 34px; }
  .month strong { font-size: 22px; font-weight: 700; }
  button.item:hover, .as-button:hover, a.item:hover { background: color-mix(in srgb, var(--line) 60%, transparent); }
  .sheet-card { border-radius: 26px; padding-top: 24px; } .sheet-card::before { display: none; }
  main > .card.hero > .bar { height: 8px; }
  #toast { left: calc(50% + 126px); }
}

/* Settings-style rows: a coloured symbol tile, with the separator starting at the text */
.tile { flex: none; width: 30px; height: 30px; border-radius: 7.5px; display: grid; place-items: center; color: #fff; }
.tile .ic { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.item:has(> .tile)::before { left: 58px; }
.big { font-weight: 700; letter-spacing: -.02em; }
.card.guide { box-shadow: none; }
.card .list { background: transparent; border-radius: 0; }
.card .list .item { padding-left: 0; padding-right: 0; } .card .list .item:not(:first-child)::before { left: 0; }
.row > button.grow { padding-inline: 10px; white-space: nowrap; font-size: 16px; }
.meta .chip:not(.warn):not(.bad), .item .sub .chip:not(.warn):not(.bad) { background: var(--line); color: var(--muted); font-weight: 500; }
button { background-color: var(--good-fill); }
@media (min-width: 900px) { nav#tabs button.desk-only { display: flex !important; } }
/* round check marks, as in Reminders */
input[type=checkbox], .check input, .item input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: none; width: 24px; height: 24px; padding: 0; border-radius: 50%; background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--sep); cursor: pointer; transition: background .15s, box-shadow .15s; }
input[type=checkbox]:checked { box-shadow: none; background: var(--good-fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 12.5 3.300 3.300L17 8.800'/%3E%3C/svg%3E") center / 100% no-repeat; }
input[type=checkbox]:focus { box-shadow: inset 0 0 0 1.5px var(--sep); } input[type=checkbox]:checked:focus { box-shadow: none; }
input[type=checkbox]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tick.on, .item.picked .tick { background: var(--good-fill); border-color: var(--good-fill); }
@media (min-width: 900px) { .seg:not(.wrap) { max-width: 480px; } }
/* money never breaks across lines; the label beside it wraps instead */
.between > .num, .item > .num, .item > strong.num { white-space: nowrap; flex: none; }

/* Inside the iPhone app the system draws the tab bar and keeps content clear of it. */
html.native nav#tabs { display: none !important; }
html.native body { padding: 0 0 12px; }
html.native #toast { bottom: 16px; }
html.native .bulkbar { bottom: 12px; }

/* Back on track: one pip per stage */
.pips { display: flex; gap: 4px; margin-top: 10px; }
.pips i { flex: 1; height: 6px; border-radius: 99px; background: var(--line); }
.pips i.on { background: var(--accent); }
.pips i.now { background: var(--warn); }
.track-now { margin: 14px 0 10px; }
.track-now strong { font-size: 20px; }
.card.track button.block { margin-top: 12px; }
.card.track button.ghost.block { margin-top: 4px; }
.item .sub.track-do { color: var(--accent); margin-top: 6px; }

/* Welcome: full-screen pages, one thing each, the action pinned at the bottom */
.ob { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--bg);
  padding: env(safe-area-inset-top) max(24px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(24px, env(safe-area-inset-left)); }
.ob-body { flex: 1; overflow-y: auto; width: 100%; max-width: 460px; margin: 0 auto; padding: 56px 4px 16px; text-align: center; animation: ob-in .45s cubic-bezier(.2, .8, .2, 1) both; }
.ob.back .ob-body { animation-name: ob-back; }
@keyframes ob-in { from { opacity: 0; transform: translateX(28px); } }
@keyframes ob-back { from { opacity: 0; transform: translateX(-28px); } }
@media (prefers-reduced-motion: reduce) { .ob-body { animation: none; } }
.ob-hero { display: grid; place-items: center; min-height: 96px; margin-bottom: 20px; }
.ob-app { border-radius: 22px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.ob-badge { width: 76px; height: 76px; border-radius: 20px; display: grid; place-items: center; color: #fff; box-shadow: 0 8px 22px rgba(0, 0, 0, .14); }
.ob-badge .ic { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ob h1 { font-size: 34px; line-height: 1.1; letter-spacing: -.025em; font-weight: 700; margin: 0 0 10px; text-wrap: balance; }
.ob-lead { color: var(--muted); font-size: 17px; margin: 0 auto 28px; max-width: 34ch; text-wrap: pretty; }
.ob-features { display: grid; gap: 24px; text-align: left; max-width: 360px; margin: 8px auto 0; }
.ob-feature { display: flex; gap: 16px; align-items: flex-start; }
.ob-fi .ic { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.ob-feature strong { display: block; font-size: 16px; }
.ob-feature p { margin: 2px 0 0; color: var(--muted); font-size: 15px; line-height: 1.35; }
.ob-field { display: block; margin: 0 0 12px; padding: 16px; font-size: 17px; border: 0; border-radius: 14px; background: var(--card); text-align: center; }
.ob textarea { border: 0; border-radius: 14px; background: var(--card); padding: 14px; }
.ob-steps { text-align: left; margin: 0 0 16px; padding-left: 22px; color: var(--muted); font-size: 15px; display: grid; gap: 8px; }
.ob-steps strong, .ob-steps em { color: var(--ink); }
.ob-list { text-align: left; }
.ob-fine { color: var(--muted); font-size: 14px; margin: 14px 0 0; }
.ob-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.ob-choice { background: var(--card); color: var(--ink); border-radius: 14px; padding: 18px 0; font-size: 17px; font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 2px transparent; }
.ob-choice.on { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); }
.ob-foot { width: 100%; max-width: 460px; margin: 0 auto; padding: 8px 4px 16px; }
.ob-foot #err { text-align: center; margin: 0 0 8px; min-height: 0; }
.ob-go { font-size: 17px; padding: 16px 20px; }
.ob-skip { margin-top: 4px; }
.ob-back { position: absolute; top: calc(env(safe-area-inset-top) + 8px); left: 12px; font-size: 28px; line-height: 1; padding: 6px 14px; z-index: 1; }

/* Apple's guidance for the glass layer: a soft edge where pages scroll under the status bar, and solid,
   higher-contrast controls for people who turn transparency down or contrast up. */
body::before { content: ''; position: fixed; inset: 0 0 auto; height: calc(env(safe-area-inset-top) * 1.35); z-index: 20; pointer-events: none;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 88%, transparent) 35%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent); mask-image: linear-gradient(to bottom, #000 45%, transparent); }
@media (prefers-reduced-transparency: reduce) {
  *, *::before, *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  nav#tabs, #toast, .bulkbar { background: var(--card) !important; }
  body::before { background: var(--bg); -webkit-mask-image: none; mask-image: none; height: env(safe-area-inset-top); }
}
@media (prefers-contrast: more) {
  :root { --muted: color-mix(in srgb, var(--ink) 80%, var(--bg)); --line: color-mix(in srgb, var(--ink) 45%, var(--bg)); --sep: color-mix(in srgb, var(--ink) 45%, var(--bg)); }
  nav#tabs, #toast, .bulkbar { background: var(--card) !important; box-shadow: inset 0 0 0 1.5px var(--ink) !important; }
  .card, .list { box-shadow: inset 0 0 0 1px var(--line); }
}

/* Home hero: two numbers and a bar; the working-out is one tap away */
.hero-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: .5px solid var(--sep); }
.hero-pair .label { color: var(--muted); font-size: 13px; }
.hero-pair .value { font: 700 24px/1.2 var(--rounded); letter-spacing: -.02em; margin-top: 2px; }
.hero-pair .unit { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
details.why { margin-top: 12px; }
details.why summary { list-style: none; cursor: pointer; color: var(--accent); font-size: 14px; font-weight: 500; }
details.why summary::-webkit-details-marker { display: none; }
details.why summary::after { content: ' ›'; }
details.why[open] summary::after { content: ''; }
details.why p { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.item[hidden] { display: none !important; }

/* iOS draws date fields wider than their box unless told otherwise */
input[type=date] { display: block; width: 100%; min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; }

/* shown inside the iPhone app's own navigation: it supplies the back button and the tab bar */
html.hosted .back, html.hosted #app > h1 { display: none !important; }
html.hosted main { padding-top: 12px; }
html.hosted #app > .seg[role=tablist] { display: none !important; }
