/* Fachverfahren Open Data – eigenes Theme über Bootstrap 5.3.
   Farben als Bootstrap-Variablen, damit Hell/Dunkel automatisch passt. */
:root, [data-bs-theme="light"] {
    --bs-primary: #0d6b70;
    --bs-primary-rgb: 13, 107, 112;
    --bs-link-color: #0d6b70;
    --bs-link-color-rgb: 13, 107, 112;
    --bs-link-hover-color: #08494d;
    --bs-body-bg: #f3f5f4;
    --bs-body-color: #18222b;
    --bs-secondary-color: #5b6873;
    --bs-border-color: #d6dddc;
    --fod-flaeche: #ffffff;
    --fod-akzent-weich: #dcefef;
}
[data-bs-theme="dark"] {
    --bs-primary: #4fbcc1;
    --bs-primary-rgb: 79, 188, 193;
    --bs-link-color: #4fbcc1;
    --bs-link-color-rgb: 79, 188, 193;
    --bs-link-hover-color: #8fd8db;
    --bs-body-bg: #11171b;
    --bs-body-color: #e5ebee;
    --bs-secondary-color: #93a2ad;
    --bs-border-color: #2b3840;
    --fod-flaeche: #182127;
    --fod-akzent-weich: #163b3e;
}

body { font-size: 15.5px; }
.btn-primary { --bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary); --bs-btn-hover-bg: var(--bs-link-hover-color); --bs-btn-hover-border-color: var(--bs-link-hover-color); --bs-btn-color: #fff; --bs-btn-hover-color: #fff; }
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #11171b; --bs-btn-hover-color: #11171b; }
/* Bootstrap-Rot erreicht auf dunklem Grund nur 3,6:1 */
[data-bs-theme="dark"] .btn-outline-danger { --bs-btn-color: var(--bs-danger-text-emphasis); --bs-btn-border-color: var(--bs-danger-text-emphasis); }
/* Bootstrap-Grau #6c757d erreicht 4,5:1 weder hell noch dunkel; die Textfarbe für Nebensächliches schon */
.btn-outline-secondary { --bs-btn-color: var(--bs-secondary-color); --bs-btn-border-color: var(--bs-secondary-color); --bs-btn-hover-bg: var(--bs-secondary-color); --bs-btn-hover-border-color: var(--bs-secondary-color); --bs-btn-hover-color: var(--bs-body-bg); --bs-btn-active-bg: var(--bs-secondary-color); --bs-btn-active-border-color: var(--bs-secondary-color); --bs-btn-active-color: var(--bs-body-bg); --bs-btn-disabled-color: var(--bs-secondary-color); --bs-btn-disabled-border-color: var(--bs-secondary-color); }
.btn-outline-primary { --bs-btn-color: var(--bs-primary); --bs-btn-border-color: var(--bs-primary); --bs-btn-hover-bg: var(--bs-primary); --bs-btn-hover-border-color: var(--bs-primary); }

.kopfleiste { background: var(--fod-flaeche); border-bottom: 1px solid var(--bs-border-color); }
.marke { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--bs-body-color); }
.marke-zeichen { width: 26px; height: 26px; border-radius: 6px; background: var(--bs-primary) url('../favicon.svg') center / cover; flex: none; }
.marke-name { font-weight: 700; letter-spacing: -.01em; }
.marke-text { display: flex; flex-direction: column; line-height: 1.2; }
.marke-org { font-size: .8rem; color: var(--bs-secondary-color); }
.navbar .marke { padding-top: .2rem; padding-bottom: .2rem; }
.kopf-symbol { display: inline-flex; padding: .25rem; color: var(--bs-secondary-color); }
.kopf-symbol:hover { color: var(--bs-primary); }

.karte { background: var(--fod-flaeche); border: 1px solid var(--bs-border-color); border-radius: 10px; padding: 1.1rem 1.25rem; }
.karte-akzent { border-top: 3px solid var(--bs-primary); }
.kachel { background: var(--fod-flaeche); border: 1px solid var(--bs-border-color); border-radius: 10px; padding: .8rem 1rem; }
.kachel-zahl { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kachel-text { color: var(--bs-secondary-color); font-size: .9rem; }

.willkommen h1 { text-wrap: balance; }
.liste-schlicht { list-style: none; margin: 0; padding: 0; }
.liste-schlicht li { padding: .55rem 0; border-bottom: 1px solid var(--bs-border-color); display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: baseline; }
.liste-schlicht li:last-child { border-bottom: 0; }

.badge[class*="status-"] { background: var(--fod-akzent-weich); color: var(--bs-body-color); font-weight: 500; }
.badge.status-nicht_freigegeben, .badge.status-verweigert, .badge.status-abgebrochen { background: #fbe3e1; color: #b3261e; }
.badge.status-veroeffentlicht, .badge.status-freigegeben, .badge.status-abgeschlossen { background: var(--bs-primary); color: var(--fod-flaeche); }

.inhalt-text { max-width: 75ch; }
.inhalt-text h1 { font-size: 1.6rem; margin-bottom: 1rem; }

#fuss { border-top: 1px solid var(--bs-border-color); background: var(--fod-flaeche); }
.schlicht { background: var(--bs-body-bg); }

.table { --bs-table-bg: transparent; }
.not-set { color: var(--bs-secondary-color); font-style: italic; }
.hint-block { display: block; margin-top: 5px; color: var(--bs-secondary-color); }

/* ---------- Workplace: Datenquellen ---------- */
.tabelle-quellen th { font-size: .85rem; color: var(--bs-secondary-color); font-weight: 600; }
.schrittstand { display: inline-flex; gap: .5rem; align-items: baseline; }
/* Schrittnummer als festes, abgerundetes Quadrat – kann nicht zum Oval gestreckt werden */
.schritt-nr { display: inline-grid; place-items: center; flex: none; width: 1.6rem; height: 1.6rem; border-radius: 6px; background: var(--bs-primary); color: var(--fod-flaeche); font-weight: 700; font-size: 1.2rem; /* 50 % größer, Kästchen bleibt 1.6rem */ font-variant-numeric: tabular-nums; line-height: 1; }
.badge.status-zur_freigabe, .badge.status-freigabe { background: #fbefdc; color: #8a4f08; }
[data-bs-theme="dark"] .badge.status-zur_freigabe, [data-bs-theme="dark"] .badge.status-freigabe { background: #3a2a12; color: #e3a64f; }

/* ---------- Vorlagenauswahl ---------- */
.vorlagen-liste { display: grid; gap: .6rem; }
.vorlage-wahl { display: flex; gap: .75rem; align-items: flex-start; padding: .8rem 1rem; border: 1px solid var(--bs-border-color); border-radius: 10px; background: var(--fod-flaeche); cursor: pointer; }
.vorlage-wahl:has(input:checked) { border-color: var(--bs-primary); box-shadow: 0 0 0 2px var(--fod-akzent-weich); }
.vorlage-wahl input { margin-top: .3rem; accent-color: var(--bs-primary); }

/* ---------- Fragen ---------- */
.leitfaden-text { color: var(--bs-secondary-color); max-width: 80ch; }
.frage { padding: 1rem 0; border-top: 1px solid var(--bs-border-color); }
.frage fieldset { margin: 0; }
.frage-label { font-weight: 600; display: block; margin-bottom: .25rem; font-size: 1rem; }
.frage-nr { color: var(--bs-secondary-color); font-weight: 500; font-variant-numeric: tabular-nums; margin-right: .5rem; font-size: .85rem; }
.frage-text { color: var(--bs-secondary-color); font-size: .92rem; margin-bottom: .5rem; max-width: 80ch; }
.frage .optionen { display: grid; gap: .25rem; }
.frage .form-check-input { accent-color: var(--bs-primary); }
.frage-fehler { border-left: 3px solid var(--bs-danger); padding-left: .75rem; }
.frage-info { background: var(--fod-akzent-weich); border-radius: 8px; padding: .75rem 1rem; margin: .75rem 0; border-top: 0; }
.pflicht { color: var(--bs-danger); }
.bemerkung summary { font-size: .82rem; color: var(--bs-link-color); cursor: pointer; margin-top: .5rem; width: fit-content; }

/* ---------- Antworten lesen ---------- */
.antwortliste dt { font-weight: 600; margin-top: .75rem; }
.antwortliste dd { margin: .15rem 0 0; padding-bottom: .5rem; border-bottom: 1px solid var(--bs-border-color); }
.badge.bewertung-kritisch { background: #fbe3e1; color: #b3261e; margin-left: .4rem; }

/* ---------- Tabellen-Werkzeug (Suche, Filter) ---------- */
.tw-suchzeile { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-bottom: .5rem; }
.tw-suchzeile input[type=search] { flex: 1 1 18rem; max-width: 32rem; }
.tw-stand { white-space: nowrap; }
/* Filterzeile direkt unter den Spaltentiteln */
.filterbereich { margin-bottom: .75rem; }
.filterbereich summary { cursor: pointer; font-weight: 600; color: var(--bs-primary); width: fit-content; }
.filterbereich-aktiv { font-weight: 400; color: var(--bs-secondary-color); }
.filterbereich-felder { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .75rem 1rem; align-items: end; margin-top: .5rem; padding: .75rem 1rem; background: var(--fod-flaeche); border: 1px solid var(--bs-border-color); border-radius: 8px; }
.filterbereich-felder .form-label { font-size: .85rem; margin-bottom: .2rem; color: var(--bs-secondary-color); }
.filterbereich-felder [data-filter-zuruecksetzen] { justify-self: start; }
.tw-sortieren { padding: 0; border: 0; background: none; color: inherit; font: inherit; }
.tw-sortieren:hover { color: var(--bs-primary); }
.tw-sortieren:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 2px; }
th[aria-sort=descending] .tw-sortieren::after { content: " ↓"; }
th[aria-sort=ascending] .tw-sortieren::after { content: " ↑"; }
.quelle-link { font-weight: 700; text-decoration: none; }
.quelle-link:hover { text-decoration: underline; }


/* Gemeinsame Zustandsfarben */
:root { --fod-freigabe-bg: #fbefdc; --fod-freigabe-rand: #e6c48e; --fod-freigabe-text: #5c3605; --fod-freigabe-stark: #c98a1a; }
[data-bs-theme="dark"] { --fod-freigabe-bg: #3a2a12; --fod-freigabe-rand: #6b4a1c; --fod-freigabe-text: #f0d2a6; --fod-freigabe-stark: #c98a1a; }



/* Schrittleiste als Reiter */
.schritte-reiter ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; border-bottom: 2px solid var(--bs-primary); overflow-x: auto; }
.schritte-reiter li { flex: 1 1 0; min-width: 0; }
.schritte-reiter li a, .schritte-reiter li > span { display: flex; align-items: baseline; gap: .35rem; height: 100%; padding: .45rem .6rem; border: 1px solid var(--bs-border-color); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--fod-flaeche); color: var(--bs-body-color); text-decoration: none; font-size: .76rem; line-height: 1.2; }
.schritte-reiter .reiter-nr { font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; color: var(--bs-primary); }
.schritte-reiter .reiter-titel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schritte-reiter .reiter-zeichen { margin-left: auto; font-weight: 700; }
.schritte-reiter li > span { color: var(--bs-secondary-color); background: transparent; }
.schritte-reiter li > span .reiter-nr { color: var(--bs-secondary-color); }
.schritte-reiter .st-abgeschlossen a { background: var(--fod-akzent-weich); }
.schritte-reiter .st-zur_freigabe a { background: var(--fod-freigabe-bg); color: var(--fod-freigabe-text); }
.schritte-reiter .st-aktuell a { background: var(--bs-primary); border-color: var(--bs-primary); color: var(--fod-flaeche); }
.schritte-reiter .st-aktuell .reiter-nr { color: var(--fod-flaeche); }
.schritte-reiter .st-hier:not(.st-aktuell) a { box-shadow: inset 0 -3px 0 var(--bs-primary); }

@media (max-width: 767.98px) {
    .schritte-reiter .reiter-titel { display: none; }
    .schritte-reiter li { min-width: 2.6rem; }
}

.schritte-reiter .st-zur_freigabe.st-aktuell a { background: var(--fod-freigabe-stark); border-color: var(--fod-freigabe-stark); color: #11171b; }
.schritte-reiter .st-zur_freigabe.st-aktuell .reiter-nr { color: #fff; }


/* ---------- Fester Kopf ---------- */
#kopf { position: sticky; top: 0; z-index: 1030; }

/* ---------- Prozessseite: Seitenleiste + Inhalt ---------- */
.prozess-layout { display: grid; grid-template-columns: 17.5rem minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 991.98px) { .prozess-layout { grid-template-columns: minmax(0, 1fr); } }
.prozess-seitenleiste { position: sticky; top: 4.75rem; max-height: calc(100vh - 5.75rem); overflow-y: auto; flex-direction: column; gap: .9rem; background: var(--fod-flaeche); border: 1px solid var(--bs-border-color); border-radius: 10px; padding: .9rem; }
.sl-kopf { display: flex; gap: .6rem; align-items: center; }
.sl-quelle { min-width: 0; line-height: 1.25; }
.sl-quelle strong { overflow-wrap: anywhere; }
.sl-fuss { border-top: 1px solid var(--bs-border-color); padding-top: .7rem; display: grid; gap: .35rem; }

.schritte-seite ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.schritte-seite li a, .schritte-seite li > span { display: flex; align-items: center; gap: .7rem; padding: .5rem .6rem; border-radius: 8px; border: 1px solid transparent; color: var(--bs-body-color); text-decoration: none; }
.schritte-seite .seite-nr { flex: none; width: 1.8rem; text-align: center; font-size: 1.55rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--bs-primary); }
.schritte-seite .seite-text { display: grid; gap: .1rem; min-width: 0; }
.schritte-seite .seite-titel { font-size: .88rem; line-height: 1.25; font-weight: 600; hyphens: auto; -webkit-hyphens: auto; }
.schritte-seite .seite-zustand { font-size: .74rem; color: var(--bs-secondary-color); }
.schritte-seite li a:hover { background: var(--bs-tertiary-bg, rgba(0,0,0,.04)); }
.schritte-seite li a:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 1px; }
/* noch nicht dran */
.schritte-seite li > span { color: var(--bs-secondary-color); }
.schritte-seite li > span .seite-nr { color: var(--bs-secondary-color); opacity: .6; }
.schritte-seite li > span .seite-titel { font-weight: 400; }
/* erledigt */
.schritte-seite .st-abgeschlossen a { background: var(--fod-akzent-weich); }
/* wartet auf Freigabe */
.schritte-seite .st-zur_freigabe a { background: var(--fod-freigabe-bg); color: var(--fod-freigabe-text); }
.schritte-seite .st-zur_freigabe .seite-nr { color: var(--fod-freigabe-stark); }
.schritte-seite .st-zur_freigabe .seite-zustand { color: inherit; }
/* aktueller Schritt: voll gefärbt */
.schritte-seite .st-aktuell a { background: var(--bs-primary); color: var(--fod-flaeche); }
.schritte-seite .st-aktuell .seite-nr, .schritte-seite .st-aktuell .seite-zustand { color: var(--fod-flaeche); }
/* dunkle Schrift: Weiß auf dem Orange erreicht nur 2,9:1 */
.schritte-seite .st-zur_freigabe.st-aktuell a { background: var(--fod-freigabe-stark); color: #11171b; }
.schritte-seite .st-zur_freigabe.st-aktuell .seite-nr, .schritte-seite .st-zur_freigabe.st-aktuell .seite-zustand { color: #11171b; }
/* gerade angezeigt, aber nicht der aktuelle */
.schritte-seite .st-hier:not(.st-aktuell) a { border-color: var(--bs-primary); }

/* Speicherstand */
.speicherstand { color: var(--bs-secondary-color); }
.speicherstand::before { content: '●'; margin-right: .35rem; color: var(--bs-border-color); }
.speicherstand[data-art="ok"]::before { color: #2e8b57; }
.speicherstand[data-art="laeuft"]::before { color: var(--fod-freigabe-stark); }
.speicherstand[data-art="warnung"], .speicherstand[data-art="fehler"] { color: var(--bs-danger); }
.speicherstand[data-art="warnung"]::before, .speicherstand[data-art="fehler"]::before { color: var(--bs-danger); }
.speicherstand:empty { display: none; }

/* Ende des Schritts: Abschluss erst nach dem Durcharbeiten */
.schritt-ende { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--bs-border-color); }

/* Kopf bleibt beim Scrollen stehen: body hat min-vh-100 statt h-100 (layouts/main.php),
   sonst endet „sticky“ nach einer Bildschirmhöhe. */

/* Prozessseite in voller Breite mit schmalem Rand */
.container-voll { max-width: none; padding-left: 1rem; padding-right: 1rem; }
@media (min-width: 992px) { .container-voll { padding-left: 1.25rem; padding-right: 1.5rem; } }

.btn-weiter { display: inline-flex; align-items: center; gap: .45rem; }

/* Feste Spaltenbreiten: sonst verteilt der Browser die Breiten nach dem
   Inhalt der gerade sichtbaren Zeilen neu, und die Spalten springen beim Filtern. */
@media (min-width: 768px) {
    .tabelle-quellen { table-layout: fixed; width: 100%; }
    .tabelle-quellen thead tr:first-child th:nth-child(1) { width: 26%; }
    .tabelle-quellen thead tr:first-child th:nth-child(2) { width: 16%; }
    .tabelle-quellen thead tr:first-child th:nth-child(3) { width: 34%; }
    .tabelle-quellen thead tr:first-child th:nth-child(4) { width: 24%; }
    .tabelle-quellen td { overflow-wrap: anywhere; }
}

/* Prozess verlassen: eigene Sektion unten in der Seitenleiste, Icon mit Text */
.sl-verlassen { border-top: 1px solid var(--bs-border-color); padding-top: .75rem; }
.verlassen-zeile { display: inline-flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn-verlassen { display: inline-flex; align-items: center; gap: .5rem; padding: .4rem .75rem; border-radius: 8px; border: 1px solid var(--bs-border-color); background: var(--fod-flaeche); color: var(--bs-body-color); text-decoration: none; font-size: .9rem; font-weight: 600; }
.btn-verlassen:hover { background: var(--fod-akzent-weich); color: var(--bs-primary); border-color: var(--bs-primary); }
.btn-verlassen:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 2px; }

/* Prozesse: fünf Spalten */
@media (min-width: 768px) {
    .tabelle-quellen.tabelle-prozesse thead tr:first-child th:nth-child(1) { width: 24%; }
    .tabelle-quellen.tabelle-prozesse thead tr:first-child th:nth-child(2) { width: 15%; }
    .tabelle-quellen.tabelle-prozesse thead tr:first-child th:nth-child(3) { width: 30%; }
    .tabelle-quellen.tabelle-prozesse thead tr:first-child th:nth-child(4) { width: 14%; }
    .tabelle-quellen.tabelle-prozesse thead tr:first-child th:nth-child(5) { width: 17%; }
}

/* Übersicht: zwei gleich große Kästchen */
.uebersicht-kachel { height: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.uebersicht-kachel .btn { margin-top: auto; }
.uebersicht-zahl { font-size: 3rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; color: var(--bs-primary); }

/* Freigabe */
.freigabe-box { border: 1px solid var(--bs-border-color); border-radius: 8px; padding: .9rem 1rem; margin-bottom: 1rem; background: var(--fod-flaeche); }
.schritte-seite .st-verweigert a, .schritte-reiter .st-verweigert a { box-shadow: inset 3px 0 0 var(--bs-danger); }
.schritte-seite .st-verweigert .seite-zustand { color: var(--bs-danger-text-emphasis); }

/* Daten erfassen: Auswahlbaum */
.befehl { background: var(--fod-flaeche); border: 1px solid var(--bs-border-color); border-radius: 6px; padding: .5rem .75rem; white-space: pre-wrap; }
.scan-werkzeuge { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: end; justify-content: space-between; margin-bottom: .75rem; }
.scan-name { flex: 1 1 18rem; max-width: 32rem; }
.scan-tabelle .scan-wahl { width: 2.25rem; }
.scan-tabelle td { overflow-wrap: anywhere; }
.scan-klappe { border: 0; background: none; padding: 0 .25rem 0 0; color: var(--bs-secondary-color); line-height: 1; }
.scan-klappe span[aria-hidden] { display: inline-block; transition: transform .12s; }
.scan-klappe[aria-expanded=true] span[aria-hidden] { transform: rotate(90deg); }
.scan-klappe:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 2px; }
.scan-datei input:not(:checked) ~ *, .scan-datei:has(input[data-scan-wahl]:not(:checked)) td { color: var(--bs-secondary-color); }
@media (prefers-reduced-motion: reduce) { .scan-klappe span[aria-hidden] { transition: none; } }

.prozess-daten summary { cursor: pointer; }
.prozess-daten summary:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 2px; }
.prozess-verwalten summary { cursor: pointer; font-weight: 600; }
.antrag { border-left: 3px solid var(--fod-freigabe-stark); padding: .35rem .6rem; background: var(--fod-freigabe-bg); border-radius: 4px; }
.antrag-stellen summary { cursor: pointer; font-size: .875rem; color: var(--bs-primary); }
.mehr-details { display: none; }
.mehr-details-an .mehr-details { display: block; }
.uebersicht-schritt { border-top: 1px solid var(--bs-border-color); padding: .5rem 0; }
.uebersicht-schritt > summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-weight: 600; }
.uebersicht-schritt > summary:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 2px; }
.antwortliste .ist-kritisch { border-left: 3px solid var(--bs-danger); padding-left: .5rem; }
.bericht-kopf th { font-weight: 400; color: var(--bs-secondary-color); padding: .1rem 1rem .1rem 0; vertical-align: top; }
.bericht-titel { font-size: 1.1rem; margin: 1.25rem 0 .5rem; }
.bericht-tabelle { width: 100%; border-collapse: collapse; }
.bericht-tabelle th, .bericht-tabelle td { border: 1px solid var(--bs-border-color); padding: .35rem .5rem; vertical-align: top; }
.bericht-tabelle thead th { background: var(--fod-flaeche); }
.bericht-tabelle .spalte-frage { width: 40%; }
.bericht-tabelle .spalte-schritt { width: 22%; background: var(--fod-flaeche); }
.bericht-tabelle tr.ist-kritisch td:not(.spalte-schritt) { background: var(--fod-freigabe-bg); }
.bericht .klein { font-size: .8rem; color: var(--bs-secondary-color); }
.bericht .leise { color: var(--bs-secondary-color); }
.bericht .kritisch { color: var(--bs-danger-text-emphasis); }
