/* Formular-Studio (FS1). Aufbau nach curaflow-leitstand/views/formulare/formulare.css und portal/formulare/formulare.css,
   Werte nur aus css/tokens.css (Look v6, css/LOOK.md). Alles hängt unter .fo-wurzel bzw. trägt fo- vorn. */

.fo-wurzel { display: flex; flex-direction: column; gap: var(--a4); min-width: 0; }
.fo-leise { color: var(--text-still); font-size: var(--gr-klein); }

/* Kopf eines Formulars */
.fo-kopf { display: flex; align-items: flex-start; gap: var(--a4); flex-wrap: wrap; }
.fo-kopf__titel { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: var(--a2); }
.fo-kopf__titel h2 { font-size: var(--gr-titel); font-weight: 600; letter-spacing: -.015em; line-height: 1.25; overflow-wrap: anywhere; }
.fo-kopf__rechts { display: flex; align-items: center; gap: var(--a2); flex-wrap: wrap; }
.fo-lage { display: flex; gap: var(--a2); flex-wrap: wrap; }
.fo-wurzel .reiterleiste { margin-bottom: 0; }

/* Liste */
.fo-tabelle { width: 100%; border-collapse: collapse; }
.fo-tabelle th { text-align: left; font-weight: 500; font-size: var(--gr-klein); color: var(--text-still); padding: var(--a2) var(--a4); border-bottom: 1px solid var(--linie); }
.fo-tabelle td { padding: var(--a3) var(--a4); border-bottom: 1px solid var(--linie); vertical-align: middle; }
.fo-tabelle tr:last-child td { border-bottom: 0; }
.fo-tabelle tbody tr:hover { background: var(--flaeche-still); }
.fo-tabelle a { color: inherit; }
.fo-zahl { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th.fo-zahl { text-align: right; }
.fo-weg { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fo-l-name { display: flex; align-items: center; gap: var(--a3); text-decoration: none; min-width: 0; }
.fo-l-name > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.fo-l-name b { font-weight: 600; }
.fo-l-name small { color: var(--text-leise); font-size: var(--gr-klein); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.fo-l-name:hover b { text-decoration: underline; }

/* Fenster (Neues Formular, Inhalt hinzufügen) */
.fo-schleier { position: fixed; inset: 0; background: var(--text); opacity: .18; z-index: 40; }
.fo-fenster { position: fixed; z-index: 41; left: 50%; top: 12vh; transform: translateX(-50%); width: min(720px, calc(100vw - 32px));
  max-height: 76vh; overflow: auto; background: var(--flaeche); border: 1px solid var(--linie-stark); border-radius: var(--r-buehne); box-shadow: var(--hebung-fenster); }
.fo-fenster__kopf { display: flex; align-items: center; gap: var(--a3); padding: var(--a4) var(--a5); border-bottom: 1px solid var(--linie); }
.fo-fenster__kopf h2 { flex: 1; font-size: var(--gr-gross); font-weight: 600; }
.fo-fenster__inhalt { padding: var(--a5); display: flex; flex-direction: column; gap: var(--a4); }
.fo-kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--a3); }
.fo-kachel { display: flex; align-items: flex-start; gap: var(--a3); text-align: left; padding: var(--a4); border: 1px solid var(--linie-stark); border-radius: var(--r-gross); background: var(--flaeche); color: var(--text); }
.fo-kachel:hover { background: var(--flaeche-still); }
.fo-kachel > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.fo-kachel small { color: var(--text-leise); font-size: var(--gr-klein); line-height: 1.4; }
.fo-h-wohin { display: flex; align-items: center; gap: var(--a3); flex-wrap: wrap; }
.fo-h-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--a4); }
.fo-h-gruppe { display: flex; flex-direction: column; gap: 2px; }

/* Einträge (Seiten links, Fragetypen) */
.fo-eintrag { display: flex; align-items: center; gap: var(--a2); width: 100%; min-height: 32px; padding: 4px var(--a2); border: 1px solid transparent; border-radius: var(--r-mittel);
  background: none; color: var(--text-zweit); text-align: left; font-size: var(--gr-klein); }
.fo-eintrag:hover { background: var(--flaeche-warm); color: var(--text); }
.fo-eintrag[aria-current="true"] { background: var(--flaeche-still); border-color: var(--linie-stark); color: var(--text); font-weight: 600; }
.fo-eintrag--rand { border-color: var(--linie-stark); }
.fo-eintrag__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fo-eintrag[draggable="true"] { cursor: grab; }
.fo-eintrag--zieht { opacity: .4; }
.fo-eintrag--ziel { box-shadow: inset 0 2px 0 var(--akzent); }
.fo-typ { display: inline-flex; align-items: center; gap: 3px; flex: none; min-width: 36px; padding: 2px 6px; border-radius: var(--r-marke);
  background: var(--akzent-sanft); color: var(--akzent-tief); font-size: var(--gr-winzig); font-weight: 600; font-variant-numeric: tabular-nums; }
.fo-typ svg { color: inherit; }

/* Editor: drei Spalten */
.fo-e-raster { display: grid; grid-template-columns: 230px minmax(0, 1fr) 270px; min-height: 540px; }
.fo-e-links { display: flex; flex-direction: column; gap: 2px; padding: var(--a3); border-right: 1px solid var(--linie); overflow: auto; }
.fo-e-links .abschnittstitel { margin: var(--a3) var(--a2) 2px; }
.fo-e-links .abschnittstitel:first-child { margin-top: 0; }
.fo-e-dazu { display: flex; gap: var(--a1); margin-top: var(--a1); }
.fo-e-mitte { display: flex; flex-direction: column; min-width: 0; background: var(--flaeche-still); }
.fo-e-leiste { display: flex; gap: var(--a2); padding: var(--a3); border-bottom: 1px solid var(--linie); background: var(--flaeche); }
.fo-e-leinwand { flex: 1; display: flex; padding: var(--a6); }
.fo-e-leinwand > .fo-b { flex: 1; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r-gross); }
.fo-e-rechts { display: flex; flex-direction: column; gap: var(--a4); padding: var(--a4); border-left: 1px solid var(--linie); }
.fo-s-kopf { font-size: var(--gr-gross); font-weight: 600; }
.fo-s-block { display: flex; flex-direction: column; gap: var(--a2); }
.fo-s-titel { font-size: var(--gr-klein); color: var(--text-leise); font-weight: 500; }
.fo-s-option { display: flex; gap: var(--a1); align-items: center; }
.fo-s-knoepfe { display: flex; flex-wrap: wrap; gap: var(--a2); }
.fo-s-schalter { display: flex; align-items: center; justify-content: space-between; gap: var(--a3); width: 100%; padding: 6px 0; border: 0; background: none; color: var(--text); font-size: var(--gr-text); text-align: left; }
.fo-s-schalter:disabled { opacity: .5; }
.fo-schalter { position: relative; flex: none; width: 30px; height: 18px; border-radius: 9px; background: var(--linie-stark); transition: background .15s; }
.fo-schalter::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--flaeche); transition: transform .15s; }
[aria-checked="true"] > .fo-schalter { background: var(--primaer); }
.fo-e-rechts .segment--voll { flex-direction: column; }
.fo-e-rechts .segment--voll button { justify-content: center; }
[aria-checked="true"] > .fo-schalter::after { transform: translateX(12px); }
.fo-weg-knopf { align-self: flex-start; color: var(--spaet-text); }
.fo-feld { width: 100%; min-height: 32px; padding: 5px 9px; border: 1px solid var(--linie-stark); border-radius: var(--r-klein); background: var(--flaeche); color: var(--text); font: inherit; }
.fo-feld:focus, .fo-still:focus { outline: 2px solid var(--text); outline-offset: 1px; }

/* Ein Bildschirm (Editor und Vorschau) */
.fo-b { display: flex; flex-direction: column; gap: var(--a4); padding: var(--a8) var(--a8); }
.fo-b--mitte { align-items: center; justify-content: center; text-align: center; }
.fo-b--mitte .fo-b-titel, .fo-b--mitte .fo-b-text { width: 100%; max-width: 560px; }
.fo-b--mitte .fo-still { text-align: center; }
.fo-b--seite { justify-content: center; gap: var(--a6); max-width: 640px; width: 100%; margin: 0 auto; }
.fo-b-frage { display: flex; gap: var(--a3); padding: var(--a3); border-radius: var(--r-gross); border: 1px solid transparent; }
.fo-b-frage[role="button"] { cursor: pointer; }
.fo-b-frage[role="button"]:hover { background: var(--flaeche-still); }
.fo-b-frage--gewaehlt { border-color: var(--akzent-rand); }
.fo-b-nr { display: inline-flex; align-items: center; align-self: flex-start; gap: 2px; flex: none; height: 28px; color: var(--akzent-tief); font-size: var(--gr-klein); font-weight: 600; }
.fo-b-inhalt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--a2); }
.fo-b-titel { display: flex; align-items: flex-start; gap: var(--a1); font-size: 21px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
.fo-b--mitte .fo-b-titel { justify-content: center; }
.fo-b-text { color: var(--text-leise); line-height: 1.5; }
.fo-b-pflicht { color: var(--akzent); }
.fo-still { width: 100%; border: 0; background: none; color: inherit; font: inherit; padding: 0; resize: none; overflow: hidden; border-radius: var(--r-marke); }
.fo-still::placeholder { color: var(--text-still); }
.fo-unterstrich { border-bottom: 1px solid var(--linie-stark); padding: 6px 0; font-size: var(--gr-gross); border-radius: 0; }
.fo-unterstrich:focus { outline: 0; border-bottom-color: var(--text); }
.fo-b-wahl { display: flex; flex-direction: column; gap: var(--a2); align-items: flex-start; }
.fo-b-skala { flex-direction: row; flex-wrap: wrap; }
.fo-wahl { display: inline-flex; align-items: center; gap: var(--a2); min-width: 180px; min-height: 36px; padding: 5px 10px; border: 1px solid var(--linie-stark); border-radius: var(--r-mittel);
  background: var(--flaeche); color: var(--text); font: inherit; text-align: left; }
.fo-wahl:hover:not(:disabled) { background: var(--flaeche-warm); }
.fo-wahl[aria-pressed="true"] { border-color: var(--akzent); background: var(--akzent-sanft); }
.fo-wahl kbd { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 1px solid var(--linie-stark); border-radius: var(--r-marke); font: 600 var(--gr-winzig) var(--schrift-text); color: var(--text-leise); background: var(--flaeche); }
.fo-wahl--quadrat { min-width: 40px; justify-content: center; font-variant-numeric: tabular-nums; }
.fo-wahl:disabled { cursor: default; }
.fo-b-datum { width: auto; }
.fo-ablage { display: flex; flex-direction: column; gap: var(--a1); padding: var(--a5); border: 1px dashed var(--linie-stark); border-radius: var(--r-gross); color: var(--text-leise); cursor: pointer; }
.fo-ablage span { display: inline-flex; align-items: center; gap: var(--a2); }
.fo-ablage input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.fo-b-fehler { display: inline-flex; align-items: center; gap: var(--a1); color: var(--spaet-text); font-size: var(--gr-klein); }
.fo-b-ok { display: flex; align-items: center; gap: var(--a3); }
.fo-gross { min-height: 40px; padding: 8px 18px; font-size: var(--gr-gross); }

/* Vorschau */
.fo-a-kasten { position: relative; }
.fo-a-sicht { position: absolute; top: var(--a3); right: var(--a3); z-index: 1; }
.fo-a-buehne { display: flex; flex-direction: column; min-height: 520px; }
.fo-a-mitte { flex: 1; display: flex; align-items: center; justify-content: center; }
.fo-a-mitte > .fo-b { width: 100%; }
.fo-a-fuss { display: flex; align-items: center; gap: var(--a3); padding: var(--a3) var(--a4); border-top: 1px solid var(--linie); }
.fo-a-leiste { flex: 1; }

/* Antworten */
.fo-antworten .kasten__kopf .segment { margin-left: auto; }
.fo-r-liste { display: flex; flex-direction: column; }
.fo-r-block { display: flex; flex-direction: column; gap: var(--a3); padding: var(--a4) var(--a5); border-bottom: 1px solid var(--linie); }
.fo-r-block:last-child { border-bottom: 0; }
.fo-r-kopf { display: flex; align-items: center; gap: var(--a3); }
.fo-r-kopf b { flex: 1; min-width: 0; }
.fo-r-anteile { display: flex; flex-direction: column; gap: var(--a2); max-width: 520px; }
.fo-r-anteil { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--a3); font-size: var(--gr-klein); }
.fo-r-anteil b { font-weight: 500; color: var(--text-leise); font-variant-numeric: tabular-nums; }
.fo-r-anteil .leiste { grid-column: 1 / -1; }
.fo-r-schnitt b { font-size: var(--gr-titel); font-weight: 600; }
.fo-r-texte { display: flex; flex-direction: column; gap: var(--a2); }
.fo-r-zitat { padding-left: var(--a3); border-left: 2px solid var(--linie-stark); color: var(--text-zweit); white-space: pre-wrap; }
.fo-r-felder { grid-template-columns: minmax(160px, 1fr) minmax(0, 2fr); }
.fo-r-felder dd { white-space: pre-wrap; }
.fo-r-leer { display: flex; flex-direction: column; align-items: flex-start; gap: var(--a2); padding: var(--a6) var(--a5); }

/* Schmal: Spalten untereinander */
@media (max-width: 1100px) {
  .fo-e-raster { grid-template-columns: 200px minmax(0, 1fr); }
  .fo-e-rechts { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--linie); }
}
@media (max-width: 720px) {
  .fo-e-raster { grid-template-columns: minmax(0, 1fr); }
  .fo-e-links { border-right: 0; border-bottom: 1px solid var(--linie); max-height: 260px; }
  .fo-e-leinwand { padding: var(--a3); }
  .fo-b { padding: var(--a5) var(--a4); }
  .fo-tabelle th:nth-child(3), .fo-tabelle td:nth-child(3), .fo-tabelle th:nth-child(5), .fo-tabelle td:nth-child(5) { display: none; }
}
