/* Flow-Arbeitsfläche des Baukastens (Teil B2b), Gegenstück zu flowbuilder.js.
   Maße aus wissen/manychat-oberflaeche.md: Seitenpanel 380 links, Fläche ruhig grau ohne Raster, Blockkarten weiß
   mit Rundung 10 (Teil B3b: Karten 10, Knöpfe und Felder 6, kleine Teile 4), farbiger Kopf je Typ, Inhalt in grauer Box, jede
   Verzweigung als Zeile mit Ziehpunkt rechts, Verbindungen grau, ja salbei, nein koralle. Hell und dunkel über die
   Variablen aus style.css. Dazu Galerie im Editor und in der Handy-Vorschau (auch für die Schrittliste). */

/* ---------- Hülle ---------- */
.bk.fb-an { --bk-ziel: 36px; --fb-seite: 380px; --fb-flaeche: oklch(93.6% 0.004 80); --fb-block: #ffffff; --fb-box: oklch(96.4% 0.003 80);
  --fb-linie: oklch(68% 0.01 80); --fb-ja: var(--salbei-p); --fb-nein: var(--koralle-p); --fb-auswahl: var(--akzent);
  --rund: 6px; --rund-mittel: 6px; --rund-klein: 4px; --rund-mini: 4px; --rund-flaeche: 10px; --rund-gross: 10px; --fb-karte: 10px;
  display: flex; flex-direction: column; gap: 0; height: calc(100dvh - 180px); min-height: 520px;
  border-radius: var(--fb-karte); overflow: hidden; background: var(--grund); box-shadow: var(--hoehe-1); }
:root[data-theme="dark"] .bk.fb-an { --fb-flaeche: oklch(13.5% 0 0); --fb-block: oklch(21% 0 0); --fb-box: oklch(25.5% 0 0); --fb-linie: oklch(58% 0 0); --fb-auswahl: var(--akzent-hell); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bk.fb-an { --fb-flaeche: oklch(13.5% 0 0); --fb-block: oklch(21% 0 0); --fb-box: oklch(25.5% 0 0); --fb-linie: oklch(58% 0 0); --fb-auswahl: var(--akzent-hell); } }
.seite:has(.bk.fb-an) { max-width: none; padding-left: var(--abst-16); padding-right: var(--abst-16); }

/* ---------- Kopfleiste ---------- */
.fb-an .bk-kopf { position: relative; z-index: 7; flex: none; flex-wrap: nowrap; gap: 6px; padding: 10px 14px; min-height: 60px; border-bottom: var(--haar) solid var(--linie); background: var(--grund); }
.fb-an .fb-zurueck { margin-left: -6px; }
.fb-an .bk-name { flex: 4 1 120px; min-width: 80px; max-width: 360px; font-size: 17px; padding: 4px 8px; text-overflow: ellipsis; }
.fb-zustand { display: inline-flex; align-items: center; gap: 6px; }
.fb-lozenge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--rund-voll); font-size: 12px; font-weight: 600; letter-spacing: .01em; white-space: nowrap; background: var(--grau-g); color: var(--grau-t); }
.fb-lozenge.z-live { background: var(--salbei-g); color: var(--salbei-t); }
.fb-lozenge.z-entwurf { background: var(--sonne-g); color: var(--sonne-t); }
.fb-entwurf-punkt { width: 8px; height: 8px; border-radius: 50%; background: var(--sonne-p); }
.fb-stand { display: inline-flex; align-items: center; gap: 4px; flex: 0 1 auto; min-width: 0; overflow: hidden; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.fb-an .bk-kopf > :not(.bk-name):not(.fb-stand):not(.raum) { flex-shrink: 0; }
.fb-stand .ic { flex: none; width: 14px; height: 14px; color: var(--salbei-p); }
.fb-stand-punkt { flex: none; width: 8px; height: 8px; margin: 0 3px; border-radius: 50%; background: var(--text-3); }
.fb-stand.fehler .fb-stand-punkt { background: var(--koralle-p); }
/* schmalere Fenster: nur Zeichen, der Stand steht im Tooltip */
@media (max-width: 1400px) { .fb-stand { max-width: 22px; font-size: 0; } }
.fb-stand.fehler { color: var(--koralle-t); }
.fb-undo-redo { display: inline-flex; gap: 2px; }
.fb-an .bk-kopf .icon-knopf.an { background: var(--flaeche-2); color: var(--text); }
.fb-an .bk-kopf .knopf { min-height: 36px; padding: 0 14px; }
.fb-an .bk-kopf .raum { flex: 1 1 0; min-width: 0; }
.fb-an .bk-kopf .schalter-text { display: none; }
.fb-an .bk-kopf .umschalter button { min-height: 32px; padding: 0 10px; }
/* Meldungen unter der Kopfleiste schweben über der Fläche, damit die Leiste einzeilig bleibt */
.fb-kopf-extras { position: absolute; top: 100%; left: 0; right: 0; display: grid; gap: 6px; padding: 8px 14px; background: var(--grund); border-bottom: var(--haar) solid var(--linie); box-shadow: 0 6px 16px oklch(30% .02 60 / 8%); }
.fb-kopf-extras:empty { display: none; }
/* Liste: Zustand auch dort zeigen */
.bk-kopf-rechts .fb-lozenge { margin-right: -4px; }

/* ---------- Rumpf: Seitenpanel, Fläche, Vorschau ---------- */
.fb-rumpf { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: var(--fb-seite) minmax(0, 1fr); }
.fb-rumpf.seite-zu { grid-template-columns: 0 minmax(0, 1fr); }
.fb-seite { min-height: 0; overflow-y: auto; overscroll-behavior: contain; border-right: var(--haar) solid var(--linie); background: var(--grund); scrollbar-width: thin; }
.fb-rumpf.seite-zu .fb-seite { visibility: hidden; }
.fb-seite > .bk-panel { margin: 0; border: 0; border-radius: 0; box-shadow: none; padding: 16px 18px 20px; gap: 16px; }
.fb-seite .bk-panel-kopf { position: sticky; top: -16px; z-index: 1; margin: -16px -18px 0; padding: 14px 18px 12px; background: var(--grund); border-bottom: var(--haar) solid var(--linie); }
.fb-seite .bk-panel-kopf[data-farbe] { box-shadow: inset 0 3px 0 var(--fb-kopf-p, var(--grau-p)); }
.fb-seite .bk-panel-kopf[data-farbe="sand"] { --fb-kopf-p: var(--sand-p); } .fb-seite .bk-panel-kopf[data-farbe="meer"] { --fb-kopf-p: var(--meer-p); }
.fb-seite .bk-panel-kopf[data-farbe="lavendel"] { --fb-kopf-p: var(--lavendel-p); } .fb-seite .bk-panel-kopf[data-farbe="salbei"] { --fb-kopf-p: var(--salbei-p); }
.fb-seite .bk-panel-kopf[data-farbe="koralle"] { --fb-kopf-p: var(--koralle-p); } .fb-seite .bk-panel-kopf[data-farbe="grau"] { --fb-kopf-p: var(--grau-p); }
.fb-seite-knopf { position: absolute; z-index: 6; top: 14px; left: calc(var(--fb-seite) - 14px); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--grund); color: var(--text-2); box-shadow: var(--schatten-klein); transition: left var(--dauer-2) var(--kurve); }
.fb-seite-knopf .ic { width: 15px; height: 15px; transition: transform var(--dauer-2) var(--kurve); }
.fb-rumpf.seite-zu .fb-seite-knopf { left: 10px; }
.fb-rumpf.seite-zu .fb-seite-knopf .ic { transform: rotate(180deg); }
@media (hover: hover) { .fb-seite-knopf:hover { color: var(--text); } }

/* Reichweite oben im Panel */
.fb-panel-zahlen { display: grid; gap: 10px; padding: 12px; border-radius: var(--fb-karte); background: var(--flaeche); font-size: 12px; color: var(--text-3); }
.fb-pz-reihe { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.fb-pz-reihe span { display: grid; }
.fb-pz-reihe strong { font-size: 16px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* Kennzahlen ohne Auswahl */
.fb-kz { display: grid; gap: 16px; padding: 18px; }
.fb-kz-kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fb-kz-kopf h2 { font-size: 16px; font-weight: 600; }
.fb-kz-kopf .feld { width: auto; min-height: 34px; font-size: 13px; }
.fb-kacheln { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fb-kachel-zahl { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--fb-karte); background: var(--flaeche); box-shadow: inset 0 0 0 var(--haar) var(--linie); min-width: 0; }
.fb-kz-titel { font-size: 12px; color: var(--text-3); font-weight: 500; }
.fb-kachel-zahl strong { font: 600 24px/1.15 var(--schrift-marke); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.fb-kz-unter { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-kz-hinweis { margin-top: -6px; }
.fb-seite-tipp { padding: 14px; border-radius: var(--fb-karte); border: var(--haar) solid var(--linie); font-size: 13px; }
.fb-seite-tipp ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }

/* ---------- Fläche ---------- */
.fb-flaeche { position: relative; overflow: hidden; background: var(--fb-flaeche); cursor: default; touch-action: none; outline: none; user-select: none; -webkit-user-select: none; }
.fb-flaeche.schiebt, .fb-flaeche.greifen { cursor: grab; }
.fb-flaeche.schiebt { cursor: grabbing; }
.fb-flaeche.greifen .fb-block { cursor: grab; }
.fb-flaeche.verbindet, .fb-flaeche.verbindet .fb-block { cursor: crosshair; }
.fb-welt { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; will-change: transform; }
.fb-welt.weich { transition: transform 240ms var(--kurve); }
.fb-linien { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.fb-bloecke { position: absolute; left: 0; top: 0; }

/* Verbindungen */
.fb-kante { pointer-events: none; }
.fb-linie { fill: none; stroke: var(--fb-linie); stroke-width: 2; stroke-linecap: round; }
.fb-kante.f-ja .fb-linie { stroke: var(--fb-ja); }
.fb-kante.f-nein .fb-linie { stroke: var(--fb-nein); }
.fb-treffer { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; }
.fb-kante:hover .fb-linie { stroke-width: 3; }
.fb-kante:hover .fb-linie { stroke-dasharray: 6 5; }
.fb-pfeil path { fill: var(--fb-linie); }
.fb-pfeil.f-ja path { fill: var(--fb-ja); }
.fb-pfeil.f-nein path { fill: var(--fb-nein); }
.fb-zieh-linie { fill: none; stroke: var(--fb-auswahl); stroke-width: 2; stroke-dasharray: 6 5; }
.fb-zieh-linie.f-ja { stroke: var(--fb-ja); } .fb-zieh-linie.f-nein { stroke: var(--fb-nein); }

/* Blockkarten */
.fb-block { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; border-radius: var(--fb-karte); background: var(--fb-block); color: var(--text);
  box-shadow: 0 1px 2px oklch(30% .02 60 / 8%), 0 0 0 var(--haar) oklch(0% 0 0 / 10%); cursor: pointer; outline: none; font-size: 13px; line-height: 1.38; }
:root[data-theme="dark"] .fb-block { box-shadow: 0 1px 2px oklch(0% 0 0 / 40%), 0 0 0 var(--haar) var(--linie-stark); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fb-block { box-shadow: 0 1px 2px oklch(0% 0 0 / 40%), 0 0 0 var(--haar) var(--linie-stark); } }
@media (hover: hover) { .fb-block:hover { box-shadow: 0 4px 14px oklch(30% .02 60 / 12%), 0 0 0 1px var(--linie-stark); } }
.fb-block:focus-visible { box-shadow: 0 0 0 2px var(--fb-auswahl); }
.fb-block.gewaehlt { box-shadow: 0 0 0 2px var(--fb-auswahl), 0 8px 22px oklch(30% .02 60 / 14%); z-index: 2; }
.fb-block.zieht { z-index: 3; box-shadow: 0 14px 34px oklch(30% .02 60 / 22%), 0 0 0 1px var(--linie-stark); cursor: grabbing; }
.fb-block.ziel { box-shadow: 0 0 0 3px var(--fb-auswahl); }
.fb-block.warn-fehler { box-shadow: 0 0 0 1.5px var(--koralle-p); }
.fb-block.warn-fehler.gewaehlt { box-shadow: 0 0 0 2px var(--fb-auswahl), 0 0 0 4px var(--koralle-g); }

.fb-kopf { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--fb-karte) var(--fb-karte) 0 0; background: var(--fb-kopf-g); }
.fb-sym { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--fb-kopf-p); color: #fff; }
.fb-sym .ic { width: 16px; height: 16px; }
.fb-titel { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.fb-titel strong { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-unter { font-size: 11px; font-weight: 500; color: var(--fb-kopf-t); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-warn { display: inline-grid; color: var(--sonne-p); }
.fb-warn.fehler { color: var(--koralle-p); }
.fb-warn .ic { width: 16px; height: 16px; }
.t-sand { --fb-kopf-g: var(--sand-g); --fb-kopf-t: var(--sand-t); --fb-kopf-p: var(--sand-p); }
.t-meer { --fb-kopf-g: var(--meer-g); --fb-kopf-t: var(--meer-t); --fb-kopf-p: var(--meer-p); }
.t-lavendel { --fb-kopf-g: var(--lavendel-g); --fb-kopf-t: var(--lavendel-t); --fb-kopf-p: var(--lavendel-p); }
.t-salbei { --fb-kopf-g: var(--salbei-g); --fb-kopf-t: var(--salbei-t); --fb-kopf-p: var(--salbei-p); }
.t-koralle { --fb-kopf-g: var(--koralle-g); --fb-kopf-t: var(--koralle-t); --fb-kopf-p: var(--koralle-p); }
.t-grau { --fb-kopf-g: var(--grau-g); --fb-kopf-t: var(--grau-t); --fb-kopf-p: var(--grau-p); }

.fb-stat { display: flex; gap: 16px; padding: 7px 12px; border-bottom: var(--haar) solid var(--linie); font-size: 11px; color: var(--text-3); }
.fb-stat span { display: grid; line-height: 1.2; }
.fb-stat strong { font-size: 14px; font-weight: 600; color: var(--akzent); font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .fb-stat strong { color: var(--akzent-hell); }

.fb-inhalt { display: grid; gap: 8px; padding: 10px 12px 12px; min-width: 0; }
.fb-box { display: grid; gap: 6px; padding: 9px 10px; border-radius: 6px; background: var(--fb-box); min-width: 0; }
.fb-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.fb-variante { -webkit-line-clamp: 2; }
.fb-variante + .fb-variante { padding-top: 6px; border-top: var(--haar) solid var(--linie); }
.fb-leer { color: var(--text-3); font-style: italic; }
.fb-klein { margin: 0; font-size: 11.5px; color: var(--text-3); }
.fb-satz { margin: 0; color: var(--text-2); }
.fb-satz strong { color: var(--text); }
.fb-var { display: inline-block; padding: 0 5px; border-radius: 4px; background: var(--meer-g); color: var(--meer-t); font-size: 11.5px; font-weight: 600; line-height: 1.5; }
.fb-datei { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.fb-datei .ic { width: 15px; height: 15px; }
.fb-datei.fehlt { color: var(--koralle-t); }
.fb-liste { display: grid; gap: 4px; }
.fb-ausloeser { display: grid; gap: 2px; }
.fb-ausloeser strong { font-weight: 600; }
.fb-ausloeser span { color: var(--text-2); overflow-wrap: anywhere; }

/* Zeilen mit Ziehpunkt rechts (Buttons, Quick Replies, Karten-Buttons, Wege, Pfade) */
.fb-zeile { position: relative; display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 5px 22px 5px 10px; border-radius: 6px; background: var(--fb-block); box-shadow: 0 0 0 var(--haar) var(--linie-stark); font-weight: 600; font-size: 12.5px; color: var(--akzent); }
:root[data-theme="dark"] .fb-zeile { color: var(--akzent-hell); }
.fb-zeile-text { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-zeile.link { padding-right: 10px; color: var(--text-2); font-weight: 500; }
.fb-link-ic { width: 13px; height: 13px; flex: none; }
.fb-ctr { flex: none; font-size: 11px; font-weight: 500; color: var(--text-3); font-variant-numeric: tabular-nums; }
.fb-zeile.quick { border-radius: var(--rund-voll); justify-content: center; }
.fb-zeile.weg { color: var(--text); font-weight: 500; }
.fb-zeile.w-ja { box-shadow: inset 3px 0 0 var(--salbei-p), 0 0 0 var(--haar) var(--linie-stark); }
.fb-zeile.w-nein { box-shadow: inset 3px 0 0 var(--koralle-p), 0 0 0 var(--haar) var(--linie-stark); }
.fb-zeile.w-unbekannt { box-shadow: inset 3px 0 0 var(--grau-p), 0 0 0 var(--haar) var(--linie-stark); }
.fb-zeile.zeit { color: var(--text-2); font-weight: 500; }
.fb-quick { display: grid; gap: 6px; }
.fb-port { position: absolute; right: -19px; top: 50%; z-index: 1; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--fb-block); box-shadow: 0 0 0 2px var(--fb-linie); cursor: crosshair; transition: transform var(--dauer-1) var(--kurve); }
.fb-port::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; }
.fb-port.voll { background: var(--fb-linie); }
.fb-port.a-ja { box-shadow: 0 0 0 2px var(--fb-ja); } .fb-port.a-ja.voll { background: var(--fb-ja); }
.fb-port.a-nein { box-shadow: 0 0 0 2px var(--fb-nein); } .fb-port.a-nein.voll { background: var(--fb-nein); }
@media (hover: hover) { .fb-port:hover { transform: scale(1.25); box-shadow: 0 0 0 2px var(--fb-auswahl); } }
.fb-zeile .fb-port { right: -19px; }
.fb-fuss { position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 34px; padding: 6px 26px 8px 12px; border-top: var(--haar) solid var(--linie); font-size: 12px; color: var(--text-3); }
.fb-fuss .fb-port { right: -7px; }

/* Galerie im Block */
.fb-galerie { display: flex; gap: 8px; overflow: hidden; margin: 0 -2px; padding: 2px; }
.fb-gkarte { flex: 0 0 82%; display: grid; gap: 6px; align-content: start; min-width: 0; }
.fb-gk-kopf { display: grid; border-radius: 6px; overflow: hidden; background: var(--fb-block); box-shadow: 0 0 0 var(--haar) var(--linie-stark); }
.fb-gk-kopf img, .fb-gk-bild { width: 100%; aspect-ratio: 1.91; object-fit: cover; display: grid; place-items: center; background: var(--flaeche-2); color: var(--text-3); pointer-events: none; }
.fb-gk-bild .ic { width: 22px; height: 22px; }
.fb-gk-text { display: grid; padding: 6px 9px 8px; line-height: 1.25; }
.fb-gk-text strong { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-gk-text span { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* nur die erste Karte zeigt ihre Ziehpunkte voll, die übrigen ragen angeschnitten hinein wie in ManyChat */
.fb-gkarte:not(:first-child) { opacity: .75; }
.fb-gkarte:not(:first-child) .fb-port { right: 4px; }

/* Notiz */
.fb-block.notiz { background: var(--sonne-g); box-shadow: 0 1px 2px oklch(30% .02 60 / 8%), 0 0 0 var(--haar) oklch(60% .1 85 / 30%); }
.fb-block.notiz .fb-kopf { background: transparent; padding-bottom: 4px; }
.fb-block.notiz .fb-sym { background: var(--sonne-p); }
.fb-block.notiz .fb-unter { color: var(--sonne-t); }
.fb-notiz-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.fb-block.notiz.gewaehlt { box-shadow: 0 0 0 2px var(--fb-auswahl); }

/* Start-Block */
.fb-start .fb-kopf { background: var(--koralle-g); }

/* Weit weg gezoomt: Inhalte ruhiger */
.fb-flaeche.fern .fb-inhalt, .fb-flaeche.fern .fb-stat { opacity: .55; }

/* Mini-Leiste über dem gewählten Block */
.fb-mini { position: absolute; right: 0; bottom: calc(100% + 8px); display: flex; gap: 2px; padding: 3px; border-radius: var(--fb-karte); background: var(--grund); box-shadow: var(--hoehe-2); }
.fb-mini button { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; color: var(--text-2); }
.fb-mini button .ic { width: 16px; height: 16px; }
@media (hover: hover) { .fb-mini button:hover { background: var(--flaeche-2); color: var(--text); } .fb-mini button.gefahr:hover { color: var(--koralle-t); } }

/* Tipp oben, Hinweise unten links */
.fb-tipp { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); max-width: calc(100% - 180px); padding: 6px 14px; border-radius: var(--rund-voll); background: var(--grund); box-shadow: var(--schatten-klein); font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.fb-hinweis-ort { position: absolute; left: 14px; bottom: 14px; z-index: 4; width: min(420px, calc(100% - 120px)); max-height: 45%; overflow-y: auto; border-radius: var(--fb-karte); }
.fb-hinweis-ort .bk-hinweise { display: grid; gap: 8px; }
.fb-hinweis-ort .bk-hinweis-box { box-shadow: var(--hoehe-2); }
.fb-hinweis-ort .bk-hinweis-box:not([open]) { width: fit-content; max-width: 100%; }

/* Werkzeuge rechts */
.fb-werkzeuge { position: absolute; right: 14px; top: 14px; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.fb-plus { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--tinte); color: var(--tinte-text); box-shadow: var(--hoehe-2); transition: transform var(--dauer-1) var(--kurve); }
.fb-plus .ic { width: 24px; height: 24px; stroke-width: 2.2; }
.fb-plus:active { transform: scale(.95); }
.fb-werkzeug-spalte { display: grid; justify-items: center; gap: 2px; padding: 4px; border-radius: var(--fb-karte); background: var(--grund); box-shadow: var(--hoehe-2); }
.fb-werkzeug { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 6px; color: var(--text-2); }
.fb-werkzeug .ic { width: 18px; height: 18px; }
@media (hover: hover) { .fb-werkzeug:hover { background: var(--flaeche-2); color: var(--text); } }
.fb-zoomwert { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; padding: 2px 0 3px; }

/* Blockauswahl */
.fb-menue { position: absolute; z-index: 8; width: 340px; max-height: calc(100% - 24px); overflow-y: auto; padding: 10px 12px 12px; border-radius: var(--fb-karte); background: var(--grund); box-shadow: var(--hoehe-3); }
.fb-menue-kopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; font-size: 14px; }
.fb-menue-kopf .icon-knopf { margin-right: -6px; }
.fb-menue-abschnitt { display: grid; gap: 6px; padding: 6px 0; }
.fb-menue-titel { font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.fb-kacheln-menue { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.fb-kachel { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 10px; border-radius: 6px; background: var(--fb-kopf-g); color: var(--text); font-size: 13px; font-weight: 500; text-align: left; }
.fb-kachel .fb-sym { width: 26px; height: 26px; border-radius: 4px; }
@media (hover: hover) { .fb-kachel:hover { box-shadow: 0 0 0 1px var(--fb-kopf-p); } }
.fb-kachel:focus-visible { outline: 2px solid var(--fb-auswahl); outline-offset: 1px; }

/* Vorschau und Versionen als Spalte rechts über der Fläche */
.fb-vorschau, .fb-versionen { position: absolute; z-index: 5; top: 0; right: 0; bottom: 0; width: 360px; overflow-y: auto; overscroll-behavior: contain; background: var(--grund); border-left: var(--haar) solid var(--linie); box-shadow: -8px 0 24px oklch(30% .02 60 / 8%); }
.fb-vorschau[hidden], .fb-versionen[hidden] { display: none; }
.fb-vorschau .bk-vorschau-spalte { position: static; padding: 14px 12px 20px; }
.fb-vorschau { --bk-handy: 320px; }
.fb-vorschau .bkv-bildschirm { height: min(600px, calc(100dvh - 300px)); min-height: 420px; }
.fb-rumpf.mit-vorschau .fb-werkzeuge, .fb-rumpf.mit-versionen .fb-werkzeuge { right: 374px; }
.fb-rumpf.mit-vorschau .fb-tipp, .fb-rumpf.mit-versionen .fb-tipp { display: none; }
.fb-versionen { padding: 16px 18px; display: grid; gap: 12px; align-content: start; }
.fb-versionen-kopf { display: flex; align-items: center; justify-content: space-between; }
.fb-versionen-kopf h2 { font-size: 16px; font-weight: 600; }
.fb-versionen-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fb-versionen-liste li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--fb-karte); background: var(--flaeche); }
.fb-versionen-liste li > div { display: grid; gap: 2px; min-width: 0; }
.fb-versionen-liste .fb-lozenge { height: 18px; font-size: 11px; justify-self: start; }
.fb-versionen-liste .knopf { min-height: 34px; padding: 0 12px; font-size: 13px; }
.fb-versionen-leer { padding: 18px; border-radius: var(--fb-karte); background: var(--flaeche); text-align: center; }

/* Eigener Dialog (statt window.confirm) */
.fb-dialog-hinter { position: fixed; inset: 0; z-index: 70; background: var(--abdunkeln); }
.fb-dialog { position: fixed; z-index: 71; left: 50%; top: 50%; width: min(420px, calc(100vw - 32px)); transform: translate(-50%, -50%); display: grid; gap: 10px; padding: 20px 22px 18px; border-radius: var(--rund-gross); background: var(--grund); box-shadow: var(--hoehe-3); }
.fb-dialog h2 { font-size: 17px; font-weight: 600; }
.fb-dialog p { margin: 0; font-size: 14px; }
.fb-dialog-knoepfe { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.fb-dialog-knoepfe .knopf { min-height: 40px; padding: 0 16px; }

/* ---------- Galerie im Editor (auch Schrittliste) ---------- */
.bk-galerie { gap: 10px; }
.bk-gk { display: grid; gap: 8px; padding: 10px 12px; border-radius: var(--fb-karte, 10px); background: var(--flaeche); box-shadow: inset 0 0 0 var(--haar) var(--linie); }
.bk-gk-kopf { display: flex; align-items: center; justify-content: space-between; }
.bk-gk-kopf .icon-knopf { margin: -6px -8px -6px 0; }
.bk-gk-reihe { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.bk-gk-bild { flex: none; width: 76px; aspect-ratio: 1.91; border-radius: 6px; object-fit: cover; background: var(--flaeche-2); }
.bk-gk-bild.leer { display: grid; place-items: center; color: var(--text-3); }
.bk-gk-bild.leer .ic { width: 18px; height: 18px; }
.bk-gk-felder { flex: 1; min-width: 0; display: grid; gap: 6px; }
.bk-gk .bk-knopf-zeile { padding-top: 6px; border-top: var(--haar) solid var(--linie); }

/* Galerie in der Handy-Vorschau und im Probechat */
.bkv-galerie { display: flex; gap: 8px; overflow-x: auto; max-width: 100%; padding: 2px 2px 6px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.bkv-galerie::-webkit-scrollbar { display: none; }
.bkv-gkarte { flex: 0 0 78%; display: grid; align-content: start; border-radius: 18px; overflow: hidden; background: var(--blase-sie); scroll-snap-align: start; }
.bkv-gkarte img, .bkv-gk-leer { width: 100%; aspect-ratio: 1.91; object-fit: cover; display: grid; place-items: center; background: var(--flaeche-2); color: var(--text-3); }
.bkv-gk-leer .ic { width: 22px; height: 22px; }
.bkv-gk-text { display: grid; gap: 1px; padding: 8px 12px 9px; line-height: 1.3; }
.bkv-gk-text strong { font-weight: 600; }
.bkv-gk-text span { font-size: 12px; color: var(--text-3); }

/* ---------- Teil B3b: App-Leiste im Editor ausblenden ---------- */
/* flowbuilder.js setzt html.fb-vollbild, solange der Editor offen ist und die Leiste nicht gewünscht wird */
@media (min-width: 1024px) {
  html.fb-vollbild:has(.bk.fb-an) .seitenleiste { display: none; }
  html.fb-vollbild:has(.bk.fb-an) #app { grid-template-columns: minmax(0, 1fr); }
  html.fb-vollbild:has(.bk.fb-an) #inhalt { margin-left: var(--rahmen); }
  html.fb-vollbild .seite:has(.bk.fb-an) { padding-left: 8px; padding-right: 8px; }
}
@media (max-width: 1023px) { .fb-an .fb-appleiste { display: none; } }
.fb-an .fb-appleiste.an { color: var(--text); background: var(--flaeche-2); }

/* Optionen-Menü im Kopf */
.fb-optionen-ort:empty { display: none; }
.fb-optionen-hinter { position: fixed; inset: 0; z-index: 60; }
.fb-optionen { position: fixed; z-index: 61; width: 300px; display: grid; gap: 2px; padding: 6px; border-radius: var(--fb-karte, 10px); background: var(--grund); box-shadow: var(--hoehe-3); }
.fb-opt { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 6px; text-align: left; color: var(--text); font-size: 13.5px; font-weight: 500; }
.fb-opt .ic { flex: none; width: 17px; height: 17px; margin-top: 1px; color: var(--text-2); }
.fb-opt > span { display: grid; gap: 1px; min-width: 0; }
.fb-opt small { font-size: 12px; font-weight: 400; color: var(--text-3); }
.fb-opt:disabled { opacity: .45; cursor: default; }
.fb-opt.gefahr, .fb-opt.gefahr .ic { color: var(--koralle-t); }
@media (hover: hover) { .fb-opt:not(:disabled):hover { background: var(--flaeche); } }
.fb-opt:focus-visible { outline: 2px solid var(--fb-auswahl, var(--akzent)); outline-offset: -2px; }
.fb-opt-linie { height: var(--haar); margin: 4px 6px; background: var(--linie); }

/* Start-Block: alle Auslöser als Zeilen */
.fb-ausl-liste { display: grid; gap: 6px; }
.fb-ausloeser { grid-template-columns: auto minmax(0, 1fr); align-items: start; column-gap: 8px; }
.fb-ausloeser.aktiv { box-shadow: inset 0 0 0 1.5px var(--fb-auswahl); }
.fb-ausloeser.aus { opacity: .6; }
.fb-ausloeser .fb-ausl-sym { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 4px; background: var(--fb-kopf-g); color: var(--fb-kopf-t); }
.fb-ausl-sym .ic { width: 13px; height: 13px; }
.fb-ausl-text { display: grid; gap: 2px; min-width: 0; }
.fb-ausloeser .fb-ausl-text > strong { color: var(--text); }
.fb-ausloeser .fb-ausl-aus { display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 4px; background: var(--grau-g); color: var(--grau-t); font-size: 10.5px; font-weight: 600; vertical-align: 1px; }
.fb-ausl-neu { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 34px; margin-top: 6px; border-radius: 6px; border: var(--haar) dashed var(--linie-stark); color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.fb-ausl-neu .ic { width: 14px; height: 14px; }
@media (hover: hover) { .fb-ausl-neu:hover { color: var(--text); border-color: var(--text-3); background: var(--fb-box); } }

/* Mehrfachauswahl */
.fb-block.fb-mehrfach { box-shadow: 0 0 0 2px var(--fb-auswahl), 0 0 0 5px color-mix(in oklch, var(--fb-auswahl) 18%, transparent); }
.fb-rahmen-wahl { position: absolute; z-index: 5; left: 0; top: 0; border: 1.5px solid var(--fb-auswahl); border-radius: 4px; background: color-mix(in oklch, var(--fb-auswahl) 10%, transparent); pointer-events: none; }
.fb-flaeche.rahmt { cursor: crosshair; }
.fb-mehr-knoepfe { display: grid; gap: 8px; }
.fb-mehr-knoepfe .knopf { justify-content: flex-start; }
.fb-mehr-knoepfe .knopf kbd { margin-left: auto; }
.bk .fb-mehr-knoepfe .knopf.gefahr { background: var(--grund); border-color: var(--linie-stark); color: var(--koralle-t); }

/* Zahlen je Schritt wie in ManyChat: erreicht, Tabelle Ereignis, Gesamt, Eindeutig */
.fb-pz-erreicht { margin: 0; font-size: 13px; color: var(--text-2); }
.fb-pz-erreicht strong { font-size: 16px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.fb-pz-tabelle { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.fb-pz-tabelle th, .fb-pz-tabelle td { padding: 5px 0; text-align: right; border-top: var(--haar) solid var(--linie); }
.fb-pz-tabelle thead th { border-top: 0; padding-top: 0; font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.fb-pz-tabelle th:first-child { text-align: left; font-weight: 500; color: var(--text-2); }
.fb-pz-tabelle thead th:first-child { color: var(--text-3); }
.fb-pz-tabelle td { width: 72px; color: var(--text); font-weight: 600; }
.fb-pz-klicks td:nth-child(2) { width: auto; white-space: nowrap; }
.fb-pz-klicks td .leise { font-weight: 400; }
.fb-pz-klicks tbody th { overflow-wrap: anywhere; }
.fb-pz-fuss { margin: 0; }

/* ---------- Teil B3b: Auslöser-Panel ---------- */
.bk-ausl-liste { display: grid; gap: 6px; }
.bk-ausl-karte { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 7px 8px 7px 12px; border-radius: 10px; border: var(--haar) solid var(--linie-stark); background: var(--grund); cursor: pointer; min-width: 0; }
.bk-ausl-karte.aktiv { border-color: var(--akzent); box-shadow: inset 0 0 0 1px var(--akzent); }
.bk-ausl-karte.aus .bk-sym, .bk-ausl-karte.aus .bk-karte-text { opacity: .55; }
.bk-ausl-karte:focus-visible { outline: 2px solid var(--akzent-hell); outline-offset: 2px; }
@media (hover: hover) { .bk-ausl-karte:not(.aktiv):hover { background: var(--flaeche); } }
.bk-ausl-karte .schalter { min-height: 0; }
.bk-ausl-weg { width: 30px; height: 30px; margin-left: -4px; }
.bk-ausl-weg .ic { width: 15px; height: 15px; }
.bk-ausl-neu { justify-self: start; margin-top: 2px; }
.bk-ausl-optionen { display: grid; gap: 14px; padding: 12px; border-radius: 10px; background: var(--flaeche); }
.bk-ausl-optionen-kopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.bk-ausl-optionen-kopf .bk-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-ausl-optionen-kopf .bk-wahl-aendern { margin-right: -8px; }
.bk-ausl-optionen .feld, .bk-ausl-optionen select { background: var(--grund); }
.bk-wahl-gruppe { padding: 9px 14px 5px; background: var(--flaeche); font-weight: 600; letter-spacing: .02em; border-top: var(--haar) solid var(--linie); }
.bk-wahl-gruppe:first-child { border-top: 0; }
.bk-bt-bereich { gap: 8px; }
.bk-bt-modus { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
.bk-bt-modus label { justify-content: center; }
.bk-bt-bereich .bk-bt-auf { justify-self: start; margin-left: -8px; }
.bk-bt-bereich .al-bt-raster { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.bk-bt-bereich .al-bt-zeile { font-size: 11px; }
.bk-qr-zeile { display: grid; gap: 8px; justify-items: start; }
.bk-qr { display: grid; place-items: center; width: 168px; min-height: 168px; padding: 8px; border-radius: 6px; background: #fff; box-shadow: inset 0 0 0 var(--haar) var(--linie-stark); }
.bk-qr svg { display: block; width: 152px; height: 152px; }
.bk-qr .leise { padding: 8px; text-align: center; color: oklch(45% 0 0); }
.bk-qr-knoepfe { display: flex; gap: 6px; }

/* Dialog "Neuer Auslöser" */
.bk-ausl-ort:empty { display: none; }
.bk-ad-hinter { position: fixed; inset: 0; z-index: 90; background: oklch(20% 0.01 60 / 38%); }
.bk-ad { position: fixed; z-index: 91; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(820px, calc(100vw - 32px)); max-height: min(640px, calc(100dvh - 48px)); display: flex; flex-direction: column; border-radius: 10px; background: var(--grund); box-shadow: var(--hoehe-3); overflow: hidden; }
.bk-ad-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: var(--haar) solid var(--linie); }
.bk-ad-kopf h2 { margin: 0; font-size: 18px; font-weight: 600; }
.bk-ad-kopf p { margin: 2px 0 0; }
.bk-ad-kopf .icon-knopf { margin: -6px -8px 0 0; }
.bk-ad-rumpf { flex: 1; min-height: 0; display: grid; grid-template-columns: 190px minmax(0, 1fr); }
.bk-ad-nav { display: grid; align-content: start; gap: 2px; padding: 12px 8px; border-right: var(--haar) solid var(--linie); background: var(--flaeche); }
.bk-ad-nav-knopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding: 0 10px; border-radius: 6px; text-align: left; font-size: 13.5px; font-weight: 500; color: var(--text); }
@media (hover: hover) { .bk-ad-nav-knopf:hover { background: var(--flaeche-2); } }
.bk-ad-inhalt { display: grid; align-content: start; gap: 18px; padding: 14px 18px 20px; overflow-y: auto; }
.bk-ad-suche { position: relative; display: block; }
.bk-ad-suche .ic { position: absolute; left: 10px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.bk-ad-suche .feld { width: 100%; padding-left: 34px; }
.bk-ad-gruppe { display: grid; gap: 8px; scroll-margin-top: 12px; }
.bk-ad-gruppe h3 { margin: 0; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.bk-ad-raster { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bk-ad-karte { display: flex; align-items: flex-start; gap: 10px; min-height: 64px; padding: 10px 12px; border-radius: 10px; border: var(--haar) solid var(--linie-stark); background: var(--grund); text-align: left; color: var(--text); }
.bk-ad-karte .bk-karte-zus { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bk-ad-karte .normal { font-weight: 400; }
@media (hover: hover) { .bk-ad-karte:hover { border-color: var(--akzent); background: var(--flaeche); } }
.bk-ad-karte:focus-visible { outline: 2px solid var(--akzent-hell); outline-offset: 2px; }
@media (max-width: 759px) {
  .bk-ad { left: 0; top: auto; bottom: 0; transform: none; width: 100vw; max-height: calc(100dvh - 24px); border-radius: 10px 10px 0 0; }
  .bk-ad-rumpf { grid-template-columns: minmax(0, 1fr); }
  .bk-ad-nav { display: none; }
  .bk-ad-raster { grid-template-columns: minmax(0, 1fr); }
  .bk-ad-inhalt { padding: 12px 16px 24px; }
  .bk-ad-karte { min-height: 56px; }
  .bk-ausl-weg { width: 40px; height: 40px; }
  .bk-bt-bereich .bk-bt-modus { max-width: 100%; }
  .bk-bt-bereich .al-bt-raster { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Unter 980 px gibt es die Fläche nicht (Schrittliste) ---------- */
@media (max-width: 979px) { .bk.fb-an { height: auto; } }
@media (prefers-reduced-motion: reduce) { .fb-welt.weich, .fb-seite-knopf, .fb-seite-knopf .ic { transition: none; } }

/* B3e: Auslöser mit KI-Absichten, je Absicht ein Ausgang statt "Dann" */
.fb-ki-weiche { display: grid; gap: 6px; padding-top: 2px; border-top: var(--haar) dashed var(--linie-stark); margin-top: 2px; }
.fb-ki-weiche .fb-zeile { color: var(--sand-t); }
.fb-ki-weiche .fb-zeile.zeit { color: var(--text-2); }
