
:root{--bg:#EEF2F5;--surface:#FFFFFF;--ink:#15212C;--muted:#5A6B7B;--rule:#D3DCE4;--soft:#E4EAF0;--accent:#1F5FBF;--good:#2E8B57;--bad:#C2453D;--warn:#B7791F;color-scheme:light;
 box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--bg:#0F1720;--surface:#16212C;--ink:#E6EDF3;--muted:#93A3B3;--rule:#2A3846;--soft:#1D2A36;--accent:#6EA8FF;--good:#4FBF86;--bad:#E8746B;--warn:#E0A93A;color-scheme:dark}}
:root[data-theme="dark"]{--bg:#0F1720;--surface:#16212C;--ink:#E6EDF3;--muted:#93A3B3;--rule:#2A3846;--soft:#1D2A36;--accent:#6EA8FF;--good:#4FBF86;--bad:#E8746B;--warn:#E0A93A;color-scheme:dark}
html{scroll-padding-top:env(safe-area-inset-top,0px)}
*,*::before,*::after{box-sizing:inherit}
body{margin:0;background:var(--bg);color:var(--ink);font:400 16px/1.5 "Archivo",system-ui,-apple-system,"Segoe UI",sans-serif;font-variant-numeric:tabular-nums}
.wrap{max-width:1240px;margin:0 auto;padding:2rem 1.25rem 4rem}
h1{font-size:clamp(2rem,4.6vw,3.2rem);font-stretch:118%;font-weight:780;letter-spacing:-.015em;line-height:1.02;margin:0}
h2{font-size:1.45rem;font-stretch:112%;font-weight:700;margin:0 0 .75rem;line-height:1.15}
h3{font-size:1rem;font-weight:600;margin:1.4rem 0 .5rem}
header p{max-width:68ch;color:var(--muted);margin:.75rem 0 0;font-size:1.05rem}
button,select,input{font:inherit}
button{font-weight:600;padding:.6rem 1rem;border-radius:6px;border:1px solid var(--accent);background:var(--accent);color:var(--surface);cursor:pointer}
button.ghost{background:transparent;color:var(--ink);border-color:var(--rule)}
button.tiny{padding:.2rem .5rem;font-size:.85rem;font-weight:500}
button:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
select{padding:.35rem .5rem;border:1px solid var(--rule);border-radius:6px;background:var(--surface);color:var(--ink)}
section{margin-top:2rem}
.panel{background:var(--surface);border:1px solid var(--rule);border-radius:12px;padding:1.25rem}
.note{font-size:.88rem;color:var(--muted);margin:.5rem 0 0;max-width:80ch}

/* live */
.live{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:1.25rem;align-items:start}
@media (max-width:900px){.live{grid-template-columns:1fr}}
.field-wrap{position:relative;overflow-x:auto}
#field{display:block;width:100%;cursor:crosshair}
#tip{position:absolute;pointer-events:none;background:var(--ink);color:var(--surface);font-size:.82rem;line-height:1.4;padding:.45rem .6rem;border-radius:6px;max-width:260px;display:none;z-index:3}
.side .month{font-size:2.6rem;font-stretch:120%;font-weight:780;line-height:1;margin:0}
.side .month small{font-size:.95rem;font-stretch:100%;font-weight:500;color:var(--muted);margin-left:.35rem}
.side dl{margin:1rem 0;display:grid;grid-template-columns:1fr auto;gap:.3rem .75rem;font-size:.95rem}
.side dt{color:var(--muted)}
.side dd{margin:0;font-weight:600;text-align:right}
.side dd.pos{color:var(--good)}.side dd.neg{color:var(--bad)}
.side .big{font-size:1.5rem;font-stretch:110%;font-weight:750}
.btns{display:flex;gap:.5rem;flex-wrap:wrap;align-items:center;margin-top:.75rem}
.legend{display:flex;flex-wrap:wrap;gap:.35rem .9rem;font-size:.88rem;margin-top:.75rem}
.legend span{display:inline-flex;align-items:center;gap:.35rem}
.legend i{width:11px;height:11px;border-radius:2px;display:inline-block}
#spark{display:block;width:100%;height:56px;margin-top:.5rem}
.fieldhead{display:flex;justify-content:space-between;align-items:baseline;gap:.5rem 1rem;flex-wrap:wrap}
.fieldhead label{font-size:.9rem;color:var(--muted);display:inline-flex;align-items:center;gap:.5rem}

/* assumptions */
.tabs{display:flex;gap:.25rem;flex-wrap:wrap;border-bottom:1px solid var(--rule);margin-bottom:1rem}
.tabs button{background:transparent;color:var(--muted);border:0;border-bottom:3px solid transparent;border-radius:0;padding:.55rem .9rem}
.tabs button[aria-selected="true"]{color:var(--ink);border-bottom-color:var(--accent)}
.tab{display:none}.tab.on{display:block}
.grid-form{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:.6rem 1.5rem}
.grid-form label{display:grid;grid-template-columns:1fr 6rem;gap:.5rem;align-items:center;font-size:.92rem}
.grid-form small{grid-column:1/-1;color:var(--muted);font-size:.8rem;margin-top:-.3rem}
input[type=number],input[type=text]{width:100%;padding:.3rem .45rem;border:1px solid var(--rule);border-radius:6px;background:var(--bg);color:var(--ink)}
input[type=number]{text-align:right}
input[type=color]{width:2rem;height:1.7rem;padding:0;border:1px solid var(--rule);border-radius:4px;background:none}
.tscroll{overflow-x:auto}
table.edit{border-collapse:collapse;font-size:.88rem;min-width:100%}
table.edit th{font-weight:500;color:var(--muted);text-align:left;vertical-align:bottom;padding:.35rem .4rem;border-bottom:1px solid var(--rule);line-height:1.25;min-width:5.5rem}
table.edit td{padding:.3rem .4rem;border-bottom:1px solid var(--soft)}
table.edit td:first-child input{min-width:9rem}
table.edit th.mix,table.edit td.mix{background:var(--soft)}

/* results */
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:1rem 1.25rem;margin:0;padding:0}
.kpis div{border-top:3px solid var(--accent);padding-top:.5rem}
.kpis dt{font-size:.85rem;color:var(--muted)}
.kpis dd{margin:0;font-size:1.55rem;font-stretch:110%;font-weight:720;line-height:1.2}
.kpis dd small{display:block;font-size:.78rem;font-stretch:100%;font-weight:400;color:var(--muted)}
.charts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1.5rem}
@media (max-width:900px){.charts{grid-template-columns:1fr}}
.chart svg{display:block;width:100%;height:auto;overflow:visible}
.chart .head{display:flex;justify-content:space-between;align-items:baseline;gap:1rem;flex-wrap:wrap}
.chart h3{margin:0 0 .4rem}
.ax{font-size:11px;fill:var(--muted)}
.heat{overflow-x:auto}
.heat table{border-collapse:collapse;font-size:10.5px}
.heat td,.heat th{width:22px;height:18px;text-align:center;padding:0;font-weight:400;color:var(--muted)}
.heat th{position:sticky;left:0;background:var(--surface);text-align:right;padding-right:6px;width:auto;white-space:nowrap}
.heat td{color:#fff}
table.data{border-collapse:collapse;width:100%;font-size:.9rem}
table.data th{font-weight:500;color:var(--muted);text-align:right;padding:.4rem .5rem;border-bottom:1px solid var(--rule);line-height:1.25}
table.data th:first-child,table.data td:first-child{text-align:left}
table.data td{padding:.4rem .5rem;border-bottom:1px solid var(--soft);text-align:right}
table.data td i{display:inline-block;width:10px;height:10px;border-radius:2px;margin-right:.4rem}
.good{color:var(--good)}.bad{color:var(--bad)}.warn{color:var(--warn)}
#status{font-size:.88rem;color:var(--muted);margin:0 0 1rem}
@media (prefers-reduced-motion:reduce){*{transition:none!important}}
