:root{
  --bg:#f3f5f7; --flaeche:#fff; --tinte:#16222c; --leise:#5d6b77; --linie:#d6dce1; --linie2:#e8ecef;
  --blau:#1f5a7a; --blau-hell:#e6eff4; --rot:#b3261e; --gruen:#2e7d4f; --gelb:#fff7e0; --fokus:#0b6bcb;
  --font: system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
@media (prefers-color-scheme: dark){
  :root{--bg:#10171d;--flaeche:#17212a;--tinte:#e6ecf0;--leise:#9aa9b5;--linie:#2c3a46;--linie2:#232f39;--blau:#7fb6d4;--blau-hell:#1b2e3a;--rot:#ff8a80;--gruen:#7ed1a0;--gelb:#2b2616;--fokus:#7ab8ff}
}
*{box-sizing:border-box}
html{font-family:var(--font);font-size:15px;color:var(--tinte);background:var(--bg);-webkit-text-size-adjust:100%}
body{margin:0;padding-bottom:3.4rem}
h1,h2{margin:0}
h2{font-size:1.05rem;font-weight:650;margin:1.4rem 0 .6rem}
.klein{font-size:.82rem;color:var(--leise);font-weight:400}
button,input,select{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--fokus);outline-offset:2px}
[hidden]{display:none!important}

/* Anmeldung */
.login{min-height:100vh;display:grid;place-items:center;padding:1rem}
.login form{background:var(--flaeche);border:1px solid var(--linie);border-radius:6px;padding:2rem;max-width:26rem;width:100%}
.login h1{font-size:1.3rem;line-height:1.25;margin-bottom:.6rem}
.login p{color:var(--leise);line-height:1.5}
.login label{display:block;margin:1.2rem 0 .3rem;font-weight:600}
.login input{width:100%;padding:.6rem .7rem;border:1px solid var(--linie);border-radius:4px;background:var(--flaeche);letter-spacing:.06em}
.login button{margin-top:1rem;width:100%;padding:.65rem;border:0;border-radius:4px;background:var(--blau);color:#fff;font-weight:600;cursor:pointer}
.fehler{color:var(--rot);min-height:1.2em}

/* Kopf und Reiter */
.kopf{display:flex;flex-wrap:wrap;gap:.5rem 1rem;align-items:center;justify-content:space-between;padding:.6rem 1rem;background:var(--flaeche);border-bottom:1px solid var(--linie)}
.titel{font-weight:650}
.menue{display:flex;flex-wrap:wrap;gap:.4rem}
.menue button{padding:.35rem .7rem;border:1px solid var(--linie);border-radius:4px;background:transparent;cursor:pointer}
.menue button:hover{background:var(--blau-hell)}
.menue .leise{border-color:transparent;color:var(--leise)}
.reiter{display:flex;gap:.2rem;padding:.5rem 1rem 0;background:var(--flaeche);border-bottom:1px solid var(--linie);position:sticky;top:0;z-index:5;overflow-x:auto}
.reiter button{padding:.55rem 1rem;border:1px solid transparent;border-bottom:0;border-radius:4px 4px 0 0;background:transparent;cursor:pointer;white-space:nowrap;color:var(--leise)}
.reiter button[aria-selected=true]{background:var(--bg);border-color:var(--linie);color:var(--tinte);font-weight:650;margin-bottom:-1px}
.inhalt{padding:0 1rem 1rem;max-width:1500px}

/* Formulare */
.zwei{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,34rem),1fr));gap:1rem;align-items:start}
fieldset{margin:0 0 1rem;padding:.8rem 1rem 1rem;border:1px solid var(--linie);border-radius:6px;background:var(--flaeche)}
legend{padding:0 .4rem;font-weight:600;color:var(--blau)}
.feld{display:grid;grid-template-columns:minmax(0,1fr) 9.5rem;gap:.6rem;align-items:center;padding:.18rem 0}
.feld.zus{grid-template-columns:minmax(0,1fr) 9.5rem auto 5.5rem}
.feld.zus:has(output){grid-template-columns:minmax(0,1fr) 9.5rem auto 6.5rem}
.feld label,.feld .lab{font-size:.93rem}
input:not([type=checkbox]):not([type=radio]),select{width:100%;padding:.32rem .5rem;border:1px solid var(--linie);border-radius:3px;background:var(--flaeche);text-align:right;font-variant-numeric:tabular-nums}
input[data-typ=text]{text-align:right}
select{text-align:left}
input.ungueltig{border-color:var(--rot);background:var(--gelb)}
input:disabled,select:disabled{opacity:.55}
label.satz{font-size:.85rem;color:var(--leise);text-align:right}
.satzout,output{font-size:.82rem;color:var(--leise);font-variant-numeric:tabular-nums;text-align:right}
output{color:var(--tinte);font-weight:600}
.check,.radio{display:flex;gap:.4rem;align-items:center;font-size:.93rem}
.radios{display:flex;flex-wrap:wrap;gap:.3rem 1rem;grid-column:2/-1;justify-self:end}
.feld:has(.radios){grid-template-columns:1fr}
.feld:has(.radios) .radios{justify-self:start;grid-column:1}
.kinder{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,38rem),1fr));gap:.5rem}
.kind{display:grid;grid-template-columns:4rem 1fr 7.5rem auto 6.5rem 6.5rem;gap:.4rem;align-items:center;padding:.45rem .7rem;border:1px solid var(--linie);border-radius:6px;background:var(--flaeche)}
.kind input[data-typ=text]{text-align:left}
.kind .mini{display:flex;gap:.3rem;align-items:center;font-size:.8rem;color:var(--leise)}
@media (max-width:640px){.kind{grid-template-columns:1fr 1fr}.feld,.feld.zus{grid-template-columns:1fr 8rem}.feld.zus label.satz,.feld.zus input.satz{grid-column:auto}}

table{border-collapse:collapse;font-variant-numeric:tabular-nums}
.abzuege{width:100%}
.abzuege th{font-weight:500;text-align:left;padding:.15rem .4rem .15rem 0}
.abzuege thead th{color:var(--leise);font-size:.82rem;text-align:right}
.abzuege td{padding:.12rem .25rem}
.abzuege .sum,.abzuege tfoot td{text-align:right;color:var(--gruen);font-weight:600}
.abzuege tfoot th{border-top:1px solid var(--linie);font-weight:650}
.abzuege tfoot td{border-top:1px solid var(--linie)}

/* Steuern */
.modus{display:flex;flex-wrap:wrap;gap:.5rem 1.2rem;align-items:center;margin-bottom:.8rem}
.modus select{width:7rem;text-align:left}
.ergebnis{display:grid;grid-template-columns:1fr auto;gap:.2rem .8rem;margin:.6rem 0 0}
.ergebnis dt{font-size:.93rem} .ergebnis dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}
.ergebnis .sum{font-weight:650;color:var(--gruen);border-top:1px solid var(--linie);padding-top:.2rem}
.steuerhoheit{width:100%;margin-top:.8rem}
.steuerhoheit th{text-align:left;font-weight:500;padding:.2rem .4rem .2rem 0;white-space:nowrap}
.steuerhoheit thead th{color:var(--leise);font-size:.8rem;text-align:right}
.steuerhoheit td{padding:.15rem .3rem;text-align:right}
.steuerhoheit td:last-child{width:6.5rem;font-weight:600}
.steuerhoheit input{width:5.5rem} .steuerhoheit td:nth-child(2) input,.steuerhoheit td:nth-child(2) select{width:9.5rem;text-align:left}
.steuerhoheit td:nth-child(2){text-align:left}
.steuerhoheit tfoot th,.steuerhoheit tfoot td{border-top:1px solid var(--linie);color:var(--gruen);font-weight:650}
.gesamt{margin:.3rem 0 1rem;padding:.7rem 1rem;border:1px solid var(--linie);border-left:4px solid var(--blau);border-radius:4px;background:var(--flaeche)}
.gesamt strong{margin-left:.8rem;font-size:1.15rem;font-variant-numeric:tabular-nums}

/* Grafiken */
.grafiken{display:grid;gap:1rem;margin-bottom:1rem}
.grafiken.zwei{grid-template-columns:repeat(auto-fit,minmax(min(100%,30rem),1fr))}
.grafiken.drei{grid-template-columns:repeat(auto-fit,minmax(min(100%,22rem),1fr))}
figure{margin:0;padding:.6rem .8rem .5rem;border:1px solid var(--linie);border-radius:6px;background:var(--flaeche)}
figcaption{font-size:.9rem;font-weight:600;margin-bottom:.3rem}
.diagramm{width:100%;height:auto;display:block;touch-action:pan-y}
.diagramm .gitter{stroke:var(--linie2)} .diagramm .achse{font-size:10.5px;fill:var(--leise)}
.diagramm .fuehrung{stroke:var(--leise);stroke-dasharray:3 3}
.legende{display:flex;flex-wrap:wrap;gap:.2rem .9rem;font-size:.8rem;color:var(--leise);margin-top:.3rem}
.legende i{display:inline-block;width:.8rem;height:.2rem;margin-right:.35rem;vertical-align:middle}
.legende i.punkt{width:.55rem;height:.55rem;border:2px solid;border-radius:50%;background:var(--flaeche)}
.tip{position:absolute;top:.2rem;z-index:2;padding:.35rem .55rem;border:1px solid var(--linie);border-radius:4px;background:var(--flaeche);font-size:.8rem;pointer-events:none;box-shadow:0 2px 8px rgba(0,0,0,.12)}
.tip i{display:inline-block;width:.6rem;height:.6rem;margin-right:.35rem;border-radius:2px}

/* Berechnung */
.werkzeug{display:flex;flex-wrap:wrap;gap:.6rem 1.2rem;align-items:center;margin:.9rem 0}
.seg{display:inline-flex;border:1px solid var(--linie);border-radius:4px;overflow:hidden}
.seg button{padding:.4rem .9rem;border:0;border-right:1px solid var(--linie);background:var(--flaeche);cursor:pointer}
.seg button:last-child{border-right:0}
.seg button[aria-checked=true]{background:var(--blau);color:#fff;font-weight:600}
.inline{display:flex;gap:.5rem;align-items:center}.inline select{width:auto}
.status{margin-left:auto;font-size:.82rem;color:var(--leise)}
.tabelle-rahmen{overflow:auto;max-height:68vh;border:1px solid var(--linie);border-radius:6px;background:var(--flaeche)}
.jahre{font-size:.84rem;width:max-content;min-width:100%}
.jahre th,.jahre td{height:1.55rem;padding:.18rem .6rem;line-height:1.1;white-space:nowrap;border-bottom:1px solid var(--linie2)}
.jahre td{text-align:right}
.jahre thead tr{height:1.8rem}
.jahre thead th{position:sticky;top:0;background:var(--flaeche);z-index:3;text-align:right;border-bottom:1px solid var(--linie)}
.jahre thead tr.alter th,.jahre thead tr.alter td{position:sticky;top:1.8rem;background:var(--flaeche);z-index:3}
.jahre thead tr.alter + tr.alter th,.jahre thead tr.alter + tr.alter td{top:3.6rem}
.jahre .l1{position:sticky;left:0;background:var(--flaeche);z-index:2;text-align:left;min-width:15rem;font-weight:500;cursor:pointer}
.jahre .l2{position:sticky;left:15rem;background:var(--flaeche);z-index:2;text-align:right;min-width:8.5rem;color:var(--leise);font-weight:400;border-right:1px solid var(--linie)}
.jahre thead .l1,.jahre thead .l2{z-index:4}
.jahre tr.summe th,.jahre tr.summe td{font-weight:700}
.jahre tr.totalsteuer th,.jahre tr.totalsteuer td{color:var(--blau)}
.jahre tr.trenner th{background:var(--blau-hell);color:var(--blau);font-weight:700;text-align:left;cursor:default;position:sticky;left:0}
.jahre tr.trenner.steuer th{color:var(--rot)}
.jahre tbody tr:hover td,.jahre tbody tr:hover th{background:var(--blau-hell)}
.jahre tbody tr.gewaehlt td,.jahre tbody tr.gewaehlt th{background:var(--blau-hell)}
.jahre td:nth-child(3){color:var(--leise)}
.zeilengrafik{margin-bottom:.5rem}

/* KPI-Leiste */
.kpi{position:fixed;left:0;right:0;bottom:0;z-index:9;display:flex;flex-wrap:wrap;gap:.2rem .9rem;align-items:baseline;padding:.6rem 1rem;background:var(--flaeche);border-top:1px solid var(--linie);font-size:.9rem}
.kpi #kpi-szenario{font-weight:650;color:var(--blau)}
.kpi #kpi-szenario[data-bezug="50% Teilkapitalbezug"]{color:#b45f06}
.kpi #kpi-szenario[data-bezug="100% Kapitalbezug"]{color:var(--gruen)}
.kpi strong{font-variant-numeric:tabular-nums}
.kpi .trenn{color:var(--linie)}
.kpi small{font-size:.8rem;color:var(--leise)} .kpi small.gut{color:var(--gruen)} .kpi small.schlecht{color:var(--rot)}
@media print{.kpi,.menue,.reiter{display:none}}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
@media (max-width:640px){
  fieldset{overflow-x:auto}
  .steuerhoheit input{width:4.6rem}
  .steuerhoheit td:nth-child(2) input,.steuerhoheit td:nth-child(2) select{width:7.5rem}
  .feld.zus,.feld.zus:has(output){grid-template-columns:1fr 7.5rem}
  .feld.zus .satzout,.feld.zus output{grid-column:1/-1;text-align:right}
  .kpi{font-size:.8rem}
  .jahre .l1{min-width:10rem}.jahre .l2{left:10rem;min-width:6.5rem}
}
fieldset{min-width:0}.zwei>*{min-width:0}

.version { margin-left: auto; font-size: .8rem; color: var(--grau, #5E6670); padding: 0 12px; }
.menuleiste { display: flex; align-items: center; }
label.check.einzel { display: block; margin: 0 0 10px; font-weight: 600; }
.ueberblick td { text-align: right; } .ueberblick tr.sum th, .ueberblick tr.sum td { font-weight: 700; border-top: 1px solid #999; }
#steuer-hinweis:empty { display: none; }

/* ===== Layout wie Desktop 0.227 (Screenshots) ===== */
.menuleiste{background:#fff;border-bottom:0}
.menuepunkte a,.menuepunkte .info{display:block;padding:.35rem 1.2rem;color:#000;text-decoration:none;white-space:nowrap}
.menuepunkte a:hover{background:#e5f3ff}
.menuepunkte .info{white-space:normal;line-height:1.5;cursor:default}
.menue{position:relative}.menuepunkte{left:0}
.reiterzeile{display:flex;justify-content:space-between;align-items:flex-end;background:#f0f0f0;padding:0 .5rem 0 .25rem}
.reiterzeile .logo{height:1.45rem;margin-bottom:.2rem}
.reiter{padding:.2rem 0 0}
.inhalt{padding-top:.2rem}
h2{font-size:1.15rem;margin:.9rem 0 .5rem}
.zeile1{display:flex;align-items:center;gap:1.1rem;margin:0 0 .7rem}
.zeile1 .hor{margin-left:.4rem}
.schmal{width:5rem!important}
#personen{display:flex;flex-wrap:wrap;gap:1.2rem;align-items:flex-start;margin-bottom:.9rem}
#personen>fieldset{flex:0 0 auto;margin:0;width:412px}
.pg{display:grid;grid-template-columns:1fr 100px;gap:.2rem .5rem;align-items:center}
.pg label{white-space:nowrap}
input[readonly]{background:#f0f0f0!important;color:#777;border-color:#f0f0f0!important}
.kindrahmen{display:inline-block;margin-bottom:.9rem}
.kindraster{display:grid;grid-template-columns:3.6rem 4.8rem 4.8rem 6.5rem 2.8rem 2.8rem;gap:.2rem .35rem;align-items:center}
.kindraster>span{text-align:center}
.kindraster input.li{text-align:left}
.todesrahmen{display:inline-block;margin:0 0 .5rem}
.todeszeile{display:flex;gap:1.4rem;align-items:center;margin-top:.4rem}
.todeszeile label{display:flex;gap:.5rem;align-items:center}
.todeszeile select{width:7.5rem}
/* Tab 2 */
.g4{display:grid;grid-template-columns:auto 100px auto 100px;gap:.2rem .6rem;align-items:center}
.g4 label:nth-child(4n+3){text-align:left;margin-left:.9rem}
.g2{display:grid;grid-template-columns:auto 100px;gap:.2rem .6rem;align-items:center}
.abzuege th{font-weight:400}
.abzuege thead th{font-weight:700}
.abzuege td input{width:4.6rem}
.abzuege .sum{text-align:right;color:#000}
.abzuege tfoot th{font-weight:700}
.abzuege tfoot td{color:#006400;font-weight:700}
/* Tab 3 */
.t3titel{margin:.3rem 0 .3rem}
.modus{display:flex;align-items:center;gap:.9rem;margin:0 0 .5rem}
.modus .sj{width:5rem;text-align:left}
.modus select.bz{width:9.5rem}
.modus .inline{gap:.4rem}
.rot{color:#e02020;font-weight:700}
.t3{display:flex;gap:1rem;align-items:flex-start}
.t3links{flex:0 0 365px}.t3rechts{flex:1 1 auto;min-width:0}
.fett{font-weight:700}.gr{color:#006400}.gs{color:#808080}
.sf{width:100%;border-collapse:collapse}
.sf td{padding:.12rem .25rem;white-space:nowrap}
.sf td.r{text-align:right}.sf td.z{text-align:right;width:3.6rem}
.sf input{width:4.2rem}.sf input.kt{width:5rem;text-align:right}
.sf td:nth-child(2) input,.sf td:nth-child(2) select{width:5.6rem;text-align:left}
.sf td:nth-child(2) input.kt{text-align:right}
.sf tr.tot td{border-top:1px solid #c8c8c8;padding-top:.3rem;text-align:right}
.sf tr.tot td:first-child{text-align:left}
.liste{display:grid;grid-template-columns:1fr auto;gap:.3rem .8rem;margin:.2rem 0 0;padding:0 .3rem}
.liste dd{margin:0;text-align:right}
.liste .tot{border-top:1px solid #c8c8c8;padding-top:.3rem}
.kst{display:flex;align-items:flex-start;gap:.8rem}
.kstl{flex:0 0 auto}
.zl{display:grid;grid-template-columns:215px 58px 140px;gap:.3rem .5rem;align-items:center;margin:.2rem 0;padding-left:.3rem}
.zl input{width:100%}.gz{white-space:nowrap}.gz .satzout{margin-left:.2rem}
.zw{display:flex;gap:2.2rem;border-top:1px solid #c8c8c8;margin-top:.4rem;padding:.3rem .3rem 0}
.mal{align-self:center;white-space:nowrap;font-weight:700}
.kstr{display:grid;grid-template-columns:1fr auto;gap:.25rem 1rem;margin:.2rem 0 0 auto;min-width:300px}
.kstr dd{margin:0;text-align:right}.kstr .tot{border-top:1px solid #c8c8c8;padding-top:.3rem}
.kstr.bund,.kstr.kap{margin-left:auto}
.satzout{color:#000}
.t3unten{display:flex;gap:1rem;align-items:flex-start}
.t3unten fieldset{flex:0 0 auto}
.sz{border-collapse:collapse}.sz td{padding:.15rem .5rem .15rem .2rem;text-align:right}.sz td:first-child{text-align:left;width:5rem}
.sz tr.tot td{border-top:1px solid #c8c8c8}
dd:empty:after,.z:empty:after{content:""}
.kopfluft{margin-top:.2rem}
/* Tab 4 */
.grauzeile{color:#555}
.jahre thead tr:first-child th{font-weight:400}
.tooltip{position:fixed;z-index:100;max-width:380px;background:#FFF6CC;color:#1a1a1a;border:1px solid #666;padding:5px 7px;font:12px "Segoe UI",system-ui,sans-serif;line-height:1.35;box-shadow:1px 1px 3px rgba(0,0,0,.25);pointer-events:none}
.kindraster input.li{text-align:left!important}
.kindrahmen,.todesrahmen{display:block;width:fit-content}
.modus select.bz{width:11rem}
.zl{grid-template-columns:215px 78px 150px}
.sf td:nth-child(2) input,.sf td:nth-child(2) select{width:7.6rem}
.sf td:nth-child(4) input{width:4.4rem}
.t3links{flex:0 0 400px}
.abzuege td input{width:4.8rem!important}
.abzuege{width:auto}
.abzuege td.sum{padding-left:.9rem;min-width:4rem}
.zwei{align-items:flex-start;flex-wrap:nowrap}
.annahmen td input{width:4.4rem!important}
.annahmen th.skopf{padding:.15rem .8rem}
.annahmen th:first-child{padding-right:1.4rem;white-space:nowrap}
.t4kopf{flex-wrap:nowrap}
.plotknoepfe{grid-template-columns:repeat(3,auto)}
.klein-knopf{width:auto;min-width:8.8rem}
.plots{flex:0 0 auto}
.jahre thead tr:first-child .l1{text-align:left}
.fenster{width:min(1400px,97vw)}
