.leaflet-legend {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px; /* Etwas knackigerer Radius passend zur kleineren Box */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    /* Slightly reduced left/right padding; keep no top padding and small bottom padding */
    padding: 0 4px 6px 4px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    width: fit-content;
    margin-top: 48px;
    box-sizing: border-box;
}

.leaflet-legend .legend-title {
    font-size: 11px; /* Minimal kleiner für kompaktere Optik */
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px; /* Abstand nach unten verringert */
    color: #333333;
    text-transform: lowercase;
}

.leaflet-legend .legend-body {
    display: flex;
    align-items: stretch;
    /* Further reduce gap between color bar and labels by 1px */
    gap: 4px;
}

.leaflet-legend .color-bar {
    display: flex;
    flex-direction: column;
    width: 18px; /* Etwas schlanker für Leaflet-Optik */
    height: 240px; /* Kompaktere Höhe für Mobilgeräte */
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1); /* Leichter Rand um die Farbleiste */
}

.leaflet-legend .swatch {
    flex: 1;
    width: 100%;
}

.leaflet-legend .labels-column {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 240px; /* Muss exakt der Höhe der .color-bar entsprechen */
    font-size: 11px;
    font-weight: 600;
    color: #444444; /* Dunkelgrau für guten Kontrast auf Weiß */
    line-height: 0;
    padding: 0;
}

.leaflet-legend .label-item {
    display: flex;
    align-items: center;
    height: 0;
}