/* Hausstil work!visionX, zurückhaltend (MAZ-10). Ziel WCAG 2.2 AA, ab 320 px ohne waagerechtes Scrollen.
   Schrift Montserrat, selbst gehostet (SIL Open Font License, schrift/OFL.txt). Keine externen Ressourcen.
   Kontraste auf Weiß (gerechnet nach WCAG): Petrol #1E4E5E 9,1:1, Text #1B2B31 14,6:1, leise #4A5C63 7,0:1,
   Feldrand #687B82 4,4:1. Türkis #2CA8B8 (2,8:1) und Orange #F08535 (2,6:1) nur für Linien und Flächen,
   nie als Textfarbe auf Weiß; dunkler Text auf Orange 5,7:1. */
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/schrift/montserrat-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/schrift/montserrat-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/schrift/montserrat-latin-700-normal.woff2") format("woff2"); }

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

:root {
  --petrol: #1E4E5E;
  --tuerkis: #2CA8B8;
  --orange: #F08535;
  --text: #1B2B31;
  --grund: #ffffff;
  --leise: #4A5C63;
  --flaeche: #F5F8F9;
  --linie: #E5EAEC;
  --rand: #687B82;      /* Eingabefelder: 4,4:1 auf Weiß */
  --gewaehlt: #E6F3F5;
  --fehler: #A4001D;
  --ok: #1E6B3A;
}

html { font-size: 100%; }
body {
  margin: 0;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  color: var(--text);
  background: var(--grund);
  overflow-wrap: anywhere;
  display: flex; flex-direction: column; min-height: 100vh;
}

main { width: 100%; max-width: 40rem; margin: 0 auto; padding: 1rem; flex: 1 0 auto; }
.verwaltung main { max-width: 56rem; }
h1, h2, h3 { color: var(--petrol); font-weight: 700; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0.75rem 0 1rem; }
h2 { font-size: 1.25rem; line-height: 1.3; margin: 1.75rem 0 0.75rem; }
h3 { font-size: 1.05rem; }
a { color: var(--petrol); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

/* Kopfleiste: Betrieb im Vordergrund */
.leiste { background: var(--flaeche); border-bottom: 3px solid var(--tuerkis); }
.leiste-innen { max-width: 40rem; margin: 0 auto; padding: 0.6rem 1rem; }
.verwaltung .leiste-innen, .verwaltung .fuss-innen { max-width: 56rem; }
.leiste p { margin: 0; }
.leiste-titel { font-weight: 600; color: var(--petrol); }
.leiste-titel a { text-decoration: none; }
.leiste-titel a:hover { text-decoration: underline; }
.leise { color: var(--leise); font-weight: 400; }
.betrieb-kopf { color: var(--petrol); font-size: 1.05rem; }
.betrieb-kopf strong { font-weight: 700; }
.kopf { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; }
.kopf form button { margin-top: 0; }

/* Fuß: work!visionX dezent */
.fuss { border-top: 1px solid var(--linie); margin-top: 2rem; color: var(--leise); font-size: 0.875rem; }
.fuss-innen { max-width: 40rem; margin: 0 auto; padding: 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; justify-content: space-between; }
.fuss-logo { display: block; width: 120px; height: auto; }
.fuss a { color: var(--leise); }

/* Hinweis im Formular */
.hinweistext { background: var(--flaeche); border-left: 4px solid var(--tuerkis); border-radius: 0 6px 6px 0; padding: 0.75rem 1rem; margin-bottom: 1.5rem; }
.hinweistext p { margin: 0.35rem 0; }
.kernsatz { font-weight: 600; }
summary { cursor: pointer; color: var(--petrol); font-weight: 600; padding: 0.6rem 0; text-decoration: underline; text-underline-offset: 0.15em; }
summary:hover { text-decoration-thickness: 2px; }
details[open] summary { margin-bottom: 0.25rem; }

/* Felder */
label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.pflicht, .optional { font-weight: 400; color: var(--leise); }
.feld { margin-bottom: 1.25rem; }
input[type="text"], input[type="url"], input[type="email"], input:not([type]), textarea, input[type="password"], input[type="date"], input[type="number"], select {
  display: block; max-width: 100%;
  font: inherit; color: inherit; background: var(--grund);
  border: 2px solid var(--rand); border-radius: 6px; padding: 0.55rem 0.7rem;
}
input[type="text"], input[type="url"], input[type="email"], input[type="password"], textarea { width: 100%; }
textarea { resize: vertical; min-height: 6rem; }
#code { text-transform: uppercase; letter-spacing: 0.08em; max-width: 22rem; }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.auswahl { margin-bottom: 1.5rem; }
fieldset.auswahl legend { font-weight: 600; margin-bottom: 0.4rem; padding: 0; }

/* Kacheln für „Wie oft?“ und „Wie lange?“: zwei Spalten ab 320 px, echte Radio-Buttons */
.kacheln { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.kacheln label {
  font-weight: 400; display: flex; align-items: center; gap: 0.55rem;
  min-height: 2.75rem; padding: 0.45rem 0.65rem; margin: 0;
  border: 1px solid var(--rand); border-radius: 6px; background: var(--grund); cursor: pointer;
}
.kacheln label:hover { background: var(--flaeche); }
.kacheln label:has(input:checked) { border: 2px solid var(--petrol); background: var(--gewaehlt); padding: calc(0.45rem - 1px) calc(0.65rem - 1px); font-weight: 600; }
input[type="radio"] { width: 1.25rem; height: 1.25rem; margin: 0; flex: none; accent-color: var(--petrol); }
input[type="checkbox"] { width: 1.25rem; height: 1.25rem; margin: 0; flex: none; accent-color: var(--petrol); }

/* Schaltflächen */
button {
  font: inherit; font-weight: 600; cursor: pointer;
  min-height: 2.75rem; padding: 0.5rem 1.25rem; margin-top: 0.5rem;
  color: #fff; background: var(--petrol); border: 2px solid var(--petrol); border-radius: 6px;
}
button:hover { background: #163C49; border-color: #163C49; }
button.zweitrangig { color: var(--petrol); background: var(--grund); }
button.zweitrangig:hover { background: var(--flaeche); }
button.gefahr { background: var(--fehler); border-color: var(--fehler); }
button.gross { font-size: 1.1rem; padding: 0.7rem 1.75rem; }
button:disabled { opacity: 0.6; cursor: wait; }
fieldset:disabled { opacity: 0.75; }

/* Sichtbarer Fokus: Orange außen, Petrol als Ring für den Kontrast */
:focus-visible, h2[tabindex="-1"]:focus {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--petrol);
}

.hilfe { color: var(--leise); font-size: 0.9rem; margin: 0.3rem 0 0; }
.hinweis { margin: 0.5rem 0; }
.hinweis-fehler { color: var(--fehler); font-weight: 600; margin: 0.5rem 0; }
.hinweis-ok { background: #E8F5EC; border-left: 4px solid var(--ok); padding: 0.5rem 0.75rem; }

/* Bestätigung nach dem Senden */
.bestaetigung { background: var(--gewaehlt); border-left: 4px solid var(--tuerkis); border-radius: 0 6px 6px 0; padding: 0.5rem 1rem 1rem; }
.bestaetigung h2 { margin-top: 0.75rem; }

.unsichtbar {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

[hidden] { display: none !important; }

/* Verwaltung */
.zeile { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.zeile .feld { margin-bottom: 0.5rem; }
.karte, .rahmen { border: 1px solid var(--linie); border-top: 3px solid var(--tuerkis); border-radius: 6px; padding: 0.75rem 1rem; margin-bottom: 1rem; background: var(--grund); }
.karte h2, .karte h3, .rahmen h2 { margin: 0.25rem 0 0.5rem; }
.karte h2, .rahmen h2 { font-size: 1.15rem; }
.aktionen { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.aktionen form { margin: 0; }
.code-anzeige { background: var(--flaeche); border-left: 4px solid var(--orange); padding: 0.75rem 1rem; margin: 1rem 0; }
.code-anzeige .code { font-family: ui-monospace, Consolas, monospace; font-size: 1.5rem; letter-spacing: 0.08em; }
.code-anzeige img { display: block; max-width: 100%; height: auto; background: #fff; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
th { color: var(--petrol); border-bottom: 2px solid var(--tuerkis); }
.tabelle { overflow-x: auto; }
.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; }

/* Prüfansicht (MAZ-5): links Meldungen, rechts Entwurf; schmal untereinander */
.pruefung { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 60rem) { .pruefung { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.pruefung .spalte { min-width: 0; }
.pruefung textarea, .pruefung input[type=text], .pruefung input:not([type]), .pruefung select { width: 100%; max-width: 100%; box-sizing: border-box; }
.pruefung fieldset { border: 1px solid var(--linie); border-radius: 6px; padding: .5rem .75rem; margin: .5rem 0; }
.pruefung details { margin-top: .75rem; }
.pruefung .idee { border-left: 3px solid var(--tuerkis); padding-left: .5rem; margin: .5rem 0; }
.status-offen { color: #8A4B00; }
.status-nv { color: var(--leise); }
form.inline { display: inline; }
.vorschau { border: 1px dashed var(--rand); border-radius: 6px; padding: .5rem 1rem; }
.liste { list-style: none; padding: 0; }
code, .code { overflow-wrap: anywhere; word-break: break-all; }
.hinweis-loeschung { color: var(--leise); }
/* Zugeklappte Inhalte nicht im Layout (Chromium legt sie sonst unsichtbar über andere Elemente) */
details:not([open]) > :not(summary) { display: none; }
