/* NEXIS – Stylesheet */
/* ============================================================
   NEXIS B2B-Design (Spec: specs/b2b-redesign.md)
   Neutrale Schwarz/Weiß-Oberfläche, spiegelt Light/Dark.
   Data-Farben NUR an Datenpunkten (Karte, Chart, Scores,
   Baustellen-Warnungen) – niemals im UI-Chrome.
   ============================================================ */
:root {
    --radius-card: 6px;
    --radius-btn: 6px;
    --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --transition-base: 0.2s ease;
    /* Amber ist in beiden Modi identisch (Spec §3) */
    --data-amber: #EF9F27;
    /* Fix Header/Panel: feste Header-Höhe als Token – Layout-Offset und
       Mobile-Panel nutzen denselben Wert (Spec: header-panel-overlap.md) */
    --header-h: 64px;
}

/* Dark Mode (Standard-Fallback) */
html[data-theme="dark"] {
    --bg-primary: #0B0B0B;
    --bg-secondary: #111111;
    --bg-card: rgba(255, 255, 255, 0.06);
    --bg-input: #0F0F0F;
    --text-primary: #FFFFFF;
    --text-secondary: #a5a5a5;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --shadow-card: none;
    --data-green: #97C459;
    --data-red: #F09595;
    --data-none: #4A4A4A;
    --data-seq-0: #25324A;
    --data-seq-1: #8DB8FF;
    --chart-grid: rgba(255, 255, 255, 0.08);
    --polyline-color: rgba(255, 255, 255, 0.55);
    --row-hover: rgba(255, 255, 255, 0.04);
    --attribution-bg: rgba(11, 11, 11, 0.85);
}

/* Light Mode */
html[data-theme="light"] {
    --bg-primary: #FFFFFF;
    --bg-secondary: #FAFAFA;
    --bg-card: #FAFAFA;
    --bg-input: #FFFFFF;
    --text-primary: #0B0B0B;
    --text-secondary: #6a6a6a;
    --border-subtle: #E0E0E0;
    --shadow-card: none;
    --data-green: #639922;
    --data-red: #E24B4A;
    --data-none: #BDBDBD;
    --data-seq-0: #E4EDF9;
    --data-seq-1: #2A62C9;
    --chart-grid: rgba(11, 11, 11, 0.06);
    --polyline-color: rgba(11, 11, 11, 0.6);
    --row-hover: #F5F5F5;
    --attribution-bg: rgba(255, 255, 255, 0.85);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-ui);
    overflow: hidden;
    height: 100vh;
}

/* Fokus: neutrale Outline, keine Akzentfarbe (K22) */
:focus-visible {
    outline: 2px solid var(--text-secondary);
    outline-offset: 2px;
}

/* Header: liegt über ALLEN App-Layern (Panel 1100, Kontakt 1400, Chat 1500),
   damit er immer vollständig sichtbar bleibt (Spec: header-panel-overlap.md) */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 1600;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-primary);
}

/* (Live-Ticker „SYNCHRONISIERE…“ entfernt — Fake-Animation, widersprach der
   Ehrlichkeits-Regel; Header zeigt jetzt nur Logo + Steuerung.) */

.header-info {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    font-size: 13px;
}

.header-stats .number {
    color: var(--text-primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.theme-toggle-btn, .chat-toggle-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    padding: 6px 12px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color var(--transition-base);
}

.theme-toggle-btn:hover, .chat-toggle-btn:hover {
    border-color: var(--text-secondary);
}

/* Unauffälliger Unread-Hinweis am Chat-Toggle (KI-Synthese): dezente Punkt-Optik,
   keine Datenfarbe, verschwindet beim Öffnen des Chats (JS entfernt .hat-neu). */
.chat-toggle-btn.hat-neu {
    border-style: dashed;
}

.chat-toggle-btn.hat-neu::after {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-secondary);
    margin-left: 6px;
    vertical-align: middle;
}

/* Layout: beginnt unter dem fixierten Header – Panel und Karte können den
   Header dadurch räumlich nie überdecken (Spec: header-panel-overlap.md) */
.main-layout {
    display: flex;
    margin-top: var(--header-h);
    height: calc(100vh - var(--header-h));
}

.map-container {
    flex: 1;
    position: relative;
}

#map {
    height: 100%;
    width: 100%;
}

/* Panel */
.detail-panel {
    width: 420px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-subtle);
    overflow-y: auto;
    padding: 0;
    transition: transform var(--transition-base);
    z-index: 1100;
    /* über Leaflet-Controls (1000), unter Chat (1500)/Kontakt (1400) */
}

/* K13: Sticky-Header mit klarer Hierarchie: Name -> Zusatzzeile -> Toggle */
.panel-header {
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.panel-header h2 {
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

.panel-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Cards: einheitliches System (K15) */
.section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-card);
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.metric-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* Toggle (Tabs) – aktiver Tab invertiert, neutral (K3) */
.toggle-group {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    padding: 4px;
    margin-bottom: 16px;
}

.toggle-btn {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    transition: background var(--transition-base), color var(--transition-base);
}

.toggle-btn.active {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.toggle-btn:hover:not(.active) {
    color: var(--text-primary);
}

/* Marker-Filter (ÖPNV / Baustellen getrennt ein-/ausblenden) */
.marker-filter-group {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.marker-filter-group .toggle-btn {
    flex: 1;
}

/* Marker-Popups: Lib-Weiß überschreiben (Bug "weiße Sprechblase ohne Text":
   body-Erbfarbe weiß im Dark Mode auf Lib-Weiß). Deckende Fläche aus Tokens,
   Tip über Anchor-Selektoren mitgezogen. Muss NACH maplibre-gl.css stehen. */
.maplibregl-popup-content {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    padding: 8px 12px;
}

.maplibregl-popup-anchor-top .maplibregl-popup-tip, .maplibregl-popup-anchor-top-left .maplibregl-popup-tip, .maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
    border-bottom-color: var(--bg-input);
}

.maplibregl-popup-anchor-bottom .maplibregl-popup-tip, .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip, .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
    border-top-color: var(--bg-input);
}

.maplibregl-popup-anchor-left .maplibregl-popup-tip {
    border-right-color: var(--bg-input);
}

.maplibregl-popup-anchor-right .maplibregl-popup-tip {
    border-left-color: var(--bg-input);
}

/* ===== Analyse-Features (Spec: analyse-features.md) =====
   Energie-Filter (Kaufpreis-Ansicht): bestehende Tokens, keine Datenfarben. */
.energie-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.energie-filter-row select {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    padding: 5px 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
}

.energie-filter-row label {
    font-size: 12px;
    color: var(--text-secondary);
}

#energie-hinweis {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* Mikro-Zonen: Button im Toggle-Stil, Zonen-Karten mit Modellschätzung-Badge
   und Formel-Aufklapper (Transparenz-Pflicht). Zahlen tabular-nums. */
.btn-mikrozonen {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 8px 16px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    transition: background var(--transition-base), color var(--transition-base);
}

.btn-mikrozonen.active {
    background: var(--text-primary);
    color: var(--bg-primary);
}

/* Mietspiegel-Rechner-Modal (amtliche Faktoren-Formel) */
.ms-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1600;
    padding: 24px;
}

.ms-modal-overlay.offen {
    display: flex;
}

.ms-modal {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    width: min(560px, 100%);
    max-height: 90vh;
    overflow-y: auto;
}

.ms-modal-kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.ms-modal-titel {
    font-size: 16px;
    font-weight: 600;
}

.ms-modal-close {
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
}

.ms-modal-close:hover {
    color: var(--text-primary);
}

.ms-modal-body {
    padding: 16px 20px 20px;
}

.ms-modal-hinweis {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.ms-form-zeile {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.ms-form-zeile-2 > .ms-feld {
    flex: 1;
}

/* Felder dürfen schrumpfen, damit drei Auswahlfelder nebeneinander nicht über den Rand laufen */
.ms-feld {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ms-feld input, .ms-feld select {
    width: 100%;
    min-width: 0;
    text-overflow: ellipsis;
}

.ms-feld span {
    font-size: 11px;
    color: var(--text-secondary);
}

.ms-feld span em {
    font-style: normal;
    opacity: 0.75;
}

.ms-feld input, .ms-feld select {
    padding: 8px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    min-width: 0;
}

.ms-feld input:focus, .ms-feld select:focus {
    outline: 1.5px solid var(--text-primary);
    outline-offset: -1px;
}

.ms-ergebnis {
    margin-top: 6px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 14px 16px;
    background: var(--bg-card);
}

.ms-ergebnis-kopf {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.ms-ergebnis-wert {
    font-size: 22px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.ms-ergebnis-spanne {
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.ms-formel-details {
    margin-top: 10px;
}

.ms-quellenzeile {
    display: none; /* Reduktion: Quellenhinweis nur noch im „Quellen & Hinweise“-Knopf */
    margin-top: 12px;
    font-size: 10.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.mikrozone-kopf {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.mikrozone-preis {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

/* Zonen-Labels auf der Karte: neutrale Pills (keine Datenfarben),
   Delta als Text. Basis ist die bestehende .poly-label-Optik. */
.zone-label {
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

/* KI-Synthese im Chat: gewöhnliche Bot-Optik, Präfix macht die Herkunft sichtbar */
.chat-message.bot.erklaerung {
    white-space: pre-line;
    /* Formel-Zeilen der Erklär-Antworten zeilenweise */
}

.chat-message.bot.synthese {
    border-style: dashed;
}

/* Legend + Chart: einheitliche Innenabstände wie Cards (K16) */
.legend {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    margin-bottom: 6px;
}

.legend-bar {
    flex: 1;
    height: 8px;
    background: linear-gradient(to right, var(--data-green), var(--data-amber), var(--data-red));
    border-radius: 4px;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
    padding: 0 16px;
    margin-bottom: 16px;
    font-variant-numeric: tabular-nums;
}

/* Chart */
.chart-container {
    height: 220px;
    padding: 16px;
}

/* Score */
.score-ring {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
}

.score-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.score-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.score-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 8px;
    font-style: italic;
}

/* List */
.data-list {
    list-style: none;
}

.data-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
}

.data-list li:last-child {
    border-bottom: none;
}

/* Textarea */
.text-field {
    width: 100%;
    min-height: 80px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    padding: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
}

.text-field:focus {
    outline: none;
    border-color: var(--text-secondary);
}

.field-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Amtlicher Richtwert (GMB 2026) — dezente Info-Karte im bestehenden Karten-Stil */
.richtwert-karte {
    background: var(--bg-card);
    border: 0.5px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 12px 16px;
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-secondary);
}

.richtwert-karte .richtwert-wert {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Bodenrichtwert-Karte (Spec wachstums-features.md §7) */
.brw-karte {
    background: var(--bg-card);
    border: 0.5px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 12px 16px;
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-secondary);
}

.brw-karte .brw-kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.brw-karte .brw-werte {
    margin: 6px 0 4px;
}

.brw-karte .brw-zeile {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 0;
}

.brw-karte .brw-wert {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.richtwert-karte .richtwort-meta {
    display: block;
    margin-top: 4px;
    font-size: 10.5px;
}

/* Baustellen / ÖPNV Badges (Data-Farben nur als Warnhinweise, K21) */
.item-badge, .transport-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    margin-right: 8px;
    white-space: nowrap;
}

.badge-planung, .transport-badge {
    background: var(--text-secondary);
    color: var(--bg-primary);
}

.badge-rohbau {
    background: var(--data-amber);
    color: #0B0B0B;
}

.badge-ausbau {
    background: transparent;
    border: 1px solid var(--data-amber);
    color: var(--data-amber);
}

.badge-fertig {
    background: var(--data-green);
    color: #0B0B0B;
}

/* Linien-Badges in der ÖPNV-Liste (UI-Neutralzone, keine Datenfarben) */
.linien-gruppe {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.linien-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 10px;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.linien-rest {
    color: var(--text-secondary);
}

#oepnv-list li > span:first-child {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

/* Chat */
.chat-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 360px;
    height: 480px;
    background: var(--bg-secondary);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-subtle);
    display: none;
    flex-direction: column;
    z-index: 1500;
    overflow: hidden;
}

.chat-container.open {
    display: flex;
}

.chat-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: var(--bg-primary);
}

.chat-message {
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-btn);
    max-width: 85%;
    font-size: 13px;
    line-height: 1.5;
}

.chat-message.user {
    background: var(--text-primary);
    color: var(--bg-primary);
    margin-left: auto;
}

.chat-message.bot {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.chat-input {
    padding: 12px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 8px;
}

.chat-input input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
}

.chat-input input:focus {
    outline: none;
    border-color: var(--text-secondary);
}

.chat-input button {
    background: var(--text-primary);
    border: none;
    border-radius: var(--radius-btn);
    padding: 0 16px;
    color: var(--bg-primary);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}

/* Kontakt-Button: integriert am Panel-Ende (K17, kein schwebender Button) */
.contact-block {
    margin: 24px 0 8px;
}

.contact-btn {
    width: 100%;
    background: var(--text-primary);
    border: none;
    border-radius: var(--radius-btn);
    padding: 12px 20px;
    color: var(--bg-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    transition: opacity var(--transition-base);
}

.contact-btn:hover {
    opacity: 0.92;
}

/* Kontakt-Panel (öffnet über dem Kartenbereich neben dem Detail-Panel) */
.kontakt-panel {
    position: fixed;
    bottom: 24px;
    right: 444px;
    width: 360px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    display: none;
    flex-direction: column;
    z-index: 1400;
}

.kontakt-panel.open {
    display: flex;
}

.kontakt-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kontakt-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.kontakt-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.kontakt-formular {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kontakt-formular label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.kontakt-formular input, .kontakt-formular textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
}

.kontakt-formular textarea {
    min-height: 80px;
    resize: vertical;
}

.kontakt-formular input:focus, .kontakt-formular textarea:focus {
    outline: none;
    border-color: var(--text-secondary);
}

.kontakt-send {
    background: var(--text-primary);
    border: none;
    border-radius: var(--radius-btn);
    padding: 10px 16px;
    color: var(--bg-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    align-self: flex-start;
}

.kontakt-bestaetigung {
    padding: 16px;
    display: none;
}

.kontakt-panel.bestaetigt .kontakt-formular, .kontakt-panel.bestaetigt .kontakt-send {
    display: none;
}

.kontakt-panel.bestaetigt .kontakt-bestaetigung {
    display: block;
}

.kontakt-bestaetigung h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.kontakt-bestaetigung p {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    margin-top: 4px;
}

.kontakt-bestaetigung .haken {
    color: var(--data-green);
    font-weight: 700;
}

@media (max-width: 900px) {
    .kontakt-panel {
        left: 24px;
        right: 24px;
        width: auto;
    }

}

/* Score-Karten nebeneinander (Kauf + Vermieten) */
.score-cards {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.score-cards .card {
    flex: 1;
    margin-bottom: 0;
    padding: 16px;
}

/* Karten-Marker: Baustellen (Kreis) und ÖPNV (S=eckig, T=rund, B=Rechteck).
   Formen bleiben als funktionale Unterscheidung; Farben neutral/Data (K21). */
.nexis-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--border-subtle);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.marker-baustelle {
    border-radius: 50%;
    background: var(--data-amber);
    color: #0B0B0B;
}

.marker-sbahn {
    background: var(--text-secondary);
    color: var(--bg-primary);
    border-radius: 2px;
}

.marker-tram {
    background: var(--text-secondary);
    color: var(--bg-primary);
    border-radius: 50%;
}

.marker-bus {
    background: var(--text-secondary);
    color: var(--bg-primary);
    border-radius: 3px;
}

/* Form-Merkmal: Rechteck */
/* Landmarken: Diamant (clip-path), invertiert-neutral – klar unterscheidbar
   von ÖPNV-/Baustellen-Markern, bei allen Zoomstufen sichtbar (DOM) */
.marker-landmark {
    width: 24px;
    height: 24px;
    background: var(--text-primary);
    color: var(--bg-primary);
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
    cursor: pointer;
}

/* Polygon-Labels: permanente Pills mit dem Stadtteilnamen (K12).
   Dunkler, halbtransparenter Grund + weiße Schrift = lesbar auf jeder
   Füllfarbe und auf Graustufen-Kacheln, in beiden Modi identisch. */
.poly-label {
    background: rgba(11, 11, 11, 0.72);
    color: #FFFFFF;
    padding: 2px 7px;
    border: none;
    border-radius: 4px;
    font-family: var(--font-ui);
    font-size: 10.5px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: none;
}

/* Label-Klicks blockieren nie (Label-Layer hat pointer-events: none) */
/* MapLibre overrides (Spec: maplibre-3d.md) */
/* Graustufen-Basemap läuft über die raster-Paint-Properties der
   'osm-basemap'-Layer in main.js (saturation -1, Kontrast/Helligkeit je
   Modus) – NICHT über CSS-Filter, damit die Polygon-Farben unangetastet
   bleiben. Karte beginnt unter dem fixierten Header (Layout-Offset). */
/* Zoom-/Kompass-Kontrolle: B2B-Tokens, liegt über den DOM-Overlays */
.maplibregl-ctrl-top-left, .maplibregl-ctrl-top-right, .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right {
    z-index: 3;
}

.maplibregl-ctrl-group {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-subtle) !important;
}

.maplibregl-ctrl-group button {
    background: var(--bg-secondary) !important;
    border-color: var(--border-subtle) !important;
}

.maplibregl-ctrl-group button:hover {
    background: var(--row-hover) !important;
}

html[data-theme="dark"] .maplibregl-ctrl button .maplibregl-ctrl-icon {
    filter: invert(1);
    /* dunkle Icons auf dunklem Grund lesbar machen */
}

.maplibregl-ctrl-attrib {
    display: none !important; /* Reduktion: Attribution nur im „Quellen & Hinweise“-Knopf (Nachrichten-Sektion) */
    background: var(--attribution-bg) !important;
    color: var(--text-secondary) !important;
    font-size: 10px !important;
}

.maplibregl-ctrl-attrib a {
    color: var(--text-secondary) !important;
}

/* DOM-Overlays über dem WebGL-Canvas (Name-Pills, Fahrzeug-Canvas) */
.label-layer, .vehicle-layer {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.label-layer .poly-label {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
}

/* Hinweis-Badge: Fahrzeug-Punkte rein visuell – kein Echtzeit-Verkehr */
.verkehr-hinweis {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 4;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    padding: 4px 10px;
    color: var(--text-secondary);
    pointer-events: none;
    max-width: 300px;
}

/* Stand label */
.stand-label {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stand-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--data-amber);
}

.stand-dot.live {
    background: var(--data-green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* prefers-reduced-motion: Animationen aus (K19/K22) */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

}

/* Scrollbar: neutral (K23) */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive */
@media (max-width: 900px) {
    .detail-panel {
        width: 100%;
        position: absolute;
        right: 0;
        transform: translateX(100%);
    }

    .detail-panel.open {
        transform: translateX(0);
    }

}

/* ============================================================
   Panel-Rhythmus (rechte Leiste): ein Abstands-Raster statt
   Einzelwerte (4/8/12/16/24/32), klare Abschnitte, Mindest-
   Schriftgröße 12px für Hinweise. Nur neutrale Tokens (K3/K22).
   ============================================================ */
.detail-panel {
    --s1: 4px;
    --s2: 8px;
    --s3: 12px;
    --s4: 16px;
    --s5: 24px;
    --s6: 32px;
    scroll-behavior: smooth;
}

.panel-header {
    padding: var(--s5) var(--s5) 0;
}

.panel-header h2 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.panel-subtitle {
    margin-bottom: var(--s4);
}

.panel-header .toggle-group {
    margin-bottom: var(--s3);
}

/* Abschnitts-Navigation */
.panel-nav {
    display: flex;
    gap: var(--s1);
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 calc(-1 * var(--s5));
    padding: 0 var(--s5);
}

.panel-nav::-webkit-scrollbar {
    display: none;
}

.panel-nav a {
    flex: 1 0 auto;
    text-align: center;
    padding: var(--s2) var(--s2) 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color var(--transition-base), border-color var(--transition-base);
}

.panel-nav a:hover {
    color: var(--text-primary);
}

.panel-nav a.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

/* Abschnitte: Kinder stapeln mit festem Abstand, keine Einzel-Margins mehr */
.detail-panel .section {
    display: flex;
    flex-direction: column;
    margin: 0;
    scroll-margin-top: 196px;
    /* Höhe des Sticky-Headers */
}

.detail-panel .section > * {
    margin-top: 0;
    margin-bottom: 0;
}

/* Abschnitts-Titel: ruhig, versal, ohne Trennlinie */
.detail-panel .section > .section-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-primary);
    padding: 0;
    border: none;
    margin: 0 0 var(--s1);
}

/* Titel innerhalb einer Karte: klein, aber als Überschrift lesbar */
.detail-panel .card > .section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0;
    border: none;
}

.detail-panel .card {
    margin-bottom: 0;
}

/* Preis-Karte: Legende, Chart, Segment-Filter und Prognose in EINER Karte */
.preis-karte .legend {
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    margin: 0;
}

.legend-end {
    font-size: 12px;
    color: var(--text-secondary);
}

.preis-karte .legend-labels {
    padding: 0;
    font-size: 12px;
}

/* Liniendiagramm mit Legende darunter: etwas höher, damit die Linien Platz haben */
.preis-karte .chart-container {
    height: 280px;
    padding: 0;
}

/* Amtlicher Richtwert: oben, deutlich, gut lesbar */
.detail-panel .richtwert-karte {
    margin: 0;
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--text-primary);
    border-radius: var(--radius-card);
    font-size: 13px;
}

.detail-panel .richtwert-karte .richtwert-wert {
    font-size: 16px;
    font-weight: 600;
}

.detail-panel .richtwert-karte .richtwort-meta {
    margin-top: var(--s2);
    font-size: 12px;
    line-height: 1.5;
}

/* Energie-Filter: Label über Feld, zwei gleich breite Spalten */
.energie-karte .energie-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s3);
    margin: 0;
}

.energie-karte .feld {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.energie-karte .feld label {
    font-size: 12px;
}

.energie-karte select {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
}

.energie-karte #energie-hinweis {
    margin-top: var(--s3);
    font-size: 12px;
    line-height: 1.5;
}

/* Scores: gleich hohe Karten */
.detail-panel .score-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s3);
}

.detail-panel .score-cards .card {
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-panel .score-value {
    font-size: 28px;
    line-height: 1.1;
}

.detail-panel .score-label {
    font-size: 13px;
    color: var(--text-primary);
    margin-top: 6px;
}

.detail-panel .score-hint {
    font-size: 12px;
    font-style: normal;
    line-height: 1.4;
}

/* Aktionen: Rechner als Primär-Aktion, Analyse sekundär */
.aktionen {
    display: flex;
    flex-direction: column;
    gap: var(--s2);
}

.detail-panel .btn-mikrozonen {
    margin: 0;
    padding: 11px 16px;
    border-radius: var(--radius-btn);
    font-size: 13px;
}

.detail-panel .btn-mikrozonen:hover:not(.active) {
    border-color: var(--text-secondary);
}

.detail-panel .btn-primaer {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
    font-weight: 600;
}

.detail-panel .btn-primaer:hover:not(.active) {
    opacity: 0.9;
    border-color: var(--text-primary);
}

.aktion-hinweis {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);
    margin: 0 2px var(--s2);
}

#mikrozonen-container:empty {
    display: none;
}

/* Listen & Kennzahlen: etwas mehr Luft, ruhige Zahlen */
.detail-panel .metric-row, .detail-panel .data-list li {
    gap: var(--s3);
    font-size: 13px;
}

.detail-panel .metric-label {
    font-size: 13px;
}

.detail-panel .metric-value {
    font-size: 14px;
    text-align: right;
}

#markttrends-list li > span:first-child, #wanderung-list li > span:first-child, #baualter-list li > span:first-child, #energietraeger-list li > span:first-child, #heizungsart-list li > span:first-child {
    color: var(--text-secondary);
}

#markttrends-list li > span:last-child, #wanderung-list li > span:last-child, #baualter-list li > span:last-child, #energietraeger-list li > span:last-child, #heizungsart-list li > span:last-child {
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.detail-panel .metric-row:first-child, .detail-panel .data-list li:first-child {
    padding-top: 0;
}

.detail-panel .metric-row:last-child, .detail-panel .data-list li:last-child {
    padding-bottom: 0;
}

/* Hinweise & Stände: nie kleiner als 12px */
.detail-panel .field-hint {
    font-size: 12px;
    line-height: 1.5;
    margin-top: var(--s2);
}

.detail-panel .section > .field-hint {
    margin-top: 0;
}

.detail-panel .stand-label {
    font-size: 12px;
    line-height: 1.45;
    padding: 0;
    align-items: flex-start;
}

.detail-panel .stand-label .stand-dot {
    margin-top: 5px;
    flex: 0 0 auto;
}

.detail-panel .card > .stand-label {
    margin-top: var(--s3);
}

.detail-panel .text-field {
    font-size: 13px;
    min-height: 96px;
}

.detail-panel .marker-filter-group {
    margin: 0;
}

/* Kontakt-Abschluss */
.detail-panel .contact-block {
    margin: var(--s6) 0 0;
    padding: var(--s5) var(--s4) var(--s4);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    background: var(--bg-card);
    text-align: center;
}

.contact-titel {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.contact-text {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: var(--s4);
}

@media (max-width: 900px) {
    .panel-header {
        padding: var(--s4) var(--s4) 0;
    }

    .panel-nav {
        margin: 0 calc(-1 * var(--s4));
        padding: 0 var(--s4);
    }

    .panel-content {
        padding: var(--s4) var(--s4) var(--s6);
    }

}

/* ===== Ortsteil-Report (Druck/PDF) ===== */
#druck-report {
    display: none;
}

@media print {
    @page  { size: A4; margin: 14mm 14mm 16mm; }

    html, body {
        height: auto !important;
        overflow: visible !important;
        background: #fff !important;
        color: #111 !important;
    }

    body > *:not(#druck-report) {
        display: none !important;
    }

    #druck-report {
        display: block !important;
        font: 10.5pt/1.45 var(--font-ui);
        color: #111;
    }

    #druck-report .rp-kopf {
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        border-bottom: 2px solid #111;
        padding-bottom: 6pt;
        margin-bottom: 12pt;
    }

    #druck-report .rp-marke {
        font-weight: 800;
        letter-spacing: 0.08em;
        font-size: 14pt;
    }

    #druck-report .rp-art, #druck-report .rp-datum {
        font-size: 9pt;
        color: #555;
    }

    #druck-report h1 {
        font-size: 22pt;
        margin: 0 0 2pt;
    }

    #druck-report .rp-unter {
        color: #555;
        margin-bottom: 12pt;
    }

    #druck-report section {
        margin-bottom: 12pt;
        break-inside: avoid;
    }

    #druck-report h2 {
        font-size: 9pt;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: #555;
        margin: 0 0 5pt;
        font-weight: 700;
    }

    #druck-report .rp-zwei {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 14pt;
    }

    #druck-report .rp-zwei > div > h2 + table {
        margin-bottom: 8pt;
    }

    #druck-report .rp-box {
        border: 1px solid #ccc;
        border-radius: 6pt;
        padding: 8pt 10pt;
    }

    #druck-report .rp-amtlich {
        border-left: 3pt solid #111;
    }

    #druck-report .rp-chart {
        width: 100%;
        max-height: 62mm;
        object-fit: contain;
        border-radius: 6pt;
        margin-bottom: 4pt;
    }

    #druck-report .rp-score {
        font-size: 24pt;
        font-weight: 700;
        line-height: 1.1;
    }

    #druck-report .rp-score-l {
        font-weight: 600;
    }

    #druck-report .rp-klein {
        font-size: 8.5pt;
        color: #555;
        margin-top: 3pt;
    }

    #druck-report table {
        width: 100%;
        border-collapse: collapse;
        font-size: 9.5pt;
    }

    #druck-report td {
        padding: 3pt 0;
        border-bottom: 0.5pt solid #ddd;
        vertical-align: top;
    }

    #druck-report td.r {
        text-align: right;
        font-weight: 600;
        padding-left: 8pt;
    }

    #druck-report .rp-quellen ul {
        margin: 0 0 6pt 12pt;
        font-size: 8.5pt;
        color: #444;
    }

    #druck-report .rp-quellen p {
        font-size: 8.5pt;
        color: #444;
    }

}

/* Karten-Labels (DOM-Overlay) außerhalb des Kartenausschnitts dürfen die Seite nicht
   verbreitern – auf Mobilgeräten schob das den Header-Inhalt aus dem Bild (body 37.000px breit). */
.main-layout, .map-container {
    overflow: hidden;
}

/* Mobil: Header-Aktionen bleiben erreichbar (vorher liefen sie rechts aus dem Bild) */
@media (max-width: 600px) {
    .app-header {
        padding-left: 16px;
        padding-right: 12px;
    }

    .app-header .header-stats, .live-ticker, .nur-breit {
        display: none;
    }

    .header-info {
        gap: 6px;
    }

    .theme-toggle-btn, .chat-toggle-btn {
        padding: 6px 9px;
    }

}

/* Bodenrichtwert-Karte im Panel-Raster (Freebuff-Feature an Panel-Rhythmus angeglichen) */
.detail-panel .brw-karte {
    font-size: 13px;
}

.detail-panel .brw-karte .brw-kopf .section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0;
    margin: 0;
    border: none;
}

.detail-panel .brw-karte .brw-kopf .toggle-btn {
    flex: 0 0 auto;
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid var(--border-subtle);
}

.detail-panel .brw-karte .brw-werte {
    margin: 12px 0 4px;
}

.detail-panel .brw-karte .brw-zeile {
    padding: 6px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px;
}

.detail-panel .brw-karte .brw-zeile:last-child {
    border-bottom: none;
}

.detail-panel .brw-karte .richtwort-meta {
    display: block;
    font-size: 12px;
    line-height: 1.5;
    margin-top: 8px;
    color: var(--text-secondary);
}

.preis-karte .chart-quelle {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);
}

/* Mobil: Karte und Detail-Leiste abwechselnd (Leiste verdeckte die Karte dauerhaft) */
.panel-schliessen, .panel-oeffnen {
    display: none;
}

@media (max-width: 900px) {
    .panel-schliessen {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        position: absolute;
        top: 16px;
        right: 16px;
        padding: 8px 12px;
        border-radius: var(--radius-btn);
        border: 1px solid var(--border-subtle);
        background: var(--bg-card);
        color: var(--text-primary);
        font: 500 13px var(--font-ui);
        cursor: pointer;
    }

    .panel-schliessen::before {
        content: "←";
    }

    .panel-header h2 {
        padding-right: 88px;
    }

    .panel-oeffnen {
        display: block;
        position: absolute;
        left: 50%;
        bottom: 24px;
        transform: translateX(-50%);
        z-index: 1050;
        max-width: calc(100% - 32px);
        padding: 12px 20px;
        border-radius: 999px;
        border: none;
        background: var(--text-primary);
        color: var(--bg-primary);
        font: 600 14px var(--font-ui);
        box-shadow: 0 6px 20px rgba(0,0,0,.35);
        cursor: pointer;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Geschlossene Leiste (translateX 100 %) darf die Seite nicht verbreitern:
       main-layout wird Bezugsrahmen, overflow:hidden schneidet sie dann ab. */
    .main-layout {
        position: relative;
    }

    .detail-panel {
        top: 0;
        height: 100%;
    }

}

/* Entrümpelung: lange Quellen-/Hinweistexte auf 1–2 Zeilen gekürzt, Klick zeigt alles.
   Nichts wird entfernt – nur eingeklappt (Kennzeichnungen bleiben sichtbar angerissen). */
.detail-panel .stand-label > span:last-child, .detail-panel .richtwort-meta, .detail-panel #energie-hinweis, .detail-panel .field-hint, .detail-panel .aktion-hinweis {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    cursor: pointer;
}

.detail-panel .stand-label > span:last-child {
    -webkit-line-clamp: 1;
}

.detail-panel .stand-label > span:last-child.offen, .detail-panel .richtwort-meta.offen, .detail-panel #energie-hinweis.offen, .detail-panel .field-hint.offen, .detail-panel .aktion-hinweis.offen {
    -webkit-line-clamp: unset;
    display: block;
}

.verkehr-hinweis {
    font-size: 11px;
    opacity: .8;
}

.detail-panel .richtwert-karte .richtwert-hinweis {
    display: block;
    font-size: 12px;
    color: var(--text-primary);
}

/* Kennzahlen & Energiekosten als Kacheln (2 Spalten) statt langer Zeilenlisten */
#sec-kennzahlen > .section-title + .card {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

#sec-kennzahlen > .section-title + .card .metric-row {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    background: var(--bg-input);
}

#sec-kennzahlen > .section-title + .card .metric-row:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

#sec-kennzahlen > .section-title + .card .metric-label {
    font-size: 12px;
}

#sec-kennzahlen > .section-title + .card .metric-value {
    font-size: 16px;
    text-align: left;
}

/* Anteilslisten (Baualter, Heizung): Anteil zusätzlich als schmaler Balken */
#baualter-list li, #energietraeger-list li, #heizungsart-list li {
    position: relative;
    padding-bottom: 14px;
}

#baualter-list li::after, #energietraeger-list li::after, #heizungsart-list li::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 5px;
    height: 4px;
    width: calc(var(--anteil, 0) * 1%);
    border-radius: 2px;
    background: var(--text-secondary);
    opacity: .55;
}

/* Farblegende der Karte: was die Ortsteil-Farben bedeuten */
.karten-legende {
    position: absolute;
    left: 12px;
    bottom: 44px;
    z-index: 4;
    background: var(--bg-card);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    padding: 8px 10px;
    font-size: 11px;
    color: var(--text-secondary);
    pointer-events: auto;
    min-width: 200px;
    max-width: 260px;
}

.karten-legende-skala {
    display: flex;
    align-items: center;
    gap: 8px;
}

.karten-legende-balken {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--data-green), var(--data-amber), var(--data-red));
}

@media (max-width: 900px) {
    .karten-legende {
        bottom: 92px;
    }

}

/* ===== Leiste v3: echte Reiter, mehr Luft, Hinweise nur auf der Info-Seite ===== */
.detail-panel .section[hidden] {
    display: none !important;
}

.detail-panel .section + .section {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.detail-panel .section {
    gap: 16px;
}

.panel-content {
    padding: 24px 24px 32px;
}

.detail-panel .card {
    padding: 20px;
}

.detail-panel .card > .section-title {
    margin-bottom: 16px;
}

.detail-panel .richtwert-karte {
    padding: 20px 20px 20px 22px;
    line-height: 1.6;
}

.detail-panel .richtwert-karte .richtwert-hinweis {
    margin-top: 12px;
}

.detail-panel .metric-row, .detail-panel .data-list li {
    padding: 12px 0;
}

.detail-panel .score-cards .card {
    padding: 24px 16px;
}

.detail-panel .aktionen {
    gap: 12px;
}

.preis-karte .legend-labels {
    margin: 8px 0 16px;
}

#sec-kennzahlen > .section-title + .card {
    gap: 12px;
    padding: 16px;
}

#sec-kennzahlen > .section-title + .card .metric-row {
    padding: 14px 16px;
    gap: 6px;
}

.detail-panel .brw-karte .brw-werte {
    margin-top: 16px;
}

.detail-panel .marker-filter-group {
    gap: 12px;
}

/* Erläuterungen, Quellen und Hinweise nur auf der Info-Seite (Inhalte bleiben im DOM) */
.detail-panel .section:not(#sec-info) .stand-label, .detail-panel .section:not(#sec-info) .field-hint, .detail-panel #energie-hinweis, .detail-panel .chart-quelle, .detail-panel .aktion-hinweis, .detail-panel .score-hint, .detail-panel .richtwert-karte > .richtwort-meta, .detail-panel #brw-quelle {
    display: none !important;
}

/* (ehemaliger „Hinweise & Quellen“-Rumpf samt .info-zurueck/.info-gruppe entfernt —
   Nachfolger: .info-mini + .info-liste-einfach ganz unten in #sec-nachrichten) */

.detail-panel .contact-block {
    margin-top: 32px;
}

/* Hinweis bei fehlenden amtlichen Daten (z. B. Energiekosten je Ortsteil) */
.detail-panel .leer-hinweis {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* ===== Nachrichten-Sektor: LIVE-Schlagzeilen rund um Leipzig (nur echt abgerufene
   Inhalte aus Tagesschau-API, L-IZ, MDR; ohne Netz klare Fehlermeldung). ===== */
.nachrichten-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 14px;
}

.nachrichten-kopf .stand-label {
  display: flex;
}

/* Budget-Filter-Chips (Alle / bis 500.000 € / bis 1 Mio. €) — neutraler B2B-Stil */
.nachrichten-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.filter-chip {
  padding: 5px 12px;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-chip:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.filter-chip.active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--bg-primary);
}

/* Zwei Sektionen: Wohnen / Gewerbe & Handel */
.nachricht-gruppe {
  margin-bottom: 18px;
}

.nachricht-gruppen-titel {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.nachricht-gruppen-zaehler {
  color: var(--text-secondary);
  font-weight: 400;
}

/* Erkannter Objektpreis — Textauszug, mit ≈ als Schätzung gekennzeichnet (kein amtlicher Wert) */
.nachricht-preis {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-primary);
  padding: 1px 7px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
}

#nachrichten-aktualisieren {
  flex: 0 0 auto;
  padding: 6px 12px;
  font-size: 12px;
}

#nachrichten-aktualisieren:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* „Quellen & Hinweise“ — kleiner, dezenter Knopf ganz unten in der Nachrichten-Sektion */
.info-mini {
  display: block;
  margin: 18px 0 0;
  padding: 4px 10px;
  background: none;
  border: 1px dashed var(--border-subtle);
  border-radius: 6px;
  color: var(--text-secondary);
  font: 500 11px var(--font-ui);
  cursor: pointer;
}

.info-mini:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

/* Der Listen-Inhalt: bewusst schlicht — keine Überschriften, keine Karten, keine Links */
.info-liste-einfach {
  margin: 8px 0 0;
  padding: 0 0 0 16px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.info-liste-einfach li {
  margin: 0 0 4px;
}

/* Kopf-Aktionen: „Auf Karte“ + „Aktualisieren“ nebeneinander */
.nachrichten-kopf-aktionen {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

#nachrichten-karte {
  padding: 6px 12px;
  font-size: 12px;
}

/* Nachrichten-Marker: runde blaue Pille mit Nummer (→ Kopfzeilen-Pille .nachricht-ortsteil) */
.marker-nachricht {
  background: var(--data-seq-1);
  color: #0B0B0B;
  border-radius: 999px;
  width: 24px;
  height: 24px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

/* Ortsteil-Pille in der Meldungs-Kopfzeile; Nummer korrespondiert mit dem Karten-Marker */
.nachricht-ortsteil {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--data-seq-1);
  padding: 1px 7px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
}

.nachricht-liste {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nachricht {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.nachricht:last-child {
  border-bottom: none;
}

.nachricht-kopf {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 3px;
}

.nachricht-quelle {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--data-amber);
}

.nachricht-zeit {
  font-size: 11px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.nachricht-titel {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  text-decoration: none;
}

.nachricht-titel:hover {
  text-decoration: underline;
}

.nachricht-text {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.nachricht-fehler {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.nachricht-mehr-zeile {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.nachricht-mehr-titel {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.nachricht-mehr {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.nachricht-mehr a {
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
}

.nachricht-mehr a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* ===== Herleitungen („Formel anzeigen", „Herleitung anzeigen", Segmente, Plausibilität,
   Mietspiegel-Rechner): einheitlich aus src/ui/rechenweg.js. Oben die Rechnung als Tabelle
   (Bezeichnung + Erläuterung links, Wert rechts), darunter Absätze und die Quelle. ===== */
.herleitung {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.herleitung > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  user-select: none;
}

.herleitung > summary::-webkit-details-marker {
  display: none;
}

.herleitung > summary::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.herleitung[open] > summary::before {
  transform: rotate(45deg);
}

.herleitung-inhalt {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.rechenweg {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.rw-zeile {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 12px;
}

.rw-zeile + .rw-zeile {
  border-top: 1px solid var(--border-subtle);
}

.rw-label {
  min-width: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-primary);
}

.rw-detail {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.rw-wert {
  flex: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.rw-basis {
  background: var(--row-hover);
}

.rw-summe .rw-label {
  font-weight: 600;
}

.rw-ergebnis {
  background: var(--row-hover);
}

.rw-ergebnis .rw-label, .rw-ergebnis .rw-wert {
  font-weight: 700;
}

.rw-ergebnis .rw-wert {
  font-size: 14px;
}

.rw-untertitel {
  margin-bottom: -4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.rw-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.rw-text strong {
  font-weight: 600;
  color: var(--text-primary);
}

.rw-quelle {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Preiskarte oben: Art-Zeile, Kopfwert, Kennzahlen-Tabelle */
.richtwert-karte .richtwert-art {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
}

.richtwert-karte .richtwert-wert {
  display: block;
  margin-top: 2px;
}

.richtwert-karte > .rechenweg {
  margin-top: 12px;
}

.ms-formel-details summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  user-select: none;
}

.ms-formel-inhalt {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

/* ---------------------------------------------------------------------------
   Start-Intro (src/ui/intro.js): Fenster öffnet sich, rechts läuft das Lade-Protokoll,
   danach breitet sich die Karte kreisförmig aus; Header und Panel gleiten hinein.
   --------------------------------------------------------------------------- */
.intro {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background:
        radial-gradient(ellipse at center, transparent 0%, var(--bg-primary) 70%),
        linear-gradient(var(--border-subtle) 1px, transparent 1px) 0 0 / 40px 40px,
        linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px) 0 0 / 40px 40px,
        var(--bg-primary);
    transition: opacity 0.9s ease, visibility 0s linear 0.9s;
}
.intro.intro-ende {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.intro-fenster {
    display: flex;
    flex-direction: column;
    max-width: calc(100vw - 32px);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    animation: intro-auf 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1), filter 0.9s ease;
}
.intro-ende .intro-fenster {
    transform: scale(1.08);
    filter: blur(8px);
}
[data-theme="light"] .intro-fenster { box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12); }
@keyframes intro-auf {
    from { opacity: 0; transform: scale(0.9) translateY(12px); }
    to { opacity: 1; transform: none; }
}
.intro-titelleiste {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 34px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border-subtle);
}
.intro-punkte { display: flex; gap: 6px; }
.intro-punkte i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-subtle);
}
.intro-punkte i:nth-child(1) { background: var(--data-red); }
.intro-punkte i:nth-child(2) { background: var(--data-amber); }
.intro-punkte i:nth-child(3) { background: var(--data-green); }
.intro-titel {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--text-secondary);
}
.intro-inhalt { display: flex; }
.intro-links {
    width: 330px;
    flex: none;
    padding: 36px 32px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.intro-logo {
    font-size: 44px;
    font-weight: 800;
    letter-spacing: 8px;
    color: var(--text-primary);
    animation: intro-logo 0.9s ease 0.15s both;
}
@keyframes intro-logo {
    from { opacity: 0; letter-spacing: 22px; }
    to { opacity: 1; letter-spacing: 8px; }
}
.intro-unter {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}
.intro-fortschritt {
    margin-top: 28px;
    height: 3px;
    background: var(--border-subtle);
    border-radius: 2px;
    overflow: hidden;
}
.intro-balken {
    height: 100%;
    background: var(--text-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.12s linear;
}
.intro-statuszeile {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
/* Rechte Seite: öffnet sich neben dem Logo */
.intro-log-rahmen {
    width: 0;
    overflow: hidden;
    border-left: 1px solid var(--border-subtle);
    animation: intro-log-auf 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 0.45s forwards;
}
@keyframes intro-log-auf { to { width: 460px; } }
.intro-log {
    width: 460px;
    height: 280px;
    padding: 14px 16px;
    overflow: hidden;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 11.5px;
    line-height: 1.65;
    color: var(--text-primary);
    background: var(--bg-primary);
    white-space: pre;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 30%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 30%);
}
.intro-zeile { animation: intro-zeile 0.18s ease both; overflow: hidden; text-overflow: ellipsis; }
.intro-zeile.leise { color: var(--text-secondary); }
.intro-zeile .t { color: var(--text-secondary); }
.intro-zeile .k { color: var(--data-amber); }
.intro-zeile .p { color: var(--text-secondary); opacity: 0.7; }
.intro-zeile .ok { color: var(--data-green); }
@keyframes intro-zeile {
    from { opacity: 0; transform: translateX(-6px); }
    to { opacity: 1; transform: none; }
}
.intro-skip {
    position: absolute;
    right: 20px;
    bottom: 20px;
    padding: 8px 14px;
    font: inherit;
    font-size: 12px;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    cursor: pointer;
}
.intro-skip:hover { color: var(--text-primary); }

/* Während des Intros: Karte als Punkt, Oberfläche ausgeblendet */
body.intro-laeuft .map-container { clip-path: circle(0% at 50% 50%); }
body.intro-laeuft .app-header { translate: 0 -100%; opacity: 0; }
body.intro-laeuft .detail-panel { translate: 48px 0; opacity: 0; }
body.intro-laeuft .poly-label,
body.intro-laeuft .karten-legende,
body.intro-laeuft .maplibregl-ctrl,
body.intro-laeuft .panel-oeffnen,
body.intro-laeuft .verkehr-hinweis { opacity: 0; }

/* Aufbau: Karte breitet sich aus, danach gleiten Header und Panel hinein */
body.intro-aufbau .map-container { clip-path: circle(150% at 50% 50%); transition: clip-path 1.6s cubic-bezier(0.5, 0, 0.2, 1); }
body.intro-aufbau .app-header { transition: translate 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 0.8s, opacity 0.7s ease 0.8s; }
body.intro-aufbau .detail-panel { transition: translate 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 2.6s, opacity 0.7s ease 2.6s, transform var(--transition-base); }
body.intro-aufbau .poly-label,
body.intro-aufbau .karten-legende,
body.intro-aufbau .maplibregl-ctrl,
body.intro-aufbau .panel-oeffnen,
body.intro-aufbau .verkehr-hinweis { transition: opacity 0.8s ease 1.6s; }

@media (max-width: 900px) {
    .intro-inhalt { flex-direction: column; }
    .intro-links { width: auto; padding: 28px 24px 24px; }
    .intro-logo { font-size: 36px; }
    .intro-log-rahmen { width: auto; height: 0; border-left: 0; border-top: 1px solid var(--border-subtle); animation-name: intro-log-auf-mobil; }
    @keyframes intro-log-auf-mobil { to { height: 200px; } }
    .intro-log { width: 100%; height: 200px; font-size: 10.5px; }
    .intro-zeile .t, .intro-zeile .d { display: none; }
    .intro-zeile .ok::before { content: ' · '; color: var(--text-secondary); }
}
@media (prefers-reduced-motion: reduce) {
    .intro-fenster, .intro-logo, .intro-zeile { animation: none; }
    .intro-log-rahmen { animation-duration: 0.01s; animation-delay: 0s; }
    body.intro-aufbau .map-container, body.intro-aufbau .app-header, body.intro-aufbau .detail-panel { transition: none; }
}

/* ---- Preis-Diagramm: Zoom-Knöpfe und eigene Legende ---- */
.preis-karte .chart-container { position: relative; }
.chart-werkzeuge {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    display: flex;
    gap: 4px;
}
.chart-werkzeuge button {
    min-width: 26px;
    height: 24px;
    padding: 0 7px;
    font: inherit;
    font-size: 13px;
    line-height: 1;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    cursor: pointer;
}
.chart-werkzeuge button:hover { color: var(--text-primary); }
.chart-werkzeuge .chart-alles { display: none; font-size: 11px; }
.chart-werkzeuge.gezoomt .chart-alles { display: inline-block; }
.preis-karte canvas { touch-action: pan-y; }
.chart-werkzeuge.gezoomt + canvas { cursor: grab; }
.chart-werkzeuge.gezoomt + canvas:active { cursor: grabbing; }
.chart-legende {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 12px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}
.chart-legende[hidden] { display: none; }
.chart-legende-eintrag {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 4px 0;
    font: inherit;
    font-size: 11.5px;
    line-height: 1.3;
    text-align: left;
    color: var(--text-secondary);
    background: none;
    border: 0;
    cursor: pointer;
}
.chart-legende-eintrag svg { flex: none; }
.chart-legende-eintrag span { min-width: 0; overflow-wrap: anywhere; }
.chart-legende-eintrag svg { align-self: flex-start; margin-top: 1px; }
.chart-legende-eintrag:hover span { color: var(--text-primary); }
.chart-legende-eintrag[aria-pressed="false"] { opacity: 0.4; }
.chart-legende-eintrag[aria-pressed="false"] span { text-decoration: line-through; }

/* ---- Kartenebene: Auswahl in der Legende, Werte-Zeile, Tooltip ---- */
.karten-ebene-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.karten-ebene {
    width: 100%;
    margin-bottom: 8px;
    padding: 5px 8px;
    font: inherit;
    font-size: 12px;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    cursor: pointer;
}
.karten-tooltip {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 6;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 260px;
    padding: 7px 10px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}
.karten-tooltip[hidden] { display: none; }
.karten-tooltip strong { color: var(--text-primary); font-size: 12.5px; }
@media (max-width: 900px) {
    .karten-legende { max-width: 220px; min-width: 0; }
}

/* ---- Exposé-Generator (src/expose.js) ---- */
body.expose-offen { overflow: hidden; }
.expose-dialog {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
}
.expose-dialog[hidden] { display: none; }
.expose-fenster {
    display: flex;
    flex-direction: column;
    width: min(1400px, 100%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}
.expose-kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
}
.expose-kopf strong { display: block; font-size: 16px; color: var(--text-primary); }
.expose-kopf span { font-size: 12px; color: var(--text-secondary); }
.expose-aktionen { display: flex; align-items: center; gap: 8px; flex: none; }
.expose-knopf {
    padding: 8px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--bg-primary);
    background: var(--text-primary);
    border: 1px solid var(--text-primary);
    border-radius: var(--radius-btn);
    cursor: pointer;
}
.expose-knopf.leise { color: var(--text-primary); background: transparent; border-color: var(--border-subtle); font-weight: 500; }
.expose-schliessen {
    width: 34px;
    height: 34px;
    font-size: 20px;
    line-height: 1;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    cursor: pointer;
}
.expose-koerper { display: grid; grid-template-columns: minmax(340px, 440px) 1fr; min-height: 0; flex: 1; }
.expose-form { overflow-y: auto; padding: 16px 20px 40px; border-right: 1px solid var(--border-subtle); }
.expose-form fieldset { border: 0; margin: 0 0 18px; padding: 0; }
.expose-form legend { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 10px; }
.expose-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; min-width: 0; }
.expose-form label[hidden] { display: none; }
.expose-form input:not([type="checkbox"]):not([type="file"]), .expose-form select, .expose-form textarea {
    width: 100%;
    padding: 7px 9px;
    font: inherit;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
}
.expose-form textarea { resize: vertical; line-height: 1.45; }
.expose-reihe { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.expose-reihe.drei { grid-template-columns: 1fr 1fr 1fr; }
.expose-form .expose-check { flex-direction: row; align-items: center; gap: 8px; color: var(--text-primary); }
.expose-drop {
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 22px 14px;
    border: 1.5px dashed var(--border-subtle);
    border-radius: 8px;
    cursor: pointer;
    background: var(--bg-card);
}
.expose-drop b { color: var(--text-primary); }
.expose-drop small { font-size: 11px; line-height: 1.4; }
.expose-drop.ueber { border-color: var(--text-primary); }
.expose-bilder { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.expose-bild { position: relative; display: flex; flex-direction: column; gap: 4px; }
.expose-bild img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; border: 1px solid var(--border-subtle); }
.expose-bild.titelbild img { outline: 2px solid var(--text-primary); outline-offset: 1px; }
.expose-bild input { padding: 4px 6px !important; font-size: 11px !important; }
.expose-marke { position: absolute; left: 4px; top: 4px; font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; color: var(--bg-primary); background: var(--text-primary); }
.expose-bild-knoepfe { position: absolute; right: 4px; top: 4px; display: flex; gap: 3px; }
.expose-bild-knoepfe button { width: 22px; height: 22px; font-size: 12px; line-height: 1; color: #fff; background: rgba(0, 0, 0, 0.6); border: 0; border-radius: 4px; cursor: pointer; }
.expose-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.expose-chips label { flex-direction: row; margin: 0; }
.expose-chips input { position: absolute; opacity: 0; pointer-events: none; }
.expose-chips span { padding: 5px 10px; font-size: 12px; color: var(--text-secondary); border: 1px solid var(--border-subtle); border-radius: 999px; cursor: pointer; }
.expose-chips input:checked + span { color: var(--bg-primary); background: var(--text-primary); border-color: var(--text-primary); }
.expose-chips input:focus-visible + span { outline: 2px solid var(--text-secondary); outline-offset: 2px; }
.expose-vorschau { background: #d9d9d9; min-height: 0; }
.expose-vorschau iframe { width: 100%; height: 100%; border: 0; display: block; }
@media (max-width: 900px) {
    .expose-dialog { padding: 0; }
    .expose-fenster { border-radius: 0; }
    .expose-kopf span { display: none; }
    .expose-koerper { grid-template-columns: 1fr; grid-template-rows: auto 60vh; overflow-y: auto; }
    .expose-form { overflow: visible; border-right: 0; }
}

/* ---- Werkzeuge-Menü und Werkzeug-Fenster (Grundstücks-Check, Widget, Mieterhöhung) ---- */
.werkzeuge-menue { position: relative; }
.werkzeuge-liste {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 1700;
    width: 290px;
    padding: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}
.werkzeuge-liste[hidden] { display: none; }
.werkzeuge-liste button {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    padding: 9px 10px;
    font: inherit;
    text-align: left;
    color: var(--text-primary);
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}
.werkzeuge-liste button:hover, .werkzeuge-liste button:focus-visible { background: var(--row-hover); }
.werkzeuge-liste b { font-size: 13px; font-weight: 600; }
.werkzeuge-liste span { font-size: 11.5px; color: var(--text-secondary); }
.gc-ort, .gc-hinweis { font-size: 12px; color: var(--text-secondary); line-height: 1.45; margin: 6px 0 10px; }
.gc-ort { color: var(--text-primary); }
.gc-kartenhinweis {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--bg-primary);
    background: var(--text-primary);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.mh-summe { padding: 10px 12px; margin-bottom: 8px; font-size: 13px; color: var(--text-secondary); background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 8px; }
.mh-summe b { display: block; font-size: 18px; color: var(--text-primary); }
.mh-leer { font-size: 12.5px; color: var(--text-secondary); }
.mh-zeile { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0 8px 10px; border-left: 3px solid var(--border-subtle); margin-bottom: 6px; }
.mh-zeile.ok { border-left-color: var(--data-green); }
.mh-zeile.warn { border-left-color: var(--data-amber); }
.mh-zeile > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 12px; color: var(--text-secondary); }
.mh-zeile strong { font-size: 13px; color: var(--text-primary); }
.mh-knoepfe { display: flex; gap: 4px; align-items: flex-start; flex: none; }
.mh-knoepfe button { padding: 4px 8px; font: inherit; font-size: 12px; color: var(--text-primary); background: transparent; border: 1px solid var(--border-subtle); border-radius: 6px; cursor: pointer; }
.widget-vorschau { background: #fff; }
.expose-form label { overflow-wrap: anywhere; }
.expose-form input[type="color"] { height: 36px; padding: 3px !important; cursor: pointer; }
