/* /budget/ page. Builds on /bills/bills.css (tokens, nav, band, footer). */
.budget { --chart-a: #d98a12; --chart-b: #1f6aa5; }
.budget .tint { background: linear-gradient(180deg, var(--sand), var(--cream)); }
.budget .lede { font-size: 1.1rem; max-width: 70ch; margin: 0 0 28px; }
.budget h3.sub { font-family: Fraunces, Georgia, serif; font-size: 1.5rem; margin: 48px 0 16px; }
.btn-navy { background: var(--navy); color: #fff; }

/* headline stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 0 0 24px; }
.stat { background: #fff; border-radius: 16px; padding: 22px; box-shadow: 0 1px 0 var(--line), 0 20px 50px -34px rgba(11,29,51,.45); display: flex; flex-direction: column; gap: 6px; }
.stat .v, .res .v { font-family: Fraunces, Georgia, serif; font-weight: 900; font-size: 2.1rem; line-height: 1; color: var(--navy); }
.stat .l, .res .l { font-weight: 700; font-size: .92rem; }
.stat .d, .res .d { font-size: .84rem; color: var(--muted); }
.callout { background: #fff7e6; border-left: 5px solid var(--gold); border-radius: 12px; padding: 20px 24px; font-size: 1.02rem; max-width: 90ch; }
.callout strong { display: block; font-family: Fraunces, Georgia, serif; font-size: 1.2rem; margin-bottom: 4px; }

/* calculator */
.presets { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 22px; }
.presets .btn { padding: 11px 18px; font-size: .88rem; }
.results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0 -8px 22px; padding: 8px; position: sticky; top: 76px; z-index: 5; background: rgba(241, 230, 208, .92); backdrop-filter: blur(8px); border-radius: 0 0 18px 18px; }
.res { background: #fff; border-radius: 14px; padding: 16px 20px; box-shadow: 0 1px 0 var(--line), 0 14px 36px -26px rgba(11,29,51,.5); display: flex; flex-direction: column; gap: 4px; border-top: 4px solid var(--line); }
.res.bad { border-top-color: var(--poppy); }
.res.bad .v { color: #b8431a; }
.res.good { border-top-color: #2f7d57; }
.res.good .v { color: #2f7d57; }
.calc { display: grid; grid-template-columns: 1.3fr 1fr 1.2fr; gap: 18px; align-items: start; }
.calc fieldset { margin: 0; border: 0; background: #fff; border-radius: 16px; padding: 20px 20px 14px; box-shadow: 0 1px 0 var(--line); min-width: 0; }
.calc legend { font-weight: 700; font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); padding: 0; float: left; width: 100%; margin-bottom: 10px; }
.toggle { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; font-size: .93rem; cursor: pointer; clear: both; }
.toggle input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--navy); flex: none; }
.toggle b { white-space: nowrap; color: var(--navy); }
.sel { display: grid; gap: 4px; font-size: .84rem; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
.sel select { font: 500 .92rem Inter, sans-serif; padding: 9px 10px; border-radius: 10px; border: 1px solid rgba(19,32,47,.25); background: #fff; color: var(--ink); width: 100%; }
.note { margin: -2px 0 8px 28px; font-size: .8rem; color: var(--muted); }
.seg-wrap { padding: 7px 0; font-size: .93rem; }
.seg-wrap b { color: var(--navy); white-space: nowrap; }
.mini-result { display: none; position: sticky; bottom: 0; z-index: 5; margin: 14px -16px 0; padding: 12px 16px; background: var(--navy); color: #fff; font-weight: 700; font-size: .92rem; text-align: center; }
.seg { display: flex; gap: 6px; margin-top: 8px; }
.seg button { flex: 1; padding: 8px 0; border-radius: 10px; border: 1px solid rgba(19,32,47,.25); background: #fff; font: 700 .9rem Inter, sans-serif; cursor: pointer; color: var(--ink); }
.seg button.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* tables */
.table-wrap { overflow-x: auto; background: #fff; border-radius: 16px; box-shadow: 0 1px 0 var(--line), 0 20px 50px -38px rgba(11,29,51,.45); margin: 0 0 20px; }
.table-wrap.narrow { max-width: 640px; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: right; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { text-align: right; padding: 11px 16px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; white-space: normal; min-width: 220px; }
table.data .basis { text-align: left; white-space: normal; min-width: 280px; color: var(--muted); font-size: .86rem; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.total td { font-weight: 700; background: var(--cream); }
.notes { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 8px; max-width: 80ch; }
.notes li { font-size: .95rem; }

/* bar charts: one magnitude series, color = group, values in ink */
.two { display: grid; grid-template-columns: 1.2fr .8fr; gap: 28px; align-items: start; margin-bottom: 20px; }
.chart { margin: 0; background: #fff; border-radius: 16px; padding: 20px 22px; box-shadow: 0 1px 0 var(--line); }
.chart figcaption { font-weight: 700; font-size: .86rem; margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; }
.legend { font-weight: 500; color: var(--muted); font-size: .8rem; display: inline-flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.sw-a { background: var(--chart-a); }
.sw-b { background: var(--chart-b); }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(130px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: .84rem; padding: 2px 0; }
.bar:hover .bl { color: var(--navy); font-weight: 600; }
.bt { height: 14px; background: rgba(11,29,51,.05); border-radius: 0 4px 4px 0; }
.bf { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; }
.bf.g-a { background: var(--chart-a); }
.bf.g-b { background: var(--chart-b); }
.bv { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; min-width: 58px; }
.bv small { display: block; font-weight: 500; color: var(--muted); font-size: .74rem; }
.facts { display: grid; gap: 12px; }
.fact { background: #fff; border-radius: 12px; padding: 14px 16px; font-size: .9rem; color: var(--muted); box-shadow: 0 1px 0 var(--line); }
.fact b { display: block; color: var(--ink); font-size: 1rem; }

.sources { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.sources li { background: #fff; border-radius: 12px; padding: 12px 16px; box-shadow: 0 1px 0 var(--line); }
.sources a { font-weight: 600; text-decoration: none; color: var(--navy); }
.sources a:hover { text-decoration: underline; }
.sources span { display: block; font-size: .78rem; color: var(--muted); }

@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .calc { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr; }
  .results { grid-template-columns: repeat(3, 1fr); gap: 8px; position: static; margin: 0 0 18px; padding: 0; background: none; }
  .mini-result { display: block; }
  .res { padding: 10px 10px; }
  .res .v { font-size: 1.3rem; }
  .res .d { display: none; }
  .res .l { font-size: .74rem; }
  table.data { font-size: .82rem; }
  table.data th, table.data td { padding: 9px 8px; }
  table.data th:first-child, table.data td:first-child { min-width: 132px; }
  table.data th { letter-spacing: .04em; font-size: .64rem; }
  .bar { grid-template-columns: 1fr auto; }
  .bar .bt { grid-column: 1 / -1; grid-row: 2; }
}
@media print {
  .presets, .calc, .results { display: none !important; }
  .budget .tint { background: none; }
}
