.fsd-panel{
    position: absolute;
    top: 10px;
    right: 54px;
    width: 280px;
    max-height: calc(100% - 20px);
    overflow-y: auto;
    z-index: 1000;
    background: #fff;
    color: #333;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.65);
    font-size: 13px;
}
.fsd-head{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid #ddd;
}
.fsd-close{
    font-size: 20px;
    line-height: 1;
    color: #666;
    text-decoration: none;
}
.fsd-body{ padding: 10px; }
.fsd-row{ display: block; margin-bottom: 2px; font-weight: normal; }
.fsd-row input[type=range]{ width: 100%; margin-top: 4px; }
.fsd-hint{ color: #777; font-size: 11px; margin-bottom: 8px; }
.fsd-run{ width: 100%; }
.fsd-error{
    margin-top: 8px;
    padding: 6px 8px;
    background: #fdecea;
    color: #a94442;
    border-radius: 3px;
    word-break: break-word;
}
.fsd-results{ margin-top: 10px; }
.fsd-swatch{
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 6px;
    vertical-align: -1px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.35);
}
.fsd-table{ width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.fsd-table th{ font-weight: normal; color: #777; font-size: 11px; padding: 2px 0; border-bottom: 1px solid #ddd; }
.fsd-table td{ padding: 3px 0; }
.fsd-table input{ margin: 0 4px 0 0; }
.fsd-table tfoot td{ border-top: 1px solid #ddd; padding-top: 5px; }
.fsd-num{ text-align: right; }
.fsd-dim{ color: #888; }
.fsd-actions{ margin-top: 8px; }
.fsd-actions .btn{ margin: 0 2px 4px 0; }

/* count by area */
.fsd-section{ margin-top: 12px; padding-top: 10px; border-top: 1px solid #ddd; }
.fsd-section-title{ font-weight: bold; margin-bottom: 6px; }
.fsd-zone-btns .btn{ margin: 0 2px 4px 0; }
.fsd-zone{ padding: 6px 0; border-bottom: 1px solid #eee; }
.fsd-zone-head{ display: flex; align-items: baseline; gap: 8px; }
.fsd-zone-name{ font-weight: bold; color: inherit; text-decoration: none; border-bottom: 1px dotted #999; }
.fsd-zone-head .fsd-dim{ margin-left: auto; font-size: 11px; }
.fsd-zone-del{ color: #999; text-decoration: none; font-size: 16px; line-height: 1; }
.fsd-zone-counts{ margin-top: 3px; }
.fsd-zone-counts .fsd-swatch{ margin-left: 6px; }
.fsd-zone-counts .fsd-swatch:first-child{ margin-left: 0; }
.fsd-zone-total{ float: right; }
.fsd-zone-label{
    background: rgba(0,0,0,0.65);
    border: 0;
    color: #fff;
    font-size: 12px;
    padding: 2px 6px;
    box-shadow: none;
}
.fsd-zone-label:before{ display: none; }

/* drawing mode */
.fsd-drawing, .fsd-drawing .leaflet-grab, .fsd-drawing .leaflet-interactive{ cursor: crosshair !important; }
.fsd-drawing .leaflet-pane > svg path.leaflet-interactive{ pointer-events: none !important; }
.fsd-tick{
    background: #111;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer !important;
}
.fsd-area-label span{
    position: absolute;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    background: rgba(0,0,0,0.65);
    color: #fff;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 12px;
    pointer-events: none;
}
.fsd-name-input{ flex: 1; min-width: 0; padding: 1px 4px; font-weight: bold; font-size: 13px; }

/* on-map legend */
.fsd-legend{
    background: rgba(255,255,255,0.92);
    color: #333;
    padding: 6px 10px;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.5);
    font-size: 12px;
    line-height: 1.6;
    min-width: 130px;
}
.fsd-legend-title{ font-weight: bold; margin-bottom: 2px; }
.fsd-legend-row, .fsd-legend-total{ display: flex; align-items: center; }
.fsd-legend-row b, .fsd-legend-total b{ margin-left: auto; padding-left: 14px; }
.fsd-legend-total{ border-top: 1px solid #ccc; margin-top: 2px; padding-top: 2px; font-weight: bold; }
.fsd-off{ opacity: 0.4; }

@media (prefers-color-scheme: dark){
    .fsd-panel{ background: #2b2f33; color: #ddd; }
    .fsd-head{ border-color: #444; }
    .fsd-close{ color: #aaa; }
    .fsd-hint{ color: #999; }
    .fsd-table th, .fsd-table tfoot td, .fsd-section, .fsd-zone{ border-color: #444; }
    .fsd-table th, .fsd-dim{ color: #999; }
}
