/* Home budget */
.tally {
  max-width: var(--col); margin: 0 auto; padding: 0 var(--pad) 10px;
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px;
}
.tally button {
  background: var(--surface); border: 0; border-radius: 12px; padding: 7px 10px; text-align: left; min-width: 0;
}
.tally span { display: block; font-size: 12.5px; color: var(--muted); }
.tally b { display: block; font-size: 17px; font-weight: 750; font-stretch: 88%; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tally .left b.pos { color: var(--green-ink); }
.tally .left b.neg { color: var(--coral-ink); }

.bd-hero { padding: 16px 0 18px; }
.bd-hero .display { color: var(--navy); }
.bd-hero .lede { margin: 12px 0 0; }

/* Collapsible sections */
.cat { background: var(--surface); border-radius: var(--r-lg); margin-top: 10px; overflow: hidden; }
.cat-head {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 16px var(--pad);
  background: none; border: 0; text-align: left;
}
.cat-head .t { flex: 1; font-size: 18px; font-weight: 700; font-stretch: 90%; }
.cat-head .sum { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--ink); }
.cat-head .sum.zero { color: var(--faint); font-weight: 500; }
.cat-head .chev { width: 20px; height: 20px; color: var(--muted); transition: transform .2s; flex: none; }
.cat[data-open="true"] .chev { transform: rotate(180deg); }
.cat-body { padding: 0 var(--pad) 14px; }
.cat-body .hint { font-size: 14px; color: var(--muted); margin: -6px 0 6px; }
.cat.income { box-shadow: inset 4px 0 0 var(--green); }

.line {
  display: grid; grid-template-columns: 1fr 112px 64px; gap: 8px; align-items: center;
  padding: 7px 0; border-top: 1px solid var(--sky-2);
}
.line:first-of-type { border-top: 0; }
.line .lbl { font-size: 15.5px; line-height: 1.2; min-width: 0; }
.line .lbl input { width: 100%; border: 0; border-bottom: 1.5px dashed var(--line); padding: 4px 0; font-size: 16px; background: transparent; }
.line .lbl input:focus { outline: none; border-bottom-color: var(--blue); }
.line .money .input { min-height: 42px; padding-top: 8px; padding-bottom: 8px; text-align: right; }
.freq { position: relative; height: 42px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--sky); display: grid; place-items: center; font-size: 14px; font-weight: 600; color: var(--navy); }
.freq select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; cursor: pointer; }
.freq:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(74, 143, 203, 0.25); }
.freq.not-m { background: #FFF4DA; border-color: #F2D28B; }
.mo-equiv { grid-column: 2 / 4; text-align: right; font-size: 12.5px; color: var(--muted); margin-top: -4px; }
.add-line { margin-top: 6px; padding-left: 0; }
.rm-line { width: 32px; height: 32px; }

/* Summary */
.big-left { padding: 20px 0 6px; }
.big-left .k { font-size: 17px; color: var(--muted); }
.big-left .v { font-weight: 800; font-stretch: 78%; font-size: clamp(52px, 17vw, 76px); line-height: 0.95; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.big-left .v.pos { color: var(--green-ink); }
.big-left .v.neg { color: var(--coral-ink); }
.big-left p { margin: 8px 0 0; color: var(--muted); max-width: 32em; }

.facts3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.facts3 div { background: var(--surface); border-radius: 14px; padding: 10px 12px; }
.facts3 span { display: block; font-size: 13px; color: var(--muted); }
.facts3 b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

.bars { margin-top: 6px; }
.bar-row { padding: 9px 0; border-top: 1px solid var(--sky-2); }
.bar-row:first-child { border-top: 0; }
.bar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
.bar-top .amt { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.bar-top .amt small { font-weight: 500; color: var(--muted); margin-left: 6px; font-size: 13px; }
.bar-track { height: 10px; border-radius: 0 5px 5px 0; background: var(--sky); margin-top: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--navy); border-radius: 0 4px 4px 0; transition: width .4s cubic-bezier(.2,.8,.2,1); }

.carry { background: var(--navy); color: #fff; border-radius: var(--r-lg); padding: 22px var(--pad); margin-top: 12px; }
.carry h2 { font-size: 22px; font-weight: 750; font-stretch: 86%; }
.carry .intro { color: #DCE5F3; margin: 8px 0 16px; }
.carry .payment { font-weight: 800; font-stretch: 78%; font-size: clamp(48px, 15vw, 68px); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.carry .payment small { font-size: 20px; font-weight: 600; font-stretch: 100%; letter-spacing: 0; margin-left: 4px; color: #C9D6EC; }
.carry .sub { color: #C9D6EC; margin-top: 4px; font-size: 15px; }
.math { margin: 18px 0 0; padding: 0; list-style: none; border-top: 1px solid rgba(255,255,255,0.15); }
.math li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,0.15); font-size: 15px; color: #DCE5F3; }
.math li b { color: #fff; font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.math li.total { color: #fff; font-weight: 650; }
.cushion { margin-top: 16px; }
.cushion label { display: block; font-size: 14px; color: #C9D6EC; margin-bottom: 6px; }
.cushion .money::before { color: var(--muted); }
.carry .input { color: var(--ink); }
.carry .warnline { background: rgba(242, 179, 61, 0.16); border-left: 3px solid var(--amber); color: #FCE7BC; padding: 10px 12px; border-radius: 0 10px 10px 0; margin-top: 12px; font-size: 14.5px; }
.carry .fine { font-size: 13.5px; color: #B4C3DE; margin: 14px 0 16px; }
.carry .btn + .btn { margin-top: 10px; }
.carry .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.35); }

/* Debts */
.debt { background: var(--surface); border-radius: var(--r-lg); padding: 14px var(--pad) 16px; margin-top: 10px; }
.debt-top { display: flex; align-items: center; gap: 8px; }
.debt-top .name { flex: 1; font-size: 18px; font-weight: 700; border: 0; border-bottom: 1.5px dashed transparent; padding: 4px 0; background: transparent; min-width: 0; }
.debt-top .name:focus { outline: none; border-bottom-color: var(--blue); }
.debt .grid-3 { margin-top: 8px; gap: 8px; }
.debt .field > span { font-size: 13px; }
.debt .input { min-height: 44px; }
.pct { position: relative; }
.pct::after { content: "%"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.pct .input { padding-right: 28px; }
.debt-out { margin-top: 10px; font-size: 15px; color: var(--muted); }
.debt-out b { color: var(--ink); }
.debt-out .warn { color: var(--coral-ink); font-weight: 600; }
.first-badge { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--coral); color: var(--ink); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.debt-total { background: var(--surface); border-radius: var(--r-lg); padding: 16px var(--pad); margin-top: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.debt-total span { display: block; font-size: 13px; color: var(--muted); }
.debt-total b { font-size: 17px; font-variant-numeric: tabular-nums; }

/* Readiness */
.ready-score { background: var(--surface); border-radius: var(--r-lg); padding: 20px var(--pad); margin-top: 6px; }
.ready-score .pctbig { font-weight: 800; font-stretch: 78%; font-size: 60px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--navy); }
.ready-score .tier { font-size: 19px; font-weight: 700; margin-top: 6px; }
.ready-score p { margin: 6px 0 0; color: var(--muted); }
.ready-meter { position: relative; height: 12px; border-radius: 6px; background: var(--sky-2); margin-top: 16px; overflow: hidden; }
.ready-meter .fill { height: 100%; background: var(--navy); border-radius: 6px; transition: width .4s; }
.ready-scale { display: grid; grid-template-columns: 70fr 20fr 10fr; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.ready-scale span { border-left: 1.5px solid var(--line); padding-left: 5px; }
.q { padding: 12px 0; border-top: 1px solid var(--sky-2); }
.q:first-of-type { border-top: 0; }
.q p { margin: 0 0 8px; font-size: 16px; line-height: 1.3; }

/* Bottom tabs: a solid navy bar so it reads as navigation */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: #122A52; border-top: 1px solid rgba(255, 255, 255, 0.22); box-shadow: 0 -8px 22px rgba(18, 42, 82, 0.28);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabs-inner { max-width: var(--col); margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.tabs button {
  background: none; border: 0; border-radius: 14px; padding: 7px 0 8px; display: grid; justify-items: center; gap: 3px;
  font-size: 13px; font-weight: 650; color: #C9D6EC; transition: background-color .15s, color .15s;
}
.tabs button svg { width: 24px; height: 24px; }
.tabs button:hover { color: #fff; }
.tabs button[aria-current="page"] { background: rgba(255, 255, 255, 0.14); color: #fff; }
.tabs button[aria-current="page"] svg { color: var(--coral); }
.tabs button:focus-visible { outline-color: #fff; }
.has-tabs { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
@media (max-width: 359px) {
  .line { grid-template-columns: 1fr 96px 58px; gap: 6px; }
  .line .lbl { font-size: 14.5px; }
  .tally b { font-size: 15px; }
}

/* Share sheet */
.share-h { margin: 18px 0 4px; font-size: 17px; }
.sheet .share-h:first-of-type { margin-top: 10px; }
.share-fine { font-size: 13.5px; margin: 10px 0 0 !important; }
.paste-row { display: flex; gap: 8px; }
.paste-row .input { flex: 1; min-width: 0; }
.cmp-list { list-style: none; margin: 0 0 6px; padding: 0; }
.cmp-list li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--sky-2); font-size: 15px; }
.cmp-list li:first-child { border-top: 0; }
.cmp-list b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* Down payment plan */
.dp-bar { height: 12px; border-radius: 6px; background: var(--sky-2); overflow: hidden; margin-top: 16px; }
.dp-bar span { display: block; height: 100%; background: var(--green); border-radius: 6px; transition: width .4s; }
.dp-line { margin: 8px 0 0; font-size: 15.5px; }
.dp-line.ok { color: var(--green-ink); font-weight: 600; }
.dp-line.warn { color: var(--coral-ink); font-weight: 600; }

/* 50/30/20 */
.split-row { padding: 10px 0; border-top: 1px solid var(--sky-2); }
.split-row:first-of-type { border-top: 0; }
.split-row .bar-top small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 1px; }
.split-track { position: relative; height: 12px; border-radius: 0 6px 6px 0; background: var(--sky); margin-top: 8px; }
.split-fill { height: 100%; border-radius: 0 5px 5px 0; background: var(--navy); transition: width .4s; }
.split-fill.save { background: var(--green-ink); }
.split-track .guide { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--coral); }
.split-status { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.split-status .ok { color: var(--green-ink); font-weight: 600; }
.split-status .warn { color: var(--coral-ink); font-weight: 600; }
.split-left { margin: 10px 0 0; font-size: 15px; color: var(--ink); background: var(--sky); padding: 10px 12px; border-radius: 10px; }

/* Pay them off faster */
.plan .chips { gap: 6px; }
.plan-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 14.5px; }
.plan-table th, .plan-table td { text-align: left; padding: 9px 6px; border-top: 1px solid var(--sky-2); vertical-align: top; }
.plan-table thead th { border-top: 0; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.plan-table tbody th { font-weight: 600; width: 44%; }
.plan-table td { font-variant-numeric: tabular-nums; }
.plan-table td small { display: block; font-size: 12.5px; margin-top: 2px; }
.plan-table .ok { color: var(--green-ink); font-weight: 650; }
.plan-table tr.best th::after { content: "Saves the most"; display: block; margin-top: 3px; font-size: 11.5px; font-weight: 700; color: var(--green-ink); }
.plan-table tr.base { color: var(--muted); }
.plan-order { margin: 12px 0 0; padding-left: 22px; }
.plan-order li { padding: 5px 0; }
.plan-order li span { font-weight: 600; }
.plan-order li small { display: block; color: var(--muted); font-size: 13px; }
.seg button[data-v="avalanche"][aria-pressed="true"], .seg button[data-v="snowball"][aria-pressed="true"] { background: var(--navy); color: #fff; }
