/* Paidfolio: design system.
   A calm "financial notebook": warm paper, deep ink, one forest green for action, ochre for what's next.
   Source Serif 4 carries numbers and headings; Instrument Sans carries everything you tap.
   Order: fonts, tokens (light, dark), base, layout, type, components, screens. Components use tokens only. */

@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f6f4ee;
  --panel: #fffefb;
  --panel-2: #f0ede5;
  --rule: #e4dfd4;
  --rule-strong: #cdc6b8;
  --field: #8c877c;
  --ink: #1b1d1a;
  --ink-2: #4a4e47;
  --ink-3: #62665d;
  --green: #1f5a47;
  --green-hover: #174536;
  --on-green: #fbfaf6;
  --green-soft: #e6ede8;
  --green-ink: #1f5a47;
  --ochre: #875809;
  --ochre-dot: #b47a1c;
  --ochre-soft: #f5ead5;
  --ochre-line: #e6d2a8;
  --danger: #a3291f;
  --danger-soft: #f8e8e5;
  --chart-line: #1f5a47;
  --chart-base: #858a80;
  --chart-grid: #e9e5db;
  --scrim: rgba(27, 29, 26, 0.42);
  --lift: 0 1px 0 rgba(27, 29, 26, 0.03), 0 12px 32px rgba(27, 29, 26, 0.12);
  --serif: "Source Serif 4", "Iowan Old Style", Charter, Georgia, serif;
  --sans: "Instrument Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 12px;
  --r-sm: 8px;
  --rail: 236px;
  --tabbar-h: 62px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #121513; --panel: #181c19; --panel-2: #1f2420; --rule: #2a302b; --rule-strong: #3c433d; --field: #6d756e;
    --ink: #ece9e1; --ink-2: #bbbcb3; --ink-3: #91958b;
    --green: #96c9b2; --green-hover: #acd6c3; --on-green: #10241c; --green-soft: #1d2c25; --green-ink: #a6d4bf;
    --ochre: #dfae5c; --ochre-dot: #dfae5c; --ochre-soft: #2d2517; --ochre-line: #4a3b22;
    --danger: #f0968b; --danger-soft: #35211e;
    --chart-line: #96c9b2; --chart-base: #6f736b; --chart-grid: #262b27;
    --scrim: rgba(0, 0, 0, 0.6); --lift: 0 14px 36px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121513; --panel: #181c19; --panel-2: #1f2420; --rule: #2a302b; --rule-strong: #3c433d; --field: #6d756e;
  --ink: #ece9e1; --ink-2: #bbbcb3; --ink-3: #91958b;
  --green: #96c9b2; --green-hover: #acd6c3; --on-green: #10241c; --green-soft: #1d2c25; --green-ink: #a6d4bf;
  --ochre: #dfae5c; --ochre-dot: #dfae5c; --ochre-soft: #2d2517; --ochre-line: #4a3b22;
  --danger: #f0968b; --danger-soft: #35211e;
  --chart-line: #96c9b2; --chart-base: #6f736b; --chart-grid: #262b27;
  --scrim: rgba(0, 0, 0, 0.6); --lift: 0 14px 36px rgba(0, 0, 0, 0.5);
}

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 var(--sans); font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--green-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
.ico { flex: none; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--panel); padding: 10px 14px; border: 1px solid var(--rule); border-radius: var(--r-sm); }
.skip:focus { top: 12px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ---------------------------------------------------------------- type */

.num, .money { font-variant-numeric: lining-nums tabular-nums; }
.display {
  font-family: var(--serif); font-weight: 600; font-variation-settings: "opsz" 60;
  font-size: clamp(50px, 13vw, 74px); line-height: 0.98; letter-spacing: -0.028em;
  font-variant-numeric: lining-nums tabular-nums;
}
.display .cents { font-size: 0.46em; letter-spacing: -0.01em; color: var(--ink-3); font-weight: 500; vertical-align: 0.82em; margin-left: 0.04em; }
.display .cur { font-size: 0.62em; letter-spacing: 0; margin-left: 0.08em; }
.display.date { font-size: clamp(40px, 10vw, 56px); }
.display.sm { font-size: clamp(34px, 8vw, 44px); }
.title { font-family: var(--serif); font-weight: 600; font-variation-settings: "opsz" 40; font-size: clamp(28px, 6vw, 36px); line-height: 1.1; letter-spacing: -0.018em; }
.h2 { font-family: var(--serif); font-weight: 600; font-variation-settings: "opsz" 24; font-size: 21px; line-height: 1.25; letter-spacing: -0.01em; }
.h3 { font-weight: 600; font-size: 16px; line-height: 1.35; }
.kicker { font-size: 11.5px; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.lead { font-size: 16.5px; color: var(--ink-2); max-width: 52ch; }
.lead strong, .muted strong { color: var(--ink); font-weight: 600; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.serif-num { font-family: var(--serif); font-variant-numeric: lining-nums tabular-nums; font-weight: 600; }

/* ---------------------------------------------------------------- layout */

.shell { min-height: 100dvh; }
.rail { display: none; }
.main { padding: 8px 18px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); max-width: 1120px; margin: 0 auto; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 0 6px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--rule);
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink-3); text-decoration: none; font-size: 11.5px; font-weight: 600; -webkit-tap-highlight-color: transparent;
}
.tab .ico { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 28%; right: 28%; height: 2px; background: var(--green); border-radius: 0 0 2px 2px; }

@media (min-width: 980px) {
  .shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); }
  .tabbar, .topbar { display: none; }
  .rail {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh;
    padding: 28px 18px 22px; border-right: 1px solid var(--rule); background: var(--paper);
  }
  .main { padding: 40px 48px 72px; width: 100%; }
}

.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); }
/* The brand mark keeps its own colours in both themes, like the app icon. */
.brand-mark { --brand-dot: #d9a441; width: 30px; height: 30px; border-radius: 8px; background: #1f5a47; color: #fbfaf6; display: grid; place-items: center; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.brand-mark .brand-dot { fill: var(--brand-dot); }
.brand-name { font-family: var(--serif); font-weight: 650; font-size: 19px; letter-spacing: -0.012em; font-variation-settings: "opsz" 24; }
.rail .brand { padding: 0 8px 30px; }
.nav { display: grid; gap: 2px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 10px;
  border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-size: 15px; font-weight: 500;
}
.nav a .ico { color: var(--ink-3); }
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 650; background: var(--panel); box-shadow: inset 0 0 0 1px var(--rule); }
.nav a[aria-current="page"] .ico { color: var(--green-ink); }
.rail-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--ink-3); display: flex; gap: 8px; line-height: 1.45; }

/* ---------------------------------------------------------------- page head & sections */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 12px 0 22px; flex-wrap: wrap; }
.page-head .kicker { margin-bottom: 8px; }
.cols { display: grid; gap: 20px; }
@media (min-width: 980px) { .cols { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); align-items: start; gap: 24px; } }
.stack { display: grid; gap: 20px; min-width: 0; }
.stack > *, .cols > * { min-width: 0; }

.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r); padding: 22px; }
.panel.tight { padding: 18px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head .h2 + .faint { margin-top: 2px; }
.rule { height: 1px; background: var(--rule); border: 0; margin: 18px 0; }

/* The two-part summary at the top of Today and Debts */
.summary { display: grid; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r); margin-bottom: 20px; }
.summary > section { padding: 24px; min-width: 0; }
.summary > section + section { border-top: 1px solid var(--rule); }
@media (min-width: 760px) {
  .summary { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
  .summary > section + section { border-top: 0; border-left: 1px solid var(--rule); }
  .summary > section { padding: 28px 30px; }
}
.summary .kicker { margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.summary .lead { margin-top: 12px; }

/* "Right now, one thing" */
.now { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; align-items: start; padding: 16px 18px; border: 1px solid var(--rule); border-left: 3px solid var(--ochre-dot); border-radius: var(--r-sm); background: var(--panel); margin-bottom: 20px; }
.now .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ochre-dot); margin-top: 8px; }
.now .now-body { display: grid; gap: 4px; }
.now .now-act { grid-column: 2; margin-top: 8px; }
.now.done { border-left-color: var(--green); }
.now.done .dot { background: var(--green); }

/* Example notice */
.notice { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 11px 14px; margin: 0 0 18px; border-radius: var(--r-sm); background: var(--ochre-soft); border: 1px solid var(--ochre-line); font-size: 14.5px; }
.notice .label { font-weight: 650; }
.notice .text { flex: 1 1 260px; color: var(--ink-2); }
.notice.demo { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 28%, transparent); }
.notice.demo .label { color: var(--green-ink); }
@media (max-width: 559px) {
  .notice { padding: 8px 8px 8px 12px; gap: 10px; flex-wrap: nowrap; }
  .notice .label { flex: 1; font-size: 14px; }
  .notice .text { display: none; }
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: var(--r-sm); border: 1px solid transparent; font-weight: 600; font-size: 15px; letter-spacing: 0.005em;
  text-decoration: none; white-space: nowrap; transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn.primary { background: var(--green); color: var(--on-green); }
.btn.primary:hover { background: var(--green-hover); }
.btn.secondary { background: var(--panel); border-color: var(--rule-strong); color: var(--ink); }
.btn.secondary:hover { border-color: var(--ink-3); }
.btn.quiet { background: transparent; color: var(--green-ink); padding: 0 6px; min-height: 40px; }
.btn.quiet:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.btn.danger { background: transparent; border-color: var(--rule-strong); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn:active { transform: translateY(1px); }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-sm); background: transparent; border: 0; color: var(--ink-3); }
.icon-btn:hover { background: var(--panel-2); color: var(--ink); }
.link { background: none; border: 0; padding: 4px 0; color: var(--green-ink); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, var(--green-ink) 35%, transparent); }
.link:hover { text-decoration-color: currentColor; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- choices: radio list, tabs, chips */

.choices { display: grid; gap: 8px; }
.choice {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 2px 12px; align-items: start; text-align: left; width: 100%;
  padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--rule); background: var(--panel); color: var(--ink);
}
.choice:hover { border-color: var(--rule-strong); }
.choice .radio { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--field); margin-top: 2px; display: grid; place-items: center; }
.choice[aria-checked="true"] { border-color: var(--green); background: var(--green-soft); }
.choice[aria-checked="true"] .radio { border-color: var(--green); }
.choice[aria-checked="true"] .radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.choice .c-title { font-weight: 650; }
.choice .c-help { grid-column: 2; font-size: 13.5px; color: var(--ink-2); }

.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--rule); margin-bottom: 20px; }
.tabs button { position: relative; background: none; border: 0; padding: 10px 0 12px; font-weight: 600; color: var(--ink-3); min-height: 44px; }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--green); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--rule); background: var(--panel); color: var(--ink-2); font-size: 14px; font-weight: 550; }
.chip:hover { border-color: var(--rule-strong); }
.chip[aria-pressed="true"] { border-color: var(--green); color: var(--green-ink); background: var(--green-soft); }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.next { color: var(--ochre); }
.tag.next::before { background: var(--ochre-dot); }
.tag.done { color: var(--green-ink); }

/* ---------------------------------------------------------------- forms */

.field { display: grid; gap: 6px; }
.field + .field { margin-top: 16px; }
.field > label, .label { font-size: 14px; font-weight: 600; color: var(--ink); }
.field .help { font-size: 13px; color: var(--ink-3); }
.field .error { font-size: 13.5px; color: var(--danger); display: flex; gap: 6px; align-items: flex-start; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--field);
  background: var(--panel); color: var(--ink); font-size: 16px; font-variant-numeric: lining-nums tabular-nums;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
select.input { appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 19px) 21px, calc(100% - 14px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
textarea.input { min-height: 72px; resize: vertical; }
.input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input.with-prefix { padding-left: 36px; }
.input.with-suffix { padding-right: 44px; }
.prefix, .suffix { position: absolute; color: var(--ink-3); pointer-events: none; font-weight: 500; }
.prefix { left: 14px; }
.suffix { right: 14px; }
.row-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.row-2 > .field + .field { margin-top: 0; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 48px; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--field); transition: background 0.2s var(--ease); pointer-events: none; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--panel); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform 0.2s var(--ease); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
details.more { margin-top: 18px; border-top: 1px solid var(--rule); }
details.more summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; min-height: 48px; font-weight: 600; color: var(--green-ink); }
details.more summary::-webkit-details-marker { display: none; }
@media (pointer: fine) {
  details.more summary { min-height: 42px; }
  .sheet-body .switch-row { min-height: 38px; }
}
details.more[open] summary .ico { transform: rotate(180deg); }
input[type="range"] { width: 100%; accent-color: var(--green); height: 32px; margin: 6px 0; }

/* ---------------------------------------------------------------- statement lists */

.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto 44px; align-items: center; gap: 12px;
  min-height: 64px; padding: 10px 0; border-bottom: 1px solid var(--rule);
}
.row:last-child { border-bottom: 0; }
.row.no-date { grid-template-columns: minmax(0, 1fr) auto 44px; }
.dblock { text-align: center; line-height: 1; }
.dblock b { display: block; font-family: var(--serif); font-weight: 600; font-size: 21px; font-variant-numeric: lining-nums; }
.dblock span { display: block; margin-top: 4px; font-size: 10.5px; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.row .name { font-weight: 600; overflow-wrap: break-word; hyphens: auto; min-width: 0; }
.row .meta { font-size: 13.5px; color: var(--ink-3); }
.row .amount { font-weight: 600; font-variant-numeric: lining-nums tabular-nums; text-align: right; white-space: nowrap; }
.row .amount.in { color: var(--green-ink); }
.row.paid .name, .row.paid .amount { color: var(--ink-3); }
.row.paid .amount { text-decoration: line-through; text-decoration-thickness: 1px; }
.day-head { display: flex; justify-content: space-between; padding: 18px 0 6px; border-bottom: 1px solid var(--rule); font-size: 12px; font-weight: 650; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); }
.check { width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; border-radius: var(--r-sm); }
.check span { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--field); display: grid; place-items: center; color: transparent; transition: background 0.15s var(--ease), border-color 0.15s var(--ease); }
.check:hover span { border-color: var(--ink-3); }
.check[aria-pressed="true"] span { background: var(--green); border-color: var(--green); color: var(--on-green); }

/* ---------------------------------------------------------------- the sum (how is this worked out) */

.sum { margin-top: 16px; border-top: 1px solid var(--rule); padding-top: 6px; font-size: 15px; }
.sum-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 6px; padding: 7px 0; align-items: baseline; }
.sum-row .op { color: var(--ink-3); font-weight: 600; }
.sum-row .what .faint { display: block; font-size: 13px; }
.sum-row .money { font-weight: 600; }
.sum-row.total { border-top: 1px solid var(--ink); margin-top: 4px; padding-top: 10px; font-weight: 650; }

/* ---------------------------------------------------------------- progress */

.bar { position: relative; height: 6px; border-radius: 3px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--rule); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--green); border-radius: 3px; transition: width 0.45s var(--ease); }
.bar.over > span { background: var(--ochre-dot); }
.bar.thin { height: 4px; }
.bar-scale { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: lining-nums tabular-nums; }

/* ---------------------------------------------------------------- ledger (debts) */

.ledger { list-style: none; margin: 0; padding: 0; }
.debt { padding: 18px 0; border-bottom: 1px solid var(--rule); display: grid; gap: 10px; }
.debt:first-child { padding-top: 4px; }
.debt:last-child { border-bottom: 0; padding-bottom: 4px; }
.debt-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; }
.debt-name { font-family: var(--serif); font-weight: 600; font-size: 19px; letter-spacing: -0.008em; overflow-wrap: break-word; hyphens: auto; min-width: 0; }
.debt-balance { font-family: var(--serif); font-weight: 600; font-size: 22px; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -0.01em; text-align: right; }
.debt-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13.5px; color: var(--ink-2); }
@media (max-width: 520px) {
  .debt-line { grid-template-columns: minmax(0, 1fr) auto; }
  .debt-line .debt-name { grid-column: 1 / -1; }
  .debt-line .debt-balance { grid-column: 1; text-align: left; order: 2; }
  .debt-line > span:nth-child(4) { grid-column: 2; order: 3; align-self: center; }
  .debt-line > span:nth-child(3) { grid-column: 1 / -1; order: 4; }
}
.debt { position: relative; }
.debt.focus::before { content: ""; position: absolute; left: -22px; top: 14px; bottom: 14px; width: 3px; border-radius: 0 2px 2px 0; background: var(--ochre-dot); }
.debt.focus:first-child::before { top: 2px; }
.debt .actions { margin-top: 2px; }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: lining-nums tabular-nums; }
table.data th { text-align: left; font-size: 11.5px; font-weight: 650; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); padding: 0 10px 10px; border-bottom: 1px solid var(--ink); white-space: nowrap; }
table.data td { padding: 12px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; vertical-align: top; }
table.data td:first-child, table.data th:first-child { padding-left: 0; }
table.data td:last-child, table.data th:last-child { padding-right: 0; }
table.data tr:last-child td { border-bottom: 0; }
table.data .r { text-align: right; }
table.data tr.chosen td { font-weight: 650; }
table.data tr.chosen td:first-child::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-right: 8px; vertical-align: 2px; }
table.data td .sub { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 400; }
table.data td .sub.saved { color: var(--green-ink); font-weight: 600; }
table.data.compare td, table.data.compare th { white-space: normal; }
table.data td.hot { color: var(--green-ink); font-weight: 700; }

/* ---------------------------------------------------------------- chart */

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--chart-line); opacity: 0.06; }
.chart .base { fill: none; stroke: var(--chart-base); stroke-width: 1.5; stroke-dasharray: 2 5; stroke-linecap: round; }
.chart .ms { fill: var(--panel); stroke: var(--ochre-dot); stroke-width: 2; }
.chart .end { fill: var(--chart-line); }
.chart text { fill: var(--ink-3); font: 500 12px var(--sans); font-variant-numeric: lining-nums tabular-nums; }
.chart text.label { fill: var(--ink); font-weight: 650; }
.chart text.ms-label { fill: var(--ochre); font-weight: 650; font-size: 11.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); margin-top: 10px; }
.legend i { display: inline-block; width: 18px; height: 2px; background: var(--chart-line); vertical-align: middle; margin-right: 7px; }
.legend i.base { background: repeating-linear-gradient(90deg, var(--chart-base) 0 2px, transparent 2px 7px); }
.legend i.ms { width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--ochre-dot); background: transparent; }

/* ---------------------------------------------------------------- dialog */

dialog.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: 92dvh;
  border-radius: 16px 16px 0 0; background: var(--panel); color: var(--ink); box-shadow: var(--lift);
  overflow: hidden; display: flex; flex-direction: column;
}
dialog.sheet:not([open]) { display: none; }
dialog.sheet::backdrop { background: var(--scrim); }
dialog.sheet[open] { animation: sheet-in 0.26s var(--ease); }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 14px; border: 1px solid var(--rule); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 10px 6px 24px; }
.sheet-head { transition: box-shadow 0.15s var(--ease); }
.sheet.scrolled .sheet-head { box-shadow: 0 1px 0 var(--rule); }
.sheet-head h2 { font-family: var(--serif); font-weight: 600; font-size: 22px; letter-spacing: -0.01em; }
.sheet-body { padding: 8px 24px 20px; overflow-y: auto; }
.sheet-body .field { margin-top: 16px; }
.sheet-body .row-2 { margin-top: 16px; }
.sheet-body .row-2 > .field, .sheet-body .row-2 > div > .field { margin-top: 0; }
.sheet-body .switch-row { margin-top: 0; }
.sheet-foot { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 24px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); }
.sheet-foot .spacer { flex: 1; }
.steps { display: flex; gap: 6px; margin: 4px 0 16px; }
.steps span { flex: 1; height: 3px; border-radius: 2px; background: var(--rule); }
.steps span.on { background: var(--green); }
.step-title { font-family: var(--serif); font-weight: 600; font-size: 23px; letter-spacing: -0.01em; margin: 8px 0 4px; }

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

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom)); z-index: 60; display: grid; gap: 8px; width: min(92vw, 440px); }
@media (min-width: 980px) { .toasts { bottom: 26px; left: calc(50% + var(--rail) / 2); } }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-radius: 10px; background: var(--ink); color: var(--paper); box-shadow: var(--lift); font-size: 15px; animation: toast-in 0.2s var(--ease); }
.toast span { flex: 1; }
.toast button { background: none; border: 0; color: var(--paper); font-weight: 650; min-height: 36px; padding: 0 10px; text-decoration: underline; text-underline-offset: 3px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------------------------------------------------------- bits */

.quick { display: grid; gap: 12px; }
.quick .line { display: flex; gap: 10px; }
.quick .line .input-wrap { flex: 1; }
.empty { padding: 26px 8px; color: var(--ink-2); display: grid; gap: 12px; justify-items: start; }
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 4px 0 6px; }
.figures > div { padding: 12px 0; }
.figures > div + div { padding-left: 14px; border-left: 1px solid var(--rule); }
.figures .v { font-family: var(--serif); font-weight: 600; font-size: 21px; font-variant-numeric: lining-nums tabular-nums; }
.figures .v.short { color: var(--ochre); }
.plain-list { list-style: none; display: grid; gap: 8px; }
.sync-code { font-family: var(--sans); font-weight: 650; font-size: 21px; letter-spacing: 0.05em; font-variant-numeric: tabular-nums;
  text-align: center; padding: 16px 12px; border: 1px dashed var(--rule-strong); border-radius: var(--r-sm); background: var(--panel-2);
  user-select: all; -webkit-user-select: all; overflow-wrap: anywhere; }
.qr-box { display: grid; place-items: center; margin: 0 0 14px; }
.qr-box .qr { display: block; padding: 6px; background: #fff; border-radius: var(--r-sm); border: 1px solid var(--rule); max-width: 100%; height: auto; }
.scan { margin-top: 12px; }
.scan video { display: block; width: 100%; max-height: 52vh; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-sm); background: #000; }
.scan p { margin-top: 8px; }
.steps { margin: 16px 0 0 20px; display: grid; gap: 6px; color: var(--ink-2); }
.code-input { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; text-transform: uppercase; }
.plain-list li { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-2); }
.plain-list li .ico { flex: none; margin-top: 2px; color: var(--green-ink); }
@media (max-width: 559px) {
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figures > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .figures > div:nth-child(n + 3) { border-top: 1px solid var(--rule); }
}
.amount.est { color: var(--ink-2); }
.figures .k { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.month-nav { display: flex; align-items: center; gap: 4px; }
.month-nav .m { min-width: 9em; text-align: center; font-family: var(--serif); font-weight: 600; font-size: 19px; margin: 0; }
.cat { padding: 13px 0; border-bottom: 1px solid var(--rule); display: grid; gap: 8px; }
.cat:last-child { border-bottom: 0; }
.cat-line { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.cat-line .money strong { font-weight: 650; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq details[open] summary .ico { transform: rotate(180deg); }
.faq details p { padding: 0 0 16px; color: var(--ink-2); max-width: 62ch; }
.setting { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.setting:last-child { border-bottom: 0; }
@media (min-width: 560px) { .setting { grid-template-columns: minmax(0, 1fr) minmax(0, 250px); align-items: center; gap: 16px; } }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); background: var(--panel-2); font-size: 14.5px; color: var(--ink-2); }
.note .ico { color: var(--ink-3); margin-top: 2px; }
.note.attention { background: var(--ochre-soft); color: var(--ink); }
.note.attention .ico { color: var(--ochre); }
.note.good { background: var(--green-soft); color: var(--ink); }
.note.good .ico { color: var(--green-ink); }
.order { font-size: 13px; color: var(--ink-3); margin-top: 10px; }

/* ---------------------------------------------------------------- touch screens: every target at least 44 px */

@media (pointer: coarse) {
  .btn.sm, .btn.quiet, .chip, .link { min-height: 44px; }
  .chip { padding: 0 14px; }
  input[type="range"] { height: 44px; }
  .topbar .brand { min-height: 44px; }
}

/* ---------------------------------------------------------------- the tour and the help guide */

.offer { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px 10px 14px; margin: 0 0 14px;
  border-radius: var(--r-sm); background: var(--panel); border: 1px solid var(--rule); font-size: 14.5px; }
.offer .text { flex: 1 1 240px; color: var(--ink-2); }
.offer-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.tour { position: fixed; inset: 0; z-index: 1000; }
.tour-catch { position: absolute; inset: 0; }
.tour-hole { position: fixed; border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 60%, transparent), 0 0 0 200vmax rgba(18, 20, 17, 0.52);
  transition: top 0.28s var(--ease), left 0.28s var(--ease), width 0.28s var(--ease), height 0.28s var(--ease), opacity 0.2s; }
.tour-card { position: fixed; width: min(360px, calc(100vw - 32px)); background: var(--panel); color: var(--ink); border: 1px solid var(--rule);
  border-radius: var(--r); box-shadow: var(--lift); padding: 14px 16px 14px; transition: top 0.28s var(--ease), left 0.28s var(--ease); }
.tour-card:focus { outline: none; }
.tour-top { display: flex; align-items: center; justify-content: space-between; min-height: 28px; margin: -4px -8px 2px 0; }
.tour-count { font-size: 12.5px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tour-title { font-family: var(--serif); font-weight: 600; font-size: 19px; line-height: 1.25; margin-bottom: 6px; }
.tour-text { color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.tour-foot { display: flex; align-items: center; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.tour-foot .spacer { flex: 1; }
.tour-dots { display: flex; gap: 5px; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--rule-strong); }
.tour-dots i.on { background: var(--green); width: 16px; border-radius: 3px; }
.tour.still .tour-hole, .tour.still .tour-card { transition: none; }
@media (prefers-reduced-motion: reduce) { .tour-hole, .tour-card { transition: none; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tour-hole { box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 60%, transparent), 0 0 0 200vmax rgba(0, 0, 0, 0.62); } }
:root[data-theme="dark"] .tour-hole { box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 60%, transparent), 0 0 0 200vmax rgba(0, 0, 0, 0.62); }

.tour-cta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; padding: 2px 0 14px; border-bottom: 1px solid var(--rule); }
.tour-cta p { flex: 1 1 200px; }
.sub-kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin: 18px 0 2px; }
.faq .show-me { margin: 4px 0 12px; }
