/* besoldung-aktuell.de | Gestaltung: Papier, Tinte, ein Stempel. Keine Fremdschriften, keine Verläufe. */

:root {
  color-scheme: light dark;
  --papier: #f4f1ea;
  --blatt: #fffdf8;
  --tinte: #15171c;
  --tinte-2: #4b505b;
  --tinte-3: #767b86;
  --linie: #d8d2c3;
  --linie-2: #e9e4d8;
  --gruen: #0e4a40;
  --gruen-hell: #e3ede9;
  --stempel: #b3261e;
  --fuss: #15171c;
  --pfeil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2315171c' stroke-width='1.6'/%3E%3C/svg%3E");
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --breite: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--papier);
  color: var(--tinte);
  font: 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gruen); text-underline-offset: 3px; }
a:hover { color: var(--tinte); }
:focus-visible { outline: 3px solid var(--gruen); outline-offset: 2px; }

.rahmen { width: 100%; max-width: var(--breite); margin-inline: auto; padding-inline: clamp(16px, 4vw, 40px); }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sprung { position: absolute; left: -999px; top: 8px; background: var(--tinte); color: var(--papier); padding: 10px 14px; z-index: 50; }
.sprung:focus { left: 8px; }

/* ---------- Kopf ---------- */

.kopf { border-bottom: 1px solid var(--tinte); }
.kopf-innen { display: flex; align-items: center; gap: 12px 28px; flex-wrap: wrap; padding-block: 14px; }
.marke { display: block; line-height: 0; }
.marke img { display: block; height: 38px; width: auto; }
.kopf-nav { display: flex; gap: 4px 20px; flex-wrap: wrap; font-size: 0.92rem; }
.kopf-nav a { color: var(--tinte); text-decoration: none; padding-block: 4px; border-bottom: 1px solid transparent; }
.kopf-nav a:hover { border-bottom-color: var(--tinte); }
.kopf-hinweis { margin: 0 0 0 auto; font-size: 0.8rem; color: var(--tinte-2); }

/* ---------- Auftakt ---------- */

.auftakt { padding-block: clamp(28px, 6vw, 64px) clamp(20px, 3vw, 32px); }
.dachzeile { margin: 0 0 14px; font-size: 0.82rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gruen); font-weight: 600; }
h1 { margin: 0; max-width: 21ch; font: 700 clamp(2rem, 5.2vw, 3.5rem)/1.06 var(--serif); letter-spacing: -0.02em; text-wrap: balance; }
.vorspann { margin: 20px 0 0; max-width: 62ch; font-size: clamp(1.02rem, 1.6vw, 1.16rem); color: var(--tinte-2); }
.lage { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-wrap: wrap; border-top: 1px solid var(--linie); border-bottom: 1px solid var(--linie); font-size: 0.92rem; }
.lage li { padding: 10px 28px 10px 0; margin-right: 28px; border-right: 1px solid var(--linie); }
.lage li:last-child { border-right: 0; margin-right: 0; }
.lage b { display: block; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tinte-3); font-weight: 600; }

/* ---------- Rechner ---------- */

.rechner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 430px); gap: clamp(24px, 4vw, 56px); align-items: start; padding-block: clamp(16px, 3vw, 32px) clamp(40px, 6vw, 72px); }

.formular { display: grid; gap: 0; min-width: 0; }
.schritt { border: 0; border-top: 1px solid var(--tinte); margin: 0; padding: 22px 0 30px; min-width: 0; }
.schritt > legend, .annahmen > summary { padding: 0; font: 700 1.32rem/1.2 var(--serif); display: flex; align-items: baseline; gap: 14px; width: 100%; }
.schritt > legend { float: left; margin-bottom: 18px; }
.schritt > legend + * { clear: both; }
.nr { font: 400 0.95rem/1 var(--sans); color: var(--tinte-3); font-variant-numeric: tabular-nums; min-width: 1.1em; }
.annahmen > summary { cursor: pointer; list-style: none; }
.annahmen > summary::-webkit-details-marker { display: none; }
.annahmen > summary::after { content: "+"; margin-left: auto; font: 400 1.5rem/1 var(--sans); color: var(--tinte-2); }
.annahmen[open] > summary::after { content: "\2212"; }
.annahmen[open] > summary { margin-bottom: 18px; }
.annahmen { border-bottom: 1px solid var(--tinte); padding-bottom: 22px; }

.reihe { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px 20px; }
.reihe + .feld, .feld + .reihe, .feld + .feld, .reihe + .reihe, .reihe + .haken { margin-top: 20px; }
.reihe > .feld + .feld { margin-top: 0; }
.feld { min-width: 0; }
.feld > label, .feldtitel { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 7px; }
.feldhinweis { margin: 7px 0 0; font-size: 0.82rem; line-height: 1.45; color: var(--tinte-2); max-width: 60ch; }

select, input[type="number"] {
  width: 100%; height: 48px; padding: 0 12px;
  font: inherit; color: var(--tinte);
  background: var(--blatt); border: 1px solid var(--tinte); border-radius: 2px;
  font-variant-numeric: tabular-nums;
}
select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: var(--pfeil);
  background-repeat: no-repeat; background-position: right 13px center; }

/* Auswahlfelder als Formularkästen, nicht als Pillen */
.wahl { display: grid; gap: 0; border: 1px solid var(--tinte); border-radius: 2px; background: var(--blatt); overflow: hidden; }
.wahl-5 { grid-template-columns: repeat(5, 1fr); }
.wahl-3 { grid-template-columns: repeat(3, 1fr); }
.wahl-2 { grid-template-columns: repeat(2, 1fr); }
.wahl label { position: relative; display: block; cursor: pointer; border-left: 1px solid var(--tinte); }
.wahl label:first-child { border-left: 0; }
.wahl input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.wahl span { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px 10px; text-align: center; font-size: 0.92rem; line-height: 1.25; }
.wahl input:checked + span { background: var(--tinte); color: var(--blatt); font-weight: 600; }
.wahl input:focus-visible + span { outline: 3px solid var(--gruen); outline-offset: -3px; }
.wahl label:hover input:not(:checked) + span { background: var(--gruen-hell); }

.zaehler { display: inline-grid; grid-template-columns: 48px 64px 48px; border: 1px solid var(--tinte); border-radius: 2px; background: var(--blatt); }
.zaehler button { height: 46px; border: 0; background: none; font: 400 1.4rem/1 var(--sans); color: var(--tinte); cursor: pointer; }
.zaehler button:hover:not(:disabled) { background: var(--gruen-hell); }
.zaehler button:disabled { color: var(--linie); cursor: default; }
.zaehler output { display: grid; place-items: center; border-inline: 1px solid var(--tinte); font: 700 1.2rem/1 var(--serif); font-variant-numeric: tabular-nums; }

.kinder-liste { display: grid; gap: 10px; margin-top: 14px; }
.kinder-liste:empty { display: none; }
.kind { display: grid; grid-template-columns: 74px 1fr 1fr; gap: 12px; align-items: end; padding: 12px; background: var(--linie-2); border-radius: 2px; }
.kind-nr { font-weight: 600; font-size: 0.9rem; padding-bottom: 13px; }
.kind label { display: grid; gap: 5px; font-size: 0.8rem; color: var(--tinte-2); min-width: 0; }
.kind select { height: 44px; }

.haken { display: flex; gap: 12px; align-items: flex-start; font-size: 0.95rem; cursor: pointer; }
.haken input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--tinte); flex: none; }

/* ---------- Abrechnung ---------- */

.blatt { position: sticky; top: 20px; background: var(--blatt); border: 1px solid var(--tinte); padding: 26px 26px 22px; box-shadow: 7px 7px 0 var(--linie); overflow: hidden; }
.blatt-kopf { margin: 0; font-size: 0.76rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tinte-2); font-weight: 600; }
.summe { margin: 10px 0 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.summe span { font: 700 clamp(2.3rem, 4.4vw, 3rem)/1 var(--serif); letter-spacing: -0.02em; font-variant-numeric: tabular-nums lining-nums; }
.summe small { font-size: 0.95rem; color: var(--tinte-2); }
.summe-zeile { margin: 6px 0 0; font-size: 0.85rem; color: var(--tinte-2); min-height: 1.3em; }

.stempel { position: absolute; top: 22px; right: -6px; transform: rotate(7deg); border: 2px solid var(--stempel); color: var(--stempel); padding: 5px 16px 4px 10px; font: 700 0.78rem/1.1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; text-align: center; opacity: 0.9; border-radius: 3px; }
.stempel small { display: block; font-size: 0.56rem; letter-spacing: 0.1em; font-weight: 600; margin-top: 2px; }

.posten { width: 100%; border-collapse: collapse; margin-top: 20px; font-size: 0.93rem; }
.posten th, .posten td { padding: 10px 0; border-top: 1px solid var(--linie); vertical-align: top; text-align: left; font-weight: 400; }
.posten td { text-align: right; white-space: nowrap; padding-left: 14px; font-variant-numeric: tabular-nums; font-weight: 600; }
.posten th small { display: block; margin-top: 2px; font-size: 0.78rem; color: var(--tinte-2); line-height: 1.35; }
.posten th small i { font-style: normal; font-weight: 600; color: var(--gruen); margin-right: 4px; }
.posten .leer td { text-align: left; white-space: normal; font-weight: 400; color: var(--tinte-2); padding-left: 0; }
.posten tfoot tr:first-child th, .posten tfoot tr:first-child td { border-top: 3px double var(--tinte); font-weight: 700; font-size: 1.02rem; padding-top: 12px; }
.posten tfoot tr + tr th, .posten tfoot tr + tr td { border-top: 0; padding-top: 0; color: var(--tinte-2); font-weight: 400; }
.posten tfoot tr + tr td { font-weight: 600; color: var(--tinte); }
#netto-satz { font-size: 0.8rem; }

.danach { margin: 18px 0 0; padding: 12px 14px; background: var(--gruen-hell); font-size: 0.9rem; line-height: 1.45; border-left: 3px solid var(--gruen); }
.hinweise p { margin: 12px 0 0; font-size: 0.84rem; line-height: 1.45; color: var(--tinte-2); }
.hinweise b { color: var(--tinte); }
.blatt-fuss { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--linie); font-size: 0.8rem; line-height: 1.45; color: var(--tinte); }
.blatt-knoepfe { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.blatt-knoepfe button { flex: 1 1 auto; min-height: 44px; padding: 8px 14px; font: 600 0.86rem/1.2 var(--sans); color: var(--tinte); background: transparent; border: 1px solid var(--tinte); border-radius: 2px; cursor: pointer; }
.blatt-knoepfe button:hover { background: var(--tinte); color: var(--blatt); }
.blatt-daten { margin: 12px 0 0; font-size: 0.76rem; color: var(--tinte-3); }

.ohne-js { padding-block: 16px; font-weight: 600; }

/* ---------- Textabschnitte ---------- */

.text { padding-block: clamp(36px, 6vw, 64px); border-top: 1px solid var(--tinte); }
.text h2 { margin: 0 0 18px; font: 700 clamp(1.6rem, 3.4vw, 2.3rem)/1.12 var(--serif); letter-spacing: -0.015em; max-width: 24ch; text-wrap: balance; }
.text h3 { margin: 34px 0 10px; font: 700 1.22rem/1.25 var(--serif); max-width: 40ch; }
.text p { margin: 0 0 14px; max-width: 70ch; }
.text .klein { font-size: 0.86rem; color: var(--tinte-2); }

.tabellenhalter { overflow-x: auto; margin-top: 22px; -webkit-overflow-scrolling: touch; border: 1px solid var(--tinte); background: var(--blatt); }
.regeln { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 0.93rem; }
.regeln th, .regeln td { padding: 12px 14px; text-align: left; vertical-align: top; border-top: 1px solid var(--linie); }
.regeln thead th { border-top: 0; border-bottom: 1px solid var(--tinte); font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tinte-2); font-weight: 600; white-space: nowrap; }
.regeln tbody th { font-weight: 600; min-width: 190px; }
.regeln tbody th small { display: block; font-weight: 400; font-size: 0.8rem; color: var(--gruen); margin-top: 2px; }
.beispiele td { font-variant-numeric: tabular-nums; white-space: nowrap; }
.beispiele td:nth-child(4) { font-weight: 700; }
.beispiele tbody th { font-weight: 400; min-width: 250px; }
.beispiele tbody th b { display: block; font-weight: 600; }

.zeitleiste { list-style: none; margin: 26px 0 0; padding: 0; max-width: 860px; }
.zeitleiste li { display: grid; grid-template-columns: 170px 1fr; gap: 20px; padding: 13px 0; border-top: 1px solid var(--linie); }
.zeitleiste time { font: 700 1rem/1.4 var(--serif); font-variant-numeric: tabular-nums; }
.zeitleiste .jetzt { border-top: 1px solid var(--tinte); border-bottom: 1px solid var(--tinte); }
.zeitleiste .jetzt time { color: var(--stempel); }

.liste { margin: 0; padding: 0; list-style: none; max-width: 74ch; }
.liste li { position: relative; padding: 9px 0 9px 22px; border-top: 1px solid var(--linie); }
.liste li::before { content: ""; position: absolute; left: 2px; top: 1.15em; width: 8px; height: 1px; background: var(--tinte); }
.quellen li { overflow-wrap: anywhere; }

.fragen { max-width: 860px; border-bottom: 1px solid var(--linie); }
.fragen details { border-top: 1px solid var(--linie); }
.fragen summary { cursor: pointer; list-style: none; padding: 15px 34px 15px 0; position: relative; font: 700 1.08rem/1.3 var(--serif); }
.fragen summary::-webkit-details-marker { display: none; }
.fragen summary::after { content: "+"; position: absolute; right: 4px; top: 12px; font: 400 1.4rem/1 var(--sans); color: var(--tinte-2); }
.fragen details[open] summary::after { content: "\2212"; }
.fragen details p { margin: 0 0 18px; max-width: 68ch; color: var(--tinte-2); }

/* ---------- Fuß und Leiste ---------- */

.fuss { border-top: 1px solid var(--tinte); background: var(--fuss); color: #d9d6cd; font-size: 0.86rem; }
.fuss-innen { display: flex; gap: 16px 40px; flex-wrap: wrap; justify-content: space-between; padding-block: 26px calc(26px + env(safe-area-inset-bottom)); }
.fuss p { margin: 0; max-width: 62ch; }
.fuss b { color: #fff; }
.fuss nav { display: flex; gap: 22px; }
.fuss a { color: #fff; }

.leiste { display: none; }

/* ---------- Schmale Bildschirme ---------- */

@media (max-width: 940px) {
  .rechner { grid-template-columns: minmax(0, 1fr); }
  .blatt { position: relative; top: auto; }
  .kopf-hinweis { margin-left: 0; flex-basis: 100%; }
  .leiste { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--tinte); color: var(--blatt); text-decoration: none; font-size: 0.92rem; }
  .leiste b { font: 700 1.12rem/1 var(--serif); font-variant-numeric: tabular-nums; margin-inline: 4px; }
  .leiste-ziel { border: 1px solid var(--blatt); padding: 7px 11px; border-radius: 2px; font-size: 0.82rem; white-space: nowrap; }
  .leiste:hover { color: var(--blatt); }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .kopf-nav { display: none; }
  .wahl-5 { grid-template-columns: repeat(2, 1fr); }
  .wahl-5 label { border-left: 0; border-top: 1px solid var(--tinte); }
  .wahl-5 label:nth-child(-n+2) { border-top: 0; }
  .wahl-5 label:nth-child(even) { border-left: 1px solid var(--tinte); }
  .wahl-5 label:last-child { grid-column: 1 / -1; }
  .auftakt { padding-top: 22px; }
  .dachzeile { margin-bottom: 10px; font-size: 0.74rem; }
  .vorspann { margin-top: 14px; }
  .lage { display: grid; margin-top: 18px; font-size: 0.86rem; }
  .lage li { display: flex; gap: 10px; align-items: baseline; border-right: 0; margin-right: 0; padding: 7px 0; border-top: 1px solid var(--linie-2); }
  .lage li:first-child { border-top: 0; }
  .lage b { display: inline-block; flex: none; width: 92px; }
  .kind { grid-template-columns: 1fr 1fr; }
  .kind-nr { grid-column: 1 / -1; padding-bottom: 0; }
  .blatt { padding: 22px 18px 18px; box-shadow: 4px 4px 0 var(--linie); }
  .stempel { top: 16px; right: -8px; }
  .zeitleiste li { grid-template-columns: 1fr; gap: 2px; }
}

@media (max-width: 380px) {
  .wahl-3 span { font-size: 0.84rem; padding-inline: 4px; }
}

/* ---------- Druck: nur die Abrechnung ---------- */

@media print {
  body { background: #fff; font-size: 12pt; }
  .kopf-nav, .formular, .text, .leiste, .blatt-knoepfe, .sprung, .lage, .vorspann, .fuss nav { display: none !important; }
  .rechner { display: block; padding: 0; }
  .blatt { position: static; box-shadow: none; border: 1px solid #000; }
  .fuss { background: #fff; color: #000; border-top: 1px solid #000; }
  .fuss b { color: #000; }
  h1 { font-size: 20pt; max-width: none; }
  .auftakt { padding-block: 0 12pt; }
}

.blatt.beispiel .summe span { color: var(--tinte-3); }
.blatt.beispiel .summe-zeile { color: var(--stempel); font-weight: 600; }

/* Tabellen auf dem Handy: Bausteine als Stapel, Beispiele auf die wichtigen Spalten gekürzt */
@media (max-width: 640px) {
  .regeln { min-width: 0; }
  .regeln:not(.beispiele) thead { display: none; }
  .regeln:not(.beispiele) tr { display: block; padding: 14px 14px 12px; border-top: 1px solid var(--linie); }
  .regeln:not(.beispiele) tr:first-child { border-top: 0; }
  .regeln:not(.beispiele) th, .regeln:not(.beispiele) td { display: block; padding: 0; border: 0; min-width: 0; }
  .regeln:not(.beispiele) td { margin-top: 6px; }
  .regeln:not(.beispiele) td:nth-child(3) { font-weight: 600; }
  .regeln:not(.beispiele) td:nth-child(4) { font-size: 0.8rem; color: var(--tinte-2); }
  .regeln:not(.beispiele) td:nth-child(4)::before { content: "Im Rechner: "; }
  .beispiele th:nth-child(2), .beispiele td:nth-child(2), .beispiele th:nth-child(3), .beispiele td:nth-child(3), .beispiele th:nth-child(5), .beispiele td:nth-child(5) { display: none; }
  .beispiele tbody th { min-width: 0; }
  .beispiele th, .beispiele td { padding: 12px; }
  .beispiele td { text-align: right; }
  .beispiele thead th:nth-child(4) { text-align: right; }
}

/* Rechtsseiten */
.recht { border-top: 0; }
.recht h1 { max-width: none; font-size: clamp(2rem, 4.4vw, 2.8rem); margin-bottom: 28px; }
.recht h2 { font-size: 1.22rem; margin: 30px 0 8px; max-width: none; }

/* Logo im Fuß */
.fuss-logo { display: block; width: 250px; height: auto; flex: none; }
.fuss-innen { align-items: center; }
@media (max-width: 640px) { .marke img { height: 32px; } .fuss-logo { width: 220px; } }

/* Dunkelmodus: folgt der Systemeinstellung */
@media (prefers-color-scheme: dark) {
  :root {
    --papier: #121419;
    --blatt: #1b1e26;
    --tinte: #efebe1;
    --tinte-2: #b9bcc6;
    --tinte-3: #8b909c;
    --linie: #3a3e4b;
    --linie-2: #262a34;
    --gruen: #7fd0b9;
    --gruen-hell: #173630;
    --stempel: #ff8274;
    --fuss: #0a0b0e;
    --pfeil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23efebe1' stroke-width='1.6'/%3E%3C/svg%3E");
  }
  .blatt { box-shadow: 7px 7px 0 #07080a; }
  .fuss { border-top-color: var(--linie); }
  .zaehler button:disabled { color: var(--tinte-3); opacity: 0.45; }
}
@media print { :root { --papier: #fff; --blatt: #fff; --tinte: #000; --tinte-2: #333; --tinte-3: #555; --linie: #bbb; --gruen: #0e4a40; --gruen-hell: #eee; --stempel: #b3261e; } .marke img { height: 30px; } }

/* Steuerzeilen in der Abrechnung */
.posten tfoot th span { display: block; margin-top: 2px; font-size: 0.78rem; font-weight: 400; color: var(--tinte-2); line-height: 1.35; }
.posten tfoot tr + tr th, .posten tfoot tr + tr td { padding-top: 8px; }
.marke img { height: 44px; }
@media (max-width: 640px) { .marke img { height: 34px; } }
