/* Gestaltung der Website-Seiten (Konzept 07, 20 §4.7). Farben und Schrift wie im Planer (style.css: --grund, --flaeche,
   --tinte, --leise, --linie, --akzent), dazu die dunkle Fassung. Keine fremden Schriften, keine Bilder von außen.
   Die Paare aus Schrift- und Grundfarbe erfüllen Kontrast AA (4,5 : 1); eine Prüfung rechnet sie nach. */
:root {
  --grund: #f3f1ec;
  --flaeche: #ffffff;
  --tinte: #1f1e1c;
  --leise: #6d6a64;
  --linie: #dedad2;
  --rand: #8a867e;            /* Ränder von Feldern und Knöpfen: 3 : 1 gegen die Fläche */
  --akzent: #2f7a68;
  --akzent-tief: #245f51;     /* Akzent als Schrift auf hellem Akzentgrund */
  --akzent-hell: #e3efeb;
  --auf-akzent: #ffffff;
  --gefahr: #a8442f;
  --gefahr-hell: #f8e9e5;
  --warnung-hell: #fbf1d6;
  --boden: #e6dccb;
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--tinte);
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #1b1a18;
    --flaeche: #262522;
    --tinte: #efece6;
    --leise: #aaa69e;
    --linie: #3b3935;
    --rand: #7d7971;
    --akzent: #6fbfab;
    --akzent-tief: #8fd2c0;
    --akzent-hell: #24372f;
    --auf-akzent: #14201c;
    --gefahr: #e99a86;
    --gefahr-hell: #3a2620;
    --warnung-hell: #383020;
    --boden: #3a352c;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--grund); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--akzent); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }
[hidden] { display: none !important; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.95em; }

/* ---------- Gerüst: Sprungmarke, Kopfzeile, Inhalt, Fußzeile */
.sprung { position: absolute; left: 8px; top: -60px; background: var(--flaeche); color: var(--tinte); padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--rand); z-index: 10; }
.sprung:focus { top: 8px; }
.kopf { background: var(--flaeche); border-bottom: 1px solid var(--linie); padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.marke { font-weight: 600; color: var(--tinte); text-decoration: none; padding: 8px 0; }
.kopf-wege { display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; }
.kopf-wege a { padding: 8px 0; }
.kopf-wege form { margin: 0; }
.kopf-name { color: var(--leise); max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inhalt { width: 100%; max-width: 960px; margin: 0 auto; padding: 32px 16px 64px; flex: 1 0 auto; }
.fuss { border-top: 1px solid var(--linie); padding: 16px; }
.fuss nav { max-width: 960px; margin: 0 auto; display: flex; gap: 4px 20px; flex-wrap: wrap; font-size: 0.9rem; }
.fuss a { color: var(--leise); padding: 8px 0; }

/* ---------- Schrift */
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 12px; overflow-wrap: anywhere; }
h2 { font-size: 1.2rem; line-height: 1.3; margin: 0 0 8px; }
h3 { font-size: 1.05rem; line-height: 1.3; margin: 0 0 4px; }
p { margin: 0 0 12px; }
.einleitung { color: var(--leise); max-width: 40em; font-size: 1.05rem; }
.leise, .hilfe { color: var(--leise); font-size: 0.9rem; }
.hilfe { margin: 4px 0 0; }
.abschnitt { margin: 40px 0 4px; }
.zurueck { margin: 0 0 12px; font-size: 0.9rem; }
.nur-vorlesen { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.aufzaehlung { margin: 0 0 12px; padding-left: 1.2em; }
.aufzaehlung li { margin-bottom: 4px; }

/* ---------- Knöpfe (Haupt, Neben, Gefahr) */
.knopf { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid var(--rand); background: var(--flaeche); color: var(--tinte); border-radius: var(--radius); padding: 9px 16px; text-decoration: none; font: inherit; cursor: pointer; }
.knopf:hover { border-color: var(--tinte); }
.knopf.haupt { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); font-weight: 600; }
.knopf.haupt:hover { filter: brightness(0.94); }
.knopf.klein { padding: 5px 12px; min-height: 36px; }
.knopf.gefahr { border-color: var(--gefahr); color: var(--gefahr); }
.knopf[disabled] { opacity: 0.55; cursor: not-allowed; }
.knopfreihe { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; margin-top: 20px; }
.knopfreihe form { margin: 0; }
.knopfreihe.oben { margin: 0 0 24px; }

/* ---------- Karten, Hinweise */
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 24px; }
.karte.block { margin: 0 0 16px; }
.karte.block > :last-child, .hinweisbox > :last-child { margin-bottom: 0; }
.schmal { max-width: 30em; margin: 0 auto; }
.schmal.breiter { max-width: 36em; }
.hinweisbox { background: var(--akzent-hell); border: 1px solid var(--linie); border-left: 4px solid var(--akzent); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 16px; max-width: 44em; }
.hinweisbox a { color: var(--akzent-tief); }     /* der Akzent selbst hätte auf dem hellen Grund zu wenig Kontrast */
.hinweisbox.warnung { background: var(--warnung-hell); border-left-color: var(--rand); }
.hinweisbox.fehler { background: var(--gefahr-hell); border-left-color: var(--gefahr); }
.hinweisbox.erfolg { border-left-color: var(--akzent); }
section.hinweisbox { padding: 20px 24px; margin-top: 40px; }

/* ---------- Formulare: Feld mit Beschriftung, Hilfe und Fehlertext */
.feld { margin: 0 0 16px; }
.feld label { display: block; font-weight: 600; margin-bottom: 4px; }
.feld input { width: 100%; font: inherit; color: var(--tinte); background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: 10px 12px; min-height: 44px; }
.feld input[type="file"] { padding: 8px; }
.haken { display: grid; grid-template-columns: 24px 1fr; column-gap: 8px; align-items: start; margin: 0 0 16px; }
.haken input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--akzent); }
.haken .hilfe, .haken .fehlertext { grid-column: 2; }
.hinweisbox .haken { margin: 0; }
.mit-fehler input { border-color: var(--gefahr); border-width: 2px; }
.fehlertext { color: var(--gefahr); font-size: 0.9rem; margin: 4px 0 0; }
.zeile { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.zeile .feld { margin: 0; flex: 1 1 16em; }
.zeile .feld:has(.hilfe) + .knopf, .zeile .feld:has(.fehlertext) + .knopf { align-self: flex-start; margin-top: 28px; }

/* ---------- Tabelle (Geräte, Versionen, hochgeladene Pläne)
   Überschriften, Datum und Knöpfe brechen nie um. Nur Spalten mit Namen der Nutzer (`td.lang`) dürfen umbrechen,
   zur Not mitten im Wort. Unter 640 px wird jede Zeile zu einem Block (siehe „schmale Bildschirme“). */
.tabelle { width: 100%; border-collapse: collapse; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); }
.tabelle th, .tabelle td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--linie); vertical-align: middle; white-space: nowrap; }
.tabelle td.lang { white-space: normal; overflow-wrap: anywhere; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle form { margin: 0; }
.tabelle .aktionen .knopf + .knopf { margin-left: 8px; }
.marke-klein { font-size: 0.8rem; color: var(--akzent-tief); background: var(--akzent-hell); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.angaben { display: grid; grid-template-columns: minmax(6em, auto) 1fr; gap: 8px 24px; margin: 0 0 16px; }
.angaben dt { font-weight: 600; }
.angaben dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Kontingent für Erkennungen */
.kontingent { font-weight: 600; margin: 0 0 4px; }
.kontingent.gesperrt { color: var(--gefahr); }
.kontingent-hinweis { max-width: 40em; margin: 0 0 16px; padding: 10px 12px; border: 1px solid var(--gefahr); border-radius: var(--radius); background: var(--flaeche); }

/* ---------- Meine Wohnungen: Kopf, Erkennungen, Karten mit Vorschaubild */
.seitenkopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.seitenkopf .knopfreihe { margin-top: 0; }
.seitenkopf h1 { margin-bottom: 4px; }
.erkennungen { margin: 0 0 32px; }
.auftragsliste, .wohnungsliste { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.auftrag { padding: 16px 20px; }
.auftrag form { margin: 8px 0 0; }
.auftrag .knopfreihe { margin-top: 8px; }
.auftrag .knopfreihe form { margin: 0; }
.auftrag.gescheitert { border-color: var(--gefahr); }
.auftrag-kopf { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; overflow-wrap: anywhere; }
.auftrag-stand { color: var(--leise); }
.auftrag-zeile { margin: 6px 0 0; overflow-wrap: anywhere; }
.fortschritt { display: block; width: 100%; height: 8px; margin-top: 10px; accent-color: var(--akzent); }
.mit-skript .ohne-skript { display: none; }
.wohnung { padding: 16px 20px; display: flex; gap: 20px; align-items: flex-start; }
.wohnung.einfach { display: block; }
.wohnung.ohne-raum { border-color: var(--gefahr); }      /* Erkennung ohne Raum: lässt sich nicht öffnen */
.wohnung p { margin: 4px 0 0; }
.wohnung .knopfreihe { margin-top: 12px; }
.wohnung-text { flex: 1 1 0; min-width: 0; }
.wohnung-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
.wohnung-kopf h2, .wohnung-kopf h3 { overflow-wrap: anywhere; margin: 0; }
.vorschau { flex: 0 0 160px; display: block; border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; background: #ffffff; line-height: 0; }
.vorschau img, .vorschau svg { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; }
.vorschau.gross { max-width: 480px; margin: 0 0 24px; }
.aufklappen > summary { list-style: none; }
.aufklappen > summary::-webkit-details-marker { display: none; }
.aufklappen[open] { flex-basis: 100%; }
.aufklappen .zeile { margin-top: 12px; }

/* ---------- Startseite */
.auftakt { padding: 24px 0 8px; }
.auftakt h1 { font-size: 2.2rem; max-width: 16em; }
.bildfolge { list-style: none; margin: 40px 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.bildfolge figure { margin: 0; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 12px; height: 100%; }
.bildfolge figcaption { color: var(--leise); font-size: 0.9rem; margin-top: 8px; }
.bildfolge img { display: block; width: 100%; height: auto; border-radius: 4px; }
.abschnitt-block { margin: 40px 0 0; }
.schritte { list-style: none; counter-reset: schritt; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.schritte li { counter-increment: schritt; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 16px 20px; }
.schritte li::before { content: counter(schritt); display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--akzent); color: var(--auf-akzent); font-weight: 600; margin-bottom: 8px; }
.schritte p { margin: 0; color: var(--leise); }

/* Zeichnung (eigenes SVG) für Wohnungen ohne Vorschaubild; Farben aus den Variablen, daher auch dunkel */
.zeichnung { display: block; width: 100%; height: auto; }
.z-wand { fill: none; stroke: var(--tinte); stroke-width: 5; stroke-linejoin: round; stroke-linecap: square; }
.z-raum { fill: var(--akzent-hell); }
.vorschau .z-wand { stroke: #1f1e1c; stroke-width: 4; }
.vorschau .z-raum { fill: #e3efeb; }

/* ---------- Pflichtseiten (Text aus Markdown) */
.text { max-width: 44em; }
.text h2 { margin-top: 32px; }
.text h3 { margin-top: 20px; }
.text ul, .text ol { padding-left: 1.3em; margin: 0 0 12px; }
.text li { margin-bottom: 6px; }
/* Angaben, die in einem Platzhalter-Text noch fehlen: als Lücke hervorgehoben */
.text .luecke { background: var(--warnung-hell); color: var(--tinte); border: 1px dashed var(--rand); border-radius: 4px; padding: 0 4px; font-weight: 600; }

/* ---------- schmale Bildschirme */
@media (max-width: 640px) {
  .inhalt { padding-top: 24px; }
  .karte { padding: 20px 16px; }
  .auftakt h1 { font-size: 1.7rem; }
  .bildfolge, .schritte { grid-template-columns: 1fr; }
  .bildfolge figure { max-width: 22em; }
  .wohnung { flex-direction: column; gap: 12px; }
  .vorschau { flex-basis: auto; width: 160px; }
  .angaben { grid-template-columns: 1fr; gap: 2px; }
  .angaben dd { margin-bottom: 10px; }
  .knopf.klein { min-height: 44px; }
  .zeile .feld:has(.hilfe) + .knopf, .zeile .feld:has(.fehlertext) + .knopf { margin-top: 0; }
  /* Tabellen als gestapelte Zeilen: je Zeile ein Block, die Überschrift der Spalte steht vor dem Wert
     (`data-titel`); der Tabellenkopf bleibt nur zum Vorlesen. */
  .tabelle, .tabelle tbody, .tabelle tr, .tabelle td { display: block; }
  .tabelle thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .tabelle tr { padding: 12px; border-bottom: 1px solid var(--linie); }
  .tabelle tbody tr:last-child { border-bottom: 0; }
  .tabelle td { padding: 2px 0; border-bottom: 0; white-space: normal; overflow-wrap: anywhere; }
  .tabelle td:first-child { font-weight: 600; }
  .tabelle td:first-child .leise { font-weight: 400; }
  .tabelle td[data-titel]::before { content: attr(data-titel) ": "; color: var(--leise); font-size: 0.9rem; }
  .tabelle td.aktionen { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; }
  .tabelle td.aktionen:empty { display: none; }
  .tabelle .aktionen .knopf + .knopf { margin-left: 0; }
  .tabelle .knopf, .tabelle .marke-klein { white-space: nowrap; }
}

/* ---------- Teilen (Paket 09): Wahl der Rolle, Link zum Kopieren */
.rollenwahl { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.rollenwahl legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.rollenwahl .haken { margin-bottom: 8px; }
.karte h3 { margin-top: 24px; }
