/* ============================================================================
   Blätter der Erfassung
   Ort wählen und „Welcher?", Abteilungen, Schreiben und Ergänzen, das
   Maßnahme-Detail mit Zusammenführen und Löschen, dazu Markieren und die
   Großansicht. Den Rahmen (.blatt, .blatt-griff, .blatt-kopf, .blatt-inhalt)
   stellt app.css; hier steht, was in den Blättern liegt.
   ========================================================================== */

/* ----------------------------------------------------------------- Rahmen -- */
@media (min-width: 768px) {
  .blatt { max-width: var(--maxw); margin: 0 auto; }
}
.blatt:focus { outline: none; }
.blatt-kopf h2 { overflow-wrap: anywhere; }
/* „Fertig", „Abbrechen": Textknopf rechts im Kopf, wie in den iOS-Systemapps. */
.blatt-zu { flex: none; min-width: var(--tap); font-weight: 600; }

/* Freier Inhalt im Blatt hat den Innenabstand; Gruppen bringen ihren
   eingerückten Rand selbst mit. */
.blatt-rand { padding: 0 var(--s4); }
.blatt-rand + .blatt-rand { margin-top: var(--s4); }
.blatt-inhalt > .gruppe-kopf:first-child { margin-top: var(--s2); }
.blatt-rand .segmente { margin: 0; }
.blatt-rand .btn-block { margin-top: var(--s6); }
.blatt-rand .btn-block + .btn-block { margin-top: var(--s2); }
.blatt-rand .btn-block.feld-knopf { margin-top: 0; }
.blatt .zeile-rechts .ic, .blatt .zeile > .ic:last-child { color: var(--ink-2); }

/* Was ein Blatt zu sagen hat („Bitte tragen Sie etwas ein", „Nicht
   gespeichert"), steht in ihm selbst, über dem Knopf, mit dem es weitergeht. */
.blatt-meldung {
  margin: var(--s4) 0 0; padding: var(--s3) var(--s4);
  border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  font-size: .9375rem; line-height: 1.333; font-weight: 600;
}
.blatt-meldung.fehler { color: var(--bad); }

/* Hinweis oben im Blatt: ein fließender Satz, das Zeichen links davor. */
.abt-hinweis {
  display: flex; align-items: flex-start; gap: var(--s3);
  margin: 0 0 var(--s4); padding: var(--s3) var(--s4);
  border-radius: var(--r-gruppe); background: var(--surface); color: var(--ink-2);
  font-size: .9375rem; line-height: 1.333;
}
.abt-hinweis .ic { flex: none; margin-top: 1px; color: var(--brand); }
.abt-hinweis b { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------- Ortssuche -- */
.search {
  position: relative; display: flex; align-items: center; gap: var(--s2);
  min-height: 56px; padding: 0 var(--s3);
  background: var(--surface-2); border-radius: var(--r-sm);
  border: 1px solid transparent;
}
.search .ic { flex: none; color: var(--ink-2); }
.search input {
  flex: 1; min-width: 0; min-height: 56px; padding: 0;
  background: none; border: 0; outline: none; color: var(--ink);
  font-size: max(1.0625rem, 16px); line-height: 1.294;
}
.search input::placeholder { color: var(--ink-2); opacity: 1; }
.search input::-webkit-search-cancel-button { display: none; }
.search:focus-within { border-color: var(--brand); }
.ort-suche { margin: 0; }
.blatt-rand .ort-suche + .btn-block { margin-top: var(--s3); }

.ort-liste { padding-bottom: var(--s2); }
/* Neu anlegen: der eingetippte Name als Akzent-Zeile mit Plus. */
.ort-neu .zeile-titel { color: var(--brand); font-weight: 400; }
.ort-leer {
  margin: var(--s6) var(--s4) 0; text-align: center;
  font-size: .9375rem; line-height: 1.333; color: var(--ink-2);
}

/* „Welcher?" — Nummern in EINER Reihe, gleich breit. */
.nummern { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--s2); }
.nummer {
  min-width: 0; min-height: 56px; padding: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink); font-size: 1.25rem; line-height: 1.25; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.nummer:active { background: var(--surface-2); }
.wo-wahl { display: flex; flex-wrap: wrap; gap: var(--s2); }
.wo {
  min-height: 56px; padding: 0 var(--s4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink); font-size: 1.0625rem; line-height: 1.294; font-weight: 400;
}
.wo:active { background: var(--surface-2); }

/* ------------------------------------------------------------ Abteilungen -- */
/* Zeilen mit Haken, Mehrfachauswahl. Gewählt zeigt der Haken, nicht nur Farbe. */
.abt-mehrere { margin: 0 var(--s4) var(--s2); }
.abt-zeile .zeile-titel { font-weight: 400; }
.blatt .abt-zeile .abt-haken .ic { color: var(--brand); }
.abt-zeile[aria-checked="false"] .abt-haken { visibility: hidden; }

/* -------------------------------------------------- Schreiben, Ergänzen -- */
.ergaenzen-zu {
  display: flex; align-items: center; gap: var(--s2);
  margin: 0 0 var(--s3); font-size: .9375rem; line-height: 1.333; color: var(--ink-2);
}
.ergaenzen-zu .ic { flex: none; color: var(--brand); }
.ergaenzen-zu b { min-width: 0; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.schreib-feld {
  display: block; width: 100%; min-height: 160px; padding: var(--s3) var(--s4);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-gruppe); outline: none;
  font-size: max(1.0625rem, 16px); line-height: 1.294; resize: vertical;
}
.schreib-feld:focus { border-color: var(--brand); }
.schreib-feld::placeholder { color: var(--ink-2); opacity: 1; }
.schreib-tipp {
  display: flex; align-items: flex-start; gap: var(--s2);
  margin: var(--s3) 0 0; font-size: .9375rem; line-height: 1.333; color: var(--ink-2);
}
.schreib-tipp .ic { flex: none; color: var(--brand); }

/* -------------------------------------------------------- Maßnahme-Detail -- */
/* „So wurde es gesagt": nur zum Lesen, kein Feld. */
.wortlaut-lesen {
  margin: 0; padding: var(--s3) var(--s4);
  border-radius: var(--r-sm); background: var(--surface);
  font-size: 1.0625rem; line-height: 1.294; color: var(--ink);
  white-space: pre-line; overflow-wrap: anywhere;
}

.foto-gitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--s2); }
.foto-feld {
  position: relative; aspect-ratio: 1;
  border-radius: var(--r-bild); overflow: hidden; background: var(--photo-bg);
}
.foto-feld img { width: 100%; height: 100%; object-fit: cover; }
/* Fotos lassen sich antippen und groß zeigen. */
.foto-feld .mk-oeffnen {
  display: block; width: 100%; height: 100%; padding: 0;
  border: 0; background: none; cursor: pointer;
}
/* Getroffen wird 44 × 44 von der Ecke aus; zu sehen ist der kleine Kreis.
   Ein größerer deckte mehr vom Foto zu, und vor dem Entfernen fragt die App. */
.foto-feld button[data-foto-weg] {
  position: absolute; top: 0; right: 0;
  width: 44px; height: 44px; padding: 4px 4px 0 0;
  display: grid; place-items: start end;
  background: none; border: 0; color: var(--lupe-schrift);
}
.foto-feld button[data-foto-weg] .ic {
  width: 28px; height: 28px; padding: 6px;
  border-radius: 50%; background: var(--lupe-grund);
}
.foto-plus {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s1);
  min-height: 56px; background: var(--surface); border: 1px solid var(--line); color: var(--brand);
  font-size: .9375rem; line-height: 1.333; font-weight: 600;
}
.foto-plus .ic { color: var(--brand); }
.foto-plus:active { background: var(--surface-2); }

.ton-zeile {
  display: grid; gap: var(--s2);
  margin-bottom: var(--s2); padding: var(--s3) var(--s4);
  background: var(--surface); border-radius: var(--r-gruppe);
  font-size: .9375rem; line-height: 1.333; color: var(--ink-2);
}
.ton-kopf { display: flex; align-items: center; gap: var(--s2); font-variant-numeric: tabular-nums; }
.ton-kopf .ic { flex: none; color: var(--brand); }
/* So hoch, wie Chromium seine Leiste selbst zeichnet: Mit weniger fehlte dem
   Abspielknopf die Tippfläche. */
.ton-zeile audio { display: block; width: 100%; height: 54px; }
.blatt-rand .ton-neu { margin-top: 0; }

/* Dringlichkeit: drei Wörter als Umschalter. Gewählt ist eine volle
   Akzent-Fläche mit weißer Schrift. */
.dringlichkeit button[aria-pressed="true"] {
  background: var(--brand-flaeche); color: #fff; border-color: var(--brand-flaeche);
}

/* ------------------------------------------------------------- Markieren -- */
/* Grundregeln für jedes markierte Bild — auch in der Maßnahmen-Liste und im
   Druckblatt der Direktion (uebersicht.js). */
.mk { position: relative; display: inline-block; line-height: 0; max-width: 100%; }
.mk img { display: block; }
.mk-ebene { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.mk-ebene * { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.mk-rand { stroke: #fff; stroke-opacity: .92; }
.mk-strich { stroke-opacity: 1; }
.mk-cover { display: block; width: 100%; height: 100%; }
.mk-cover img { width: 100%; height: 100%; object-fit: cover; }
.mk-contain { display: inline-block; }

/* Die Großansicht ist immer dunkel: Ein Foto liest man auf dunklem Grund.
   Ihre Farben (--lupe-*) stehen in app.css; auch das Kreuz „Foto entfernen"
   auf dem Vorschaubild nimmt sie. Die Markierungsfarbe kommt als --mk-farbe
   aus markieren.js (FARBE). */
.mk-lupe { justify-content: flex-end; background: var(--lupe-grund); }
.mk-buehne { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
.mk-lupe .mk-contain img {
  max-width: 100%; max-height: calc(100vh - 300px); max-height: calc(100svh - 300px);
  width: auto; height: auto; border-radius: var(--r-bild);
}
.mk-lupe .lupe-t { color: var(--lupe-neben); }
/* Mehrere Fotos ansehen (fotosGross in markieren.js): oben „Foto 2 von 3“,
   unten „Voriges“ und „Nächstes“ als ganze Wörter. Waagerecht gehört der
   Finger dem Blättern, senkrecht und Zoomen bleiben dem Browser. */
.fg-zahl {
  margin: 0; text-align: center;
  font-size: 1.0625rem; line-height: 1.294; font-weight: 600; color: var(--lupe-schrift);
  font-variant-numeric: tabular-nums;
}
.fg-buehne { touch-action: pan-y pinch-zoom; }
.fg-knopf .ic { flex: none; }
/* Beim Markieren gehört der Finger dem Bild: kein Scrollen, kein Zoomen. */
.mk-aktiv .mk-ebene { pointer-events: all; touch-action: none; cursor: crosshair; }
.mk-aktiv img { outline: 2px solid var(--mk-farbe); outline-offset: 2px; }
.mk-leiste { width: 100%; max-width: 520px; display: grid; gap: var(--s2); }
.mk-hinweis { margin: 0; text-align: center; color: var(--lupe-neben); font-size: .9375rem; line-height: 1.333; }

/* Werkzeuge: Kreis, Pfeil, Freihand — ganze Wörter als Umschalter. */
.mk-werkzeuge {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px;
  background: var(--lupe-flaeche); border-radius: var(--r-sm);
}
.mk-wz {
  min-width: 0; min-height: 56px; padding: 0 var(--s2);
  border: 1px solid transparent; border-radius: 10px; background: none;
  color: var(--lupe-schrift); font-size: 1.0625rem; line-height: 1.294; font-weight: 600;
}
.mk-wz[aria-pressed="true"] { background: var(--lupe-flaeche-2); border-color: var(--mk-farbe); }

.mk-knoepfe { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.mk-knoepfe > :only-child { grid-column: 1 / -1; }
/* Zweiter Knopf auf dem dunklen Grund: „Markieren", „Rückgängig". */
.mk-knopf {
  background: var(--lupe-flaeche); border-color: var(--lupe-linie); color: var(--lupe-akzent);
}
