:root {
    --bg: #f8f9fa;
    --card: #fff;
    --border: #dee2e6;
    --accent: #2563eb;
    --text: #17191e;
    --muted: #64748b;
    /* Chart-Palette (wie im Artifact / Buckets) */
    --c-pkw: #e34948;
    --c-lkw: #4a3aa7;
    --c-rad: #12a06f;
    --c-rad-elektro: #067a53;
    --c-escooter: #46c19a;
    --c-bus: #eb6834;
    --c-motorrad: #d9772e;
    --c-moped: #f0996b;
    --c-traktor: #b3541e;
    --c-schiene: #8a6d3b;
    --c-fussgaenger: #64748b;
    --c-sonstige: #9aa0a8;
    /* Mischfarben für die Sammelgruppen (Mittelwert der jeweils
       zusammengefassten Untergruppen-Farben), nur für die
       Kennzahl-Karten "motorisierter Verkehr" / "Mikromobilität" */
    --c-motor: #bb644c;
    --c-mikro: #2cb084;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}
header {
    background: var(--text);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
header h1 {
    font-size: 1.4rem;
    font-weight: 600;
}
header h1 a {
    color: inherit;
    text-decoration: none;
}
header .sub {
    color: #94a3b8;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}
header nav {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}
header nav a {
    color: #94a3b8;
    font-size: 0.9rem;
    text-decoration: none;
}
header nav a:hover {
    color: white;
}
.pill {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #12a06f;
    color: #fff;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    vertical-align: middle;
    margin-left: 0.5rem;
}
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

.filter-heading {
    flex-basis: 100%;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}
.filter-top {
    flex-basis: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.filter-top .filter-heading {
    flex-basis: auto;
}
.filter-bottom {
    flex-basis: 100%;
}
.filter-heading select {
    margin: 0 0.15rem;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: end;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}
select,
button {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    color: var(--text);
}
select:focus {
    outline: 2px solid var(--accent);
    border-color: transparent;
}

.mode-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.mode-toggle button {
    border: none;
    border-radius: 0;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    background: white;
    color: var(--muted);
    transition: all 0.15s;
}
.mode-toggle button.active {
    background: var(--accent);
    color: white;
    font-weight: 600;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}
.stat-card .number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.stat-card .label {
    font-size: 0.75rem;
    color: var(--muted);
}

.chart-container {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.chart-container h2 {
    font-size: 1.05rem;
    margin-bottom: 0.15rem;
}
.chart-sub {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 1.25rem;
}

/* Horizontale Balken */
.bars {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.bar-row {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 0.9rem;
    align-items: center;
}
.bar-lab {
    font-size: 0.85rem;
    color: var(--text);
    text-align: right;
}
.bar-track {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.bar {
    height: 22px;
    border-radius: 0 4px 4px 0;
    min-width: 2px;
    transition: width 0.4s ease;
}
.bar-val {
    font-size: 0.82rem;
    color: var(--text);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.bar-val .n {
    color: var(--muted);
}
.bar-expand {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--muted);
    padding: 0 0.3rem;
    line-height: 1;
    vertical-align: middle;
}
.bar-expand:hover {
    color: var(--text);
}
.bar-expand:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}
.bar-sub-group {
    display: contents;
}
.bar-row.sub {
    padding-left: 1.5rem;
}
.bar-row.sub .bar-lab {
    font-size: 0.78rem;
    color: var(--muted);
}
.bar-row.sub .bar {
    height: 16px;
}
.bar-row.sub .bar-lab a {
    color: inherit;
    text-decoration: underline;
}
.bar-row.sub .bar-lab a:hover {
    color: var(--text);
}

/* Tabelle */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    font-size: 0.85rem;
}
caption {
    text-align: left;
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
}
th,
td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
td.num,
th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
tbody tr:hover {
    background: #f1f5f9;
}
tr.sub-row td:first-child {
    padding-left: 2rem;
}
tr.sub-row {
    font-size: 0.82rem;
    color: var(--muted);
}
tfoot td {
    font-weight: 700;
    border-top: 2px solid var(--border);
    border-bottom: none;
}
.swatch {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 3px;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.note {
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.6;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
}
.note b {
    color: var(--text);
}
.loading {
    text-align: center;
    padding: 4rem;
    color: var(--muted);
    font-size: 1.1rem;
}
.empty {
    padding: 2rem;
    text-align: center;
    color: var(--muted);
}

/* Umschalter Einfach | Erweitert; Filter der erweiterten Ansicht (.adv) */
.view-switch {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
    background: var(--card);
}
.view-switch button {
    border: 0;
    border-radius: 0;
    background: none;
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    color: var(--muted);
    cursor: pointer;
}
.view-switch button.on {
    background: var(--accent);
    color: #fff;
}
.view-switch button:not(.on):hover {
    color: var(--text);
}
.adv {
    display: none !important;
}
body.erweitert .adv {
    display: flex !important;
}

/* Schmale Bildschirme (Telefon): Beschriftung über dem Balken statt daneben */
@media (max-width: 600px) {
    .bar-row {
        grid-template-columns: 1fr;
        gap: 0.15rem;
        margin-bottom: 0.55rem;
    }
    .bar-lab {
        text-align: left;
    }
    .bar-track {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.15rem;
    }
    .bar-row.sub {
        padding-left: 1rem;
    }
}
