/* Мобильная карта /companies/nearby и /companies/nearby_test. На широком экране остаётся список. */
.nearby-test-sheet, .nearby-test-back, .directory-nearby-view3d { display: none; }
/* Фокус на метке не должен прокручивать внутренний контейнер карты. */
.company-directory-nearby .ymaps3--map-container { overflow: clip; }

@media (max-width: 900px) {
    .company-directory-nearby .company-directory-test__workspace,
    .company-directory-nearby.is-expanded .company-directory-test__workspace {
        position: fixed;
        inset: var(--company-directory-expanded-top, 0px) 0 var(--company-directory-expanded-bottom, 0px);
        z-index: 49;
        display: block;
        width: 100%;
        height: calc(100dvh - var(--company-directory-expanded-top, 0px) - var(--company-directory-expanded-bottom, 0px));
        min-height: 0;
        max-height: none;
        border: 0;
        border-radius: 0;
    }
    .company-directory-nearby .company-directory-test__map-panel,
    .company-directory-nearby.is-expanded .company-directory-test__map-panel {
        position: absolute;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
        min-height: 0;
        border: 0;
    }
    .company-directory-nearby .company-directory-test__list-panel {
        position: absolute;
        z-index: 10;
        inset: max(8px, env(safe-area-inset-top)) 8px auto;
        border: 1px solid #dce6eb;
        border-radius: 18px;
        background: #fff;
        box-shadow: 0 4px 24px #18374d24;
    }
    .company-directory-nearby .company-directory-test__header {
        grid-template-columns: 32px minmax(0, 1fr) auto;
        padding: 8px;
        gap: 6px;
    }
    .company-directory-nearby .company-directory-test__header h1 { margin: 0; font-size: 16px; }
    .company-directory-nearby .nearby-test-back {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 40px;
        color: #33566c;
        font-size: 23px;
        border-radius: 10px;
    }
    .company-directory-nearby .directory-nearby-mobile-filters { min-height: 40px; padding: 6px 8px; }
    .company-directory-nearby .company-directory-test__list,
    .company-directory-nearby .company-directory-test__context,
    .company-directory-nearby #companies-test-expand,
    .company-directory-nearby #companies-test-map-toggle { display: none; }
    .company-directory-nearby .directory-nearby-categories { padding: 0 8px 6px; border: 0; }
    .company-directory-nearby .directory-nearby-chips button { min-height: 36px; padding: 6px 12px; font-size: 12px; }
    .company-directory-nearby .company-directory-test__load-more {
        padding: 0 12px 7px;
        min-height: 0;
        border: 0;
        background: transparent;
        font-size: 10px;
        line-height: 1.4;
    }
    .company-directory-nearby .company-directory-test__map-actions {
        top: calc(var(--nearby-test-controls-bottom, 130px) + 8px);
        left: 12px;
        right: auto;
    }
    .company-directory-nearby .company-directory-test__map-actions button { min-height: 36px; padding: 6px 10px; }
    .company-directory-nearby .directory-nearby-view3d { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; }
    .company-directory-nearby .directory-nearby-view3d[aria-pressed="true"] { background: #087fae; border-color: #087fae; color: white; }
    .company-directory-nearby .company-directory-test__map-feedback { bottom: 28px; }
    .company-directory-nearby .ymaps3--map-copyrights { bottom: var(--nearby-test-sheet-height, 0px); }
    .company-directory-nearby .ymaps3--controls_right:has(.ymaps3--zoom-control) {
        top: calc(var(--nearby-test-controls-bottom, 130px) + 8px);
        bottom: auto;
        justify-content: flex-start;
    }
    .company-directory-nearby:has(.nearby-test-sheet:not([hidden])) .company-directory-test__map-feedback { display: none; }
    .company-directory-nearby .nearby-test-sheet:not([hidden]) {
        position: absolute;
        z-index: 20;
        bottom: 0;
        left: 0;
        right: 0;
        display: flex;
        flex-direction: column;
        max-height: min(48dvh, max(160px, calc(100% - var(--nearby-test-controls-bottom, 130px) - 190px)));
        padding-bottom: env(safe-area-inset-bottom);
        border-radius: 24px 24px 0 0;
        background: white;
        color: #153249;
        box-shadow: 0 -8px 36px #18374d29;
        animation: nearby-test-sheet-enter .22s ease-out;
    }
    .nearby-test-sheet__handle {
        display: flex;
        flex: 0 0 24px;
        justify-content: center;
        align-items: center;
        cursor: grab;
        touch-action: none;
    }
    .nearby-test-sheet__handle span { width: 38px; height: 4px; border-radius: 4px; background: #c4d3dd; }
    .nearby-test-sheet__close {
        position: absolute;
        z-index: 1;
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        border: 0;
        border-radius: 50%;
        background: #edf3f6;
        color: #415c6e;
        font-size: 26px;
        cursor: pointer;
    }
    .nearby-test-sheet__body { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; }
    .nearby-test-sheet .company-preview-card {
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr);
        gap: 10px 12px;
        margin: 0;
        padding: 4px 16px 18px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: white;
        content-visibility: visible;
        contain: none;
        cursor: auto;
    }
    .nearby-test-sheet .company-preview-card__media { width: 44px; height: 44px; border-radius: 14px; }
    .nearby-test-sheet .company-preview-card__topline { padding-right: 42px; }
    .nearby-test-sheet .company-preview-card__title { font-size: 18px; line-height: 1.25; }
    .nearby-test-sheet .company-preview-card__category { margin-top: 5px; font-size: 13px; line-height: 1.4; padding-right: 36px; white-space: normal; overflow-wrap: anywhere; }
    .nearby-test-sheet .company-preview-card__title { overflow-wrap: anywhere; }
    .nearby-test-sheet .company-preview-card__facts { margin-top: 12px; gap: 8px; font-size: 12px; }
    .nearby-test-sheet .company-preview-card__actions { grid-column: 1 / -1; margin: 4px 0 0; gap: 8px; }
    .nearby-test-sheet .company-preview-card__actions a { min-height: 40px; font-size: 12px; padding: 8px 12px; }
    .nearby-test-sheet.is-dragging { animation: none; }
    @keyframes nearby-test-sheet-enter { from { transform: translateY(100%); } to { transform: translateY(0); } }
}
@media (prefers-reduced-motion: reduce) {
    .company-directory-nearby .nearby-test-sheet:not([hidden]) { animation: none; }
}
