/* splittingtabelle.de – Stylesheet
   Leitidee: amtliches Formular in modern. Feine Linien, Feldkästen mit Beschriftung,
   tabellarische Ziffern. Partner A = Grün, Partner B = Violett (CVD-geprüft). */

:root {
  --paper: #fbfcfb;
  --paper-2: #f0f5f2;
  --field: #ffffff;
  --ink: #15211c;
  --ink-2: #44544d;
  --ink-3: #6b7a73;
  --rule: #cddbd4;
  --rule-strong: #9fb5aa;
  --form: #00684f;          /* Formulargrün: Links, Fokus, Akzente */
  --form-soft: #e1efe9;
  --a: #00826a;             /* Partner A */
  --b: #6b4fc4;             /* Partner B */
  --a-soft: #d3ebe3;
  --b-soft: #e6e0f7;
  --gain: #00684f;
  --ad-bg: #f3f6f4;

  --radius-field: 4px;
  --radius-panel: 10px;
  --wrap: 1120px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #101a16;
    --paper-2: #16231e;
    --field: #0c1411;
    --ink: #e4ece8;
    --ink-2: #b3c2bb;
    --ink-3: #8a9a93;
    --rule: #2a3a33;
    --rule-strong: #3f544a;
    --form: #4cc3a0;
    --form-soft: #183129;
    --a: #2fa889;
    --b: #9077e0;
    --a-soft: #173a30;
    --b-soft: #2a2447;
    --gain: #4cc3a0;
    --ad-bg: #15201b;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }
a { color: var(--form); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--form); outline-offset: 2px; border-radius: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
@media (max-width: 560px) { .wrap { padding: 0 16px; } }

.num { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Kopfzeile ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-head .wrap { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 650; letter-spacing: -0.01em; font-size: 1.05rem; white-space: nowrap; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand span span { color: var(--ink-3); font-weight: 450; }
.form-legend { font-size: 0.95rem; font-weight: 600; padding: 10px 0 0; margin: 0; }
.site-nav { margin-left: auto; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a { color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: 0.95rem; white-space: nowrap; }
.site-nav a:hover { background: var(--paper-2); color: var(--ink); }
@media (max-width: 720px) {
  .site-head .wrap { height: auto; flex-wrap: wrap; gap: 0; padding-top: 8px; }
  .site-nav { margin: 0 -10px; width: calc(100% + 20px); padding-bottom: 4px; }
}

/* ---------- Hero / Splittingrechner ---------- */
.hero { padding: 48px 0 40px; border-bottom: 1px solid var(--rule); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 48px; align-items: start; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; } }

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4.6vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 750;
  margin: 0 0 16px;
}
.lede { font-size: 1.15rem; color: var(--ink-2); margin: 0 0 28px; max-width: 34em; }

/* Formularfelder im Stil eines Steuerformulars */
.form-block { border-top: 2px solid var(--ink); padding-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-bottom: 1px solid var(--rule); }
.form-row.single { grid-template-columns: 1fr; }
.field { padding: 10px 12px 12px 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form-row > .field + .field { padding-left: 14px; border-left: 1px solid var(--rule); }
.field > span:first-child { font-size: 0.85rem; color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.swatch.a { background: var(--a); }
.swatch.b { background: var(--b); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input { padding-right: 32px; }
.input-wrap::after { content: "€"; position: absolute; right: 12px; color: var(--ink-3); pointer-events: none; }
input[type="text"], input[type="number"], select {
  width: 100%;
  font: inherit;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-field);
  padding: 9px 12px;
  min-height: 46px;
}
select { font-size: 1.05rem; cursor: pointer; }
input:focus, select:focus { outline: none; border-color: var(--form); box-shadow: 0 0 0 3px var(--form-soft); }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.form-note { font-size: 0.85rem; color: var(--ink-3); margin: 12px 0 0; }

/* Ergebnis: die Splitting-Grafik */
.result {
  background: var(--field);
  border: 1px solid var(--rule);
  border-radius: var(--radius-panel);
  padding: 28px 28px 22px;
}
@media (max-width: 560px) { .result { padding: 20px 16px 16px; } }
.result-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 4px; }
.result-head p { margin: 0; color: var(--ink-2); font-size: 0.98rem; }
.vorteil {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6.5vw, 4.4rem);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin: 6px 0 22px;
  color: var(--gain);
}
.vorteil.null { color: var(--ink-3); }

.split-viz { display: grid; gap: 10px; margin-bottom: 22px; }
.viz-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: center; }
@media (max-width: 480px) { .viz-row { grid-template-columns: minmax(0, 1fr); gap: 4px; } }
.viz-label { font-size: 0.85rem; color: var(--ink-2); line-height: 1.25; }
.viz-track { display: flex; flex-direction: column; gap: 4px; }
.bar-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar { flex: none; height: 22px; border-radius: 0 4px 4px 0; display: flex; overflow: hidden; min-width: 2px; transition: width 320ms cubic-bezier(.2,.7,.2,1); }
@media (prefers-reduced-motion: reduce) { .bar { transition: none; } }
.bar i { display: block; height: 100%; }
.bar .fa { background: var(--a); }
.bar .fb { background: var(--b); }
.bar .fa + .fb { box-shadow: -2px 0 0 var(--field); }
.bar-val { font-size: 0.82rem; line-height: 1.25; color: var(--ink-2); min-width: 0; font-variant-numeric: tabular-nums; }
.viz-sep { border: 0; border-top: 1px dashed var(--rule-strong); margin: 4px 0 2px; }

.compare { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.compare th, .compare td { padding: 7px 0 7px 10px; border-bottom: 1px solid var(--rule); text-align: right; }
.compare td.num { white-space: nowrap; }
.compare th:first-child, .compare td:first-child { text-align: left; padding-right: 12px; }
.compare thead th { font-weight: 500; color: var(--ink-3); font-size: 0.82rem; }
.compare tfoot td { border-bottom: 0; border-top: 2px solid var(--ink); font-weight: 650; }
.compare td.gain { color: var(--gain); }
.compare .muted { color: var(--ink-3); }
@media (max-width: 480px) {
  .compare { font-size: 0.8rem; }
  .compare th, .compare td { padding-left: 5px; }
  .compare .swatch { display: none; }
}

/* ---------- Abschnitte ---------- */
.section { padding: 64px 0; border-bottom: 1px solid var(--rule); }
.section:last-of-type { border-bottom: 0; }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 32px; align-items: end; margin-bottom: 28px; }
@media (max-width: 720px) { .section-head { grid-template-columns: minmax(0, 1fr); } }
h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 720;
  margin: 0 0 8px;
}
.section-head p { margin: 0; color: var(--ink-2); max-width: 44em; }
h3 { font-size: 1.25rem; letter-spacing: -0.01em; line-height: 1.25; margin: 36px 0 8px; font-weight: 680; }
h4 { font-size: 1.05rem; margin: 24px 0 4px; }

/* Tabelle */
.table-controls { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); margin-bottom: 18px; }
.table-controls .field { padding: 10px 14px 12px; border-left: 1px solid var(--rule); }
.table-controls .field:first-child { border-left: 0; padding-left: 0; }
@media (max-width: 860px) {
  .table-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-controls .field { border-left: 0; padding-left: 0; border-bottom: 1px solid var(--rule); }
  .table-controls .field:nth-child(even) { border-left: 1px solid var(--rule); padding-left: 14px; }
  .table-controls .field:last-child { border-bottom: 0; }
}
.table-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.table-actions p { margin: 0; font-size: 0.9rem; color: var(--ink-3); }

.btn {
  font: inherit; font-size: 0.95rem; font-weight: 560;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; min-height: 42px;
  border-radius: 6px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--rule-strong); background: var(--field); color: var(--ink);
}
.btn:hover { border-color: var(--form); color: var(--form); }
.btn.primary { background: var(--form); border-color: var(--form); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #06130e; } }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary:hover { color: #06130e; } }
.btn svg { width: 18px; height: 18px; }

.table-scroll { overflow: auto; max-height: 70vh; border: 1px solid var(--rule); border-radius: var(--radius-panel); background: var(--field); }
.st-table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; font-size: 0.95rem; min-width: 760px; }
.st-table th, .st-table td { padding: 7px 14px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--rule); }
.st-table thead th { position: sticky; top: 0; z-index: 1; background: var(--paper-2); font-weight: 560; font-size: 0.82rem; color: var(--ink-2); line-height: 1.3; vertical-align: bottom; border-bottom: 1px solid var(--rule-strong); }
.st-table th:first-child, .st-table td:first-child { text-align: right; position: sticky; left: 0; background: var(--field); font-weight: 600; }
.st-table thead th:first-child { background: var(--paper-2); z-index: 2; }
.st-table tbody tr:nth-child(5n) td { border-bottom-color: var(--rule-strong); }
.st-table tbody tr:hover td { background: var(--form-soft); }
.st-table td.sum { font-weight: 650; }
.st-table .grp { border-left: 1px solid var(--rule); }

/* Diagramm */
.chart-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 32px; align-items: start; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: minmax(0, 1fr); } }
.chart-box { position: relative; background: var(--field); border: 1px solid var(--rule); border-radius: var(--radius-panel); padding: 16px 12px 8px 4px; }
.chart-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.88rem; color: var(--ink-2); margin: 0 0 8px 52px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { width: 18px; height: 0; border-top: 2px solid; display: inline-block; }
.chart-legend .l-split { border-color: var(--a); }
.chart-legend .l-grund { border-color: var(--ink-2); }
.chart-legend .l-grenz { border-color: var(--ink-3); border-top-style: dashed; }
#chart svg { display: block; width: 100%; height: auto; overflow: visible; }
#chart .grid line { stroke: var(--rule); stroke-width: 1; }
#chart .axis text { fill: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
#chart .s-split { stroke: var(--a); }
#chart .s-grund { stroke: var(--ink-2); }
#chart .s-grenz { stroke: var(--ink-3); stroke-dasharray: 5 4; stroke-width: 1.5; }
#chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; }
#chart .line.s-grenz { stroke-width: 1.5; }
#chart .cross { stroke: var(--ink-3); stroke-width: 1; }
#chart .dot { stroke: var(--field); stroke-width: 2; }
#chart .dot-split { fill: var(--a); }
#chart .dot-grund { fill: var(--ink-2); }
#chart .dot-grenz { fill: var(--ink-3); }
#chart .lbl { font-size: 12px; font-weight: 600; fill: var(--ink-2); }
#chart .s-grenz-t { fill: var(--ink-3); font-weight: 500; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--ink); color: var(--paper);
  border-radius: 6px; padding: 8px 10px; font-size: 0.82rem; line-height: 1.45;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  opacity: 0; transition: opacity 120ms;
}
.tooltip.on { opacity: 1; }
.tooltip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

.eckwerte { margin: 0; border-top: 2px solid var(--ink); }
.eckwerte div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 0.95rem; }
.eckwerte dt { color: var(--ink-2); }
.eckwerte dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.eckwerte-title { font-size: 1rem; margin: 0 0 8px; }

/* Downloads */
.dl-grid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 800px) { .dl-grid { grid-template-columns: minmax(0, 1fr); } }
.dl-main {
  display: block; text-decoration: none; color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: var(--radius-panel);
  background: var(--field); padding: 22px; position: relative; overflow: hidden;
}
.dl-main::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: linear-gradient(90deg, var(--a) 0 50%, var(--b) 50% 100%); }
.dl-main:hover { border-color: var(--form); }
.dl-main strong { display: block; font-family: var(--font-display); font-size: 2rem; letter-spacing: -0.02em; line-height: 1.1; margin: 8px 0 6px; }
.dl-main span { color: var(--ink-2); font-size: 0.92rem; }
.dl-main .btn { margin-top: 16px; }
.dl-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); column-gap: 20px; border-top: 1px solid var(--rule); }
.dl-list a b { font-size: 1.1rem; }
.dl-list li { border-bottom: 1px solid var(--rule); }
.dl-list a { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 11px 12px 11px 0; text-decoration: none; color: var(--ink); }
.dl-list a:hover { color: var(--form); }
.dl-list a b { font-weight: 620; font-variant-numeric: tabular-nums; }
.dl-list a small { color: var(--ink-3); font-size: 0.8rem; }
.dl-note { font-size: 0.88rem; color: var(--ink-3); margin: 14px 0 0; }

/* Ratgeber */
.guide { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 56px; align-items: start; }
@media (max-width: 900px) { .guide { grid-template-columns: minmax(0, 1fr); gap: 16px; } }
.toc { position: sticky; top: 84px; font-size: 0.92rem; }
@media (max-width: 900px) { .toc { position: static; border: 1px solid var(--rule); border-radius: var(--radius-panel); padding: 14px 16px; } }
.toc p { font-weight: 650; margin: 0 0 6px; }
.toc ol { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--rule); }
.toc li a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.toc li a:hover { color: var(--ink); border-left-color: var(--rule-strong); }
.toc li a.active { color: var(--form); border-left-color: var(--form); }
.prose { max-width: 70ch; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; }
.prose li { margin-bottom: 4px; }
.prose h3 { scroll-margin-top: 80px; }
.prose .hint { background: var(--form-soft); border-left: 3px solid var(--form); padding: 12px 16px; border-radius: 0 6px 6px 0; }
.prose table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 0.95rem; margin: 0 0 16px; }
.prose th, .prose td { text-align: left; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose td.r, .prose th.r { text-align: right; }
.prose thead th { font-weight: 560; color: var(--ink-2); font-size: 0.85rem; border-bottom-color: var(--rule-strong); }
.formula { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.9rem; white-space: nowrap; }

/* Weitere Rechner */
.links-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 40px; }
@media (max-width: 800px) { .links-grid { grid-template-columns: minmax(0, 1fr); } }
.link-list { list-style: none; margin: 0; padding: 0; columns: 2 240px; column-gap: 32px; }
.link-list li { break-inside: avoid; border-bottom: 1px solid var(--rule); }
.link-list a { display: block; padding: 10px 0; text-decoration: none; color: var(--ink); }
.link-list a span { display: block; font-size: 0.85rem; color: var(--ink-3); }
.link-list a:hover { color: var(--form); }
.promo { border: 1px solid var(--rule); border-radius: var(--radius-panel); padding: 20px; background: var(--field); display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; }
.promo img { width: 96px; height: auto; }
.promo p { margin: 0 0 8px; font-size: 0.95rem; color: var(--ink-2); }
.promo strong { color: var(--ink); display: block; font-size: 1.05rem; }

/* Werbung */
.ad { margin: 0 auto; padding: 24px 0; }
.ad-label { font-size: 0.75rem; color: var(--ink-3); margin: 0 0 4px; }
.ad-local { border: 1px dashed var(--rule-strong); border-radius: 6px; background: var(--ad-bg); color: var(--ink-3); font-size: 0.85rem; text-align: center; padding: 30px 12px; }

/* Fuß */
.site-foot { background: var(--paper-2); border-top: 1px solid var(--rule); padding: 36px 0 44px; font-size: 0.92rem; color: var(--ink-2); }
.foot-grid { display: flex; flex-wrap: wrap; gap: 16px 40px; justify-content: space-between; }
.site-foot p { margin: 0 0 6px; }
.site-foot a { color: var(--ink-2); }
.site-foot a:hover { color: var(--form); }

/* Druck: nur die Steuertabelle */
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body { background: #fff; color: #000; font-size: 10pt; }
  .site-head, .hero, .ad, .site-foot, .section:not(#tabelle), .table-controls, .table-actions, .noprint { display: none !important; }
  #tabelle { padding: 0; border: 0; }
  #tabelle .section-head p { display: none; }
  .print-title { display: block !important; font-size: 14pt; margin: 0 0 6pt; }
  .table-scroll { max-height: none; overflow: visible; border: 0; }
  .st-table { min-width: 0; font-size: 8.5pt; }
  .st-table th, .st-table td { padding: 2pt 6pt; }
  .st-table thead { display: table-header-group; }
  .st-table thead th, .st-table td:first-child { position: static; background: #fff !important; }
  .st-table tbody tr:nth-child(even) td { background: #f2f2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-foot { display: block !important; font-size: 8pt; margin-top: 6pt; }
}
.print-title, .print-foot { display: none; }
