:root {
  --pico-font-size: 95%;
  --pico-form-element-spacing-vertical: 0.4rem;
  --pico-form-element-spacing-horizontal: 0.6rem;
}

body { padding-bottom: 5rem; }
main.container { max-width: 720px; padding-inline: 1rem; }

.page-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-block: 1rem 0.5rem;
}
.page-head h2 { margin: 0; }

.tbb { text-align: right; }
.tbb strong { display: block; font-size: 1.25rem; }
.tbb.neg strong { color: var(--pico-color-red-500); }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  /* own compositor layer: prevents the mobile-scroll repaint lag where the
     fixed nav drifts up over content while the browser toolbar animates */
  transform: translateZ(0);
  backface-visibility: hidden;
  display: flex; justify-content: space-around;
  background: var(--pico-card-background-color);
  border-top: 1px solid var(--pico-muted-border-color);
  padding: 0.6rem env(safe-area-inset-right) calc(0.6rem + env(safe-area-inset-bottom)) env(safe-area-inset-left);
  z-index: 50;
}
.bottom-nav a {
  text-decoration: none; color: var(--pico-muted-color);
  font-size: 0.9rem; padding: 0.3rem 0.8rem; border-radius: 6px;
}
.bottom-nav a.active { color: var(--pico-primary); font-weight: 600; }

/* global work-in-progress pill: floats above the bottom nav while an AI run
   or bank sync is going, self-polls via htmx, disappears when done */
.ai-banner {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(3.6rem + env(safe-area-inset-bottom));
  z-index: 60;
  display: flex; align-items: center; gap: 0.5rem;
  max-width: min(92vw, 480px);
  padding: 0.45rem 0.9rem;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(13, 27, 42, 0.18);
  font-size: 0.82rem;
}
.ai-banner-step { color: var(--pico-muted-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-banner-count { white-space: nowrap; }
.ai-banner-dot {
  width: 0.55rem; height: 0.55rem; border-radius: 50%; flex: none;
  background: var(--pico-primary);
  animation: ai-banner-pulse 1.2s ease-in-out infinite;
}
@keyframes ai-banner-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}

/* pace-first dashboard hero: big "so far vs usual" numbers with a
   day-of-month tick on each bar; the projected result is a sentence */
.pace-hero { margin-bottom: 1rem; }
.pace-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.pace-card {
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 12px; padding: 0.8rem 0.9rem;
  display: flex; flex-direction: column; gap: 0.15rem;
}
.pace-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--pico-muted-color); }
.pace-num { font-size: 1.55rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.pace-of { color: var(--pico-muted-color); }
.pace-bar { height: 10px; margin: 0.45rem 0 0.3rem; position: relative; overflow: visible; }
.pace-today {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: var(--pico-color); opacity: 0.55; border-radius: 1px;
}
.pace-word { color: var(--pico-muted-color); }
.pace-word.neg { color: var(--pico-color-red-500); }
.pace-sentence { margin: 0.7rem 0 0.2rem; font-size: 0.95rem; }
.pace-sentence.neg strong { color: var(--pico-color-red-500); }
@media (max-width: 480px) {
  .pace-cards { grid-template-columns: 1fr; }
}

.cats { width: 100%; font-size: 0.85rem; table-layout: auto; }
.cats th, .cats td { padding: 0.4rem 0.25rem; vertical-align: middle; }
.cats th.num, .cats td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cats input { margin: 0; padding: 0.2rem 0.3rem; width: 5.5rem; text-align: right; font-size: 0.85rem; display: inline-block; }
.cats td:nth-child(2) { text-align: right; }
.cats td.num small { display: block; opacity: 0.55; font-size: 0.65rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.neg { color: var(--pico-color-red-500); }
@media (max-width: 520px) {
  .lifetime-col { display: none; }
  .cats { font-size: 0.78rem; }
  .cats input { width: 4.2rem; }
}

.month-nav { display: flex; align-items: center; gap: 0.6rem; }
.month-nav h2 { margin: 0; }
.month-nav a { text-decoration: none; font-size: 0.85rem; color: var(--pico-primary); }
.month-nav .muted { color: var(--pico-muted-color); font-size: 0.85rem; }

.stats-bar {
  display: flex; gap: 1rem; flex-wrap: wrap; align-items: center;
  font-size: 0.78rem; margin: 0.4rem 0 0.8rem;
  color: var(--pico-muted-color);
}
.stats-bar strong { color: var(--pico-color); }
.stats-bar .warn { color: var(--pico-color-orange-500); text-decoration: none; font-weight: 600; }
.stats-bar .ok { color: var(--pico-color-green-500); }

.hint-soft { font-size: 0.78rem; color: var(--pico-muted-color); text-align: center; margin: 0.8rem 0; }

.tx-list { list-style: none; padding: 0; margin: 0; }
.tx {
  display: flex; justify-content: space-between; gap: 0.75rem;
  padding: 0.7rem 0; border-bottom: 1px solid var(--pico-muted-border-color);
}
.tx-main { min-width: 0; flex: 1; }
.tx-payee { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 0.78rem; color: var(--pico-muted-color); }
.tx-side { text-align: right; }
.tx-amt { font-variant-numeric: tabular-nums; font-weight: 600; }
.tx-amt.neg { color: var(--pico-color-red-500); }
.tx-amt.pos { color: var(--pico-color-green-500); }
.tx-side select { font-size: 0.78rem; padding: 0.2rem; margin: 0.3rem 0 0; max-width: 9rem; }
.pill {
  display: inline-block; font-size: 0.7rem; padding: 0.1rem 0.4rem;
  border-radius: 999px; background: var(--pico-muted-border-color);
  color: var(--pico-muted-color); margin-top: 0.2rem;
}
.pill.ai { background: var(--pico-primary-background); color: var(--pico-primary-inverse); }

/* split pieces sit under their parent charge, visibly subordinate to it */
.tx-split-piece { padding: 0.25rem 0 0.25rem 1.1rem; border-bottom: 0; font-size: 0.85rem; }
.tx-split-piece .tx-payee { font-weight: 400; color: var(--pico-muted-color); }
.tx-split-tools { border-bottom: 1px solid var(--pico-muted-border-color); padding-top: 0; }
.tx-split-tools summary { cursor: pointer; color: var(--pico-muted-color); }
.split-form { margin: 0.5rem 0; }
.split-row { display: flex; gap: 0.4rem; margin-bottom: 0.35rem; }
.split-row input[type="text"] { flex: 1; margin: 0; font-size: 0.8rem; padding: 0.25rem; }
.split-row select { margin: 0; font-size: 0.8rem; padding: 0.25rem; max-width: 10rem; }

.acct-list { list-style: none; padding: 0; }
.acct-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.8rem 0; border-bottom: 1px solid var(--pico-muted-border-color);
}
.acct-list li.disabled { opacity: 0.55; }
.acct-list small { display: block; color: var(--pico-muted-color); font-size: 0.75rem; }
.acct-right { display: flex; align-items: center; gap: 0.6rem; }
.acct-right form { margin: 0; }
button.toggle {
  font-size: 0.7rem; padding: 0.25rem 0.6rem; margin: 0;
  border-radius: 999px; min-width: 4.5rem;
}
button.toggle.off { background: var(--pico-muted-border-color); border-color: var(--pico-muted-border-color); color: var(--pico-muted-color); }

.hint {
  background: var(--pico-primary-background); color: var(--pico-primary-inverse);
  padding: 0.6rem 0.8rem; border-radius: 6px; font-size: 0.85rem; margin: 0.5rem 0;
}

details.danger { margin-top: 2rem; }
details.danger summary { font-size: 0.85rem; color: var(--pico-muted-color); cursor: pointer; }

/* Dedicated danger button — explicit colors so Pico's .secondary/.outline
   styling can't make it invisible. Applied directly via class="btn-danger".
   Styled to read as CAUTION at a glance: vivid red, white bold text,
   a slight shadow and uppercase treatment. */
button.btn-danger,
.btn-danger[type="submit"] {
  background: #e53935 !important;
  border: 2px solid #b71c1c !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.55rem 1.2rem !important;
  box-shadow: 0 2px 4px rgba(183, 28, 28, 0.3);
  transition: all 0.15s ease;
}
button.btn-danger:hover,
.btn-danger[type="submit"]:hover {
  background: #c62828 !important;
  border-color: #7f0000 !important;
  box-shadow: 0 3px 6px rgba(127, 0, 0, 0.4);
  transform: translateY(-1px);
}
button.btn-danger:active,
.btn-danger[type="submit"]:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(127, 0, 0, 0.3);
}

.htmx-indicator {
  display: none;
  margin-left: 0.6rem;
  color: var(--pico-color-orange-500);
  font-size: 0.85rem;
  font-weight: 600;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline; }

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.5rem 0; }
.actions button { flex: 1; min-width: 8rem; }
.result { font-size: 0.85rem; margin: 0.5rem 0; min-height: 1rem; }
.result pre { white-space: pre-wrap; color: var(--pico-color-red-500); font-size: 0.75rem; }

.status {
  padding: 0.6rem 0.8rem; border-radius: 8px; margin: 0.4rem 0;
  font-size: 0.85rem; line-height: 1.4;
}
.status small { display: block; opacity: 0.75; font-size: 0.72rem; margin-top: 0.2rem; }
.status.running { background: var(--pico-primary-background); color: var(--pico-primary-inverse); }
.status.done { background: var(--pico-card-sectioning-background-color); border: 1px solid var(--pico-muted-border-color); }
.status.err { background: rgba(220, 53, 69, 0.12); color: var(--pico-color-red-500); }
.status p { margin: 0.4rem 0 0; }
.spinner { display: inline-block; animation: spin 2s linear infinite; }
.warn { color: var(--pico-color-orange-500); }
.warn-list { font-size: 0.72rem; margin: 0.3rem 0 0; padding-left: 1rem; opacity: 0.75; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.filters { display: flex; gap: 0.5rem; }
.filters a { text-decoration: none; font-size: 0.85rem; padding: 0.2rem 0.6rem; border-radius: 6px; }
.filters a.active { background: var(--pico-primary-background); color: var(--pico-primary-inverse); }

.empty { text-align: center; color: var(--pico-muted-color); padding: 2rem 1rem; }

.login-card {
  max-width: 360px; margin: 6rem auto;
}
.login-card h1 { text-align: center; margin-bottom: 1.5rem; }
.login-card .error { color: var(--pico-color-red-500); display: block; margin-top: 0.5rem; }

.logout { margin-top: 2rem; }

/* Review page */
.review-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.8rem; font-size: 0.85rem; }
.review-actions form { margin: 0; }

.review-list { list-style: none; padding: 0; margin: 0; }
.review-row {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  padding: 0.7rem 0; border-bottom: 1px solid var(--pico-muted-border-color);
  flex-wrap: wrap;
}
.rr-main { flex: 1; min-width: 0; }
.rr-payee { font-weight: 600; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rr-meta { font-size: 0.72rem; color: var(--pico-muted-color); margin-top: 0.15rem; }
.rr-actions { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.rr-current { margin-right: 0.3rem; }
.rr-buttons { display: flex; gap: 0.3rem; align-items: center; }
.rr-buttons form { margin: 0; }

.btn-approve {
  background: var(--pico-color-green-500) !important;
  color: white !important;
  border: none !important;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.3rem 0.6rem !important;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}
.btn-approve:hover { background: #2e7d32 !important; }

.change-form select {
  margin: 0; padding: 0.25rem 0.3rem; font-size: 0.75rem;
  max-width: 8rem; border-radius: 4px;
}

.pill.unc { background: var(--pico-color-orange-500); color: white; }

.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--pico-color-orange-500); color: white;
  font-size: 0.6rem; font-weight: 700; min-width: 1.1rem; height: 1.1rem;
  border-radius: 999px; margin-left: 0.15rem; padding: 0 0.25rem;
}

.docs h3 { margin-top: 1.5rem; font-size: 1.05rem; }
.docs p, .docs li { font-size: 0.88rem; line-height: 1.5; }
.docs ul.def li { margin-bottom: 0.4rem; }
.docs code { font-size: 0.78rem; word-break: break-all; }
.docs pre { background: var(--pico-card-sectioning-background-color); padding: 0.7rem; border-radius: 6px; overflow-x: auto; font-size: 0.72rem; }
.docs pre code { word-break: normal; }
.docs-tools { width: 100%; font-size: 0.78rem; margin: 0.5rem 0; }
.docs-tools th, .docs-tools td { padding: 0.3rem 0.3rem; vertical-align: top; }
.docs-tools td:nth-child(2) { text-align: center; opacity: 0.7; }

.goals textarea { font-size: 0.85rem; }
.goals { margin: 1rem 0; }
.plan-actions { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; margin: 0.5rem 0; }
.plan-actions button { margin: 0; }
.plan-actions small { color: var(--pico-muted-color); font-size: 0.78rem; }

.pos { color: var(--pico-color-green-500); }

.plan-cards { display: grid; gap: 0.7rem; margin: 1rem 0; }
.plan-card { padding: 0.9rem 1rem; border-radius: 10px; border: 1px solid var(--pico-muted-border-color); background: var(--pico-card-sectioning-background-color); margin: 0; }
.plan-card h4 { margin: 0 0 0.4rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pico-muted-color); }
.plan-card p { margin: 0; font-size: 0.92rem; line-height: 1.55; }
.baseline-card { border-left: 3px solid var(--pico-color-slate-500, #64748b); }
.interpretation-card { border-left: 3px solid var(--pico-primary); }
.strategy-card { border-left: 3px solid var(--pico-color-green-500); }
.watchout-card { border-left: 3px solid var(--pico-color-orange-500); }

.projection table, .proposals table { width: 100%; font-size: 0.82rem; }
.projection th, .projection td { padding: 0.35rem 0.3rem; }
.projection th.num, .projection td.num { text-align: right; font-variant-numeric: tabular-nums; }

.proposals-head { display: flex; justify-content: space-between; align-items: baseline; }
.proposals-head h3 { margin-bottom: 0.3rem; }
.proposals-table .reasoning-inline { display: none; font-size: 0.66rem; opacity: 0.6; margin-top: 0.1rem; line-height: 1.25; white-space: normal; max-width: 9rem; margin-left: auto; }
.proposals-table.show-reasoning .reasoning-inline { display: block; }
.proposals-table .amt { cursor: help; border-bottom: 1px dotted var(--pico-muted-border-color); }
.proposals-table .actual-cell { color: var(--pico-muted-color); }
.proposals-table .delta { display: block; font-size: 0.66rem; opacity: 0.8; margin-top: 0.05rem; font-weight: 500; }
.proposals-table .delta.cut { color: var(--pico-color-green-500); }
.proposals-table .delta.grow { color: var(--pico-color-orange-500); }
.tag-income { display: inline-block; font-size: 0.65rem; padding: 0.1rem 0.35rem; border-radius: 3px; background: var(--pico-color-green-500); color: white; margin-left: 0.3rem; vertical-align: middle; opacity: 0.8; }

.inline-check { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; margin-right: 0.5rem; }
.inline-check input { margin: 0; }

.neg-row { background: rgba(220, 53, 69, 0.06); }
.muted { color: var(--pico-muted-color); }

button.tiny { font-size: 0.7rem; padding: 0.2rem 0.5rem; margin: 0; }
tr.archived { opacity: 0.5; }
tr.archived td input { font-style: italic; }

.cat-create { margin: 1rem 0 1.5rem; padding: 0.7rem 0.9rem; background: var(--pico-card-sectioning-background-color); border-radius: 6px; }
.cat-create h4 { margin: 0 0 0.4rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pico-muted-color); }
.cat-create-form { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.cat-create-form input { flex: 1; min-width: 8rem; margin: 0; padding: 0.35rem 0.6rem; font-size: 0.85rem; }
.cat-create-form button { margin: 0; padding: 0.4rem 1rem; font-size: 0.85rem; white-space: nowrap; }
.tool-counts { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; opacity: 0.6; word-break: break-all; }
.flash { display: inline-block; margin-left: 0.4rem; font-size: 0.85rem; }
.flash-ok { color: var(--pico-color-green-500); animation: fadeout 2s forwards; }
.flash-err { color: var(--pico-color-red-500); font-size: 0.7rem; }
@keyframes fadeout { 0% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

.reset-steps { list-style: none; padding-left: 0; font-size: 0.78rem; margin: 0.4rem 0; }
.reset-steps li { padding: 0.1rem 0; }
.reset-steps li.ok { color: var(--pico-color); }
.reset-steps li.error { color: var(--pico-color-red-500); }
.reset-steps code { font-size: 0.78rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.section-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--pico-muted-color); margin-top: 0.8rem; margin-bottom: 0.2rem; }

/* Conversational review wizard */
.review-wizard {
  background: var(--pico-card-sectioning-background-color);
  border-radius: 10px;
  padding: 1rem 1rem 1.2rem;
  margin: 0.8rem 0 1.2rem;
}
.rw-progress {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pico-muted-color);
  margin-bottom: 0.7rem;
}
.rw-progress strong { color: var(--pico-color); margin: 0 0.25rem; font-size: 0.85rem; }
.rw-preview {
  padding: 0.6rem 0.8rem;
  background: var(--pico-background-color);
  border-radius: 6px;
  margin-bottom: 0.9rem;
}
.rw-payee { font-weight: 600; font-size: 1rem; }
.rw-meta { font-size: 0.78rem; color: var(--pico-muted-color); margin-top: 0.15rem; }
.rw-question {
  font-size: 1.05rem;
  line-height: 1.35;
  margin: 0.5rem 0 0.3rem;
}
.rw-context {
  font-size: 0.82rem;
  color: var(--pico-muted-color);
  margin-bottom: 0.8rem;
}
.rw-options { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.6rem; }
.rw-options form { margin: 0; }
.rw-opt {
  width: 100%;
  text-align: left;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--pico-primary-background);
  border: 1px solid var(--pico-primary-border);
  color: var(--pico-primary-inverse);
  min-height: 3rem;
}
.rw-opt:hover { filter: brightness(1.1); }
.rw-opt-mixed {
  background: var(--pico-background-color);
  color: var(--pico-color);
  border: 1px dashed var(--pico-muted-border-color);
}
.rw-opt-skip {
  background: transparent;
  color: var(--pico-muted-color);
  border: 1px dashed var(--pico-muted-border-color);
}
.rw-freeform { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; }
.rw-freeform textarea { margin: 0; padding: 0.7rem 0.8rem; font-size: 0.95rem; min-height: 5rem; }
.rw-freeform small { color: var(--pico-muted-color); font-size: 0.78rem; }

.rw-skip-row { text-align: right; margin-top: 0.9rem; }
.rw-skip-row button { margin: 0; }

.rw-other { margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px dashed var(--pico-muted-border-color); }
.rw-other summary { cursor: pointer; font-size: 0.85rem; color: var(--pico-muted-color); padding: 0.3rem 0; }
.rw-other-form { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.6rem; }
.rw-other-form label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.78rem; color: var(--pico-muted-color); }
.rw-other-form select, .rw-other-form input { margin: 0; padding: 0.5rem 0.6rem; font-size: 0.9rem; }
.rw-other-form button {
  margin: 0;
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  align-self: stretch;
  background: var(--pico-primary-background);
  border: 1px solid var(--pico-primary-border);
  color: var(--pico-primary-inverse);
  border-radius: 8px;
}
.rw-other-form button:hover { filter: brightness(1.1); }
.rw-other-new { margin-top: 0.9rem; padding-top: 0.7rem; border-top: 1px dotted var(--pico-muted-border-color); }
.rw-other-hint { margin-top: 0.6rem; color: var(--pico-muted-color); }

.review-progress { list-style: none; padding: 0; margin: 0.6rem 0 0.4rem; font-size: 0.88rem; line-height: 1.7; }
.review-progress li { padding: 0; }
.review-progress strong { color: var(--pico-color); }
.review-tokens { display: block; margin-top: 0.5rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; opacity: 0.55; font-size: 0.7rem; }

/* Plan page - 2-step wizard */
.plan-step { max-width: 32rem; margin: 0 auto; }
.plan-step-head { margin-bottom: 1rem; }
.plan-step-head h3 { margin: 0.2rem 0 0.15rem; }
.plan-step-num {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pico-muted-color);
}

.plan-headline {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.6rem;
  margin: 1rem 0 1.2rem;
  text-align: center;
}
.plan-headline > div {
  padding: 0.7rem 0.3rem;
  background: var(--pico-card-sectioning-background-color);
  border-radius: 8px;
}
.plan-headline small {
  display: block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pico-muted-color);
  margin-bottom: 0.2rem;
}
.plan-headline strong { font-size: 1.1rem; }

.plan-pie-wrap {
  max-width: 320px;
  margin: 0.6rem auto 1.2rem;
}

.plan-cat-list { list-style: none; padding: 0; margin: 0 0 1.2rem; }
.plan-cat-list li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color);
}
.pc-head { display: flex; justify-content: space-between; align-items: baseline; }
.pc-name { font-weight: 600; font-size: 0.95rem; }
.pc-total { font-size: 0.92rem; }
.pc-bars {
  display: flex;
  gap: 0.4rem;
  align-items: flex-end;
  height: 2.5rem;
  margin-top: 0.4rem;
}
.pc-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
}
.pc-fill {
  width: 100%;
  min-height: 2px;
  background: var(--pico-primary-background);
  border-radius: 3px 3px 0 0;
  transition: height 0.2s ease;
}
.pc-bar small {
  font-size: 0.62rem;
  color: var(--pico-muted-color);
  margin-top: 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.plan-goals { margin: 1rem 0; padding: 0.6rem 0.8rem; background: var(--pico-card-sectioning-background-color); border-radius: 8px; }
.plan-goals summary { cursor: pointer; font-size: 0.9rem; }
.plan-goals summary small { color: var(--pico-muted-color); }
.goals-form { margin-top: 0.7rem; }
.goals-form textarea { margin-bottom: 0.5rem; }

.plan-next-form, .plan-create-form, .plan-rerun-form { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; margin-top: 1rem; }
.plan-next-form small, .plan-create-form small, .plan-rerun-form small { color: var(--pico-muted-color); font-size: 0.78rem; text-align: center; }
.plan-next-btn, .plan-create-btn { padding: 0.8rem 2rem; font-size: 1rem; }
.plan-rerun-form { margin-top: 0.5rem; }

.plan-strategy {
  padding: 0.8rem 1rem;
  background: var(--pico-card-sectioning-background-color);
  border-left: 3px solid var(--pico-primary);
  border-radius: 6px;
  font-size: 0.92rem;
  line-height: 1.45;
  margin: 0.8rem 0 1rem;
}

.plan-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  background: var(--pico-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 8px;
  margin-bottom: 1rem;
}
.plan-total strong { font-size: 1.3rem; }
.plan-total small { color: var(--pico-muted-color); font-size: 0.78rem; }

.plan-proposals { list-style: none; padding: 0; margin: 0 0 1.2rem; }
.plan-proposals li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color);
}
.pp-head { display: flex; justify-content: space-between; align-items: baseline; }
.pp-name { font-weight: 600; font-size: 0.95rem; }
.pp-amount { font-size: 1.05rem; }
.pp-reason { margin-top: 0.25rem; font-size: 0.8rem; color: var(--pico-muted-color); line-height: 1.4; }

.plan-back { text-align: center; margin-top: 1.5rem; }

/* Dashboard (YNAB-style TBB / Available) */
.dash-head .month-nav { width: 100%; }

.tbb-hero {
  text-align: center;
  padding: 1.4rem 1rem 1.2rem;
  margin: 0.6rem 0 1rem;
  background: var(--pico-card-sectioning-background-color);
  border-radius: 12px;
  border: 1px solid var(--pico-muted-border-color);
}
.tbb-hero.tbb-has-work { background: rgba(20, 83, 45, 0.15); border-color: #2e7d32; }
.tbb-hero.tbb-neg { background: rgba(165, 20, 20, 0.12); border-color: #c0392b; }
.tbb-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--pico-muted-color); display: block; margin-bottom: 0.2rem; }
.tbb-amount { font-size: 2rem; font-weight: 700; display: block; }
.tbb-hero.tbb-has-work .tbb-amount { color: #4caf50; }
.tbb-hero.tbb-neg .tbb-amount { color: #e57373; }
.tbb-msg { font-size: 0.85rem; color: var(--pico-muted-color); margin: 0.4rem 0 0; }

/* The one number the page exists to answer, with where the month lands
   underneath it. Everything else on the dashboard is supporting detail. */
.hero { text-align: center; padding: 1.1rem 0.5rem 0.9rem; margin-bottom: 0.8rem;
        background: var(--pico-card-sectioning-background-color); border-radius: 10px; }
.hero-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
              color: var(--pico-muted-color); display: block; }
.hero-num { display: block; font-size: 2.3rem; line-height: 1.15; margin: 0.15rem 0 0.35rem;
            font-variant-numeric: tabular-nums; }
.hero-num.neg { color: #e57373; }
.hero-sub { font-size: 0.95rem; margin: 0 0 0.35rem; }
.hero-sub.neg { color: #e57373; }
.hero-support { font-size: 0.76rem; color: var(--pico-muted-color); }

/* debt sits directly under the hero: it is the goal, so it gets a permanent
   place on the page rather than a link at the bottom */
.debt-strip { display: flex; gap: 0.5rem; align-items: center; justify-content: space-between;
              padding: 0.65rem 0.8rem; margin-bottom: 0.8rem; border-radius: 10px;
              background: var(--pico-card-sectioning-background-color);
              text-decoration: none; color: inherit; }
.debt-strip:hover { filter: brightness(1.08); }
.debt-strip small { display: block; font-size: 0.64rem; text-transform: uppercase;
                    letter-spacing: 0.04em; color: var(--pico-muted-color); }
.debt-strip strong { font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.debt-strip .ds-side { text-align: right; }
.debt-strip .ds-side strong { font-size: 0.8rem; font-weight: 500; }

/* cal.com-style neutral CTA: near-black in light mode, near-white in dark.
   Colors are explicit (not Pico vars) because role="button" makes Pico
   redefine --pico-color to white, which was unreadable on the old amber. */
.dash-banner {
  display: block;
  padding: 0.75rem 1rem;
  margin: 0.8rem 0;
  background: #111827;
  border: 1px solid #111827;
  color: #ffffff;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.dash-banner:hover { background: #374151; border-color: #374151; color: #ffffff; }
@media (prefers-color-scheme: dark) {
  .dash-banner { background: #f9fafb; border-color: #f9fafb; color: #111827; }
  .dash-banner:hover { background: #e5e7eb; border-color: #e5e7eb; color: #111827; }
}

.dash-income { margin: 0.8rem 0; padding: 0.5rem 0.8rem; background: var(--pico-card-sectioning-background-color); border-radius: 8px; border-left: 3px solid #4caf50; }
.dash-income summary { font-size: 0.88rem; cursor: pointer; }
.dash-income ul { list-style: none; padding: 0; margin: 0.6rem 0 0.3rem; }
.dash-income li { display: grid; grid-template-columns: 1fr auto auto; gap: 0.5rem; padding: 0.3rem 0; font-size: 0.85rem; align-items: baseline; }
.inc-amt { font-variant-numeric: tabular-nums; }
.inc-amt.pos { color: #4caf50; }

.dash-upcoming { margin: 0.8rem 0 1rem; padding: 0.5rem 0.8rem; background: var(--pico-card-sectioning-background-color); border-radius: 8px; }
.dash-upcoming summary { font-size: 0.88rem; cursor: pointer; }
.dash-upcoming ul { list-style: none; padding: 0; margin: 0.6rem 0 0; }
.dash-upcoming li { display: grid; grid-template-columns: 3rem 1fr auto; gap: 0.5rem; padding: 0.35rem 0; font-size: 0.85rem; align-items: baseline; }
.up-date { font-size: 0.75rem; color: var(--pico-muted-color); }
.up-amt { font-variant-numeric: tabular-nums; }
.up-cat { grid-column: 2 / -1; color: var(--pico-muted-color); font-size: 0.7rem; }

.cat-rows { display: flex; flex-direction: column; gap: 0.4rem; }
.cat-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.8rem;
  background: var(--pico-card-sectioning-background-color);
  border-radius: 8px;
  border-left: 3px solid transparent;
}
.cat-row.overspent { border-left-color: #e57373; }
.cat-row.empty-row { opacity: 0.7; }
.cr-main { flex: 1; min-width: 0; }
.cr-top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem; }
.cr-name { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-available { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cr-sub { margin-top: 0.2rem; font-size: 0.72rem; color: var(--pico-muted-color); }
/* Replaces .cr-allocate, which was a 4.8rem-wide unlabeled box (its own
   "target $" placeholder didn't fit) next to a bare checkmark. */
.acct-sync { margin: 0 0 0 0.35rem; padding: 0.3rem 0.6rem; }
.acct-sync-slot:empty { display: none; }
.acct-sync-slot { flex-basis: 100%; margin-top: 0.25rem; }
.acct-sync-result { font-size: 0.75rem; color: var(--pico-muted-color); }
.acct-sync-result.err { color: #e57373; }

.cr-edit { margin: 0.4rem 0 0; }
.cr-edit > summary { font-size: 0.75rem; color: var(--pico-muted-color); cursor: pointer; }
.cr-edit > summary:hover { color: var(--pico-color); }
.cr-edit form { margin: 0.4rem 0 0; display: flex; align-items: flex-end; gap: 0.5rem; }
.cr-edit label { flex: 1; margin: 0; }
.cr-edit label span { display: block; font-size: 0.72rem; color: var(--pico-muted-color); margin-bottom: 0.15rem; }
.cr-edit input { margin: 0; padding: 0.35rem 0.5rem; font-size: 0.9rem; }
.cr-edit button { margin: 0; white-space: nowrap; }

.settings-section { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--pico-muted-border-color); }
.settings-section h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.settings-section p { margin: 0 0 0.6rem; }

.plan-age { color: var(--pico-muted-color); font-size: 0.78rem; }
.plan-stale-banner {
  padding: 0.7rem 0.9rem;
  margin: 0.6rem 0 1rem;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 8px;
  font-size: 0.88rem;
}

/* Category budget-relevance toggle pill */
.toggle-on { background: var(--pico-primary-background); border: 1px solid var(--pico-primary-border); color: var(--pico-primary-inverse); }
.toggle-off { background: transparent; border: 1px dashed var(--pico-muted-border-color); color: var(--pico-muted-color); }
tr.excluded input { opacity: 0.6; }

.review-empty { text-align: center; padding: 1.5rem 0.5rem; }
.review-empty .empty { margin-bottom: 1rem; }
.review-empty button.primary { padding: 0.8rem 1.4rem; font-size: 1rem; }

.review-prefs { margin-top: 1.5rem; padding-top: 0.8rem; border-top: 1px solid var(--pico-muted-border-color); }
.review-prefs summary { cursor: pointer; font-size: 0.85rem; color: var(--pico-muted-color); }
.prefs-form { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.7rem; }
.prefs-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; }
.prefs-form select { margin: 0; }
.prefs-form button { align-self: flex-start; margin: 0; }

/* Drill-in per-transaction view */
.drill-list { list-style: none; padding: 0; margin: 0; }
.drill-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color);
}
.drill-main { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; font-size: 0.85rem; }
.drill-date { color: var(--pico-muted-color); font-size: 0.78rem; min-width: 3.5rem; }
.drill-amt { font-weight: 600; min-width: 4.5rem; }
.drill-amt.neg { color: var(--pico-color-red-500); }
.drill-amt.pos { color: var(--pico-color-green-500); }
.drill-memo { color: var(--pico-muted-color); font-size: 0.78rem; flex: 1; min-width: 0; }
.drill-acct { color: var(--pico-muted-color); font-size: 0.72rem; }
.drill-row select { margin: 0; padding: 0.35rem 0.6rem; font-size: 0.85rem; }
.drill-actions { display: flex; gap: 0.6rem; margin-top: 1rem; }
.drill-actions button, .drill-actions a { margin: 0; }

.neg { color: var(--pico-color-red-500); }
.pos { color: var(--pico-color-green-500); }

/* ===== bookkeeper model additions ===== */
.cr-bar { height: 6px; background: var(--pico-card-sectioning-background-color); border-radius: 4px; overflow: hidden; margin: 0.3rem 0 0.15rem; }
.cr-bar-fill { height: 100%; background: #10b981; border-radius: 4px; }
.cr-bar-fill.warn { background: #f59e0b; }
.cr-bar-fill.over { background: #ef4444; }
.funds-head { font-size: 1rem; margin: 1.2rem 0 0.4rem; }
.dash-proposal { padding: 0.75rem 1rem; margin: 0.8rem 0; border-radius: 8px; border: 1px solid var(--pico-muted-border-color); background: var(--pico-card-sectioning-background-color); }
.dash-proposal p { margin: 0.3rem 0; font-size: 0.85rem; }

/* ===== income vs spending cashflow bars ===== */
.cashflow { margin: 0.8rem 0; padding: 0.7rem 0.9rem; background: var(--pico-card-sectioning-background-color); border-radius: 8px; }
.cf-row { display: grid; grid-template-columns: 4.5rem 1fr auto; gap: 0.6rem; align-items: center; margin-bottom: 0.45rem; }
.cf-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pico-muted-color); }
.cf-bar { display: flex; height: 10px; background: var(--pico-muted-border-color); border-radius: 5px; overflow: hidden; }
.cf-fill { height: 100%; }
.cf-fill.cf-income { background: #10b981; border-radius: 5px; }
.cf-fill.cf-spent { background: #64748b; }
.cf-fill.cf-bills { background: repeating-linear-gradient(45deg, #94a3b8, #94a3b8 4px, #cbd5e1 4px, #cbd5e1 8px); }
.cf-amt { font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cf-amt small { opacity: 0.65; }
.cf-caption { margin: 0.2rem 0 0; font-size: 0.78rem; }
.cf-caption.pos { color: #10b981; }
.cf-caption.neg { color: var(--pico-color-red-500); }
.pos { color: #10b981; }

.tbb-strict { margin-top: 0.4rem; padding-top: 0.4rem; border-top: 1px solid var(--pico-muted-border-color); font-size: 0.8rem; opacity: 0.85; }
.tbb-strict.neg strong { color: var(--pico-color-red-500); }

.pc-nums { text-align: right; }
.pc-nums .pc-total small { font-weight: 400; opacity: 0.6; font-size: 0.65rem; margin-left: 0.15rem; }
.pc-window-total { display: block; font-size: 0.68rem; color: var(--pico-muted-color); }

.cr-link { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--pico-muted-border-color); }
.cr-link:hover { border-bottom-color: var(--pico-primary); }

/* onboarding */
.muted-center { text-align: center; color: var(--pico-muted-color); }
.ob-account-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.35rem 0; border-bottom: 1px solid var(--pico-muted-border-color); }
.ob-account-row label { margin: 0; flex: 1; }
.ob-account-row select { width: auto; margin: 0; }
.ob-checklist p { line-height: 1.9; }

/* branded top nav */
.top-nav { display: flex; align-items: center; justify-content: space-between; padding: 0.55rem 1rem; border-bottom: 1px solid var(--pico-muted-border-color); position: sticky; top: 0; background: var(--pico-background-color); z-index: 50; }
.top-brand { font-weight: 700; text-decoration: none; color: inherit; letter-spacing: -0.01em; }
.top-actions { display: flex; align-items: center; gap: 0.9rem; font-size: 0.85rem; }
.top-actions a { text-decoration: none; color: var(--pico-muted-color); }
.top-actions a:hover { color: inherit; }
.top-user { color: var(--pico-muted-color); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-signout { margin: 0; display: inline; }
.top-signout button { background: none; border: none; color: var(--pico-muted-color); font-size: 0.85rem; padding: 0; margin: 0; width: auto; cursor: pointer; }
.top-signout button:hover { color: inherit; }

/* month summary hero rows */
.ms-row { display: flex; align-items: center; gap: 0.6rem; margin: 0.25rem 0; width: 100%; }
.ms-bar { position: relative; }
.cf-track { position: absolute; inset: 0; width: 100%; background: color-mix(in srgb, var(--pico-muted-border-color) 55%, transparent); border-radius: inherit; }
.ms-bar .cf-fill { position: relative; z-index: 1; }
.tbb-hero .tbb-amount { margin-top: 0.6rem; }

/* onboarding AI-sort progress */
.ob-progress { margin: 0.75rem 0; }
.ob-progress-head { margin-bottom: 0.4rem; }
.ob-progress-bar { height: 14px; }
.ob-progress .cf-fill { transition: width 0.6s ease; }

/* indeterminate "pulling in transactions" bar */
.ob-indeterminate { animation: ob-pulse 1.4s ease-in-out infinite; }
@keyframes ob-pulse { 0%,100% { opacity: 0.35; } 50% { opacity: 1; } }
