:root { --green: #166534; --green-dk: #14532d; --ink: #1d2420; --muted: #6b7280; --bg: #f0fdf4; --card: #ffffff; --line: #eef2ee; }
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
#hdr { background: linear-gradient(135deg, #166534, #22c55e); color: #fff; padding: 20px 16px 16px; position: sticky; top: 0; z-index: 5; }
.hdr-title { font-size: 24px; font-weight: 700; }
.hdr-sub { font-size: 13px; opacity: .92; margin-top: 2px; }
#view { padding: 14px 14px 28px; max-width: 640px; margin: 0 auto; }
.card { background: var(--card); border-radius: 16px; padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
h2.sect { font-size: 12.5px; color: var(--muted); margin: 26px 4px 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em; }
h2.sect:first-of-type { margin-top: 10px; }
#foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 16px 30px; }

/* Paycheck calculator — bills grouped by which check pays them */
.monthsum { background: var(--bg); border-radius: 12px; padding: 14px 12px; margin-bottom: 14px; text-align: center; }
.monthsum .mk { font-size: 11.5px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.monthsum .mv { font-size: 17px; margin-top: 4px; line-height: 1.45; }
.monthsum .mv b { color: var(--green-dk); }
.checkgroup { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.checkhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.checkhead .cn { font-size: 17px; font-weight: 800; color: var(--green-dk); }
.checkamt { display: flex; align-items: center; gap: 4px; }
.checkamt .dollar { font-size: 18px; font-weight: 700; color: var(--green); }
.checkamt input { font-size: 18px; font-weight: 800; color: var(--ink); width: 112px; padding: 6px 8px;
  border: 2px solid var(--line); border-radius: 8px; text-align: right; }
.checkamt input:focus { border-color: var(--green); outline: none; }
.checkleft { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.checkleft .lv { font-size: 20px; font-weight: 800; color: var(--green-dk); }
.ckpill { flex: none; min-width: 44px; padding: 8px 10px; border-radius: 999px; border: 2px solid var(--green);
  background: #fff; color: var(--green-dk); font-weight: 800; font-size: 13.5px; cursor: pointer; }
.ckpill.none { border-color: var(--line); color: var(--muted); }
.unassigned-head { font-size: 13px; color: var(--muted); font-weight: 700; margin: 12px 4px 6px; }
.btn { display: block; width: 100%; font-size: 16px; font-weight: 700; border: 0; border-radius: 12px;
  padding: 14px; cursor: pointer; }
.btn.ghost { background: var(--bg); color: var(--green-dk); margin-top: 12px; }
.btn.small-toggle { width: fit-content; margin: 4px auto 12px; padding: 10px 18px; font-size: 14px; }
.payfrom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 2px 0 12px; }
.payfrom-label { font-size: 13px; color: var(--muted); font-weight: 700; }
.pillbtn { border: 1.5px solid var(--green); background: #fff; color: var(--green-dk); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 700; cursor: pointer; }
.pillbtn.on { background: var(--green); color: #fff; }
.activetag { font-size: 12px; color: var(--green-dk); font-weight: 700; }
.setaside { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.setaside input { width: 78px; padding: 6px 8px; font-size: 14px; border: 1.5px solid var(--line); border-radius: 8px; }
.setaside input:focus { border-color: var(--green); outline: none; }
.trulyleft { font-weight: 800; color: var(--green-dk); }
.paydayrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px;
  font-size: 13px; color: var(--muted); font-weight: 700; }
.paydayrow input { padding: 6px 8px; font-size: 14px; border: 1.5px solid var(--line); border-radius: 8px; color: var(--ink); }
.paydayrow input:focus { border-color: var(--green); outline: none; }
.paydayrow .pastwarn { color: #b45309; font-weight: 800; }
.safespend { margin-top: 6px; font-size: 13.5px; font-weight: 700; color: var(--green-dk); }
.safespend.over { color: #b45309; }
.bill-due { font-size: 11px; color: var(--muted); margin-top: 2px; }
.bill-due.edit { cursor: pointer; }
.due-edit { width: 54px; padding: 2px 4px; font-size: 12px; border: 1.5px solid var(--line); border-radius: 6px; }
.backuprow { display: flex; gap: 8px; justify-content: center; }
.btn.sm { width: auto; margin: 12px 0 4px; padding: 10px 16px; font-size: 14px; }

/* 3-paycheck month banner */
.threebonus { background: linear-gradient(135deg, #fef3c7, #fde68a); border: 2px solid #f59e0b;
  border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.tb-head { font-size: 16px; font-weight: 800; color: #92400e; }
.tb-sub { font-size: 13px; color: #92400e; margin-top: 2px; line-height: 1.35; }

/* Fun money figure — what's guilt-free for the family from the paying-from check */
.funmoney { background: linear-gradient(135deg, #dcfce7, #bbf7d0); border: 2px solid #16a34a;
  border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.fm-head { font-size: 17px; font-weight: 800; color: var(--green-dk); }
.fm-sub { font-size: 13px; color: var(--green-dk); margin-top: 2px; line-height: 1.35; }
.funmoney.none .fm-head { font-size: 15px; }

/* Bill rows — shared by calculator checklist and monthly bills list */
.bill { display: flex; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid var(--line); border-radius: 10px; }
.bill:last-child { border-bottom: 0; }
.bill.active-check { background: #fce7f3; }
.bill-title { flex: 1; min-width: 0; }
.bill-name { font-size: 15.5px; font-weight: 600; }
.bill-note { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.bill-amt { font-size: 16px; font-weight: 700; white-space: nowrap; padding: 8px 6px; border-radius: 8px; cursor: pointer; }
.bill-amt.unknown { color: var(--muted); font-weight: 600; font-size: 14px; }
.bill-amt:active { background: var(--bg); }
.bill.paid .bill-name { color: var(--ink); }
.paidbtn { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--green);
  background: #fff; color: var(--green); font-size: 22px; font-weight: 800; cursor: pointer;
  display: flex; align-items: center; justify-content: center; }
.paidbtn.on { background: #16a34a; border-color: #16a34a; color: #fff; }
.amt-edit { font-size: 16px; font-weight: 700; width: 110px; padding: 8px 6px; border: 2px solid var(--green);
  border-radius: 8px; text-align: right; }
.bills-total { display: flex; justify-content: space-between; align-items: center; margin-top: 10px;
  padding-top: 10px; border-top: 2px solid var(--line); font-size: 17px; font-weight: 800; }
.bills-total .v { color: var(--green-dk); }

/* Debts / plan / income */
.debt { padding: 10px 0; border-bottom: 1px solid var(--line); }
.debt:last-child { border-bottom: 0; }
.debt .dn { font-size: 16px; font-weight: 700; }
.debt .dd { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.debt-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.debt-bal { font-size: 20px; font-weight: 800; color: var(--green-dk); padding: 10px 8px;
  border-radius: 8px; cursor: pointer; white-space: nowrap; }
.debt-bal:active { background: var(--bg); }
.logrow { display: flex; gap: 8px; margin-top: 10px; }
.log-amt { flex: 1; min-width: 0; font-size: 16px; padding: 10px; border: 2px solid var(--line);
  border-radius: 10px; }
.log-amt:focus { border-color: var(--green); outline: none; }
.btn.small { width: auto; flex: 1; padding: 12px 8px; font-size: 15px; background: #16a34a; color: #fff; }
.btn.small.alt { background: #b45309; }
.hist { margin-top: 8px; }
.histent { display: flex; gap: 8px; align-items: baseline; font-size: 13.5px; padding: 6px 0;
  border-top: 1px dashed var(--line); }
.histent.empty { color: var(--muted); border-top: 0; }
.histent .hd { color: var(--muted); flex: 0 0 62px; }
.histent .ht { flex: 1; font-weight: 600; }
.histent.is-pay .ht { color: #16a34a; }
.histent.is-charge .ht { color: #b45309; }
.histent .ha { font-weight: 700; }
.histent .hb { color: var(--muted); }
.debt-total { border-top: 2px solid var(--line); margin-top: 4px; padding-top: 12px; }
.debt-total .dd { font-weight: 800; color: var(--ink); font-size: 16px; margin-top: 4px; }
.planstep { display: flex; gap: 10px; padding: 8px 0; font-size: 14.5px; }
.planstep .n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--green);
  color: #fff; font-weight: 800; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.fact { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.fact:last-child { border-bottom: 0; }
.fact .fk { color: var(--muted); }
.fact .fv { font-weight: 700; text-align: right; }
.note-line { font-size: 13.5px; color: var(--muted); margin: 6px 0 0; }

/* Extra-payment simulator */
.sim-top { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 6px; }
.sim-lab { font-size: 13.5px; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.sim-num { width: 92px; font-size: 16px; font-weight: 700; padding: 8px 10px; border: 2px solid var(--line);
  border-radius: 10px; text-align: right; }
.sim-num:focus { border-color: var(--green); outline: none; }
.sim-sel { font-size: 15px; font-weight: 600; padding: 8px 10px; border: 2px solid var(--line);
  border-radius: 10px; background: #fff; max-width: 200px; }
.sim-sel:focus { border-color: var(--green); outline: none; }
.sim-fhead { font-size: 12.5px; color: var(--muted); font-weight: 700; margin: 12px 0 4px; }
.sim-frow { border-top: 1px dashed var(--line); padding: 8px 0; }
.sim-fname { font-size: 14.5px; font-weight: 700; margin-bottom: 6px; }
.sim-fgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sim-fld { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.sim-fld input { font-size: 14px; font-weight: 600; padding: 7px 8px; border: 1.5px solid var(--line);
  border-radius: 8px; width: 100%; min-width: 0; }
.sim-fld input:focus { border-color: var(--green); outline: none; }
.sim-results { margin-top: 12px; background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.sim-line { font-size: 14.5px; padding: 4px 0; }
.sim-win { margin-top: 8px; font-size: 16px; font-weight: 800; color: var(--green-dk); }
.sim-warn { margin-top: 8px; font-size: 13px; color: #b45309; font-weight: 600; }
