.workspace-toolbar { flex: 0 0 auto; }
.workspace-toolbar, .workspace-toolbar-group { min-width: 0; }
.workspace-title [hidden] { display: none !important; }
.workspace-title input { min-width: 16rem; }
.workspace-canvas .leaflet-sidebar-tabs li.disabled { opacity: .35; pointer-events: none; }
.ws-delete-all { flex: 0 0 25%; }
.workspace-marker { background: transparent; border: 0; }
.workspace-marker > span { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; box-sizing: border-box; background: #0d6efd; color: white; border: 2px solid white; border-radius: 50%; font-weight: bold; box-shadow: 0 1px 4px #0005; }
.workspace-marker-depot > span { background: #198754; border-radius: 6px; }
/* isolate keeps the sidebar above map controls without covering page dialogs or menus. */
.workspace-canvas { position: relative; flex: 1; min-height: 480px; display: flex; isolation: isolate; }
.workspace-canvas #content { min-width: 0; }
.workspace-canvas .leaflet-sidebar { top: 12px; bottom: 12px; }
/* Above Leaflet controls (1000); kept in this file with the isolation rule so both ship together. */
.workspace-canvas .leaflet-sidebar { z-index: 1100 !important; }
.workspace-canvas .leaflet-sidebar-content { background: var(--bs-body-bg); }
.workspace-canvas .leaflet-sidebar-pane { padding-bottom: 24px; }
.workspace-canvas .leaflet-sidebar-pane > .container-fluid { padding: 0; }
.workspace-canvas .leaflet-sidebar-pane .table { font-size: .8rem; }
.workspace-canvas .leaflet-sidebar-pane .table th { font-weight: 500; }
@media (min-width: 768px) {
    .workspace-canvas .leaflet-sidebar { width: 460px; max-width: 460px; }
    .workspace-canvas .leaflet-sidebar.collapsed { width: 40px; }
    .workspace-canvas .leaflet-sidebar-pane { min-width: 420px; }
}
@media (max-width: 767px) {
    .workspace-canvas { min-height: 65dvh; }
    .workspace-canvas .leaflet-sidebar { top: 0; bottom: 0; }
}

/* Optimization results */
.results-summary { padding: 12px 0 4px; }
.result-vehicle { --route-color: var(--bs-primary); margin-top: 12px; border: 1px solid var(--bs-border-color); border-left: 4px solid var(--route-color); border-radius: var(--bs-border-radius-lg); background: var(--bs-body-bg); }
.result-vehicle-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--bs-border-color-translucent); }
.result-vehicle-badge { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--route-color); color: white; font-size: .85rem; }
.result-vehicle-action { flex: 0 0 auto; width: 36px; height: 36px; }
.result-vehicle-toggle { color: var(--bs-secondary-color); border: 1px solid var(--bs-border-color); }
.result-vehicle-toggle:hover { color: var(--bs-body-color); background: var(--bs-tertiary-bg); }
.result-vehicle.is-hidden { border-left-color: var(--bs-border-color); }
.result-vehicle.is-hidden .result-vehicle-badge, .result-vehicle.is-hidden .result-stop-marker { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }
.result-vehicle.is-hidden .result-stops { opacity: .55; }
.result-stops { counter-reset: stop; list-style: none; margin: 0; padding: 8px 12px 10px; }
.result-stop { position: relative; display: flex; gap: 12px; padding: 6px 0; }
/* Connector line between markers */
.result-stop:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 34px; bottom: -6px; width: 2px; background: var(--bs-border-color); }
.result-stop-marker { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--route-color); color: white; font-size: .8rem; font-weight: 600; }
.result-stop:not(.is-depot) .result-stop-marker::before { counter-increment: stop; content: counter(stop); }
.result-stop.is-depot .result-stop-marker { border-radius: 6px; }
.result-stop-address { font-weight: 500; overflow-wrap: anywhere; line-height: 1.3; }
.result-unassigned { margin-top: 12px; padding: 12px; border: 1px solid var(--bs-danger-border-subtle); border-radius: var(--bs-border-radius-lg); background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.result-unassigned ul { padding-left: 1.2rem; overflow-wrap: anywhere; }
.min-w-0 { min-width: 0; }

/* Sidebar lists: points, points with errors, vehicles */
.ws-panel { padding: 12px 0 8px; }
.ws-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ws-list-numbered { counter-reset: point; }
.ws-item { display: flex; gap: 12px; padding: 10px 12px; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius-lg); background: var(--bs-body-bg); scroll-margin-top: 12px; }
.ws-item:hover { border-color: var(--bs-primary-border-subtle); }
.ws-item-marker { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin-top: 1px; border-radius: 50%; background: var(--bs-primary); color: white; font-size: .8rem; font-weight: 600; }
.ws-list-numbered .ws-item:not(.is-depot) .ws-item-marker::before { counter-increment: point; content: counter(point); }
.ws-item.is-depot .ws-item-marker { background: #198754; border-radius: 6px; }
.ws-item.is-error { border-color: var(--bs-danger-border-subtle); background: var(--bs-danger-bg-subtle); }
.ws-item.is-error .ws-item-marker { background: var(--bs-danger); }
.ws-item-body { flex: 1 1 auto; min-width: 0; }
.ws-item-title { display: block; width: 100%; padding: 0; border: 0; background: none; color: var(--bs-body-color); text-align: left; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
button.ws-item-title:hover { color: var(--bs-primary); text-decoration: underline; }
.ws-item-meta { margin-top: 2px; font-size: .85rem; color: var(--bs-secondary-color); overflow-wrap: anywhere; }
.ws-item-facts { margin: 4px 0 0; font-size: .85rem; }
/* "Label: value" on one line per fact */
.ws-item-facts dt { display: inline; font-weight: 400; color: var(--bs-secondary-color); }
.ws-item-facts dt::after { content: ": "; }
.ws-item-facts dd { display: inline; margin: 0; overflow-wrap: anywhere; }
.ws-item-facts dd::after { content: "\A"; white-space: pre; }
.ws-item-actions { display: flex; gap: 6px; margin-top: 8px; }
.ws-item-actions .btn { min-width: 36px; min-height: 32px; }

/* Depot role: toggle in the points list, switch in the point dialog */
.ws-depot-toggle { color: var(--bs-secondary-color); border: 1px solid var(--bs-border-color); }
.ws-depot-toggle:hover { color: #198754; border-color: #198754; }
.ws-depot-toggle[aria-pressed="true"] { color: white; background: #198754; border-color: #198754; }
.ws-depot-toggle[aria-pressed="true"]:hover { background: #157347; color: white; }
.ws-depot-switch { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius-lg); cursor: pointer; }
.ws-depot-switch .form-check-input { float: none; margin: 0; width: 2.5em; height: 1.35em; cursor: pointer; }
.ws-depot-switch .form-check-input:checked { background-color: #198754; border-color: #198754; }
.ws-depot-switch:has(:checked) { border-color: #198754; background: var(--bs-success-bg-subtle); }
.ws-depot-switch:has(:checked) .fa-warehouse { color: #198754; }

/* Point dialog: fits the viewport; the map takes the remaining height */
.ws-point-modal .modal-content { max-height: calc(100dvh - var(--bs-modal-margin) * 2); }
.ws-point-modal .modal-content > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.ws-point-modal .modal-body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.ws-point-modal-map { display: flex; flex: 1 1 400px; min-height: 160px; margin-top: .5rem; padding-bottom: 1rem; }
.ws-point-modal-map > div { flex: 1 1 auto; border-radius: var(--bs-border-radius); }
@media (max-width: 575.98px) {
    .ws-point-modal .modal-content { max-height: none; }
}

/* Address suggestions in the point dialog */
.ws-address-results { position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 10; max-height: 16rem; overflow-y: auto; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); }
.ws-address-results [role=option] { padding: .5rem .75rem; font-size: .875rem; overflow-wrap: anywhere; cursor: pointer; }
.ws-address-results [role=option] + [role=option] { border-top: 1px solid var(--bs-border-color); }
.ws-address-results [role=option]:hover, .ws-address-results [aria-selected=true] { background: var(--bs-primary); color: white; }
.result-unassigned-reasons { margin: 0 0 10px; padding: 8px 10px 8px 1.6rem; border-radius: var(--bs-border-radius); background: var(--bs-body-bg); color: var(--bs-body-color); }
.result-unassigned-points li + li { margin-top: 6px; }
.result-unassigned-why { color: var(--bs-body-color); opacity: .85; }

/* Shown while address lines are looked up before saving */
.ws-geocode-overlay { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .45); }
.ws-geocode-box { display: flex; flex-direction: column; align-items: center; gap: .75rem; min-width: min(280px, 100%); padding: 1.5rem 2rem; text-align: center; background: var(--bs-body-bg); color: var(--bs-body-color); border-radius: var(--bs-border-radius-lg); box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .3); }
.result-vehicle-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; font-weight: 500; }
