.ydv2-courier,
.ydv2-pvz {
    margin-top: 10px;
}

.ydv2-courier-form {
    display: block;
    max-width: 620px;
}

.ydv2-input {
    width: 100%;
    box-sizing: border-box;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #c9cdd4;
    border-radius: 4px;
}

textarea.ydv2-readonly-property {
    display: block;
    width: 100%;
    min-height: 38px;
    overflow: hidden;
    resize: none;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ydv2-button {
    min-height: 30px;
    font-size: 12px;
    padding: 8px 14px;
    border: 0;
    border-radius: 4px;
    background: #705b9b;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
}
.popup-window-with-titlebar .popup-window-content {
    border-radius: 8px;
    background-color: transparent;
}
.ydv2-button:hover {
    background: #a284bf;
}

.ydv2-button-secondary {
 /*   min-height: 30px;
    padding: 5px 10px;
    background: #eef2f7;
    color: #1f2937;*/
}
.ydv2-selected-title{
    font-weight: 600;
    font-size: 13px;
}
.ydv2-button-secondary:hover {
    background: #dde4ee;
}

.ydv2-selected {
    margin-top: 0;
    font-weight: 600;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.ydv2-message {
    margin: 8px 0;
    padding: 10px 12px;
    border: 1px solid #f0d88a;
    border-radius: 4px;
    background: #fff8db;
    color: #5f4b00;
}

.yd-v2-error {
    border-color: #efb0b0;
    background: #fff1f1;
    color: #8a1f1f;
}

.ydv2-popup {
    display: block;
    width: 100%;
    max-width: 1060px;
    max-height: calc(100vh - 140px);
    overflow: hidden;
}

.ydv2-inline-modal {
    position: fixed;
    z-index: 2147483000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(0, 0, 0, .35);
}

.ydv2-inline-modal-content {
    width: 100%;
    max-width: 1100px;
    max-height: calc(100vh - 24px);
    overflow: auto;
    border-radius: 8px;
    background: #fff;
}

.ydv2-popup > .ydv2-message {
    grid-column: 1 / -1;
}

.ydv2-popup-message {
    display: block;
    min-width: 320px;
}

.ydv2-popup-message .ydv2-button {
    width: auto;
}

.ydv2-loading {
    display: flex;
    min-height: 120px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px 12px;
    text-align: center;
}

.ydv2-loading-spinner {
    display: block;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border: 3px solid #d7dbe3;
    border-top-color: #705b9b;
    border-radius: 50%;
    animation: ydv2-spin .8s linear infinite;
}

.ydv2-map > .ydv2-loading {
    height: 100%;
    box-sizing: border-box;
}

@keyframes ydv2-spin {
    to {
        transform: rotate(360deg);
    }
}

.ydv2-popup-body {
    position: relative;
    display: grid;
    grid-template-columns: minmax(420px, 1fr) minmax(280px, 360px);
    gap: 16px;
    height: min(68vh, 620px);
    min-height: 420px;
}

.ydv2-pvz-loading-overlay {
    position: absolute;
    z-index: 10;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.ydv2-pvz-loading-overlay .ydv2-loading {
    width: 100%;
}

.ydv2-popup-footer {
    display: flex;
    justify-content: center;
    padding: 18px 0 12px;
}

.ydv2-popup-close {
    min-width: 220px;
    min-height: 44px;
}

.ydv2-map {
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 1px solid #d7dbe3;
}

.ydv2-map-message {
    display: flex;
    height: 100%;
    min-height: 280px;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #5f4b00;
    background: #fff8db;
    text-align: center;
}

.ydv2-list {
    flex: 1;
    min-height: 0;
    overflow: auto;
    height: auto;
    padding-right: 4px;
}

.ydv2-list-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
}

.ydv2-pvz-search {
    box-sizing: border-box;
    width: 100%;
    min-height: 38px;
    margin-bottom: 10px;
    padding: 8px 10px;
    border: 1px solid #c9cdd4;
    border-radius: 4px;
    background: #fff;
    color: #1f2937;
}

.ydv2-list-empty {
    padding: 16px 0;
    color: #666;
}

.ydv2-point {
    padding: 12px 0;
    border-bottom: 1px solid #e2e6ee;
}

.ydv2-point-title {
    font-weight: 700;
}

.ydv2-point-schedule {
    color: #666;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: none;
}

.ydv2-point-address {
    margin: 6px 0 8px;
}

.ydv2-point-type {
    margin-bottom: 10px;
}

.ydv2-map-select {
    margin-top: 8px;
}
.popup-window-with-titlebar .popup-window-content{
    padding: 0;
}

.ydv2-pvz-popup-window.popup-window.popup-window-with-titlebar {
    padding: 1rem;
}

@media (max-width: 900px) {
    .ydv2-popup {
        max-height: calc(100vh - 96px);
    }

    .ydv2-popup-body {
        grid-template-columns: minmax(320px, 1fr) minmax(240px, 300px);
        gap: 12px;
    }
}

@media (max-width: 760px) {
    .ydv2-pvz-popup-window {
        position: fixed !important;
        top: auto !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: none !important;
        max-height: calc(100vh - 12px) !important;
        margin: 0 !important;
        border-radius: 12px 12px 0 0 !important;
    }

    .ydv2-pvz-popup-window .popup-window-content {
        max-height: calc(100vh - 64px);
        overflow: auto;
        border-radius: 8px 8px 0 0 !important;
    }

    .ydv2-pvz-popup-window .ydv2-popup {
        max-height: none;
        overflow: visible;
    }

    .ydv2-inline-modal-content .ydv2-popup {
        max-height: none;
        overflow: visible;
    }

    .ydv2-inline-modal {
        align-items: flex-end;
        padding: 0;
    }

    .ydv2-inline-modal-content {
        max-height: calc(100vh - 12px);
        border-radius: 12px 12px 0 0;
    }

    .ydv2-popup-body {
        display: block;
    }

    .ydv2-courier-form {
        display: block;
        width: 100%;
        max-width: none;
    }

    .ydv2-courier-address-field {
        width: 100%;
    }

    .ydv2-button {
        margin-top: 8px;
        width: 100%;
    }

    .ydv2-popup {
        max-height: calc(100vh - 72px);
        overflow: auto;
    }

    .ydv2-popup-body {
        height: auto;
        min-height: 0;
        overflow: visible;
        padding: 0 0 8px;
    }

    .ydv2-popup-footer {
        justify-content: center;
        padding: 12px 0 8px;
        position: relative;
        z-index: 3;
        background: #fff;
    }

    .ydv2-popup-close {
        margin-top: 0;
        width: 100%;
    }

    .ydv2-map,
    .ydv2-list {
        height: auto;
    }

    .ydv2-list-column {
        display: block;
        height: auto;
        position: relative;
        overflow: visible;
        padding-top: 12px;
        border-top: 1px solid #e5e7eb;
    }

    .ydv2-map {
        position: relative;
        z-index: 1;
        flex: none;
        min-height: 300px;
        height: 48vh;
    }

    .ydv2-list {
        display: block;
        flex: none;
        height: auto;
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .ydv2-pvz-search {
        position: sticky;
        top: 0;
        z-index: 4;
        margin-top: 0;
        background: #fff;
        box-shadow: 0 2px 6px rgba(31, 41, 55, .12);
        font-size: 16px;
    }

    .ydv2-input {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .ydv2-popup {
        max-height: calc(100vh - 48px);
    }

    .ydv2-popup-message {
        min-width: 0;
    }

    .ydv2-map {
        min-height: 260px;
        height: 42vh;
    }

    .ydv2-list {
        max-height: none;
    }

    .ydv2-list-column {
        padding-top: 10px;
    }
}
.ydv2-courier-address-field{position:relative;flex:1;min-width:0}
.ydv2-courier-address-field,
.ydv2-courier-address-field .ydv2-input {
    width: 100%;
}
.ydv2-courier-details-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}
.ydv2-courier-details-row .ydv2-input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
}
.ydv2-courier-details-row .ydv2-button {
    flex: 0 0 auto;
    margin-top: 0;
    width: auto;
}
.ydv2-courier-suggest{position:absolute;z-index:2147483000;top:calc(100% + 4px);right:0;left:0;display:block;margin:0;padding:4px 0;list-style:none;background:#fff;border:1px solid #c9cdd4;border-radius:4px;box-shadow:0 5px 16px rgba(31,41,55,.14);pointer-events:auto}
.ydv2-courier-suggest[hidden]{display:none}
.ydv2-courier-suggest li{margin:0;padding:0}
.ydv2-courier-suggest button{display:flex;flex-direction:column;width:100%;padding:9px 10px;border:0;background:#fff;color:#1f2937;text-align:left;cursor:pointer}
.ydv2-courier-suggest button:hover,.ydv2-courier-suggest button:focus{background:#f1f5f9;outline:0}
.ydv2-courier-suggest strong{font-weight:600}
.ydv2-courier-suggest span{margin-top:2px;color:#6b7280;font-size:12px}

/* Keep the Bitrix popup itself fixed to the visual viewport on mobile. The
 * popup content is the scrollable region; the page scroll is blocked by the
 * native PopupWindow disableScroll option. */
@media (max-width: 760px) {
    .ydv2-pvz-popup-window {
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: var(--ydv2-pvz-viewport-height, 100vh) !important;
        max-width: none !important;
        max-height: var(--ydv2-pvz-viewport-height, 100vh) !important;
        min-height: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        overscroll-behavior: contain;
    }

    .ydv2-pvz-popup-window .popup-window-content {
        display: flex;
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding: 0 !important;
    }

    .ydv2-pvz-popup-window .ydv2-popup {
        display: block;
        height: auto;
        max-height: none;
        overflow: visible;
    }

    .ydv2-pvz-popup-window .ydv2-popup-body {
        display: block;
        height: auto;
        min-height: 0;
        overflow: visible;
        padding: 0 0 8px;
    }

    .ydv2-pvz-popup-window .ydv2-map {
        flex: none;
        height: auto;
        min-height: 260px;
        height: 42vh;
    }

    .ydv2-pvz-popup-window .ydv2-list-column {
        display: block;
        height: auto;
        min-height: 0;
        overflow: visible;
        padding-top: 12px;
    }

    .ydv2-pvz-popup-window .ydv2-pvz-search {
        position: sticky;
        top: 0;
        z-index: 4;
        background: #fff;
    }

    .ydv2-pvz-popup-window .ydv2-list {
        display: block;
        height: auto;
        max-height: none;
        overflow: visible;
    }

    .ydv2-pvz-popup-window .ydv2-popup-footer {
        position: relative;
        z-index: 3;
        background: #fff;
    }
}
