:root {
  --primaer: #0e6e6e;
  --primaer-dunkel: #0a5252;
  --hintergrund: #f4f6f6;
  --karte: #ffffff;
  --text: #1f2a2a;
  --gedaempft: #6b7a7a;
  --rahmen: #dde4e4;
  --fehler: #b3261e;
  --fehler-bg: #fdeceb;
  --hinweis-bg: #e8f4f4;
}

.bogen-editor-abschnitt summary { cursor: pointer; }
.bogen-editor-abschnitt[open] summary { margin-bottom: 20px; }
.bogen-editor-feld { border-top: 1px solid var(--rahmen); padding: 16px 0; }
.bogen-editor-feld > label:first-child { display: block; font-weight: 600; margin-bottom: 6px; }
.bogen-editor-feld .checkbox-zeile { display: flex; font-weight: 400; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--hintergrund);
  color: var(--text);
  line-height: 1.55;
}

.kopf {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--primaer);
  color: #fff;
}
.logo { font-weight: 700; font-size: 1.15rem; letter-spacing: 0.02em; }
.kopf-rechts { font-size: 0.9rem; opacity: 0.9; }

.inhalt { max-width: 980px; margin: 0 auto; padding: 24px 16px 48px; }

.fuss {
  text-align: center;
  color: var(--gedaempft);
  font-size: 0.8rem;
  padding: 16px;
}

.karte {
  background: var(--karte);
  border: 1px solid var(--rahmen);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
}
.karte.schmal { max-width: 460px; margin: 32px auto; }
.karte.breit { max-width: 760px; margin: 0 auto; }

h1 { font-size: 1.45rem; margin: 0 0 12px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
a { color: var(--primaer); }

.gedaempft { color: var(--gedaempft); }
.klein { font-size: 0.85rem; }

.kopfzeile {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

/* Buttons */
.button {
  display: inline-block;
  background: var(--primaer);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}
.button:hover { background: var(--primaer-dunkel); }
.button.sekundaer {
  background: #fff;
  color: var(--primaer);
  border: 1px solid var(--primaer);
}
.button.sekundaer:hover { background: var(--hinweis-bg); }
.button.gefahr { background: var(--fehler); }
.button.klein { padding: 4px 10px; font-size: 0.8rem; }
.button.gross { padding: 14px 28px; font-size: 1.05rem; }
.button:disabled { opacity: 0.5; cursor: not-allowed; }
.designer-toolbar { position: sticky; top: 8px; z-index: 5; box-shadow: 0 3px 12px #0001; }
.designer-abschnitt summary { cursor: pointer; }
.designer-werkzeuge { margin: 16px 0; }
.designer-frage { border: 1px solid var(--rahmen); border-radius: 8px; padding: 16px; margin: 16px 0; background: var(--hintergrund); }
.designer-griff { cursor: grab; display: inline-block; padding: 6px; color: var(--gedaempft); }
.inline { display: inline; }

/* Formulare */
.feld { margin-bottom: 16px; }
.feld label, .feld-label {
  display: block;
  font-weight: 600;
  margin-bottom: 5px;
  font-size: 0.95rem;
}
.feld input[type="text"],
.feld input[type="email"],
.feld input[type="tel"],
.feld input[type="date"],
.feld input[type="number"],
.feld input[type="password"],
.feld select,
.feld textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--rahmen);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}
.feld input:focus, .feld select:focus, .feld textarea:focus {
  outline: 2px solid var(--primaer);
  outline-offset: -1px;
  border-color: var(--primaer);
}

.optionen { display: flex; flex-direction: column; gap: 6px; }
.checkbox-zeile {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 400;
}
.checkbox-zeile input { margin-top: 4px; }
.einwilligung {
  background: var(--hinweis-bg);
  border: 1px solid var(--rahmen);
  border-radius: 8px;
  padding: 12px;
}

.skala { display: flex; gap: 6px; flex-wrap: wrap; }
.skala-stufe { position: relative; }
.skala-stufe input { position: absolute; opacity: 0; }
.skala-stufe span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--rahmen);
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
}
.skala-stufe input:checked + span {
  background: var(--primaer);
  color: #fff;
  border-color: var(--primaer);
}

fieldset {
  border: 1px solid var(--rahmen);
  border-radius: 10px;
  padding: 20px;
  margin: 0 0 20px;
}
legend { font-weight: 700; padding: 0 8px; }

.absenden-zeile {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

/* „unauffällig"-Option und Zusammenfassung */
.unauffaellig-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--gedaempft);
  background: #f7f9f9;
  border: 1px dashed var(--rahmen);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 16px;
  cursor: pointer;
}
.abschnitt-unauffaellig .abschnitt-felder {
  opacity: 0.45;
  pointer-events: none;
}
.abschnitt-unauffaellig legend { color: var(--gedaempft); }

.zusammenfassung-box {
  background: var(--hinweis-bg);
  border: 1px solid var(--primaer);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 20px;
}
.zusammenfassung-box h2 { font-size: 1.05rem; margin: 0 0 4px; }
.zusammenfassung-spalten {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 10px;
}
.zusammenfassung-liste {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 0.9rem;
  max-height: 180px;
  overflow-y: auto;
}
.zusammenfassung-auffaellig {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(14, 110, 110, 0.25);
}
.zeichen-zaehler {
  display: block;
  text-align: right;
  font-size: 0.75rem;
  color: var(--gedaempft);
  margin-top: 2px;
}
.feld-verborgen { display: none; }

/* --- Client-Portal-Seite (Hub) --- */
.portal-bogen {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border: 2px solid var(--primaer);
  border-radius: 12px;
  padding: 20px;
  margin: 18px 0 8px;
  background: var(--hinweis-bg);
}
.portal-bogen-fertig { border-color: var(--rahmen); background: #f7f9f9; }
.portal-bogen-info { flex: 1; min-width: 220px; }
.portal-bogen-aktionen {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.portal-fortschritt { margin-top: 10px; max-width: 420px; }
.portal-fortschritt .fortschritt-balken { margin-bottom: 4px; }
.portal-dok-titel { margin-top: 28px; font-size: 1.05rem; }
.portal-dokumente {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.portal-dok {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--rahmen);
  border-radius: 10px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.portal-dok:hover {
  border-color: var(--primaer);
  box-shadow: 0 6px 18px rgba(14, 110, 110, 0.12);
  transform: translateY(-2px);
}
.portal-dok strong { color: var(--primaer); }
.portal-dok span { font-size: 0.83rem; color: var(--gedaempft); }

/* Datei-Uploads im Admin-Portal */
.upload-zeile {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.datei-liste { list-style: none; margin: 0; padding: 0; }
.datei-liste li {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-bottom: 1px solid var(--rahmen);
}
.datei-liste li:last-child { border-bottom: none; }
.kategorie-badge { background: #e8f4f4; color: var(--primaer-dunkel); }

/* Einstellungen */
.einstellungen-tabelle input[type="text"] {
  width: 100%;
  min-width: 220px;
  padding: 6px 10px;
  border: 1px solid var(--rahmen);
  border-radius: 6px;
  font-size: 0.9rem;
}
.einstellungen-tabelle td { vertical-align: top; }
.zeile-inaktiv { opacity: 0.55; }

/* Dokumentseiten */
.dokument h2 { font-size: 1.05rem; margin: 22px 0 8px; }
.dokument ul { padding-left: 22px; }
.tabelle.preise td:last-child { white-space: nowrap; text-align: right; font-weight: 600; }
.dokument-bild { margin: 18px 0 0; }
.dokument-bild img {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--rahmen);
}
.dokument-bild figcaption {
  font-size: 0.82rem;
  color: var(--gedaempft);
  margin-top: 6px;
}

/* Fortschrittsanzeige */
.fortschritt {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--karte);
  padding: 10px 0;
  margin-bottom: 16px;
}
.fortschritt-balken {
  height: 8px;
  background: var(--rahmen);
  border-radius: 999px;
  overflow: hidden;
}
.fortschritt-fuellung {
  height: 100%;
  width: 0;
  background: var(--primaer);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.fortschritt-text {
  display: block;
  margin-top: 5px;
  font-size: 0.85rem;
  color: var(--gedaempft);
}

/* Tabelle */
.tabelle { width: 100%; border-collapse: collapse; background: var(--karte); border-radius: 10px; overflow: hidden; }
.tabelle th, .tabelle td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rahmen); }
.tabelle th { background: #eef2f2; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--gedaempft); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-neu { background: var(--fehler); color: #fff; margin-left: 6px; }
.status-angelegt { background: #eef2f2; color: var(--gedaempft); }
.status-bearbeitung { background: #fff4d6; color: #8a6100; }
.status-abgeschlossen { background: #dff0d8; color: #2d6a2d; }
.status-abgelaufen { background: #f0e0e0; color: var(--fehler); }

.hinweis-box {
  background: var(--hinweis-bg);
  border: 1px solid var(--primaer);
  border-radius: 8px;
  padding: 12px 16px;
}
.fehler-box {
  background: var(--fehler-bg);
  border: 1px solid var(--fehler);
  color: var(--fehler);
  border-radius: 8px;
  padding: 12px 16px;
}
.fehler-box ul { margin: 8px 0 0; padding-left: 20px; }

.stammdaten { display: grid; grid-template-columns: 160px 1fr; gap: 6px 16px; margin: 0 0 16px; }
.stammdaten dt { font-weight: 600; color: var(--gedaempft); }
.stammdaten dd { margin: 0; }
.link-zeile { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.link-zeile code { word-break: break-all; font-size: 0.85rem; }

.aktionen { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tage-input { width: 70px; padding: 8px; border: 1px solid var(--rahmen); border-radius: 8px; }

.abschnitt-titel {
  margin: 20px 0 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--primaer);
  font-size: 1rem;
}
.antworten { margin: 0 0 8px; }
.antworten dt { font-weight: 600; font-size: 0.9rem; margin-top: 10px; }
.antworten dd { margin: 2px 0 0 14px; color: #333; white-space: pre-wrap; }

/* --- Login-Seite mit DNA-Animation --- */
.login-seite {
  min-height: 100vh;
  background: linear-gradient(140deg, #041f1f 0%, #0a3d3d 45%, #0e6e6e 100%);
  overflow-x: hidden;
}
.login-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-karte {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  animation: login-einblenden 0.7s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}
@keyframes login-einblenden {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primaer);
  letter-spacing: 0.02em;
  text-align: center;
}
.login-untertitel {
  text-align: center;
  color: var(--gedaempft);
  margin: 4px 0 24px;
  font-size: 0.95rem;
}
.login-button { width: 100%; padding: 12px; font-size: 1rem; }
.login-fuss {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.85rem;
  margin-top: 20px;
  animation: login-einblenden 0.7s 0.15s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}
@media (prefers-reduced-motion: reduce) {
  .login-karte, .login-fuss { animation: none; }
}

/* --- 3D-Landingpage --- */
.landing-seite {
  min-height: 100vh;
  background: linear-gradient(150deg, #031a1a 0%, #0a3d3d 55%, #0e6e6e 100%);
  overflow-x: hidden;
}
#szene-3d {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.landing-inhalt {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 48px 20px 24px;
}
.landing-kopf { text-align: center; animation: login-einblenden 0.8s both; }
.landing-logo {
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: #fff;
  margin: 0;
  letter-spacing: 0.03em;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}
.landing-claim {
  color: rgba(255, 255, 255, 0.75);
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  margin: 10px 0 0;
}
.landing-karten {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 1000px;
}
.landing-karte {
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 28px 24px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-decoration: none;
  color: #fff;
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  animation: login-einblenden 0.7s var(--verzoegerung, 0s) both;
}
.landing-karte:hover {
  transform: translateY(-8px);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.karte-icon { font-size: 1.9rem; }
.karte-titel { font-size: 1.2rem; font-weight: 700; }
.karte-text { font-size: 0.9rem; color: rgba(255, 255, 255, 0.75); flex-grow: 1; }
.karte-link { font-size: 0.9rem; font-weight: 600; color: #5eead4; }
.landing-fuss {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
  animation: login-einblenden 0.7s 0.55s both;
}
@media (prefers-reduced-motion: reduce) {
  .landing-karte, .landing-kopf, .landing-fuss { animation: none; }
}

@media (max-width: 640px) {
  .kopfzeile { flex-direction: column; align-items: flex-start; }
  .stammdaten { grid-template-columns: 1fr; }
  .stammdaten dt { margin-top: 8px; }
  .tabelle { display: block; overflow-x: auto; }
  .absenden-zeile { flex-direction: column; align-items: stretch; }
  .absenden-zeile .button { width: 100%; }
  .landing-karte { width: 100%; max-width: 340px; }
  .zusammenfassung-spalten { grid-template-columns: 1fr; }
}

.antworten dd { color: #397db3; line-height: 1; }
.antworten dt { color: #000; font-weight: bold; line-height: 1; }
@media print { .zusatz-seite { break-before: page; } .zusatz-seite .aktionen, .zusatz-seite form, .zusatz-seite button { display: none; } }

.antwort-inline dt, .antwort-inline dd { display: inline; margin: 0; }
.antwort-inline dd { margin-left: 4px; }
.antwortzeile { margin: 6px 0; }
@media print { .druck-seitenumbruch { break-before: page; } .antwortzeile { break-inside: avoid; } }

.abschnitt-status { display: inline-block; font-size: .75rem; font-weight: normal; color: #665f51; background: #f5efdf; border-radius: 4px; padding: 3px 7px; }
.abschnitt-status.abschnitt-fertig { color: #245537; background: #e4f1e7; }
@media print { .fortschritt { position: static; } }

.feld-fehler { outline: 2px solid #b42318; outline-offset: 5px; border-radius: 5px; scroll-margin-top: 130px; }

/* Fragetexte behalten im Designer eingefügte Zeilenumbrüche. */
.feld > label, .feld-label, .einwilligung span, .bogen-seiten > .gedaempft { white-space: pre-line; }
.bogen-seiten { background: transparent; box-shadow: none; }
.bogen-seiten #bogen > fieldset { background: #fff; padding: 28px; margin: 28px 0 42px; border: 1px solid #d5dee5; border-radius: 6px; box-shadow: 0 4px 14px #19364d12; }
#speicher-status { display: block; min-height: 4.5em; width: 100%; }
@media (max-width: 600px) { .bogen-seiten #bogen > fieldset { padding: 16px; } }
