/* Карты на MapLibre (js/tbmap/tbmap.js) */

.maplibregl-map {
    font-family: inherit;
}

.tbmap-marker {
    cursor: pointer;
}

/* Нумерованная метка объекта лота — табличка с хвостиком к точке */
/* position не задаём: маркер MapLibre сам absolute, relative ломает позиционирование */
.tbmap-num {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    box-sizing: border-box;
    border-radius: 6px;
    background: #1d60ff;
    box-shadow: 0 0 0 2px #fff, 0 3px 8px rgba(29, 96, 255, .45);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.tbmap-num::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border: 5px solid transparent;
    border-top: 6px solid #1d60ff;
    border-bottom: 0;
}

/* Точка клика на мобильных */
.tbmap-point {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid #1bad03;
    box-sizing: border-box;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}

.tbmap-popup .maplibregl-popup-content {
    padding: 14px 16px;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(17, 24, 39, .18), 0 2px 6px rgba(17, 24, 39, .08);
    color: #2F3237;
    font-size: 13px;
    line-height: 1.4;
    animation: tbmap-pop .12s ease-out;
}

@keyframes tbmap-pop {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
}

/* Единый крестик «закрыть» для всех попапов и панелей карт — как в «Анализе зоны».
   :is(#map, body) поднимает вес выше общего «#map button» на /map. */
:is(#map, body) :is(.tbmap-close, .tbmap-popup .maplibregl-popup-close-button) {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #DEE3ED;
    border-radius: 3px;
    box-sizing: border-box;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M1 1L9 9M1 9L9 1' fill='none' stroke='%232F3237' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center / 10px 10px no-repeat;
    box-shadow: none;
    color: transparent;
    font-size: 0;
    line-height: 0;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}

:is(#map, body) :is(.tbmap-close, .tbmap-popup .maplibregl-popup-close-button):hover {
    background-color: #F4F6FA;
    border-color: #C9D0DD;
}

:is(#map, body) :is(.tbmap-close, .tbmap-popup .maplibregl-popup-close-button) > * {
    display: none;
}

.tbmap-popup .maplibregl-popup-close-button {
    position: absolute;
    top: 10px;
    right: 10px;
}

/* Инфо по кадастровым слоям: поля таблицей «название — значение».
   Высота по содержимому: в общем CSS жёсткие 200px, и подвал «1 из 2» уходил за край */
.tbmap #balloonInfoObjects {
    width: 100%;
    height: auto;
    overflow: visible;
}

.tbmap #balloonInfoObjects h3 {
    margin: 0 40px 10px 0;
    padding-top: 4px;
    font-size: 15px;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
}

.tbmap #balloonInfoObjects .slide {
    gap: 0;
    max-height: none;
    overflow: visible;
}

.tbmap #balloonInfoObjects .slide__body {
    max-height: 170px;
    overflow-y: auto;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: #DDE1EA transparent;
}

.tbmap #balloonInfoObjects .slide__body::-webkit-scrollbar {
    width: 4px;
}

.tbmap #balloonInfoObjects .slide__body::-webkit-scrollbar-thumb {
    background: #DDE1EA;
    border-radius: 4px;
}

.tbmap #balloonInfoObjects .slide__body::-webkit-scrollbar-track {
    background: transparent;
}

.tbmap #balloonInfoObjects .balloon__content {
    display: grid;
    grid-template-columns: 42% 1fr;
    gap: 12px;
    padding: 6px 0;
    border-top: 1px solid #F1F3F9;
}

.tbmap #balloonInfoObjects .balloon__content--title {
    color: #8F96A3;
}

.tbmap #balloonInfoObjects .balloon__content--text {
    color: #2F3237;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.tbmap #balloonInfoObjects .balloon__footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #F1F3F9;
    font-variant-numeric: tabular-nums;
}

.tbmap #balloonInfoObjects .balloon__footer a {
    font-weight: 500;
}

.tbmap #balloonInfoObjects .balloon__btn__slide {
    width: 24px;
    height: 24px;
    padding: 6px;
    box-sizing: border-box;
    border-radius: 6px;
}

.tbmap #balloonInfoObjects .balloon__btn__slide:hover {
    background: #F4F6FA;
}

/* Ценники объявлений: компактная бирка «N · от цены» с хвостиком */
.tbmap .cluster-ads {
    padding: 3px 8px 3px 3px;
    gap: 6px;
    border-radius: 6px;
    background: #0AADFF;
    box-shadow: 0 0 0 1.5px #fff, 0 3px 8px rgba(17, 24, 39, .22);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 16px;
    transition: transform .12s;
}

.tbmap .cluster-ads:hover {
    transform: translateY(-1px);
}

.tbmap .cluster-ads__count {
    width: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    box-sizing: border-box;
    border-radius: 4px;
    font-size: 11px;
}

.tbmap .cluster-ads::after {
    left: 50%;
    margin-left: -5px;
    border-left-width: 5px;
    border-right-width: 5px;
    border-top: 5px solid #0AADFF;
}

/* варианты задаём здесь же: общее .tbmap .cluster-ads выше перебивает их из других файлов */
.tbmap .cluster-ads.rent {
    background: #FF7A00;
}

.tbmap .cluster-ads.rent .cluster-ads__count {
    color: #FF7A00;
}

.tbmap .cluster-ads.rent::after {
    border-top-color: #FF7A00;
}

.tbmap .cluster-ads.closed {
    background: #F5364C;
}

.tbmap .cluster-ads.closed .cluster-ads__count {
    color: #F5364C;
}

.tbmap .cluster-ads.closed::after {
    border-top-color: #F5364C;
}

.tbmap .cluster-ads.once {
    padding: 3px 8px;
}

/* Балун объявлений */
.tbmap .balloon__ads-head {
    padding: 5px 40px 10px 0;
    font-size: 15px;
}

/* Заголовок сверху, список занимает остаток и скроллится внутри балуна:
   у списка своя max-height 350px больше, чем у всего блока, — иначе он вылезает */
.tbmap .balloon__ads {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    max-height: 290px;
}

.tbmap .balloon__ads-head {
    flex: none;
}

.tbmap .balloon__ads-items {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
    width: auto;
    padding: 0 10px 14px 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #DDE1EA transparent;
}

.tbmap .balloon__ads-item {
    flex: none;
}

.tbmap .additional-desc {
    overflow-wrap: anywhere;
}

.tbmap .balloon__ads-item {
    border-radius: 8px;
    border-color: #EDF0F6;
    transition: border-color .12s;
}

.tbmap .balloon__ads-item:hover {
    border-color: #B9D3F6;
}

.tbmap .photo_ad {
    border-radius: 6px;
}

.tbmap .info_ad-price {
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.tbmap-popup--ads .maplibregl-popup-content {
    width: 360px;
    max-width: calc(100vw - 40px);
    box-sizing: border-box;
    padding: 14px 0 0 14px;
}

.tbmap-popup--info .maplibregl-popup-content {
    width: 340px;
    max-width: calc(100vw - 40px);
    box-sizing: border-box;
}

/* Балун соседних торгов: компактная карточка — статус, название, цена и дата, номера */
.tbmap-popup--trade .maplibregl-popup-content {
    width: 300px;
    max-width: calc(100vw - 40px);
    padding: 10px 12px;
    box-sizing: border-box;
    font-size: 12px;
}

.tbmap-trade {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tbmap-trade__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    min-height: 26px;
    padding-right: 32px;
    font-size: 11px;
    line-height: 16px;
}

.tbmap-trade__top > span {
    white-space: nowrap;
}

.tbmap-trades__slide .tbmap-trade__top {
    min-height: 20px;
    padding-right: 0;
}

.tbmap-trade__status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 6px;
    border-radius: 4px;
    background: #E8F7EE;
    color: #12813F;
    font-weight: 600;
}

.tbmap-trade__status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.tbmap-trade.is-closed .tbmap-trade__status {
    background: #FDECEC;
    color: #C8312B;
}

.tbmap-trade__kind {
    color: #5E636E;
}

.tbmap-trade__dist {
    margin-left: auto;
    color: #8F96A3;
}

.tbmap-trade__title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    color: #2F3237;
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    text-decoration: none;
}

.tbmap-trade__title:hover {
    color: #156CE1;
}

.tbmap-trade__grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    background: #F4F8FF;
    font-variant-numeric: tabular-nums;
}

.tbmap-trade.is-closed .tbmap-trade__grid {
    background: #F7F8FB;
}

.tbmap-trade__label,
.tbmap-trade__note {
    color: #8F96A3;
    font-size: 11px;
    line-height: 14px;
}

.tbmap-trade__price {
    color: #2F3237;
    font-size: 15px;
    font-weight: 700;
    line-height: 20px;
    white-space: nowrap;
}

.tbmap-trade__value {
    color: #2F3237;
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
}

.tbmap-trade__foot {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    font-size: 11px;
    line-height: 14px;
}

.tbmap-trade__ids {
    flex: 1;
    min-width: 0;
    color: #8F96A3;
    overflow-wrap: anywhere;
}

.tbmap-trade__link {
    flex: none;
    padding: 5px 12px;
    border-radius: 6px;
    background: #156CE1;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    text-decoration: none;
    transition: background .12s;
}

.tbmap-trade__link:hover {
    background: #0F5BC2;
    color: #fff;
}

/* Несколько торгов в одной точке: листаем по одному */
.tbmap-trades__slide.hide {
    display: none;
}

.tbmap-trades__pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 34px 6px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #F1F3F9;
    color: #5E636E;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.tbmap-trades__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #156CE1;
    border-radius: 8px;
    background: #fff;
    color: #156CE1;
    cursor: pointer;
    transition: background .12s, color .12s;
}

.tbmap-trades__btn svg {
    width: 16px;
    height: 16px;
}

.tbmap-trades__btn:hover:not(:disabled) {
    background: #156CE1;
    color: #fff;
}

.tbmap-trades__btn:disabled {
    border-color: #E1E5EC;
    background: #F4F6FA;
    color: #B8BEC9;
    cursor: default;
}

.tbmap-hint {
    pointer-events: none;
}

.tbmap-hint .maplibregl-popup-content {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}

.tbmap-hint .maplibregl-popup-tip {
    display: none;
}

.tbmap-ctrl-btn img {
    width: 18px;
    height: 18px;
}

/* Полноэкранный режим разворачивает весь блок вместе с меню */
.kadastr__maps:fullscreen {
    margin: 0;
    background: #fff;
}

.kadastr__maps:fullscreen #KadastrMap {
    height: 100% !important;
}

/* ---------- Меню «Слои» ---------- */
.kadastr__maps .tbmap-layers__panel {
    width: 320px;
    max-width: calc(100vw - 40px);
    padding: 12px;
    gap: 10px;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .16), 0 1px 3px rgba(0, 0, 0, .08);
    box-sizing: border-box;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
}

.tbmap-layers__section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tbmap-layers__section + .tbmap-layers__section {
    padding-top: 10px;
    border-top: 1px solid #F1F3F9;
}

.tbmap-layers__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #2F3237;
    font-size: 13px;
    font-weight: 600;
}

.tbmap-layers__link {
    border: none;
    background: none;
    padding: 0;
    color: #156CE1;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
}

.tbmap-layers__link:hover {
    text-decoration: underline;
}

/* Подложки: карточки с превью в один ряд */
.tbmap-layers__basemaps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.tbmap-basemap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    color: #5E636E;
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
}

.tbmap-basemap__img {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    background: #F1F3F9 center / cover no-repeat;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
    transition: box-shadow .15s;
}

.tbmap-basemap:hover .tbmap-basemap__img {
    box-shadow: inset 0 0 0 2px #B9D3F6;
}

.tbmap-basemap.active .tbmap-basemap__img {
    box-shadow: inset 0 0 0 2px #156CE1;
}

.tbmap-basemap.active {
    color: #2F3237;
    font-weight: 600;
}

/* Группы кадастровых слоёв */
.tbmap-layers__groups {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tbmap-group {
    display: flex;
    flex-direction: column;
}

.tbmap-group__head,
.tbmap-layer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
}

.tbmap-group__head:hover,
.tbmap-layer:hover {
    background: #F7F8FB;
}

.tbmap-group__title {
    color: #2F3237;
    font-size: 13px;
    font-weight: 500;
}

.tbmap-layer {
    padding-left: 14px;
    color: #5E636E;
    font-size: 13px;
}

/* Переключатель */
.tbmap-switch {
    --w: 24px;
    --h: 14px;
    position: relative;
    flex: none;
    width: var(--w);
    height: var(--h);
}

.kadastr__maps .tbmap-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.tbmap-switch i {
    position: absolute;
    inset: 0;
    border-radius: 99px;
    background: #DDE1EA;
    transition: background .15s;
    pointer-events: none;
}

.tbmap-switch i::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(var(--h) - 4px);
    height: calc(var(--h) - 4px);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
    transition: transform .15s;
}

.tbmap-switch input:checked + i {
    background: #156CE1;
}

.tbmap-switch input:checked + i::after {
    transform: translateX(calc(var(--w) - var(--h)));
}

.tbmap-switch input:indeterminate + i {
    background: #8FD8FF;
}

/* Прозрачность */
.kadastr__maps .tbmap-layers__opacity input {
    width: 100%;
    height: 4px;
    accent-color: #156CE1;
    cursor: pointer;
}

.tbmap-layers__opacity-value {
    color: #8F96A3;
    font-weight: 400;
}

/* ---------- Кнопки поверх карты (новая карта) ---------- */
.kadastr__maps--ml .box__menu {
    top: 10px;
}

.kadastr__maps--ml .box__menu.infrastructure {
    left: 10px;
}

/* справа колонка зума шириной 36px */
.kadastr__maps--ml .box__menu.layers {
    right: 56px;
}

.kadastr__maps--ml .btn__to__map {
    top: 10px;
    left: 136px;
}

.kadastr__maps--ml .btn__open__menu,
.kadastr__maps--ml .btn__to__map {
    height: 36px;
    box-sizing: border-box;
    padding: 0 12px;
    gap: 8px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, .96);
    /* кнопки тише панелей: тонкая обводка и короткая тень */
    box-shadow: 0 0 0 1px rgba(17, 24, 39, .08), 0 1px 3px rgba(17, 24, 39, .12);
    color: #2F3237;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    transition: background .15s, box-shadow .15s;
}

.kadastr__maps--ml .btn__open__menu:hover,
.kadastr__maps--ml .btn__to__map:hover {
    background: #fff;
    box-shadow: 0 0 0 1px rgba(17, 24, 39, .12), 0 2px 6px rgba(17, 24, 39, .14);
    color: #2F3237;
}

.kadastr__maps--ml .btn__open__menu:focus-visible,
.kadastr__maps--ml .btn__to__map:focus-visible,
.kadastr__maps--ml .tbmap-basemap:focus-visible,
.kadastr__maps--ml .tbmap-layers__link:focus-visible,
.tbmap .maplibregl-ctrl button:focus-visible {
    outline: 2px solid #156CE1;
    outline-offset: 2px;
}

.kadastr__maps--ml .tbmap-switch:has(input:focus-visible) i,
.kadastr__maps--ml .infrastructure input[type="checkbox"]:focus-visible {
    outline: 2px solid #156CE1;
    outline-offset: 2px;
}

/* Открытые панели приподняты сильнее кнопок и появляются от кнопки */
.kadastr__maps--ml .popup__content:not(.hide) {
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(17, 24, 39, .18), 0 2px 6px rgba(17, 24, 39, .08);
    animation: tbmap-pop .12s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .kadastr__maps--ml *,
    .kadastr__maps--ml *::after {
        animation: none !important;
        transition: none !important;
    }
}

.kadastr__maps--ml .btn__open__menu img,
.kadastr__maps--ml .btn__to__map img {
    width: 18px;
    height: 18px;
}

/* стрелка меню разворачивается, пока меню открыто */
.kadastr__maps--ml .btn__open__menu img:last-child {
    width: 14px;
    height: 14px;
    opacity: .6;
    transition: transform .2s;
}

.kadastr__maps--ml .box__menu:has(.popup__content:not(.hide)) .btn__open__menu img:last-child {
    transform: rotate(180deg);
}

.kadastr__maps--ml .box__menu:has(.popup__content:not(.hide)) .btn__open__menu {
    background: #fff;
    box-shadow: 0 0 0 2px #156CE1, 0 4px 14px rgba(17, 24, 39, .18);
}

.kadastr__maps--ml .popup__content {
    top: 44px;
}

/* Меню «Рядом» и «Слои» не выходят за кадр карты высотой 400px:
   10px отступ + 44px кнопка + панель + 10px снизу */
.kadastr__maps--ml .infrastructure .popup__content {
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.kadastr__maps--ml .infrastructure .list__box label {
    padding: 5px 8px;
    flex: none;
}

/* Тонкий скролл без серой дорожки в обоих меню */
.kadastr__maps--ml .infrastructure .popup__content,
.kadastr__maps--ml .tbmap-layers__panel {
    scrollbar-width: thin;
    scrollbar-color: #DDE1EA transparent;
}

.kadastr__maps--ml .infrastructure .popup__content::-webkit-scrollbar,
.kadastr__maps--ml .tbmap-layers__panel::-webkit-scrollbar {
    width: 4px;
    height: 0;
}

.kadastr__maps--ml .infrastructure .popup__content::-webkit-scrollbar-track,
.kadastr__maps--ml .tbmap-layers__panel::-webkit-scrollbar-track {
    background: transparent;
}

.kadastr__maps--ml .infrastructure .popup__content::-webkit-scrollbar-thumb,
.kadastr__maps--ml .tbmap-layers__panel::-webkit-scrollbar-thumb {
    background: #DDE1EA;
    border-radius: 4px;
}

.kadastr__maps--ml:fullscreen .infrastructure .popup__content,
.kadastr__maps--ml:fullscreen .tbmap-layers__panel {
    max-height: calc(100vh - 74px);
}

/* Контролы MapLibre в том же стиле */
.tbmap .maplibregl-ctrl-top-right .maplibregl-ctrl {
    margin: 10px 10px 0 0;
}

.tbmap .maplibregl-ctrl-group {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(17, 24, 39, .08), 0 1px 3px rgba(17, 24, 39, .12);
}

.tbmap .maplibregl-ctrl-group button {
    width: 36px;
    height: 36px;
    box-sizing: border-box;
}

.tbmap .maplibregl-ctrl-group button + button {
    border-top: 1px solid #F1F3F9;
}

.tbmap .maplibregl-ctrl-group button:not(:disabled):hover {
    background-color: #F7F8FB;
}

/* Ссылка «Открыть в Яндекс Картах» — плашкой в правом нижнем углу, над атрибуцией */
.tbmap .tbmap-yandex-link a {
    display: block;
    padding: 4px 9px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 1px 4px rgba(17, 24, 39, .15);
    color: #2F3237;
    font-size: 11px;
    line-height: 14px;
    text-decoration: none;
    white-space: nowrap;
}

.tbmap .tbmap-yandex-link a:hover {
    color: #156CE1;
}
/* Масштаб: подпись на матовой плашке, под ней линейка с засечками.
   Ширину элемента MapLibre задаёт инлайном = длина отрезка, поэтому линейку
   рисуем по всей ширине через фон, а не рамкой */
.tbmap .maplibregl-ctrl-bottom-left .maplibregl-ctrl-scale {
    margin: 0 0 14px 14px;
    padding: 2px 0 7px;
    box-sizing: content-box;
    border: none;
    border-radius: 6px;
    background:
        linear-gradient(#2F3237, #2F3237) left bottom 3px / 100% 2px no-repeat,
        linear-gradient(#2F3237, #2F3237) left bottom 3px / 2px 7px no-repeat,
        linear-gradient(#2F3237, #2F3237) right bottom 3px / 2px 7px no-repeat,
        rgba(255, 255, 255, .94);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .94), 0 1px 4px 4px rgba(17, 24, 39, .1);
    color: #2F3237;
    font-size: 11px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 14px;
    text-align: center;
}

.tbmap .maplibregl-ctrl-attrib.maplibregl-compact {
    margin: 0 10px 10px 0;
}

/* ---------- Координаты клика: плашка над масштабом, клик копирует ---------- */
.kadastr__maps--ml #coordsClickKadMap {
    bottom: 51px;
    left: 10px;
    gap: 6px;
    width: auto;
    height: 28px;
    padding: 0 8px 0 10px;
    box-sizing: border-box;
    border-radius: 8px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 0 0 1px rgba(17, 24, 39, .08), 0 1px 3px rgba(17, 24, 39, .12);
    cursor: pointer;
    transition: box-shadow .15s;
}

.kadastr__maps--ml #coordsClickKadMap.hide {
    display: none;
}

.kadastr__maps--ml #coordsClickKadMap:hover {
    background: #fff;
    box-shadow: 0 0 0 1px rgba(17, 24, 39, .12), 0 2px 6px rgba(17, 24, 39, .14);
}

.kadastr__maps--ml #coordsClickKadMap input {
    width: 17ch;
    padding: 0;
    color: #2F3237;
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    outline: none;
}

.kadastr__maps--ml #coordsClickKadMap input:hover {
    color: #2F3237;
}

/* иконка «копировать» */
.kadastr__maps--ml #coordsClickKadMap::after {
    content: '';
    flex: none;
    width: 14px;
    height: 14px;
    background: #8F96A3;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='12' height='12' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='12' height='12' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: background .15s;
}

.kadastr__maps--ml #coordsClickKadMap:hover::after {
    background: #156CE1;
}

/* после копирования иконка становится галочкой, пока висит подсказка */
.kadastr__maps--ml #coordsClickKadMap:has(.notice__clipboard:not(.hide))::after {
    background: #12813F;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

.kadastr__maps--ml #coordsClickKadMap .notice__clipboard {
    bottom: calc(100% + 6px);
    left: 0;
    padding: 4px 8px;
    border-radius: 6px;
    background: #2F3237;
    color: #fff;
    font-size: 11px;
    white-space: nowrap;
    animation: tbmap-pop .12s ease-out;
}

/* ---------- Мобильная ширина ---------- */
@media (max-width: 768px) {
    /* общий margin: 15px съедает ширину — по бокам карта до краёв карточки */
    .kadastr__maps--ml:not(:fullscreen) {
        margin: 12px 0 0;
    }

    /* старые правила переносят «Слои» во второй ряд под кнопки высотой 28px;
       на новой карте оставляем её в первом ряду иконкой рядом с зумом */
    #real_estate_info .kadastr__maps--ml .box__menu.layers {
        top: 10px;
        left: auto;
        right: 56px;
    }

    .kadastr__maps--ml .box__menu.layers .btn__open__menu {
        width: 36px;
        padding: 0;
        gap: 0; /* скрытый текст «Слои» иначе даёт отступ и сдвигает иконку */
        justify-content: center;
        font-size: 0;
    }

    .kadastr__maps--ml .box__menu.layers .btn__open__menu img:first-child {
        margin: 0;
    }

    .kadastr__maps--ml .box__menu.layers .btn__open__menu img:last-child {
        display: none;
    }

    #real_estate_info .kadastr__maps--ml .layers .popup__content {
        left: auto;
        right: 0;
    }

    .kadastr__maps--ml .tbmap-layers__panel {
        width: min(320px, calc(100vw - 110px));
    }

    /* меню «Рядом» не шире карты */
    .kadastr__maps--ml .infrastructure .popup__content {
        max-width: calc(100vw - 60px);
    }
}

/* ---------- Редактор полигона (TBMap.drawPolygon) ---------- */
.tbmap-vertex {
    width: 12px;
    height: 12px;
    box-sizing: border-box;
    border: 2px solid #0000FF;
    border-radius: 50%;
    background: #fff;
    cursor: move;
}

.tbmap-vertex--first {
    width: 14px;
    height: 14px;
    background: #0000FF;
    cursor: pointer;
}

.tbmap-vertex--mid {
    width: 9px;
    height: 9px;
    border-width: 1.5px;
    opacity: .7;
    cursor: copy;
}

.tbmap-vertex--mid:hover {
    opacity: 1;
}

/* ---------- Метки с подписью: точки маршрута, финиш, найденный адрес ---------- */
.tbmap-pin {
    position: relative;
    width: 22px;
    height: 28px;
    --pin-color: #156CE1;
}

.tbmap-pin__drop {
    position: absolute;
    left: 2px;
    top: 0;
    width: 18px;
    height: 18px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: var(--pin-color);
    box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(17, 24, 39, .3);
}

.tbmap-pin--red {
    --pin-color: #F5364C;
}

.tbmap-pin--green {
    --pin-color: #12b600;
}

/* точка маршрута: кружок, его можно перетаскивать */
.tbmap-pin--dot {
    width: 14px;
    height: 14px;
    cursor: grab;
}

.tbmap-pin--dot .tbmap-pin__drop {
    left: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transform: none;
}

.tbmap-pin__caption {
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 1px 3px rgba(17, 24, 39, .2);
    color: #2F3237;
    font-size: 12px;
    font-weight: 500;
    line-height: 14px;
    white-space: nowrap;
}

/* ---------- Линейка (TBMap.ruler) ---------- */
.tbmap .tbmap-ruler-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2F3237;
}

.tbmap .tbmap-ruler-btn.active {
    background: #E8F1FD;
    color: #156CE1;
}

.tbmap-ruler-point {
    position: relative;
    width: 10px;
    height: 10px;
    cursor: pointer;
}

.tbmap-ruler-point i {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    border: 2px solid #156CE1;
    border-radius: 50%;
    background: #fff;
}

.tbmap-ruler-point:hover i {
    border-color: #F5364C;
}

.tbmap-ruler-point span {
    position: absolute;
    left: 100%;
    top: 50%;
    margin-left: 6px;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 1px 3px rgba(17, 24, 39, .2);
    color: #2F3237;
    font-size: 11px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    transform: translateY(-50%);
    pointer-events: none;
}

.tbmap-ruler-point--last span {
    background: #156CE1;
    color: #fff;
    font-weight: 600;
}

/* Простые попапы («Загрузка ....», «Объекты не найдены»): справа место под крестик */
.tbmap-popup:not([class*="tbmap-popup--"]) .maplibregl-popup-content {
    padding-right: 40px;
}

/* Карта заблокирована, пока грузятся данные (TBMap.lock) */
.tbmap--locked .maplibregl-canvas {
    cursor: progress !important;
}

/* Пока карта заблокирована загрузкой — тонкая бегущая полоска сверху */
.tbmap--locked::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    width: 30%;
    height: 3px;
    border-radius: 0 2px 2px 0;
    background: #156CE1;
    pointer-events: none;
    animation: tbmap-progress 1s ease-in-out infinite;
}

@keyframes tbmap-progress {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(340%);
    }
}

/* Загрузка карты лота — то же тонкое кольцо, что на /map */
.kadastr__maps--ml .loader,
#real_estate_info .kadastr__maps--ml .loader {
    z-index: 5;
    width: 32px;
    height: 32px;
    right: calc(50% - 16px);
    top: calc(50% - 16px);
    border: 3px solid rgba(21, 108, 225, .15);
    border-top-color: #156CE1;
    border-radius: 50%;
    box-sizing: border-box;
    background: none;
    animation: tbmap-spin .8s linear infinite;
}

.kadastr__maps--ml .loader::before,
.kadastr__maps--ml .loader::after {
    display: none;
}

@keyframes tbmap-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Балун поверх кнопок и панелей карты (поиск, «Слои», анализ зоны — z-index до 4),
   как было у Яндекса; открытые меню карточки лота (999) всё равно выше */
.tbmap .maplibregl-popup {
    z-index: 5;
}

/* Карточка лота: в realEstateAnalyticsNew.css «#KadastrMap * {box-sizing: unset}» —
   попапы и кнопки карты рассчитаны на border-box, иначе шире на величину отступов */
#KadastrMap.tbmap .maplibregl-popup *,
#KadastrMap.tbmap .maplibregl-ctrl * {
    box-sizing: border-box;
}
