/* Beratungsflow – Rechtstexte (rechtliches.js): öffentliche Seiten (Modus „seite“) und Einstellungen › Rechtliches (Modus „reiter“).
   Nur Token aus plattform.css (hell/dunkel automatisch), eigene Klassen mit Präfix .rt-, kein Lila.
   Einzige feste Farben: Schwarz/Weiß in der Druckansicht. */

/* ---------- gemeinsame Bausteine ---------- */
.rt-stand { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; line-height: 1.4; color: var(--accent-ink); background: var(--chip-bg); border: 1px solid var(--chip-line); white-space: nowrap; }
.rt-stand::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--bf-blau); flex: none; }
html.dark .rt-stand::before { background: var(--link); }
.rt-nr { flex: none; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.rt-text { color: var(--ink); overflow-wrap: break-word; }
.rt-text p { margin: 0 0 12px; }
.rt-text > :last-child { margin-bottom: 0; }
.rt-text strong { color: var(--heading); font-weight: 650; }
.rt-text a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent); text-underline-offset: 2px; overflow-wrap: anywhere; }
.rt-text a:hover { text-decoration-color: var(--link); }
.rt-text .rt-zwischen { margin-top: 18px; }
.rt-text .rt-zwischen:first-child { margin-top: 0; }
.rt-punkte { list-style: none; margin: 4px 0 14px; padding: 0; }
.rt-punkte li { position: relative; padding-left: 20px; margin: 0 0 8px; }
.rt-punkte li:last-child { margin-bottom: 0; }
.rt-punkte li::before { content: ""; position: absolute; left: 4px; top: .68em; width: 6px; height: 6px; border-radius: 50%; background: var(--bf-blau); }
html.dark .rt-punkte li::before { background: var(--link); }
.rt-check { list-style: none; margin: 4px 0 14px; padding: 0; display: grid; gap: 8px; }
.rt-check li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.rt-check-ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px; background: var(--green-bg); color: var(--green); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 30%, transparent); }
.rt-check-ic svg { width: 13px; height: 13px; stroke-width: 2.6; }
.rt-hinweis { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; margin: 4px 0 16px; border-radius: var(--radius-sm); background: var(--blue-50); border: 1px solid var(--blue-200); border-left: 3px solid var(--bf-blau); }
html.dark .rt-hinweis { border-left-color: var(--link); }
.rt-hinweis p { margin: 0; }
.rt-hinweis-ic { flex: none; color: var(--bf-blau); margin-top: 2px; }
html.dark .rt-hinweis-ic { color: var(--link); }
.rt-hinweis-ic svg { width: 19px; height: 19px; display: block; }
.rt-tabelle-wrap { overflow-x: auto; margin: 4px 0 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.rt-tabelle { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
.rt-tabelle th, .rt-tabelle td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.rt-tabelle thead th { background: var(--bg-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; white-space: nowrap; }
.rt-tabelle tbody th { font-weight: 600; color: var(--heading); min-width: 140px; }
.rt-tabelle td { min-width: 150px; }
.rt-tabelle tbody tr:last-child > * { border-bottom: 0; }
/* Offene Angaben „[wird ergänzt]“: deutlich, aber ruhig markiert */
.rt-offen { padding: 1px 6px; border-radius: 6px; background: var(--amber-bg); color: var(--amber); border: 1px dashed color-mix(in srgb, var(--amber) 60%, transparent); font-size: .92em; font-weight: 600; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.rt-offen-kurz { white-space: nowrap; }

/* ---------- Modus „seite“ ---------- */
.rt-haupt { padding-top: 40px; padding-bottom: 64px; }
.rt-kopf { max-width: 780px; padding-bottom: 22px; }
.rt-ober { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 12.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--bf-blau); }
html.dark .rt-ober { color: var(--link); }
.rt-ober::before { content: ""; width: 20px; height: 3px; border-radius: 2px; background: var(--bf-verlauf); flex: none; }
.rt-titel { font-size: 40px; margin: 0 0 10px; letter-spacing: -0.025em; }
.rt-kopf .rt-kurz { font-size: 17.5px; line-height: 1.55; color: var(--muted); margin: 0 0 18px; max-width: 700px; }
.rt-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rt-druck svg { width: 16px; height: 16px; }
.rt-doknav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin: 8px 0 34px; }
.rt-doknav::-webkit-scrollbar { display: none; }
.rt-doknav a { padding: 11px 14px 10px; font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.rt-doknav a:hover { color: var(--accent-ink); text-decoration: none; border-bottom-color: var(--line-strong); }
.rt-doknav a[aria-current="page"] { color: var(--bf-blau); border-bottom-color: var(--bf-blau); }
html.dark .rt-doknav a[aria-current="page"] { color: var(--link); border-bottom-color: var(--link); }
.rt-raster { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 56px; align-items: start; }
.rt-toc { position: sticky; top: calc(var(--ppt-leiste-h) + 24px); max-height: calc(100vh - var(--ppt-leiste-h) - 48px); overflow-y: auto; scrollbar-width: thin; }
.rt-toc summary { list-style: none; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 0 10px; font-size: 12px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); cursor: default; }
.rt-toc summary::-webkit-details-marker { display: none; }
.rt-toc-zahl { font-size: 11.5px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.rt-toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.rt-toc a { display: flex; gap: 10px; padding: 6px 10px 6px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.rt-toc a:hover { color: var(--accent-ink); text-decoration: none; border-left-color: var(--line-strong); }
.rt-toc a.aktiv { color: var(--bf-blau); border-left-color: var(--bf-blau); font-weight: 600; }
html.dark .rt-toc a.aktiv { color: var(--link); border-left-color: var(--link); }
.rt-toc .rt-nr { min-width: 18px; justify-content: start; opacity: .8; }
.rt-toc-anlage { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.rt-abschnitte { max-width: 780px; min-width: 0; }
.rt-abschnitt { padding: 26px 0; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--ppt-leiste-h) + 20px); }
.rt-abschnitte > .rt-abschnitt:first-child { border-top: 0; padding-top: 0; }
.rt-seite .rt-abschnitt h2, .rt-anlage .rt-abschnitt h3 { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; }
.rt-seite .rt-abschnitt h2 { font-size: 20px; }
.rt-anlage .rt-abschnitt h3 { font-size: 18px; }
.rt-seite .rt-abschnitt .rt-nr { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; font-weight: 700; background: var(--blue-50); color: var(--bf-blau); box-shadow: inset 0 0 0 1px var(--blue-200); }
html.dark .rt-seite .rt-abschnitt .rt-nr { color: var(--link); }
.rt-seite .rt-text { font-size: 15.5px; line-height: 1.68; }
.rt-anlage { margin-top: 30px; padding-top: 34px; border-top: 2px solid var(--line-strong); scroll-margin-top: calc(var(--ppt-leiste-h) + 20px); }
.rt-anlage .rt-kopf { padding-bottom: 10px; }
.rt-anlage .rt-titel { font-size: 28px; }
.rt-anlage .rt-kopf .rt-kurz { font-size: 16px; }
.rt-anlage .rt-abschnitt:first-of-type { border-top: 0; padding-top: 10px; }
.rt-fuss a { white-space: nowrap; }

@media (max-width: 959px) {
  .rt-raster { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .rt-toc { position: static; max-height: none; overflow: visible; margin: 0 0 26px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-soft); }
  .rt-toc summary { cursor: pointer; padding: 2px 0; }
  .rt-toc summary::after { content: ""; width: 8px; height: 8px; margin-left: auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
  .rt-toc details[open] summary { padding-bottom: 10px; }
  .rt-toc details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
  .rt-toc ol { border-left: 0; }
  .rt-toc a { padding: 7px 4px; margin-left: 0; border-left: 0; }
}
@media (max-width: 720px) {
  .rt-haupt { padding-top: 26px; padding-bottom: 44px; }
  .rt-titel { font-size: 31px; }
  .rt-kopf .rt-kurz { font-size: 16px; }
  .rt-doknav { margin-bottom: 24px; }
  .rt-seite .rt-text { font-size: 15px; line-height: 1.65; }
  .rt-seite .rt-abschnitt h2 { font-size: 18px; gap: 10px; }
  .rt-seite .rt-abschnitt .rt-nr { width: 26px; height: 26px; }
  .rt-abschnitt { padding: 22px 0; }
  .rt-anlage .rt-titel { font-size: 24px; }
}

/* ---------- Modus „reiter“ (Einstellungen › Rechtliches) ---------- */
.rt-reiter { container-type: inline-size; }
.rt-einordnung { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin: 0 0 14px; }
.rt-einordnung p { margin: 0; color: var(--muted); font-size: 14px; }
.rt-kern { list-style: none; margin: 0 0 22px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rt-kern li { display: flex; gap: 12px; align-items: flex-start; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); }
.rt-kern-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface); color: var(--bf-blau); box-shadow: inset 0 0 0 1px var(--blue-200); }
html.dark .rt-kern-ic { color: var(--link); }
.rt-kern-ic svg { width: 18px; height: 18px; }
.rt-kern b { display: block; font-size: 14px; line-height: 1.35; font-weight: 650; color: var(--heading); }
.rt-kern small { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.rt-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.rt-dokliste { display: flex; flex-direction: column; gap: 4px; position: sticky; top: calc(var(--ppt-leiste-h) + 16px); }
.rt-dokliste button { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--ink); transition: background .15s, border-color .15s; }
.rt-dokliste button:hover { background: var(--bg-soft); }
.rt-dokliste button.aktiv { background: var(--blue-50); border-color: var(--blue-200); }
.rt-dokliste button:focus-visible { outline: 2px solid var(--bf-blau); outline-offset: 2px; }
.rt-dl-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--bg-soft); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); transition: color .15s, background .15s; }
.rt-dokliste button.aktiv .rt-dl-ic { background: var(--surface); color: var(--bf-blau); box-shadow: inset 0 0 0 1px var(--blue-200); }
html.dark .rt-dokliste button.aktiv .rt-dl-ic { color: var(--link); }
.rt-dl-ic svg { width: 18px; height: 18px; }
.rt-dl-tx { display: flex; flex-direction: column; min-width: 0; }
.rt-dl-tx b { font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--heading); }
.rt-dokliste button.aktiv .rt-dl-tx b { color: var(--bf-blau); }
html.dark .rt-dokliste button.aktiv .rt-dl-tx b { color: var(--link); }
.rt-dl-tx small { font-size: 12.5px; line-height: 1.35; color: var(--muted); }
.rt-panel { min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); scroll-margin-top: calc(var(--ppt-leiste-h) + 16px); }
.rt-panel:focus { outline: none; }
.rt-panel-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; padding: 20px 24px 18px; border-bottom: 1px solid var(--line); }
.rt-panel-tx { flex: 1 1 260px; min-width: 0; }
.rt-panel-kopf h3 { font-size: 19px; margin: 0 0 4px; }
.rt-panel-kopf .rt-kurz { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.rt-panel-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.rt-eigen { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.rt-eigen svg { width: 15px; height: 15px; }
.rt-panel-text { padding: 4px 24px 24px; }
.rt-panel .rt-abschnitt { padding: 18px 0; scroll-margin-top: calc(var(--ppt-leiste-h) + 16px); }
.rt-panel .rt-abschnitt:first-child { border-top: 0; }
.rt-panel .rt-abschnitt h4 { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 15.5px; font-weight: 650; line-height: 1.3; color: var(--heading); }
.rt-panel .rt-abschnitt .rt-nr { width: 24px; height: 24px; border-radius: 7px; font-size: 12px; font-weight: 700; background: var(--blue-50); color: var(--bf-blau); box-shadow: inset 0 0 0 1px var(--blue-200); }
html.dark .rt-panel .rt-abschnitt .rt-nr { color: var(--link); }
.rt-panel .rt-text { font-size: 14.5px; line-height: 1.62; }

@container (max-width: 780px) {
  /* Kernaussagen als eine kompakte Karte mit drei Zeilen */
  .rt-kern { grid-template-columns: minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); overflow: hidden; }
  .rt-kern li { padding: 10px 12px; align-items: center; border: 0; border-radius: 0; background: transparent; }
  .rt-kern li + li { border-top: 1px solid var(--line); }
  .rt-kern-ic { width: 30px; height: 30px; border-radius: 9px; }
  .rt-kern-ic svg { width: 16px; height: 16px; }
  .rt-kern small { margin-top: 1px; }
}
@container (max-width: 720px) {
  .rt-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .rt-dokliste { position: static; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-soft); }
  .rt-dokliste button { padding: 8px 10px; border-radius: 10px; }
  .rt-dokliste button.aktiv { background: var(--surface); }
  .rt-dl-ic { width: 30px; height: 30px; border-radius: 9px; }
  .rt-dl-tx { flex-direction: row; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .rt-panel-kopf { padding: 16px 16px 14px; }
  .rt-panel-meta { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
  .rt-panel-text { padding: 2px 16px 18px; }
}
@container (max-width: 420px) {
  .rt-einordnung p { font-size: 13.5px; }
  .rt-kern { margin-bottom: 16px; }
  .rt-dl-tx small { display: none; }
  .rt-tabelle th, .rt-tabelle td { padding: 9px 11px; }
}

/* ---------- Tabellen schmal: jede Zeile als beschrifteter Block (Seite per Media Query, Reiter per Container Query) ---------- */
@media (max-width: 560px) {
  .rt-seite .rt-tabelle thead { display: none; }
  .rt-seite .rt-tabelle, .rt-seite .rt-tabelle tbody, .rt-seite .rt-tabelle tr, .rt-seite .rt-tabelle th, .rt-seite .rt-tabelle td { display: block; width: 100%; min-width: 0; }
  .rt-seite .rt-tabelle tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .rt-seite .rt-tabelle tbody tr:last-child { border-bottom: 0; }
  .rt-seite .rt-tabelle tbody th { padding: 0 0 4px; border: 0; }
  .rt-seite .rt-tabelle td { padding: 4px 0 0; border: 0; }
  .rt-seite .rt-tabelle td::before { content: attr(data-titel); display: block; font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
  .rt-seite .rt-tabelle td[data-titel=""]::before { display: none; }
}
@container (max-width: 520px) {
  .rt-panel .rt-tabelle thead { display: none; }
  .rt-panel .rt-tabelle, .rt-panel .rt-tabelle tbody, .rt-panel .rt-tabelle tr, .rt-panel .rt-tabelle th, .rt-panel .rt-tabelle td { display: block; width: 100%; min-width: 0; }
  .rt-panel .rt-tabelle tr { padding: 11px 12px; border-bottom: 1px solid var(--line); }
  .rt-panel .rt-tabelle tbody tr:last-child { border-bottom: 0; }
  .rt-panel .rt-tabelle tbody th { padding: 0 0 4px; border: 0; }
  .rt-panel .rt-tabelle td { padding: 4px 0 0; border: 0; }
  .rt-panel .rt-tabelle td::before { content: attr(data-titel); display: block; font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
  .rt-panel .rt-tabelle td[data-titel=""]::before { display: none; }
}

/* ---------- Druck ---------- */
@media print {
  body.rt-body > :not(main) { display: none !important; }
  body.rt-body { padding-top: 0 !important; background: #fff !important; }
  .rt-haupt { max-width: none; padding: 0 !important; }
  .rt-dok, .rt-dok * { color: #000 !important; background: transparent !important; box-shadow: none !important; }
  .rt-doknav, .rt-druck, .rt-dokliste, .rt-kern, .rt-eigen { display: none !important; }
  .rt-titel { font-size: 26pt; }
  .rt-raster, .rt-layout { display: block; }
  .rt-toc { position: static; max-height: none; overflow: visible; padding: 0; margin: 0 0 14pt; border: 0; }
  .rt-toc summary::after { display: none; }
  .rt-toc ol { border-left: 0; columns: 2; column-gap: 24pt; }
  .rt-toc a { border-left: 0 !important; padding: 2pt 0; break-inside: avoid; }
  .rt-abschnitt { padding: 12pt 0; border-top: 1px solid rgba(0, 0, 0, .25); }
  .rt-abschnitt h2, .rt-abschnitt h3, .rt-abschnitt h4 { break-after: avoid; }
  .rt-seite .rt-abschnitt .rt-nr, .rt-panel .rt-abschnitt .rt-nr { box-shadow: inset 0 0 0 1px #000 !important; }
  .rt-text { font-size: 10.5pt !important; line-height: 1.5 !important; }
  .rt-punkte li::before { content: "–"; top: 0; left: 2px; width: auto; height: auto; border-radius: 0; background: none !important; }
  .rt-ober::before, .rt-stand::before, .rt-toc-zahl { display: none !important; }
  .rt-offen { border-style: dashed !important; }
  .rt-tabelle-wrap { overflow: visible; border-color: rgba(0, 0, 0, .35); }
  .rt-tabelle th, .rt-tabelle td, .rt-hinweis, .rt-check li, .rt-offen, .rt-stand, .rt-anlage, .rt-panel, .rt-panel-kopf { border-color: rgba(0, 0, 0, .35) !important; }
  .rt-tabelle tr, .rt-hinweis, .rt-check li { break-inside: avoid; }
  .rt-text a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 90%; }
  .rt-anlage { break-before: page; }
  @page { margin: 18mm 16mm; }
}
