/* The "ledger" look shared with the owner's BTC site: neutral paper and ink,
   hairlines over stacked cards, IBM Plex served from /fonts. Actions use ink;
   blue marks progress and data. */
@font-face { font-family: "IBM Plex Sans"; 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-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --font: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, "PingFang SC", monospace;
  --page: #fafaf9;
  --surface: #ffffff;
  --raised: #ffffff;
  --ink: #15171b;
  --ink-2: #565b63;
  --ink-3: #8a8f97;
  --line: #e6e6e2;
  --line-strong: #d2d2cd;
  --ring: rgba(16, 18, 22, 0.06);
  --chip: #f3f3f1;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --good: #13795b;
  --good-ink: #13795b;
  --warn: #f0a92e;
  --warn-ink: #8f5400;
  --crit: #c0362c;
  --crit-ink: #c0362c;
  --btc: #f7931a;
  --shadow: 0 0.0625rem 0.125rem rgba(16, 18, 22, 0.04);
  --shadow-lifted: 0 0.75rem 2rem rgba(16, 18, 22, 0.1);
  --radius: 0.875rem;
  --page-w: 640px;
  /* categories: distinct hues, the rest grey */
  --cat-0: #2a78d6;
  --cat-1: #1a9e8f;
  --cat-2: #d99a1e;
  --cat-3: #8a5cd0;
  --cat-4: #d0577e;
  --cat-5: #6f8f2e;
  --cat-rest: #b4b2aa;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #111214;
    --surface: #18191c;
    --raised: #1d1f22;
    --ink: #ececee;
    --ink-2: #a7aab1;
    --ink-3: #70747c;
    --line: #26282c;
    --line-strong: #393b40;
    --ring: rgba(255, 255, 255, 0.06);
    --chip: #1d1f22;
    --accent: #4a93ea;
    --accent-ink: #86b6ef;
    --good: #3fcf8e;
    --good-ink: #3fcf8e;
    --warn: #f0b25a;
    --warn-ink: #f0b25a;
    --crit: #ff7a6e;
    --crit-ink: #ff7a6e;
    --shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.5);
    --shadow-lifted: 0 0.75rem 2rem rgba(0, 0, 0, 0.5);
    --cat-0: #4a93ea;
    --cat-1: #2fbfae;
    --cat-2: #e8ad3a;
    --cat-3: #a47fe3;
    --cat-4: #e67597;
    --cat-5: #93b44c;
    --cat-rest: #5b5a55;
  }
}
@media (min-width: 1080px) { :root { --page-w: 1160px; } }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; } /* layout classes must not unhide things */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Sizes are in rem, so the root sets the page's scale: a phone keeps 16px,
   a mouse on a wide screen gets the denser 14px. Text stays at 12px or more
   (max(12px, …)); hairlines, shadows, motion and page widths stay in px. */
@media (min-width: 720px) and (pointer: fine) { html { font-size: 87.5%; } }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--page);
  color: var(--ink);
  font: 1rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- frame ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: var(--page-w);
  margin: 0 auto;
  padding: calc(0.625rem + env(safe-area-inset-top)) 1rem 0.625rem;
  background: color-mix(in srgb, var(--page) 84%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 1.0625rem; letter-spacing: 0.04em; }
.brand img { width: 1.5rem; height: 1.5rem; border-radius: 0.4375rem; }
/* Two pages: the same pill at every width; a bar at the bottom is for three to five. */
.nav { display: flex; margin-left: auto; padding: 0.1875rem; gap: 0.125rem; background: var(--chip); border-radius: 999px; }
.nav-link { position: relative; padding: 0.375rem 1rem; border-radius: 999px; font-size: 0.875rem; font-weight: 600; color: var(--ink-2); transition: background-color 0.2s, color 0.2s; }
.nav-link:hover { color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.nav-link .badge { position: absolute; top: 0.3125rem; right: 0.4375rem; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--crit); box-shadow: 0 0 0 2px var(--chip); }
.icon-btn { margin-left: 0.25rem; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 999px; color: var(--ink-2); transition: background-color 0.2s, color 0.2s; }
.icon-btn:hover, .icon-btn[aria-current="page"] { background: var(--chip); color: var(--ink); }

.view { max-width: var(--page-w); margin: 0 auto; padding: 0.25rem 1rem calc(3.5rem + env(safe-area-inset-bottom)); }
.stack { display: grid; gap: 0.75rem; }
.stack-sm { display: grid; gap: 0.875rem; }
.view.narrow, .top.narrow { max-width: 640px; }
/* Two columns on a wide screen, one on a phone (left column first). */
.cols { display: grid; gap: 0.75rem; align-items: start; }
/* A phone shows more at once by tighter space, not smaller text: text stays
   at 16px, so fields do not zoom and lines stay easy to read. On 2026-10-28
   the owner asked for a little more on a phone screen, "但不要过于紧凑".
   Each rule sits after the one it tightens, so cards with their own spacing
   (.nudges) keep it. */
@media (max-width: 719px) { .stack, .cols { gap: 0.625rem; } .stack-sm { gap: 0.75rem; } }
@media (min-width: 1080px) {
  .stack { gap: 1rem; }
  .cols { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1rem; }
}

@media (min-width: 720px) {
  .top { padding-top: 0.875rem; padding-bottom: 0.75rem; }
}
@media (max-width: 719px) { .top { padding-top: calc(0.5rem + env(safe-area-inset-top)); padding-bottom: 0.5rem; } }

/* ---------- cards and text ---------- */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; min-width: 0; }
.card h2 { font-size: 0.9375rem; font-weight: 600; color: var(--ink-2); margin-bottom: 0.75rem; }
@media (max-width: 719px) { .card { padding: 1rem; } .card h2 { margin-bottom: 0.625rem; } }
.card h2.tight, .tight { margin: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.card-link { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; transition: transform 0.15s; }
.card-link:active { transform: scale(0.99); }
.card-link h2 { margin-bottom: 0.125rem; color: var(--ink); }
.card-link svg { color: var(--ink-3); flex: none; }
.card-quiet { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; background: transparent; box-shadow: inset 0 0 0 1px var(--line); font-size: 0.875rem; color: var(--ink-2); }
.title { font-size: 1.625rem; font-weight: 600; letter-spacing: -0.02em; }
.lead { color: var(--ink-2); }
.eyebrow { display: block; font-size: max(12px, 0.8125rem); font-weight: 600; color: var(--ink-3); letter-spacing: 0.04em; }
.muted { color: var(--ink-2); font-size: 0.875rem; margin-top: 0.625rem; }
.fine { font-size: max(12px, 0.78125rem); color: var(--ink-3); margin-top: 0.75rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-top: 0.875rem; }
@media (max-width: 719px) { .row-between { margin-top: 0.75rem; } }
.row-between .fine { margin: 0; }
.stack > .app-version { margin: 0; text-align: center; }

/* Switching tabs only fades; numbers move only when they change. */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.view .stack { animation: fade 0.16s ease-out backwards; }
.view.no-enter .stack { animation: none; }

/* ---------- overview ---------- */

.hero { padding: 1.5rem 1.375rem 1.125rem; position: relative; isolation: isolate; }
/* The rays are clipped to the card; the card itself is not, so tips can overflow it. */
.hero-rays { position: absolute; inset: 0; z-index: -1; overflow: hidden; border-radius: inherit; pointer-events: none; }
/* Slow sun rays behind the freedom years, barely there. */
.hero-rays::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -23.75rem;
  top: -29.375rem;
  width: 62.5rem;
  height: 62.5rem;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--accent) 7%, transparent) 0deg 7deg, transparent 7deg 22deg);
  -webkit-mask: radial-gradient(closest-side, #000 18%, transparent 70%);
  mask: radial-gradient(closest-side, #000 18%, transparent 70%);
  animation: spin 140s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hero-grid { display: grid; gap: 1.125rem; }
.hero-row { display: flex; align-items: baseline; gap: 0.5rem; margin-top: 0.125rem; }
.hero-num { font-size: clamp(4.25rem, 19vw, 5.75rem); font-weight: 600; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.hero-unit { font-size: 1.5rem; font-weight: 600; color: var(--ink-2); }
.hero-sub { margin-top: 0.5rem; color: var(--ink-2); font-size: 1rem; }
.level-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.875rem;
  padding: 0.3125rem 0.75rem 0.3125rem 0.625rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent-ink);
  font-size: max(12px, 0.84375rem);
  font-weight: 600;
}
.level-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.hero-stat { padding-top: 1rem; border-top: 1px solid var(--line); min-width: 0; }
.stat-label { font-size: max(12px, 0.8125rem); font-weight: 600; color: var(--ink-3); letter-spacing: 0.02em; }
.stat-value { margin-top: 0.25rem; font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-value .good { color: var(--good-ink); }
.stat-sub { margin-top: 0.375rem; font-size: 0.875rem; color: var(--ink-2); }
.hero-stat .meter { margin-top: 0.75rem; }
@media (max-width: 719px) {
  .hero { padding: 1.125rem 1.125rem 1rem; }
  .hero-grid { gap: 0.875rem; }
  .hero-num { font-size: clamp(3.75rem, 17vw, 5.25rem); }
  .level-pill { margin-top: 0.625rem; }
  .hero-stat { padding-top: 0.75rem; }
  .stat-value { font-size: 1.5rem; }
}
@media (min-width: 1080px) {
  .hero { padding: 1.5rem 1.875rem 1.25rem; }
  .hero-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 2.125rem; align-items: start; }
  .hero-num { font-size: 6rem; }
  .hero-stat { padding: 0.375rem 0 0 2.125rem; border-top: 0; border-left: 1px solid var(--line); align-self: stretch; }
  .stat-value { font-size: 2.125rem; }
}

.nudges { display: grid; padding: 0.375rem 0.5rem; }
.nudge { display: flex; align-items: center; gap: 0.625rem; padding: 0.625rem 0.5rem; border-radius: 0.75rem; color: var(--accent-ink); font-size: 0.9375rem; font-weight: 600; transition: background-color 0.2s; }
.nudge + .nudge { border-top: 1px solid var(--line); border-radius: 0; }
.nudge:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.nudge span { flex: 1; }

.meter { position: relative; height: 0.5rem; margin: 0.625rem 0 0.125rem; border-radius: 999px; background: color-mix(in srgb, var(--accent) 15%, var(--surface)); }
.meter > span { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--accent); transition: width 0.9s cubic-bezier(0.2, 0.8, 0.2, 1); }
.meter-lg { height: 0.625rem; }
.meter .dot { position: absolute; z-index: 1; top: 50%; width: 0.5rem; height: 0.5rem; margin: -0.25rem 0 0 -0.25rem; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.meter .dot.on { background: var(--surface); box-shadow: 0 0 0 2px var(--accent); }
.meter-warn { background: color-mix(in srgb, var(--warn) 22%, var(--surface)); }
.meter-warn > span { background: var(--warn); }

.ladder { list-style: none; margin: 0; padding: 0; }
.rung { display: grid; grid-template-columns: 1.375rem minmax(0, 1fr); gap: 0.75rem; padding: 0.75rem 0; }
.rung + .rung { border-top: 1px solid var(--line); }
.rung-mark { width: 1.375rem; height: 1.375rem; margin-top: 0.0625rem; border-radius: 50%; display: grid; place-items: center; color: #fff; box-shadow: inset 0 0 0 2px var(--line); }
.is-reached .rung-mark { background: var(--good); box-shadow: none; }
.is-warn .rung-mark { background: var(--warn); box-shadow: none; color: #1a1300; font-size: max(12px, 0.8125rem); font-weight: 600; line-height: 1; }
.is-next .rung-mark { box-shadow: inset 0 0 0 2px var(--accent); }
.is-next .rung-mark::after { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent); }
.rung-head { display: flex; align-items: baseline; gap: 0.5rem; }
.rung-name { font-weight: 600; }
.rung-amount { margin-left: auto; color: var(--ink-2); font-size: 0.875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rung-gives { margin-top: 0.125rem; font-size: max(12px, 0.84375rem); color: var(--ink-2); }
.is-future .rung-name { color: var(--ink-2); }
.is-future .rung-gives { color: var(--ink-3); }
.rung-eta { margin-top: 0.375rem; font-size: max(12px, 0.8125rem); color: var(--ink-2); }
.is-next .rung-eta { color: var(--ink); }
@media (max-width: 719px) { .rung { padding: 0.625rem 0; } .rung-eta { margin-top: 0.25rem; } }
.stress { display: flex; gap: 0.5rem; align-items: flex-start; margin-top: 0.25rem; padding-top: 0.75rem; border-top: 1px solid var(--line); font-size: max(12px, 0.8125rem); color: var(--ink-2); }
.stress svg { flex: none; margin-top: 0.125rem; color: var(--ink-3); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 0.625rem; }
.tile { padding: 0.875rem; border-radius: 0.875rem; background: var(--chip); min-width: 0; }
.tile-label { font-size: max(12px, 0.8125rem); color: var(--ink-2); }
.tile-value { margin-top: 0.125rem; font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.tile-sub { font-size: max(12px, 0.8125rem); color: var(--ink-3); }

/* ---------- controls ---------- */

.btn {
  appearance: none;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.625rem 1rem;
  border-radius: 0.625rem;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--ink);
  font-weight: 500;
  font-size: 0.9375rem;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s ease, background-color 0.2s, opacity 0.2s;
}
.btn:hover { background: var(--chip); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn-primary { background: var(--ink); color: var(--page); box-shadow: none; }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 85%, var(--page)); }
.btn-block { width: 100%; padding: 0.875rem; font-size: 1rem; }
.btn-sm { padding: 0.4375rem 0.6875rem; font-size: max(12px, 0.84375rem); border-radius: 0.625rem; }
.link-btn, .text-btn { appearance: none; background: none; border: 0; padding: 0.25rem 0.125rem; font-size: 0.875rem; font-weight: 600; cursor: pointer; }
.link-btn { color: var(--crit-ink); justify-self: start; }
.text-btn { color: var(--accent-ink); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.actions .btn { flex: 1; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0.125rem; padding: 0.1875rem; border-radius: 0.75rem; background: var(--chip); }
.seg-btn { appearance: none; border: 0; background: transparent; padding: 0.5rem 0.375rem; border-radius: 0.5625rem; font-weight: 600; font-size: 0.875rem; color: var(--ink-2); cursor: pointer; transition: background-color 0.2s, color 0.2s, box-shadow 0.2s; }
.seg-btn[aria-checked="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

.field { display: grid; gap: 0.375rem; min-width: 0; }
.field > label { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); }
.input {
  width: 100%;
  min-width: 0;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--raised);
  font-size: 1.0625rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input[aria-invalid="true"] { border-color: var(--crit); box-shadow: 0 0 0 3px color-mix(in srgb, var(--crit) 18%, transparent); }
.input::placeholder { color: var(--ink-3); }
.input-num { text-align: right; font-variant-numeric: tabular-nums; }
.input-wrap { position: relative; display: flex; align-items: center; }
.prefix, .suffix { position: absolute; color: var(--ink-3); font-size: 1rem; pointer-events: none; }
.prefix { left: 0.875rem; }
.suffix { right: 0.875rem; }
.has-prefix .input { padding-left: 2rem; }
.has-suffix .input { padding-right: 3.25rem; }
.hint { font-size: max(12px, 0.78125rem); color: var(--ink-3); }
.hint.error { color: var(--crit-ink); font-weight: 600; }
.form-reason { min-height: 1.4em; font-size: max(12px, 0.84375rem); color: var(--ink-2); text-align: center; }
.warn-box { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.625rem 0.75rem; border-radius: 0.75rem; background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--ink); font-size: max(12px, 0.84375rem); }
.warn-box svg { flex: none; margin-top: 0.125rem; color: var(--warn-ink); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.875rem; }
@media (max-width: 420px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

details.card > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-weight: 600; color: var(--ink-2); list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary svg { transition: transform 0.2s; color: var(--ink-3); }
details.card[open] > summary svg { transform: rotate(90deg); }
.derived { padding: 0.625rem 0.75rem; border-radius: 0.75rem; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); color: var(--accent-ink); font-size: max(12px, 0.84375rem); }

/* ---------- purchase check ---------- */

/* On a phone the card moves up under the top bar while the keyboard is out. */
.buy { --tier: var(--ink-3); scroll-margin-top: calc(4.5rem + env(safe-area-inset-top)); transition: background-color 0.3s ease, box-shadow 0.3s ease; }
.amount { display: flex; align-items: center; gap: 0.375rem; margin: 0.125rem 0 0.875rem; }
.clear-btn { flex: none; display: grid; place-items: center; width: 2.125rem; height: 2.125rem; border: 0; border-radius: 50%; background: var(--chip); color: var(--ink-2); cursor: pointer; }
.clear-btn[hidden] { display: none; }
.decide { display: grid; gap: 0.625rem; margin-top: 1rem; }
.decide .actions { margin-top: 0; }
.amount-cur { font-size: 2.125rem; font-weight: 600; color: var(--ink-3); }
.amount-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: clamp(2.625rem, 12.5vw, 3.5rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  caret-color: var(--accent);
}
.amount-input::placeholder { color: color-mix(in srgb, var(--ink-3) 50%, transparent); }

.verdict { margin-top: 1rem; }
.verdict:empty { display: none; }
.verdict > .fine { margin-top: 0; }
.result-empty { color: var(--ink-2); font-size: 0.9375rem; }
/* Where the verdicts begin, in money, for the kind of cost the toggle picked. */
.bounds { color: var(--ink-2); font-size: max(12px, 0.875rem); }
.bounds-c { white-space: nowrap; }
.bounds-dot { margin: 0 0.375rem; color: var(--ink-3); }
.tier-pill { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.3125rem 0.75rem 0.3125rem 0.5625rem; border-radius: 999px; font-size: 0.875rem; font-weight: 600; }
.buy.tier-green { --tier: var(--good); background: color-mix(in srgb, var(--good) 7%, var(--surface)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--good) 32%, transparent), var(--shadow); }
.buy.tier-yellow { --tier: var(--warn); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 45%, transparent), var(--shadow); }
.buy.tier-red { --tier: var(--crit); background: color-mix(in srgb, var(--crit) 7%, var(--surface)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--crit) 32%, transparent), var(--shadow); }
.tier-green .tier-pill { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good-ink); }
.tier-yellow .tier-pill { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn-ink); }
.tier-red .tier-pill { background: color-mix(in srgb, var(--crit) 14%, transparent); color: var(--crit-ink); }
@keyframes settle { from { opacity: 0.55; } to { opacity: 1; } }
.result-head { margin-top: 0.75rem; font-size: 1.625rem; font-weight: 600; line-height: 1.25; letter-spacing: -0.02em; animation: settle 0.2s ease backwards; }
.result-sub { margin-top: 0.375rem; color: var(--ink-2); }
/* The price in the owner's own year and month: hairline-separated views. */
.result-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.work-days { flex: none; display: grid; grid-template-columns: repeat(5, 0.5625rem); gap: 0.1875rem; margin-top: 1.125rem; }
.work-days span { width: 0.5625rem; height: 0.5625rem; border-radius: 0.125rem; background: var(--tier); }
.lens { margin-top: 1rem; padding-top: 0.875rem; border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); }
.lens-head { font-weight: 600; }
.lens .fine { margin-top: 0.25rem; }
.price-chart { margin-top: 0.5rem; }
.price-strip { display: block; width: 100%; height: auto; overflow: visible; }
.price-strip circle { fill: var(--ink-3); fill-opacity: 0.45; }
.price-strip .is-alike { fill: var(--ink); fill-opacity: 0.8; }
.price-strip line { stroke: var(--tier); stroke-width: 2; }
.price-strip .price-mark { fill: var(--tier); fill-opacity: 1; stroke: var(--surface); stroke-width: 2; }
.strip-axis { position: relative; height: 1.125rem; font-size: max(12px, 0.75rem); color: var(--ink-3); }
.strip-axis span { position: absolute; top: 0; transform: translateX(-50%); }
.month-meter { position: relative; height: 0.75rem; margin: 0.75rem 0 1.75rem; border-radius: 0.1875rem; background: color-mix(in srgb, var(--ink) 7%, transparent); }
.mm-spent, .mm-new { position: absolute; top: 0; bottom: 0; border-radius: 0.1875rem; }
.mm-spent { left: 0; background: var(--ink-3); }
.mm-new { margin-left: 0.125rem; background: color-mix(in srgb, var(--tier) 70%, transparent); }
.mm-usual { position: absolute; top: -0.25rem; bottom: -0.25rem; border-left: 1.5px solid var(--ink); }
.mm-label { position: absolute; top: 1.125rem; transform: translateX(-50%); white-space: nowrap; font-size: max(12px, 0.75rem); color: var(--ink-3); }
.kind-chips { align-items: center; }
.kind-chips + .kind-chips { margin-top: 0.5rem; }
.kind-label { margin-right: 0.25rem; font-size: max(12px, 0.84375rem); color: var(--ink-2); }
.kind-advice { margin-top: 0.625rem; }

.wait { list-style: none; margin: 0; padding: 0; }
.wait-row { display: grid; grid-template-columns: 0.625rem minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; padding: 0.75rem 0; }
.wait-row + .wait-row { border-top: 1px solid var(--line); }
.wait-dot { width: 0.625rem; height: 0.625rem; border-radius: 50%; }
.wait-dot.tier-green { background: var(--good); }
.wait-dot.tier-yellow { background: var(--warn); }
.wait-dot.tier-red { background: var(--crit); }
.wait-name { font-weight: 600; overflow-wrap: anywhere; }
.wait-meta { font-size: max(12px, 0.8125rem); color: var(--ink-2); }
.is-due .wait-meta { color: var(--accent-ink); font-weight: 600; }
.wait-actions { display: flex; gap: 0.375rem; }
.saved { display: flex; align-items: center; gap: 0.375rem; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--line); color: var(--good-ink); font-size: 0.875rem; font-weight: 600; }
.saved svg { flex: none; }

/* ---------- update ---------- */

.acc-list { display: grid; }
.acc-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(8.125rem, 46%); align-items: center; gap: 0.75rem; padding: 0.625rem 0; }
.acc-row + .acc-row, .acc-panel + .acc-row { border-top: 1px solid var(--line); }
.acc-label { display: grid; justify-items: start; }
.acc-name { font-weight: 600; overflow-wrap: anywhere; }
.acc-kind { font-size: max(12px, 0.78125rem); color: var(--ink-3); }
label.acc-kind { cursor: pointer; }
/* The name opens the account's actions under its row, like a fold. */
.acc-open { appearance: none; display: inline-flex; align-items: center; gap: 0.25rem; max-width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.acc-open svg { flex: none; color: var(--ink-3); transition: transform 0.2s, color 0.2s; }
.acc-open:hover svg, .acc-open[aria-expanded="true"] svg { color: var(--ink); }
.acc-open[aria-expanded="true"] svg { transform: rotate(90deg); }
.acc-panel { display: grid; gap: 0.625rem; padding: 0 0 0.875rem; animation: unfold 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
.acc-panel > .conn-list { padding: 0 0.75rem; border-radius: 0.75rem; background: var(--chip); }
.acc-manage { display: flex; align-items: center; gap: 0.5rem; }
.acc-manage .input { flex: 1; min-width: 0; }
.acc-input { display: grid; gap: 0.125rem; justify-items: end; }
.acc-delta { min-height: 1.2em; font-size: max(12px, 0.78125rem); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.acc-delta.stale { color: var(--warn-ink); font-weight: 600; }
.add-account { padding: 0.875rem; border-radius: 0.875rem; background: var(--chip); }
.add-account .seg { background: var(--surface); }
.preview { display: grid; gap: 0.5rem; }
.preview-row { display: flex; justify-content: space-between; align-items: baseline; color: var(--ink-2); }
.preview-row strong { color: var(--ink); font-size: 1.25rem; font-weight: 600; }
.save-row { margin-top: 1rem; }
.history > summary { font-size: 0.9375rem; }
.history ul { list-style: none; margin: 0.75rem 0 0; padding: 0; }
.history li { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0; border-top: 1px solid var(--line); font-size: 0.875rem; }
.history li .num { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ---------- real money ---------- */

.year-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.year-stat { min-width: 0; }
.year-stat .stat-value { font-size: 1.625rem; }
.year-badge { display: inline-block; margin-top: 0.375rem; font-size: max(12px, 0.78125rem); font-weight: 600; padding: 0.125rem 0.5625rem; border-radius: 999px; }
.year-badge.up { color: var(--warn-ink); background: color-mix(in srgb, var(--warn) 18%, transparent); }
.year-badge.down { color: var(--good-ink); background: color-mix(in srgb, var(--good) 14%, transparent); }
.insights { display: grid; gap: 0.75rem; }
.insight { display: flex; gap: 0.625rem; align-items: flex-start; font-size: 0.90625rem; }
.insight svg { flex: none; margin-top: 0.125rem; color: var(--accent-ink); }
.insight.is-warn svg { color: var(--warn-ink); }
.insight.is-good svg { color: var(--good-ink); }
.insights .insight + .insight { padding-top: 0.75rem; border-top: 1px solid var(--line); }
details.insight { display: block; }
details.insight > summary { display: flex; gap: 0.625rem; align-items: flex-start; cursor: pointer; list-style: none; }
details.insight > summary::-webkit-details-marker { display: none; }
.sub-list { list-style: none; margin: 0.5rem 0 0 1.75rem; padding: 0; font-size: max(12px, 0.84375rem); color: var(--ink-2); }
.sub-list li { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.25rem 0; border-top: 1px solid var(--line); }
.sub-list .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.drop { appearance: none; display: grid; justify-items: center; gap: 0.375rem; width: 100%; padding: 1.375rem 1rem; border: 1.5px dashed var(--line); border-radius: 1rem; background: transparent; color: var(--ink); font: inherit; font-size: 0.9375rem; font-weight: 600; cursor: pointer; text-align: center; transition: border-color 0.2s, background-color 0.2s; }
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.drop svg { color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.chip { appearance: none; border: 0; padding: 0.375rem 0.6875rem; border-radius: 999px; background: var(--chip); color: var(--ink); font: inherit; font-size: max(12px, 0.84375rem); font-weight: 600; cursor: pointer; transition: background-color 0.15s, color 0.15s; }
.chip:hover { background: color-mix(in srgb, var(--accent) 14%, var(--chip)); }
.chip.ghost { background: transparent; color: var(--ink-3); }
.chip.ghost:hover { color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--page); }
/* + opens a label of one's own, typed in place. */
.chip-add { display: inline-grid; place-items: center; padding: 0.375rem 0.5625rem; background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink-2); }
.chip-new { display: inline-flex; align-items: center; gap: 0.25rem; }
.chip-input { width: 8.5em; padding: 0.3125rem 0.6875rem; border: 1px solid var(--accent); border-radius: 999px; background: var(--raised); color: var(--ink); font: inherit; font-size: max(12px, 0.84375rem); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
@media (pointer: coarse) { .chip-input, .pay-note { font-size: 16px; } } /* no zoom on focus */

/* ---------- questions: a stack of cards, one on top ---------- */

.deck { display: grid; gap: 0.5rem; min-width: 0; }
.deck-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: 2.125rem; padding-left: 0.125rem; }
.deck-head h2 { font-size: 0.9375rem; font-weight: 600; color: var(--ink-2); }
.pager { display: flex; align-items: center; }
.pager-at { min-width: 5ch; text-align: center; font-size: max(12px, 0.84375rem); font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.deck-stack { display: grid; padding-bottom: 0.875rem; }
.deck-stack > * { grid-area: 1 / 1; min-width: 0; }
.deck-peek { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); transform: translateY(0.4375rem) scale(0.965); transform-origin: 50% 100%; }
.deck-peek-2 { transform: translateY(0.875rem) scale(0.93); opacity: 0.6; }
.ask-card {
  position: relative;
  display: grid;
  gap: 0.375rem;
  align-content: start;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow), 0 10px 26px rgba(16, 18, 22, 0.05);
  touch-action: pan-y;
  transition: transform 0.17s ease-in, opacity 0.17s ease-in;
}
.ask-card:focus { outline: none; }
.ask-card.dragging { transition: none; }
.ask-card .chips { margin-top: 0.625rem; }
.ask-hero { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; }
.ask-hero.num { font-variant-numeric: tabular-nums; }
.ask-meta { color: var(--ink-2); font-size: 0.90625rem; overflow-wrap: anywhere; }
.ask-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: max(12px, 0.78125rem); color: var(--ink-3); overflow-wrap: anywhere; }
@keyframes from-stack { from { transform: translateY(7px) scale(0.965); } }
@keyframes from-left { from { transform: translateX(-64px) rotate(-4deg); opacity: 0; } }
.ask-card.enter-stack { animation: from-stack 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); }
.ask-card.enter-back { animation: from-left 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); }

/* ---------- lock ---------- */

.lock-card { display: grid; justify-items: center; gap: 0.75rem; margin-top: 8vh; padding: 2rem 1.5rem 1.5rem; text-align: center; }
.lock-card .title { margin-top: 0.25rem; }
.lock-card .lead { margin-bottom: 0.5rem; }
.lock-card form, .lock-card .forgot { width: 100%; }
.lock-badge { display: grid; place-items: center; width: 3.75rem; height: 3.75rem; border-radius: 1.125rem; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent-ink); }
.text-btn.subtle { color: var(--ink-3); font-weight: 500; font-size: max(12px, 0.8125rem); }
.field-label { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); }
details.sub > summary { cursor: pointer; font-weight: 600; color: var(--accent-ink); font-size: 0.875rem; list-style: none; }
details.sub > summary::-webkit-details-marker { display: none; }
details.sub[open] > summary { margin-bottom: 0.625rem; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: calc(1.5rem + env(safe-area-inset-bottom));
  max-width: calc(100vw - 2rem);
  padding: 0.625rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--page);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translate(-50%, 0.75rem);
  transition: opacity 0.25s, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast { display: flex; align-items: center; gap: 0.75rem; }
.toast-undo { appearance: none; border: 0; padding: 0; background: none; color: color-mix(in srgb, var(--accent) 60%, var(--page)); font: inherit; font-weight: 600; cursor: pointer; }
@media (min-width: 720px) { .toast { bottom: 2rem; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.readout { min-height: 1.2em; font-size: max(12px, 0.78125rem); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.readout:empty { display: none; }
.readout.error { color: var(--crit-ink); font-weight: 600; }

/* ---------- motion ---------- */

/* The overview's entrance, once per unlock: cards rise in turn, then bars
   grow and reached stages pop. Values follow the data, never overshoot. */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes pop-in { from { transform: scale(0.4); opacity: 0; } }
.view .stack.intro, .intro .stack { animation: none; }
.intro > *, .intro .cols > .stack > * { animation: rise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
.intro > :nth-child(2) { animation-delay: 90ms; }
.intro .cols > .stack:first-child > :nth-child(1) { animation-delay: 160ms; }
.intro .cols > .stack:first-child > :nth-child(2) { animation-delay: 250ms; }
.intro .cols > .stack:first-child > :nth-child(3) { animation-delay: 330ms; }
.intro .cols > .stack:first-child > :nth-child(4) { animation-delay: 400ms; }
.intro .cols > .stack:last-child > :nth-child(1) { animation-delay: 210ms; }
.intro .cols > .stack:last-child > :nth-child(2) { animation-delay: 300ms; }
.intro .cols > .stack:last-child > :nth-child(3) { animation-delay: 360ms; }
.intro .meter > span { transform-origin: left; animation: grow 1s 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
.intro .is-reached .rung-mark { animation: pop-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) backwards; }
.intro .rung:nth-child(1) .rung-mark { animation-delay: 0.45s; }
.intro .rung:nth-child(2) .rung-mark { animation-delay: 0.55s; }
.intro .rung:nth-child(3) .rung-mark { animation-delay: 0.65s; }
.intro .rung:nth-child(4) .rung-mark { animation-delay: 0.75s; }
.intro .rung:nth-child(5) .rung-mark { animation-delay: 0.85s; }
.intro .rung:nth-child(6) .rung-mark { animation-delay: 0.95s; }

/* "You are here" breathes. */
@keyframes breathe { 50% { transform: scale(1.4); opacity: 0.55; } }
@keyframes halo { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 12%, transparent); } }
.is-next .rung-mark::after { animation: breathe 2.6s ease-in-out infinite; }
.level-dot { animation: halo 2.6s ease-in-out infinite; }

/* A stage just reached, and a verdict that changed. */
.level-pill.just-reached { animation: pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good-ink); }
.level-pill.just-reached .level-dot { background: var(--good); }
.tier-pill.pop { animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 50; pointer-events: none; }

/* ---------- month by month ---------- */

.card-sub { margin: 1.375rem 0 0; font-size: 0.875rem; font-weight: 600; color: var(--ink-2); }
.months { position: relative; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0.375rem; height: 9.375rem; margin-top: 2.125rem; padding-bottom: 1.25rem; }
@media (max-width: 719px) { .months { height: 8.125rem; margin-top: 1.875rem; } }
.months-usual { position: absolute; left: 0; right: 0; height: 0; margin-bottom: 1.25rem; border-top: 1.5px dashed color-mix(in srgb, var(--ink-3) 70%, transparent); pointer-events: none; z-index: 1; }
.month { appearance: none; position: relative; display: flex; align-items: flex-end; justify-content: center; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 0.375rem; }
.month-bar { display: block; width: 100%; max-width: 2.125rem; min-height: 0.125rem; border-radius: 0.3125rem 0.3125rem 0.125rem 0.125rem; background: color-mix(in srgb, var(--accent) 45%, var(--surface)); transition: background-color 0.2s, transform 0.2s; transform-origin: bottom; }
.month.is-high .month-bar { background: var(--warn); }
.month:hover .month-bar { background: color-mix(in srgb, var(--accent) 70%, var(--surface)); }
.month.is-high:hover .month-bar { background: color-mix(in srgb, var(--warn) 80%, var(--ink)); }
.month[aria-pressed="true"] .month-bar { background: var(--accent); }
.month.is-high[aria-pressed="true"] .month-bar { background: color-mix(in srgb, var(--warn) 75%, var(--crit)); }
.month-label { position: absolute; bottom: -1.25rem; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.month[aria-pressed="true"] .month-label { color: var(--ink); font-weight: 600; }
.month-detail { margin-top: 0.875rem; padding: 0.875rem 1rem; border-radius: 0.875rem; background: var(--chip); display: grid; gap: 0.375rem; min-height: 5.75rem; }
.month-head { font-size: 1rem; font-weight: 600; }
.month-line { font-size: 0.875rem; color: var(--ink-2); }
.month-detail .fine { margin: 0; }
.intro .month-bar { animation: grow-up 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
.intro .month:nth-child(n) .month-bar { animation-delay: calc(0.3s + var(--i, 0) * 40ms); }
@keyframes grow-up { from { transform: scaleY(0); } }

/* ---------- bill rules ---------- */

.rules { list-style: none; margin: 0; padding: 0; }
.rule { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) auto; align-items: center; gap: 0.75rem; padding: 0.625rem 0; }
.rule + .rule { border-top: 1px solid var(--line); }
.rule-who { display: grid; min-width: 0; }
.rule-who strong { font-weight: 600; overflow-wrap: anywhere; }
.select { padding: 0.5625rem 0.75rem; font-size: 0.90625rem; }
.rule-list { margin: 0; padding-left: 1.125rem; display: grid; gap: 0.375rem; font-size: 0.875rem; color: var(--ink-2); }
@media (max-width: 520px) { .rule { grid-template-columns: minmax(0, 1fr) auto; } .rule-pick { grid-column: 1 / -1; grid-row: 2; } }
.inline-link { color: var(--accent-ink); font-weight: 600; }
/* The amount sits on top of the bar on hover; without a mouse, on the picked month. */
.month-bar { position: relative; }
.month-value { position: absolute; left: 50%; bottom: calc(100% + 0.3125rem); transform: translate(-50%, 0.1875rem); padding: 0.125rem 0.4375rem; border-radius: 0.4375rem; background: var(--ink); color: var(--page); font-size: 12px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s; z-index: 2; }
.month:hover .month-value, .month:focus-visible .month-value { opacity: 1; transform: translate(-50%, 0); }
@media (hover: none) { .month[aria-pressed="true"] .month-value { opacity: 1; transform: translate(-50%, 0); } }
.remove-btn { appearance: none; flex: none; display: grid; place-items: center; width: 2.125rem; height: 2.125rem; padding: 0; border: 0; border-radius: 0.625rem; background: transparent; color: var(--ink-3); cursor: pointer; transition: background-color 0.15s, color 0.15s; }
.remove-btn:hover, .remove-btn:focus-visible { background: color-mix(in srgb, var(--crit) 12%, transparent); color: var(--crit-ink); }

/* ---------- explanations on hover ---------- */

.tip { position: relative; cursor: help; border-radius: 0.25rem; }
.stat-sub .tip, .rung-eta .tip, .year-stat .stat-value .tip { text-decoration: underline dotted color-mix(in srgb, var(--ink-3) 70%, transparent); text-underline-offset: 3px; }
.tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  top: calc(100% + 0.5rem);
  z-index: 30;
  width: max-content;
  max-width: min(18.75rem, 80vw);
  padding: 0.5rem 0.6875rem;
  border-radius: 0.625rem;
  background: var(--ink);
  color: var(--page);
  font-size: max(12px, 0.78125rem);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0;
  white-space: pre-line; /* a tip's parts can stand on lines of their own */
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  /* Not rendered until wanted: a hidden tip near the right edge would widen the page. */
  display: none;
}
@keyframes tip-in { from { opacity: 0; transform: translateY(-3px); } }
.tip:hover::after, .tip:focus-visible::after, .tip:focus::after { display: block; animation: tip-in 0.15s ease-out backwards; }
/* Tips on the right half open leftwards so they stay on screen. */
.hero-stat:last-child .tip::after, .year-stat:last-child .tip::after { left: auto; right: 0; }
.tip:focus { outline: none; }
.buffer-have .cue { text-decoration: underline dotted color-mix(in srgb, var(--ink-3) 70%, transparent); text-underline-offset: 3px; }
.sr-only { position: absolute; width: 0.0625rem; height: 0.0625rem; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* A balance that updates itself: the figure, and a pencil to correct it. */
.acc-auto { display: flex; align-items: center; justify-content: flex-end; gap: 0.25rem; }
.acc-value { font-size: 1.0625rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.acc-error { color: var(--crit-ink); font-weight: 600; }
.edit-btn:hover, .edit-btn:focus-visible { background: var(--chip); color: var(--ink); }
.fix-actions { display: flex; align-items: center; gap: 0.25rem; margin-top: 0.25rem; }
.input-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; resize: vertical; min-height: 5.25rem; -webkit-text-security: disc; }
.input-key:focus { -webkit-text-security: none; }
.steps { margin: 0; padding-left: 1.25rem; display: grid; gap: 0.375rem; font-size: max(12px, 0.84375rem); color: var(--ink-2); }
.bank-row { padding-top: 0.625rem; border-top: 1px solid var(--line); }
.acc-auto.no-edit { padding-right: 2.375rem; }
.derived.connected { display: flex; align-items: center; gap: 0.5rem; color: var(--good-ink); background: color-mix(in srgb, var(--good) 10%, var(--surface)); }
.derived.connected svg { flex: none; }
.derived.refused { display: flex; align-items: flex-start; gap: 0.5rem; color: var(--crit-ink); background: color-mix(in srgb, var(--crit) 10%, var(--surface)); }
.derived.refused svg { flex: none; margin-top: 0.125rem; }
.conn-list.bills > li.over { outline: 1.5px dashed var(--accent); outline-offset: -1.5px; border-radius: 0.75rem; background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* ---------- a month's receipt ---------- */

.rc-open { justify-self: start; display: inline-flex; align-items: center; gap: 0.375rem; margin-top: 0.25rem; }
body.receipt-open, body.sheet-open { overflow: hidden; }
.receipt-layer {
  position: fixed; inset: 0; z-index: 60;
  display: grid; justify-items: center; align-content: start;
  padding: calc(1.5rem + env(safe-area-inset-top)) 1rem 3rem;
  background: color-mix(in srgb, #000 45%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fade 0.2s ease-out backwards;
  overflow-y: auto;
  overflow-x: hidden; /* the slot is a little wider than the paper on a phone */
}
.receipt-layer.closing { animation: fade-out 0.2s ease-in both; }
@keyframes fade-out { to { opacity: 0; } }
/* The slot the paper comes out of. */
.rc-slot { width: min(25.5rem, calc(100vw - 1rem)); height: 0.75rem; border-radius: 0.5rem; background: linear-gradient(#2a2a28, #111); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), inset 0 -2px 0 rgba(255, 255, 255, 0.06); position: relative; z-index: 2; }
.receipt {
  --paper: #fbfaf5;
  --ink-r: #2b2723;
  position: relative;
  width: min(23.75rem, calc(100vw - 2rem));
  margin-top: -0.375rem;
  color: var(--ink-r);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "PingFang SC", "Noto Sans SC", monospace;
  font-size: max(12px, 0.8125rem);
  line-height: 1.55;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.28));
}
/* Torn, zigzag bottom edge. */
.receipt::after { content: ""; position: absolute; left: 0; right: 0; bottom: -0.5625rem; height: 0.625rem; background: conic-gradient(from 135deg at top, var(--paper) 90deg, transparent 0) 0 0 / 0.875rem 0.625rem repeat-x; }
.rc-body { background: var(--paper); padding: 1.375rem 1.25rem 0.875rem; border-radius: 0.125rem 0.125rem 0 0; background-image: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.012) 0 2px, transparent 2px 4px); }
.rc-head { display: grid; justify-items: center; gap: 0.125rem; text-align: center; padding-bottom: 0.25rem; }
.rc-head img { width: 1.75rem; height: 1.75rem; border-radius: 0.4375rem;margin-bottom: 0.25rem; filter: grayscale(1) contrast(1.2); }
.rc-head strong { font-size: 0.9375rem; letter-spacing: 0.04em; }
.rc-head span { font-size: 12px; color: #7a746b; }
.rc-rule { height: 0; margin: 0.625rem 0; border-top: 1.5px dashed #c9c2b6; }
.rc-rule.rc-double { border-top-style: double; border-top-width: 0.1875rem; }
.rc-row { display: flex; align-items: baseline; gap: 0.375rem; padding: 0.0625rem 0; }
.rc-left { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-dots { flex: 1; min-width: 0.75rem; border-bottom: 1.5px dotted #d6cfc3; transform: translateY(-0.25rem); }
.rc-amt { white-space: nowrap; font-variant-numeric: tabular-nums; }
.rc-group { margin-top: 0.625rem; font-weight: 700; }
.rc-group:first-of-type { margin-top: 0; }
.rc-row:not(.rc-group):not(.rc-total):not(.rc-note) { color: #4b463f; padding-left: 0.625rem; }
.rc-day { display: inline-block; width: 2.6ch; color: #9a9389; }
.rc-back .rc-amt { color: #2f7d4a; }
.rc-note .rc-left { white-space: normal; font-size: 12px; color: #7a746b; }
.rc-note.rc-share { padding-left: 0.625rem; }
.rc-total { font-size: 1.0625rem; font-weight: 800; }
.rc-sub { margin-top: 0.125rem; text-align: right; font-size: 12px; color: #7a746b; }
.rc-barcode { display: flex; justify-content: center; margin-top: 1.125rem; }
.rc-barcode span { width: 70%; height: 2.375rem; background: repeating-linear-gradient(90deg, var(--ink-r) 0 2px, transparent 2px 3px, var(--ink-r) 3px 4px, transparent 4px 7px, var(--ink-r) 7px 10px, transparent 10px 11px, var(--ink-r) 11px 12px, transparent 12px 15px); opacity: 0.85; }
.rc-thanks { margin-top: 0.5rem; text-align: center; font-size: 12px; letter-spacing: 0.2em; color: #7a746b; }
.rc-tools { position: fixed; z-index: 61; top: calc(0.875rem + env(safe-area-inset-top)); right: 0.875rem; display: flex; gap: 0.5rem; animation: fade 0.2s ease-out backwards; }
/* Dark glass, so they show over the dim page and over the paper alike. */
.rc-close { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%; background: rgba(24, 24, 24, 0.55); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: #fff; cursor: pointer; }
.rc-close:hover { background: rgba(24, 24, 24, 0.75); }
@media (max-width: 520px) { .receipt-layer { padding-top: calc(4rem + env(safe-area-inset-top)); } }
.rc-returned { margin-top: 0.625rem; text-align: left; }
/* The owner's note on a payment, under its line. */
.rc-memo { padding-left: calc(0.625rem + 2.6ch); font-size: 12px; color: #7a746b; overflow-wrap: anywhere; }
/* Fixing a month: the pencil beside the ×; lines turn into buttons. */
.rc-edit[aria-pressed="true"], .rc-edit[aria-pressed="true"]:hover { background: #fbfaf5; color: #2b2723; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); }
.editing .rc-row.rc-item:not(.rc-group):not(.rc-total) { appearance: none; width: calc(100% + 0.75rem); margin: 0.0625rem -0.375rem; padding: 0.125rem 0.375rem 0.125rem 1rem; border: 0; border-radius: 0.25rem; background: rgba(43, 39, 35, 0.045); font: inherit; text-align: left; cursor: pointer; }
.editing .rc-item:hover, .editing .rc-item[aria-expanded="true"] { background: rgba(43, 39, 35, 0.1); }
/* The payment editor, as part of the paper. */
.receipt .pay-editor { gap: 0.5rem; margin: 0.25rem 0 0.625rem; padding: 0.625rem; border: 1.5px dashed #c9c2b6; border-radius: 0.375rem; font-family: var(--font); }
.receipt .pay-note { padding: 0.4375rem 0.625rem; border: 1px solid #d6cfc3; border-radius: 0.375rem; background: #fff; color: #2b2723; font-size: 0.875rem; box-shadow: none; }
.receipt .pay-note:focus { border-color: #2b2723; box-shadow: none; }
.receipt .pay-note::placeholder { color: #9a9389; }
.receipt .pay-offer { color: #2f5f9e; font-size: max(12px, 0.8125rem); }
.receipt .chip { background: transparent; box-shadow: inset 0 0 0 1px #d6cfc3; color: #2b2723; font-size: max(12px, 0.8125rem); }
.receipt .chip:hover { background: rgba(43, 39, 35, 0.06); }
.receipt .chip[aria-pressed="true"] { background: #2b2723; color: #fbfaf5; box-shadow: none; }
.receipt .chip.ghost { box-shadow: none; color: #7a746b; }
.receipt .chip-input { border-color: #2b2723; background: #fff; color: #2b2723; box-shadow: none; }

/* ---------- Settings: a title, an index, one column of sections ---------- */

.settings-page { display: grid; gap: 1.375rem; animation: fade 0.16s ease-out backwards; }
.page-title h1 { font-size: 1.625rem; font-weight: 600; letter-spacing: -0.02em; }
.page-title p { margin-top: 0.25rem; color: var(--ink-2); font-size: 0.90625rem; }
.set-nav { display: none; }
.set-body { display: grid; gap: 1.875rem; min-width: 0; }
.set-section { display: grid; gap: 0.625rem; scroll-margin-top: 5.25rem; min-width: 0; }
.set-label { margin: 0 0 0 0.125rem; font-size: max(12px, 0.78125rem); font-weight: 600; letter-spacing: 0.08em; color: var(--ink-3); }
.card-title { margin: 0; font-size: 0.9375rem; font-weight: 600; }
@media (min-width: 1080px) {
  .settings-page { grid-template-columns: 180px minmax(0, 760px); justify-content: center; column-gap: 3rem; align-items: start; }
  .page-title { grid-column: 2; }
  .set-nav { display: grid; gap: 0.125rem; position: sticky; top: 5.25rem; grid-row: 2; grid-column: 1; }
  .set-body { grid-column: 2; grid-row: 2; }
  .set-nav-link { appearance: none; border: 0; background: none; text-align: left; padding: 0.4375rem 0.625rem; border-radius: 0.5rem; font: inherit; font-size: 0.90625rem; color: var(--ink-2); cursor: pointer; transition: background-color 0.15s, color 0.15s; }
  .set-nav-link:hover { background: var(--chip); color: var(--ink); }
  .set-nav-link.is-current { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 0 0 1px var(--line), var(--shadow); }
}

/* ---------- connections: one hairline row per service ---------- */

.conn-list { list-style: none; margin: 0; padding: 0; }
.conn { border-top: 1px solid var(--line); transition: background-color 0.4s ease; }
.conn-list > .conn:first-child { border-top: 0; }
.conn-line { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) auto; align-items: center; gap: 0.875rem; padding: 0.875rem 0; }
.conn-mark { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 0.625rem; background: var(--chip); color: var(--ink); font-family: var(--mono); font-size: max(12px, 0.8125rem); font-weight: 500; box-shadow: inset 0 0 0 1px var(--line); transition: background-color 0.3s, color 0.3s; }
.conn-mark.mark-btc { background: color-mix(in srgb, var(--btc) 14%, var(--surface)); color: #b85f00; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--btc) 30%, transparent); font-family: var(--font); font-size: 1.0625rem; font-weight: 600; }
.conn-mark.is-muted { opacity: 0.5; }
.conn-main { min-width: 0; }
.conn-name { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.5rem; font-weight: 600; font-size: 0.96875rem; }
.conn-status { display: flex; align-items: center; gap: 0.4375rem; margin-top: 0.125rem; font-size: max(12px, 0.84375rem); color: var(--ink-2); min-width: 0; }
.conn-status > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-status .dot { flex: none; width: 0.4375rem; height: 0.4375rem; border-radius: 50%; background: var(--ink-3); }
.conn-status.is-ok { color: var(--good-ink); }
.conn-status.is-ok .dot { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 18%, transparent); }
.conn-status.is-bad { color: var(--crit-ink); }
.conn-status.is-bad .dot { background: var(--crit); }
.conn-status.is-busy { color: var(--ink); }
.conn-actions { display: flex; align-items: center; gap: 0.375rem; }
.conn-panel { padding: 0 0 1rem 3.125rem; animation: unfold 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
@keyframes unfold { from { opacity: 0; transform: translateY(-4px); } }
.conn.is-open .conn-line { padding-bottom: 0.625rem; }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.panel-actions .grow { flex: 1 1 100%; margin: 0; }
.panel-actions .text-btn.danger { margin-left: auto; }

/* A row that just worked glows green once, and its mark turns into a check. */
.conn.just-connected { background: color-mix(in srgb, var(--good) 7%, transparent); }
.conn.just-connected .conn-mark { background: var(--good); color: #fff; box-shadow: none; animation: pop-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Working: a spinner in the button and in the status line. */
.spinner { display: inline-block; flex: none; width: 0.8125rem; height: 0.8125rem; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; vertical-align: -0.125rem; }
.btn.is-busy { cursor: progress; opacity: 1; }
.btn-primary.is-busy { background: color-mix(in srgb, var(--ink) 80%, var(--page)); }
.icon-action { appearance: none; display: grid; place-items: center; width: 2.125rem; height: 2.125rem; padding: 0; border: 0; border-radius: 0.625rem; background: transparent; color: var(--ink-2); cursor: pointer; transition: background-color 0.15s, color 0.15s; }
.icon-action:hover:not(:disabled) { background: var(--chip); color: var(--ink); }
.icon-action:disabled { cursor: progress; }
.icon-action.is-spinning svg { animation: spin 0.8s linear infinite; }
.text-btn.danger { color: var(--crit-ink); font-weight: 500; }
.text-btn.danger.armed { padding: 0.375rem 0.625rem; border-radius: 0.5rem; background: color-mix(in srgb, var(--crit) 12%, transparent); font-weight: 600; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.shake { animation: shake 0.35s ease-in-out; }
.drop.drop-sm { padding: 0.875rem; font-size: 0.90625rem; }

/* Linking a bank: two numbered steps. */
.link-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 0.875rem; }
.link-steps > li { counter-increment: step; position: relative; display: grid; gap: 0.375rem; padding-left: 2rem; justify-items: start; }
.link-steps > li::before { content: counter(step); position: absolute; left: 0; top: -0.0625rem; display: grid; place-items: center; width: 1.375rem; height: 1.375rem; border-radius: 50%; background: var(--ink); color: var(--page); font-size: 12px; font-weight: 600; }
.link-steps > li.is-done::before { content: "✓"; background: var(--good); color: #fff; }
.link-steps .hint { margin: 0; }
.paste-row { display: flex; gap: 0.5rem; width: 100%; }
.paste-row .input { flex: 1; min-width: 0; }
@media (max-width: 560px) {
  .conn-line { grid-template-columns: 2rem minmax(0, 1fr) auto; gap: 0.75rem; align-items: start; }
  .conn-mark { width: 2rem; height: 2rem; margin-top: 0.125rem; }
  .conn-status { align-items: flex-start; }
  .conn-status .dot, .conn-status .spinner { margin-top: 0.375rem; }
  .conn-status > span:last-child { white-space: normal; }
  .conn-panel { padding-left: 0; }
  .paste-row { flex-direction: column; }
}
@media (prefers-color-scheme: dark) { .conn-mark.mark-btc { color: #f7a440; } }

/* A field's explanation: a small "?" beside its label, open on hover or tap. */
.info-tip { appearance: none; display: inline-grid; place-items: center; width: 1rem; height: 1rem; margin-left: 0.375rem; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: transparent; color: var(--ink-3); font: inherit; font-size: 10.5px; font-weight: 600; line-height: 1; vertical-align: 0.0625rem; cursor: help; }
.info-tip:hover, .info-tip:focus-visible { color: var(--ink); border-color: var(--ink-3); }
.field > label { display: flex; align-items: center; }
.seg-tip { display: flex; align-items: center; gap: 0.5rem; }
.seg-tip .seg { flex: 1; }
/* Rules: which way the money goes, as an arrow. */
.rule-who { grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 0.5rem; }
.rule-dir { display: inline-grid; place-items: center; width: 1.375rem; height: 1.375rem; border-radius: 0.375rem; font-size: max(12px, 0.8125rem); font-weight: 600; }
.rule-dir.is-in { background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good-ink); }
.rule-dir.is-out { background: var(--chip); color: var(--ink-2); }
.rule-dir.is-trip { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent-ink); }
.rule-span { font-size: 0.875rem; color: var(--ink-2); }
.card-sub .tip, .card-title .tip, details > summary .tip, .acc-kind .tip, .rung-name .tip { text-decoration: underline dotted color-mix(in srgb, var(--ink-3) 70%, transparent); text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: 0.92em; }
.rule-pick { display: flex; gap: 0.5rem; align-items: center; }
.rule-pick .select { flex: 1; min-width: 0; }
.acc-figure { display: grid; justify-items: end; }
.acc-coins { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.acc-gain { font-size: max(12px, 0.8125rem); font-weight: 600; font-variant-numeric: tabular-nums; }
.acc-gain.is-up { color: var(--good-ink); }
.acc-gain.is-down { color: var(--crit-ink); }
.acc-figure .tip::after { left: auto; right: 0; text-align: left; } /* the figure sits at the right edge */
.acc-unvalued { display: grid; gap: 0.25rem; justify-items: start; margin-top: 0.25rem; }

/* ---------- bill rules: one fold per kind, each with its form ---------- */

.rule-card { padding: 0.125rem 1.25rem; }
.rule-group + .rule-group { border-top: 1px solid var(--line); }
.rule-group > summary { display: flex; align-items: center; gap: 0.625rem; padding: 0.9375rem 0; font-weight: 600; cursor: pointer; list-style: none; }
.rule-group > summary::-webkit-details-marker { display: none; }
.rule-group > summary > span:first-child { flex: 1; }
.rule-count { color: var(--ink-3); font-size: 0.875rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.rule-group > summary svg { flex: none; color: var(--ink-3); transition: transform 0.2s; }
.rule-group[open] > summary svg { transform: rotate(90deg); }
.rule-body { display: grid; gap: 0.875rem; padding-bottom: 1.125rem; animation: unfold 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
.rule-name { display: grid; min-width: 0; }
.rule-sub { font-size: max(12px, 0.78125rem); color: var(--ink-3); overflow-wrap: anywhere; }
/* A form under its list: name, what it is, the button; what it read below. */
.rule-add { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; align-items: center; gap: 0.5rem; padding-top: 0.875rem; border-top: 1px solid var(--line); }
.rule-body > .rule-add:first-child { padding-top: 0; border-top: 0; }
.rule-add .input { padding: 0.5625rem 0.75rem; font-size: 0.9375rem; }
.rule-add .hint { grid-column: 1 / -1; margin: 0; }
.rule-add .hint:empty { display: none; }
.trip-add { grid-template-columns: auto minmax(0, 1fr) auto; }
.trip-days { display: flex; align-items: center; gap: 0.375rem; color: var(--ink-3); }
.trip-days .input { width: 10.5em; }
@media (max-width: 560px) {
  .rule-add, .trip-add { grid-template-columns: minmax(0, 1fr) auto; }
  .rule-add > :first-child { grid-column: 1 / -1; }
  .trip-days .input { flex: 1; width: auto; min-width: 0; }
}
/* Finding one payment, then saying what it was. */
.pay-editor { display: grid; gap: 0.625rem; }
.pay-note { padding: 0.5625rem 0.75rem; font-size: 0.9375rem; }
.pay-offer { appearance: none; justify-self: start; padding: 0; border: 0; background: none; color: var(--accent-ink); font: inherit; font-size: max(12px, 0.84375rem); font-weight: 600; text-align: left; cursor: pointer; }
.pay-found { display: grid; }
.pay-row { appearance: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: baseline; gap: 0.625rem; width: 100%; padding: 0.625rem 0.25rem; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); font: inherit; font-size: 0.90625rem; text-align: left; cursor: pointer; transition: background-color 0.15s; }
.pay-row:first-child { border-top: 0; }
.pay-row.with-edit { grid-template-columns: auto minmax(0, 1fr) auto auto auto; }
.bills-all { max-height: 27.5rem; overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pay-pencil { display: inline-grid; color: var(--ink-3); }
.pay-row.with-edit[aria-expanded="true"] .pay-pencil { color: var(--accent-ink); }
@media (max-width: 520px) { .pay-row.with-edit { grid-template-columns: minmax(0, 1fr) auto auto; row-gap: 0.125rem; } .pay-row.with-edit .pay-day { grid-column: 1; grid-row: 2; } .pay-row.with-edit .pay-cat { grid-column: 2; grid-row: 2; justify-self: end; } .pay-row.with-edit .pay-name { grid-row: 1; grid-column: 1; } .pay-row.with-edit .num { grid-row: 1; grid-column: 2; justify-self: end; } .pay-row.with-edit .pay-pencil { grid-row: 1 / 3; grid-column: 3; align-self: center; } }
.bills-sum { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.25rem 0.625rem; }
.bills-total { font-size: 2.125rem; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pay-row:hover, .pay-row[aria-expanded="true"] { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.pay-day, .pay-cat { color: var(--ink-3); font-size: max(12px, 0.8125rem); white-space: nowrap; }
.pay-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.pay-row .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay-memo { margin: -0.375rem 0 0.375rem; padding: 0 0.25rem; font-size: max(12px, 0.78125rem); color: var(--ink-3); overflow-wrap: anywhere; }
.pay-found .pay-editor { padding: 0.25rem 0.25rem 1rem; }
.pay-lesson { display: grid; gap: 0.375rem; padding: 0 0.25rem 0.625rem; }
.receipt .pay-lesson { margin: 0.125rem 0 0.5rem; font-family: var(--font); }
.rule.rule-2 { grid-template-columns: minmax(0, 1fr) auto; }
.rule-dir.is-label { background: var(--chip); color: var(--ink-2); }
.rule-label { padding: 0.4375rem 0.625rem; font-size: 0.9375rem; font-weight: 600; }
.rule-tag .rule-pick .grow { flex: 1; min-width: 0; }
.rule-merge { grid-column: 1 / -1; }
.derived.connected .grow { flex: 1; min-width: 0; }
/* What the app filed by itself: a dashed chip marks the guess; the row is the fix. */
.rule-guesses { padding-top: 0.875rem; border-top: 1px solid var(--line); }
.rule-body > .rule-guesses:first-child { padding-top: 0; border-top: 0; }
.pay-row.place-row { grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; }
.chip.guess { padding: 0.25rem 0.625rem; border: 1px dashed var(--line-strong); background: transparent; color: var(--ink-2); font-weight: 500; }
.chips .chip.guess { padding: 0.3125rem 0.625rem; } /* as tall as the answered ones beside it */
.pay-row:hover .chip.guess { border-color: var(--ink-3); color: var(--ink); }
/* A place learned from repeated fixes, said where it happened. */
.pay-learned { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; margin: 0; color: var(--good-ink); font-size: max(12px, 0.84375rem); font-weight: 600; }
.pay-learned svg { flex: none; }
.pay-learned .pay-offer { margin-left: 0.25rem; }
.receipt .pay-learned { color: #2f7d4a; font-size: max(12px, 0.8125rem); }
/* On a phone a found row takes two lines: what and how much, then when and how it is filed. */
@media (max-width: 420px) {
  .pay-row, .pay-row.place-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0.125rem; }
  .pay-row .pay-name { grid-area: 1 / 1; }
  .pay-row .num { grid-area: 1 / 2; }
  .pay-row .pay-day { grid-area: 2 / 1; }
  .pay-row .pay-cat { grid-area: 2 / 2; justify-self: end; }
  .pay-row .chip.guess { grid-area: 1 / 2 / 3 / 3; align-self: center; }
}

/* ---------- audit: the year's decisions, place by place ---------- */

.audit-card { padding: 1rem 1.25rem 0.75rem; }
.audit-card > h2 { margin-bottom: 0.25rem; }
.audit-row { appearance: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name amt" "why chip"; align-items: center; gap: 0.1875rem 0.75rem; width: 100%; padding: 0.6875rem 0.125rem; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: background-color 0.15s; }
.audit-row:hover, .audit-row[aria-expanded="true"] { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.audit-name { grid-area: name; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.audit-amt { grid-area: amt; font-variant-numeric: tabular-nums; white-space: nowrap; }
.audit-why { grid-area: why; min-width: 0; font-size: max(12px, 0.8125rem); color: var(--ink-3); overflow-wrap: anywhere; }
.audit-why.is-doubt { color: var(--warn-ink); font-weight: 600; }
.audit-row .chip { grid-area: chip; justify-self: end; padding: 0.125rem 0.625rem; font-size: max(12px, 0.78125rem); }
.audit-row .chip.guess { padding: 0.0625rem 0.5625rem; }
.audit-open { display: grid; gap: 0.75rem; padding: 0.375rem 0.125rem 1rem; }
.audit-pays { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.audit-pay { appearance: none; padding: 0.25rem 0.5625rem; border: 0; border-radius: 0.5rem; background: var(--chip); color: var(--ink-2); font: inherit; font-size: max(12px, 0.78125rem); font-variant-numeric: tabular-nums; }
button.audit-pay { cursor: pointer; }
button.audit-pay:hover { color: var(--ink); }
.audit-pay[aria-pressed="true"] { background: var(--ink); color: var(--page); }
.audit-cat { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.875rem 0.125rem 0.375rem; border-top: 1px solid var(--line-strong); font-size: max(12px, 0.84375rem); font-weight: 600; color: var(--ink-2); }
.audit-card > h2 + .audit-cat { border-top: 0; }
.audit-cat + .audit-row { border-top: 0; }
.pay-why { margin: 0; font-size: max(12px, 0.78125rem); color: var(--ink-3); }
.receipt .pay-why { color: #7a746b; }
/* Links into the audit. */
.card-link-end { display: inline-flex; align-items: center; gap: 0.625rem; }
.count-badge { min-width: 1.375rem; padding: 0.0625rem 0.4375rem; border-radius: 999px; background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn-ink); font-size: max(12px, 0.78125rem); font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.rule-link { display: flex; align-items: center; justify-content: space-between; gap: 0.625rem; padding-top: 0.875rem; border-top: 1px solid var(--line); color: var(--accent-ink); font-size: 0.90625rem; font-weight: 600; }
.rule-body > .rule-link:first-child { padding-top: 0; border-top: 0; }

/* ---------- answers, grouped by what they do ---------- */

.answers { display: grid; gap: 0.5rem; }
.ask-card .answers { margin-top: 0.625rem; }
.ask-card .answers .chips { margin-top: 0; }
.answer-row { display: grid; grid-template-columns: 4.6em minmax(0, 1fr); align-items: start; gap: 0.625rem; }
.answer-what { padding-top: 0.4375rem; font-size: max(12px, 0.78125rem); font-weight: 600; color: var(--ink-3); white-space: nowrap; }

/* ---------- a dialog over the page (核对) ---------- */

.sheet-layer {
  position: fixed; inset: 0; z-index: 60;
  padding: 0 1rem;
  background: color-mix(in srgb, #000 40%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: fade 0.2s ease-out backwards;
}
.sheet-layer.closing { animation: fade-out 0.2s ease-in both; }
.sheet { width: min(720px, 100%); margin: calc(1.5rem + env(safe-area-inset-top)) auto 3rem; border-radius: 1.125rem; background: var(--page); box-shadow: var(--shadow-lifted); animation: rise 0.24s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
/* The title and the × stay in view while the list scrolls; the space
   above the sheet is its margin, so nothing shows above the stuck head. */
.sheet-head { position: sticky; top: 0; z-index: 2; display: grid; gap: 0.625rem; padding: 0.875rem 0.875rem 0.75rem 1.25rem; border-radius: 1.125rem 1.125rem 0 0; background: color-mix(in srgb, var(--page) 90%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.sheet-title { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.sheet-title h1 { font-size: 1.375rem; font-weight: 600; letter-spacing: -0.02em; }
.sheet-body { display: grid; gap: 0.75rem; padding: 0 0.75rem 0.875rem; }
@media (max-width: 560px) {
  .sheet-layer { padding: 0 0.5rem; }
  .sheet { margin: calc(0.5rem + env(safe-area-inset-top)) auto 1.5rem; }
  .sheet-head { padding-left: 1rem; }
  .sheet-body { padding: 0 0.375rem 0.5rem; }
}

/* What opens the dialog is a button that looks like the link beside it. */
button.card-link { appearance: none; width: 100%; text-align: left; cursor: pointer; }
button.nudge { appearance: none; width: 100%; border: 0; background: none; text-align: left; cursor: pointer; }
button.rule-link { appearance: none; width: 100%; padding: 0.875rem 0 0; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
button.inline-link { appearance: none; padding: 0; border: 0; background: none; cursor: pointer; }

/* ---------- adding an account: one of a fixed list ---------- */

.add-btn { display: inline-flex; align-items: center; gap: 0.375rem; justify-self: start; }
.add-list { display: grid; gap: 0.125rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.providers .conn-line { padding: 0.6875rem 0; }
.providers .conn-panel { display: grid; gap: 0.75rem; }
.bank-later { display: grid; gap: 0.125rem; }
.bank-later .conn-list { border-top: 1px solid var(--line); }
.onboarding .providers { margin-top: -0.25rem; }

/* ---------- 流向: where the money goes ---------- */

.flow-hero .eyebrow { margin-bottom: 0.375rem; }
.flow-num { font-size: clamp(2.75rem, 11vw, 3.5rem); font-weight: 600; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.flow-sub { margin-top: 0.5rem; color: var(--ink-2); font-size: 0.9375rem; }
/* One bar across the month's income: fixed, everyday, chosen, then what stays. */
.flow-bar { display: flex; gap: 0.125rem; height: 0.875rem; margin-top: 1.25rem; border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.flow-seg { display: block; min-width: 0; }
.g-fixed { background: var(--ink); }
.g-daily { background: color-mix(in srgb, var(--ink) 58%, var(--surface)); }
.g-chosen { background: color-mix(in srgb, var(--ink) 28%, var(--surface)); }
.g-saved { background: var(--good); }
.flow-keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: 0.75rem 1rem; margin-top: 1rem; }
.flow-key { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 0.4375rem; align-items: center; font-size: max(12px, 0.84375rem); color: var(--ink-2); }
.flow-key i { width: 0.5625rem; height: 0.5625rem; border-radius: 0.1875rem; }
.flow-key-value { grid-column: 2; margin-top: 0.125rem; font-size: 1.0625rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.flow-key-pct { grid-column: 2; font-size: max(12px, 0.78125rem); color: var(--ink-3); }
.flow-key .tip { text-decoration: underline dotted color-mix(in srgb, var(--ink-3) 70%, transparent); text-underline-offset: 3px; }
/* Month bars stacked by group, with a mark for the month's income. */
.flow-legend { display: flex; flex-wrap: wrap; gap: 0.375rem 1rem; margin-top: -0.25rem; font-size: max(12px, 0.84375rem); color: var(--ink-2); }
.flow-legend span { display: inline-flex; align-items: center; gap: 0.4375rem; }
.flow-legend i { width: 0.5625rem; height: 0.5625rem; border-radius: 0.1875rem; }
.flow-legend .flow-income-key { width: 0.875rem; height: 0; border-top: 2px solid var(--accent); border-radius: 0; }
.flow-months { margin-top: 1.5rem; gap: 0.1875rem; }
.flow-stack-wrap { position: relative; display: block; width: 100%; max-width: 2.125rem; min-height: 0.125rem; }
.flow-stack { position: absolute; inset: 0; display: flex; flex-direction: column; border-radius: 0.3125rem 0.3125rem 0.125rem 0.125rem; overflow: hidden; }
.flow-stack .flow-seg { flex-basis: 0; }
.flow-month:hover .flow-stack, .flow-month[aria-pressed="true"] .flow-stack { box-shadow: 0 0 0 2px var(--accent); }
.flow-month:hover .flow-stack { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 50%, transparent); }
.flow-income { position: absolute; left: 10%; right: 10%; height: 0; border-top: 2px solid var(--accent); pointer-events: none; z-index: 1; }
/* Each category's year in a row: name, twelve small bars, the latest amount, how it compares. */
.courses { list-style: none; margin: -0.25rem 0 0; padding: 0; }
.course { border-top: 1px solid var(--line); }
.course:first-child { border-top: 0; }
.course-row { display: grid; grid-template-columns: minmax(0, 1fr) 4.5rem auto minmax(0, 1fr); gap: 0.125rem 0.875rem; align-items: center; width: 100%; padding: 0.625rem 0; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; border-radius: 0.5rem; }
.course-row:disabled { cursor: default; }
.course-row:not(:disabled):hover { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.course-name { font-weight: 500; }
.spark { display: flex; align-items: flex-end; gap: 0.0625rem; height: 1.25rem; }
.spark i { flex: 1; min-height: 0.0625rem; border-radius: 0.0625rem; background: color-mix(in srgb, var(--ink) 30%, var(--surface)); }
.spark i:nth-last-child(-n+3) { background: var(--ink); } /* the latest three months, the ones compared */
.course-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.course-change { color: var(--ink-2); font-size: max(12px, 0.84375rem); text-align: right; }
.course-places { margin: 0 0 0.75rem; }
.course-count { color: var(--ink-3); }
@media (max-width: 520px) {
  .course-row { grid-template-columns: minmax(0, 1fr) auto; }
  .spark { grid-column: 1; grid-row: 2; width: 5rem; }
  .course-change { grid-column: 2; grid-row: 2; }
}
/* The chosen money by what it bought: a hairline row a kind. */
.lenses { display: grid; }
.lens-row { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0.25rem 0.875rem; padding: 0.5625rem 0; border-top: 1px solid var(--line); font-size: 0.90625rem; }
.lens-row:first-child { border-top: 0; padding-top: 0; }
.lens-row:last-child { padding-bottom: 0; }
.lens-k { color: var(--ink-3); font-size: max(12px, 0.84375rem); padding-top: 0.0625rem; }
.lens-v { color: var(--ink); }
.lens-rate .lens-v { color: var(--ink-2); }
.lens-v .tip { text-decoration: underline dotted color-mix(in srgb, var(--ink-3) 70%, transparent); text-underline-offset: 3px; }
@media (max-width: 520px) { .lens-row { grid-template-columns: minmax(0, 1fr); } }
/* A row at a card's foot that leads to the page with more. */
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--line); font-size: 0.875rem; font-weight: 600; }
.card-foot-link { display: flex; align-items: center; gap: 0.5rem; color: var(--accent-ink); }
.card-foot svg { color: var(--ink-3); }
.card-foot .inline-link { font-size: max(12px, 0.84375rem); }
.flow-year { margin-top: 0.25rem; }
.flow-year .tip { text-decoration: underline dotted color-mix(in srgb, var(--ink-3) 70%, transparent); text-underline-offset: 3px; }
.lens-k .tip { text-decoration: underline dotted color-mix(in srgb, var(--ink-3) 70%, transparent); text-underline-offset: 3px; }
.course-places { margin: 0 0 0.75rem; }
.course-places .sub-list { margin-top: 0.25rem; }
.course-places .fine { margin: 0 0 0 1.75rem; }
/* The months the 流向 page looks at. */
/* Five short names fit a phone in one row; the pill scrolls sideways before it wraps. */
.flow-range { display: flex; overflow-x: auto; scrollbar-width: none; }
.flow-range .seg { width: auto; flex: none; }
@media (min-width: 720px) { .flow-range { justify-content: flex-end; } }
.flow-range .seg-btn { white-space: nowrap; padding: 0.4375rem 0.625rem; }
.spark.dense { gap: 0; }

