A cash-flow and tax set-aside planner for Kentucky trades owner-operators (roofers, HVAC, landscapers) whose income swings with the seasons. Try "Show me an example roofer first," the sample bank statement, and the what-if buttons (wet spring, truck breakdown). Runs fully in the browser; no data leaves the page.
<!-- Copyright (c) 2026 Ashley Butts. Released under the MIT License. -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Off-Season Planner</title>
<meta name="description" content="A cash and tax planner for Kentucky trades owners whose income comes in by the season.">
<style>
:root{
--paper:#EDEFEB; --panel:#FFFFFF; --ink:#17212B; --muted:#55606B; --line:#CBD1CA;
--navy:#1E3A52; --navy-2:#2C5374; --yellow:#F5B800; --red:#B3261E; --green:#2E6B4F;
--cond:"Barlow Condensed","Roboto Condensed","Arial Narrow","Avenir Next Condensed","Helvetica Neue",sans-serif;
--body:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--paper);color:var(--ink);font:16px/1.5 var(--body)}
body.locked{overflow:hidden}
a{color:var(--navy-2)}
button,input,select{font:inherit;color:inherit}
:focus-visible{outline:3px solid var(--yellow);outline-offset:2px}
.num{font-variant-numeric:tabular-nums}
[hidden]{display:none !important}
/* Header */
header.top{background:var(--navy);color:#fff;border-bottom:6px solid var(--yellow)}
.wrap{max-width:1180px;margin:0 auto;padding:0 16px}
.top .wrap{display:flex;flex-wrap:wrap;gap:12px 24px;align-items:flex-end;justify-content:space-between;padding-top:22px;padding-bottom:18px}
.brand h1{margin:0;font-family:var(--cond);font-stretch:condensed;font-weight:800;font-size:clamp(2.4rem,6vw,3.6rem);line-height:.9;letter-spacing:-.01em}
.brand p{margin:8px 0 0;max-width:46ch;color:#D6E1EA}
.toolbar{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.btn{border:1px solid rgba(255,255,255,.45);background:transparent;color:#fff;padding:8px 14px;border-radius:6px;cursor:pointer;font-weight:600}
.btn:hover{background:rgba(255,255,255,.12)}
.btn.primary{background:var(--yellow);border-color:var(--yellow);color:var(--ink)}
.btn.primary:hover{background:#FFC928}
.status{font-size:.85rem;color:#D6E1EA;min-width:9ch}
.status.dirty{color:var(--yellow);font-weight:600}
.notice{margin:16px 0 0;padding:10px 14px;border-left:4px solid var(--navy);background:var(--panel);font-size:.9rem;color:var(--muted)}
.alert{margin:16px 0 0;padding:12px 14px;border-left:4px solid var(--red);background:#FBECEA;color:#5C1410;font-size:.95rem}
/* Layout */
main.wrap{display:grid;grid-template-columns:minmax(300px,380px) 1fr;gap:24px;padding-top:20px;padding-bottom:40px;align-items:start}
@media (max-width:900px){main.wrap{grid-template-columns:1fr} .inputs{order:2}}
.inputs{background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:4px 18px 18px}
@media (min-width:901px){.inputs{position:sticky;top:12px;max-height:calc(100vh - 24px);overflow:auto}}
.inputs-head{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:14px 0 4px}
.inputs-head h2{margin:0;font-family:var(--cond);font-stretch:condensed;font-weight:800;font-size:1.5rem;color:var(--navy)}
fieldset{border:0;border-top:1px solid var(--line);margin:0;padding:14px 0 6px}
legend{font-family:var(--cond);font-stretch:condensed;font-weight:700;font-size:1.25rem;padding:0;color:var(--navy)}
.field{margin:10px 0}
.field label,.label{display:block;font-weight:600;font-size:.92rem;margin-bottom:4px}
.hint{display:block;font-size:.82rem;color:var(--muted);margin-top:3px}
.field input[type=number],.field input[type=text],.field select{width:100%;padding:8px 10px;border:1px solid #AEB6AD;border-radius:6px;background:#fff}
.money{position:relative}
.money::before{content:"$";position:absolute;left:10px;top:50%;transform:translateY(-50%);color:var(--muted);pointer-events:none}
.money input{padding-left:22px !important}
.pct{position:relative}
.pct::after{content:"%";position:absolute;right:10px;top:50%;transform:translateY(-50%);color:var(--muted);pointer-events:none}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.months{display:grid;grid-template-columns:repeat(3,1fr);gap:6px 8px;margin-top:6px}
.months label{font-size:.78rem;font-weight:600;color:var(--muted);margin:0}
.months input{width:100%;padding:6px 6px;border:1px solid #AEB6AD;border-radius:5px;font-size:.9rem}
.linkbtn{background:none;border:1px solid var(--navy);color:var(--navy);border-radius:6px;padding:6px 10px;cursor:pointer;font-weight:600;font-size:.88rem}
.linkbtn:hover{background:#E6EDF3}
.btnrow{display:flex;flex-wrap:wrap;gap:8px;margin:6px 0}
.radio{display:flex;gap:8px;align-items:flex-start;margin:6px 0;font-size:.92rem}
.radio input{margin-top:4px}
.check{display:flex;gap:8px;align-items:flex-start;font-size:.88rem;margin-top:6px}
/* Results */
.results{display:flex;flex-direction:column;gap:20px;min-width:0}
section.card{background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:18px 20px}
section.card h2{margin:0 0 4px;font-family:var(--cond);font-stretch:condensed;font-weight:800;font-size:1.7rem;line-height:1.1;color:var(--navy)}
section.card > p.sub{margin:0 0 14px;color:var(--muted);font-size:.92rem;max-width:70ch}
.ticket{display:grid;grid-template-columns:repeat(3,1fr);border:1px solid var(--line);border-radius:6px;overflow:hidden}
@media (max-width:640px){.ticket{grid-template-columns:1fr}}
.ticket > div{padding:14px 16px;border-right:1px solid var(--line)}
.ticket > div:last-child{border-right:0}
@media (max-width:640px){.ticket > div{border-right:0;border-bottom:1px solid var(--line)}.ticket > div:last-child{border-bottom:0}}
.ticket .k{font-size:.85rem;color:var(--muted)}
.ticket .v{font-family:var(--cond);font-stretch:condensed;font-weight:800;font-size:2.4rem;line-height:1.05;margin:2px 0}
.ticket .d{font-size:.88rem}
.verdict{margin:14px 0 0;font-size:1rem;max-width:72ch}
.bad{color:var(--red)} .good{color:var(--green)}
/* Right now */
.now{display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center}
@media (max-width:640px){.now{grid-template-columns:1fr}}
.countdown{background:var(--navy);color:#fff;border-radius:8px;padding:12px 18px;text-align:center;min-width:130px}
.countdown b{display:block;font-family:var(--cond);font-stretch:condensed;font-size:3rem;line-height:1}
.countdown span{font-size:.82rem;color:#D6E1EA}
.now ol{margin:0;padding-left:20px}
.now li{margin:4px 0}
/* What-if */
.chips{display:flex;flex-wrap:wrap;gap:8px;margin:2px 0 6px}
.chip{border:1.5px solid var(--navy);background:#fff;color:var(--navy);border-radius:999px;padding:7px 14px;cursor:pointer;font-weight:600;font-size:.9rem;display:inline-flex;align-items:center;gap:6px}
.chip:hover{background:#E6EDF3}
.chip[aria-pressed=true]{background:var(--navy);color:#fff}
.chip[aria-pressed=true]::before{content:"✓"}
.delta{min-height:1.5em;margin:4px 0 8px;font-size:.95rem}
/* Season strip */
.strip-wrap{overflow-x:auto;margin:6px -4px 0;padding:0 4px}
svg.strip{display:block;width:100%;min-width:620px;height:auto}
svg.strip .bar{transform-box:fill-box;transform-origin:50% 100%}
svg.strip .bar.neg{transform-origin:50% 0}
svg.strip.go .bar{animation:grow .55s cubic-bezier(.2,.8,.2,1) both}
@keyframes grow{from{transform:scaleY(0)}to{transform:scaleY(1)}}
svg.strip.go .txline{stroke-dasharray:1400;animation:draw 1.1s .3s ease-out both}
@keyframes draw{from{stroke-dashoffset:1400}to{stroke-dashoffset:0}}
.legend{display:flex;flex-wrap:wrap;gap:6px 18px;font-size:.84rem;color:var(--muted);margin-top:8px}
.sw{display:inline-block;width:14px;height:10px;vertical-align:middle;margin-right:5px;border-radius:2px}
table{width:100%;border-collapse:collapse;font-size:.92rem}
th,td{padding:7px 8px;text-align:right;border-bottom:1px solid var(--line);white-space:nowrap}
th:first-child,td:first-child{text-align:left}
thead th{font-size:.82rem;color:var(--muted);font-weight:600;border-bottom:2px solid var(--ink)}
tfoot td{font-weight:700;border-top:2px solid var(--ink);border-bottom:0}
tr.tight td{background:#FFF6D6}
tr.over td{background:#FBECEA}
.table-wrap{overflow-x:auto}
#taxTable td{white-space:normal}
#taxTable td:first-child{min-width:12em}
#taxTable td:last-child,#taxTable th:last-child{min-width:14em}
.split{display:flex;height:34px;border-radius:5px;overflow:hidden;margin:12px 0 8px;border:1px solid var(--line)}
.split > span{display:flex;align-items:center;justify-content:center;font-size:.8rem;font-weight:600;color:#fff;min-width:0;overflow:hidden;white-space:nowrap;transition:flex-grow .4s ease}
.splitkey{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
@media (max-width:640px){.splitkey{grid-template-columns:1fr}}
.splitkey div{font-size:.9rem}
.splitkey b{display:block;font-family:var(--cond);font-stretch:condensed;font-size:1.6rem}
details{border-top:1px solid var(--line);padding-top:10px;margin-top:10px}
summary{cursor:pointer;font-weight:600;color:var(--navy)}
.prose{max-width:72ch}
.prose h3{font-family:var(--cond);font-stretch:condensed;font-size:1.25rem;margin:18px 0 4px;color:var(--navy)}
.prose ul{padding-left:20px}
.prose li{margin:4px 0}
footer{border-top:1px solid var(--line);padding:18px 0 40px;color:var(--muted);font-size:.85rem}
footer p{max-width:80ch}
input[type=file]{display:none}
/* Overlays (setup + bank import) */
.overlay{position:fixed;inset:0;background:rgba(23,33,43,.72);display:flex;align-items:center;justify-content:center;padding:16px;z-index:50}
.sheet{background:var(--panel);border-radius:12px;width:min(640px,100%);max-height:calc(100vh - 32px);overflow:auto;box-shadow:0 20px 60px rgba(0,0,0,.35);position:relative}
.sheet-top{height:6px;background:var(--yellow);border-radius:12px 12px 0 0;overflow:hidden}
.sheet-top i{display:block;height:100%;background:var(--navy);transition:width .35s ease}
.sheet-body{padding:24px 26px 22px}
@media (max-width:520px){.sheet-body{padding:20px 18px}}
.step-count{font-size:.85rem;color:var(--muted);margin:0 0 6px}
.q{font-family:var(--cond);font-stretch:condensed;font-weight:800;font-size:clamp(1.8rem,5vw,2.4rem);line-height:1.05;margin:0 0 8px;color:var(--navy)}
.sheet-body .q{padding-right:30px}
.qsub{margin:0 0 18px;color:var(--muted);max-width:52ch}
.step{animation:slidein .3s ease both}
@keyframes slidein{from{opacity:0;transform:translateX(18px)}to{opacity:1;transform:none}}
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
.tile{border:2px solid var(--line);background:#fff;border-radius:10px;padding:14px 12px;cursor:pointer;text-align:left;display:flex;flex-direction:column;gap:6px;font-weight:700;font-size:1.02rem;transition:border-color .15s,background .15s}
.tile small{font-weight:400;font-size:.82rem;color:var(--muted)}
.tile svg{width:34px;height:34px;color:var(--navy)}
.tile:hover{border-color:var(--navy-2)}
.tile[aria-pressed=true]{border-color:var(--navy);background:#E9F0F6;box-shadow:inset 0 0 0 1px var(--navy)}
.big-money{position:relative;max-width:340px}
.big-money::before{content:"$";position:absolute;left:14px;top:50%;transform:translateY(-50%);font-size:1.6rem;color:var(--muted);font-weight:700}
.big-money input{width:100%;font-size:1.9rem;font-weight:700;padding:10px 14px 10px 36px;border:2px solid #AEB6AD;border-radius:10px;font-variant-numeric:tabular-nums}
.quick{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.quick button{border:1.5px solid var(--line);background:#fff;border-radius:999px;padding:6px 12px;cursor:pointer;font-weight:600}
.quick button:hover{border-color:var(--navy)}
.slider{width:100%;accent-color:var(--navy);height:28px}
.slider-out{font-family:var(--cond);font-stretch:condensed;font-weight:800;font-size:3rem;line-height:1;color:var(--navy)}
.example{background:#F4F6F3;border-radius:8px;padding:10px 14px;margin-top:12px;font-size:.95rem}
.sheet-foot{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:24px}
.sbtn{border:0;border-radius:8px;padding:12px 20px;font-weight:700;cursor:pointer;font-size:1rem}
.sbtn.go{background:var(--navy);color:#fff}
.sbtn.go:hover{background:var(--navy-2)}
.sbtn.ghost{background:none;color:var(--navy);border:1.5px solid var(--line)}
.sbtn.yellow{background:var(--yellow);color:var(--ink)}
.close-x{position:absolute;top:14px;right:12px;background:none;border:0;font-size:1.6rem;line-height:1;cursor:pointer;color:var(--muted);padding:4px 8px}
.welcome-btns{display:flex;flex-direction:column;gap:10px;margin-top:20px;max-width:360px}
.welcome-btns .sbtn{text-align:left}
.building{list-style:none;padding:0;margin:18px 0 0;font-size:1.1rem}
.building li{display:flex;align-items:center;gap:10px;margin:12px 0;opacity:.35;transition:opacity .3s}
.building li.on{opacity:1}
.building .tick{width:26px;height:26px;border-radius:50%;border:2px solid var(--line);display:inline-flex;align-items:center;justify-content:center;font-size:.9rem;color:#fff;transition:background .3s,border-color .3s}
.building li.done .tick{background:var(--green);border-color:var(--green)}
.drop{border:2px dashed #9AA59B;border-radius:10px;padding:22px;text-align:center;cursor:pointer;background:#FAFBF9;transition:background .15s,border-color .15s}
.drop.over{background:#E9F0F6;border-color:var(--navy)}
.drop b{display:block;font-size:1.05rem;margin-bottom:4px}
.preview-bars{display:flex;align-items:flex-end;gap:4px;height:90px;margin:12px 0 4px}
.preview-bars div{flex:1;background:var(--navy);border-radius:3px 3px 0 0;min-height:2px;transition:height .5s ease}
.preview-labels{display:flex;gap:4px;font-size:.72rem;color:var(--muted)}
.preview-labels span{flex:1;text-align:center}
.found{font-size:.95rem;margin:10px 0}
.skipped{font-size:.85rem;color:var(--muted)}
@media print{
header.top .toolbar,.inputs,.notice,#loadError,.chips,.overlay{display:none !important}
main.wrap{display:block}
body{background:#fff}
section.card{break-inside:avoid;border:0;padding:8px 0}
}
@media (prefers-reduced-motion:reduce){
*,*::before,*::after{animation:none !important;transition:none !important}
}
</style>
</head>
<body>
<header class="top">
<div class="wrap">
<div class="brand">
<h1>Off-Season</h1>
<p>A cash and tax planner for Kentucky trades owners whose money comes in by the season, so the slow months and the IRS never catch you short.</p>
</div>
<div class="toolbar" role="toolbar" aria-label="Plan file">
<span id="saveStatus" class="status" aria-live="polite">Not saved yet</span>
<button class="btn" id="btnOpen" type="button">Open plan</button>
<button class="btn primary" id="btnSave" type="button">Save plan</button>
<button class="btn" id="btnReset" type="button">Start over</button>
<input type="file" id="fileInput" accept=".json,application/json">
</div>
</div>
</header>
<div class="wrap">
<p class="notice"><strong>For education only.</strong> This is not tax, legal, or financial advice. It estimates 2026 federal and Kentucky taxes with simplified rules. Check your numbers with a tax professional before you pay. Everything stays on your computer. Nothing is sent anywhere, including bank statements you load.</p>
<div id="loadError" class="alert" role="alert" hidden></div>
</div>
<main class="wrap">
<!-- INPUTS -->
<form class="inputs" id="form" autocomplete="off" onsubmit="return false">
<div class="inputs-head">
<h2>Your numbers</h2>
<button type="button" class="linkbtn" id="btnWizard">Walk me through it</button>
</div>
<fieldset>
<legend>Your season</legend>
<div class="field">
<label for="bizName">Business name <span class="hint" style="display:inline">(optional)</span></label>
<input type="text" id="bizName" maxlength="80" placeholder="e.g. Bluegrass Roofing">
</div>
<div class="row2">
<div class="field">
<label for="trade">Trade</label>
<select id="trade">
<option value="roofing">Roofing</option>
<option value="hvac">HVAC</option>
<option value="landscaping">Landscaping and lawn</option>
<option value="remodeling">Remodeling</option>
<option value="steady">Steady all year</option>
</select>
</div>
<div class="field">
<label for="annual">Money you'll collect this year</label>
<div class="money"><input type="number" id="annual" min="0" step="1000" inputmode="decimal"></div>
</div>
</div>
<div class="btnrow">
<button type="button" class="linkbtn" id="btnFill">Spread it across the months</button>
<button type="button" class="linkbtn" id="btnBank">Fill from my bank statement</button>
</div>
<span class="hint">Spreading uses a typical pattern for your trade. A bank statement uses your real deposits.</span>
<div class="field">
<span class="label" id="monthsLabel">Collected each month</span>
<div class="months" id="months" role="group" aria-labelledby="monthsLabel"></div>
<span class="hint">Total: <b id="monthsTotal" class="num">$0</b></span>
</div>
</fieldset>
<fieldset>
<legend>Your costs</legend>
<div class="field">
<label for="jobCost">Materials, subs, and job costs</label>
<div class="pct"><input type="number" id="jobCost" min="0" max="100" step="1" inputmode="decimal"></div>
<span class="hint">As a share of each job's price. Shingles, dumpsters, 1099 crews, fuel.</span>
</div>
<div class="field">
<label for="overhead">Fixed business bills each month</label>
<div class="money"><input type="number" id="overhead" min="0" step="50" inputmode="decimal"></div>
<span class="hint">Truck note, insurance, phone, software, storage. Paid even when there's no work.</span>
</div>
</fieldset>
<fieldset>
<legend>Your taxes</legend>
<div class="row2">
<div class="field">
<label for="filing">Filing status</label>
<select id="filing">
<option value="mfj">Married, joint</option>
<option value="single">Single</option>
<option value="hoh">Head of household</option>
</select>
</div>
<div class="field">
<label for="localRate">Local tax on profit</label>
<div class="pct"><input type="number" id="localRate" min="0" max="5" step="0.05" inputmode="decimal"></div>
</div>
</div>
<span class="hint">Lexington-Fayette charges 2.25% (city) plus 0.5% (schools) on business net profit. Kentucky counties charge from 0.5% to 2.5%; the most common rate is 1%. Check your own city and county.</span>
<div class="field">
<label for="lastYearTax">Last year's total federal tax <span class="hint" style="display:inline">(optional)</span></label>
<div class="money"><input type="number" id="lastYearTax" min="0" step="100" inputmode="decimal" placeholder="From line 24 of last year's 1040"></div>
<label class="check"><input type="checkbox" id="highIncome"> Last year's adjusted gross income was over $150,000</label>
<span class="hint">Used to show the least you can pay each quarter without an IRS penalty.</span>
</div>
</fieldset>
<fieldset>
<legend>Your cash</legend>
<div class="row2">
<div class="field">
<label for="startCash">Business checking on Jan 1</label>
<div class="money"><input type="number" id="startCash" min="0" step="500" inputmode="decimal"></div>
</div>
<div class="field">
<label for="startTax">Tax savings on Jan 1</label>
<div class="money"><input type="number" id="startTax" min="0" step="500" inputmode="decimal"></div>
</div>
</div>
<div class="row2">
<div class="field">
<label for="cushion">Never let checking drop below</label>
<div class="money"><input type="number" id="cushion" min="0" step="250" inputmode="decimal"></div>
</div>
<div class="field">
<label for="need">Your household needs each month</label>
<div class="money"><input type="number" id="need" min="0" step="100" inputmode="decimal"></div>
</div>
</div>
<span class="label">Your paycheck from the business</span>
<label class="radio"><input type="radio" name="drawMode" value="safe" id="drawSafe"> <span>Pay me the most I can take every month without dipping below my floor</span></label>
<label class="radio"><input type="radio" name="drawMode" value="custom" id="drawCustom"> <span>Pay me this much each month:</span></label>
<div class="field" style="margin-top:0">
<div class="money"><input type="number" id="customDraw" min="0" step="100" inputmode="decimal" aria-label="Monthly paycheck amount"></div>
</div>
</fieldset>
</form>
<!-- RESULTS -->
<div class="results">
<section class="card" id="answer" aria-live="polite">
<h2 id="answerTitle">Your year at a glance</h2>
<p class="sub">The three numbers to live by, worked out from your answers.</p>
<div class="ticket">
<div>
<div class="k">Put toward taxes from every payment</div>
<div class="v num" id="rRate">0%</div>
<div class="d" id="rRateD"></div>
</div>
<div>
<div class="k" id="rDrawK">Steady paycheck you can afford</div>
<div class="v num" id="rDraw">$0</div>
<div class="d" id="rDrawD"></div>
</div>
<div>
<div class="k">Tightest month</div>
<div class="v" id="rTight">None</div>
<div class="d" id="rTightD"></div>
</div>
</div>
<p class="verdict" id="verdict"></p>
</section>
<section class="card" id="nowCard">
<h2 id="nowTitle">Right now</h2>
<p class="sub">What to do this month, based on today's date.</p>
<div class="now">
<div class="countdown"><b class="num" id="nowDays">0</b><span id="nowDaysL">days until your next tax payment</span></div>
<ol id="nowList"></ol>
</div>
</section>
<section class="card">
<h2>Your season, month by month</h2>
<p class="sub">Bars show what's left in business checking at the end of each month, after job costs, bills, tax savings, tax payments, and your paycheck. Striped months fall below your floor.</p>
<span class="label" id="whatIfLabel">What if…</span>
<div class="chips" role="group" aria-labelledby="whatIfLabel" id="chips">
<button type="button" class="chip" data-w="wet" aria-pressed="false">It's a wet spring</button>
<button type="button" class="chip" data-w="lostJob" aria-pressed="false">You lose a big job</button>
<button type="button" class="chip" data-w="truck" aria-pressed="false">The truck breaks down</button>
<button type="button" class="chip" data-w="raise" aria-pressed="false">You raise prices 5%</button>
</div>
<p class="delta" id="delta" aria-live="polite"></p>
<div class="strip-wrap"><svg class="strip" id="strip" viewBox="0 0 960 330" role="img" aria-labelledby="stripTitle stripDesc"><title id="stripTitle">Month-end business checking balance</title><desc id="stripDesc"></desc></svg></div>
<div class="legend">
<span><span class="sw" style="background:#B8C3BA"></span>Money collected</span>
<span><span class="sw" style="background:var(--navy)"></span>Checking at month end</span>
<span><span class="sw" style="background:repeating-linear-gradient(135deg,var(--yellow) 0 4px,var(--ink) 4px 8px)"></span>Below your floor</span>
<span><span class="sw" style="background:var(--green);height:3px"></span>Tax savings account</span>
<span>▲ Estimated tax due</span>
</div>
<details>
<summary>See the month-by-month table</summary>
<div class="table-wrap"><table id="monthTable" class="num"></table></div>
</details>
</section>
<section class="card">
<h2>When a check comes in</h2>
<p class="sub">Type in a payment you just got. Here's where every dollar of it should go before you spend any.</p>
<div class="field" style="max-width:240px">
<label for="deposit">Payment amount</label>
<div class="money"><input type="number" id="deposit" min="0" step="100" inputmode="decimal"></div>
</div>
<div class="split" id="splitBar" aria-hidden="true"></div>
<div class="splitkey" id="splitKey"></div>
</section>
<section class="card">
<h2>Your estimated tax payments</h2>
<p class="sub">Self-employed Kentuckians pay federal and state income tax four times a year. Here's what each payment looks like and whether your tax savings will cover it.</p>
<div class="table-wrap"><table id="payTable" class="num"></table></div>
<p class="verdict" id="payNote"></p>
</section>
<section class="card">
<h2>Where the tax money goes</h2>
<p class="sub" id="taxIntro"></p>
<div class="table-wrap"><table id="taxTable" class="num"></table></div>
<details>
<summary>How the math works, and what it leaves out</summary>
<div class="prose">
<h3>Steps</h3>
<ul>
<li><b>Profit</b> = money collected − job costs − fixed bills − any one-time costs, added up for the year.</li>
<li><b>Self-employment tax</b> = 15.3% of (profit × 92.35%). The 12.4% Social Security part stops at $184,500 of earnings in 2026. An extra 0.9% Medicare tax applies above $200,000 ($250,000 joint).</li>
<li><b>Adjusted gross income</b> = profit − half of self-employment tax.</li>
<li><b>Federal income tax</b>: subtract the 2026 standard deduction ($16,100 single, $32,200 joint, $24,150 head of household). Then subtract the 20% qualified business income deduction, and run what's left through the 2026 brackets.</li>
<li><b>Kentucky income tax</b> = 3.5% of (adjusted gross income − $3,360). Kentucky has no business-income deduction.</li>
<li><b>Local tax</b> = your local rate × profit.</li>
<li><b>Share of every payment</b> = total yearly tax ÷ money collected for the year. Setting aside that share of every check fills the tax savings account by the time each bill is due.</li>
<li><b>Steady paycheck</b> = the largest monthly amount (to the nearest $50) that keeps checking at or above your floor at the end of every month.</li>
<li><b>Quarterly payments</b> = one quarter of projected federal tax and one quarter of Kentucky tax, due April 15, June 15, September 15, and January 15. If tax savings are short on a due date, the gap comes out of checking.</li>
<li><b>What-ifs</b>: a wet spring cuts April and May collections by 30%. Losing a big job removes 10% of the year's collections from your busiest month, along with its job costs. A truck breakdown adds a $4,000 one-time repair in February, when cash is thinnest. Raising prices 5% lifts every payment 5% while job costs stay the same in dollars.</li>
<li><b>Bank statement import</b> adds up money coming in by month for the latest 12 months in the file. It skips lines that look like transfers, loans, refunds, or interest. Nothing leaves your computer.</li>
</ul>
<h3>What it leaves out</h3>
<ul>
<li>Credits such as the Child Tax Credit. These lower your bill, so leaving them out means you set aside a little more than you'll owe.</li>
<li>A spouse's paycheck or other income, which could push you into a higher bracket.</li>
<li>Truck and equipment depreciation, self-employed health insurance, and retirement contributions. These can lower your tax.</li>
<li>The qualified business income deduction above $201,750 of taxable income ($403,500 joint). Above that, the deduction depends on wages and equipment, so this tool leaves it out.</li>
<li>S-corporation pay. It assumes a sole proprietor or single-member LLC.</li>
<li>The annualized income method. If most of your income comes late in the year, IRS Form 2210 Schedule AI may let you pay less in April and June. Ask a tax professional.</li>
</ul>
<h3>Sources</h3>
<ul>
<li>IRS Revenue Procedure 2025-32: 2026 brackets, standard deduction, and qualified business income thresholds.</li>
<li>Social Security Administration: 2026 wage base of $184,500.</li>
<li>Kentucky Department of Revenue: 3.5% rate and $3,360 standard deduction for 2026.</li>
<li>Lexington-Fayette Urban County Government (2.25%) and Fayette County Public Schools (0.5%): occupational tax on net profits.</li>
<li>Kentucky Association of Counties, 2026 data brief: county occupational tax rates range from 0.5% to 2.5%, with a median of 1%.</li>
</ul>
</div>
</details>
</section>
</div>
</main>
<footer>
<div class="wrap">
<p><strong>Educational use only.</strong> Off-Season is a learning tool, not tax, legal, or investment advice, and it doesn't recommend any investment. It uses 2026 rules as published by the IRS, the Social Security Administration, the Kentucky Department of Revenue, and Lexington-Fayette. Rules change, and your situation may differ. Confirm with a tax professional before making payments.</p>
<p>Built by Ashley Butts for the Kentucky PFM Challenge. Released under the MIT License. No outside code, services, or tracking. Everything runs in this page.</p>
</div>
</footer>
<!-- Guided setup -->
<div class="overlay" id="wiz" role="dialog" aria-modal="true" aria-labelledby="wizQ" hidden>
<div class="sheet">
<div class="sheet-top"><i id="wizBar" style="width:0"></i></div>
<button class="close-x" id="wizClose" type="button" aria-label="Close setup">×</button>
<div class="sheet-body" id="wizBody"></div>
</div>
</div>
<!-- Bank statement import -->
<div class="overlay" id="bank" role="dialog" aria-modal="true" aria-labelledby="bankQ" hidden>
<div class="sheet">
<div class="sheet-top"><i style="width:100%"></i></div>
<button class="close-x" id="bankClose" type="button" aria-label="Close bank statement import">×</button>
<div class="sheet-body">
<h2 class="q" id="bankQ">Load a bank statement</h2>
<p class="qsub">Download last year's business checking activity from your bank's website as a CSV file, then drop it here. Off-Season adds up what customers paid you each month. The file never leaves your computer.</p>
<div class="drop" id="drop" tabindex="0" role="button" aria-describedby="dropHint">
<b>Drop your CSV file here</b>
<span id="dropHint">or click to pick it from your computer</span>
</div>
<input type="file" id="csvInput" accept=".csv,text/csv,text/plain">
<p style="margin:10px 0 0"><button type="button" class="linkbtn" id="btnSample">No file handy? Try a sample statement</button></p>
<label class="check"><input type="checkbox" id="skipXfer" checked> Skip transfers, loans, refunds, and interest</label>
<div id="bankResult" aria-live="polite"></div>
<div class="sheet-foot">
<button type="button" class="sbtn ghost" id="bankCancel">Cancel</button>
<button type="button" class="sbtn go" id="bankUse" disabled>Use these numbers</button>
</div>
</div>
</div>
</div>
<script>
"use strict";
/* ---------- 2026 tax constants (update yearly) ---------- */
const TAX = {
year: 2026,
std: { single: 16100, mfj: 32200, hoh: 24150 },
brackets: {
single: [[12400,.10],[50400,.12],[105700,.22],[201775,.24],[256225,.32],[640600,.35],[Infinity,.37]],
mfj: [[24800,.10],[100800,.12],[211400,.22],[403550,.24],[512450,.32],[768700,.35],[Infinity,.37]],
hoh: [[17700,.10],[67450,.12],[105700,.22],[201750,.24],[256200,.32],[640600,.35],[Infinity,.37]]
},
ssWageBase: 184500,
addlMedicare: { single: 200000, mfj: 250000, hoh: 200000 },
qbiThreshold: { single: 201750, mfj: 403500, hoh: 201750 },
kyRate: 0.035,
kyStd: 3360
};
const MONTHS = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
const MONTHS_LONG = ["January","February","March","April","May","June","July","August","September","October","November","December"];
/* Typical share of the year's collections by month (each sums to 100). Illustrative; users should replace with their own books. */
const PATTERNS = {
roofing: [3,3,6,9,11,11,11,11,11,10,8,6],
hvac: [10,8,6,6,8,11,13,12,8,6,6,6],
landscaping: [1,2,7,12,14,13,11,11,10,9,6,4],
remodeling: [6,6,8,9,10,10,9,9,9,9,8,7],
steady: [8.34,8.33,8.33,8.34,8.33,8.33,8.34,8.33,8.33,8.34,8.33,8.33]
};
const TRADE_NAMES = {roofing:"Roofing", hvac:"HVAC", landscaping:"Landscaping and lawn", remodeling:"Remodeling", steady:"Steady all year"};
/* Quarterly estimated tax due dates. m is the 0-based month in the plan year; the 4th is Jan 15 of next year. */
const DUE = [{m:3,day:15,label:"Apr 15"},{m:5,day:15,label:"Jun 15"},{m:8,day:15,label:"Sep 15"},{m:12,day:15,label:"Jan 15 (next year)"}];
const WHATIFS = {
wet: "It's a wet spring",
lostJob: "You lose a big job",
truck: "The truck breaks down",
raise: "You raise prices 5%"
};
const APP_ID = "off-season-planner";
const FILE_VERSION = 1;
function defaults(){
const annual = 220000;
return {
bizName: "", trade: "roofing", annual,
months: spread(annual, "roofing"),
jobCost: 50, overhead: 2800,
filing: "mfj", localRate: 2.75, lastYearTax: null, highIncome: false,
startCash: 15000, startTax: 0, cushion: 2500, need: 5500,
drawMode: "safe", customDraw: 5000, deposit: 12000,
whatIf: {wet:false, lostJob:false, truck:false, raise:false}
};
}
function spread(annual, trade){
const p = PATTERNS[trade] || PATTERNS.steady;
const raw = p.map(x => Math.round(annual * x / 100 / 50) * 50);
const diff = Math.round(annual) - raw.reduce((a,b)=>a+b,0);
const iMax = raw.indexOf(Math.max(...raw));
raw[iMax] += diff; // keep the total exact
return raw.map(v => Math.max(0, v));
}
/* ---------- Tax engine ---------- */
function bracketTax(ti, br){
let tax = 0, prev = 0;
for (const [top, rate] of br){
if (ti > prev) tax += (Math.min(ti, top) - prev) * rate;
if (ti <= top) break;
prev = top;
}
return tax;
}
function calcTax(profit, filing, localRatePct){
const z = {profit, seBase:0, ss:0, medicare:0, se:0, addl:0, halfSE:0, agi:0, std:TAX.std[filing],
tiBeforeQbi:0, qbi:0, qbiApplied:true, ti:0, fedIncome:0, fedTotal:0, ky:0, local:0, total:0};
if (!(profit > 0)) return z;
const seBase = profit * 0.9235;
if (seBase >= 400){
z.seBase = seBase;
z.ss = 0.124 * Math.min(seBase, TAX.ssWageBase);
z.medicare = 0.029 * seBase;
z.se = z.ss + z.medicare;
z.addl = 0.009 * Math.max(0, seBase - TAX.addlMedicare[filing]);
}
z.halfSE = z.se / 2;
z.agi = profit - z.halfSE;
z.tiBeforeQbi = Math.max(0, z.agi - z.std);
if (z.tiBeforeQbi <= TAX.qbiThreshold[filing]){
z.qbi = 0.2 * Math.min(Math.max(0, profit - z.halfSE), z.tiBeforeQbi);
} else { z.qbi = 0; z.qbiApplied = false; }
z.ti = z.tiBeforeQbi - z.qbi;
z.fedIncome = bracketTax(z.ti, TAX.brackets[filing]);
z.fedTotal = z.fedIncome + z.se + z.addl;
z.ky = TAX.kyRate * Math.max(0, z.agi - TAX.kyStd);
z.local = profit * (localRatePct / 100);
z.total = z.fedTotal + z.ky + z.local;
return z;
}
/* ---------- The year as it would play out, with any what-ifs applied ---------- */
function buildYear(s, w){
w = w || {};
const base = s.months.slice();
const rev = base.slice();
const jc = base.map(r => r * s.jobCost / 100);
const extra = new Array(12).fill(0);
if (w.wet){ for (const m of [3,4]){ rev[m] *= 0.7; jc[m] *= 0.7; } }
if (w.lostJob){
const total = base.reduce((a,b)=>a+b,0);
const peak = rev.indexOf(Math.max(...rev));
const cut = Math.min(rev[peak], total * 0.10);
if (rev[peak] > 0){ jc[peak] -= jc[peak] * cut / rev[peak]; }
rev[peak] -= cut;
}
if (w.truck){ extra[1] += 4000; }
if (w.raise){ for (let m = 0; m < 12; m++) rev[m] *= 1.05; } // job costs stay the same in dollars
const collected = rev.reduce((a,b)=>a+b,0);
const profit = rev.reduce((a,r,m)=> a + r - jc[m] - s.overhead - extra[m], 0);
return {rev, jc, extra, collected, profit};
}
/* ---------- Cash-flow simulation ---------- */
function simulate(s, yr, tax, draw){
const rate = yr.collected > 0 ? tax.total / yr.collected : 0;
const fedQ = tax.fedTotal / 4, kyQ = tax.ky / 4;
let op = s.startCash, tx = s.startTax;
const rows = [];
for (let m = 0; m < 12; m++){
const rev = yr.rev[m];
const jobCosts = yr.jc[m];
const setAside = rev * rate;
tx += setAside;
let taxPaid = 0, fromChecking = 0;
if (DUE.some(d => d.m === m)){
const due = fedQ + kyQ;
taxPaid = due;
if (tx >= due) tx -= due;
else { fromChecking = due - tx; tx = 0; }
}
op += rev - jobCosts - s.overhead - yr.extra[m] - setAside - draw - fromChecking;
rows.push({m, rev, jobCosts, overhead:s.overhead + yr.extra[m], setAside, taxPaid, fromChecking, draw, op, tx});
}
const minRow = rows.reduce((a,b)=> b.op < a.op ? b : a, rows[0]);
return {rows, rate, fedQ, kyQ, min: minRow.op, minMonth: minRow.m, endOp: op, endTx: tx};
}
function safeDraw(s, yr, tax){
if (simulate(s, yr, tax, 0).min < s.cushion) return 0;
let lo = 0, hi = Math.max(1000, yr.collected + s.startCash);
for (let i = 0; i < 60; i++){
const mid = (lo + hi) / 2;
if (simulate(s, yr, tax, mid).min >= s.cushion) lo = mid; else hi = mid;
}
return Math.floor(lo / 50) * 50;
}
function plan(s, w){
const yr = buildYear(s, w);
const tax = calcTax(yr.profit, s.filing, s.localRate);
const safe = safeDraw(s, yr, tax);
const draw = s.drawMode === "custom" ? s.customDraw : safe;
const sim = simulate(s, yr, tax, draw);
return {yr, tax, safe, draw, sim};
}
/* ---------- Bank statement (CSV) reading ---------- */
function parseCSV(text){
const rows = []; let row = [], cell = "", q = false;
text = text.replace(/^/, "");
for (let i = 0; i < text.length; i++){
const c = text[i];
if (q){
if (c === '"'){ if (text[i+1] === '"'){ cell += '"'; i++; } else q = false; }
else cell += c;
} else if (c === '"') q = true;
else if (c === ",") { row.push(cell); cell = ""; }
else if (c === "\n" || c === "\r"){
if (c === "\r" && text[i+1] === "\n") i++;
row.push(cell); cell = "";
if (row.some(x => x.trim() !== "")) rows.push(row);
row = [];
} else cell += c;
}
row.push(cell);
if (row.some(x => x.trim() !== "")) rows.push(row);
return rows;
}
function parseDate(t){
t = String(t).trim();
let m = t.match(/^(\d{4})-(\d{1,2})-(\d{1,2})/);
if (m) return {y:+m[1], m:+m[2]-1};
m = t.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2,4})/);
if (m){ let y = +m[3]; if (y < 100) y += 2000; return {y, m:+m[1]-1}; }
return null;
}
function parseAmount(t){
let s = String(t).trim();
if (!s) return NaN;
let neg = false;
if (/^\(.*\)$/.test(s)){ neg = true; s = s.slice(1,-1); }
s = s.replace(/[$,\s]/g, "");
if (/^-/.test(s)){ neg = true; s = s.slice(1); }
if (/^\+/.test(s)) s = s.slice(1);
if (!/^\d*\.?\d+$/.test(s)) return NaN;
const v = parseFloat(s);
return neg ? -v : v;
}
const SKIP_RE = /transfer|xfer|\btrf\b|loan|refund|reversal|returned|interest|owner contrib|from savings/i;
function readStatement(text, skipXfer){
const rows = parseCSV(text);
if (rows.length < 2) throw new Error("The file doesn't have enough rows to read.");
let hi = rows.findIndex(r => r.some(c => /date/i.test(c)));
if (hi < 0 || hi > 10) throw new Error("Couldn't find a Date column. Make sure the file has column names in the first row.");
const head = rows[hi].map(c => c.trim().toLowerCase());
const find = re => head.findIndex(h => re.test(h));
const dateCol = find(/date/);
const descCol = find(/desc|memo|payee|name|detail|narrative/);
const creditCol = find(/credit|deposit/);
const amountCol = find(/^amount$|amount/);
if (creditCol < 0 && amountCol < 0) throw new Error("Couldn't find an Amount, Credit, or Deposit column.");
const items = [], skipped = [];
for (const r of rows.slice(hi + 1)){
const d = parseDate(r[dateCol] || "");
if (!d) continue;
const amt = creditCol >= 0 ? parseAmount(r[creditCol]) : parseAmount(r[amountCol]);
if (!(amt > 0)) continue;
const desc = descCol >= 0 ? (r[descCol] || "").trim() : "";
if (skipXfer && SKIP_RE.test(desc)){ skipped.push({desc, amt}); continue; }
items.push({key: d.y * 12 + d.m, m: d.m, amt});
}
if (!items.length) throw new Error("No money coming in was found in the file.");
const last = Math.max(...items.map(i => i.key));
const months = new Array(12).fill(0), seen = new Array(12).fill(false);
let count = 0;
for (const it of items){
if (it.key > last - 12){ months[it.m] += it.amt; seen[it.m] = true; count++; }
}
const lastY = Math.floor(last / 12), lastM = last % 12;
return {months: months.map(v => Math.round(v)), seen, count, skipped,
coversMonths: seen.filter(Boolean).length, through: MONTHS_LONG[lastM] + " " + lastY};
}
function sampleStatement(){
// A made-up Lexington roofer's 2025 checking export, with transfers and a loan mixed in.
let seed = 7;
const rnd = () => (seed = (seed * 16807) % 2147483647) / 2147483647;
const names = ["Johnson","Patel","Wright","Carter","Nguyen","Hall","Brooks","Ellis","Ramirez","Turner","Coleman","Price"];
const jobs = ["roof replacement","storm repair","gutter install","shingle repair","insurance claim payment","leak repair"];
const lines = ["Date,Description,Amount"];
const p = PATTERNS.roofing;
for (let m = 0; m < 12; m++){
let target = Math.round(205000 * p[m] / 100 * (0.88 + rnd() * 0.24));
const n = 2 + Math.floor(p[m] / 2);
for (let k = 0; k < n; k++){
const amt = k === n - 1 ? target : Math.round(target / (n - k) * (0.6 + rnd() * 0.8));
target -= amt;
const day = 1 + Math.floor(rnd() * 27);
lines.push(`${m+1}/${day}/2025,"${names[Math.floor(rnd()*names.length)]} - ${jobs[Math.floor(rnd()*jobs.length)]}",${amt.toFixed(2)}`);
lines.push(`${m+1}/${Math.min(28, day+1)}/2025,ABC Supply materials,-${(amt*0.45).toFixed(2)}`);
}
lines.push(`${m+1}/28/2025,Truck payment,-685.00`);
if (m === 1 || m === 2) lines.push(`${m+1}/12/2025,Online transfer from savings,3000.00`);
}
lines.push(`3/3/2025,Equipment loan deposit,12000.00`);
return lines.join("\n");
}
/* ---------- State, dirty tracking ---------- */
let state = defaults();
let dirty = false;
function setDirty(v){
dirty = v;
const el = document.getElementById("saveStatus");
el.textContent = v ? "Unsaved changes" : (el.dataset.saved ? "Saved" : "Not saved yet");
el.classList.toggle("dirty", v);
}
window.addEventListener("beforeunload", e => { if (dirty){ e.preventDefault(); e.returnValue = ""; } });
/* ---------- Formatting + animation helpers ---------- */
const fmt = n => (n < 0 ? "−$" : "$") + Math.round(Math.abs(n)).toLocaleString("en-US");
const pct = (n, d=1) => (n*100).toFixed(d).replace(/\.0$/,"") + "%";
const $ = id => document.getElementById(id);
function esc(t){ return String(t).replace(/[&<>"']/g, c => ({"&":"&","<":"<",">":">",'"':""","'":"'"}[c])); }
const reduceMotion = () => window.matchMedia && matchMedia("(prefers-reduced-motion: reduce)").matches;
function countTo(el, to, format, ms){
const from = parseFloat(el.dataset.val || "0");
el.dataset.val = to;
if (reduceMotion() || !ms || from === to){ el.textContent = format(to); return; }
const t0 = performance.now();
const step = now => {
const k = Math.min(1, (now - t0) / ms), e = 1 - Math.pow(1 - k, 3);
el.textContent = format(from + (to - from) * e);
if (k < 1) requestAnimationFrame(step);
};
requestAnimationFrame(step);
}
/* ---------- Form <-> state ---------- */
function buildMonthInputs(){
$("months").innerHTML = MONTHS.map((m,i)=>
`<div><label for="m${i}">${m}</label><div class="money"><input type="number" id="m${i}" min="0" step="100" inputmode="decimal"></div></div>`).join("");
}
function num(id, min=0, max=Infinity){
const v = parseFloat($(id).value);
if (!isFinite(v)) return 0;
return Math.min(max, Math.max(min, v));
}
function readForm(){
state.bizName = $("bizName").value.slice(0,80);
state.trade = $("trade").value;
state.annual = num("annual");
state.months = MONTHS.map((_,i)=> num("m"+i));
state.jobCost = num("jobCost",0,100);
state.overhead = num("overhead");
state.filing = $("filing").value;
state.localRate = num("localRate",0,5);
const ly = $("lastYearTax").value.trim();
state.lastYearTax = ly === "" ? null : num("lastYearTax");
state.highIncome = $("highIncome").checked;
state.startCash = num("startCash");
state.startTax = num("startTax");
state.cushion = num("cushion");
state.need = num("need");
state.drawMode = $("drawCustom").checked ? "custom" : "safe";
state.customDraw = num("customDraw");
state.deposit = num("deposit");
}
function writeForm(){
$("bizName").value = state.bizName;
$("trade").value = state.trade;
$("annual").value = state.annual;
state.months.forEach((v,i)=> $("m"+i).value = v);
$("jobCost").value = state.jobCost;
$("overhead").value = state.overhead;
$("filing").value = state.filing;
$("localRate").value = state.localRate;
$("lastYearTax").value = state.lastYearTax == null ? "" : state.lastYearTax;
$("highIncome").checked = !!state.highIncome;
$("startCash").value = state.startCash;
$("startTax").value = state.startTax;
$("cushion").value = state.cushion;
$("need").value = state.need;
$("drawSafe").checked = state.drawMode !== "custom";
$("drawCustom").checked = state.drawMode === "custom";
$("customDraw").value = state.customDraw;
$("deposit").value = state.deposit;
document.querySelectorAll(".chip").forEach(c => c.setAttribute("aria-pressed", state.whatIf[c.dataset.w] ? "true" : "false"));
}
/* ---------- Render ---------- */
function render(opts){
const animate = !!(opts && opts.animate);
const s = state;
$("monthsTotal").textContent = fmt(s.months.reduce((a,b)=>a+b,0));
const P = plan(s, s.whatIf);
const {yr, tax, safe, draw, sim} = P;
const profit = yr.profit, collected = yr.collected;
const needSim = simulate(s, yr, tax, s.need);
const reserveForNeed = Math.max(0, s.cushion - needSim.min);
$("answerTitle").textContent = s.bizName ? s.bizName + ": your year at a glance" : "Your year at a glance";
const ms = animate ? 900 : 0;
countTo($("rRate"), collected > 0 ? sim.rate * 100 : 0, v => v.toFixed(1).replace(/\.0$/,"") + "%", ms);
$("rRateD").textContent = profit > 0
? `That's ${fmt(tax.total)} of estimated tax on ${fmt(profit)} of profit. Move it to a separate savings account the day you're paid.`
: "No profit projected, so no income tax is projected.";
countTo($("rDraw"), draw, fmt, ms);
if (s.drawMode === "custom"){
$("rDrawK").textContent = "Your chosen monthly paycheck";
$("rDrawD").innerHTML = draw > safe
? `<span class="bad">More than the ${fmt(safe)} your checking can support every month.</span>`
: `Within the ${fmt(safe)} your checking can support every month.`;
} else {
$("rDrawK").textContent = "Steady paycheck you can afford";
$("rDrawD").textContent = "Every month, the slow ones included, without checking dropping below " + fmt(s.cushion) + ".";
}
const belowMonths = sim.rows.filter(r => r.op < s.cushion);
$("rTight").textContent = MONTHS_LONG[sim.minMonth];
$("rTightD").innerHTML = sim.min < 0
? `<span class="bad">Checking goes ${fmt(sim.min)} (overdrawn).</span>`
: sim.min < s.cushion
? `<span class="bad">Checking falls to ${fmt(sim.min)}, under your ${fmt(s.cushion)} floor.</span>`
: `Checking bottoms out at ${fmt(sim.min)}.`;
let v = "";
if (profit <= 0){
v = `<strong class="bad">On these numbers the business loses ${fmt(-profit)} this year.</strong> Before planning a paycheck, look at pricing, job costs, or fixed bills.`;
} else if (safe === 0){
v = `<strong class="bad">Even with no paycheck, checking drops below ${fmt(s.cushion)} in ${MONTHS_LONG[simulate(s,yr,tax,0).minMonth]}.</strong> You'd need more cash on hand on January 1, or a line of credit lined up before the slow months.`;
} else if (s.need > safe){
v = `Your household needs ${fmt(s.need)} a month. <strong class="bad">That's ${fmt(s.need - safe)} more than the business can pay steadily.</strong> To cover it every month, start January with about <strong>${fmt(reserveForNeed)}</strong> more in checking. Think of it as next winter's paycheck, saved during the busy season. Or trim fixed bills, or raise prices on peak-season jobs.`;
} else {
v = `<strong class="good">The business can cover the ${fmt(s.need)} your household needs every month</strong>, with ${fmt(safe - s.need)} of room. Anything above your paycheck that piles up by December is next winter's reserve.`;
}
if (s.drawMode === "custom" && belowMonths.length){
v += ` With a ${fmt(draw)} paycheck, checking dips below your floor in <strong>${belowMonths.map(r=>MONTHS_LONG[r.m]).join(", ")}</strong>.`;
}
v += ` You'd end December with ${fmt(sim.endOp)} in checking and ${fmt(sim.endTx)} in tax savings for the January 15 payment and your local tax return.`;
$("verdict").innerHTML = v;
renderDelta(s, P);
renderNow(s, P);
renderStrip(s, sim, animate);
renderMonthTable(s, sim);
renderSplit(s, tax, collected);
renderPayments(s, tax, sim);
renderTaxTable(s, tax, collected);
}
function renderDelta(s, P){
const on = Object.keys(WHATIFS).filter(k => s.whatIf[k]);
if (!on.length){ $("delta").innerHTML = "Tap a button to see how a surprise would change your year. Tap it again to undo."; return; }
const B = plan(s, {});
const cls = (a, b) => a < b ? "bad" : "good";
const parts = [];
if (s.drawMode === "custom"){
if (Math.round(P.sim.min) !== Math.round(B.sim.min)) parts.push(`Lowest checking balance: ${fmt(B.sim.min)} → <strong class="${cls(P.sim.min, B.sim.min)}">${fmt(P.sim.min)}</strong>`);
} else if (P.safe !== B.safe){
parts.push(`Steady paycheck: ${fmt(B.safe)} → <strong class="${cls(P.safe, B.safe)}">${fmt(P.safe)}</strong> a month`);
}
// Year-end cash on the same paycheck isolates the surprise's real cost.
const endB = B.sim.endOp + B.sim.endTx, endP = simulate(s, P.yr, P.tax, B.draw);
const endPt = endP.endOp + endP.endTx;
if (Math.round(endPt) !== Math.round(endB)) parts.push(`${parts.length ? "money" : "Money"} left in December on the same paycheck: ${fmt(endB)} → <strong class="${cls(endPt, endB)}">${fmt(endPt)}</strong>`);
if (Math.round(P.tax.total) !== Math.round(B.tax.total)) parts.push(`yearly tax: ${fmt(B.tax.total)} → ${fmt(P.tax.total)}`);
$("delta").innerHTML = parts.length ? parts.join("; ") + "." : "That doesn't change your year.";
}
function nextDue(today){
const y = today.getFullYear();
const cands = [];
for (const yy of [y, y+1]) for (const d of DUE.slice(0,3)) cands.push({date:new Date(yy, d.m, d.day), d});
for (const yy of [y, y+1]) cands.push({date:new Date(yy, 0, 15), d:DUE[3]});
const t0 = new Date(today.getFullYear(), today.getMonth(), today.getDate());
return cands.filter(c => c.date >= t0).sort((a,b)=>a.date-b.date)[0];
}
function renderNow(s, P){
const today = new Date();
const m = today.getMonth();
const {yr, sim} = P;
const row = sim.rows[m];
const nd = nextDue(today);
const t0 = new Date(today.getFullYear(), today.getMonth(), today.getDate());
const days = Math.round((nd.date - t0) / 86400000);
const due = sim.fedQ + sim.kyQ;
$("nowTitle").textContent = `Right now: ${MONTHS_LONG[m]}`;
$("nowDays").textContent = days;
$("nowDaysL").textContent = days === 1 ? "day until your next tax payment" : "days until your next tax payment";
const dateTxt = nd.date.toLocaleDateString("en-US", {month:"long", day:"numeric", year:"numeric"});
const items = [];
items.push(`Expect about <strong>${fmt(yr.rev[m])}</strong> from customers this month${m === sim.minMonth ? ", and this is your tightest month, so hold off on extra spending" : ""}.`);
items.push(`Move <strong>${fmt(row.setAside)}</strong> of it to tax savings (${pct(sim.rate)} of each payment).`);
items.push(`Pay yourself <strong>${fmt(P.draw)}</strong>.`);
items.push(`Next tax payment: <strong>${fmt(due)}</strong> (${fmt(sim.fedQ)} IRS + ${fmt(sim.kyQ)} Kentucky) on ${dateTxt}.`);
$("nowList").innerHTML = items.map(t => `<li>${t}</li>`).join("");
}
function renderStrip(s, sim, animate){
const W = 960, H = 330, padL = 64, padR = 12, top = 18, revH = 70, gap = 26, balTop = top + revH + gap, balH = 170;
const colW = (W - padL - padR) / 12;
const maxRev = Math.max(1, ...sim.rows.map(r=>r.rev));
const bals = sim.rows.map(r=>r.op).concat(sim.rows.map(r=>r.tx), [s.cushion, 0]);
const hiB = Math.max(...bals), loB = Math.min(...bals);
const span = Math.max(1, hiB - loB);
const y = v => balTop + (hiB - v) / span * balH;
let g = `<defs><pattern id="caution" width="10" height="10" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="10" height="10" fill="#F5B800"/><rect width="5" height="10" fill="#17212B"/></pattern></defs>`;
g += `<text x="${padL-8}" y="${top+10}" text-anchor="end" font-size="12" fill="#55606B">Collected</text>`;
g += `<text x="${padL-8}" y="${balTop+10}" text-anchor="end" font-size="12" fill="#55606B">Checking</text>`;
g += `<line x1="${padL}" x2="${W-padR}" y1="${y(0)}" y2="${y(0)}" stroke="#17212B" stroke-width="1"/>`;
g += `<text x="${padL-8}" y="${y(0)+4}" text-anchor="end" font-size="11" fill="#55606B">$0</text>`;
if (s.cushion > 0){
g += `<line x1="${padL}" x2="${W-padR}" y1="${y(s.cushion)}" y2="${y(s.cushion)}" stroke="#B3261E" stroke-dasharray="5 4" stroke-width="1.5"/>`;
g += `<text x="${padL-8}" y="${y(s.cushion)+4}" text-anchor="end" font-size="11" fill="#B3261E">Floor</text>`;
}
const txPts = [];
sim.rows.forEach((r,i)=>{
const x = padL + i*colW, cx = x + colW/2, bw = colW*0.56;
const delay = animate ? `style="animation-delay:${i*45}ms"` : "";
const rh = r.rev / maxRev * revH;
g += `<rect class="bar" ${delay} x="${cx-bw/2}" y="${top+revH-rh}" width="${bw}" height="${rh}" fill="#B8C3BA"><title>${MONTHS_LONG[i]}: ${fmt(r.rev)} collected</title></rect>`;
const below = r.op < s.cushion;
const y0 = y(0), y1 = y(r.op);
const by = Math.min(y0,y1), bh = Math.max(2, Math.abs(y1-y0));
g += `<rect class="bar${r.op < 0 ? " neg" : ""}" ${delay} x="${cx-bw/2}" y="${by}" width="${bw}" height="${bh}" fill="${below ? "url(#caution)" : "#1E3A52"}" ${below ? 'stroke="#17212B" stroke-width="1"' : ""}><title>${MONTHS_LONG[i]}: ${fmt(r.op)} in checking at month end${below ? " (below your floor)" : ""}</title></rect>`;
const ly = r.op >= 0 ? by - 5 : by + bh + 13;
g += `<text x="${cx}" y="${ly}" text-anchor="middle" font-size="11" font-weight="600" fill="${below ? "#B3261E" : "#17212B"}">${shortMoney(r.op)}</text>`;
txPts.push(`${cx},${y(r.tx)}`);
g += `<text x="${cx}" y="${H-8}" text-anchor="middle" font-size="13" font-weight="600" fill="#17212B">${MONTHS[i]}</text>`;
if (DUE.some(d=>d.m===i)) g += `<path d="M${cx-6},${H-26} l6,-9 l6,9 z" fill="#B3261E"><title>Estimated tax due ${DUE.find(d=>d.m===i).label}</title></path>`;
});
g += `<polyline class="txline" points="${txPts.join(" ")}" fill="none" stroke="#2E6B4F" stroke-width="3" stroke-linejoin="round"/>`;
const svg = $("strip");
svg.classList.remove("go");
svg.innerHTML = `<title id="stripTitle">Month-end business checking balance</title><desc id="stripDesc">${esc(sim.rows.map(r => `${MONTHS_LONG[r.m]}: collected ${fmt(r.rev)}, checking ${fmt(r.op)}`).join("; "))}</desc>` + g;
if (animate){ void svg.getBoundingClientRect(); svg.classList.add("go"); }
}
function shortMoney(v){
const a = Math.abs(v), sign = v < 0 ? "−" : "";
if (a >= 100000) return sign + "$" + Math.round(a/1000) + "k";
if (a >= 1000) return sign + "$" + (a/1000).toFixed(1).replace(/\.0$/,"") + "k";
return sign + "$" + Math.round(a);
}
function renderMonthTable(s, sim){
let h = `<thead><tr><th>Month</th><th>Collected</th><th>Job costs</th><th>Bills</th><th>To tax savings</th><th>Tax from checking</th><th>Your pay</th><th>Checking</th><th>Tax savings</th></tr></thead><tbody>`;
const t = {rev:0,jc:0,oh:0,sa:0,fc:0,dr:0};
sim.rows.forEach(r=>{
const cls = r.op < 0 ? "over" : r.op < s.cushion ? "tight" : "";
h += `<tr class="${cls}"><td>${MONTHS_LONG[r.m]}</td><td>${fmt(r.rev)}</td><td>${fmt(r.jobCosts)}</td><td>${fmt(r.overhead)}</td><td>${fmt(r.setAside)}</td><td>${r.fromChecking ? fmt(r.fromChecking) : "—"}</td><td>${fmt(r.draw)}</td><td>${fmt(r.op)}</td><td>${fmt(r.tx)}</td></tr>`;
t.rev+=r.rev; t.jc+=r.jobCosts; t.oh+=r.overhead; t.sa+=r.setAside; t.fc+=r.fromChecking; t.dr+=r.draw;
});
h += `</tbody><tfoot><tr><td>Year</td><td>${fmt(t.rev)}</td><td>${fmt(t.jc)}</td><td>${fmt(t.oh)}</td><td>${fmt(t.sa)}</td><td>${t.fc ? fmt(t.fc) : "—"}</td><td>${fmt(t.dr)}</td><td>${fmt(sim.endOp)}</td><td>${fmt(sim.endTx)}</td></tr></tfoot>`;
$("monthTable").innerHTML = h;
}
function renderSplit(s, tax, collected){
const d = s.deposit;
const jc = d * s.jobCost / 100;
const tx = collected > 0 ? d * tax.total / collected : 0;
const rest = d - jc - tx;
const parts = [
{k:"Job costs", sub:"Pay the supplier and subs", v:jc, c:"#55606B"},
{k:"Tax savings", sub:"Move to tax savings today", v:tx, c:"#2E6B4F"},
{k:"Business checking", sub:"Fixed bills, then your paycheck", v:rest, c:"#1E3A52"}
];
const bar = $("splitBar");
if (bar.children.length !== 3) bar.innerHTML = parts.map(()=>`<span></span>`).join("");
parts.forEach((p,i)=>{
const el = bar.children[i];
el.style.flexGrow = d > 0 ? Math.max(0, p.v) : 0;
el.style.flexBasis = "0";
el.style.background = p.c;
el.textContent = d > 0 && p.v/d >= .12 ? pct(p.v/d,0) : "";
});
$("splitKey").innerHTML = parts.map(p => `<div><b class="num" style="color:${p.c}">${fmt(p.v)}</b>${p.k}<br><span class="hint" style="margin:0">${p.sub}</span></div>`).join("");
}
function renderPayments(s, tax, sim){
const fedQ = sim.fedQ, kyQ = sim.kyQ;
let h = `<thead><tr><th>Due</th><th>Federal (IRS)</th><th>Kentucky</th><th>Total</th><th>Covered by tax savings?</th></tr></thead><tbody>`;
let shortAny = false;
DUE.forEach(d=>{
let cov;
if (d.m < 12){
const r = sim.rows[d.m];
if (r.fromChecking > 0.5){ cov = `<span class="bad">Short ${fmt(r.fromChecking)}, taken from checking</span>`; shortAny = true; }
else cov = `<span class="good">Yes</span>`;
} else {
cov = sim.endTx >= fedQ + kyQ - 0.5 ? `<span class="good">Yes, held from December</span>` : `<span class="bad">Short ${fmt(fedQ + kyQ - sim.endTx)}</span>`;
}
h += `<tr><td>${d.label}</td><td>${fmt(fedQ)}</td><td>${fmt(kyQ)}</td><td>${fmt(fedQ+kyQ)}</td><td style="text-align:left">${cov}</td></tr>`;
});
h += `</tbody><tfoot><tr><td>Year</td><td>${fmt(tax.fedTotal)}</td><td>${fmt(tax.ky)}</td><td>${fmt(tax.fedTotal+tax.ky)}</td><td></td></tr></tfoot>`;
$("payTable").innerHTML = h;
let n = "";
if (s.lastYearTax != null){
const mult = s.highIncome ? 1.10 : 1.00;
const minReq = Math.min(0.9 * tax.fedTotal, s.lastYearTax * mult) / 4;
n += `<strong>Least you can pay the IRS each quarter and avoid an underpayment penalty: ${fmt(minReq)}.</strong> That's the smaller of 90% of this year's projected federal tax or ${s.highIncome ? "110%" : "100%"} of last year's. Paying only the minimum leaves a bigger bill in April. `;
} else {
n += `Add last year's federal tax on the left to see the smallest quarterly payment that avoids an IRS penalty. `;
}
if (shortAny){
n += `<span class="bad">Your slow season means tax savings can't cover every payment yet.</span> The shortfall comes out of checking, and that's already counted in your paycheck above. Since most of your money comes in later in the year, ask a tax professional about the annualized income method (IRS Form 2210, Schedule AI), which can lower the early payments. `;
}
n += `Local occupational tax (${fmt(tax.local)}) is paid with your city or county net-profits return, so it stays in tax savings until then.`;
$("payNote").innerHTML = n;
}
function renderTaxTable(s, tax, collected){
const fs = {mfj:"married filing jointly", single:"single", hoh:"head of household"}[s.filing];
$("taxIntro").textContent = tax.profit > 0
? `On ${fmt(tax.profit)} of profit, ${fs}, using 2026 rules.`
: `No profit is projected, so no income or self-employment tax is projected.`;
const rows = [
["Self-employment tax (Social Security and Medicare)", tax.se, "15.3% of profit × 92.35%"],
tax.addl > 0 ? ["Additional Medicare tax", tax.addl, "0.9% above the threshold"] : null,
["Federal income tax", tax.fedIncome, `After ${fmt(tax.std)} standard deduction` + (tax.qbiApplied ? ` and ${fmt(tax.qbi)} business-income deduction` : ` (business-income deduction not applied above the threshold)`)],
["Kentucky income tax", tax.ky, `3.5% after ${fmt(TAX.kyStd)} standard deduction`],
["Local occupational tax", tax.local, `${s.localRate}% of profit`]
].filter(Boolean);
let h = `<thead><tr><th>Tax</th><th>Amount</th><th>Share of profit</th><th style="text-align:left">How</th></tr></thead><tbody>`;
rows.forEach(r => h += `<tr><td>${r[0]}</td><td>${fmt(r[1])}</td><td>${tax.profit>0 ? pct(r[1]/tax.profit) : "—"}</td><td style="text-align:left;color:#55606B">${r[2]}</td></tr>`);
h += `</tbody><tfoot><tr><td>Total</td><td>${fmt(tax.total)}</td><td>${tax.profit>0 ? pct(tax.total/tax.profit) : "—"}</td><td style="text-align:left;font-weight:400;color:#55606B">${collected>0 ? pct(tax.total/collected) + " of every dollar collected" : ""}</td></tr></tfoot>`;
$("taxTable").innerHTML = h;
}
/* ---------- Overlays ---------- */
let lastFocus = null;
function openOverlay(id){
lastFocus = document.activeElement;
$(id).hidden = false;
document.body.classList.add("locked");
}
function closeOverlay(id){
$(id).hidden = true;
if ($("wiz").hidden && $("bank").hidden) document.body.classList.remove("locked");
if (lastFocus && lastFocus.focus) lastFocus.focus();
}
function trapFocus(e, id){
if (e.key !== "Tab") return;
const f = [...$(id).querySelectorAll("button:not([disabled]),input:not([type=file]),select,[tabindex='0']")].filter(x => x.offsetParent !== null);
if (!f.length) return;
const first = f[0], last = f[f.length-1];
if (e.shiftKey && document.activeElement === first){ e.preventDefault(); last.focus(); }
else if (!e.shiftKey && document.activeElement === last){ e.preventDefault(); first.focus(); }
}
/* ---------- Guided setup ---------- */
const ICONS = {
roofing: '<svg viewBox="0 0 32 32" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linejoin="round"><path d="M3 16 16 5l13 11"/><path d="M7 13v14h18V13"/><path d="M13 27v-7h6v7"/></svg>',
hvac: '<svg viewBox="0 0 32 32" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><circle cx="16" cy="16" r="3"/><path d="M16 13c0-5 1-8 4-8s3 5-4 8M19 16c5 0 8 1 8 4s-5 3-8-4M16 19c0 5-1 8-4 8s-3-5 4-8M13 16c-5 0-8-1-8-4s5-3 8 4"/></svg>',
landscaping: '<svg viewBox="0 0 32 32" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linejoin="round"><path d="M16 28V14"/><path d="M16 18C8 18 6 11 6 6c6 0 10 3 10 12zM16 15c0-6 3-9 10-9 0 5-3 9-10 9z"/></svg>',
remodeling: '<svg viewBox="0 0 32 32" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linejoin="round"><path d="M5 9h14l3 4H8z"/><path d="M13 13v14"/><path d="M19 9V5"/></svg>',
steady: '<svg viewBox="0 0 32 32" fill="none" stroke="currentColor" stroke-width="2.2"><rect x="5" y="7" width="22" height="20" rx="2"/><path d="M5 13h22M11 4v6M21 4v6"/></svg>'
};
const TRADE_SUB = {roofing:"Busy spring to fall, slow winters", hvac:"Peaks in summer and winter", landscaping:"Big spring, almost nothing in winter", remodeling:"Fairly even, dips in winter", steady:"About the same every month"};
let wizStep = 0, wizDraft = null;
const STEPS = ["welcome","trade","collect","jobcost","bills","need","cash","filing","local","build"];
function startWizard(){
wizDraft = JSON.parse(JSON.stringify(state));
wizDraft._monthsFromBank = false;
wizStep = 0;
openOverlay("wiz");
drawStep();
}
function moneyStep(q, sub, key, chips, extraHtml){
return `<p class="step-count"></p><h2 class="q" id="wizQ">${q}</h2><p class="qsub">${sub}</p>
<div class="big-money"><input type="number" id="wizIn" data-key="${key}" min="0" inputmode="decimal" value="${wizDraft[key]}" aria-labelledby="wizQ"></div>
<div class="quick">${chips.map(c=>`<button type="button" data-set="${c}">${fmt(c)}</button>`).join("")}</div>${extraHtml||""}`;
}
function drawStep(){
const name = STEPS[wizStep], d = wizDraft, body = $("wizBody");
const qCount = STEPS.length - 2;
$("wizBar").style.width = (wizStep / (STEPS.length - 1) * 100) + "%";
let h = "", nextLabel = "Next", showBack = wizStep > 1, showNext = true;
switch (name){
case "welcome":
h = `<h2 class="q" id="wizQ">Know what's yours to spend, even in February.</h2>
<p class="qsub">Answer 8 quick questions about your business. Off-Season will tell you how much of every check to save for taxes, what you can safely pay yourself each month, and which months will be tight. It takes about 2 minutes.</p>
<div class="welcome-btns">
<button type="button" class="sbtn go" data-act="start">Build my plan</button>
<button type="button" class="sbtn ghost" data-act="example">Show me an example roofer first</button>
<button type="button" class="sbtn ghost" data-act="open">Open a plan I saved</button>
</div>`;
showNext = false; break;
case "trade":
h = `<h2 class="q" id="wizQ">What kind of work do you do?</h2><p class="qsub">This sets the shape of your year. You can fine-tune it later.</p>
<div class="tiles" role="group" aria-labelledby="wizQ">${Object.keys(PATTERNS).map(t=>`<button type="button" class="tile" data-trade="${t}" aria-pressed="${d.trade===t}">${ICONS[t]}${TRADE_NAMES[t]}<small>${TRADE_SUB[t]}</small></button>`).join("")}</div>`;
break;
case "collect":
h = moneyStep("About how much do customers pay you in a year?", "Everything that comes in, before materials or anything else. Last year's number is a good guess.", "annual", [100000,150000,250000,400000],
`<p style="margin:16px 0 0"><button type="button" class="linkbtn" data-act="bank">Or fill it in from my bank statement</button> <span class="hint" id="wizBankNote">${d._monthsFromBank ? "Your months were filled in from your bank statement." : ""}</span></p>`);
break;
case "jobcost":
h = `<h2 class="q" id="wizQ">How much of each job goes to materials and subs?</h2><p class="qsub">Shingles, equipment rental, dumpsters, 1099 crews, fuel for the job.</p>
<div class="slider-out num" id="jcOut">${d.jobCost}%</div>
<input type="range" class="slider" id="wizRange" min="0" max="85" step="1" value="${d.jobCost}" aria-labelledby="wizQ">
<div class="example" id="jcEx"></div>`;
break;
case "bills":
h = moneyStep("What are your fixed business bills each month?", "Truck payment, insurance, phone, software, storage. The bills that come whether you work or not.", "overhead", [1500,2500,4000,6000]);
break;
case "need":
h = moneyStep("How much does your household need each month?", "Mortgage or rent, groceries, car, utilities. What you need the business to pay you.", "need", [3500,4500,5500,7000]);
break;
case "cash":
h = moneyStep("How much is in your business checking at the start of the year?", "Your plan runs January to December. If you're not sure yet, use what's there today.", "startCash", [2000,5000,10000,20000],
`<div class="field" style="max-width:340px;margin-top:18px"><label for="wizTax">Already saved for taxes, if any</label><div class="money"><input type="number" id="wizTax" min="0" inputmode="decimal" value="${d.startTax}"></div></div>`);
break;
case "filing":
h = `<h2 class="q" id="wizQ">How do you file your taxes?</h2><p class="qsub">This changes your standard deduction and tax brackets.</p>
<div class="tiles" role="group" aria-labelledby="wizQ">
<button type="button" class="tile" data-filing="mfj" aria-pressed="${d.filing==='mfj'}">Married, together<small>One return with your spouse</small></button>
<button type="button" class="tile" data-filing="single" aria-pressed="${d.filing==='single'}">Single<small>Just you</small></button>
<button type="button" class="tile" data-filing="hoh" aria-pressed="${d.filing==='hoh'}">Head of household<small>Unmarried, supporting kids or family</small></button>
</div>`;
break;
case "local": {
const lex = d.localRate === 2.75;
h = `<h2 class="q" id="wizQ">Where in Kentucky do you work?</h2><p class="qsub">Most Kentucky cities and counties tax business profit. It's easy to forget until the bill shows up.</p>
<div class="tiles" role="group" aria-labelledby="wizQ">
<button type="button" class="tile" data-local="lex" aria-pressed="${lex}">Lexington (Fayette County)<small>2.25% city + 0.5% schools</small></button>
<button type="button" class="tile" data-local="other" aria-pressed="${!lex}">Somewhere else<small>Enter your local rate</small></button>
</div>
<div class="field" id="localOther" style="max-width:220px;margin-top:14px" ${lex ? "hidden" : ""}>
<label for="wizLocal">Local tax rate on profit</label>
<div class="pct"><input type="number" id="wizLocal" min="0" max="5" step="0.05" value="${lex ? 1 : d.localRate}"></div>
<span class="hint">Not sure? 1% is the most common county rate. Your city or county clerk can confirm.</span>
</div>`;
nextLabel = "Build my plan";
break;
}
case "build":
h = `<h2 class="q" id="wizQ">Building your year…</h2>
<ul class="building" id="buildList">
<li><span class="tick">✓</span>Working out your 2026 federal, Kentucky, and local taxes</li>
<li><span class="tick">✓</span>Mapping your busy and slow months</li>
<li><span class="tick">✓</span>Finding the paycheck you can count on every month</li>
<li><span class="tick">✓</span>Lining up your tax payment dates</li>
</ul>`;
showBack = false; showNext = false;
break;
}
if (name !== "welcome" && name !== "build"){
h = h.replace('<p class="step-count"></p>', "");
h = `<p class="step-count">Question ${wizStep} of ${qCount}</p>` + h;
}
if (showNext || showBack){
h += `<div class="sheet-foot">${showBack ? `<button type="button" class="sbtn ghost" data-act="back">Back</button>` : "<span></span>"}${showNext ? `<button type="button" class="sbtn ${name==="local"?"yellow":"go"}" data-act="next">${nextLabel}</button>` : ""}</div>`;
}
body.innerHTML = `<div class="step">${h}</div>`;
if (name === "jobcost") updateJcExample();
if (name === "build") runBuild();
const focusEl = body.querySelector("#wizIn,#wizRange,.tile[aria-pressed=true],.sbtn.go");
if (focusEl) focusEl.focus();
}
function updateJcExample(){
const v = +$("wizRange").value;
wizDraft.jobCost = v;
$("jcOut").textContent = v + "%";
$("jcEx").innerHTML = `On a <strong>$10,000</strong> job, about <strong>${fmt(10000*v/100)}</strong> goes to materials and subs, and <strong>${fmt(10000 - 10000*v/100)}</strong> is left to cover your bills, your taxes, and you.`;
}
function captureStep(){
const name = STEPS[wizStep], d = wizDraft;
const inp = $("wizIn");
if (inp){
const v = parseFloat(inp.value);
d[inp.dataset.key] = isFinite(v) && v >= 0 ? v : 0;
}
if (name === "cash"){ const t = parseFloat($("wizTax").value); d.startTax = isFinite(t) && t >= 0 ? t : 0; }
if (name === "local" && !$("localOther").hidden){
const r = parseFloat($("wizLocal").value); d.localRate = isFinite(r) ? Math.min(5, Math.max(0, r)) : 1;
}
}
function finishWizard(){
const d = wizDraft;
if (!d._monthsFromBank) d.months = spread(d.annual, d.trade);
d.annual = d.months.reduce((a,b)=>a+b,0);
delete d._monthsFromBank;
d.drawMode = "safe";
d.whatIf = {wet:false, lostJob:false, truck:false, raise:false};
state = d;
writeForm();
closeOverlay("wiz");
render({animate:true});
setDirty(true);
document.getElementById("answer").scrollIntoView({behavior: reduceMotion() ? "auto" : "smooth", block:"start"});
}
function runBuild(){
const lis = [...document.querySelectorAll("#buildList li")];
const gap = reduceMotion() ? 0 : 420;
lis.forEach((li, i) => {
setTimeout(()=> li.classList.add("on"), i * gap);
setTimeout(()=> li.classList.add("done"), i * gap + gap * 0.8);
});
setTimeout(finishWizard, lis.length * gap + (reduceMotion() ? 0 : 450));
}
function wizClick(e){
const t = e.target.closest("button");
if (!t) return;
const act = t.dataset.act;
if (t.dataset.trade){ wizDraft.trade = t.dataset.trade; wizDraft._monthsFromBank = false; wizStep++; drawStep(); return; }
if (t.dataset.filing){ wizDraft.filing = t.dataset.filing; wizStep++; drawStep(); return; }
if (t.dataset.local){
document.querySelectorAll("[data-local]").forEach(b => b.setAttribute("aria-pressed", b === t ? "true" : "false"));
if (t.dataset.local === "lex"){ wizDraft.localRate = 2.75; $("localOther").hidden = true; }
else { $("localOther").hidden = false; $("wizLocal").focus(); }
return;
}
if (t.dataset.set){ $("wizIn").value = t.dataset.set; $("wizIn").focus(); return; }
if (act === "start"){ wizStep = 1; drawStep(); }
else if (act === "example"){ closeOverlay("wiz"); render({animate:true}); }
else if (act === "open"){ closeOverlay("wiz"); $("fileInput").value = ""; $("fileInput").click(); }
else if (act === "bank"){ captureStep(); openBank("wizard"); }
else if (act === "back"){ captureStep(); wizStep = Math.max(1, wizStep - 1); drawStep(); }
else if (act === "next"){
captureStep();
if (STEPS[wizStep] === "trade" || STEPS[wizStep] === "filing"){ /* tiles advance on tap; Next keeps the current choice */ }
wizStep = Math.min(STEPS.length - 1, wizStep + 1); drawStep();
}
}
/* ---------- Bank import UI ---------- */
let bankResult = null, bankFrom = "form", bankText = null;
function openBank(from){
bankFrom = from; bankResult = null; bankText = null;
$("bankResult").innerHTML = ""; $("bankUse").disabled = true;
$("bank").hidden = false;
document.body.classList.add("locked");
$("drop").focus();
}
function closeBank(){
$("bank").hidden = true;
if ($("wiz").hidden) document.body.classList.remove("locked");
if (bankFrom === "wizard"){ const i = $("wizIn"); if (i) i.focus(); }
else $("btnBank").focus();
}
function showBankResult(text){
bankText = text;
try {
bankResult = readStatement(text, $("skipXfer").checked);
} catch (e){
bankResult = null; $("bankUse").disabled = true;
$("bankResult").innerHTML = `<p class="alert" style="margin-top:14px"><strong>Couldn't read that file.</strong> ${esc(e.message)} Your plan wasn't changed.</p>`;
return;
}
const r = bankResult, max = Math.max(1, ...r.months), total = r.months.reduce((a,b)=>a+b,0);
const skippedTxt = r.skipped.length
? `<p class="skipped">Skipped ${r.skipped.length} line${r.skipped.length>1?"s":""} that looked like transfers, loans, or refunds, such as “${esc(r.skipped[0].desc.slice(0,40))}” (${fmt(r.skipped[0].amt)}).</p>` : "";
const gapTxt = r.coversMonths < 12 ? `<p class="skipped">The file covers ${r.coversMonths} month${r.coversMonths>1?"s":""}. Months with no deposits will keep their current numbers.</p>` : "";
$("bankResult").innerHTML = `
<p class="found">Found <strong>${r.count} payments</strong> totaling <strong>${fmt(total)}</strong> in the 12 months through ${r.through}.</p>
<div class="preview-bars" aria-hidden="true">${r.months.map(()=>`<div style="height:0"></div>`).join("")}</div>
<div class="preview-labels" aria-hidden="true">${MONTHS.map(m=>`<span>${m[0]}</span>`).join("")}</div>
${skippedTxt}${gapTxt}`;
const bars = [...document.querySelectorAll(".preview-bars div")];
requestAnimationFrame(()=> requestAnimationFrame(()=> bars.forEach((b,i)=> b.style.height = Math.max(2, r.months[i]/max*90) + "px")));
$("bankUse").disabled = false;
}
function readCSVFile(file){
if (!file) return;
if (file.size > 5 * 1024 * 1024){ $("bankResult").innerHTML = `<p class="alert" style="margin-top:14px">That file is too large to be a bank statement export.</p>`; return; }
const fr = new FileReader();
fr.onload = () => showBankResult(String(fr.result));
fr.onerror = () => { $("bankResult").innerHTML = `<p class="alert" style="margin-top:14px">The file couldn't be read.</p>`; };
fr.readAsText(file);
}
function useBank(){
if (!bankResult) return;
const r = bankResult;
const target = bankFrom === "wizard" ? wizDraft : state;
const base = bankFrom === "wizard" ? spread(target.annual, target.trade) : target.months.slice();
target.months = base.map((v,i)=> r.seen[i] ? r.months[i] : v);
target.annual = target.months.reduce((a,b)=>a+b,0);
if (bankFrom === "wizard"){
wizDraft._monthsFromBank = true;
closeBank();
const i = $("wizIn"); if (i) i.value = target.annual;
const n = $("wizBankNote"); if (n) n.textContent = "Your months were filled in from your bank statement.";
} else {
closeBank();
writeForm(); render({animate:true}); setDirty(true);
}
}
/* ---------- Save / open / reset ---------- */
function savePlan(){
readForm();
const payload = { app: APP_ID, version: FILE_VERSION, taxYear: TAX.year, savedAt: new Date().toISOString(), plan: state };
const blob = new Blob([JSON.stringify(payload, null, 2)], {type:"application/json"});
const a = document.createElement("a");
const base = (state.bizName || "off-season-plan").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"") || "off-season-plan";
a.href = URL.createObjectURL(blob);
a.download = base + ".json";
document.body.appendChild(a); a.click(); a.remove();
setTimeout(()=>URL.revokeObjectURL(a.href), 2000);
$("saveStatus").dataset.saved = "1";
setDirty(false);
}
function validatePlan(obj){
if (!obj || typeof obj !== "object") throw new Error("The file is empty or isn't a plan.");
if (obj.app !== APP_ID) throw new Error("This file wasn't saved from Off-Season.");
if (obj.version !== FILE_VERSION) throw new Error("This plan was saved by a different version of Off-Season.");
const p = obj.plan;
if (!p || typeof p !== "object") throw new Error("The file has no plan in it.");
const out = defaults();
const isNum = v => typeof v === "number" && isFinite(v);
const needNum = (k, min, max) => {
if (!isNum(p[k]) || p[k] < min || p[k] > max) throw new Error(`"${k}" is missing or out of range.`);
out[k] = p[k];
};
if (typeof p.bizName === "string") out.bizName = p.bizName.slice(0,80);
if (!(p.trade in PATTERNS)) throw new Error(`"trade" isn't one this tool knows.`);
out.trade = p.trade;
if (!["mfj","single","hoh"].includes(p.filing)) throw new Error(`"filing" isn't a valid filing status.`);
out.filing = p.filing;
if (!Array.isArray(p.months) || p.months.length !== 12 || !p.months.every(v => isNum(v) && v >= 0 && v <= 1e9))
throw new Error("The monthly collections must be 12 numbers of zero or more.");
out.months = p.months.slice();
needNum("annual",0,1e10); needNum("jobCost",0,100); needNum("overhead",0,1e8);
needNum("localRate",0,5); needNum("startCash",0,1e9); needNum("startTax",0,1e9);
needNum("cushion",0,1e9); needNum("need",0,1e8); needNum("customDraw",0,1e8); needNum("deposit",0,1e9);
if (p.lastYearTax === null || p.lastYearTax === undefined) out.lastYearTax = null;
else if (isNum(p.lastYearTax) && p.lastYearTax >= 0) out.lastYearTax = p.lastYearTax;
else throw new Error(`"lastYearTax" isn't a valid amount.`);
out.highIncome = p.highIncome === true;
out.drawMode = p.drawMode === "custom" ? "custom" : "safe";
if (p.whatIf !== undefined){
if (!p.whatIf || typeof p.whatIf !== "object") throw new Error(`"whatIf" isn't valid.`);
for (const k of Object.keys(WHATIFS)) out.whatIf[k] = p.whatIf[k] === true;
}
return out;
}
function showError(msg){
const el = $("loadError");
el.innerHTML = `<strong>Couldn't open that file. Your current plan wasn't changed.</strong> ${esc(msg)}`;
el.hidden = false;
el.scrollIntoView({block:"nearest"});
}
function openFile(file){
if (!file) return;
if (file.size > 1024 * 1024){ showError("The file is larger than a plan should be."); return; }
const reader = new FileReader();
reader.onerror = () => showError("The file couldn't be read.");
reader.onload = () => {
let parsed;
try { parsed = JSON.parse(reader.result); }
catch { showError("The file isn't valid plan data. Plans are saved as .json files by the Save plan button."); return; }
let next;
try { next = validatePlan(parsed); }
catch (e){ showError(e.message); return; }
state = next;
$("loadError").hidden = true;
writeForm(); render({animate:true});
$("saveStatus").dataset.saved = "1";
setDirty(false);
};
reader.readAsText(file);
}
/* ---------- Wire up ---------- */
function fillMonths(){
state.months = spread(state.annual, state.trade);
state.months.forEach((v,i)=> $("m"+i).value = v);
render({animate:true}); setDirty(true);
}
function init(){
buildMonthInputs();
writeForm();
render();
setDirty(false);
$("form").addEventListener("input", e => {
if (e.target.id === "annual" || e.target.id === "trade") { readForm(); setDirty(true); return; }
if (e.target.id === "customDraw") $("drawCustom").checked = true;
readForm(); render(); setDirty(true);
});
$("form").addEventListener("change", e => {
if (e.target.id === "trade" || e.target.id === "annual") return;
readForm(); render(); setDirty(true);
});
$("trade").addEventListener("change", () => { readForm(); fillMonths(); });
$("btnFill").addEventListener("click", () => { readForm(); fillMonths(); });
$("deposit").addEventListener("input", () => { readForm(); render(); setDirty(true); });
$("chips").addEventListener("click", e => {
const c = e.target.closest(".chip"); if (!c) return;
const k = c.dataset.w;
state.whatIf[k] = !state.whatIf[k];
c.setAttribute("aria-pressed", state.whatIf[k] ? "true" : "false");
render({animate:true}); setDirty(true);
});
$("btnSave").addEventListener("click", savePlan);
$("btnOpen").addEventListener("click", () => {
if (dirty && !confirm("Opening a plan replaces what's on screen. Your unsaved changes will be lost. Open anyway?")) return;
$("fileInput").value = "";
$("fileInput").click();
});
$("fileInput").addEventListener("change", e => openFile(e.target.files[0]));
$("btnReset").addEventListener("click", () => {
if (dirty && !confirm("Start over? Your unsaved changes will be lost.")) return;
state = defaults(); $("loadError").hidden = true; writeForm(); render(); setDirty(false);
startWizard();
});
// Guided setup
$("btnWizard").addEventListener("click", startWizard);
$("wizBody").addEventListener("click", wizClick);
$("wizBody").addEventListener("input", e => { if (e.target.id === "wizRange") updateJcExample(); });
$("wizBody").addEventListener("keydown", e => {
if (e.key === "Enter" && e.target.tagName === "INPUT"){ e.preventDefault(); const n = $("wizBody").querySelector("[data-act=next]"); if (n) n.click(); }
});
$("wizClose").addEventListener("click", () => { closeOverlay("wiz"); render(); });
$("wiz").addEventListener("keydown", e => {
if (e.key === "Escape" && $("bank").hidden){ closeOverlay("wiz"); render(); }
trapFocus(e, "wiz");
});
// Bank import
$("btnBank").addEventListener("click", () => openBank("form"));
$("bankClose").addEventListener("click", closeBank);
$("bankCancel").addEventListener("click", closeBank);
$("bankUse").addEventListener("click", useBank);
$("bank").addEventListener("keydown", e => { if (e.key === "Escape"){ e.stopPropagation(); closeBank(); } trapFocus(e, "bank"); });
const drop = $("drop");
drop.addEventListener("click", () => { $("csvInput").value = ""; $("csvInput").click(); });
drop.addEventListener("keydown", e => { if (e.key === "Enter" || e.key === " "){ e.preventDefault(); drop.click(); } });
drop.addEventListener("dragover", e => { e.preventDefault(); drop.classList.add("over"); });
drop.addEventListener("dragleave", () => drop.classList.remove("over"));
drop.addEventListener("drop", e => { e.preventDefault(); drop.classList.remove("over"); readCSVFile(e.dataTransfer.files[0]); });
$("csvInput").addEventListener("change", e => readCSVFile(e.target.files[0]));
$("btnSample").addEventListener("click", () => showBankResult(sampleStatement()));
$("skipXfer").addEventListener("change", () => { if (bankText) showBankResult(bankText); });
startWizard();
}
init();
</script>
</body>
</html>
Nothing. This page is entirely self-contained and contacts no other website when it runs.
Published on Globefin under the MIT License. You may copy, change, and reuse this page, including commercially — just keep the notice below with it.
Copyright © 2026 Ashley Butts. Licensed under the MIT License. Published on Globefin.
Provided as is, without warranty. Any external libraries it loads keep their own licences. Terms →
Scripts run, but the demo has its own throwaway origin. It can't read your session or cookies, can't reach the page around it, and can't navigate your tab. Don't enter real passwords or personal data into any demo.