@font-face { font-family: "MM Serif"; src: url("fonts/LibreBaskerville.woff") format("woff"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "MM Serif"; src: url("fonts/LibreBaskerville-Italic.woff") format("woff"); font-weight: 400 700; font-style: italic; font-display: swap; }

:root {
  --navy: #1D2C44; --navy-2: #2B3D5C; --gold: #E2BF67; --gold-ink: #8A6A1F;
  --cream: #F4EDE1; --paper: #FBF8F2; --line: #E3D8C3; --ink: #1F2633; --muted: #5B6170;
  --sage: #5F7F6A; --red: #A23B32; --red-bg: #FBEDEA; --amber-bg: #FBF3DD;
  --serif: "MM Serif", "Libre Baskerville", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 16px/1.55 var(--sans); }
h1, h2, h3 { font-family: var(--serif); color: var(--navy); font-weight: 700; line-height: 1.2; margin: 0 0 .4em; }
a { color: var(--navy); }
button, input, select { font: inherit; }

.preview-flag { background: var(--gold); color: var(--navy); text-align: center; font-size: 13px; font-weight: 600; padding: 6px 12px; letter-spacing: .02em; }

.hero { text-align: center; padding: 36px 20px 22px; max-width: 720px; margin: 0 auto; }
.eyebrow { font-size: 12px; letter-spacing: .28em; text-transform: uppercase; color: var(--navy); margin: 0 0 12px; display: flex; align-items: center; gap: 12px; justify-content: center; }
.eyebrow::before, .eyebrow::after { content: ""; height: 1px; width: 36px; background: var(--gold); }
.hero h1 { font-size: clamp(38px, 10vw, 60px); margin-bottom: 10px; }
.lede { font-family: var(--serif); font-style: italic; color: var(--navy-2); font-size: 18px; margin: 0 auto 14px; max-width: 34ch; }
.privacy { font-size: 14px; color: var(--muted); margin: 0; }

main { max-width: 720px; margin: 0 auto; padding: 0 16px 24px; }
.howto { background: var(--paper); border-left: 4px solid var(--gold); padding: 14px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 15px; }
.linklike { display: block; min-height: 44px; margin-top: 4px; text-align: left; background: none; border: 0; padding: 0; color: var(--navy); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-weight: 600; }
.example-note { background: var(--amber-bg); border: 1px solid #EAD8A4; color: #6E5313; border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; font-size: 15px; font-weight: 600; }
.example-note[hidden] { display: none; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 18px; margin-bottom: 16px; box-shadow: 0 1px 0 rgba(29,44,68,.04); }
.step-num { font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-ink); font-weight: 700; margin: 0 0 4px; }
.card h2 { font-size: 24px; }
.opt { font-family: var(--sans); font-size: 14px; font-weight: 400; color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.field { margin-bottom: 14px; }
.field label, legend { display: block; font-weight: 600; color: var(--navy); margin-bottom: 4px; }
input, select { width: 100%; min-height: 48px; padding: 10px 12px; border: 1.5px solid #CBBFA8; border-radius: 10px; background: #fff; color: var(--ink); font-size: 16px; }
input:focus, select:focus, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--navy); }
.money { position: relative; }
.money span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money input { padding-left: 26px; }
.invalid { border-color: var(--red) !important; background: var(--red-bg); }
.err { color: var(--red); font-size: 14px; margin: 4px 0 0; min-height: 0; }
.err:empty { display: none; }
.err.big { font-weight: 600; text-align: center; margin-bottom: 10px; }
.row2 { display: grid; gap: 0 14px; }

.seg { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg legend { width: 100%; margin-bottom: 6px; }
.seg label { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid #CBBFA8; border-radius: 999px; padding: 8px 14px; background: #fff; cursor: pointer; min-height: 44px; }
.seg input { width: auto; min-height: 0; accent-color: var(--navy); }

.bills { display: grid; gap: 10px; margin-bottom: 12px; }
.bill { display: grid; grid-template-columns: 1fr 1fr auto; grid-template-areas: "name name rm" "amt due due"; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.bill .b-name { grid-area: name; } .bill .b-amt { grid-area: amt; } .bill .b-due { grid-area: due; } .bill .b-rm { grid-area: rm; }
.bill label { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 2px; }
.bill .err { grid-column: 1 / -1; }
.b-rm { align-self: end; width: 44px; height: 48px; border: 0; background: none; color: var(--muted); font-size: 22px; cursor: pointer; border-radius: 10px; }
.b-rm:hover { background: var(--red-bg); color: var(--red); }

.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 48px; padding: 12px 20px; border-radius: 999px; border: 2px solid var(--navy); font-weight: 700; cursor: pointer; text-decoration: none; text-align: center; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.ghost { background: transparent; color: var(--navy); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn.block { width: 100%; font-size: 18px; }

/* results */
.results { padding-top: 8px; outline: none; scroll-margin-top: 12px; }
.res-head { text-align: center; margin: 18px 0 16px; }
.res-head h2 { font-size: 30px; }
.res-head p { margin: 0; color: var(--muted); }
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.tot { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tot .k { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.tot .v { font-family: var(--serif); font-size: 22px; color: var(--navy); font-weight: 700; }
.tot.wide { grid-column: 1 / -1; background: var(--navy); border-color: var(--navy); }
.tot.wide .k { color: var(--gold); } .tot.wide .v { color: #fff; font-size: 26px; }
.tot .s { font-size: 13px; color: var(--muted); }
.tot.wide .s { color: #D9DEE8; }

.alert { border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; font-size: 15px; }
.alert h3 { font-family: var(--sans); font-size: 16px; margin: 0 0 4px; }
.alert.bad { background: var(--red-bg); border: 1px solid #E7B9B2; } .alert.bad h3 { color: var(--red); }
.alert.warn { background: var(--amber-bg); border: 1px solid #EAD8A4; } .alert.warn h3 { color: #6E5313; }
.alert.good { background: #EEF4EF; border: 1px solid #C9DCCD; } .alert.good h3 { color: #3F6049; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }

.bar { display: flex; height: 22px; border-radius: 999px; overflow: hidden; background: #E9E1D1; margin: 8px 0 6px; }
.bar span { display: block; height: 100%; min-width: 0; }
.c-bills { background: var(--navy); } .c-sav { background: var(--sage); } .c-spend { background: var(--gold); } .c-short { background: repeating-linear-gradient(45deg, var(--red), var(--red) 6px, #C9645A 6px, #C9645A 12px); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); margin: 0; padding: 0; list-style: none; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.check { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.check-head { background: var(--navy); color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.check-head h3 { color: #fff; margin: 0; font-size: 19px; }
.check-head .amt { color: var(--gold); font-weight: 700; font-family: var(--serif); font-size: 18px; }
.check-body { padding: 14px 16px; }
.check h4 { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-ink); margin: 6px 0 6px; }
.lines { list-style: none; margin: 0 0 8px; padding: 0; }
.lines li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.lines li:last-child { border-bottom: 0; }
.lines .due { color: var(--muted); font-size: 13px; display: block; }
.lines .sum { font-weight: 700; color: var(--navy); }
.lines .note { color: #6E5313; }
.lines .neg { color: var(--red); font-weight: 700; }
.split { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.acct { border-radius: 10px; padding: 8px 10px; background: #fff; border: 1px solid var(--line); border-top-width: 4px; }
.acct.b { border-top-color: var(--navy); } .acct.s { border-top-color: var(--sage); } .acct.p { border-top-color: var(--gold); }
.acct .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.acct .v { font-weight: 700; color: var(--navy); font-size: 16px; }
.empty { color: var(--muted); font-style: italic; font-size: 15px; margin: 0 0 8px; }

.tips { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 18px 0; }
.tips h3 { font-size: 20px; }
.tips ul { margin: 0; padding-left: 20px; }
.tips li { margin-bottom: 8px; }
.nerd { font-family: var(--serif); font-style: italic; color: var(--navy-2); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 18px; }
.actions .btn { width: 100%; padding: 10px 12px; font-size: 15px; }
.actions .full { grid-column: 1 / -1; }
.copied { text-align: center; color: var(--sage); font-weight: 600; font-size: 14px; min-height: 1em; margin: -8px 0 12px; }

.cta { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 24px 20px; text-align: center; margin: 22px 0 10px; }
.cta .eyebrow { color: var(--gold); }
.cta h3 { color: #fff; font-size: 26px; }
.cta p { color: #D9DEE8; margin: 0 auto 16px; max-width: 42ch; }
.cta .btn { width: 100%; max-width: 380px; }
.cta2 { text-align: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.email-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 18px; margin: 8px 0 18px; }
.email-card h3 { font-size: 22px; }
.email-card > p { margin: 0 0 14px; color: var(--muted); }
.consent { display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 8px; font-size: 15px; cursor: pointer; }
.consent input[type=checkbox] { width: 44px; height: 44px; min-width: 44px; min-height: 44px; margin: 0; accent-color: var(--navy); flex-shrink: 0; }
.consent span { padding-top: 10px; }
.cta2 p { margin: 0 0 10px; }

.site-foot { max-width: 720px; margin: 0 auto; padding: 18px 20px 40px; text-align: center; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
.site-foot p { margin: 4px 0; }
.disclaimer { font-weight: 700; color: var(--navy); font-size: 14px; }
.print-only { display: none; }

@media (min-width: 640px) {
  .row2 { grid-template-columns: 1fr 1fr; }
  .bill { grid-template-columns: 2fr 1fr 1fr auto; grid-template-areas: "name amt due rm"; }
  .totals { grid-template-columns: repeat(4, 1fr); }
  .tot.wide { grid-column: 1 / -1; }
  .actions { grid-template-columns: repeat(4, 1fr); }
  .actions .full { grid-column: auto; }
  .card { padding: 24px 26px; }
}

@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 12px; }
  .preview-flag, #planForm, .actions, .copied, .cta, .cta2, .email-card, .example-note, .privacy, .lede, .site-foot a { display: none !important; }
  .hero { padding: 0 0 8px; } .hero h1 { font-size: 30px; }
  .results { display: block !important; }
  .check, .tot, .tips { break-inside: avoid; box-shadow: none; }
  .check-head, .tot.wide, .bar span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-only { display: block; }
  .site-foot { border: 0; }
}
