:root {
  --text: #1d2430;
  --leise: #5b6576;
  --linie: #d5dae2;
  --flaeche: #ffffff;
  --grund: #f3f5f8;
  --akzent: #1f5fa8;
  --akzent-hell: #e7eff9;
  --fehler: #b3261e;
  --fehler-hell: #fbeceb;
  --gut: #1e7a46;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--grund);
}
a { color: var(--akzent); }
.seite { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
.breite-seite { max-width: 1200px; }
.kopf { margin-bottom: 20px; }
.vorzeile { margin: 0; color: var(--leise); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: 13px; }
h1 { font-size: 28px; line-height: 1.2; margin: 4px 0 12px; }
h2 { font-size: 20px; margin: 0 0 12px; }
.einleitung { margin: 0; color: var(--leise); }

.block {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 20px;
  margin: 0 0 16px;
  min-width: 0;
}
legend { font-weight: 700; font-size: 18px; padding: 0; float: left; width: 100%; margin-bottom: 12px; }
legend + * { clear: both; }
.nr {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; margin-right: 8px;
  border-radius: 50%; background: var(--akzent-hell); color: var(--akzent);
  font-size: 14px;
}
.hilfe { display: block; color: var(--leise); font-size: 14px; margin: 2px 0 6px; font-weight: 400; }
.optional { color: var(--leise); font-weight: 400; }

.raster { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.breit { grid-column: 1 / -1; }
@media (max-width: 560px) { .raster { grid-template-columns: 1fr; } }

label { display: block; font-weight: 600; font-size: 15px; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=password], input[type=search], select, textarea {
  display: block; width: 100%; margin-top: 4px;
  font: inherit; color: inherit;
  padding: 10px 12px;
  border: 1px solid var(--linie); border-radius: 8px; background: #fff;
}
input:focus, select:focus, textarea:focus, button:focus-visible, .karte:focus-within {
  outline: 3px solid color-mix(in srgb, var(--akzent) 35%, transparent);
  outline-offset: 1px; border-color: var(--akzent);
}
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--fehler); }
input[type=file] { display: block; margin-top: 6px; font: inherit; max-width: 100%; }

.karten { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .karten { grid-template-columns: 1fr; } }
.karte {
  position: relative; display: block; cursor: pointer;
  border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 14px 14px 14px 44px; font-weight: 400;
}
.karte input { position: absolute; left: 14px; top: 17px; width: 18px; height: 18px; margin: 0; }
.karte:has(input:checked) { border-color: var(--akzent); background: var(--akzent-hell); }
.karte-titel { display: block; font-weight: 700; }
.karte-text { display: block; color: var(--leise); font-size: 14px; }

.foto-bereich { display: flex; gap: 16px; align-items: flex-start; }
.foto-feld { flex: 1; }
.vorschau {
  width: 105px; height: 135px; flex: none;
  border: 1px dashed var(--linie); border-radius: 8px;
  display: grid; place-items: center; overflow: hidden;
  color: var(--leise); font-size: 13px; background: var(--grund);
}
.vorschau img { width: 100%; height: 100%; object-fit: cover; }
#block-passseiten { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--linie); }
#block-passseiten .raster { margin-top: 14px; }

.erklaerung {
  display: grid; grid-template-columns: 22px 1fr; gap: 0 10px;
  padding: 12px 0; border-top: 1px solid var(--linie);
}
.erklaerung input { width: 18px; height: 18px; margin: 3px 0 0; }
.erklaerung label { font-weight: 400; cursor: pointer; }
.erklaerung .feldfehler { grid-column: 2; }
.erkl-titel { display: block; font-weight: 700; }
.erkl-text { display: block; font-size: 15px; }
.zustimmer { margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--linie); }

.feldfehler { color: var(--fehler); font-size: 14px; font-weight: 600; margin: 4px 0 0; }
.hinweis { border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.hinweis p { margin: 4px 0 0; }
.hinweis.fehler { background: var(--fehler-hell); border: 1px solid var(--fehler); }
.hinweis.ok { background: #e8f5ee; border: 1px solid var(--gut); }

button, .knopf {
  display: inline-block; font: inherit; font-weight: 700; cursor: pointer;
  padding: 12px 22px; border-radius: 8px; border: 1px solid var(--akzent);
  background: var(--akzent); color: #fff; text-decoration: none;
}
button.zweit, .knopf.zweit { background: #fff; color: var(--akzent); }
button.gefahr { background: #fff; color: var(--fehler); border-color: var(--fehler); }
button:disabled { opacity: .6; cursor: progress; }
.absenden { margin-top: 8px; }
.absenden button { width: 100%; font-size: 17px; padding: 14px; }
.fuss { margin-top: 24px; text-align: center; color: var(--leise); font-size: 14px; }
.schritte li { margin-bottom: 8px; }

.unsichtbar { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
[hidden] { display: none !important; }
html:not(.js) .nur-kind, html:not(.js) .nur-umstellung, html:not(.js) .nur-unter16, html:not(.js) .nur-erwachsen, html:not(.js) .nur-jugendlich { display: block; }

/* ---------- Verwaltung ---------- */
.leiste { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.leiste h1 { margin: 0; }
.filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
.filter label { font-size: 13px; }
.filter select, .filter input { margin-top: 2px; padding: 8px 10px; }
.filter button { padding: 9px 16px; }
.zaehler { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.zaehler a { text-decoration: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--linie); background: #fff; color: var(--text); font-size: 14px; }
.zaehler a.aktiv { border-color: var(--akzent); background: var(--akzent-hell); color: var(--akzent); font-weight: 700; }
.tabelle-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--linie); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--linie); vertical-align: middle; white-space: nowrap; }
th { background: var(--grund); font-size: 13px; color: var(--leise); }
tr:last-child td { border-bottom: 0; }
td.name a { font-weight: 700; }
.marke { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--grund); }
.marke.s-neu { background: #fff4d6; color: #7a5300; }
.marke.s-rueckfrage { background: var(--fehler-hell); color: var(--fehler); }
.marke.s-geprueft { background: var(--akzent-hell); color: var(--akzent); }
.marke.s-in_dokume { background: #ece7fb; color: #4b2fa8; }
.marke.s-freigegeben { background: #e8f5ee; color: var(--gut); }
.mini { width: 36px; height: 46px; object-fit: cover; border-radius: 4px; display: block; background: var(--grund); }
.aktionen { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.aktionen select { width: auto; margin: 0; }
.detail { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
@media (max-width: 860px) { .detail { grid-template-columns: 1fr; } }
.fotos { display: flex; flex-wrap: wrap; gap: 10px; }
.fotos figure { margin: 0; }
.fotos img { width: 130px; height: 170px; object-fit: cover; border-radius: 6px; border: 1px solid var(--linie); display: block; }
.fotos figcaption { font-size: 13px; margin-top: 4px; }
dl.protokoll { margin: 0; font-size: 14px; }
dl.protokoll dt { font-weight: 700; margin-top: 8px; }
dl.protokoll dd { margin: 0; color: var(--leise); }
.anmelden { max-width: 380px; margin: 60px auto; }
.anmelden label { margin-bottom: 12px; }
.hilfe.inline { display: inline; }

/* ---------- Gebühr und Datenschutz ---------- */
.gebuehr-box { background: var(--akzent-hell); border: 1px solid color-mix(in srgb, var(--akzent) 30%, transparent); border-radius: var(--radius); padding: 16px; margin-bottom: 4px; }
.gebuehr-betrag { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 4px; font-size: 18px; }
.gebuehr-betrag strong { font-size: 22px; }
dl.bank { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0 0; }
dl.bank dt { color: var(--leise); font-size: 14px; }
dl.bank dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
dl.bank dd.iban { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }
@media (max-width: 420px) { dl.bank { grid-template-columns: 1fr; gap: 0; } dl.bank dd { margin-bottom: 8px; } }
.zahlung h2 { margin-bottom: 4px; }
.datenfluss { border: 1px solid var(--linie); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; background: var(--grund); }
h2.klein { font-size: 16px; margin: 0 0 10px; }
ul.empfaenger { list-style: none; margin: 0 0 10px; padding: 0; }
ul.empfaenger li { padding: 10px 0; border-top: 1px solid var(--linie); }
ul.empfaenger li:first-child { border-top: 0; padding-top: 0; }
ul.empfaenger span { display: block; font-size: 15px; }
ul.empfaenger .zweck { color: var(--leise); font-size: 14px; margin-top: 2px; }
.text-seite .block p, .text-seite .block li { font-size: 15px; }
.text-seite .block ul { padding-left: 20px; margin: 8px 0; }
.text-seite .block li { margin-bottom: 6px; }
.marke.bezahlt { background: #e8f5ee; color: var(--gut); }
.marke.offen { background: #fff4d6; color: #7a5300; }
@media print {
  body { background: #fff; }
  .nicht-drucken { display: none; }
  .block { border-color: #999; }
}
.anmelden.breit-form { max-width: 640px; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.adminnav { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: 4px 0 18px; padding-bottom: 10px; border-bottom: 1px solid var(--linie); font-size: 14px; }
.adminnav a { font-weight: 600; text-decoration: none; }
.adminnav .wer { margin-left: auto; color: var(--leise); }
.marke.r-admin { background: #ece7fb; color: #4b2fa8; }
.marke.r-bearbeiter { background: var(--akzent-hell); color: var(--akzent); }
.marke.r-lesen { background: var(--grund); color: var(--leise); }
.marke.gesperrt { background: var(--fehler-hell); color: var(--fehler); }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 2px 0; }
.inline-form select, .inline-form input { width: auto; margin: 0; padding: 6px 8px; font-size: 14px; }
.inline-form button { padding: 6px 12px; font-size: 14px; }
td.aktionen-zelle { white-space: normal; min-width: 320px; }
fieldset.ohne-rahmen { border: 0; padding: 0; margin: 0; min-width: 0; }
.abstand-oben { margin-top: 16px; }
.erkl-titel .stand { font-weight: 400; color: var(--leise); }
.aenderungen { margin: 8px 0 0; padding-left: 18px; } .aenderungen li { margin-bottom: 6px; }
ol.checkliste { margin: 8px 0; padding-left: 22px; font-size: 14px; }
ol.checkliste li { margin-bottom: 8px; }
ol.checkliste li.ok strong { color: var(--text); }
ol.checkliste li.fehlt strong { color: var(--fehler); }

/* Aufklappbarer Info-Hinweis (funktioniert per Klick/Tippen, ohne JavaScript) */
.info { margin: 0 0 12px; font-size: 14px; }
.info summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--akzent); font-weight: 600; list-style: none; }
.info summary::-webkit-details-marker { display: none; }
.info summary:hover, .info summary:focus-visible { text-decoration: underline; }
.info-symbol { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--akzent); color: #fff; font: 700 12px/1 Georgia, serif; font-style: italic; }
.info[open] summary { margin-bottom: 6px; }
.info ul { margin: 0; padding: 10px 14px 10px 30px; background: var(--akzent-hell); border-radius: 8px; color: var(--text); }
.info li { margin: 4px 0; }

/* Pflichtfelder */
.stern { color: var(--fehler); text-decoration: none; font-weight: 700; border: 0; cursor: help; }
.pflicht-hinweis { margin: 0 0 12px; color: var(--leise); font-size: 14px; }
.erkl-hinweis { display: block; margin-top: 4px; font-size: 14px; color: var(--akzent); }

/* Rückfrage ohne Botenauftrag */
dialog#dialog-bote { max-width: 560px; width: calc(100% - 32px); border: 0; border-radius: var(--radius); padding: 24px; color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog#dialog-bote::backdrop { background: rgba(20, 28, 40, .55); }
dialog#dialog-bote h2 { margin-top: 0; }
dialog#dialog-bote ul { padding-left: 20px; }
dialog#dialog-bote li { margin: 6px 0; }
.dialog-knoepfe { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.ohne-bote-noscript { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }

/* Verwaltung: Markierung ohne Botenauftrag */
.marke.ohne-bote { background: #fff0e0; color: #9a4a00; }

/* Dateivorschau mit Kacheln (Passbild und Passseiten) */
.foto-bereich { flex-direction: column; align-items: stretch; }
.vorschau { width: auto; height: auto; min-height: 0; border: 0; display: block; background: none; overflow: visible; }
.vorschau > span { display: inline-flex; width: 105px; height: 135px; align-items: center; justify-content: center; border: 1px dashed var(--linie); border-radius: 8px; color: var(--leise); font-size: 13px; }
.dateiliste { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.vorschau, .dateiliste { width: 100%; }
.vorschau .kachel, .dateiliste .kachel { margin: 0; }
.kachel { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border: 1px solid var(--linie); border-radius: 8px; background: var(--flaeche); width: 100%; }
.kachel img, .pdf-kachel { width: 84px; height: 108px; object-fit: cover; border-radius: 4px; flex: none; background: var(--grund); }
.pdf-kachel { display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--fehler); border: 1px solid var(--linie); }
.kachel figcaption { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.dateiname { font-size: 14px; color: var(--leise); overflow-wrap: anywhere; }
.kachel-knoepfe { display: flex; flex-wrap: wrap; gap: 6px; }
button.klein { padding: 6px 12px; font-size: 14px; }
.erklaerer { margin: 0 0 10px; padding: 10px 14px; background: var(--akzent-hell); border-radius: 8px; }
.auswahl { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.auswahl label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; padding: 10px 12px; border: 1px solid var(--linie); border-radius: 8px; cursor: pointer; }
.auswahl label:has(input:checked) { border-color: var(--akzent); background: var(--akzent-hell); }
.auswahl input { margin-top: 4px; }
dialog#dialog-pass { max-width: 560px; width: calc(100% - 32px); border: 0; border-radius: var(--radius); padding: 24px; color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog#dialog-pass::backdrop, dialog.bildeditor::backdrop { background: rgba(20, 28, 40, .55); }
dialog#dialog-pass h2 { margin-top: 0; }

/* Bildeditor */
dialog.bildeditor { max-width: 820px; width: calc(100% - 24px); border: 0; border-radius: var(--radius); padding: 20px; color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.bildeditor h2 { margin-top: 0; }
.bildeditor-werkzeuge { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.bildeditor-werkzeuge button { padding: 8px 14px; font-size: 14px; }
.bildeditor-buehne { display: flex; justify-content: center; background: #2b3340; border-radius: 8px; padding: 10px; }
.bildeditor-buehne canvas { touch-action: none; cursor: crosshair; max-width: 100%; }
.pdf-kachel.gross { width: 120px; height: 150px; text-decoration: none; }
.fotos figcaption form { display: inline; }

/* Zurück zur Webseite */
.zurueck-leiste { margin: 0 0 8px; font-size: 15px; }
.zurueck-link { color: var(--akzent); text-decoration: none; font-weight: 600; }
.zurueck-link:hover, .zurueck-link:focus-visible { text-decoration: underline; }
.knopf-link { display: inline-block; padding: 10px 18px; border: 1px solid var(--akzent); border-radius: 8px; color: var(--akzent); text-decoration: none; font-weight: 600; }
.knopf-link:hover, .knopf-link:focus-visible { background: var(--akzent-hell); }

/* Vorschaufenster */
dialog.vorschau-fenster { max-width: 960px; width: calc(100% - 24px); max-height: calc(100vh - 24px); border: 0; border-radius: var(--radius); padding: 16px 20px; color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog.vorschau-fenster::backdrop { background: rgba(20, 28, 40, .7); }
.vorschau-kopf { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.vorschau-kopf h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.vorschau-kopf button { padding: 8px 14px; font-size: 14px; flex: none; }
.vorschau-buehne { display: flex; flex-direction: column; align-items: center; gap: 8px; background: #2b3340; border-radius: 8px; padding: 10px; }
.vorschau-buehne img { max-width: 100%; max-height: calc(100vh - 220px); object-fit: contain; background: #fff; }
.vorschau-buehne iframe { width: 100%; height: calc(100vh - 260px); min-height: 320px; border: 0; background: #fff; border-radius: 4px; }
.vorschau-buehne .hilfe { color: #d7dde6; margin: 0; }
.vorschau-buehne .hilfe a { color: #fff; }

/* Auswahl mit Suche (Nationalität) */
.such-box { position: relative; margin-top: 4px; }
.such-box input { width: 100%; }
.such-liste { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 2px); max-height: 260px; overflow-y: auto; margin: 0; padding: 4px 0; list-style: none; background: var(--flaeche, #fff); border: 1px solid var(--linie); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.such-liste li { padding: 8px 12px; cursor: pointer; font-weight: 400; }
.such-liste li.aktiv, .such-liste li:hover { background: var(--akzent-hell); }
.such-liste li.such-leer { color: var(--leise); cursor: default; }
.zweite-staatsangehoerigkeit { margin-top: 4px; }
.zweite-staatsangehoerigkeit summary { cursor: pointer; color: var(--akzent); font-weight: 600; font-size: 15px; }
.zweite-staatsangehoerigkeit[open] summary { margin-bottom: 8px; }

/* Kachel: Vorschaubild ist selbst ein Knopf */
.kachel-bild { padding: 0; border: 0; background: none; cursor: pointer; flex: none; border-radius: 4px; }
.kachel-bild img { display: block; }
.kachel-bild.pdf-kachel { width: 84px; height: 108px; font-size: 16px; }
.marke.bearbeitet { align-self: flex-start; background: #e6f4ea; color: #1e6b34; }

/* Bearbeiten-Fenster */
.bildeditor .vorschau-kopf .schliessen { padding: 6px 12px; }
.bildeditor-werkzeuge .trenner { width: 1px; align-self: stretch; background: var(--linie); margin: 0 4px; }
.bildeditor-werkzeuge button:disabled { opacity: .45; cursor: default; }
.bildeditor-stapel { position: relative; line-height: 0; }
.bildeditor-stapel canvas { display: block; }
.bildeditor-stapel .deck { position: absolute; left: 0; top: 0; touch-action: none; cursor: crosshair; }
.bildeditor > .hilfe { margin: 8px 0 0; }
.bildeditor-regler { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 10px 0 0; }
.regler { display: flex; align-items: center; gap: 10px; font-weight: 400; flex: 1 1 240px; }
.regler-name { min-width: 80px; }
.regler input[type=range] { flex: 1; }
.regler-wert { min-width: 32px; text-align: right; color: var(--leise); font-variant-numeric: tabular-nums; }
.bildeditor-fuss { align-items: center; }
.bildeditor-fuss .links { margin-right: auto; }
.bildeditor .vorschau-buehne iframe { width: 100%; height: calc(100vh - 300px); min-height: 320px; border: 0; background: #fff; border-radius: 4px; }
@media (max-width: 560px) {
  .bildeditor-werkzeuge button { flex: 1 1 calc(50% - 8px); }
  .bildeditor-werkzeuge .trenner { display: none; }
  .bildeditor-fuss .links { margin-right: 0; flex-basis: 100%; }
}
