/* ==========================================================================
   ERFASSUNG
   Aufbau wie im gemessenen Entwurf: großer Titel, die Orte in der
   Reihenfolge des ersten Besuchs, am aktuellen Ort die Karte „Sie sind
   hier“ mit seinen Maßnahmen, unten fest die Knopfleiste. Die Blätter
   der Erfassung stehen in blaetter.css.
   ========================================================================== */

.erf {
  display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100svh;
  padding-bottom: 0;
}
.erf-liste { flex: 1 1 auto; padding-bottom: var(--s6); }
.erf-zahl { font-variant-numeric: tabular-nums; }
/* Wie im Entwurf sitzt der große Titel dicht unter der Leiste, und der erste
   Ort folgt dicht darauf. */
.erf > .grosstitel { padding-top: var(--s2); padding-bottom: var(--s1); }

/* Was angesprungen wird, liegt nie unter App-Leiste, Netzband oder Knopfleiste.
   Für die Ort-Karte ist das der leere Anker an ihrer Stelle in der Liste. */
.erf-anker, .erf-karte, .erf-ortkopf {
  scroll-margin-top: calc(var(--bar) + var(--safe-t) + var(--netz-h) + var(--s2));
  scroll-margin-bottom: calc(var(--leiste-h, 170px) + var(--s2));
}
.erf-anker { display: block; height: 0; }

/* ------------------------------------------------------- Frühere Orte */
.erf-ort + .erf-ort, .erf-ort + .erf-anker { margin-top: var(--s4); }
/* Der Name steht unten in der 56 px hohen Tippfläche, nah an seiner Gruppe. */
.erf-ortkopf {
  display: flex; align-items: flex-end; gap: var(--s2);
  width: 100%; min-height: 56px; padding: 0 var(--s4) var(--s2);
  background: none; border: 0; text-align: left;
  color: var(--ink-2);
}
.erf-ortkopf:active { background: var(--surface-3); }
.erf-ortkopf-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 1.25rem; line-height: 1.25; font-weight: 600; color: var(--ink-2);
}
.erf-ortkopf-zahl {
  flex: 1 1 auto; font-size: .9375rem; line-height: 1.333; color: var(--ink-2);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* „· 1 nicht verstanden“: Passt es nicht in die Zeile, rutscht es als Ganzes darunter.
   Sonst nähme es dem Namen des Orts den Platz. */
.erf-ortkopf-zahl:has(.erf-ortkopf-warn) { flex-basis: 0; white-space: normal; }
.erf-ortkopf-warn { display: inline-block; font-weight: 600; color: var(--warn-schrift); white-space: nowrap; }
.erf-ortkopf .ic { flex: none; color: var(--ink-2); }
/* „Hierher wechseln“: letzte Zeile der Gruppe, eine Aktion wie in iOS. */
.zeile.erf-hierher {
  justify-content: center; min-height: 56px;
  background: var(--surface); text-align: center;
  color: var(--brand); font-size: 1.0625rem; line-height: 1.294; font-weight: 400;
}
.zeile.erf-hierher:active { background: var(--surface-2); }

/* --------------------------------------------- Ort-Karte „Sie sind hier“ */
/* Klebt oben unter der App-Leiste oder unten über der Knopfleiste, je
   nachdem, an welcher Kante sie den Schirm verlassen würde: So steht immer
   da, wohin eine neue Maßnahme geht. Über den Zeilen, unter beiden Leisten. */
.ortkarte {
  position: sticky; z-index: 40;
  top: calc(var(--bar) + var(--safe-t) + var(--netz-h));
  bottom: calc(var(--leiste-h, 170px) + var(--s2));
  display: flex; align-items: center; gap: var(--s2);
  min-height: 62px; margin: 0 var(--rand) var(--s3);
  padding: var(--s1) var(--s2) var(--s1) var(--s4);
  background: var(--surface); border: 0; border-radius: 12px;
}
/* Klebt sie unten, liefe zwischen ihr und der Knopfleiste die Liste durch.
   Ein Streifen in Grund-Farbe unter ihr hält die Fuge ruhig. Er beginnt
   erst unter der Karte und lässt ihre runden Ecken frei; in Ruhe liegt er
   im Abstand zur nächsten Gruppe auf gleichem Grund und ist nicht zu sehen. */
.ortkarte::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%;
  height: var(--s2); background: var(--bg);
}
.ortkarte-pin { flex: none; display: grid; place-items: center; margin-right: var(--s1); color: var(--brand); }
.ortkarte-t { flex: 1 1 auto; min-width: 0; }
.ortkarte-t b {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 1.25rem; line-height: 1.25; font-weight: 600; color: var(--ink);
}
.ortkarte-t span { display: block; font-size: .9375rem; line-height: 1.333; color: var(--brand); }
/* 15 px wie im Entwurf: So bleibt „Sie sind hier · 2 Maßnahmen“ auf einer
   Zeile. Die Tippfläche ist trotzdem 56 px hoch. */
.ortkarte-wechseln {
  flex: none; display: inline-flex; align-items: center; gap: 2px;
  min-height: 56px; padding: 0;
  background: none; border: 0; border-radius: var(--r-xs);
  color: var(--brand); font-size: .9375rem; line-height: 1.333; white-space: nowrap;
}
.ortkarte-wechseln:active { background: var(--surface-2); }

/* Rückweg nach einem gesprochenen Ortswechsel: eine ruhige Zeile unter der
   Ort-Karte. Sie bleibt, bis sie benutzt oder der Ort von Hand gesetzt wird. */
.erf-rueckweg { margin-bottom: 0; }
.erf-rueckweg + .gruppe { margin-top: var(--s3); }
.ortzurueck { color: var(--brand); background: var(--surface); }
.ortzurueck .ic { flex: none; }
.ortzurueck-t { flex: 1 1 auto; min-width: 0; display: block; }
.ortzurueck-t b {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 1.0625rem; line-height: 1.294; font-weight: 600; color: var(--ink);
}
.ortzurueck-t span { display: block; font-size: .9375rem; line-height: 1.333; color: var(--brand); }

/* ---------------------------------------------------- Maßnahme als Zeile */
/* Foto links, Text ab 8 + 72 + 16 px; die Knöpfe stehen bündig darunter.
   Die ganze Zeile öffnet das Detail-Blatt, das Foto oder das graue
   Kamera-Feld haben ihre eigene Aufgabe. */
.erf-karte { --erf-einzug: calc(var(--s2) + 72px + var(--s4)); background: var(--surface); }
.gruppe > .erf-karte + .erf-karte::before, .gruppe > .erf-karte + .erf-hierher::before { left: var(--s2); }
.erf-zeile { align-items: flex-start; gap: var(--s4); }
.erf-bild {
  flex: none; position: relative; display: grid; place-items: center;
  width: 72px; height: 72px; min-height: 72px; padding: 0; border: 0;
  border-radius: var(--r-bild); overflow: hidden; background: var(--photo-bg);
}
.erf-bild img { display: block; width: 100%; height: 100%; object-fit: cover; }
.erf-bild-leer { color: var(--ink-2); }
.erf-bild-leer:active { background: var(--line); }
/* Die Textspalte steht neben dem Foto mittig, solange sie niedriger ist. */
.erf-spalte {
  align-self: stretch; display: flex; flex-direction: column; justify-content: center;
  min-height: 72px;
}
.erf-haupt {
  display: flex; align-items: center; gap: var(--s3);
  width: 100%; min-height: 56px; padding: var(--s1) 0;
  background: none; border: 0; text-align: left; color: var(--ink);
}
/* Folgt die Abteilung als eigener Knopf, rückt der Text an dessen Kante. */
.erf-haupt.mit-abt { align-items: flex-end; padding-bottom: 2px; }
/* Gedrückt färbt sich die ganze Zeile, wie in iOS. */
.erf-karte:has(.erf-haupt:active) .erf-zeile { background: var(--surface-2); }
.erf-haupt-t { flex: 1 1 auto; min-width: 0; display: block; }
.erf-titel {
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Ohne Titel steht der Platzhalter da — nichts täuscht Fertigkeit vor. */
.erf-blass { color: var(--ink-2); font-style: italic; }
.erf-text {
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-top: 2px;
  font-size: .9375rem; line-height: 1.333; color: var(--ink-2);
}

/* Hinweise als Wörter in Nebentext-Farbe, durch Punkte getrennt. */
.kar-hinweise { display: flex; flex-wrap: wrap; gap: 0 var(--s2); margin-top: 2px; }
.erf-hinweis { font-size: .9375rem; line-height: 1.333; color: var(--ink-2); }
.erf-hinweis + .erf-hinweis::before { content: '·'; margin-right: var(--s2); }

.erf-laeuft {
  display: flex; align-items: center; gap: var(--s2); margin-top: 2px;
  font-size: .9375rem; line-height: 1.333; font-weight: 600; color: var(--bad);
}
.erf-laeuft i {
  flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--bad);
  animation: pulsieren 1.2s ease-in-out infinite;
}
/* Gestoppt, das letzte Stück ist noch unterwegs: nicht mehr rot. */
.erf-laeuft.sichert { color: var(--ink-2); }
.erf-laeuft.sichert i { background: var(--ink-2); }
@keyframes pulsieren { 50% { opacity: .3; } }

/* „Wird ausgewertet …": Mikrofon, Schallwellen, Zeilen, die entstehen. */
.erf-wertet {
  display: flex; align-items: center; gap: var(--s2); margin-top: 2px;
  font-size: .9375rem; line-height: 1.333; color: var(--ink-2);
}
.kw-bild { display: inline-flex; align-items: center; gap: var(--s1); flex: none; color: var(--brand); }
.kw-wellen { display: inline-flex; align-items: center; gap: 2px; height: 14px; }
.kw-wellen i {
  display: block; width: 3px; height: 13px; border-radius: 2px; background: currentColor;
  transform: scaleY(.3); animation: kw-welle 1s ease-in-out infinite;
}
.kw-wellen i:nth-child(2) { animation-delay: .15s; }
.kw-wellen i:nth-child(3) { animation-delay: .3s; }
@keyframes kw-welle { 0%, 100% { transform: scaleY(.3); opacity: .5; } 50% { transform: scaleY(1); opacity: 1; } }
.kw-zeilen { display: inline-grid; gap: 2px; width: 16px; }
.kw-zeilen i {
  display: block; height: 2px; border-radius: 1px; background: currentColor;
  transform-origin: left center; animation: kw-zeile 1.8s ease-in-out infinite;
}
.kw-zeilen i:nth-child(1) { width: 100%; }
.kw-zeilen i:nth-child(2) { width: 80%; animation-delay: .2s; }
.kw-zeilen i:nth-child(3) { width: 55%; animation-delay: .4s; }
@keyframes kw-zeile {
  0% { transform: scaleX(0); opacity: .3; }
  40%, 80% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: .3; }
}
.erf-wertet.aus .ic { flex: none; color: var(--ink-2); }

/* Abteilung unter dem Titel als eigener Knopf, solange etwas zu tun ist:
   Sie fehlt, oder travdo hat sie nur vorgeschlagen. Die Schrift steht oben,
   dicht am Titel; die Tippfläche reicht darunter. */
.kar-abt {
  display: flex; align-items: flex-start; gap: var(--s2);
  width: 100%; min-height: 56px; padding: 2px 0 0;
  background: none; border: 0; text-align: left;
  color: var(--ink-2); font-size: .9375rem; line-height: 1.333;
}
.kar-abt:active { background: var(--surface-2); }
.kar-abt .ic { flex: none; margin-left: auto; color: var(--ink-2); }
.kar-abt-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Noch niemand zugeordnet: eine Aufgabe, kein Zustand. */
.kar-abt-leer { color: var(--warn-schrift); font-weight: 600; }
/* Von travdo vorgeschlagen, noch von keinem Menschen bestätigt. */
.kar-abt-q { flex: none; color: var(--ink-2); font-style: italic; }

/* Wortgenau oder sortiert: der Baustein .segmente, hier nur eingerückt. */
.kar-fassung { margin: 0 var(--s4) var(--s2) var(--erf-einzug); }
/* Noch nicht wählbar, aber lesbar: inaktiv durch den gestrichelten Rand und
   die schräge Schrift, nicht durch Blässe. */
.kar-fassung button.wartet {
  cursor: default; background: none; border: 1px dashed var(--line-2);
  color: var(--ink-2); font-weight: 400; font-style: italic;
}

/* Kein Mangel erkannt — mit dem Weg hinaus gleich darunter. */
.kar-ohne { margin: 0 var(--s4) var(--s2) var(--erf-einzug); }
.kar-ohne-t {
  display: flex; align-items: center; gap: var(--s2);
  font-size: 1.0625rem; line-height: 1.294; font-weight: 600; color: var(--ink);
}
.kar-ohne-t .ic { flex: none; color: var(--ok); }
.kar-ohne-s { margin-top: 2px; font-size: .9375rem; line-height: 1.333; color: var(--ink-2); }
.kar-ohne-weg { margin-top: var(--s2); }

/* Foto und Sprechen für GENAU DIESE Maßnahme, bündig unter dem Text. */
.erf-knoepfe {
  display: flex; gap: var(--s2);
  padding: 0 var(--s4) var(--s3) var(--erf-einzug);
}
.erf-knoepfe .btn { flex: 1 1 0; min-width: 0; min-height: 56px; padding: 0 var(--s2); }
/* Grau getönt: anders als die großen Knöpfe der Leiste, die eine neue
   Maßnahme beginnen. */
.erf-knoepfe .btn-zweit { background: var(--surface-2); border-color: transparent; color: var(--brand); }
@media (min-width: 768px) {
  .erf-knoepfe .btn { flex: 0 1 200px; }
}

/* Aufnahme läuft: Gefahr-Farbe, weiße Schrift (5,2 : 1). */
.erf-stop { background: var(--bad-flaeche); border-color: var(--bad-flaeche); color: #fff; }
.erf-stop b { font-variant-numeric: tabular-nums; font-weight: 700; }

.erf-leer { padding: var(--s6) var(--s5); text-align: center; color: var(--ink-2); }
.erf-leer .ic { color: var(--ink-2); }
.erf-leer h3 { margin-top: var(--s3); font-size: 1.0625rem; line-height: 1.294; color: var(--ink); }
.erf-leer p { margin-top: var(--s2); font-size: .9375rem; line-height: 1.333; }

/* ------------------------------------------------------------- Knopfleiste */
.erf-wege { display: grid; gap: var(--s2); }
.erf-paar { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.erf-paar .btn { min-width: 0; padding: 0 var(--s2); }
.erf-wege-hinweis { text-align: center; font-size: .9375rem; line-height: 1.333; color: var(--ink-2); }

/* Pegel beim Sprechen: der einzige Beweis, dass das Telefon wirklich zuhört. */
.pegel { height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.pegel i {
  display: block; width: 100%; height: 100%; border-radius: var(--r-full);
  background: var(--ok); transform: scaleX(0); transform-origin: left center;
  transition: transform .08s linear;
}
/* Zu leise: Die Farbe sagt es, ohne dass jemand eine Skala lesen muss. */
.pegel i.leise { background: var(--warn); }

/* Foto eingeordnet: kurz gezeigt und sofort korrigierbar, in der Leiste. */
.foto-ok {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) var(--s2) var(--s2) var(--s4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-gruppe);
  color: var(--ink); font-size: .9375rem; line-height: 1.333;
  animation: hochschieben .2s var(--ease);
}
.foto-ok.ruhig { animation: none; }
.foto-ok > span { flex: 1 1 auto; min-width: 0; }
.foto-ok > .ic { flex: none; color: var(--ok); }
.foto-ok .btn { flex: none; padding: 0 var(--s4); }
@keyframes hochschieben { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  .erf-laeuft i, .foto-ok { animation: none; }
  .pegel i { transition: none; }
  .kw-wellen i { animation: none; transform: none; opacity: 1; }
  .kw-zeilen i { animation: none; transform: none; opacity: 1; }
}
