/* ROS REAL – Baustein formular (Design v46). Inhalt: Felder, Kästchen/Kreise, Segment-Wahl, Auswahlliste, Von–bis, Kleingedrucktes. Nur Tokens aus main.css verwenden, keine Hex-Werte. */

/* ===== 1 · Feld und Etikett ===== */
.feld { display: grid; gap: 6px; margin: 0 0 14px; }
.feld label,
fieldset legend {
  display: block;
  width: 100%;
  padding: 0;
  font: 400 var(--t4)/1.6 var(--sans);
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--grau);
}
.feld input,
.feld textarea,
.feld select {
  font: inherit;
  font-size: var(--t1);
  line-height: 1.6;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  background: var(--papier);
  border: 1px solid var(--linie);
  border-radius: 0;
  color: var(--tinte);
}
.feld textarea { min-height: 104px; resize: vertical; }
.feld input:focus-visible,
.feld textarea:focus-visible,
.feld select:focus-visible { border-color: var(--blau); }
.feld--fehler input,
.feld--fehler textarea,
.feld--fehler select,
input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] { border-color: var(--fehler); }
.feld__meldung { margin: 0; font: 400 var(--t4)/1.6 var(--sans); color: var(--fehler); }
.fhinweis { margin: 0 0 18px; font: 400 var(--t4)/1.6 var(--sans); letter-spacing: .06em; color: var(--grau); }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 599px) {
  .zwei { grid-template-columns: 1fr; gap: 0; }
}

/* ===== 2 · Kästchen und Kreise ===== */
.haken {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  margin: 14px 0;
  font: 400 var(--t3)/1.5 var(--sans);
  color: var(--tinte);
  cursor: pointer;
}
.haken input[type="checkbox"],
.haken input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 1px solid var(--tinte);
  background: var(--papier);
  cursor: pointer;
}
.haken input[type="radio"] { border-radius: 50%; }
.haken input[type="checkbox"]:checked,
.haken input[type="radio"]:checked { border-color: var(--blau); }
.haken input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--blau);
}
.haken input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--blau);
}

/* Anrede: kompakte Kreis-Gruppe in einer Zeile. */
.anrede { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; min-height: 48px; }
.anrede label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font: 400 var(--t2)/1 var(--sans);
  color: var(--tinte);
  cursor: pointer;
}
.anrede input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 1px solid var(--tinte);
  border-radius: 50%;
  background: var(--papier);
  cursor: pointer;
}
.anrede input[type="radio"]:checked { border-color: var(--blau); }
.anrede input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--blau);
}

/* ===== 3 · Segment-Wahl und Werte ===== */
.wahl,
.werte { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.wahl label,
.werte label {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font: 400 var(--t2)/1.6 var(--sans);
  color: var(--grau);
  cursor: pointer;
}
.wahl input,
.werte input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
}
.wahl label:has(input:checked),
.werte label:has(input:checked) {
  color: var(--tinte);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: var(--unterstrich-abstand);
}
.wahl label:has(input:focus-visible),
.werte label:has(input:focus-visible) {
  outline: 2px solid var(--blau);
  outline-offset: 2px;
}

/* ===== 4 · Auswahlliste ===== */
.rselect { position: relative; display: inline-block; min-width: 168px; }
.rselect__native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.rselect > button {
  font: 400 var(--t3)/1.6 var(--sans);
  width: 100%;
  min-height: 44px;
  padding: 8px 4px 8px 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--linie);
  color: var(--tinte);
  text-align: left;
  cursor: pointer;
}
.rselect > button:hover { color: var(--blau); border-color: var(--blau); }
.rselect.auf > button { border-color: var(--blau); }
.rliste {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 70;
  min-width: 100%;
  max-height: min(58vh, 420px);
  overflow-y: auto;
  padding: 4px 0;
  background: var(--papier);
  border: 1px solid var(--linie);
  display: none;
}
.rselect.auf .rliste { display: block; }
.rselect.nachoben .rliste { top: auto; bottom: calc(100% + 8px); }
.rliste [role="option"] {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 11px 16px;
  font: 400 var(--t2)/1.6 var(--sans);
  color: var(--tinte);
  white-space: nowrap;
  cursor: pointer;
}
.rliste [role="option"][aria-selected="true"] { box-shadow: inset 2px 0 0 var(--blau); }
.rliste [role="option"].hin,
.rliste [role="option"]:hover { background: var(--stein); }
.rliste__k {
  position: relative;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 1px solid var(--tinte);
  background: var(--papier);
}
.rliste [role="option"][aria-selected="true"] .rliste__k { border-color: var(--blau); }
.rliste [role="option"][aria-selected="true"] .rliste__k::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--blau);
}
@media (max-width: 767px) {
  .rliste {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    max-height: 70dvh;
    padding: 8px 0 calc(16px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--linie);
  }
  .rselect.nachoben .rliste { bottom: 0; }
  .rliste [role="option"] { padding: 14px 20px; font-size: var(--t1); }
}

/* ===== 5 · Von–bis ===== */
.vonbis { display: flex; align-items: center; gap: 12px; }
.vonbis i { font-style: normal; font-size: var(--t1); line-height: 1.6; color: var(--grau); }
.vonbis i::before { content: "–"; }
.vonbis .rselect { flex: 1 1 0; min-width: 0; }

/* ===== 6 · Kleingedrucktes ===== */
.kleind { margin: 10px 0 0; font: 400 var(--t3)/1.6 var(--sans); color: var(--grau); }

/* Knopf-Zeilenhöhe: main.css setzt .knopf auf 1.2, die Bauanleitung misst 1.6
   („Letzten Filter entfernen“, „Suche speichern“). Nur die Zeilenhöhe nachziehen. */
.knopf { line-height: 1.6; }

/* Gesamttest 23.09.: Werte ohne Treffer auch in der gestalteten Liste ausgegraut (wie .haken.aus). */
.rliste [role="option"].aus { color: var(--grau); opacity: .5; cursor: not-allowed; }
.rliste [role="option"].aus:hover { background: transparent; }
