/* Rebound — calm, paper-and-ink look. Tokens first, then layout, then components. */
:root {
  --bg: #f6f3ec; --surface: #fffdf8; --surface-2: #f0ece2; --line: #e3ddd0; --line-2: #d4ccbb;
  --ink: #1d2421; --ink-2: #4a524e; --muted: #636a65;
  --brand: #1f4d42; --brand-2: #2f6f5e; --brand-ink: #fff; --accent: #c8862a; --accent-soft: #f7ead3;
  --ok: #2a6f47; --ok-soft: #e3f1e7; --warn: #965a00; --warn-soft: #fbefd9; --bad: #b42318; --bad-soft: #fbe5e2; --info: #2c5d8a; --info-soft: #e3edf7;
  --radius: 14px; --radius-s: 9px; --shadow: 0 1px 2px rgba(30, 36, 33, .05), 0 4px 16px rgba(30, 36, 33, .05);
  --font: ui-sans-serif, -apple-system, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --side: 236px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614; --surface: #1a201d; --surface-2: #222a26; --line: #2c3530; --line-2: #3a4540;
    --ink: #e8ece9; --ink-2: #b9c2bd; --muted: #95a09a;
    --brand: #7cc4ad; --brand-2: #5fae95; --brand-ink: #0e1a16; --accent: #e3a74d; --accent-soft: #3a2f1d;
    --ok: #6cc28c; --ok-soft: #1c3226; --warn: #e3a74d; --warn-soft: #3a2f1d; --bad: #f08a7e; --bad-soft: #3c2220; --info: #8ab8e6; --info-soft: #1d2b3a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }
a { color: var(--brand-2); }
p { margin: 0 0 .6em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num, td.r, .stat-value { font-variant-numeric: tabular-nums; }
.r { text-align: right; } .c { text-align: center; }
.pad { padding: 16px; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.ic { width: 18px; height: 18px; flex: none; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--side); flex: none; background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-size: 21px; font-weight: 600; padding: 4px 10px 16px; }
nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 4px; }
nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-size: 14.5px; }
nav a:hover { background: var(--surface-2); color: var(--ink); }
nav a.active { background: var(--brand); color: var(--brand-ink); }
nav a .count { margin-left: auto; font-size: 12px; background: var(--bad); color: #fff; border-radius: 10px; padding: 0 7px; }
.side-foot { margin-top: auto; padding-top: 16px; }
.main-col { flex: 1; min-width: 0; }
main:focus, main:focus-visible { outline: none; }
main { max-width: 1180px; margin: 0 auto; padding: 28px 32px 80px; outline: none; }
.topbar { display: none; }
.loading { color: var(--muted); padding: 40px 0; }

@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 40; left: 0; transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .topbar-title { font-family: var(--serif); font-weight: 600; font-size: 18px; }
  main { padding: 18px 16px 80px; }
}

/* ---------- page ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 30px; line-height: 1.15; }
.page-head .sub { color: var(--ink-2); margin: 6px 0 0; max-width: 680px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.section-title h2 { font-size: 19px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 1050px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); } .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .cols-4 .card { padding: 14px; } .cols-4 .stat-value { font-size: 22px; } .span-2 { grid-column: auto; } }
.stack > * + * { margin-top: 16px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .section-title { padding: 16px 20px 0; }
.card h2 { font-size: 18px; }
.card.hero { background: var(--brand); color: var(--brand-ink); border: none; }
.card.hero .stat-label, .card.hero .stat-sub { color: inherit; opacity: .8; }
.card.tint-bad { background: var(--bad-soft); border-color: transparent; }
.card.tint-warn { background: var(--warn-soft); border-color: transparent; }
.card.tint-ok { background: var(--ok-soft); border-color: transparent; }
.card.tint-info { background: var(--info-soft); border-color: transparent; }

.stat { min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1.2; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.stat.bad .stat-value { color: var(--bad); } .stat.ok .stat-value { color: var(--ok); } .stat.warn .stat-value { color: var(--warn); }
.pos { color: var(--ok); } .neg { color: var(--bad); }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 8px 14px;
  font: 500 14px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--bad); border-color: transparent; }
@media (prefers-color-scheme: dark) { .btn.danger:not(.ghost) { color: #1a0d0b; } }
.btn.small { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn.link { border: none; background: none; padding: 0; color: var(--brand-2); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: none; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-s); padding: 8px 10px; width: 100%; min-width: 0; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand-2); }
input[type=range] { padding: 0; accent-color: var(--brand-2); }
textarea { resize: vertical; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .affix { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.input-wrap .affix.post { left: auto; right: 28px; }
.input-wrap .affix + input { padding-left: 22px; }
.form { gap: 14px 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.form .full, .field.full, .form-heading, .form-error { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field.check { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; padding-top: 22px; }
.field.check .help { flex-basis: 100%; }
.help { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.req { color: var(--bad); }
.form-heading { font-size: 15px; margin: 8px 0 -4px; padding-top: 8px; border-top: 1px solid var(--line); font-family: var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.form-error { color: var(--bad); background: var(--bad-soft); padding: 8px 12px; border-radius: 8px; margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; }
.toolbar input[type=search] { min-width: 220px; flex: 1; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: none; background: none; padding: 6px 12px; border-radius: 8px; font: 500 13.5px var(--font); color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
tfoot td { font-weight: 600; border-top: 2px solid var(--line); border-bottom: none; }
td .sub { color: var(--muted); font-size: 12.5px; display: block; }
td.actions { white-space: nowrap; text-align: right; }
@media (max-width: 700px) {
  table.stack-sm thead { display: none; }
  table.stack-sm tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.stack-sm td { display: flex; justify-content: space-between; gap: 12px; border: none; padding: 4px 14px; text-align: right; }
  table.stack-sm td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; }
  table.stack-sm td[data-label=""]::before { content: none; }
  table.stack-sm td[data-label=""] { display: inline-flex; align-items: center; gap: 6px; padding-top: 2px; padding-bottom: 2px; }
  table.stack-sm td.actions[data-label=""] { float: right; }
  table.stack-sm td:first-child { justify-content: flex-start; text-align: left; display: block; }
  table.stack-sm td:first-child::before { content: none; }
  table.stack-sm td[data-label=""]:empty { display: none; }
}

/* ---------- badges, progress, lists ---------- */
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.info { background: var(--info-soft); color: var(--info); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 6px; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--brand-2); border-radius: 99px; }
.progress.warn span { background: var(--warn); } .progress.bad span { background: var(--bad); } .progress.ok span { background: var(--ok); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.list .meta { font-size: 13px; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); text-decoration: none; color: var(--ink); font-size: 14px; }
.alert + .alert { margin-top: 8px; }
.alert .ic { margin-top: 2px; }
.alert.bad { background: var(--bad-soft); } .alert.bad .ic { color: var(--bad); }
.alert.warn { background: var(--warn-soft); } .alert.warn .ic { color: var(--warn); }
.alert.info { background: var(--info-soft); } .alert.info .ic { color: var(--info); }
a.alert:hover { filter: brightness(.97); }
.callout { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 12px 16px; border-radius: 0 10px 10px 0; font-size: 14px; }
.callout p:last-child { margin: 0; }

.empty { text-align: center; padding: 36px 20px; }
.empty h3 { font-size: 19px; margin-bottom: 6px; }
.empty p { color: var(--ink-2); max-width: 460px; margin: 0 auto 14px; }

.finding { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.finding:last-child { border-bottom: none; }
.finding h3 { font-family: var(--font); font-size: 15.5px; font-weight: 650; }
.finding .impact { text-align: right; font-family: var(--serif); font-size: 20px; font-weight: 600; white-space: nowrap; }
.finding .impact small { display: block; font-family: var(--font); font-size: 12px; color: var(--muted); font-weight: 400; }
.finding p { grid-column: 1 / -1; margin: 0; color: var(--ink-2); font-size: 14px; }
.finding .do { grid-column: 1 / -1; font-size: 13.5px; color: var(--brand-2); }
.finding .do::before { content: "→ "; }

.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { position: relative; padding: 10px 0 10px 40px; border-bottom: 1px solid var(--line); counter-increment: s; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 10px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); }
.steps li.done::before { content: "✓"; background: var(--ok); color: #fff; }
.steps li.current { background: var(--accent-soft); border-radius: 10px; padding-left: 48px; padding-right: 12px; }
.steps li.current::before { left: 10px; background: var(--accent); color: #fff; }
.steps .t { font-weight: 600; }
.steps .d { color: var(--ink-2); font-size: 13.5px; }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .zero { stroke: var(--line-2); stroke-width: 1.5; }
.axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.donut-center { fill: var(--ink); font: 600 20px var(--serif); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.split { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.split > .grow { flex: 1; min-width: 220px; }

/* ---------- calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal .dow { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px; background: var(--surface-2); text-align: center; }
.cal .day { min-height: 96px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 6px; font-size: 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal .day:nth-child(7n+1) { border-left: none; }
.cal .day.other { background: var(--bg); color: var(--muted); }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal .day.neg { background: var(--bad-soft); }
.cal .dnum { font-weight: 600; color: var(--ink-2); display: flex; justify-content: space-between; }
.cal .dnum .bal { font-weight: 500; font-size: 11px; color: var(--muted); }
.cal .ev { border-radius: 6px; padding: 2px 6px; background: var(--surface-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border: none; text-align: left; font: inherit; color: var(--ink); }
.cal .ev.income { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.cal .ev.paid { text-decoration: line-through; opacity: .6; }
.cal .ev.overdue { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.cal .ev.due_soon { background: var(--warn-soft); }
.cal .ev.scheduled { background: var(--info-soft); color: var(--info); }
.cal .ev.missed { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
@media (max-width: 700px) { .cal .day { min-height: 64px; padding: 3px; } .cal .ev { font-size: 10px; padding: 1px 3px; } .cal .dnum .bal { display: none; } }

/* ---------- modal & toast ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(20, 24, 22, .45); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal.wide { width: min(860px, 100%); }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 10px; }
.modal header h2 { font-size: 20px; }
.modal-body { padding: 4px 20px 16px; overflow-y: auto; }
.modal footer { display: flex; gap: 8px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); }
.intro { margin-bottom: 14px; }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; max-width: 360px; transition: opacity .4s, transform .4s; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- letters ---------- */
.letter { white-space: pre-wrap; font-family: var(--serif); font-size: 15px; line-height: 1.6; background: #fff; color: #1d2421; border: 1px solid var(--line); border-radius: 10px; padding: 28px 32px; max-height: 60vh; overflow-y: auto; }
.letter[contenteditable=true] { outline: none; }
.letter[contenteditable=true]:focus { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- lock screen ---------- */
.lock { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.lock .card { width: min(360px, 100%); text-align: center; padding: 32px; }
.lock h1 { font-size: 26px; margin: 12px 0 6px; }
.lock input { text-align: center; font-size: 20px; letter-spacing: .2em; margin: 16px 0 10px; }

@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: fixed; inset: 0; border: none; max-height: none; overflow: visible; padding: 0; font-size: 12pt; }
}

/* ---------- AI ---------- */
.ai-fab { position: fixed; right: 22px; bottom: 22px; z-index: 50; display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 999px; border: none;
  background: var(--brand); color: var(--brand-ink); font: 600 14.5px var(--font); box-shadow: 0 6px 24px rgba(0,0,0,.18); cursor: pointer; }
.ai-fab:hover { filter: brightness(1.08); }
.ai-drawer { position: fixed; right: 16px; bottom: 16px; top: 16px; width: min(440px, calc(100vw - 32px)); z-index: 90; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.25); display: flex; flex-direction: column; animation: fade .15s; }
.ai-drawer header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ai-drawer header > div:first-child { display: flex; flex-direction: column; }
.ai-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 10px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; }
.msg p { margin: 0 0 .5em; } .msg p:last-child { margin: 0; }
.msg ul, .msg ol { margin: .3em 0 .5em; padding-left: 20px; }
.msg.user { align-self: flex-end; background: var(--brand); color: var(--brand-ink); white-space: pre-wrap; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg.thinking { color: var(--muted); font-style: italic; }
.ai-empty { text-align: center; color: var(--ink-2); padding: 20px 6px; }
.chips { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 12px; padding: 9px 12px; font: 14px var(--font); color: var(--ink); cursor: pointer; text-align: left; }
.chip:hover { background: var(--surface-2); }
.ai-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.ai-input textarea { resize: none; }
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.provider { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; padding: 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: 14px var(--font); cursor: pointer; }
.provider:hover { background: var(--surface-2); }
.provider.featured { border-color: var(--brand-2); }
.provider.on { box-shadow: 0 0 0 2px var(--accent); }
#provStep { margin-top: 16px; }
@media (max-width: 700px) { .ai-fab span { display: none; } .ai-fab { padding: 14px; } .ai-drawer { right: 0; left: 0; bottom: 0; top: 40px; width: auto; border-radius: 18px 18px 0 0; } }
@media print { .ai-fab, .ai-drawer { display: none !important; } }
.disclaimer { max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px 18px 10px; background: var(--bg); font-size: 14px; }
.disclaimer h3 { font-family: var(--font); font-size: 14.5px; font-weight: 700; margin: 14px 0 4px; }
.disclaimer p { color: var(--ink-2); margin: 0; }
.ai-disclaimer { margin: 0; padding: 8px 14px 0; font-size: 11.5px; line-height: 1.4; color: var(--muted); border-top: 1px solid var(--line); }
.ai-disclaimer .btn.link { font-size: 11.5px; }
.ai-input { border-top: none !important; }
.field.check > span { flex: 1; min-width: 0; }
.bank-conn { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 10px; }
.bank-conn select { min-width: 220px; }
.lock input::placeholder { letter-spacing: normal; font-size: 16px; }
.lock input[name=name], .lock input[name=code] { font-size: 17px; letter-spacing: normal; margin: 12px 0 10px; text-align: center; }
.lock input + input { margin-top: 0; }
.invite-code { font: 600 26px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .08em; text-align: center; padding: 14px; margin: 12px 0; border-radius: 12px; background: var(--surface-2); user-select: all; }
.list select { width: auto; flex: none; max-width: 150px; }

/* ---- alerts, safe to spend, splits, recap ---- */
nav a .nav-count, .bell-count { margin-left: auto; font-size: 11.5px; line-height: 18px; min-width: 18px; text-align: center; background: var(--bad); color: #fff; border-radius: 9px; padding: 0 5px; }
.topbar .bell { margin-left: auto; position: relative; }
.bell-count { position: absolute; top: -2px; right: -4px; margin: 0; }
.card.hero.safe { display: flex; flex-direction: column; }
.card.hero.safe.short { background: var(--bad); color: #fff; }
.safe-foot { margin-top: auto; padding-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; opacity: .9; }
.card.hero .btn.link { color: inherit; text-decoration: underline; }
.split-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px dashed var(--line-2); background: var(--surface-2); color: var(--ink-2); border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 13px; cursor: pointer; text-align: left; max-width: 280px; }
.split-chip svg { flex: none; width: 15px; height: 15px; }
.split-line { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(90px, .7fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 8px; }
@media (max-width: 560px) { .split-line { grid-template-columns: 1fr 110px auto; } .split-line .sNote { grid-column: 1 / 3; } }
.alerts-list li { align-items: flex-start; }
.alerts-list li.unread .title { font-weight: 700; }
.alerts-list li.unread { box-shadow: inset 3px 0 0 var(--accent); padding-left: 8px; }
.alert-link { display: flex; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.alert-link .title { display: block; }
.alert-link .meta { display: block; color: var(--muted); font-size: 13px; }
.alert-ic { flex: none; color: var(--brand-2); margin-top: 2px; }
.nowrap { white-space: nowrap; }
.recap-text { font-size: 16px; line-height: 1.55; }
.num.big { font-size: 24px; font-weight: 650; }
.recap-facts .stat-label { margin-bottom: 2px; }
.list span.meta { display: block; }
.kv.money-kv { grid-template-columns: minmax(0, 1fr) auto; }
.kv.money-kv dd { white-space: nowrap; text-align: right; }
.safe-foot { flex-wrap: wrap; }
.safe-foot .btn.link { white-space: nowrap; }
.prio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 10px; }
.prio { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line-2); border-radius: 12px; padding: 12px; cursor: pointer; background: var(--surface); }
.prio input { position: absolute; opacity: 0; pointer-events: none; }
.prio span { font-size: 13px; color: var(--muted); }
.prio.on { border-color: var(--brand-2); box-shadow: inset 0 0 0 1px var(--brand-2); background: var(--ok-soft); }
.prio:focus-within { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.plan-totals .neg .stat-value { color: var(--bad); }
.warn-in { border-color: var(--warn); }
.prio { position: relative; }
.plan-totals { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 10px; }
.plan-totals .stat-value { font-size: 22px; }
.plan-totals .stat-sub { font-size: 12px; }
.plan-list li { align-items: center; }
.plan-list .meta { display: block; }
.plan-list .why { color: var(--ink-2); }
.plan-list .input-wrap { flex: none; width: 110px; }
.plan-list input { text-align: right; }
.modal-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.modal { min-width: 0; }
.modal footer { flex-wrap: wrap; }
/* ---- credit ---- */
.court-box { border: 2px solid var(--bad); background: var(--bad-soft); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.court-box h3 { color: var(--bad); display: flex; gap: 8px; align-items: center; margin: 0 0 6px; }
.big-deadline { font-size: 18px; }
.bad-callout { border-color: var(--bad) !important; background: var(--bad-soft) !important; }
.report-strip .rs { display: flex; flex-direction: column; margin-right: 18px; }
.issue-list li { align-items: flex-start; }
.issue-list .meta { display: block; margin-top: 3px; }
.issue-act { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex: none; }
@media (max-width: 600px) { .issue-list li { flex-wrap: wrap; } .issue-act { flex-direction: row; width: 100%; } }
table.compare td { vertical-align: top; }
table.compare .cell + .cell { margin-top: 6px; }
tr.neg-row td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.rp-list li { align-items: flex-start; flex-wrap: wrap; }
.rp-list li.neg-row { box-shadow: inset 3px 0 0 var(--bad); padding-left: 8px; }
.rp-list .meta { display: block; }
.rp-act { display: flex; flex-direction: column; gap: 4px; flex: none; width: min(240px, 100%); }
.rp-act select { width: 100%; max-width: none; }
.scan-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.progress .indeterminate { display: block; width: 35%; height: 100%; background: var(--brand-2); animation: indet 1.2s infinite ease-in-out; }
@keyframes indet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line-2); }
.timeline li { position: relative; display: flex; gap: 12px; padding: 6px 0 10px 10px; }
.timeline li::before { content: ''; position: absolute; left: -21px; top: 11px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-2); }
.timeline .tl-date { flex: none; width: 96px; font-size: 13px; color: var(--muted); }
.timeline .tl-body .sub { display: block; }
.timeline li.tl-transferred::before, .timeline li.tl-charged_off::before, .timeline li.tl-delinquent::before { border-color: var(--bad); }
.timeline li.tl-court::before { background: var(--bad); border-color: var(--bad); }
.timeline li.tl-payment::before, .timeline li.tl-removed::before { background: var(--ok); border-color: var(--ok); }
@media (max-width: 520px) { .timeline li { flex-direction: column; gap: 2px; } }
.rp-list .grow { flex: 1 1 260px; } .rp-act { flex: 1 1 200px; max-width: 280px; } @media (max-width: 600px) { .rp-act { max-width: none; } }

/* debt ↔ spending (1.8) */
.debt-chip { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-2); border-radius: 999px; padding: 2px 9px; font: inherit; font-size: 12px; cursor: pointer; max-width: 100%; }
.debt-chip svg { width: 13px; height: 13px; flex: none; }
.debt-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.debt-chip.ask { border-style: dashed; color: var(--warn, #b7791f); }
.fixups .fix-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.fixups .fix-row:first-of-type { border-top: 0; }
.fixups .fix-row .grow { flex: 1 1 260px; min-width: 0; }
.fixups .fix-row .small { display: block; margin-top: 2px; }
.fixups .fix-row select { max-width: 100%; }
.fixups .alert { margin-bottom: 8px; }
.rates-list li { gap: 10px; }
.rate-in { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.rate-in input { width: 84px; text-align: right; }
.sweep .toolbar { flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.card.tint-ok { background: var(--ok-soft, var(--surface-2)); border-color: transparent; }
.rate-real { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; color: var(--ink-2); }
@media (max-width: 520px) { .rates-list li { flex-wrap: wrap; } .rates-list li .grow { flex: 1 1 100%; } }

/* 1.9: Today list */
.today-list li.today-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-left: 3px solid transparent; padding-left: 8px; }
.today-item.bad { border-left-color: var(--bad); }
.today-item.warn { border-left-color: var(--warn); }
.today-item.info { border-left-color: var(--line-2); }
.today-item .grow { min-width: 0; }
.today-item .title { font-weight: 600; color: var(--ink); text-decoration: none; display: block; }
.today-item a.title:hover { text-decoration: underline; }
.today-item .meta { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.today-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.check-btn { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface); color: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; margin-top: 1px; }
.check-btn svg { width: 14px; height: 14px; }
.check-btn:hover { border-color: var(--ok); color: var(--ok); }
.done-anim { opacity: .35; transition: opacity .25s; }
.done-card summary { cursor: pointer; padding: 4px 0; }

/* 1.9: Paycheck plan */
.plan-items li.plan-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.plan-item .grow { min-width: 0; }
.plan-item .title { font-weight: 600; }
.plan-item .meta { font-size: 13px; color: var(--ink-2); }
.plan-item .r { text-align: right; flex: none; }
.plan-item .r .num { font-weight: 600; }
.plan-item.short .r .num { color: var(--bad); }
.plan-actions { display: flex; gap: 4px; align-items: center; flex: none; }
.period-foot { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; font-size: 14px; }
.period.has-short { border-color: var(--bad-soft); }
details.period.fold > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
details.period.fold > summary::-webkit-details-marker { display: none; }
details.period.fold > summary::after { content: '▾'; color: var(--ink-3, var(--ink-2)); }
details.period.fold[open] > summary { margin-bottom: 8px; }
details.call { padding: 6px 0; border-top: 1px solid var(--line); }
details.call:first-of-type { border-top: 0; }
details.call summary { cursor: pointer; }
.script { margin: 8px 0 6px 18px; padding: 0; }
.script li { margin: 4px 0; }
ol.tiers { padding-left: 20px; } ol.tiers li { margin: 8px 0; } ol.tiers .small { display: block; }
@media (max-width: 520px) {
  .plan-items li.plan-item { flex-wrap: wrap; }
  .plan-item .grow { flex: 1 1 60%; }
  .plan-actions { width: 100%; justify-content: flex-end; }
  .today-list li.today-item { flex-wrap: wrap; }
  .today-item .grow { flex: 1 1 70%; }
}
.small-h { font-size: 14px; font-weight: 700; margin: 10px 0 4px; font-family: inherit; }
.qr-wrap { display: flex; gap: 14px; align-items: center; margin: 8px 0 10px; }
.qr-wrap .qr { flex: none; max-width: 100%; height: auto; border-radius: 6px; outline: 1px solid var(--line); background: #fff; }
.qr-wrap span { font-size: 13.5px; }
@media (max-width: 420px) { .qr-wrap { flex-direction: column; align-items: flex-start; } }
.setup-key { display: inline-block; margin-top: 6px; font-size: 16px; letter-spacing: .08em; padding: 6px 10px; background: var(--surface-2); border-radius: 8px; word-break: break-all; }
.settle-actions, .sub-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sub-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; }
.sub-list li .grow { flex: 1 1 220px; min-width: 0; }
.sub-list .r { text-align: right; }
.util-steps li { display: block; }
.util-steps .moves { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }

/* ---------- 1.10: whose is whose ---------- */
.who { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 1px 8px 1px 6px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap; vertical-align: 1px; }
.who i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.who i.j { background: linear-gradient(90deg, var(--brand-2) 50%, var(--accent) 50%); }
.who-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 16px; }
.who-opt { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink-2); font: inherit; font-size: 14px; cursor: pointer; }
.who-opt i { width: 9px; height: 9px; border-radius: 50%; }
.who-opt[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.who-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hh-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.hh-col { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); min-width: 0; }
.hh-col h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 15px; }
.hh-col h3 i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.hh-col dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin: 0; font-size: 13.5px; }
.hh-col dt { color: var(--ink-2); }
.hh-col dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.hh-col .due { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; }
.hh-col .due li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.hh-col .due li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.person-tabs { margin-bottom: 12px; }

/* ---------- 1.11: tax time ---------- */
.tax-bars { display: grid; gap: 12px; margin-top: 4px; }
.tb-label { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 4px; }
label.check { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; padding: 4px 0; cursor: pointer; }
label.check input { margin-top: 3px; }
#taxProfile .field { margin: 0; }
.found-list li { align-items: flex-start; }
.found-list .tf { margin-top: 4px; }
.fr-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.found-list .tk { margin-top: 6px; max-width: 100%; }
.receipt-list li { flex-wrap: wrap; }
.receipt-list .grow { min-width: 160px; }
.who.biz { background: transparent; border: 1px solid var(--line-2); }
.prog .meta { margin-top: 2px; }

/* ---------- 1.15: guided set-up ---------- */
.setup-chat { display: flex; flex-direction: column; min-height: 420px; }
.chat-log { flex: 1; overflow-y: auto; max-height: 55vh; display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.bubble { padding: 10px 12px; border-radius: 14px; max-width: 88%; white-space: pre-wrap; font-size: 14.5px; line-height: 1.45; }
.bubble.assistant { background: var(--surface-2); align-self: flex-start; }
.bubble.user { background: var(--brand); color: var(--brand-ink); align-self: flex-end; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.chat-input textarea { flex: 1; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 1.16: weekly moves ---------- */
.moves { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.moves li { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--surface); }
.moves li.done .title { text-decoration: line-through; color: var(--muted); }
.moves .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.moves .meta { font-size: 13px; color: var(--ink-2); }
.moves input[type="checkbox"], label.check input[type="checkbox"] { flex: none; width: 18px; height: 18px; }
.wi-moves { display: grid; gap: 4px; margin-top: 10px; }
.wi-moves label.check { align-items: center; flex-wrap: wrap; }
.wi-result { border-radius: 10px; padding: 10px 12px; background: var(--surface-2); margin-bottom: 6px; }
.wi-moves label.check { flex-wrap: nowrap; gap: 8px; }
.wi-moves label.check > span:not(.input-wrap) { flex: 1 1 auto; min-width: 0; }
.wi-moves select { max-width: 55%; }

/* Accessibility: skip link, reduced motion, larger hit areas on touch screens. */
.skip { position: absolute; left: 8px; top: -60px; z-index: 1000; background: var(--brand); color: var(--brand-ink); border: 0; border-radius: var(--radius-s); padding: 10px 14px; font: 600 14px var(--font); cursor: pointer; }
.skip:focus, .skip:focus-visible { top: 8px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (pointer: coarse) { .icon-btn { min-width: 44px; min-height: 44px; } }

/* Privacy policy and terms pages. */
.legal-page { background: var(--bg); }
.legal { max-width: 760px; margin: 0 auto; padding: 24px 16px 60px; line-height: 1.6; }
.legal h1 { font-family: var(--serif); font-size: 32px; margin: 12px 0 4px; }
.legal h2 { font-family: var(--serif); font-size: 21px; margin: 28px 0 6px; }
.legal li { margin: 4px 0; }
.legal a { color: var(--brand-2); }
.legal .brand-link { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); text-decoration: none; }
.legal-draft { background: var(--warn-soft); border: 1px solid var(--warn); color: var(--ink); border-radius: var(--radius-s); padding: 12px 14px; margin: 16px 0; font-size: 14px; }
.incident-steps li { align-items: flex-start; }
.incident-steps li.done .title { color: var(--muted); text-decoration: line-through; }
.playbooks { display: flex; flex-wrap: wrap; gap: 8px; }
.playbooks .btn { white-space: normal; text-align: left; max-width: 100%; height: auto; min-height: 36px; }
@media (max-width: 600px) { .playbooks .btn { width: 100%; } }
.incident-steps .title { font-weight: 400; }
.card.incident { margin-top: 16px; }
.biz-report { margin-top: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-s); }
.biz-report.plain { background: transparent; padding: 0; }
.welcome-steps { list-style: none; margin: 12px 0 0; padding: 0; }
.welcome-steps li { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.welcome-steps li:first-child { border-top: 0; }
.welcome-steps .mark { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; margin-top: 1px; }
.welcome-steps .mark svg { width: 14px; height: 14px; }
.welcome-steps li.done .mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.welcome-steps li.done .t, .welcome-steps li.skipped .t { color: var(--muted); }
.welcome-steps li.next .mark { border-color: var(--brand-2); }
.welcome-steps .t { font-weight: 600; color: var(--ink); text-decoration: none; }
.welcome-steps li.next .t { color: var(--brand-2); }
.welcome-steps .d { color: var(--ink-2); margin-top: 2px; }
.welcome-steps .grow { flex: 1; min-width: 0; } .welcome-steps .btn { flex: none; }
@media (prefers-color-scheme: dark) { nav a .nav-count, .bell-count { color: #1a0d0b; } }

/* Account pages (many-household service). */
.account-page { background: var(--bg); }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; }
.auth .card { width: min(400px, 100%); padding: 28px; }
.auth h1 { font-size: 26px; margin: 10px 0 6px; text-align: center; }
.auth .lead { text-align: center; margin: 0 0 14px; }
.auth .brand-mark { display: block; margin: 0 auto; }
.auth .form .field { margin-bottom: 10px; }
.auth .wide { width: 100%; justify-content: center; }
.auth .alt { text-align: center; margin: 12px 0 0; }
.acct { max-width: 920px; margin: 0 auto; padding: 20px 16px 60px; }
.acct-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.acct-top .spacer { flex: 1; }
.member-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.member-row:first-child { border-top: 0; }
.member-row .grow { flex: 1; min-width: 160px; }
.acct .grid { align-items: start; } .acct .form > button, .acct .form .btn[type=submit] { margin-top: 6px; } .acct h2 { margin-bottom: 8px; }
.qr-wrap code { word-break: break-all; } .qr-wrap span { min-width: 0; }
