/* bbe-leads — ADAPTER zum Hausbauteil cf-chrome.css / cf-uikit.css.
   Regel: memory/feedback_design_as_module_not_rebuild.md, Punkt 3.
   Hier stehen NUR Anschluesse und Anordnung. Keine eigenen Token, keine
   Farbliterale — jede Farbe kommt als var(--…) aus dem Modul. Fehlt ein Wert,
   gehoert er ins Modul, nicht hierher. */

/* --- Anmeldung: eine Karte in der Mitte des Fensters --- */
.lead-mitte {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 18px;
}

.lead-anmeldekarte { width: 100%; max-width: 420px; }

.lead-breit { width: 100%; justify-content: center; }

/* --- Cockpit: Liste links, Einzelheiten rechts (ab 1100 px) --- */
.lead-zweispalt { display: grid; gap: 18px; align-items: start; }

@media (min-width: 1100px) {
  .lead-zweispalt { grid-template-columns: minmax(0, 25rem) minmax(0, 1fr); }
  .lead-spalte-liste { position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow-y: auto; }
}

.lead-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

/* Eine Zeile ist eine Schaltflaeche, damit sie mit der Tastatur erreichbar ist. */
.lead-zeile {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: start;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: .15s var(--ease);
}

.lead-zeile:hover { background: var(--surface-2); border-color: var(--line-strong); }
.lead-zeile[aria-current="true"] { border-color: var(--lime); border-width: 2px; padding: 13px 14px; }

.lead-zeile-kopf { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.lead-zeile-name { font-weight: 800; }
.lead-zeile-firma { color: var(--ink-soft); font-size: .9rem; }
.lead-zeile-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: .875rem; color: var(--ink-faint); }

/* --- Ladezustand: gleiche Hoehe wie das Ergebnis, damit nichts springt --- */
.lead-skelett {
  height: 76px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  animation: lead-schimmer 1.4s ease-in-out infinite;
}

@keyframes lead-schimmer { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* --- Brieftext --- */
.lead-brief {
  width: 100%;
  min-height: 20rem;
  padding: 14px 15px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .875rem;
  line-height: 1.6;
  resize: vertical;
}

/* --- Fragebogen: Schrittleiste --- */
.lead-schritte { display: flex; gap: 10px; list-style: none; margin: 0 0 22px; padding: 0; overflow-x: auto; }

/* Die Beschriftung darf schrumpfen und wird gekuerzt, statt in den Nachbarn zu
   laufen: die Schrittnummer steht vorn und bleibt in jeder Breite lesbar. */
.lead-schritt {
  flex: 1 1 0;
  min-width: 4.5rem;
  padding-top: 9px;
  border-top: 3px solid var(--line);
  font-size: .875rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-schritt[data-stand="fertig"] { border-top-color: var(--lime-strong); color: var(--ink-soft); }
.lead-schritt[data-stand="aktiv"] { border-top-color: var(--lime); color: var(--ink); }

.lead-fuss {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.lead-fuss .btn { flex: 1 1 auto; justify-content: center; }

@media (min-width: 640px) { .lead-fuss .btn { flex: 0 0 auto; } }

.lead-stand { margin-inline-start: auto; font-size: .875rem; color: var(--ink-faint); }

/* --- Auswahl als Kacheln, Bedienflaeche mindestens 44 px --- */
.lead-wahl-liste { display: grid; gap: 9px; }

@media (min-width: 640px) {
  .lead-wahl-liste { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
}

.lead-wahl {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-in2, 11px);
  background: var(--surface-2);
  cursor: pointer;
  font-size: .94rem;
}

.lead-wahl:hover { background: var(--surface); border-color: var(--ink-faint); }
.lead-wahl input { width: 18px; height: 18px; flex: none; accent-color: var(--lime); }
.lead-wahl:has(input:checked) { border-color: var(--lime); border-width: 2px; padding: 9px 12px; }

/* --- Dateiablage --- */
.lead-ablage {
  border: 2px dashed var(--line-strong);
  border-radius: var(--r);
  padding: 26px 18px;
  text-align: center;
  background: var(--surface-2);
}

.lead-ablage[data-ueber="ja"] { border-color: var(--lime); background: var(--surface); }
.lead-ablage-ziel { font-size: .875rem; color: var(--ink-soft); margin-bottom: 14px; }

.lead-dateien { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }

.lead-datei {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: .92rem;
}

.lead-datei-name { overflow-wrap: anywhere; min-width: 0; }
.lead-datei-groesse { margin-inline-start: auto; color: var(--ink-faint); font-size: .875rem; white-space: nowrap; }

/* --- Kleinkram --- */
.lead-kennung { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .875rem; overflow-wrap: anywhere; }
.lead-schwach { color: var(--ink-soft); }
.lead-klein { font-size: .875rem; }
.lead-reihe { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.lead-abstand { margin-top: 18px; }

/* Fortschrittsbalken des Fragebogens.
   Natives progress-Element statt eines Kastens mit gesetzter Breite: der Wert
   steht im Attribut, nicht in einem Inline-Stil. Die Inhaltsrichtlinie verbietet
   Inline-Stile (R47), und die Sprachausgabe liest den Wert von selbst vor. */
progress.lead-balken {
  display: block;
  width: 100%;
  height: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-3);
  overflow: hidden;
  appearance: none;
}

progress.lead-balken::-webkit-progress-bar { background: var(--surface-3); }
progress.lead-balken::-webkit-progress-value { background: var(--lime); transition: width .2s var(--ease); }
progress.lead-balken::-moz-progress-bar { background: var(--lime); }

/* Feldgruppe ohne Rahmen — die Gruppe traegt ihre Bedeutung ueber die Legende. */
.lead-gruppe { border: 0; margin: 0; padding: 0; min-width: 0; }
.lead-legende { font-weight: 800; font-size: .875rem; margin-bottom: 8px; padding: 0; }

/* Aufzaehlung in einem sonst mittig gesetzten Kasten bleibt linksbuendig. */
.lead-liste-links { text-align: start; margin: 0 0 14px; padding-inline-start: 20px; }

.lead-zitat { margin: 0; padding-inline-start: 14px; border-inline-start: 3px solid var(--line-strong); color: var(--ink); }

/* Fehlermeldung am Feld: Farbe UND Text, nie Farbe allein */
.lead-feldfehler { display: flex; gap: 7px; align-items: flex-start; margin-top: 7px; font-size: .875rem; color: var(--bad); }
.lead-feldfehler .ic { width: 15px; height: 15px; flex: none; margin-top: 2px; }

.inp2[aria-invalid="true"] { border-color: var(--bad); border-width: 2px; }

/* Fokus sichtbar halten, auch unter der klebenden Leiste.
   Der Indikator braucht 3:1 gegen die Flaeche, auf der er liegt (R68). Auf
   heller wie dunkler Flaeche traegt --ink; auf der Lime-Schaltflaeche traegt
   --on-lime, weil --ink dort im dunklen Thema fast gleich hell waere. */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.btn-primary:focus-visible {
  outline: 2px solid var(--on-lime);
  outline-offset: -4px;
  box-shadow: 0 0 0 2px var(--ink);
}

.lead-wahl:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }

.lead-zeile, .lead-wahl, .btn, .inp2, .inp { scroll-margin-block-start: 96px; }

.lead-nur-vorlesen {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .lead-skelett, .lead-balken-fuellung, .lead-zeile { animation-duration: .01ms; transition-duration: .01ms; }
}

@media print {
  .topbar, .rail, .lead-fuss, .btn, .toast { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; }
}
