.spatial-legend {
    position: absolute;
    top: 10px;
    right: 50px;
    width: 200px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    z-index: 500;
    backdrop-filter: blur(4px);
    overflow: hidden;
    cursor: default;
}
.spatial-legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    cursor: grab;
    user-select: none;
}
.spatial-legend-header:active {
    cursor: grabbing;
}
.spatial-legend-title {
    font-size: 11px;
    font-weight: 700;
    color: #333;
}
.spatial-legend-count {
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    background: #2196f3;
    border-radius: 10px;
    padding: 1px 7px;
    line-height: 16px;
}
.spatial-legend-hint {
    padding: 4px 12px 6px;
    font-size: 10px;
    color: #aaa;
    border-bottom: 1px solid #f0f0f0;
    line-height: 1.4;
}
.spatial-legend-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 4px 0;
}
.spatial-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    cursor: grab;
    transition: background 0.15s;
    user-select: none;
}
.spatial-legend-item:hover {
    background: #f5f9ff;
}
.spatial-legend-item.off {
    opacity: 0.45;
}
.spatial-legend-item.dragging {
    opacity: 0.4;
    background: #e3f2fd;
}
.spatial-legend-item.drag-over {
    border-top: 2px solid #2196f3;
}
.spatial-legend-drag {
    flex-shrink: 0;
    cursor: grab;
    display: flex;
    align-items: center;
}
.spatial-legend-geom {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.spatial-legend-name {
    flex: 1;
    font-size: 11px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.spatial-legend-vis {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 4px;
    color: #666;
    transition: background 0.15s;
}
.spatial-legend-vis:hover {
    background: #e8e8e8;
}
.spatial-legend-list::-webkit-scrollbar { width: 4px; }
.spatial-legend-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }
