.map-measure-control {
    position: relative;
    z-index: 1;
    width: 43px;
    overflow: hidden;
    border: 1px solid rgba(16,59,45,.15);
    border-radius: 14px;
    background: rgba(255,255,255,.92);
    box-shadow: 0 12px 32px rgba(16,59,45,.16);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.map-measure-control .map-measure-button {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: #103b2d;
    cursor: pointer;
}

.map-measure-control .map-measure-button:hover {
    background: rgba(16,59,45,.08);
}

.map-measure-control .map-measure-button.is-active {
    background: #103b2d;
    color: #fff;
}

.map-measure-control svg {
    width: 21px;
    height: 21px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Leaflet applies its own cursors to interactive paths; measuring state must win. */
.land-leaflet-map.is-measuring,
.land-leaflet-map.is-measuring .leaflet-interactive {
    cursor: crosshair !important;
}

.map-basemap-unavailable-notice {
    position: absolute;
    top: 76px;
    left: 50%;
    z-index: 1300;
    width: max-content;
    max-width: min(520px, calc(100% - 32px));
    padding: 11px 15px;
    transform: translateX(-50%);
    border: 1px solid rgba(127,86,0,.24);
    border-radius: 12px;
    background: rgba(255,249,230,.96);
    box-shadow: 0 10px 28px rgba(16,59,45,.16);
    color: #5d4300;
    font-family: Manrope, Arial, sans-serif;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    pointer-events: none;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.map-basemap-unavailable-notice[hidden] {
    display: none;
}

/* Leaflet DivIcon wrappers carry their own marker surface styles. */
.zf-side-length-marker,
.zf-measure-segment-marker,
.zf-measure-total-marker {
    background: transparent !important;
    border: 0 !important;
    overflow: visible !important;
    pointer-events: none !important;
}

.zf-side-length-marker span,
.zf-measure-segment-marker span,
.zf-measure-total-marker span {
    position: absolute;
    left: 0;
    top: 0;
    display: block;
    width: max-content;
    white-space: nowrap;
    border-radius: 7px;
    box-shadow: 0 3px 10px rgba(16,59,45,.18);
    font-family: Manrope, Arial, sans-serif;
    font-weight: 800;
    line-height: 1;
    pointer-events: none;
    transform-origin: center center;
}

.zf-side-length-marker span {
    padding: 4px 6px;
    border: 1px solid rgba(16,59,45,.18);
    background: rgba(255,255,255,.94);
    color: #103b2d;
    font-size: 10px;
    transform: translate(-50%,-50%) rotate(var(--zf-side-angle,0deg));
}

.public-map-embed .zf-side-length-marker span {
    font-size: 10px;
    padding: 4px 5px;
}

.zf-measure-segment-marker span {
    padding: 4px 6px;
    border: 1px solid rgba(255,255,255,.72);
    background: rgba(16,59,45,.92);
    color: #fff;
    font-size: 10px;
    transform: translate(-50%,-50%);
}

.zf-measure-total-marker span {
    padding: 5px 7px;
    border: 1px solid rgba(255,255,255,.78);
    background: #103b2d;
    color: #fff;
    font-size: 11px;
    transform: translate(8px,-25px);
}

.map-info-area {
    flex-wrap: wrap;
}

.map-info-perimeter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin-left: 4px;
}

.map-info-perimeter strong {
    min-width: 0;
    font-variant-numeric: tabular-nums;
    white-space: normal;
}

.map-info-perimeter .map-info-icon {
    color: #657068;
}

/* Desktop слева направо: Навигация → Линейка → + → − → Слои. */
.public-map-view .map-controls-left.map-controls-right > .map-location-control { order: 1; }
.public-map-view .map-controls-left.map-controls-right > .map-measure-control { order: 2; }
.public-map-view .map-controls-left.map-controls-right > .map-zoom-control { order: 3; }
.public-map-view .map-controls-left.map-controls-right > .map-basemap-select { order: 4; }

.public-map-view .map-basemap-select,
.public-map-view .map-measure-control,
.public-map-view .map-location-control {
    flex: 0 0 43px;
    width: 43px;
}

/* На desktop + и − стоят рядом, а не вертикальной колонкой. */
.public-map-view .map-zoom-control {
    flex: 0 0 86px;
    width: 86px;
    height: 43px;
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

.public-map-view .map-zoom-control button {
    flex: 0 0 43px;
    width: 43px;
    height: 43px;
}

.public-map-view .map-zoom-control button + button {
    border-top: 0;
    border-left: 1px solid rgba(16,59,45,.12);
}

.public-map-view .map-basemap-current {
    position: relative;
    width: 43px;
    min-width: 43px;
    height: 43px;
    min-height: 43px;
    padding: 0;
    display: grid;
    place-items: center;
    justify-content: center;
    gap: 0;
    font-size: 0;
}

.public-map-view .map-basemap-current::before {
    content: "";
    width: 21px;
    height: 21px;
    display: block;
    background: center / 21px 21px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23103b2d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 3 8 4.5-8 4.5-8-4.5L12 3Z'/%3E%3Cpath d='m4 12 8 4.5 8-4.5'/%3E%3Cpath d='m4 16.5 8 4.5 8-4.5'/%3E%3C/svg%3E");
}

.public-map-view .map-basemap-current [data-map-basemap-current] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

.public-map-view .map-basemap-current .map-control-chevron {
    display: none;
}

.public-map-view .map-basemap-menu {
    top: calc(100% + 7px);
    right: 0;
    left: auto;
    width: 178px;
    max-width: calc(100vw - 28px);
    max-height: calc(100dvh - 86px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

@media (max-width: 780px) {
    .map-measure-control,
    .map-measure-control .map-measure-button {
        width: 43px;
        height: 43px;
    }

    .map-basemap-unavailable-notice {
        top: 68px;
        max-width: calc(100% - 24px);
        padding: 10px 12px;
        font-size: 13px;
    }

    .zf-side-length-marker span {
        font-size: 9px;
        padding: 4px 5px;
    }

    .map-info-perimeter {
        margin-left: 0;
    }

    /* Верхняя панель имеет фиксированную мобильную высоту, чтобы внешний отступ совпадал с gap кнопок. */
    .public-map-view .land-map-brandbar {
        height: 48px;
        min-height: 48px;
        box-sizing: border-box;
    }

    /* Сверху вниз: Слои → Линейка → Навигация. */
    .public-map-view .map-controls-left.map-controls-right > .map-basemap-select { order: 1; }
    .public-map-view .map-controls-left.map-controls-right > .map-measure-control { order: 2; }
    .public-map-view .map-controls-left.map-controls-right > .map-location-control { order: 3; }

    .public-map-view .map-basemap-menu {
        top: 0;
        right: calc(100% + 6px);
        bottom: auto;
        left: auto;
        width: min(176px, calc(100vw - 65px));
        max-width: calc(100vw - 65px);
        max-height: calc(100dvh - 70px);
        overflow-y: auto;
    }

    .public-map-view .map-zoom-control {
        display: none;
    }
}
