body.ts-checkout-open {
    overflow: hidden;
}

#tsCheckoutModal {
    padding: 16px;
    align-items: center;
    justify-content: center;
}

#tsCheckoutModal .ts-checkout-box {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    gap: 12px 18px;
    width: min(960px, calc(100vw - 32px));
    max-width: none;
    height: auto;
    max-height: min(92dvh, 860px);
    overflow-x: hidden;
    overflow-y: auto;
    margin: 0;
    padding: 24px;
    border: 1px solid #e5eaf0;
    border-radius: 16px;
    color: #182230;
    font-family: var(--ts-font-primary, Tahoma, sans-serif);
    font-size: 15px;
    line-height: 1.55;
    direction: rtl;
    overscroll-behavior: contain;
}

#tsCheckoutModal .ts-checkout-header {
    position: relative;
    grid-column: 1 / -1;
    order: 1;
    min-height: 70px;
    direction: rtl;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    padding-inline-start: 52px;
}

#tsCheckoutModal .ts-checkout-user {
    direction: rtl;
    flex-direction: row;
    gap: 14px;
    text-align: right;
}

#tsCheckoutModal .ts-user-avatar {
    width: 62px;
    height: 62px;
}

#tsCheckoutModal .ts-checkout-user h4 {
    margin: 0;
    color: #263238;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.4;
}

#tsCheckoutModal .ts-checkout-user span {
    margin-top: 3px;
    color: #7a858b;
    font-size: 16px;
    line-height: 1.4;
}



#tsCheckoutModal .ts-checkout-total {
    display: block;
    grid-column: 1 / -1;
    order: 2;
    margin: 14px 0 4px;
}

#tsCheckoutModal .ts-checkout-total > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

#tsCheckoutModal .ts-checkout-total strong {
    display: block;
    color: #30383d;
    font-size: 20px;
    font-weight: 700;
}

#tsCheckoutModal #tsCheckoutTotal {
    color: #20292e;
    font-size: 32px;
    font-weight: 800;
    line-height: 1.25;
    text-align: left;
}

#tsCheckoutModal #tsCouponToggle {
    display: inline-block;
    margin-top: 8px;
    color: #ef7773;
    font-size: 18px;
    font-weight: 600;
    text-decoration: underline;
}

#tsCheckoutModal .ts-checkout-coupon {
    display: flex;
    grid-column: 1 / -1;
    order: 3;
    gap: 10px;
    margin: 0;
}

#tsCheckoutModal .ts-checkout-coupon input {
    flex: 1;
    min-width: 0;
    height: 48px;
    padding-inline: 14px;
    border: 1px solid #d9e0e5;
    border-radius: 8px;
    font: inherit;
}

#tsCheckoutModal .ts-checkout-coupon button {
    width: 120px;
    height: 48px;
    border-radius: 8px;
    background: #0a5bff;
    color: #fff;
    font: inherit;
    font-weight: 700;
}

#tsCheckoutModal .ts-checkout-card {
    min-width: 0;
    margin: 0;
    padding: 18px;
    border: 1px solid #e8ebee;
    border-radius: 12px;
    background: #fff;
}

#tsCheckoutModal .ts-card-header {
    margin: 0 0 14px;
}

#tsCheckoutModal .ts-card-header span {
    color: #263238;
    font-size: 18px;
    font-weight: 700;
}

#tsCheckoutModal .ts-card-header button {
    color: #0a5bff;
    font-size: 15px;
    font-weight: 600;
}

#tsCheckoutModal .ts-checkout-address {
    padding: 16px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    background: #fafbfc;
    color: #535f65;
    font-size: 14px;
    line-height: 1.8;
}

#tsCheckoutModal #tsCheckoutSavedAddress {
    width: 100%;
    min-height: 44px;
    margin-bottom: 10px;
    padding-inline: 12px;
    border: 1px solid #d9e0e5;
    border-radius: 8px;
    background: #fff;
    font: inherit;
}

#tsCheckoutModal .ts-tool-btn {
    min-height: 46px;
    height: auto;
    border: 1px solid #e5e9ed;
    border-radius: 9px;
    background: #f8fafb;
    color: #34454c;
    font-size: 15px;
}

#tsCheckoutModal .ts-payment-content.active {
    gap: 10px;
    margin-top: 12px;
}

#tsCheckoutModal .ts-payment-option {
    min-height: 46px;
    padding: 10px 12px;
    border-color: #e5e9ed;
    border-radius: 9px;
    color: #34454c;
    font-size: 14px;
}

#tsCheckoutModal .ts-payment-option:has(input:checked) {
    border-color: #0a5bff;
    background: #f4f8ff;
}

#tsCheckoutModal .ts-checkout-card:has(.ts-summary-toggle) {
    position: relative;
    grid-column: 1 / -1;
    order: 4;
    margin: 6px 0 10px;
    padding: 12px 0 0;
    border: 0;
    background: transparent;
}

#tsCheckoutModal .ts-checkout-card:has(.ts-summary-toggle)::before {
    position: absolute;
    top: 39px;
    right: -24px;
    left: -24px;
    border-top: 3px dotted #f0f2f4;
    content: "";
}

#tsCheckoutModal .ts-summary-toggle {
    position: relative;
    z-index: 1;
    display: flex;
    width: max-content;
    min-width: min(250px, 100%);
    height: 58px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 0 auto;
    border: 1px solid #e3e8eb;
    border-radius: 999px;
    background: #fff;
    color: #47727b;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 3px 12px rgba(16, 24, 40, .08);
}

#tsCheckoutModal .ts-summary-toggle i {
    color: #47727b;
    font-size: 15px;
    transition: transform .2s ease;
}

#tsCheckoutModal .ts-summary-toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}

#tsCheckoutModal .ts-checkout-card:has(#tsCheckoutSummary) {
    grid-column: 1 / -1;
    order: 5;
}

#tsCheckoutModal .ts-checkout-card:has(#tsCheckoutAddress) {
    order: 6;
}

#tsCheckoutModal .ts-checkout-card:has(.ts-payment-item) {
    order: 7;
}

#tsCheckoutModal #tsCheckoutSummary {
    display: grid;
    gap: 0;
}

#tsCheckoutModal .ts-product-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px 0;
    border-bottom: 1px solid #edf0f4;
}

#tsCheckoutModal .ts-product-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

#tsCheckoutModal #tsCheckoutSummary img {
    width: 64px;
    height: 64px;
    border: 1px solid #edf0f4;
    border-radius: 9px;
    object-fit: cover;
}

#tsCheckoutModal .ts-product-info {
    min-width: 0;
}

#tsCheckoutModal .ts-product-info h4 {
    margin: 0 0 4px;
    color: #263238;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

#tsCheckoutModal .ts-product-info span {
    margin: 0;
    color: #77838a;
    font-size: 13px;
    line-height: 1.5;
}

#tsCheckoutModal .ts-product-price {
    color: #263238;
    font-size: 15px;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

#tsCheckoutModal #tsCheckoutDetails {
    margin-top: 14px;
    color: #535f65;
    font-size: 14px;
}

#tsCheckoutModal .ts-checkout-box #tsCompleteOrder {
    display: flex;
    position: sticky;
    bottom: 0;
    z-index: 3;
    grid-column: 1 / -1;
    order: 8;
    width: 100%;
    height: 54px;
    min-height: 54px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #1677ff, #0757df);
    color: #fff;
    box-shadow: 0 7px 18px rgba(10, 91, 255, .24);
    font: inherit;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    transition: background .18s ease, box-shadow .18s ease, transform .18s ease;
}

#tsCheckoutModal .ts-checkout-box #tsCompleteOrder:hover:not(:disabled) {
    background: linear-gradient(135deg, #0868ef, #0348bf);
    box-shadow: 0 9px 22px rgba(10, 91, 255, .3);
    transform: translateY(-1px);
}

#tsCheckoutModal .ts-checkout-box #tsCompleteOrder:active:not(:disabled) {
    transform: translateY(0);
}

#tsCheckoutModal .ts-checkout-box #tsCompleteOrder:disabled {
    background: #e8edf5;
    color: #7b8798;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

#tsCheckoutModal .ts-checkout-box #tsCompleteOrder:focus-visible {
    outline: 3px solid rgba(10, 91, 255, .3);
    outline-offset: 2px;
}

#tsCheckoutModal .ts-complete-btn i {
    font-size: 18px;
}

@media (max-width: 700px) {
    #tsCheckoutModal {
        padding: 10px;
    }

    #tsCheckoutModal .ts-checkout-box {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        width: calc(100vw - 20px);
        max-height: calc(100dvh - 20px);
        padding: 16px 14px;
        border-radius: 12px;
    }

    #tsCheckoutModal .ts-checkout-header {
        min-height: 50px;
        padding-inline-start: 42px;
    }

    #tsCheckoutModal .ts-checkout-user {
        transform: translateX(50px);
    }

    #tsCheckoutModal .ts-user-avatar {
        width: 44px;
        height: 44px;
    }

    #tsCheckoutModal .ts-checkout-user h4 { font-size: 16px; }
    #tsCheckoutModal .ts-checkout-user span { font-size: 12px; }
    #tsCheckoutModal .ts-checkout-total { margin-top: 6px; }
    #tsCheckoutModal .ts-checkout-total strong { font-size: 15px; }
    #tsCheckoutModal #tsCheckoutTotal { font-size: 24px; }
    #tsCheckoutModal #tsCouponToggle { font-size: 14px; }
    #tsCheckoutModal .ts-checkout-coupon {
        flex-direction: column;
        width: 100%;
    }
    #tsCheckoutModal .ts-checkout-coupon input {
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    #tsCheckoutModal .ts-checkout-coupon button { width: 100%; }
    #tsCheckoutModal .ts-card-header span { font-size: 15px; }
    #tsCheckoutModal .ts-checkout-card:has(#tsCheckoutSummary),
    #tsCheckoutModal .ts-checkout-card:has(#tsCheckoutAddress),
    #tsCheckoutModal .ts-checkout-card:has(.ts-payment-item) { grid-column: 1 / -1; }
    #tsCheckoutModal .ts-checkout-card:has(.ts-summary-toggle)::before { right: -14px; left: -14px; }
    #tsCheckoutModal .ts-summary-toggle { height: 50px; min-width: min(220px, 100%); font-size: 15px; }
    #tsCheckoutModal .ts-product-row { grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; }
    #tsCheckoutModal #tsCheckoutSummary img { width: 52px; height: 52px; }
    #tsCheckoutModal .ts-product-info h4 { font-size: 14px; }
    #tsCheckoutModal .ts-product-price { font-size: 13px; }
    #tsCheckoutModal .ts-complete-btn { height: 50px; font-size: 15px; }
}