/* Schnell-Basiseintrag (m7.3a105/a106): Typeform-artiger Arbeitsbereich INNERHALB des Inhaltsbereichs (Seitenleiste und Kopfleiste der Anwendung bleiben sichtbar). Eine Hauptfrage pro Ansicht, durchgehend responsiv nach der Breite des Inhaltsbereichs (Container-Abfragen).
   Keine feste Seiten-, Karten- oder Formularbreite: der Inhalt nutzt die verfuegbare Breite mit seitlichem Abstand; nur auf grossen Bildschirmen
   begrenzt eine maximale Lesebreite die Zeilenlaenge. Farben kommen aus den vorhandenen Tokens (--olive, --border ...); im Agenturrahmen (.ag-frame)
   wirken die Petrol-Werte automatisch. Nur Darstellung. */

/* Der Inhaltsbereich gibt dem Assistenten die ganze Flaeche: kein Innenabstand, keine Hoechstbreite des Seitenrahmens */
.outlet:has(> .sb-seite), .ag-frame .outlet:has(> .sb-seite) { padding: 0; max-width: none; margin: 0; }

/* ---- Rahmen: Arbeitsbereich im Inhaltsbereich (Kopf oben, Navigation unten, dazwischen scrollt nur die Frage).
   Hoehe = sichtbarer Bereich abzueglich der Kopfleiste der Anwendung; Breite = Breite des Inhaltsbereichs (kein Vollbild, kein Overlay). ---- */
.sb-seite, .page.sb-seite {
  --sb-rand: clamp(16px, 4.5cqi, 48px);
  container: sb / inline-size;
  position: relative; width: 100%; height: calc(var(--sb-hoehe, 100dvh) - var(--ag-kopf-h, 0px));
  margin: 0; padding: 0; max-width: none;
  background: var(--bg-page, var(--surface)); color: var(--text);
  display: flex; flex-direction: column; overflow: hidden; min-width: 0;
}
.sb-seite *, .sb-seite *::before, .sb-seite *::after { box-sizing: border-box; }
.sb-seite :focus-visible { outline: 3px solid #1F6FEB; outline-offset: 2px; border-radius: 6px; }
.sb { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; min-width: 0; width: 100%; max-width: none; margin: 0; gap: 0; }

/* Einzelne Hinweis-, Fehler- und Fortsetzen-Seiten innerhalb des Arbeitsbereichs */
.sb-seite > :not(.sb) { width: min(100% - 2 * var(--sb-rand), 640px); margin-inline: auto; }
.sb-seite > :not(.sb):first-child { margin-top: auto; }
.sb-seite > :not(.sb):last-child { margin-bottom: auto; }
.sb-seite > .sb-karte { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-1); padding: clamp(18px, 4cqi, 32px); min-width: 0; }
.sb-seite > .form-error, .sb-seite > .btn { margin-top: 12px; }

/* ---- Kopf ---- */
.sb-kopf { flex: none; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px var(--sb-rand) 12px; }
.sb-kopf-innen { width: 100%; max-width: 960px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sb-kopf-zeile { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; min-width: 0; }
.sb-marke { margin: 0; font-size: 12.5px; font-weight: 650; letter-spacing: .03em; color: var(--text-muted); text-transform: uppercase; min-width: 0; overflow-wrap: anywhere; flex: 1 1 140px; }
.sb-verlassen { min-height: 44px; min-width: 44px; flex: 0 1 auto; padding-inline: 14px; }
.sb-fortschritt { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sb-balken { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.sb-balken-fuell { display: block; height: 100%; background: var(--olive); border-radius: 999px; transition: width .25s ease; }
.sb-schritte { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.sb-schritt { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 6px; font-size: 13px; color: var(--text-muted); min-width: 0; }
.sb-schritt-nr { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 650; background: var(--surface); color: var(--text-muted); }
.sb-schritt.is-aktuell { color: var(--text); font-weight: 650; }
.sb-schritt.is-aktuell .sb-schritt-nr { border-color: var(--olive); background: var(--olive); color: #fff; }
.sb-schritt.is-erledigt .sb-schritt-nr { border-color: var(--olive); background: var(--olive-tint); color: var(--olive-dark); }
.sb-schritt-text { overflow-wrap: anywhere; min-width: 0; }

/* ---- Buehne: hier scrollt nur die aktuelle Frage ---- */
.sb-buehne { flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scroll-padding: 24px; display: flex; padding: clamp(20px, 5vh, 56px) var(--sb-rand) 28px; min-width: 0; }
.sb-inhalt { width: 100%; max-width: 720px; margin: auto; min-width: 0; }
.sb-nr { margin: 0 0 10px; font-size: 13px; font-weight: 650; color: var(--olive-dark); text-transform: uppercase; letter-spacing: .04em; overflow-wrap: anywhere; }
.sb-fragen { min-width: 0; }
.sb-frage { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sb-frage[hidden] { display: none; }
.sb-titel { margin: 0; font-size: clamp(25px, 4.4cqi, 40px); line-height: 1.18; font-weight: 750; letter-spacing: -.02em; color: var(--text); outline: none; overflow-wrap: anywhere; }
.sb-titel:focus-visible { outline: 3px solid #1F6FEB; outline-offset: 4px; }
.sb-hilfe { margin: 0; font-size: clamp(16px, 2cqi, 18px); line-height: 1.5; color: var(--text-muted); overflow-wrap: anywhere; }
.sb-koerper { display: flex; flex-direction: column; gap: 20px; margin-top: 10px; min-width: 0; }
.sb-unter { margin: 0; font-size: 18px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }

/* ---- Felder ---- */
.sb-feld { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sb-label { font-size: 16px; font-weight: 650; color: var(--text); overflow-wrap: anywhere; }
.sb-pflicht { color: var(--danger); }
.sb-optional { font-weight: 400; font-size: 13.5px; color: var(--text-muted); }
.sb-nur-lesen { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sb-hinweis { margin: 0; font-size: 14px; line-height: 1.45; color: var(--text-muted); overflow-wrap: anywhere; }
.sb-warn { color: #8A5A00; }
.sb-ok { margin: 0; font-size: 15px; color: var(--olive-dark); font-weight: 600; overflow-wrap: anywhere; }
.sb-fehler { margin: 0; font-size: 14.5px; color: var(--danger); font-weight: 600; overflow-wrap: anywhere; }
.sb-eingabe { width: 100%; max-width: 100%; min-height: 56px; font-size: clamp(17px, 2.2cqi, 20px); padding: 12px 16px; border-radius: 12px; }
.sb-textbereich { min-height: 120px; line-height: 1.5; resize: vertical; }
.sb-eingabe.has-error { border-color: var(--danger); border-width: 2px; }
.sb-raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 20px; min-width: 0; }
.sb-gemeindebox { position: relative; min-width: 0; }
.sb-treffer { list-style: none; margin: 4px 0 0; padding: 4px; position: absolute; left: 0; right: 0; z-index: 5; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-2); max-height: 320px; overflow: auto; }
.sb-treffer-eintrag { padding: 12px; min-height: 48px; border-radius: 8px; cursor: pointer; font-size: 16px; display: flex; align-items: center; overflow-wrap: anywhere; }
.sb-treffer-eintrag:hover, .sb-treffer-eintrag[aria-selected="true"] { background: var(--olive-tint); }
.sb-kartenhinweis { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sb-link { color: var(--olive-dark); font-weight: 600; overflow-wrap: anywhere; }

/* ---- Auswahlkarten (Organisation, Portal) ---- */
.sb-wahl { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sb-wahlkarte { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; min-height: 60px; border: 1.5px solid var(--border-strong); border-radius: 14px; background: var(--surface); cursor: pointer; min-width: 0; }
.sb-wahlkarte:hover { border-color: var(--olive); background: var(--surface-sunk); }
.sb-wahlkarte:has(input:checked) { border-color: var(--olive); background: var(--olive-tint); }
.sb-wahlkarte:has(input:focus-visible) { outline: 3px solid #1F6FEB; outline-offset: 2px; }
.sb-wahlkarte.is-gesperrt { opacity: .62; cursor: not-allowed; }
.sb-wahlkarte input { width: 24px; height: 24px; margin-top: 1px; flex: none; accent-color: var(--olive); }
.sb-wahltext { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sb-wahltitel { font-size: 17px; font-weight: 650; overflow-wrap: anywhere; }
.sb-check { display: flex; align-items: flex-start; gap: 12px; padding: 4px 0; min-height: 44px; min-width: 0; }
.sb-check input { width: 26px; height: 26px; flex: none; margin-top: 0; accent-color: var(--olive); }
.sb-check label { font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; min-width: 0; }

/* ---- Zusammenfassung / Anlegen ---- */
.sb-bestaetigung { display: flex; flex-direction: column; gap: 16px; padding: clamp(14px, 3cqi, 22px); border: 1px solid var(--olive-border); background: var(--surface-sunk); border-radius: 14px; min-width: 0; }
.sb-zusammen { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 15.5px; }
.sb-zusammen dt { color: var(--text-muted); overflow-wrap: anywhere; }
.sb-zusammen dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.sb-dubletten, .sb-vorherige { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sb-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sb-liste-eintrag { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); min-width: 0; }
.sb-liste-titel { font-weight: 600; overflow-wrap: anywhere; min-width: 0; flex: 1 1 180px; }

/* ---- Texte ---- */
.sb-textblock, .sb-pruefblock { display: flex; flex-direction: column; gap: 14px; padding: clamp(14px, 3cqi, 20px); border: 1px solid var(--border); border-radius: 14px; background: var(--surface); min-width: 0; }
.sb-textkopf { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 10px; flex-wrap: wrap; }
.sb-zaehler { align-self: flex-end; font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.sb-zaehler.is-zu-lang { color: var(--danger); font-weight: 650; }
.sb-textstatus { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.sb-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 650; background: var(--surface-sunk); color: var(--text); border: 1px solid var(--border-strong); max-width: 100%; overflow-wrap: anywhere; }
.sb-chip-ok { background: var(--olive-tint); border-color: var(--olive-border); color: var(--olive-dark); }
.sb-chip-warte { background: #FFF6DC; border-color: #E9D18C; color: #7A5A00; }
.sb-chip-fehlt { background: var(--danger-tint); border-color: #E6B4AC; color: var(--danger); }
.sb-freigabe { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

/* ---- Abschluss ---- */
.sb-pruefung, .sb-vorschau-host { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sb-gruppe { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sb-gruppe-titel { margin: 0; font-size: 14.5px; font-weight: 700; color: var(--text); }
.sb-gruppe-fehlt .sb-gruppe-titel { color: var(--danger); }
.sb-gruppe-warte .sb-gruppe-titel { color: #7A5A00; }
.sb-hindernisse { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sb-hindernis { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-sunk); min-width: 0; max-width: 100%; }
.sb-hindernis-titel { font-weight: 650; overflow-wrap: anywhere; }
.sb-abschlussaktion { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; max-width: 100%; }
.sb-vorschau { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sb-vorschaukarte { border: 1px dashed var(--border-strong); border-radius: 14px; padding: clamp(14px, 3cqi, 20px); background: var(--surface); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sb-vorschau-name { margin: 0; font-size: 21px; font-weight: 750; overflow-wrap: anywhere; }
.sb-vorschau-teaser { margin: 0; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }

/* ---- Fuss: feste Navigation (liegt unter dem scrollenden Bereich, verdeckt nie Inhalt) ---- */
.sb-fuss { flex: none; background: var(--surface); border-top: 1px solid var(--border); padding: 10px var(--sb-rand) calc(10px + env(safe-area-inset-bottom, 0px)); }
.sb-fuss-innen { width: 100%; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sb-meldung { margin: 0; max-height: 28vh; overflow: auto; overflow-wrap: anywhere; }
.sb-navbereich { min-width: 0; }
.sb-nav { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; min-width: 0; }
.sb-nav .sb-zurueck { flex: 0 1 auto; }
.sb-nav .sb-ueberspringen { flex: 0 1 auto; margin-left: auto; }
.sb-nav .sb-weiter { flex: 1 1 160px; max-width: 100%; }
.sb-nav .sb-ueberspringen[hidden] { display: none; }
.sb-nav .sb-ueberspringen:not([hidden]) + .sb-weiter { flex: 0 1 auto; min-width: 140px; }
.sb-speicher { margin: 0; font-size: 12.5px; color: var(--text-muted); overflow-wrap: anywhere; }
.sb-knopf { min-height: 52px; min-width: 110px; max-width: 100%; padding: 10px 22px; font-size: 17px; line-height: 1.25; border-radius: 12px; justify-content: center; text-align: center; white-space: normal; overflow-wrap: anywhere; }
.sb-klein { min-height: 44px; min-width: 44px; font-size: 14.5px; padding: 8px 14px; }
.sb-aktionen { display: flex; gap: 12px; flex-wrap: wrap; min-width: 0; }
.sb-aktionen .sb-knopf { flex: 1 1 200px; }

/* ---- Schmale Fenster und starker Zoom ---- */
@container sb (max-width: 640px) {
  .sb-schritt-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sb-schritte { gap: 4px; }
  .sb-schritt-nr { width: 24px; height: 24px; }
  .sb-zusammen { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .sb-zusammen dd { margin-bottom: 10px; }
  .sb-nav .sb-ueberspringen { flex: 1 1 100%; order: -1; margin-left: 0; min-height: 44px; }
  .sb-nav .sb-ueberspringen:not([hidden]) + .sb-weiter { flex: 1 1 140px; }
  .sb-knopf { min-width: 0; padding-inline: 16px; }
}
@container sb (max-width: 400px) {
  .sb-marke { flex: 1 1 0; font-size: 11.5px; }
  .sb-verlassen { flex: none; padding-inline: 12px; font-size: 15px; }
  .sb-nav .sb-zurueck { flex: 0 1 96px; min-width: 0; }
  .sb-aktionen .sb-knopf { flex-basis: 100%; }
}
@media (max-height: 684px) {
  .sb-schritte { display: none; }
  .sb-speicher { display: none; }
  .sb-buehne { padding-top: 16px; padding-bottom: 16px; }
  .sb-kopf { padding-block: 6px 8px; }
  .sb-knopf { min-height: 48px; }
}
/* Hinweismeldungen (Toast) ueber der festen Navigation statt darauf */
body:has(.sb-seite) .toast { bottom: calc(118px + env(safe-area-inset-bottom, 0px)); }

/* Sehr geringe Hoehe (z. B. Browserzoom 400 %): Kopf, Frage und Navigation scrollen gemeinsam, damit die feste Navigation nichts verdeckt */
@media (max-height: 534px) {
  .sb-seite, .page.sb-seite { height: auto; overflow: visible; display: block; }
  .sb { display: block; height: auto; }
  .sb-buehne { display: block; overflow: visible; padding-top: 14px; padding-bottom: 14px; }
  .sb-inhalt { margin: 0 auto; }
  .sb-meldung { max-height: none; }
}
@media (prefers-reduced-motion: reduce) { .sb-balken-fuell { transition: none; } }
