#vertrag, #sd-result { scroll-margin-top: 6.5rem; }
.sd-form {
  background: #fff;
  border: 1px solid rgba(94, 30, 115, 0.14);
  border-radius: 1.25rem;
  box-shadow: 0 18px 40px rgba(94, 30, 115, 0.08);
  padding: clamp(2.5rem, 4.5vw, 3.25rem);
  max-width: 100%;
}
@media (min-width: 992px) {
  .sd-form { padding: clamp(4rem, 6vw, 5.25rem); }
}
.sd-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.sd-steps {
  display: flex;
  gap: 0.75rem 1rem;
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0 0 0.25rem;
  overflow-x: auto;
  max-width: 100%;
}
.sd-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 0;
  background: transparent;
  color: var(--fd-muted);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.3;
  padding: 0.5rem 0.15rem;
  white-space: nowrap;
}
.sd-step__no {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--fd-surface-3);
  color: var(--fd-ink);
  flex-shrink: 0;
}
.sd-step.is-current { color: var(--fd-primary); }
.sd-step.is-current .sd-step__no,
.sd-step.is-done .sd-step__no {
  background: var(--fd-primary);
  color: #fff;
}
.sd-step.is-done { color: var(--fd-ink); }
.sd-req { color: var(--fd-primary); }

/* Schritt- und Abschnittsüberschriften: Stufe der Inhalts-h3 (.h5), nicht die Browser-h3 */
.sd-panel > h3,
.sd-subsection > h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}
.sd-panel > h3:not(:has(+ p)) {
  margin-bottom: 1rem;
}
.sd-panel > h3:has(+ .row) {
  margin-bottom: 0;
}
.sd-panel > h3 + p,
.sd-subsection > h3 + p {
  margin-bottom: 0;
}
.sd-panel > h3 + p:not(:has(+ .row)),
.sd-subsection > h3 + p:not(:has(+ .row)) {
  padding-bottom: 1.5rem;
}

/* Fragen-Legenden: kleinste Überschriftenstufe (h6), nicht die große legend-Defaultgröße */
.sd-form legend {
  float: none;
  width: 100%;
  display: block;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--fd-primary);
  margin: 0 0 0.5rem;
  padding: 0;
}
.sd-form .form-label {
  display: block;
  margin-bottom: 0.5rem;
}
.sd-form .row.g-3 {
  --bs-gutter-y: 1.5rem;
  margin-top: 0;
}
.sd-form fieldset {
  min-width: 0;
  max-width: 100%;
  padding: 0;
  border: 0;
}

.sd-choices, .sd-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  max-width: 100%;
}
.sd-choice, .sd-check {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.5rem;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0.55rem 0.9rem;
  border: 1px solid #6a5578;
  border-radius: 999px;
  background: #fff;
  line-height: 1.4;
  cursor: pointer;
}
.sd-check { border-radius: 0.8rem; }
.sd-choice:has(input:checked),
.sd-check:has(input:checked) {
  border-color: var(--fd-primary);
  background: rgba(94, 30, 115, 0.08);
}
.sd-choice input, .sd-check input {
  margin-top: 0.2rem;
  flex-shrink: 0;
  accent-color: var(--fd-primary);
}
.sd-terms {
  max-height: 280px;
  overflow: auto;
  padding: 1rem 1.1rem;
  border-radius: 0.9rem;
  background: var(--fd-surface-2);
  font-size: 0.92rem;
  max-width: 100%;
}
.sd-terms h2, .sd-terms h3, .sd-terms h4 { font-size: 1rem; }
.sd-form > .sd-steps + p {
  margin-bottom: clamp(2.5rem, 4.5vw, 3.25rem);
}
.sd-subsection {
  margin-top: clamp(2.5rem, 4.5vw, 3.25rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--fd-surface-3);
}
@media (min-width: 992px) {
  .sd-form > .sd-steps + p {
    margin-bottom: clamp(4rem, 6vw, 5.25rem);
  }
  .sd-subsection {
    margin-top: clamp(4rem, 6vw, 5.25rem);
  }
}
.sd-nav {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: clamp(2.5rem, 4.5vw, 3.25rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--fd-surface-3);
}
@media (min-width: 992px) {
  .sd-nav { margin-top: clamp(4rem, 6vw, 5.25rem); }
}
.sd-follow { margin-top: 1.5rem; }
.sd-panel > .sd-follow { margin-bottom: 1.5rem; }
.sd-note { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.sd-hint { margin: 0.25rem 0 0.5rem; }
.sd-form.is-enhanced .sd-panel { display: none; }
.sd-form.is-enhanced .sd-panel.is-active { display: block; }
.sd-form.is-enhanced .sd-follow.is-off { display: none; }
.sd-form:not(.is-enhanced) [data-sd-next],
.sd-form:not(.is-enhanced) [data-sd-back] { display: none; }
.sd-form .form-control {
  border-color: #6a5578;
}
.sd-form :is(a, button, input, select, textarea):focus,
.sd-form :is(a, button, input, select, textarea):focus-visible,
.sd-form [tabindex]:not([tabindex="-1"]):focus,
.sd-form [tabindex]:not([tabindex="-1"]):focus-visible {
  outline: 2px solid var(--fd-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #fff;
}
.sd-form h3:focus,
.sd-form h3:focus-visible {
  outline: none;
  box-shadow: none;
}
.sd-check > span {
  min-width: 0;
}
.sd-check strong {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}
.sd-form h3,
.sd-form input,
.sd-form textarea,
.sd-form select,
.sd-form button,
.sd-field-error,
#sd-result {
  scroll-margin-top: 6.5rem;
}
.sd-choice:has(input.is-invalid),
.sd-check:has(input.is-invalid) {
  border-color: #9b2c2c;
}
.sd-form .is-invalid { border-color: #9b2c2c; }
.sd-field-error { color: #9b2c2c; font-size: 0.85rem; margin-top: 0.35rem; }
.sd-agb h2 { font-size: 1.35rem; }
.sd-agb h3 { font-size: 1.05rem; margin-top: 1.4rem; }
.sd-text-btn {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fd-primary);
  font: inherit;
  font-weight: 700;
  line-height: inherit;
  text-decoration: underline;
  text-underline-offset: 0.12em;
  cursor: pointer;
}
.sd-text-btn:focus,
.sd-text-btn:focus-visible,
.sd-dialog__close:focus,
.sd-dialog__close:focus-visible {
  outline: 2px solid var(--fd-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #fff;
}
.sd-dialog {
  width: min(42rem, calc(100vw - 2rem));
  max-height: min(85vh, 46rem);
  padding: 0;
  border: 0;
  border-radius: 1rem;
  background: #fff;
  color: var(--fd-ink);
}
.sd-dialog::backdrop {
  background: rgba(20, 21, 26, 0.55);
}
.sd-dialog__panel {
  display: flex;
  flex-direction: column;
  max-height: min(85vh, 46rem);
}
.sd-dialog__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem 0.5rem;
}
.sd-dialog__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fd-primary);
}
.sd-dialog__close {
  flex-shrink: 0;
  border: 1px solid var(--fd-primary);
  background: #fff;
  color: var(--fd-primary);
  border-radius: 999px;
  font-weight: 700;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
}
.sd-dialog .sd-terms {
  margin: 0 1.1rem 1.1rem;
  max-height: min(60vh, 32rem);
}
.sd-signed {
  margin-bottom: 3rem;
  font-size: 1.31em;
  text-align: center;
  margin-left: 12%;
  margin-right: 12%;
}
.sd-signed .sd-nowrap {
  white-space: nowrap;
}
