/* Gehaltsrechner – schlicht, gut lesbar, hell und dunkel */
:root {
  --bg: #f5f6f8;
  --flaeche: #ffffff;
  --text: #1c2330;
  --leise: #5b6576;
  --linie: #dfe3ea;
  --akzent: #1f5fbf;
  --akzent-text: #ffffff;
  --akzent-zart: #e8f0fc;
  --gut: #1d7a46;
  --gut-zart: #e6f4ec;
  --schlecht: #b42318;
  --schlecht-zart: #fdecea;
  --radius: 12px;
  --schatten: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
  --serie-1: #2a78d6;
  --serie-2: #eb6834;
  --gitter: #e8ebf0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151c;
    --flaeche: #1a2029;
    --text: #e6e9ef;
    --leise: #9aa4b5;
    --linie: #2c3441;
    --akzent: #6ea3f2;
    --akzent-text: #0d1524;
    --akzent-zart: #1d2b42;
    --gut: #5cc28a;
    --gut-zart: #16301f;
    --schlecht: #f08a7e;
    --schlecht-zart: #3a1c1a;
    --schatten: none;
    --serie-1: #3987e5;
    --serie-2: #d95926;
    --gitter: #262d38;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
a { color: var(--akzent); }
h1, h2 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }

/* Rahmen */
.rahmen { display: flex; min-height: 100vh; }
.seitenleiste {
  width: 230px; flex-shrink: 0; padding: 1.25rem 1rem;
  background: var(--flaeche); border-right: 1px solid var(--linie);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
}
.marke { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; margin: 0 .5rem 1.25rem; }
.seitenleiste ul { list-style: none; margin: 0; padding: 0; flex: 1; }
.seitenleiste a:not(.marke) {
  display: flex; gap: .65rem; align-items: center; padding: .55rem .6rem; border-radius: 8px;
  color: var(--text); text-decoration: none;
}
.seitenleiste a:not(.marke):hover { background: var(--bg); }
.seitenleiste a[aria-current="page"] { background: var(--akzent-zart); color: var(--akzent); font-weight: 600; }
.icon { width: 1.2em; text-align: center; }
main { flex: 1; min-width: 0; padding: 2rem clamp(1rem, 3vw, 2.5rem) 3rem; max-width: 1200px; }
.leiste-unten { display: none; }

@media (max-width: 860px) {
  .seitenleiste { display: none; }
  main { padding: 1.25rem 1rem 6rem; }
  .leiste-unten {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
    background: var(--flaeche); border-top: 1px solid var(--linie);
    padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
  }
  .leiste-unten a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem;
    font-size: .72rem; color: var(--leise); text-decoration: none; padding: .3rem 0;
  }
  .leiste-unten a .icon { font-size: 1.15rem; }
  .leiste-unten a[aria-current="page"] { color: var(--akzent); font-weight: 600; }
}

/* Bausteine */
.kopfzeile { margin-bottom: 1.25rem; }
.untertitel { color: var(--leise); margin: 0; }
.karte {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--schatten);
}
.karte.hervor { border-color: var(--akzent); background: var(--akzent-zart); }
.zweispaltig { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 1rem; align-items: start; }
.zweispaltig > .karte { margin: 0; }
@media (max-width: 1050px) { .zweispaltig { grid-template-columns: 1fr; } }

.kennzahlen { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kennzahlen.kompakt { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kennzahl {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 1rem; display: flex; flex-direction: column; gap: .15rem;
}
.karte .kennzahl { background: var(--bg); border: none; }
.kennzahl .titel { color: var(--leise); font-size: .85rem; }
.kennzahl .wert { font-size: 1.45rem; font-weight: 700; }
.kennzahl.haupt .wert { color: var(--akzent); }
.kennzahl .zusatz { color: var(--leise); font-size: .8rem; }

/* Formulare */
fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; }
legend { font-weight: 650; margin-bottom: .6rem; padding: 0; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--leise); }
.raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: .75rem; }
.raster.drei { grid-template-columns: 2fr 1fr 1fr; }
@media (max-width: 520px) { .raster.drei { grid-template-columns: 1fr 1fr; } .raster.drei label:first-child { grid-column: 1 / -1; } }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--flaeche);
  border: 1px solid var(--linie); border-radius: 8px; padding: .55rem .65rem; min-height: 2.6rem; width: 100%;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }
label.haken { flex-direction: row; align-items: center; gap: .55rem; color: var(--text); margin-bottom: .5rem; }
label.haken input { width: 1.15rem; height: 1.15rem; min-height: 0; flex-shrink: 0; }
details.aufklapp { border-top: 1px solid var(--linie); padding-top: .85rem; }
details.aufklapp > summary { font-weight: 650; margin-bottom: .85rem; }
details.aufklapp > summary .klein { font-weight: 400; }
.feldtitel { font-size: .9rem; color: var(--leise); margin: .5rem 0; }
.wochentage { display: flex; flex-wrap: wrap; gap: .4rem; }
.wochentage .tag { flex-direction: row; }
.wochentage input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wochentage span {
  display: inline-block; min-width: 2.8rem; text-align: center; padding: .45rem .5rem;
  border: 1px solid var(--linie); border-radius: 8px; color: var(--text); cursor: pointer;
}
.wochentage input:checked + span { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.wochentage input:focus-visible + span { outline: 2px solid var(--akzent); outline-offset: 1px; }
.aktionen { display: flex; gap: .5rem; align-items: end; }

.knopf {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: .6rem 1rem; min-height: 2.6rem;
  border: 1px solid var(--linie); background: var(--flaeche); color: var(--text); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.knopf.haupt { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.knopf.leise { border-color: transparent; background: transparent; color: var(--leise); }
.knopf.breit { width: 100%; }
.knopf.gefahr { background: var(--schlecht); border-color: var(--schlecht); color: #fff; }
.konto { display: flex; flex-direction: column; gap: .25rem; padding: 0 .5rem; }
.konto .knopf { padding-left: 0; justify-content: flex-start; }
.marke-klein { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .45rem; border-radius: 99px; margin-left: .35rem; background: var(--bg); color: var(--leise); vertical-align: middle; }
.marke-klein.admin { background: var(--akzent-zart); color: var(--akzent); }
.marke-klein.status-gesperrt { background: var(--schlecht-zart); color: var(--schlecht); }
.marke-klein.status-eingeladen { background: var(--gut-zart); color: var(--gut); }
.konto-karte { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.aktionen-reihe { display: flex; flex-wrap: wrap; gap: .4rem; align-items: flex-start; }
.aktionen-reihe form { margin: 0; }
details.loeschen > summary { list-style: none; }
details.loeschen > summary::-webkit-details-marker { display: none; }
details.loeschen[open] { flex-basis: 100%; }
.link-feld code, .umbruch { display: block; overflow-wrap: anywhere; background: var(--flaeche); padding: .6rem .75rem; border-radius: 8px; border: 1px solid var(--linie); user-select: all; }
.qr { display: block; width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 8px; margin: .5rem 0; }
.schritt { border-top: 1px solid var(--linie); padding-top: .75rem; }
.schritt p { margin: 0 0 .25rem; }
form.inline { display: flex; gap: .4rem; align-items: center; }
form.inline input { width: auto; }

.meldung { padding: .7rem .9rem; border-radius: 8px; background: var(--akzent-zart); margin: 0 0 1rem; }
.meldung.ok { background: var(--gut-zart); color: var(--gut); }
.meldung.fehler { background: var(--schlecht-zart); color: var(--schlecht); }
.klein { font-size: .82rem; color: var(--leise); }
.block { display: block; }

/* Tabellen: Zahlen rechtsbündig, lange Begriffe trennen, notfalls horizontal blättern */
.tabelle-rahmen { overflow-x: auto; margin: .5rem 0 1rem; }
.tabelle { width: 100%; border-collapse: collapse; }
.tabelle caption { text-align: left; font-weight: 650; padding-bottom: .4rem; }
.tabelle th, .tabelle td { padding: .5rem .4rem; border-bottom: 1px solid var(--linie); text-align: left; font-weight: 400; vertical-align: top; }
.tabelle thead th { color: var(--leise); font-size: .82rem; }
.tabelle tbody th { hyphens: auto; overflow-wrap: anywhere; }
.tabelle tfoot th, .tabelle tfoot td { font-weight: 700; border-bottom: 0; }
@media (max-width: 520px) {
  .tabelle { font-size: .88rem; }
  .tabelle th, .tabelle td { padding: .45rem .25rem; }
  .karte { padding: 1rem .85rem; }
}
.zahl { text-align: right !important; white-space: nowrap; }
.minus { color: var(--schlecht); }
details summary { cursor: pointer; color: var(--akzent); }
.feiertage { list-style: none; padding: 0; columns: 2 220px; }
.feiertage span { display: inline-block; min-width: 5.8rem; color: var(--leise); }
.liste-links { margin: 0; padding-left: 1.1rem; }
.eintraege { list-style: none; padding: 0; margin: 0 0 1rem; }
.eintraege li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--linie); flex-wrap: wrap; }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .4rem; padding: 0; list-style: none; }

/* Login */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.login-karte {
  width: 100%; max-width: 380px; background: var(--flaeche); border: 1px solid var(--linie);
  border-radius: var(--radius); padding: 1.75rem; box-shadow: var(--schatten);
}
.login-karte.breit { max-width: 460px; }
.login-karte form { display: flex; flex-direction: column; gap: .85rem; }
.trenner { display: flex; align-items: center; gap: .75rem; color: var(--leise); font-size: .85rem; margin: 1rem 0; }
.trenner::before, .trenner::after { content: ""; flex: 1; border-top: 1px solid var(--linie); }

.htmx-request #ergebnis, #ergebnis.htmx-request { opacity: .6; transition: opacity .2s; }

/* Belege */
.beleg-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
@media (max-width: 1050px) { .beleg-layout { grid-template-columns: 1fr; } }
.vorschau-bild { width: 100%; height: auto; max-width: 420px; border-radius: 8px; border: 1px solid var(--linie); background: #fff; }
.ocr { max-height: 28rem; overflow: auto; white-space: pre-wrap; font-size: .8rem; background: var(--bg); padding: .75rem; border-radius: 8px; }
.vorschlag { font-size: .78rem; color: var(--gut); }
.vorschlag.leer { color: var(--leise); }
.feld-zeile { overflow-wrap: anywhere; }
.status-ok { color: var(--gut); font-weight: 600; }
.status-abw { color: var(--schlecht); font-weight: 600; }
.liste-belege .zahl { white-space: nowrap; }

/* Diagramme */
.diagramm-rahmen { position: relative; margin: .5rem 0; }
.diagramm { width: 100%; height: auto; display: block; overflow: visible; }
.diagramm .gitter { stroke: var(--gitter); stroke-width: 1; }
.diagramm .tick { stroke: var(--linie); }
.diagramm .achse { fill: var(--leise); font-size: 12px; }
.diagramm .linie { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.diagramm .serie-1 { stroke: var(--serie-1); }
.diagramm .serie-2 { stroke: var(--serie-2); }
.diagramm .punkt { stroke: var(--flaeche); stroke-width: 2; }
.diagramm .punkt.serie-1 { fill: var(--serie-1); }
.diagramm .punkt.serie-2 { fill: var(--serie-2); }
.diagramm .endlabel { fill: var(--text); font-size: 12px; font-weight: 600; }
.diagramm .endwert { fill: var(--leise); font-weight: 400; }
.diagramm .hover-flaeche { fill: transparent; cursor: crosshair; touch-action: pan-y; }
.diagramm .fadenkreuz { stroke: var(--leise); stroke-width: 1; stroke-dasharray: 3 3; }
.tooltip { position: absolute; top: 0; min-width: 160px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; padding: .45rem .6rem; font-size: .82rem; box-shadow: 0 4px 12px rgb(0 0 0 / 12%); pointer-events: none; }
.tooltip strong { display: block; margin-bottom: .15rem; }
.legende { display: flex; gap: 1rem; list-style: none; padding: 0; margin: .25rem 0; font-size: .85rem; color: var(--leise); }
.marke { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: .4rem; vertical-align: middle; }
.marke.serie-1 { background: var(--serie-1); }
.marke.serie-2 { background: var(--serie-2); }
.raten { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; list-style: none; padding: 0; margin: .5rem 0; }
.raten span { color: var(--leise); margin-right: .25rem; }
.raster.posten { grid-template-columns: 1.2fr 2fr 1fr 1.1fr; border-bottom: 1px solid var(--linie); padding-bottom: .75rem; }
@media (max-width: 700px) { .raster.posten { grid-template-columns: 1fr 1fr; } }
label.schmal { max-width: 240px; margin-bottom: .75rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tabelle td form { margin: 0; }
.tabelle td .knopf { min-height: 0; padding: .1rem .4rem; }

/* Szenarien und Verhandlung */
.vergleich th:first-child { min-width: 11rem; position: sticky; left: -1px; padding-left: calc(.4rem + 1px); background: var(--flaeche); z-index: 1; }
.vergleich td, .vergleich thead th:not(:first-child) { min-width: 6.5rem; }
@media (max-width: 520px) { .vergleich th:first-child { min-width: 8rem; max-width: 8rem; } }
.vergleich thead th a { color: var(--text); }
.vergleich tr.betont th, .vergleich tr.betont td { font-weight: 700; }
.szenario-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 0; margin: .25rem 0 .9rem; }
.chips li { font-size: .8rem; padding: .15rem .55rem; border-radius: 99px; background: var(--akzent-zart); color: var(--akzent); }
.auswahl { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin-bottom: .5rem; }
.anker { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.anker .kennzahl .zusatz.klein { margin-top: .2rem; }
form.mini { margin-top: .4rem; }
form.mini .knopf { padding: 0; min-height: 0; font-size: .82rem; color: var(--akzent); }
.argumente { margin: 0; padding-left: 1.1rem; }
.argumente li { margin-bottom: .5rem; }
textarea { font: inherit; resize: vertical; }

/* Bericht und Druck */
.bericht-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.bericht-block { margin-bottom: 1.5rem; }
.bericht-block h2 { border-bottom: 2px solid var(--linie); padding-bottom: .3rem; }
.tabelle.kompakt th { color: var(--leise); }
.tabelle tr.betont th, .tabelle tr.betont td { font-weight: 700; }
.herleitung { margin: .25rem 0 0; padding-left: 1.2rem; font-size: .9rem; }
.quelle { margin-top: 2rem; }

@page { size: A4; margin: 14mm 14mm 16mm; }
@media print {
  :root {
    --bg: #fff; --flaeche: #fff; --text: #000; --leise: #444; --linie: #ccc; --gitter: #e5e5e5;
    --akzent: #1f5fbf; --akzent-zart: #fff; --gut: #1d7a46; --schlecht: #b42318;
    --serie-1: #2a78d6; --serie-2: #eb6834; color-scheme: light;
  }
  body { font-size: 10.5pt; background: #fff; }
  .seitenleiste, .leiste-unten, .nicht-drucken, .tooltip { display: none !important; }
  .rahmen { display: block; min-height: 0; }
  main { padding: 0; max-width: none; }
  .bericht-block { break-inside: avoid; }
  .tabelle-rahmen { overflow: visible; }
  a { color: inherit; text-decoration: none; }
  .diagramm { max-height: 75mm; }
}
