.vx-dmm,
.vx-dmm * {
    box-sizing: border-box;
}

.vx-dmm {
    position: relative;
    z-index: 2;
    display: block;
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 18px 0 22px;
    padding: 20px;
    clear: both;
    overflow: visible !important;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 12px;
    background: #fff;
}

.vx-dmm-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
    margin-bottom: 16px;
}

.vx-dmm h3 {
    margin: 0 0 5px;
    font-size: 22px;
    line-height: 1.25;
}

.vx-dmm-note {
    margin: 0;
    color: #666;
    line-height: 1.45;
}

.vx-dmm-summary {
    min-width: 190px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, .1);
    border-radius: 10px;
    background: #fafafa;
    text-align: right;
}

.vx-dmm-summary > span,
.vx-dmm-summary > small {
    display: block;
    color: #666;
    font-size: 12px;
    line-height: 1.35;
}

.vx-dmm-summary strong {
    display: block;
    margin: 2px 0;
    font-size: 22px;
    line-height: 1.2;
}

.vx-dmm-status {
    display: none;
    width: 100%;
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid #c62828;
    border-radius: 8px;
    background: #fff4f4;
    color: #8b1111;
    font-size: 14px;
    line-height: 1.4;
}

.vx-dmm-status:not(:empty) {
    display: block;
}

.vx-dmm-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.vx-dmm-row {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 10px;
    border: 1px solid rgba(0, 0, 0, .1);
    border-radius: 10px;
    background: #fff;
    scroll-margin-top: 110px;
    scroll-margin-bottom: 120px;
}

.vx-dmm-row--selected {
    background: #fcfcfc;
}

.vx-dmm-row--error {
    border-color: #c62828;
    box-shadow: 0 0 0 1px #c62828;
}

.vx-dmm-thumb {
    width: 82px;
    height: 82px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 9px;
    background: #f6f6f6;
}

.vx-dmm-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.vx-dmm-row-main {
    width: 100%;
    min-width: 0;
}

.vx-dmm-row label {
    display: block;
    margin: 0 0 6px;
    font-weight: 700;
    line-height: 1.3;
}

.vx-dmm-row .required {
    color: #d21f2b;
}

.vx-dmm-select,
.vx-dmm select.vx-dmm-select {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 46px !important;
    min-height: 46px !important;
    margin: 0 !important;
    padding: 0 38px 0 10px !important;
    overflow: hidden;
    border-radius: 8px !important;
    font-size: 14px !important;
    line-height: 44px !important;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.vx-dmm .select2-container,
.vx-dmm .select2-container--default,
.vx-dmm .select2-selection,
.vx-dmm .select2-selection--single,
.vx-dmm .wd-select,
.vx-dmm .wd-dropdown {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

.vx-dmm-selected-meta {
    min-height: 18px;
    margin-top: 6px;
    overflow: hidden;
    color: #666;
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
}

.vx-dmm-open-picker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    margin-top: 8px;
    padding: 6px 10px;
    border: 1px solid rgba(0, 0, 0, .18);
    border-radius: 7px;
    background: #fff;
    color: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
}

.vx-dmm-open-picker:hover,
.vx-dmm-open-picker:focus {
    border-color: rgba(0, 0, 0, .4);
}

.vx-dmm-payload,
.vx-dmm-payload-copy,
.vx-dmm[data-vx-duplicate="1"] {
    display: none !important;
}

.vx-dmm-admin-warning {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding: 12px;
    border-left: 4px solid #d63638;
    background: #fff3f3;
}

.vx-dmm-shop-price small {
    font-size: .72em;
    font-weight: 400;
}

.vx-has-disposable-builder form.cart > .vx-dmm,
.vx-has-disposable-builder form.variations_form > .vx-dmm {
    flex-basis: 100%;
    order: -1;
}

.vx-dmm-picker {
    position: fixed;
    z-index: 999999;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.vx-dmm-picker--open {
    display: flex;
}

.vx-dmm-picker-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .62);
}

.vx-dmm-picker-dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(980px, 100%);
    max-height: min(82vh, 820px);
    overflow: hidden;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 20px 70px rgba(0, 0, 0, .3);
}

.vx-dmm-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(0, 0, 0, .1);
}

.vx-dmm-picker-head strong,
.vx-dmm-picker-head small {
    display: block;
}

.vx-dmm-picker-head strong {
    font-size: 18px;
}

.vx-dmm-picker-head small {
    margin-top: 2px;
    color: #666;
    font-size: 12px;
}

.vx-dmm-picker-close {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f1f1f1;
    color: #222;
    font-size: 26px;
    line-height: 38px;
    cursor: pointer;
}

.vx-dmm-picker-search {
    padding: 12px 18px;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.vx-dmm-search {
    display: block;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 16px;
}

.vx-dmm-products {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 16px 18px 20px;
    overflow: auto;
    overscroll-behavior: contain;
}

.vx-dmm-product {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 10px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, .11);
    border-radius: 10px;
    background: #fff;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.vx-dmm-product:hover,
.vx-dmm-product:focus {
    border-color: rgba(0, 0, 0, .38);
    box-shadow: 0 5px 18px rgba(0, 0, 0, .08);
}

.vx-dmm-product--unavailable,
.vx-dmm-product:disabled {
    opacity: .42;
    cursor: not-allowed;
    box-shadow: none;
}

.vx-dmm-product-image {
    display: block;
    aspect-ratio: 1 / 1;
    width: 100%;
    margin-bottom: 8px;
    overflow: hidden;
    border-radius: 8px;
    background: #f6f6f6;
}

.vx-dmm-product-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.vx-dmm-product-name {
    display: -webkit-box;
    min-height: 38px;
    overflow: hidden;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.vx-dmm-product-price {
    display: block;
    margin-top: 5px;
    font-size: 14px;
    font-weight: 700;
}

.vx-dmm-product-price del {
    margin-right: 4px;
    opacity: .55;
    font-weight: 400;
}

.vx-dmm-product-price ins {
    text-decoration: none;
}

.vx-dmm-product-stock {
    display: block;
    margin-top: 3px;
    color: #666;
    font-size: 11px;
}

html.vx-dmm-modal-open,
html.vx-dmm-modal-open body {
    overflow: hidden !important;
}

@media (max-width: 900px) {
    .vx-dmm-products {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .vx-dmm {
        margin: 14px 0 calc(24px + env(safe-area-inset-bottom));
        padding: 14px 12px;
        border-radius: 10px;
    }

    .vx-dmm-heading {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .vx-dmm h3 {
        font-size: 20px;
    }

    .vx-dmm-note {
        font-size: 14px;
    }

    .vx-dmm-summary {
        min-width: 0;
        width: 100%;
        text-align: left;
    }

    .vx-dmm-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .vx-dmm-row {
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 10px;
        padding: 9px;
    }

    .vx-dmm-thumb {
        width: 72px;
        height: 72px;
    }

    .vx-dmm-select,
    .vx-dmm select.vx-dmm-select {
        height: 48px !important;
        min-height: 48px !important;
        padding-right: 36px !important;
        font-size: 16px !important;
        line-height: 46px !important;
    }

    .vx-dmm-picker {
        align-items: flex-end;
        padding: 0;
    }

    .vx-dmm-picker-dialog {
        width: 100%;
        max-height: 88vh;
        border-radius: 16px 16px 0 0;
    }

    .vx-dmm-products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 12px 12px calc(18px + env(safe-area-inset-bottom));
    }

    .vx-dmm-picker-head,
    .vx-dmm-picker-search {
        padding-right: 12px;
        padding-left: 12px;
    }
}

@media (max-width: 420px) {
    .vx-dmm {
        padding: 12px 10px;
    }

    .vx-dmm-row {
        grid-template-columns: 62px minmax(0, 1fr);
        padding: 8px;
    }

    .vx-dmm-thumb {
        width: 62px;
        height: 62px;
    }

    .vx-dmm-selected-meta {
        font-size: 11px;
    }

    .vx-dmm-product {
        padding: 8px;
    }

    .vx-dmm-product-name {
        font-size: 12px;
    }
}
