/* Formularbauer, Handy-Vorschau, Ausfüllen und Prüfung */

input[type="date"], textarea {
  min-height: 44px;
  border: 1px solid #aeb7c4;
  border-radius: 6px;
  padding: 8px 12px;
  font: inherit;
  background: #fff;
  width: 100%;
}
input[type="text"]:not(.form-control), select:not(.form-control) { width: 100%; }
.composer input { width: auto; }
textarea { resize: vertical; }

a.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
button.small { min-height: 44px; padding: 0 12px; font-size: 14px; }
button.icon { min-width: 44px; padding: 0; }
button.voll { width: 100%; margin-top: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.check { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; cursor: pointer; }
.actions { align-items: center; margin-top: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.abschnitt { margin: 24px 0 8px; }
h3 { font-size: 16px; margin: 0; }
.notice-bad { background: var(--bad-bg); color: var(--bad-fg); padding: 10px 14px; border-radius: 8px; margin: 8px 0; }
.notice-bad p { margin: 4px 0 0; white-space: pre-wrap; }

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 16px 0; flex-wrap: wrap; }
.tabs .tab { background: transparent; color: var(--muted); border: none; border-radius: 6px 6px 0 0; font-weight: 600; }
.tabs .tab.active { background: var(--card); color: var(--primary); box-shadow: inset 0 -3px 0 var(--primary); }

.liste-zeile { display: flex; gap: 12px; align-items: center; }
.liste-zeile p { margin: 4px 0 0; }
.link-karte { color: inherit; text-decoration: none; }
.link-karte:hover { border-color: var(--primary); }

/* Editor mit Vorschau */
.content:has(.editor) { max-width: 1280px; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; align-items: start; }
.editor-builder { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px; min-height: 480px; }
.editor-builder .formcomponents { position: sticky; top: 12px; flex: 0 0 200px; max-width: 200px; }
.editor-builder .formarea { flex: 1 1 0; max-width: none; min-width: 0; }
.editor-builder .formcomponents .formcomponent { width: 100%; text-align: left; }
.editor-builder .drag-container { min-height: 300px; }

/* Form.io-Formulare in der App */
.fio.fio-laedt { position: relative; pointer-events: none; opacity: 0.55; min-height: 120px; }
.fio.fio-laedt::before {
  content: "Formular wird geladen";
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 14px;
  font-weight: 600;
  opacity: 1;
}
.fio .formio-component { margin-bottom: 16px; }
.fio .card { border-color: var(--line); }
.fio .card-header { background: var(--bg); }
.fio .card-title { font-size: 16px; font-weight: 600; }
.fio .form-check-input { width: 22px; height: 22px; margin-top: 0; }
.fio .form-check-label { padding-left: 8px; min-height: 32px; display: inline-flex; align-items: center; }
.fio .formio-component-radio .form-check-inline { margin-right: 20px; }
.uebersicht .karte { margin-bottom: 16px; }

.editor-vorschau { position: sticky; top: 16px; }
.vorschau-titel { display: flex; flex-direction: column; margin-bottom: 8px; }
.phone {
  width: 375px;
  max-width: 100%;
  height: 720px;
  margin: 0 auto;
  border: 12px solid #1b2430;
  border-radius: 40px;
  background: #1b2430;
  box-shadow: 0 12px 32px #0b122033;
  overflow: hidden;
}
.phone-screen { height: 100%; display: flex; flex-direction: column; background: var(--bg); border-radius: 28px; overflow: hidden; }
.phone-bar { background: #14233b; color: #fff; padding: 22px 16px 12px; font-weight: 600; text-align: center; }
.phone-body { flex: 1 1 auto; overflow-y: auto; padding: 12px; }
.phone-body .karte { height: 200px; }

.qr-panel { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.qr-panel p { margin: 6px 0; }
.qr-panel .grow { flex: 1 1 280px; }
.qr { width: 220px; height: 220px; flex: 0 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.qr svg { width: 100%; height: 100%; display: block; }

/* Felder */
.feld { margin-bottom: 18px; }
.f-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.f-hint { color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.f-head { margin: 20px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.f-wert { margin: 0; padding: 8px 0; white-space: pre-wrap; }

.seg { display: inline-flex; border: 1px solid #c5ccd6; border-radius: 6px; overflow: hidden; }
.seg button { background: #fff; color: var(--text); border: none; border-radius: 0; min-width: 72px; }
.seg button + button { border-left: 1px solid #c5ccd6; }
.seg button.seg-on { background: var(--primary); color: #fff; }
.seg button:disabled { opacity: 1; cursor: default; }
.seg button:disabled:not(.seg-on) { color: var(--muted); }

.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.foto { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.foto img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.foto-leer { aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.foto figcaption { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; font-size: 13px; word-break: break-word; }
.foto figcaption .check { min-height: 36px; }
.foto-add {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  margin-top: 8px;
  border: 2px dashed #aeb7c4;
  border-radius: 8px;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  position: relative;
}
.foto-add:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.foto-add.busy { color: var(--muted); cursor: progress; }
.sr-file { position: absolute; opacity: 0; width: 1px; height: 1px; }

.karte { height: 260px; border-radius: 8px; border: 1px solid var(--line); background: #e8ecf2; z-index: 0; }

/* Prüfung */
.pruef-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.content:has(.pruef-layout) { max-width: 1280px; }
.pruef-item { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 16px; }
.bezug { background: var(--bg); border-left: 4px solid var(--primary); border-radius: 6px; padding: 8px 10px; margin-bottom: 10px; }
.bezug-titel { font-size: 12px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 4px; }
.bezug .feld { margin-bottom: 0; }
.bezug .bezug-titel + .feld > .f-label { display: none; }

.schmal { max-width: 640px; margin: 0 auto; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--line); }

@media (max-width: 960px) {
  .editor, .pruef-layout { grid-template-columns: 1fr; }
  .editor-vorschau { position: static; }
}
@media (max-width: 600px) {
  .grid2 { grid-template-columns: 1fr; }
  .topbar { padding: 8px 16px; }
  .phone { border-width: 8px; height: 640px; }
}
