.route-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 24px;
    align-items: start;
}

.route-left {
    display: flex;
    flex-direction: column;
}

.route-right {
    position: sticky;
    top: 20px;
    /*height: calc(100vh - 100px);*/
    /*align-self: start;*/
}

#map {
    width: 100%;
    height: 70vh;
    min-height: 400px;
    border: 2px solid #000;
    border-radius: 4px;
}

/* -------------------- адреса -------------------- */

.address-item {
    margin-bottom: 15px;
    transition: all 0.3s ease;
    position: relative;
}

.address-item.route-address-invalid .input-group {
    border-color: #d9534f;
    box-shadow: 0 0 0 2px rgba(217, 83, 79, 0.15);
}

.address-item:hover {
    /*transform: translateX(5px);*/
}

.input-group {
    border: 2px solid #000;
    border-radius: 4px;
}

.input-group .form-control {
    border: none;
    box-shadow: none;
    height: 38px;
    font-size: 13px;
    line-height: 1.3;
}

.address-preview {
    display: -webkit-box;
    margin: 4px 44px 0 44px;
    color: #6d6d6d;
    font-size: 12px;
    line-height: 1.25;
    max-height: 2.5em;
    white-space: normal;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.address-item.address-editing .address-preview,
.address-preview.is-empty {
    display: none;
}

.input-group-addon {
    border: none;
    background-color: transparent;
    vertical-align: top;
}

/* -------------------- drag -------------------- */

.handle {
    cursor: move;
    min-width: 40px;
    text-align: center;
    user-select: none;
    border-right: 2px solid #000;
    padding: 6px 0;
}

.drag-arrows {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.arrow-up {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid #000;
    margin-bottom: 3px;
}

.arrow-down {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid #000;
    margin-top: 3px;
}

/* -------------------- удалить адрес -------------------- */

.input-group-addon.remove-address {
    cursor: pointer;
    color: #999;
    border-left: 2px solid #000;

    font-size: 20px;      /* размер крестика */
    line-height: 1;

    vertical-align: top;
    padding: 2px 10px 8px 10px;

    text-align: center;
    width: 36px;
}

.input-group-addon.remove-address:hover {
    color: #666;
    transform: scale(1.1);
}

/* -------------------- добавить адрес -------------------- */

.add-address-row {
    margin: 10px 0 0 0;
}

.add-address-button {
    background: none;
    border: none;
    color: #337ab7;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.add-address-button:hover {
    color: #23527c;
    transform: translateX(5px);
}

.add-address-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* -------------------- тоннаж -------------------- */

.field-order-tonnage {
    margin: 0 0 10px 0;
}

.tonnage-dropdown {
    border: 2px solid #000;
    border-radius: 4px;
    height: 38px;
    font-size: 14px;
    background-color: #f8f9fa;
}

.tonnage-dropdown:focus {
    outline: none;
    border-color: #000;
}

/* -------------------- кнопка -------------------- */

.btn-primary {
    background-color: #337ab7;
    border-color: #2e6da4;
    color: white;
    padding: 10px 20px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.btn-primary:hover:not(:disabled) {
    background-color: #286090;
    border-color: #204d74;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #ccc;
    border-color: #999;
}

/* -------------------- sortable -------------------- */

.ui-sortable-placeholder {
    border: 2px dashed #000;
    background-color: #f5f5f5;
    height: 60px;
    margin-bottom: 15px;
}

/* -------------------- suggest -------------------- */

.ymaps-2-1-79-suggest {
    z-index: 9999;
    box-shadow: 0 6px 12px rgba(0,0,0,0.175);
    border: 2px solid #000;
    border-radius: 4px;
    margin-top: 2px;
    max-height: 300px;
    overflow-y: auto;
}

.ymaps-2-1-79-suggest-item {
    padding: 10px 15px;
    font-size: 14px;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
}

.route-suggest-title {
    display: block;
    font-size: 14px;
    line-height: 1.25;
    color: #1f1f1f;
}

.route-suggest-subtitle {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.2;
    color: #7a7a7a;
}

.ymaps-2-1-79-suggest-item:hover {
    background-color: #f5f5f5;
}

.ymaps-2-1-79-suggest-item__highlight {
    color: #337ab7;
    font-weight: bold;
}

.address-item {
    position: relative;
}

/* -------------------- страница -------------------- */

.route-page {
    margin-top: 20px;
}

#map-toggle {
    display: inline-block;
    margin-top: 8px;
    margin-bottom: 16px;
    text-align: left;
}

#map-wrap {
    overflow: hidden;
    max-height: 72vh;
    margin-bottom: 8px;
    opacity: 1;
    transition: max-height 0.25s ease, opacity 0.25s ease;
}

#map-wrap.collapsed {
    max-height: 0;
    opacity: 0;
}

#map-wrap.map-hidden {
    display: none;
}

#map-wrap[hidden] {
    display: none !important;
}

#index2-page #map {
    height: 60vh;
    min-height: 320px;
}

#index2-page .row > [class*='col-'] {
    margin-bottom: 12px;
}

#index2-page .checkbox label,
#index2-page .radio-inline {
    line-height: 1.45;
}

#index2-page .index2-cargo-hint {
    margin-top: 6px;
    margin-bottom: 8px;
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.28;
    color: #5c6670;
    background-color: #f8fafb;
    border-color: #e8eef2;
}

#index2-page .index2-cargo-hint strong {
    color: #4e5963;
    font-weight: 600;
}

#index2-page .index2-cargo-hint-body {
    position: relative;
    max-height: 68px;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

#index2-page .index2-cargo-hint[data-expanded="1"] .index2-cargo-hint-body {
    max-height: 420px;
    overflow: visible;
}

#index2-page .index2-cargo-hint-body::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 2em;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(248, 250, 251, 0), rgba(248, 250, 251, 0.62) 68%, #f8fafb);
    -webkit-backdrop-filter: blur(1px);
    backdrop-filter: blur(1px);
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.12) 35%, rgba(0, 0, 0, 0.72) 72%, #000 100%);
    mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.12) 35%, rgba(0, 0, 0, 0.72) 72%, #000 100%);
}

#index2-page .index2-cargo-hint[data-expanded="1"] .index2-cargo-hint-body::after {
    display: none;
}

#index2-page .index2-cargo-hint ul {
    margin: 4px 0 0 14px;
    padding: 0;
}

#index2-page .index2-cargo-hint li + li {
    margin-top: 2px;
}

#index2-page .index2-cargo-hint-toggle {
    display: inline-block;
    margin-top: 5px;
    padding: 0;
    color: #337ab7;
    background: transparent;
    border: 0;
    border-bottom: 1px dashed rgba(51, 122, 183, 0.45);
    font-size: 12px;
    line-height: 1.2;
}

#index2-page .index2-cargo-hint-toggle:hover,
#index2-page .index2-cargo-hint-toggle:focus {
    color: #23527c;
    border-bottom-color: rgba(35, 82, 124, 0.7);
    outline: none;
}

#index2-page .index2-client-search-wrap {
    position: relative;
}

#index2-page .index2-client-search-wrap .form-control {
    padding-right: 36px;
}



#index2-page .index2-mode-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
}

#index2-page .index2-mode-options .radio-inline {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding-left: 20px;
    white-space: nowrap;
}

#index2-page .index2-mode-options .radio-inline + .radio-inline {
    margin-left: 0;
}


#index2-page .index2-client-clear {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    z-index: 3;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #8f8f8f;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: inline-block;
    opacity: 0.45;
    padding: 0;
}

#index2-page .index2-client-clear.is-visible {
    opacity: 1;
}

#index2-page .index2-client-clear:hover {
    background: #f1f1f1;
    color: #5f5f5f;
}

#index2-page .index2-rate-row {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 6px;
}

#index2-page .index2-rate-row-hidden {
    display: none;
}

#index2-page .index2-rate-row:last-child {
    margin-bottom: 0;
}

#index2-page .index2-rate-row > input[type="checkbox"] {
    position: static;
    margin: 0;
    margin-left: 0;
    flex: 0 0 auto;
    align-self: center;
    margin-right: 8px;
}

#index2-page .index2-rate-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding-left: 2px;
    line-height: 1.35;
    margin: 0;
    font-weight: 400;
    flex: 1 1 auto;
}

#index2-page .index2-rate-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

#index2-page .index2-rate-rating {
    display: block;
    width: 100%;
    font-size: 11px;
    line-height: 1.2;
}

#index2-page .index2-rate-rating .rating-container {
    display: inline-flex;
    align-items: center;
    margin-left: 0;
    vertical-align: middle;
}

#index2-page .index2-rate-rating .rating-xs {
    font-size: 9px;
}

#index2-page .index2-rate-rating .caption {
    margin-left: 4px;
    font-size: 11px;
    line-height: 1.2;
}

#index2-page .index2-rate-rating .index2-rate-availability-fallback {
    display: inline-block;
    margin-left: 0;
    font-size: 11px;
    line-height: 1.2;
}

#index2-page .index2-rate-info-btn {
    margin-left: 8px;
}

#index2-page .index2-rate-count-wrap {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    white-space: nowrap;
}

#index2-page .index2-rates-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 24px;
    color: #6b6b6b;
    font-size: 13px;
}

#index2-page .index2-rates-loading-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #d9d9d9;
    border-top-color: #7a7a7a;
    border-radius: 50%;
    animation: index2-rates-spin 0.8s linear infinite;
}

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

#index2-page .index2-rate-count-link {
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

#index2-page #refresh-rates.index2-btn-loading {
    opacity: 0.85;
    cursor: progress;
}

#index2-page #refresh-rates:disabled {
    opacity: 0.58;
    cursor: not-allowed;
}

#index2-page #refresh-rates.index2-btn-loading:disabled {
    cursor: progress;
}

#index2-page .index2-rate-count {
    font-weight: 600;
}

#index2-page .index2-rates-show-all-wrap {
    margin-top: 4px;
}

#index2-page .index2-rates-show-all {
    display: inline-block;
    font-size: 13px;
}

#index2-page .index2-rate-info-modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
}

.index2-rate-info-open {
    overflow: hidden;
}

#index2-page .index2-rate-info-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
}

#index2-page .index2-rate-info-dialog {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(92vw, 760px);
    max-height: 88vh;
    overflow: hidden;
    border-radius: 6px;
    background: #fff;
    padding: 12px 12px 10px;
}

#index2-page .index2-rate-info-close {
    position: absolute;
    top: 4px;
    right: 8px;
    border: 0;
    background: transparent;
    color: #666;
    font-size: 28px;
    line-height: 1;
}

#index2-page .index2-rate-info-title {
    margin: 0 26px 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

#index2-page .index2-rate-info-body {
    max-height: calc(88vh - 74px);
    overflow-y: auto;
}

#index2-page .index2-rate-info-body p:last-child {
    margin-bottom: 0;
}

#index2-page #order-datetime-start,
#index2-page #order-valid-datetime {
    display: inline-block;
    width: 17ch;
    max-width: 100%;
}

#index2-page .index2-submit-checklist {
    margin: 0 0 10px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.35;
}

#index2-page .index2-submit-checklist ul {
    margin: 5px 0 0 18px;
    padding: 0;
}

#index2-page .index2-submit-checklist li + li {
    margin-top: 3px;
}

#index2-page #submit-button:disabled {
    opacity: 0.58;
    cursor: not-allowed;
}

/* Fallback: show clear button when input has text even if JS class toggling is delayed */
#index2-page #client-search:not(:placeholder-shown) + .index2-client-clear {
    display: inline-block;
}

@media (min-width: 768px) and (max-width: 991px) {
    #index2-page .col-sm-6,
    #index2-page .col-sm-4,
    #index2-page .col-sm-8 {
        float: none;
        width: 100%;
    }

    #index2-page .row > [class*='col-'] {
        margin-bottom: 12px;
    }

    #index2-page {
        padding-left: 10px;
        padding-right: 10px;
    }

    #index2-page h4 {
        margin-top: 8px;
        font-size: 19px;
    }

    #index2-page .well {
        padding: 10px;
        margin-bottom: 10px;
    }

    #index2-page .form-group {
        margin-bottom: 10px;
    }

    #index2-page .input-group .form-control {
        height: 40px;
        font-size: 14px;
    }

    #index2-page .handle {
        min-width: 44px;
        padding: 10px 0;
    }

    #index2-page .input-group-addon.remove-address {
        width: 44px;
        padding: 8px 10px;
    }

    #index2-page .address-preview {
        margin: 5px 48px 0 48px;
        font-size: 12px;
        line-height: 1.3;
    }

    #index2-page #map {
        height: 36vh;
        min-height: 240px;
    }

    #index2-page #map-wrap {
        max-height: 52vh;
    }

    #index2-page #client-results {
        height: 132px;
    }

    #index2-page #map-toggle,
    #index2-page .btn-lg,
    #index2-page #refresh-rates {
        width: 100%;
    }
}

@media (max-width: 767px) {
    #index2-page {
        margin-top: 10px;
        padding-left: 8px;
        padding-right: 8px;
    }

    #index2-page .row {
        margin-left: -8px;
        margin-right: -8px;
    }

    #index2-page .row > [class*='col-'] {
        padding-left: 8px;
        padding-right: 8px;
        margin-bottom: 10px;
    }

    #index2-page h4 {
        margin-top: 8px;
        font-size: 18px;
    }

    #index2-page .well {
        padding: 8px;
        margin-bottom: 8px;
    }

    #index2-page .form-group {
        margin-bottom: 10px;
    }

    #index2-page .index2-cargo-hint {
        margin-top: 4px;
        margin-bottom: 8px;
        padding: 6px 8px;
        font-size: 11px;
        line-height: 1.24;
    }

    #index2-page .index2-cargo-hint-body {
        max-height: 55px;
    }

    #index2-page .index2-cargo-hint[data-expanded="1"] .index2-cargo-hint-body {
        max-height: 440px;
    }

    #index2-page label.control-label {
        margin-bottom: 6px;
        font-size: 13px;
    }

    #index2-page .form-control {
        min-height: 40px;
        font-size: 14px;
    }

    #index2-page textarea.form-control {
        min-height: 92px;
    }

    #index2-page .radio-inline,
    #index2-page .checkbox label,
    #index2-page .radio label {
        white-space: normal;
        word-break: break-word;
    }

    #index2-page .input-group .form-control {
        height: 40px;
        font-size: 13px;
    }

    #index2-page .handle {
        min-width: 42px;
        padding: 8px 0;
    }

    #index2-page .input-group-addon.remove-address {
        width: 42px;
        padding: 7px 9px;
    }

    #index2-page .address-preview {
        margin: 4px 44px 0 44px;
        font-size: 11px;
        line-height: 1.3;
    }

    #index2-page #map {
        height: 32vh;
        min-height: 190px;
    }

    #index2-page #map-wrap {
        max-height: 46vh;
    }

    #index2-page #client-results {
        height: 128px;
    }

    #index2-page #map-toggle,
    #index2-page .btn-lg {
        width: 100%;
    }

    #index2-page #refresh-rates {
        width: 100%;
    }

    #index2-page #index2-body-type-toggle {
        display: inline-flex !important;
        align-items: center;
    }

    #index2-page #order-body-typies .checkbox,
    #index2-page #order-type-payment .radio,
    #index2-page #order-loading-typies-fallback .checkbox {
        margin-top: 6px;
        margin-bottom: 6px;
    }

    #index2-page .index2-rate-info-dialog {
        width: min(96vw, 760px);
        max-height: 90vh;
        padding: 10px 10px 8px;
    }

    #index2-page .index2-rate-info-close {
        top: 2px;
        right: 4px;
        font-size: 24px;
    }

    #index2-page .index2-rate-info-title {
        font-size: 15px;
    }

    #index2-page .index2-rate-info-body {
        max-height: calc(90vh - 72px);
    }
}

@media (max-width: 480px) {
    #index2-page {
        padding-left: 6px;
        padding-right: 6px;
    }

    #index2-page .row {
        margin-left: -6px;
        margin-right: -6px;
    }

    #index2-page .row > [class*='col-'] {
        padding-left: 6px;
        padding-right: 6px;
    }

    #index2-page .radio-inline {
        display: block;
        margin: 0 0 8px 0;
        padding-left: 22px;
    }

    #index2-page #map {
        min-height: 170px;
    }

    #index2-page .form-control {
        font-size: 13px;
    }

    #index2-page .index2-rate-info-dialog {
        width: calc(100vw - 10px);
        padding: 8px 8px 6px;
    }

    #index2-page .index2-rate-info-title {
        font-size: 14px;
        margin-right: 22px;
    }

    #index2-page .checkbox {
        margin-top: 4px;
        margin-bottom: 4px;
    }
}
