
:root {
  --g-950: #013328;
  --g-900: #014A3A;
  --g-800: #01604B;
  --g-700: #0B7A5F;
  --g-600: #1F8F70;
  --g-500: #2FA37F;
  --g-300: #8ECBB3;
  --g-200: #C3E4D6;
  --g-100: #E2F1EA;
  --g-50: #F0F7F3;
  --bg: #F2F5F3;
  --surface: #FFFFFF;
  --text: #142019;
  --muted: #5B6B63;
  --border: #D9E3DD;
  --border-strong: #B9CBC1;
  --table-line: #C8D5CD;
  --table-line-strong: #779586;
  --danger: #B23A48;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(11, 61, 46, .06), 0 4px 16px rgba(11, 61, 46, .06);
  --font: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wrap: 1280px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--g-700); }
a:hover { color: var(--g-900); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

@media screen {
  body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
  body > main.wrap { flex: 1 0 auto; width: 100%; }
  body > .site-header, body > .site-footer { flex-shrink: 0; }
}
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--g-900); color: #fff; padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }
[hidden] { display: none !important; }


.site-header { background: var(--g-900); color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); position: sticky; top: 0; z-index: 30; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; padding-top: 8px; padding-bottom: 8px; }
.brand { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 12px; }
.brand-title { font-size: 1.35rem; font-weight: 600; letter-spacing: -.01em; }
.brand-title em { font-style: italic; font-weight: 400; color: var(--g-200); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.logo-filters { position: absolute; width: 0; height: 0; overflow: hidden; }
.logo { display: inline-flex; align-items: center; margin-left: 8px; }
.logo-viewport { display: block; position: relative; width: 156px; height: 35px; overflow: hidden; flex: none; }
.logo-img { display: block; position: absolute; width: 163px; height: auto; max-width: none; left: -4px; top: -21px; filter: url(#logo-black-to-white); }

.brand-name { transition: color .18s ease; }
.brand:hover .brand-name, .brand:focus-visible .brand-name { color: #D1D5DB; }


.btn { display: inline-flex; align-items: center; justify-content: center; text-align: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--g-900); padding: 8px 18px; border-radius: 999px; font: inherit; font-size: .88rem; font-weight: 500; cursor: pointer; text-decoration: none; line-height: 1.25; transition: background .15s, color .15s, border-color .15s, box-shadow .15s; box-sizing: border-box; max-width: 100%; }
.btn:hover { background: var(--g-50); border-color: var(--g-500); color: var(--g-900); }
.btn.is-active, .btn-primary { background: var(--g-800); border-color: var(--g-800); color: #fff; }
.btn.is-active:hover, .btn-primary:hover { background: var(--g-900); border-color: var(--g-900); color: #fff; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn-ghost:hover { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .7); }
.btn-sm { padding: 4px 10px; font-size: .82rem; }
.btn:focus-visible, button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--g-300); outline-offset: 2px; }


.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 24px; margin: 20px 0; }
.card h2.section-title, .card h3.section-title, .section-title { font-size: 1.25rem; color: var(--g-900); margin-bottom: 6px; text-align: center; }
.select-grid .section-title { text-align: left; }


.controls { padding-bottom: 14px; }
.ctrl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 32px; }
.ctrl-group { min-width: 0; }
.ctrl-group.full { grid-column: 1 / -1; }
.ctrl-label { display: block; font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { border: 1px solid var(--border-strong); background: var(--surface); color: var(--g-900); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .88rem; cursor: pointer; text-decoration: none; line-height: 1.2; transition: background .15s, color .15s, border-color .15s; }
.pill:hover { background: var(--g-50); border-color: var(--g-500); }
.pill.is-active { background: var(--g-800); border-color: var(--g-800); color: #fff; }
.pill.is-disabled { opacity: .45; cursor: default; }
.pill-year { padding: 5px 9px; font-size: .84rem; font-variant-numeric: tabular-nums; min-width: 52px; text-align: center; }
.year-nav { display: flex; align-items: center; gap: 8px; }
.year-nav select { display: none; }


.adress { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.adress label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--muted); min-width: 0; max-width: 100%; }
.adress input, .adress select, .side-select select, select.styled, input.styled {
  font: inherit;
  font-size: .92rem;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  min-width: 0;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.adress input:focus, .adress select:focus, .side-select select:focus, select.styled:focus, input.styled:focus {
  outline: none;
  border-color: var(--g-600);
  box-shadow: 0 0 0 3px var(--g-100);
}
.adress input[id^="adrStreet"], .adress input#adrStreet { width: 300px; max-width: 100%; }
.adress input[id^="adrHnr"], .adress input#adrHnr { width: 110px; }
.adress input.is-invalid { border-color: var(--danger); background: #FFF3F4; }
.adress-result { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; }
.adress-result a { font-weight: 600; }
.adress-hint { font-size: .82rem; color: var(--muted); }


input[list].styled,
.adress input[list],
select.styled,
.side-select select,
.adress select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23014A3A' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
  padding-right: 32px;
}
select.styled,
.side-select select,
.adress select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
}

input[list]::-webkit-calendar-picker-indicator {
  opacity: 0 !important;
  cursor: pointer;
  width: 28px;
  height: 100%;
}


.select-grid { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }
.area-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; max-height: 860px; overflow: auto; padding-right: 4px; }
.area-list a { display: block; padding: 7px 12px; border-radius: var(--radius-sm); background: var(--g-50); color: var(--g-900); text-decoration: none; font-size: .9rem; border: 1px solid transparent; transition: background .12s, border-color .12s; }
.area-list a:hover, .area-list a.is-hover { background: var(--g-100); border-color: var(--g-300); }
.area-list a.is-active { background: var(--g-800); color: #fff; }
.map-wrap { position: relative; }
.map-wrap svg { width: 100%; height: auto; max-height: 860px; display: block; }
.map-area { fill: #fff; stroke: var(--g-800); stroke-width: 1; stroke-linejoin: round; cursor: pointer; transition: fill .12s; }
.map-area:hover, .map-area.is-hover { fill: var(--g-200); }
.map-area.is-active { fill: var(--g-600); }
.map-outline { fill: none; stroke: var(--g-950); stroke-width: 2; pointer-events: none; }
.map-tools { display: flex; justify-content: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.map-tools .btn { padding: 8px 22px; font-size: .88rem; text-align: center; }
.map-tooltip { position: absolute; pointer-events: none; background: var(--g-950); color: #fff; padding: 4px 8px; border-radius: 6px; font-size: .8rem; white-space: nowrap; transform: translate(-50%, -130%); display: none; z-index: 5; }


.tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; border-bottom: 2px solid var(--border); margin: 6px 0 16px; }
.tab { border: 0; background: transparent; font: inherit; font-size: .92rem; font-weight: 500; color: var(--muted); padding: 10px 14px; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: color .12s, border-color .12s; }
.tab:hover { color: var(--g-900); }
.tab.is-active { color: var(--g-900); border-bottom-color: var(--g-700); }
.subtabs { border-bottom: 0; margin: 0 0 14px; gap: 6px; }
.subtabs .tab { border: 1px solid var(--border-strong); border-radius: 999px; padding: 5px 12px; font-size: .85rem; margin: 0; }
.subtabs .tab.is-active { background: var(--g-100); border-color: var(--g-500); color: var(--g-900); }


.page-title { font-size: 1.5rem; color: var(--g-900); text-align: center; margin: 4px 0 4px; }
.page-title .q { color: var(--g-600); }
/* Abstand zwischen Seitentitel und Übersichtstabelle der Detailansicht */
#uebersicht { margin-top: 20px; }
.content-title { font-size: 1.1rem; color: var(--g-900); margin: 4px 0 12px; text-align: center; }
.content-title.left { text-align: left; }
.notice { background: var(--g-50); border-left: 4px solid var(--g-500); padding: 10px 14px; border-radius: 6px; color: var(--g-900); margin: 8px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }


.table-wrap { min-width: 0; container-type: inline-size; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.table-footnote { margin: 6px 0 0; }
.table-banner { padding: 8px 12px; background: var(--g-50); border-bottom: 1px solid var(--table-line); color: var(--g-900); font-size: .85rem; font-weight: 600; text-align: center; }
table.data { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: .85rem; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 5px clamp(4px, .7cqw, 8px); text-align: center; white-space: nowrap; box-sizing: border-box; }
table.data.dense { font-size: .78rem; }
table.data.dense th, table.data.dense td { padding-left: 3px; padding-right: 3px; }
table.data th { white-space: normal; hyphens: manual; -webkit-hyphens: manual; overflow-wrap: normal; word-break: normal; vertical-align: middle; line-height: 1.3; }
table.data th { background: var(--g-50); color: var(--g-900); font-weight: 600; vertical-align: middle; }
table.data th.has-info-toggle { position: relative; padding-right: 30px; }
.table-info-toggle { position: absolute; top: 4px; right: 5px; display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 1.5px solid var(--g-900); border-radius: 50%; background: #fff; color: var(--g-900); font: 700 12px/1 Arial, sans-serif; cursor: pointer; }
.table-info-toggle:hover { background: var(--g-100); }
.table-info-toggle[aria-expanded="true"] { background: var(--g-900); color: #fff; }
.table-info-toggle:focus-visible { outline: 2px solid var(--g-900); outline-offset: 2px; }
table.data thead tr:first-child th { border-top: 0; }
table.data thead th:not(.head-final) { border-bottom: 1px solid var(--table-line); }
table.data thead th.head-final { border-bottom: 2px solid var(--table-line-strong); }
table.data tbody td { border-bottom: 1px solid var(--table-line); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data th.lbl, table.data td.lbl { text-align: left; position: sticky; left: 0; background: #fff; z-index: 1; }
table.data th.lbl { background: var(--g-50); }
table.data td.lbl { font-weight: 500; white-space: nowrap; }
/* Die Klammer darf den Innenabstand der Zelle mitnutzen, damit sie mittig in eine Zeile passt;
   bei großer Schrift bricht sie innerhalb der Zelle um, statt in die Nachbarspalten zu ragen */
table.data th .nowrap { display: block; margin: 0 calc(-1 * clamp(4px, .7cqw, 8px)); }
table.data th.border-thin, table.data td.border-thin { border-right: 1px solid var(--table-line-strong); }
table.data th.border-medium, table.data td.border-medium { border-right: 2px solid var(--table-line-strong); }
table.data th.border-extra-strong, table.data td.border-extra-strong { border-right: 3px solid var(--table-line-strong); }
table.data td.pct { color: var(--muted); font-style: italic; }
/* Saldo- und Minuswerte werden wie alle anderen Tabellenzahlen in Standardschriftfarbe (schwarz) dargestellt */
table.data tr.sum td { font-weight: 700; background: var(--g-50); }
table.data td.is-total { font-weight: 700; }
table.data tbody tr:hover td { background: var(--g-50); }
table.data tbody tr.sum:hover td { background: var(--g-100); }
table.data tbody tr.linkable { cursor: pointer; }
table.data tbody tr.is-hl td { background: var(--g-100); }
table.data td.hl-col, table.data th.hl-col { background: #FFF8E1; }
table.data.compact td, table.data.compact th { padding: 4px clamp(4px, .7cqw, 8px); }
table.data th[title] { cursor: help; }
table.data th[title]:hover, table.data th[title]:focus-visible { background: var(--g-100); }
.chart-color-key { width: min(520px, 100%); margin-top: 14px; }
.chart-legend-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .95rem; }
.chart-legend-table th, .chart-legend-table td { padding: 8px 10px; border: 0; text-align: center; }
.chart-legend-table th:first-child { width: 60%; padding-left: 0; text-align: left; font-weight: 500; overflow-wrap: anywhere; }
.chart-legend-table thead th { color: #142019; font-weight: 700; }
.chart-key-square { display: inline-block; width: 16px; height: 16px; vertical-align: middle; }
.time-series-chart .chart-color-key { width: min(380px, 100%); margin-top: 8px; }
.time-series-chart .chart-legend-table { font-size: .82rem; }
.time-series-chart .chart-legend-table th, .time-series-chart .chart-legend-table td { padding: 5px 7px; }
.time-series-chart .chart-key-square { width: 12px; height: 12px; }
.legend-table { font-size: .85rem; border-collapse: collapse; }
.legend-table td { padding: 2px 10px 2px 0; }


.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 16px; align-items: stretch; }
.detail-main { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.detail-main > .card { margin: 0; }
.detail-main > .card:last-child { flex: 1; }
.side { position: sticky; top: 84px; align-self: start; display: flex; flex-direction: column; gap: 12px; }
.side .card { margin: 0; padding: 16px; }
.side-select { display: flex; flex-direction: column; gap: 8px; }
.side-select select { width: 100%; }
.side-select .btn { width: 100%; justify-content: center; text-align: center; padding: 8px 16px; font-size: .82rem; line-height: 1.25; }
.side .adress { width: 100%; }
.side .adress .adr-label-street,
.side .adress label:first-of-type { width: 100%; }
.side .adress input[id^="adrStreet"],
.side .adress input#adrStreet { width: 100%; }
.minimap { position: relative; }
.minimap svg { width: 100%; height: auto; display: block; }
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; margin-top: 16px; }
.chart-row.single { grid-template-columns: 1fr; }
.chart { width: 100%; }
.chart-pie { max-width: 440px; margin: 0 auto; }
.chart svg { width: 100%; height: auto; display: block; font-family: var(--font); }
.chart-title { font-size: .9rem; font-weight: 600; color: var(--g-900); margin-bottom: 4px; }
.population-pyramid { margin-top: 20px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.population-pyramid .chart-title { text-align: center; margin-bottom: 12px; }
.population-pyramid-svg { display: block; width: 100%; height: auto; font-family: var(--font); }
.pyramid-grid { stroke: #e5ece8; stroke-width: 1; }
.pyramid-tick { fill: var(--muted); font-size: 11px; }
.pyramid-sex { fill: var(--g-900); font-size: 13px; font-weight: 650; }
.pyramid-age { fill: #263b34; font-size: 11px; }
.population-pyramid-svg .pyramid-bar { transform-box: fill-box; transition: transform 650ms cubic-bezier(.2,.75,.25,1); transition-delay: var(--bar-delay, 0ms); }
.population-pyramid-svg:not(.is-animated) .pyramid-bar-men { transform: scaleX(0); transform-origin: right center; }
.population-pyramid-svg:not(.is-animated) .pyramid-bar-women { transform: scaleX(0); transform-origin: left center; }
.population-pyramid-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 18px; padding-top: 10px; border-top: 1px solid var(--border); }
.population-pyramid-footer .legend { margin: 0; }
.population-pyramid > .pyramid-legend { margin-top: 12px; }
.stand { font-size: .82rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .population-pyramid-svg .pyramid-bar { transition: none; transform: none !important; }
}


/* Deutlicher Abstand zwischen Karte und Vergleich sowie zum Erklärtext darunter */
.vg-grid { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 24px 56px; align-items: stretch; margin-bottom: 36px; }
/* Spalte reicht bis zur Unterkante der rechten Seite, der Button steht mittig im Raum unter der Legende */
.vg-map { position: relative; display: flex; flex-direction: column; }
.vg-table { align-self: start; }
.vg-map svg { width: 100%; height: auto; display: block; }
.vg-area { stroke: #fff; stroke-width: .8; cursor: pointer; transition: opacity .12s; }
.vg-area:hover { opacity: .75; stroke: var(--g-950); }
.vg-area.is-pin1, .vg-area.is-pin2 { stroke: var(--g-950); stroke-width: 2; }
.vg-scale { width: 140px; min-height: 297px; overflow: hidden; color: #333; font: 12px/1 Arial, sans-serif; }
.vg-scale ol { margin: 0; padding: 0; list-style: none; }
.vg-scale li { display: flex; align-items: center; gap: 10px; height: 24.64px; white-space: nowrap; }
.vg-scale-swatch { align-self: stretch; flex: 0 0 10px; }
.vg-scale-unit { margin-top: 10px; line-height: 12px; }
.vg-scale.vg-scale-h { width: auto; min-height: 0; overflow: visible; margin: 16px 0 0; padding: 10px 22px 4px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; font: inherit; color: var(--text, #263b34); }
.vg-scale-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 7px; font-size: .82rem; }
.vg-scale-h .vg-scale-unit { margin: 0; line-height: 1.2; font-weight: 600; color: var(--g-900); }
.vg-scale-dir { color: var(--muted); font-size: .76rem; white-space: nowrap; }
.vg-scale-bar { display: flex; gap: 1px; height: 16px; border-radius: 4px; overflow: hidden; background: #fff; }
.vg-scale-bar span { flex: 1; }
.vg-scale-ticks { position: relative; height: 24px; font-size: .74rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.vg-scale-ticks span { position: absolute; top: 0; transform: translateX(-50%); padding-top: 7px; line-height: 1.2; white-space: nowrap; background: linear-gradient(#9aa8a2, #9aa8a2) center top / 1px 5px no-repeat; }
@media (max-width: 480px) {
  .vg-scale-ticks span:nth-child(even) { visibility: hidden; }
}
/* Überschrift und Farbklassen fluchten mit dem Text in den Kästen (Rahmen + Innenabstand) */
.vg-table { --vg-inset: 13px; }
.vg-table h3 { font-size: 1rem; color: var(--g-900); margin-bottom: 8px; padding-left: var(--vg-inset); }
.vg-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px; background: #fff; }
.vg-box .vg-name { font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vg-box .vg-row { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; padding: 2px 0; }
/* Lange Merkmalsnamen dürfen umbrechen, der Wert bleibt mit Einheit zusammen und steht auf Höhe der letzten Zeile */
.vg-box .vg-row span:last-child { font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; align-self: flex-end; }
.vg-box.is-empty { color: var(--muted); }
.vg-table { min-width: 0; }
.vg-table .class-legend-wrap { max-width: none; margin-top: 28px; padding: 24px var(--vg-inset) 0; border-top: 1px solid var(--border); }
.vg-anim-action { margin: auto 0; padding-top: 20px; text-align: center; }
.pin { width: 18px; height: 19px; vertical-align: middle; }
.vg-desc { font-size: .9rem; color: var(--text); margin: 14px 0 4px; }
.vg-note { font-size: .78rem; color: var(--muted); }
/* Merkmale mittig unter den ebenfalls zentrierten Themen- und Unterthemen-Reitern */
.radios { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 14px; }


.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(7, 42, 31, .55); }
.modal-dialog { position: relative; background: #fff; border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--g-50); }
.modal-head h2 { font-size: 1.1rem; color: var(--g-900); }
.modal-close { border: 0; background: transparent; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.modal-close:hover { background: var(--g-100); color: var(--g-900); }
.modal-body { padding: 20px; overflow: auto; }
.modal-body h2 { font-size: 1.15rem; color: var(--g-900); margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--g-200); }
.modal-body h2:first-child { margin-top: 0; }
.modal-body h3 { font-size: 1rem; color: var(--g-800); margin: 14px 0 4px; }
.modal-body h4 { font-size: .9rem; color: var(--muted); margin: 8px 0 2px; text-transform: uppercase; letter-spacing: .04em; }
.modal-body p { margin: 4px 0 6px; }
.desc-block { margin-bottom: 6px; }
.formula-p { margin: 6px 0 10px; }
.formula { display: inline-flex; align-items: center; gap: 8px; font-size: .95rem; background: var(--g-50); padding: 8px 14px; border-radius: 8px; }
.frac { display: inline-flex; flex-direction: column; align-items: center; text-align: center; }
.frac .num { border-bottom: 1.5px solid var(--g-900); padding: 0 6px 2px; }
.frac .den { padding: 2px 6px 0; }
.anim { text-align: center; }
.anim img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.anim .anim-year { font-size: 1.4rem; font-weight: 600; color: var(--g-900); margin: 8px 0; font-variant-numeric: tabular-nums; }
.anim-controls { display: flex; justify-content: center; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.anim-meta { color: var(--muted); font-size: .9rem; margin-bottom: 8px; }
.anim-pyramid-chart { display: flex; justify-content: center; min-height: 280px; height: min(600px, 59dvh); }
.anim-pyramid-chart .population-pyramid-svg { width: 100%; height: 100%; }
.anim-pyramid > .pyramid-legend, .anim-pyramid #animLegend .pyramid-legend { margin: 10px auto 0; }
.anim-grid { display: grid; grid-template-columns: 1fr 150px; gap: 16px; align-items: start; }

.modal-dialog:has(.anim-comparison) { height: min(760px, calc(100dvh - 24px)); max-height: calc(100dvh - 24px); }
.modal-dialog:has(.anim-comparison) .modal-head { flex: none; }
.modal-body:has(.anim-comparison) { flex: 1; min-height: 0; overflow: hidden; padding: 12px 20px; }
.anim-comparison { height: 100%; min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.anim-comparison .anim-grid { min-height: 0; grid-template-columns: minmax(0, 1fr) 140px; align-items: stretch; }
.anim-comparison .vg-map { min-height: 0; min-width: 0; }
.anim-comparison .vg-map svg { width: 100%; height: 100%; }
.anim-comparison .vg-legend { min-height: 0; text-align: left; }
.anim-comparison .vg-scale { height: 100%; max-height: 297px; min-height: 0; display: flex; flex-direction: column; font-size: clamp(8px, 1.7dvh, 12px); }
.anim-comparison .vg-scale ol { flex: 1; min-height: 0; }
.anim-comparison .vg-scale li { height: 10%; }
.anim-comparison .vg-scale-unit { flex: none; margin: 8px 0 4px; }
.anim-comparison .anim-controls { margin: 10px 0 0; }
@media (max-width: 600px), (max-height: 500px) {
  .modal-body:has(.anim-comparison) { padding: 8px 12px; }
  .anim-comparison .anim-meta { font-size: .75rem; margin-bottom: 0; }
  .anim-comparison .anim-year { font-size: 1.1rem; margin: 2px 0; }
  .anim-comparison .anim-grid { grid-template-columns: minmax(0, 1fr) 112px; gap: 8px; }
  .anim-comparison .vg-scale { width: 112px; font-size: 9px; }
  .anim-comparison .vg-scale li { gap: 5px; }
  .anim-comparison .anim-controls { gap: 5px; margin-top: 6px; }
  .anim-comparison .anim-controls .btn { font-size: .75rem; padding: 6px 9px; }
}
.pyramid-legend { margin: 14px 0 6px; border-collapse: collapse; font-size: .88rem; }
.pyramid-legend th, .pyramid-legend td { padding: 4px 12px; text-align: center; border: 0; }
.pyramid-legend th:first-child { min-width: 230px; padding-left: 0; text-align: left; font-weight: 500; }
.pyramid-legend .sw { display: inline-block; width: 13px; height: 13px; vertical-align: middle; }


.site-footer {
  margin-top: 40px;
  background: var(--g-900);
  color: var(--g-200);
  font-size: .84rem;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding-top: 24px;
  padding-bottom: 24px;
}
.site-footer a {
  color: #fff;
  text-decoration: none;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 24px;
}
.footer-links a {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background-color .15s ease, color .15s ease;
}
.footer-links a:hover,
.footer-links a:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, .1);
  text-decoration: underline;
}
.footer-links a[aria-current="page"] {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.footer-divider {
  width: 100%;
  max-width: 500px;
  height: 1px;
  background: rgba(255, 255, 255, .12);
  margin: 0 auto;
}
.footer-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 20px;
  color: var(--g-200);
  font-size: .82rem;
  line-height: 1.5;
}
.footer-meta > span:empty {
  display: none;
}
.footer-copy {
  font-weight: 500;
}
.footer-copy a {
  color: #fff;
  text-decoration: none;
  transition: color .15s ease;
}
.footer-copy a:hover,
.footer-copy a:focus-visible {
  color: var(--g-200);
  text-decoration: none;
}
.to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--g-950);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1.35rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  opacity: .95;
  z-index: 40;
  user-select: none;
  transition: background-color .2s ease, transform .2s ease, opacity .2s ease;
}
.to-top:hover,
.to-top:focus-visible {
  background: #00221a;
  color: #fff;
  opacity: 1;
  transform: translateY(-2px);
  outline: 3px solid var(--g-300);
  outline-offset: 2px;
}
.loading { color: var(--muted); padding: 30px; text-align: center; }
.loading::before { content: ""; display: inline-block; width: 18px; height: 18px; border: 3px solid var(--g-200); border-top-color: var(--g-700); border-radius: 50%; margin-right: 10px; vertical-align: -4px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { background: #FFF3F4; border-left: 4px solid var(--danger); padding: 10px 14px; border-radius: 6px; }


@media (max-width: 1000px) {
  .select-grid, .vg-grid { grid-template-columns: 1fr; }
  .side { position: static; }
  .chart-row { grid-template-columns: 1fr; }
  .area-list { max-height: 60vh; }
  .vg-grid { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); column-gap: 32px; }
}
@media (max-width: 1260px) {
  .detail-grid { grid-template-columns: 1fr; }
  .side { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: start; }
}
@media (max-width: 700px) {
  .ctrl-grid { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; }
  .brand-title { font-size: 1.1rem; }
  .card { padding: 16px; }
  .vg-grid { grid-template-columns: 1fr; }
  .pills.years { display: none; }
  .year-nav select { display: block; }
  .anim-grid { grid-template-columns: 1fr; }
}
@media print {
  .site-header, .controls, .side, .to-top, .site-footer .footer-links, .site-footer .footer-divider { display: none; }
  .card { box-shadow: none; }
}




html[data-textsize="klein"] { font-size: 88%; }
html[data-textsize="gross"] { font-size: 115%; }
html[data-textsize="sehrgross"] { font-size: 132%; }
html[data-textsize="gross"] table.data, html[data-textsize="sehrgross"] table.data { font-size: .92rem; }


html[data-contrast="hoch"] {
  --text: #000000;
  --muted: #17261F;
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --border: #475C52;
  --border-strong: #16281E;
  --g-50: #EDF5F1;
  --g-100: #DBEDE4;
  --shadow: none;
}
html[data-contrast="hoch"] .card,
html[data-contrast="hoch"] .page,
html[data-contrast="hoch"] .table-wrap,
html[data-contrast="hoch"] .vg-box { border: 2px solid var(--border-strong); box-shadow: none; }
html[data-contrast="hoch"] .vg-table { --vg-inset: 14px; }
html[data-contrast="hoch"] .btn,
html[data-contrast="hoch"] .pill,
html[data-contrast="hoch"] .a11y-opts label,
html[data-contrast="hoch"] .adress input,
html[data-contrast="hoch"] select.styled { border-width: 2px; }
html[data-contrast="hoch"] input[list].styled,
html[data-contrast="hoch"] .adress input[list],
html[data-contrast="hoch"] select.styled,
html[data-contrast="hoch"] .side-select select,
html[data-contrast="hoch"] .adress select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
html[data-contrast="hoch"] .tab { color: var(--text); }
html[data-contrast="hoch"] .tab.is-active { border-bottom-width: 4px; }
html[data-contrast="hoch"] table.data td.pct { color: var(--text); }
html[data-contrast="hoch"] { --table-line: #475C52; --table-line-strong: #16281E; }
html[data-contrast="hoch"] .site-footer { border-top: 2px solid var(--border-strong); }
html[data-contrast="hoch"] .site-footer .footer-divider { background: var(--border-strong); height: 2px; }
html[data-contrast="hoch"] .site-footer a,
html[data-contrast="hoch"] .page a,
html[data-contrast="hoch"] main a:not(.btn):not(.pill):not(.tab) { text-decoration: underline; }

html[data-contrast="hoch"] .brand:hover .brand-name,
html[data-contrast="hoch"] .brand:focus-visible .brand-name { color: #E5E7EB; }
html[data-contrast="hoch"] .map-area { stroke-width: 1.6; }
html[data-contrast="hoch"] .vg-area { stroke: #0A1C15; stroke-width: 1.2; }
html[data-contrast="hoch"] :focus-visible { outline: 4px solid #A8202F; outline-offset: 2px; }
html[data-contrast="hoch"] .to-top { background: #000; color: #fff; border: 2px solid #fff; }
html[data-contrast="hoch"] .to-top:hover,
html[data-contrast="hoch"] .to-top:focus-visible { background: #222; outline: 3px solid #FF9494; }


.a11y { position: relative; }
.a11y-panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 40;
  width: 330px; max-width: calc(100vw - 24px);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 14px 36px rgba(0, 0, 0, .24); padding: 16px;
}
.a11y-panel fieldset { border: 0; margin: 0 0 14px; padding: 0; }
.a11y-panel legend { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 0 7px; }
.a11y-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.a11y-opts input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.a11y-opts label { border: 1px solid var(--border-strong); background: var(--surface); color: var(--g-900); border-radius: 999px; padding: 6px 12px; font-size: .86rem; cursor: pointer; line-height: 1.2; }
.a11y-opts label:hover { background: var(--g-50); }
.a11y-opts input:checked + label { background: var(--g-800); border-color: var(--g-800); color: #fff; }
.a11y-opts input:focus-visible + label { outline: 3px solid var(--g-300); outline-offset: 2px; }
.a11y-hint { font-size: .8rem; color: var(--muted); margin: 0 0 10px; }
.a11y-link { font-size: .86rem; margin: 4px 0 0; }


.class-legend-wrap { max-width: 550px; margin-top: 14px; }
.class-legend-wrap > p { margin: 0 0 18px; }
/* Ohne Linien zwischen den Zeilen; die Anzahl steht als Balken in der Klassenfarbe */
.class-legend { width: 100%; border-collapse: separate; border-spacing: 0 3px; font-size: .9rem; }
.class-legend th, .class-legend td { padding: 6px 10px; text-align: left; vertical-align: middle; }
.class-legend thead th { padding-bottom: 10px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: .8rem; font-weight: 600; }
.class-legend thead th:first-child, .class-legend tbody th { padding-left: 0; }
.class-legend tbody th { width: 46%; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.class-legend tbody tr:first-child th, .class-legend tbody tr:first-child td { padding-top: 10px; }
.class-legend .sw { display: inline-block; width: 16px; height: 16px; margin-right: 12px; vertical-align: -3px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); }
.class-legend .cnt { color: var(--muted); }
.cl-count { display: flex; align-items: center; gap: 10px; }
.cl-count > span:last-child { font-variant-numeric: tabular-nums; }
.cl-bar { flex: none; min-width: 4px; height: 12px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); transform-origin: left center; animation: cl-grow .5s ease-out both; }
@keyframes cl-grow { from { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .cl-bar { animation: none; } }


details.values { margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
details.values > summary { cursor: pointer; padding: 10px 14px; text-align: center; font-weight: 600; color: var(--g-900); border-radius: var(--radius-sm); }
details.values > summary:hover { background: var(--g-50); }
details.values > summary:focus-visible { outline: 3px solid var(--g-300); outline-offset: -3px; }
details.values[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
details.values .table-wrap { border: 0; }


.page { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 34px; margin: 20px 0 40px; max-width: 900px; }
.page h1 { font-size: 1.7rem; color: var(--g-900); margin-bottom: 8px; }
.page h2 { font-size: 1.2rem; color: var(--g-900); margin: 28px 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--g-200); }
.page h3 { font-size: 1rem; color: var(--g-800); margin: 18px 0 4px; }
.page p, .page li { max-width: 70ch; }
.page p { margin: 8px 0; }
.page ul, .page ol { margin: 8px 0; padding-left: 24px; }
.page li { margin: 5px 0; }
.page .lead { font-size: 1.05rem; color: var(--muted); max-width: 70ch; }
.page .todo { background: #FFF7E0; border-left: 4px solid #B08A15; padding: 12px 16px; border-radius: 6px; margin: 14px 0; }
html[data-contrast="hoch"] .page .todo { border-left-width: 6px; background: #FFF3CC; }
.page .platzhalter { background: rgba(0, 0, 0, .07); padding: 1px 6px; border-radius: 4px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; }
.page dl { margin: 8px 0; }
.page dt { font-weight: 600; margin-top: 10px; }
.page dd { margin: 2px 0 0 0; }
.page .back { display: inline-block; margin-top: 26px; }


.ls p, .ls li { font-size: 1.12rem; line-height: 1.75; max-width: 48ch; }
.ls h2 { font-size: 1.35rem; margin-top: 32px; }
.ls li { margin: 9px 0; }


.header-inner { flex-wrap: wrap; }
.brand-title { white-space: nowrap; }
.header-actions { flex-wrap: wrap; }
@media (max-width: 980px) {
  .brand { width: 100%; order: 1; }
  .header-actions { width: 100%; order: 2; justify-content: flex-start; padding-bottom: 4px; }
  .header-actions .logo { margin-left: auto; }
  .site-header { position: static; }
}
@media (max-width: 430px) {
  .brand-title { white-space: normal; font-size: 1rem; }
  .logo-viewport { width: 143px; height: 32px; }
  .logo-img { width: 149px; left: -4px; top: -19px; }
}


@media (max-height: 560px) {
  .site-header { position: static; }
  .side { position: static; }
  .to-top { display: none; }
}
@media (max-width: 700px) {
  .a11y-panel { position: fixed; left: 12px; right: 12px; top: 76px; width: auto; max-width: none; }
  .page { padding: 20px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
