:root {
    --panel-radius: 14px;
    --soft-shadow: 0 6px 18px rgba(0, 0, 0, .06);
    --rand: rgba(0, 0, 0, .08);
}

body {
    line-height: 1.55;
    background: #f6f7f9;
}

.app-nav .nav-link.active {
    font-weight: 600;
    color: var(--bs-primary) !important;
}

/* Karten/Kacheln */
.panel {
    background: #fff;
    border: 1px solid var(--rand);
    border-radius: var(--panel-radius);
    box-shadow: var(--soft-shadow);
    padding: 16px 18px;
}

.panel-titel {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: .25rem;
}

.panel-untertitel {
    font-size: .85rem;
    color: var(--bs-secondary-color);
    margin-bottom: .75rem;
}

.seitenkopf h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: .25rem;
}

.seitenkopf p {
    color: var(--bs-secondary-color);
    margin-bottom: 0;
    max-width: 70ch;
}

/* Kennzahlen */
.kpi {
    background: #fff;
    border: 1px solid var(--rand);
    border-radius: var(--panel-radius);
    padding: 14px 16px;
    height: 100%;
}

.kpi .wert {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.kpi .label {
    font-size: .85rem;
    color: var(--bs-secondary-color);
}

/* Bereichskarten auf der Übersicht */
.bereich {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.bereich .bereich-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: .75rem;
}

.bereich ul {
    padding-left: 1.1rem;
    color: var(--bs-secondary-color);
    font-size: .92rem;
}

.bereich .aktionen {
    margin-top: auto;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

/* Hinweise */
.hinweis {
    background: #eef4ff;
    border: 1px solid #d6e4ff;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: .9rem;
}

.hinweis.warnung {
    background: #fff8e6;
    border-color: #ffe3a3;
}

/* Diagramme */
.chart-box {
    position: relative;
    height: 320px;
}

.chart-box.hoch {
    height: 460px;
}

.chart-box.niedrig {
    height: 220px;
}

/* Karten */
.flaechenkarte {
    height: 460px;
    border-radius: 10px;
    background: #eef1f4;
}

.leaflet-container {
    font: inherit;
}

.legende {
    background: rgba(255, 255, 255, .92);
    padding: 8px 10px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
    font-size: .8rem;
    line-height: 1.4;
}

.legende i {
    display: inline-block;
    width: 14px;
    height: 12px;
    margin-right: 6px;
    vertical-align: -1px;
    border-radius: 2px;
}

.filterleiste {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filterleiste .form-label {
    font-size: .8rem;
    margin-bottom: 2px;
    color: var(--bs-secondary-color);
}

.chip {
    border: 1px solid var(--rand);
    background: #fff;
    border-radius: 999px;
    padding: 3px 12px;
    font-size: .85rem;
    cursor: pointer;
}

.chip.aktiv {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}

table.daten td, table.daten th {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

table.daten td.text, table.daten th.text {
    white-space: normal;
}

table.daten tr.ausgewaehlt td {
    background: #eef4ff;
}

.lade-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .5);
    z-index: 1000;
}

.lade-overlay.sichtbar {
    display: flex;
}

/* Trefferliste der Delikt-Suche */
.suchtreffer {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1100;
    max-height: 360px;
    overflow-y: auto;
    display: none;
}

.suchtreffer.offen {
    display: block;
}

.suchtreffer .list-group-item {
    font-size: .88rem;
    padding: .4rem .75rem;
}

.suchtreffer .list-group-item.active-treffer {
    background: #eef4ff;
}

/* Kein Fokusrahmen um angeklickte Kartenflächen */
.leaflet-interactive:focus {
    outline: none;
}

/* Stau-Kalender (Wochentag × Uhrzeit) */
.kalender {
    border-collapse: separate;
    border-spacing: 2px;
    width: 100%;
    table-layout: fixed;
    font-size: .72rem;
}

.kalender th {
    font-weight: 500;
    color: var(--bs-secondary-color);
    text-align: center;
    padding: 0;
}

.kalender th.tag {
    width: 2.4rem;
    text-align: left;
}

.kalender td {
    height: 26px;
    border-radius: 3px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    cursor: default;
}

.kalender td.wenig {
    opacity: .45;
}

.kalender td.leer {
    background: repeating-linear-gradient(45deg, #f1f3f5, #f1f3f5 3px, #e9ecef 3px, #e9ecef 6px);
}

.kalender td.jetzt {
    outline: 2px solid #111827;
    outline-offset: -1px;
}

@media (max-width: 768px) {
    .kalender td span {
        display: none;
    }
}

/* Unternavigation und Reiter */
.unternav .nav-link {
    padding: .3rem .85rem;
    font-size: .9rem;
}

.reiter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.reiter .chip {
    padding: 5px 14px;
}

.ansicht[hidden] {
    display: none !important;
}

/* CSV-Knopf oben rechts in einem Panel */
.panel {
    position: relative;
}

.csv-knopf {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: .72rem;
    padding: 1px 7px;
    line-height: 1.4;
    border: 1px solid var(--rand);
    border-radius: 6px;
    background: #fff;
    color: var(--bs-secondary-color);
}

.csv-knopf:hover {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.panel:has(> .csv-knopf) > .panel-titel,
.panel:has(> .csv-knopf) > div > div > .panel-titel {
    padding-right: 3rem;
}

/* Jahreskalender (Monate × Tage) */
.jahreskalender {
    border-collapse: separate;
    border-spacing: 2px;
    width: 100%;
    table-layout: fixed;
    font-size: .7rem;
}

.jahreskalender th {
    font-weight: 500;
    color: var(--bs-secondary-color);
    text-align: center;
    padding: 0;
}

.jahreskalender th.monat {
    width: 2.2rem;
    text-align: left;
}

.jahreskalender td {
    height: 22px;
    border-radius: 3px;
    padding: 0;
}

.jahreskalender td.wert {
    cursor: pointer;
}

.jahreskalender td.wert:hover {
    outline: 2px solid #111827;
    outline-offset: -1px;
}

.jahreskalender td.fehlt {
    background: #f1f3f5;
}

.farblegende {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .78rem;
    color: var(--bs-secondary-color);
}

.farblegende .verlauf {
    height: 10px;
    width: 160px;
    border-radius: 3px;
}

/* Heat-Tabelle (z. B. SAIDI Land × Jahr) */
table.heat td {
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-size: .78rem;
    padding: 3px 4px;
    white-space: nowrap;
}

table.heat th {
    font-size: .78rem;
    font-weight: 500;
    white-space: nowrap;
}

table.heat tr.de td, table.heat tr.de th {
    font-weight: 700;
    border-top: 2px solid #adb5bd;
}

.tabelle-scroll {
    max-height: 520px;
    overflow: auto;
}

.tabelle-scroll thead th {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

tr.klickbar {
    cursor: pointer;
}

tr.klickbar:hover td {
    background: #f4f7fd;
}

/* Kopfzeilen mit Auswahlfeld rechts: Platz für den CSV-Knopf lassen */
.panel:has(> .csv-knopf) > .d-flex.justify-content-between:first-of-type {
    padding-right: 2.8rem;
}

/* zweiter Knopf (PNG) links neben dem CSV-Knopf */
.panel > .bild-knopf {
    right: 52px;
}

.panel:has(> .bild-knopf) > .d-flex.justify-content-between:first-of-type {
    padding-right: 5.6rem;
}

.panel:has(> .bild-knopf) > .panel-titel {
    padding-right: 6rem;
}
/* Ergebnis der Rechner (Geld & Inflation) */
.ergebnis-zahl {
    font-size: 2.1rem;
    font-weight: 700;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}
@media (max-width: 576px) {
    .ergebnis-zahl {
        font-size: 1.7rem;
    }
}

/* Chronik der Themenseiten: Nummern passen zu den Markierungen im Diagramm */
.chronik {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

@media (min-width: 1200px) {
    .chronik {
        max-height: 440px;
        overflow-y: auto;
    }
}

.chronik li {
    display: flex;
    gap: .6rem;
    padding: .35rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, .06);
}

.chronik li:last-child {
    border-bottom: 0;
}

.chronik .nr {
    flex: 0 0 auto;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: .1rem;
}

/* Kreis-Steckbrief: Lage im Bundesvergleich */
.profil-zeile {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.6fr) minmax(0, 1.2fr);
    gap: .75rem;
    align-items: center;
    padding: .3rem 0;
    font-size: .85rem;
    border-bottom: 1px solid rgba(0, 0, 0, .05);
}

.profil-balken {
    position: relative;
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(to right, #dbeafe, #93c5fd, #2563eb);
}

.profil-median {
    position: absolute;
    left: 50%;
    top: -3px;
    bottom: -3px;
    width: 1px;
    background: rgba(17, 24, 39, .45);
}

.profil-punkt {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border-radius: 50%;
    background: #f59e0b;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .25);
}

@media (max-width: 576px) {
    .profil-zeile {
        grid-template-columns: 1fr 1fr;
    }

    .profil-name {
        grid-column: 1 / -1;
    }
}
