#route-builder {
    position: relative;
    width: 100%;
    /* navbar высота ~56px. dvh учитывает плавающий address bar мобильных браузеров. */
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    overflow: hidden;
}

#route-map {
    width: 100%;
    height: 100%;
    z-index: 0;
}

.order-panel {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 380px;
    max-width: calc(100vw - 2rem);
    max-height: calc(100% - 2rem);
    overflow-y: auto;
    z-index: 1000;
}

.order-panel .card {
    border: none;
}

@media (max-width: 991.98px) {
    .order-panel {
        position: fixed;
        bottom: 0;
        top: auto;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        max-height: 75vh;
        border-radius: 1rem 1rem 0 0;
        transform: translateY(100%);
        transition: transform 0.25s ease;
    }
    .order-panel.is-open {
        transform: translateY(0);
    }
}

.panel-toggle {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1001;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
}

.stop-marker {
    background: #0d6efd;
    color: #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
    font-size: 13px;
}

.stop-marker.is-end {
    background: #198754;
}

.stop-marker.is-start {
    background: #dc3545;
}

.stop-marker.is-active {
    transform: scale(1.25);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, .35), 0 1px 4px rgba(0, 0, 0, .35);
    z-index: 999 !important;
}

.stop-list .list-group-item.stop-row {
    cursor: pointer;
}
.stop-list .list-group-item.stop-row.is-active {
    background: #e9f2ff;
    border-left: 3px solid #0d6efd;
}
.stop-list .stop-label {
    font-size: .88rem;
}

.stop-popup .btn { font-size: .75rem; }

/* Гарантия что navbar поверх всего и точно виден */
nav.navbar.sticky-top {
    z-index: 1080;
}

.my-request-marker {
    background: #198754;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
    font-size: 10px;
    opacity: .85;
}

.my-request-popup .badge {
    font-size: 10px;
    text-transform: uppercase;
}

.my-request-popup ol {
    margin: 0;
}

.boat-marker {
    background: #ffc107;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
    font-size: 11px;
}

.stop-list .list-group-item {
    cursor: grab;
}
.stop-list .list-group-item.dragging {
    opacity: .5;
}
.stop-list .list-group-item .stop-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #0d6efd;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    margin-right: .5rem;
    flex-shrink: 0;
}

.autocomplete-results {
    position: absolute;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: .375rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
    z-index: 1050;
    width: 100%;
    max-height: 240px;
    overflow-y: auto;
    margin-top: 2px;
}
.autocomplete-results .item {
    padding: .5rem .75rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}
.autocomplete-results .item:last-child {
    border-bottom: 0;
}
.autocomplete-results .item:hover,
.autocomplete-results .item.active {
    background: #e9f2ff;
}
.autocomplete-results .item small {
    color: #6c757d;
}

/* Boat detail popup (Leaflet) */
.boat-popup {
    width: 280px;
}
.boat-popup .gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-bottom: .5rem;
}
.boat-popup .gallery img {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: .25rem;
    cursor: pointer;
}
.boat-popup .hero img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: .25rem;
    margin-bottom: .5rem;
}
.boat-popup h6 {
    margin-bottom: .25rem;
}
.boat-popup .meta {
    font-size: .75rem;
    color: #6c757d;
    margin-bottom: .5rem;
}
.boat-popup .description {
    font-size: .8rem;
}
.leaflet-popup-content-wrapper {
    border-radius: .5rem;
}
