/* --- Fonts (selbst gehostet, OFL) --- */
@font-face { font-family: "Fraunces"; font-weight: 600; font-display: swap;
  src: url("fonts/Fraunces-SemiBold.be790b114597.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap;
  src: url("fonts/IBMPlexSans-Regular.77bc02670657.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap;
  src: url("fonts/IBMPlexSans-SemiBold.196e3cbc5fee.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap;
  src: url("fonts/IBMPlexMono-Regular.79936b18df9f.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; font-display: swap;
  src: url("fonts/IBMPlexMono-SemiBold.5a2ce7798732.woff2") format("woff2"); }

/* --- Tokens: hell (Amtlicher Bescheid) --- */
:root {
  --paper: #F1EEE3; --surface: #FAF8F0; --ink: #1A2333; --muted: #6B6656;
  --line: #D8D2BF; --line-input: #C9C2AE;
  --akzent: #A8331E; --akzent-weich: #EFE7D3; --auf-akzent: #FFFFFF; --fehler: #A8331E;
  --fs-display: clamp(2.75rem, 6vw, 4.5rem);
  --fs-h1: clamp(1.6rem, 3vw, 2.2rem);
  --display: "Fraunces", Georgia, serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
/* Bewusst nur Hell-Modus: Das Tool rendert immer im „Amtlicher Bescheid"-
   Papierlook, unabhängig von der Betriebssystem-Einstellung (kein Dunkelmodus). */

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body); line-height: 1.6; }

.topbar { display: flex; align-items: baseline; gap: .9rem;
  padding: 1rem clamp(1rem, 4vw, 2.5rem); border-bottom: 1px solid var(--line); }
.brand { font-family: var(--display); font-weight: 600; font-size: 1.25rem;
  text-decoration: none; color: var(--ink); letter-spacing: -.01em; }
.brand .dot { color: var(--akzent); }
.brand-claim { font-size: .8rem; color: var(--muted); letter-spacing: .04em; }

main { max-width: 1040px; margin: 0 auto; padding: clamp(1.25rem, 4vw, 2.5rem); }
h1 { font-family: var(--display); font-weight: 600; font-size: var(--fs-h1);
  letter-spacing: -.01em; margin: 0 0 .35rem; }
.lead { color: var(--muted); margin: 0 0 1.75rem; max-width: 46ch; }

/* Zweispaltiges Rechner-Layout ab 900px; Formular links, Ergebnis sticky rechts */
.rechner-huelle { display: grid; gap: clamp(1.25rem, 3vw, 2rem);
  grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) {
  .rechner-huelle { grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); }
  #ergebnis { position: sticky; top: 1.5rem; }
}

/* Formular */
form { background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: clamp(1rem, 3vw, 1.5rem); }
label { display: block; margin: .9rem 0 .3rem; font-weight: 600; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
input, select, textarea { width: 100%; padding: .55rem .65rem; font: inherit; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line-input); border-radius: 5px;
  font-family: var(--mono); font-size: .85rem; }
.hilfe { display: block; font-size: .78rem; color: var(--muted); margin-top: .3rem;
  font-weight: 400; text-transform: none; letter-spacing: 0; font-family: var(--body); }
.feldreihe { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .feldreihe { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: .9rem 0 0; padding: .8rem; }
legend { padding: 0 .4rem; font-weight: 600; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
button, .btn { font-family: var(--body); font-weight: 600; font-size: .88rem;
  cursor: pointer; border-radius: 7px; border: none; padding: .65rem 1.2rem;
  background: var(--akzent); color: var(--auf-akzent); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line-input); }

/* Formular-Chips (Wochentage + Umfrage-Radios) — ersetzt kaputte Checkbox-/Radio-Darstellung */
.tage { display: flex; gap: .5rem; flex-wrap: wrap; margin: .3rem 0 1.1rem; }
.tage label {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 2.6rem; height: 2.6rem; margin: 0; border-radius: 7px;
  border: 1.5px solid var(--line-input); font-family: var(--mono); font-weight: 600;
  font-size: .82rem; text-transform: none; letter-spacing: 0; color: var(--muted);
  cursor: pointer; user-select: none; background: var(--paper);
}
.tage input[type="checkbox"] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tage label:has(input:checked) { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); }
.tage label:has(input:focus-visible) { outline: 2px solid var(--akzent); outline-offset: 2px; }

.chips { display: flex; flex-direction: column; gap: .5rem; margin: .3rem 0 1.1rem; }
.chips label {
  position: relative; display: flex; align-items: center; gap: .6rem; margin: 0;
  padding: .55rem .8rem; border-radius: 7px; border: 1.5px solid var(--line-input);
  font-family: var(--body); font-weight: 400; font-size: .88rem; text-transform: none;
  letter-spacing: 0; color: var(--ink); cursor: pointer; background: var(--paper);
}
.chips input[type="radio"], .chips input[type="checkbox"] {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chips label::before { content: ""; flex: 0 0 auto; width: 1rem; height: 1rem;
  border-radius: 50%; border: 1.5px solid var(--line-input); }
.chips label:has(input:checked) { border-color: var(--akzent); background: var(--akzent-weich); }
.chips label:has(input:checked)::before { border-color: var(--akzent); background: var(--akzent);
  box-shadow: inset 0 0 0 3px var(--paper); }
.chips label:has(input:focus-visible) { outline: 2px solid var(--akzent); outline-offset: 2px; }

.einwilligung { display: flex; align-items: flex-start; gap: .5rem; margin: 1.1rem 0 0;
  text-transform: none; letter-spacing: 0; font-weight: 400; font-size: .88rem; color: var(--ink); }
.einwilligung input { width: auto; margin-top: .2rem; flex: 0 0 auto; }

/* Belege (bewegliche Ferientage) */
.beleg { border: 1px dashed var(--line-input); border-radius: 8px; padding: .9rem 1rem; margin-top: 1.2rem; }
.beleg legend { padding: 0 .4rem; }
.beweglich-zeile { display: flex; justify-content: space-between; align-items: center;
  gap: .6rem; padding: .4rem 0; border-bottom: 1px dotted var(--line); font-family: var(--mono); font-size: .85rem; }
.hinweis { font-size: .83rem; color: var(--muted); margin: 0 0 .7rem; }

/* --- Ergebnis-Karte: Aktenzeichen, Stempel, Ledger --- */
.ergebnis-karte { position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: clamp(1.2rem, 3vw, 1.7rem); }
.az { font-family: var(--mono); font-size: .72rem; color: var(--muted); margin: 0 0 .9rem; }
.stempel { position: absolute; top: 1.3rem; right: 1.4rem; border: 2px solid var(--akzent);
  color: var(--akzent); font-family: var(--display); font-weight: 600; font-size: .68rem;
  text-transform: uppercase; letter-spacing: .07em; padding: .3rem .55rem;
  transform: rotate(4deg); border-radius: 4px; }
.ergebnis-karte h2 { font-family: var(--body); font-weight: 600; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0; }
.ergebnis-karte .W { font-family: var(--mono); font-weight: 600;
  font-variant-numeric: tabular-nums; font-size: var(--fs-display); line-height: 1;
  letter-spacing: -.01em; color: var(--ink); margin: .25rem 0 1rem; }
.ergebnis-karte details { border-top: 1px dotted var(--line); padding-top: .75rem; }
.ergebnis-karte summary { cursor: pointer; font-weight: 600; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ergebnis-karte ul { list-style: none; padding: 0; margin: .75rem 0 0;
  font-family: var(--mono); font-size: .8rem; font-variant-numeric: tabular-nums; }
.ergebnis-karte li { display: flex; justify-content: space-between; gap: 1rem;
  padding: .35rem 0; border-bottom: 1px dotted var(--line); }
.disclaimer { font-size: .78rem; color: var(--muted); margin-top: 1.25rem; line-height: 1.5; }
.cta { margin-top: 1.5rem; padding: 1rem 1.1rem; background: var(--akzent-weich);
  border-radius: 8px; }
.cta p { margin: 0 0 .4rem; font-weight: 600; font-family: var(--body); }
.cta-link { display: inline-block; font-weight: 600; text-decoration: none;
  color: var(--auf-akzent); background: var(--akzent); padding: .55rem 1rem; border-radius: 7px; }
.fehler { color: var(--fehler); font-weight: 600; }
.erfolg { color: var(--akzent); font-weight: 600; }

.umlage { margin: .25rem 0 1.25rem; }
.umlage-zeile { display: grid; grid-template-columns: 10rem 1fr auto; align-items: center;
  gap: .6rem; padding: .25rem 0; }
.umlage-label { font-size: .78rem; color: var(--muted); font-family: var(--body); }
.umlage-spur { height: 10px; background: var(--line); border-radius: 3px; overflow: hidden; }
.umlage-balken { display: block; height: 100%; border-radius: 3px;
  transform-origin: left center; animation: umlage-wachsen .5s ease-out both; }
.umlage-balken.n { background: var(--muted); }
.umlage-balken.w { background: var(--ink); }
.umlage-wert { font-variant-numeric: tabular-nums; font-weight: 600; font-size: .85rem;
  font-family: var(--mono); }
.umlage-fazit { margin: .5rem 0 0; font-size: .85rem; color: var(--ink); font-family: var(--body); }
.umlage-fazit .marke { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px;
  background: var(--akzent); margin-right: .4rem; vertical-align: middle; }
.umlage-fazit strong { color: var(--akzent); font-family: var(--mono); }
@keyframes umlage-wachsen { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
  .umlage-balken { animation: none; }
}

/* --- Mobil (schmale Screens) --- */
@media (max-width: 480px) {
  /* Umlage-Zeile stapeln: Label über voller Balkenbreite statt fixe 10rem-Spalte */
  .umlage-zeile { grid-template-columns: 1fr auto; }
  .umlage-label { grid-column: 1 / -1; }
  /* Stempel nicht mehr absolut (kein Überlappen der Aktenzeichen-Zeile) */
  .stempel { position: static; display: inline-block; transform: none; margin-bottom: .7rem; }
}
