/* =========================
   IMV One Page Checkout Layout v8.18
   適用：WooCommerce 傳統 checkout shortcode + WooCommerce 原生 cart page
   ========================= */

/* 結帳頁專用：隱藏原本 header / footer，改用極簡 checkout header */
body.woocommerce-checkout:not(.woocommerce-order-received) #site-header,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-location-header,
body.woocommerce-checkout:not(.woocommerce-order-received) header[data-elementor-type="header"],
body.woocommerce-checkout:not(.woocommerce-order-received) #site-footer,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-location-footer,
body.woocommerce-checkout:not(.woocommerce-order-received) footer[data-elementor-type="footer"],
body.woocommerce-checkout:not(.woocommerce-order-received) #footer,
body.woocommerce-checkout:not(.woocommerce-order-received) #footer-widgets,
body.woocommerce-checkout:not(.woocommerce-order-received) #footer-bottom {
    display: none !important;
}

/* v8.14：結帳頁頁面背景不由外掛設定，交由主題 / Elementor 控制。 */

/* v7：重新處理留白。直接從主內容與 Elementor 外層加左右 padding，不再只靠 width calc。 */
body.woocommerce-checkout:not(.woocommerce-order-received) #main,
body.woocommerce-checkout:not(.woocommerce-order-received) #content-wrap,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-location-single,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-section-wrap,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-widget-container {
    box-sizing: border-box !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #main {
    width: 100% !important;
    max-width: none !important;
    background: transparent !important;
    padding: 48px clamp(64px, 7vw, 120px) 84px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #content-wrap,
body.woocommerce-checkout:not(.woocommerce-order-received) #primary,
body.woocommerce-checkout:not(.woocommerce-order-received) #content,
body.woocommerce-checkout:not(.woocommerce-order-received) .content-area,
body.woocommerce-checkout:not(.woocommerce-order-received) .site-main,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-section.elementor-top-section,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-section.elementor-top-section > .elementor-container,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-column,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-widget-wrap,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-widget-container,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-widget-container > .woocommerce {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* 只限制真正的 checkout 內容最大閱讀寬度 */
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-widget-container > .woocommerce,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper {
    max-width: 1160px !important;
}

body.woocommerce-checkout #right-sidebar,
body.woocommerce-checkout aside.sidebar-container {
    display: none !important;
}

/* 結帳頁極簡 header */
.imv-checkout-header {
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid #eeeeee;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

.imv-checkout-header-inner {
    width: min(1200px, calc(100% - 40px));
    min-height: 72px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.imv-checkout-header-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none !important;
}

.imv-checkout-header-logo-img {
    display: block;
    width: auto;
    max-width: 150px;
    max-height: 42px;
    object-fit: contain;
}

.imv-checkout-header-site-name {
    color: #222222;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.imv-checkout-cancel-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid #dddddd;
    border-radius: 999px;
    color: #333333 !important;
    background: #ffffff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none !important;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.imv-checkout-cancel-link:hover,
.imv-checkout-cancel-link:focus {
    border-color: #ed9318;
    color: #ed9318 !important;
    background: #fff8ec;
}

/* 移除 WooCommerce 原本折價券提示，改用訂單明細版本 */
body.woocommerce-checkout .woocommerce-form-coupon-toggle,
body.woocommerce-checkout form.checkout_coupon.woocommerce-form-coupon {
    display: none !important;
}

/* 整個 checkout 表單改成左右兩欄：左付款，右訂單明細 */
body.woocommerce-checkout form.checkout.woocommerce-checkout {
    display: grid;
    grid-template-columns: minmax(0, 57%) minmax(340px, 43%);
    column-gap: 34px;
    row-gap: 24px;
    align-items: start;
}

/* 右側訂單明細 */
body.woocommerce-checkout .imv-checkout-order-summary {
    grid-column: 2;
    grid-row: 1 / span 8;
    position: sticky;
    top: 96px;
    z-index: 1;
}

/* 左側第一區：付款方式 */
body.woocommerce-checkout #order_review {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
}

body.woocommerce-checkout #order_review_heading {
    display: none !important;
}

body.woocommerce-checkout .imv-invoice-section {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
}

body.woocommerce-checkout #customer_details {
    grid-column: 1;
    grid-row: 3;
    width: 100%;
}

body.woocommerce-checkout #customer_details.col2-set,
body.woocommerce-checkout #customer_details .col-1,
body.woocommerce-checkout #customer_details .col-2 {
    float: none !important;
    width: 100% !important;
}

/* 卡片共用樣式 */
.imv-summary-card,
body.woocommerce-checkout #customer_details,
body.woocommerce-checkout #order_review,
body.woocommerce-checkout .imv-invoice-section {
    background: #ffffff;
    border: 1px solid #eeeeee;
    border-radius: 22px;
    padding: 32px;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.055);
}

/* Section 標題一致化 */
.imv-section-title,
.imv-summary-title,
.imv-invoice-title,
body.woocommerce-checkout #order_review::before,
body.woocommerce-checkout .woocommerce-billing-fields > h3,
body.woocommerce-checkout .woocommerce-additional-fields > h3,
body.woocommerce-checkout #ship-to-different-address {
    margin: 0 0 18px !important;
    font-size: 21px !important;
    line-height: 1.35 !important;
    font-weight: 700 !important;
    color: #222222 !important;
    letter-spacing: 0 !important;
}

.imv-summary-title {
    margin-bottom: 22px !important;
}

/* 商品明細 */
.imv-summary-items {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.imv-summary-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    padding-bottom: 18px;
    border-bottom: 1px solid #eeeeee;
}

.imv-summary-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.imv-summary-thumb {
    width: 78px;
    height: 78px;
    flex: 0 0 78px;
    border-radius: 14px;
    overflow: hidden;
    background: #f7f7f7;
}

.imv-summary-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.imv-summary-info {
    flex: 1;
    min-width: 0;
}

.imv-summary-product-name {
    font-size: 18px;
    line-height: 1.45;
    font-weight: 700;
    color: #222222;
}

.imv-summary-product-price {
    display: none !important;
}

/* 優惠券：v7 改成自然文字按鈕，不做突兀圓框，也不刻意分隔 */
.imv-coupon-box {
    margin-top: 18px;
    padding: 0;
    border: 0;
}

.imv-coupon-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: auto;
    min-height: 32px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    color: #666666;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none !important;
    box-shadow: none !important;
}

.imv-coupon-toggle:hover,
.imv-coupon-toggle:focus {
    color: #ed9318;
    outline: none;
    text-decoration: none !important;
}

.imv-coupon-toggle > span:first-child {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.imv-coupon-toggle-icon,
.imv-coupon-toggle:hover .imv-coupon-toggle-icon,
.imv-coupon-toggle:focus .imv-coupon-toggle-icon {
    text-decoration: none !important;
    border-bottom: 0 !important;
    box-shadow: none !important;
}

.imv-coupon-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font-size: 16px;
    line-height: 1;
    font-weight: 800;
    text-decoration: none !important;
    border-bottom: 0 !important;
    box-shadow: none !important;
}

.imv-coupon-toggle:hover .imv-coupon-toggle-icon,
.imv-coupon-toggle:focus .imv-coupon-toggle-icon {
    text-decoration: none !important;
    border-bottom: 0 !important;
    box-shadow: none !important;
}

.imv-coupon-box.is-open .imv-coupon-toggle-icon {
    transform: rotate(45deg);
}

.imv-coupon-panel {
    margin-top: 10px;
}

.imv-coupon-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 10px;
    align-items: stretch;
}

.imv-coupon-input {
    width: 100%;
    min-width: 0;
    height: 42px;
    border-radius: 10px;
    border: 1px solid #dddddd;
    padding: 0 14px;
    font-size: 14px;
    background: #ffffff;
}

.imv-coupon-input:focus {
    border-color: #ed9318;
    box-shadow: 0 0 0 1px rgba(237, 147, 24, 0.18);
    outline: none;
}

.imv-coupon-row .imv-apply-coupon-button.button,
body.woocommerce-checkout .imv-coupon-row .imv-apply-coupon-button.button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 42px !important;
    min-height: 42px !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 12px !important;
    border-radius: 10px !important;
    white-space: nowrap !important;
    background: #252930 !important;
    border: 1px solid #252930 !important;
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    box-shadow: none !important;
}

.imv-coupon-row .imv-apply-coupon-button.button:hover,
.imv-coupon-row .imv-apply-coupon-button.button:focus {
    background: #ed9318 !important;
    border-color: #ed9318 !important;
    color: #ffffff !important;
}

.imv-coupon-box.is-loading .imv-apply-coupon-button,
.imv-coupon-box.is-loading .imv-coupon-toggle {
    opacity: 0.65;
    pointer-events: none;
}

.imv-coupon-message {
    margin-top: 8px;
    min-height: 0;
}

.imv-coupon-message .woocommerce-message {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: #ed9318 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    box-shadow: none !important;
}

.imv-coupon-message .woocommerce-message::before {
    display: none !important;
}

.imv-coupon-message .woocommerce-error,
.imv-coupon-message .woocommerce-info {
    margin: 0 !important;
    padding: 4px 0 0 !important;
    border: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
    font-size: 13px !important;
    box-shadow: none !important;
}

.imv-coupon-message .woocommerce-info::before,
.imv-coupon-message .woocommerce-error::before {
    display: none !important;
}

/* 訂單金額 */
.imv-left-totals {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #eeeeee;
}

.imv-total-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 9px 0;
    font-size: 14px;
    color: #555555;
}

.imv-total-row strong {
    text-align: right;
    color: #222222;
    font-weight: 700;
}

.imv-discount-row strong,
.imv-total-row.cart-discount strong,
.imv-total-row.cart-discount .amount {
    color: #ed9318;
}

.imv-grand-total-row {
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid #eeeeee;
    font-size: 18px;
    color: #222222;
}

.imv-grand-total-row strong {
    color: #ed9318;
    font-size: 21px;
}

.imv-total-row .woocommerce-remove-coupon,
.imv-total-row .imv-remove-coupon-link {
    margin-left: 8px;
    font-size: 12px;
    color: #999999 !important;
    text-decoration: underline;
    font-weight: 600;
}

/* 加贈項目：v8 改成較自然的「已包含」提示，不做上下兩行生硬標籤 */
.imv-bonus-box {
    margin-top: 18px;
    padding: 13px 14px;
    border: 1px solid rgba(237, 147, 24, 0.22);
    border-radius: 14px;
    background: linear-gradient(180deg, #fffaf1 0%, #ffffff 100%);
    display: flex;
    align-items: center;
    gap: 12px;
}

.imv-bonus-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #ed9318;
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}

.imv-bonus-content {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.imv-bonus-label {
    color: #777777;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.imv-bonus-value {
    color: #222222;
    font-size: 15px;
    line-height: 1.4;
    font-weight: 700;
}

/* 訂單明細底部：確認購買＋同意文字 */
.imv-summary-actions {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid #eeeeee;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 付款方式卡片 */
body.woocommerce-checkout #order_review::before {
    content: "付款方式";
    display: block;
}

body.woocommerce-checkout #order_review .woocommerce-checkout-review-order-table {
    display: none !important;
}

.imv-payment-security-notice {
    margin: -2px 0 20px;
    padding: 14px 16px;
    border: 1px solid #b7e6dd;
    border-radius: 12px;
    background: #e8f8f5;
    color: #235c58;
    font-size: 14px;
    line-height: 1.75;
    font-weight: 600;
}

body.woocommerce-checkout #payment {
    background: transparent;
    border-radius: 0;
}

body.woocommerce-checkout #payment ul.payment_methods {
    border-bottom: 0 !important;
    padding: 0 !important;
    margin-bottom: 0 !important;
}

body.woocommerce-checkout #payment div.form-row {
    padding: 0;
    margin: 0;
}

/* 金流 logo 顯示與縮小：包含 LINE Pay */
body.woocommerce-checkout #payment ul.payment_methods li label img,
body.woocommerce-checkout #payment ul.payment_methods li img {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: auto !important;
    max-width: 72px !important;
    max-height: 22px !important;
    margin: 0 0 0 8px !important;
    vertical-align: middle !important;
    object-fit: contain !important;
}

body.woocommerce-checkout #payment ul.payment_methods li.payment_method_linepay-tw label img.imv-linepay-logo,
body.woocommerce-checkout #payment ul.payment_methods li.payment_method_linepay-tw label img {
    max-width: 64px !important;
    max-height: 18px !important;
}

body.woocommerce-checkout #payment ul.payment_methods li label {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px;
    line-height: 1.5;
}

/* 發票資料 */
.imv-invoice-note {
    margin: -6px 0 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fff8ec;
    color: #6b4a1f;
    font-size: 14px;
    line-height: 1.7;
}

.imv-invoice-section .form-row {
    margin-bottom: 0;
}

/* 使用 WooCommerce 原生條款 checkbox。保留原生驗證，但搬到訂單明細底部。 */
body.woocommerce-checkout .woocommerce-privacy-policy-text {
    display: none !important;
}

/* 舊版自訂同意欄位不再使用，若快取殘留則隱藏。 */
.imv-privacy-consent {
    display: none !important;
    order: 2;
    margin: 0 !important;
    padding: 0 2px !important;
    border-radius: 0;
    background: transparent;
    color: #555555;
    font-size: 14px;
    line-height: 1.65;
    font-weight: 400 !important;
}

.imv-privacy-consent label {
    display: flex !important;
    gap: 9px;
    align-items: flex-start;
    margin: 0;
    cursor: pointer;
    font-weight: 400 !important;
}

.imv-privacy-consent span {
    font-weight: 400 !important;
}

.imv-privacy-consent input[type="checkbox"] {
    margin-top: 5px !important;
    flex: 0 0 auto;
}

.imv-privacy-consent .required {
    color: #d63638;
    text-decoration: none;
}


.imv-summary-actions .woocommerce-terms-and-conditions-wrapper {
    order: 2;
    margin: 0 !important;
    padding: 0 2px !important;
    color: #555555;
    font-size: 14px;
    line-height: 1.65;
    font-weight: 400 !important;
}

.imv-summary-actions .woocommerce-terms-and-conditions-wrapper .form-row {
    margin: 0 !important;
    padding: 0 !important;
}

.imv-summary-actions .woocommerce-terms-and-conditions-wrapper label.checkbox {
    display: flex !important;
    align-items: flex-start !important;
    gap: 9px !important;
    margin: 0 !important;
    cursor: pointer;
    color: #555555;
    font-size: 14px;
    line-height: 1.65;
    font-weight: 400 !important;
}

.imv-summary-actions .woocommerce-terms-and-conditions-wrapper label.checkbox span,
.imv-summary-actions .woocommerce-terms-and-conditions-wrapper .woocommerce-terms-and-conditions-checkbox-text {
    font-weight: 400 !important;
}

.imv-summary-actions .woocommerce-terms-and-conditions-wrapper input[type="checkbox"] {
    margin-top: 5px !important;
    flex: 0 0 auto;
}

.imv-summary-actions .woocommerce-terms-and-conditions-wrapper .required {
    color: #d63638;
    text-decoration: none;
}

.imv-summary-actions .woocommerce-terms-and-conditions {
    margin: 10px 0 12px !important;
    padding: 12px !important;
    border: 1px solid #eeeeee;
    border-radius: 12px;
    background: #fafafa;
    font-size: 13px;
    line-height: 1.65;
}

body.woocommerce-checkout #place_order:disabled,
body.woocommerce-checkout #place_order.imv-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* 確認購買按鈕 */
body.woocommerce-checkout #place_order,
body.woocommerce-checkout .imv-summary-actions #place_order {
    order: 1;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 52px !important;
    border-radius: 999px !important;
    padding: 16px 24px !important;
    font-size: 17px !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
    background: #ed9318 !important;
    border: 1px solid #ed9318 !important;
    color: #ffffff !important;
    box-shadow: 0 10px 22px rgba(237, 147, 24, 0.22) !important;
}

body.woocommerce-checkout #place_order:hover {
    background: #d87f05 !important;
    border-color: #d87f05 !important;
}

/* 表單欄位視覺 */
body.woocommerce-checkout form .form-row input.input-text,
body.woocommerce-checkout form .form-row select,
body.woocommerce-checkout form .form-row textarea,
body.woocommerce-checkout .select2-container .select2-selection--single {
    min-height: 44px;
    border-radius: 10px;
    border: 1px solid #dddddd;
}

body.woocommerce-checkout form .form-row input.input-text:focus,
body.woocommerce-checkout form .form-row select:focus,
body.woocommerce-checkout form .form-row textarea:focus {
    border-color: #ed9318;
    box-shadow: 0 0 0 1px rgba(237, 147, 24, 0.2);
    outline: none;
}

body.woocommerce-checkout form .form-row label {
    font-size: 14px;
    font-weight: 600;
    color: #333333;
}

/* 中等螢幕：保留左右 margin/padding，避免貼邊 */
@media (min-width: 769px) and (max-width: 1120px) {
    body.woocommerce-checkout:not(.woocommerce-order-received) #main {
        padding: 38px 36px 68px !important;
    }

    body.woocommerce-checkout form.checkout.woocommerce-checkout {
        grid-template-columns: minmax(0, 57%) minmax(310px, 43%);
        column-gap: 26px;
    }

    .imv-summary-card,
    body.woocommerce-checkout #customer_details,
    body.woocommerce-checkout #order_review,
    body.woocommerce-checkout .imv-invoice-section {
        padding: 26px;
    }
}

/* 手機版：改回上下排列，訂單明細放在最下面 */
@media (max-width: 768px) {
    body.woocommerce-checkout:not(.woocommerce-order-received) #main {
        padding: 24px 18px 48px !important;
    }

    body.woocommerce-checkout form.checkout.woocommerce-checkout {
        display: flex;
        flex-direction: column;
    }

    body.woocommerce-checkout #order_review {
        order: 1;
    }

    body.woocommerce-checkout .imv-invoice-section {
        order: 2;
    }

    body.woocommerce-checkout #customer_details {
        order: 3;
    }

    body.woocommerce-checkout .imv-checkout-order-summary {
        order: 4;
        position: static;
        margin-bottom: 0;
    }

    .imv-summary-card,
    body.woocommerce-checkout #customer_details,
    body.woocommerce-checkout #order_review,
    body.woocommerce-checkout .imv-invoice-section {
        padding: 20px;
        border-radius: 16px;
        margin-bottom: 24px;
    }

    .imv-summary-thumb {
        width: 68px;
        height: 68px;
        flex-basis: 68px;
    }

    .imv-summary-product-name {
        font-size: 16px;
    }

    .imv-coupon-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .imv-coupon-row .imv-apply-coupon-button.button {
        width: 100% !important;
    }

    .imv-checkout-header-inner {
        width: min(100% - 28px, 1200px);
        min-height: 64px;
    }

    .imv-checkout-header-logo-img {
        max-width: 126px;
        max-height: 36px;
    }

    .imv-checkout-cancel-link {
        min-height: 36px;
        padding: 0 13px;
        font-size: 13px;
    }

    .imv-bonus-box {
        align-items: center;
        flex-direction: row;
        gap: 10px;
    }

    .imv-bonus-content {
        flex-direction: row;
    }
}

/* 超小螢幕 */
@media (max-width: 420px) {
    body.woocommerce-checkout:not(.woocommerce-order-received) #main {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    .imv-summary-card,
    body.woocommerce-checkout #customer_details,
    body.woocommerce-checkout #order_review,
    body.woocommerce-checkout .imv-invoice-section {
        padding: 18px;
    }
}

/* v8：保險移除付款方式 section 底部可能由主題 / WooCommerce 補上的分隔線 */
body.woocommerce-checkout #payment ul.payment_methods,
body.woocommerce-checkout #payment ul.payment_methods li,
body.woocommerce-checkout #payment div.form-row,
body.woocommerce-checkout #payment .place-order {
    border-bottom: 0 !important;
}


/* 必填星號：WooCommerce 已經輸出 .required，但部分主題 / WooCommerce inline CSS 會把它隱藏，這裡強制恢復顯示。 */
body.woocommerce-checkout form.checkout .form-row .required,
body.woocommerce-checkout form.checkout label .required,
body.woocommerce-checkout form.checkout abbr.required {
    visibility: visible !important;
    display: inline !important;
    color: #d63638 !important;
    opacity: 1 !important;
    text-decoration: none !important;
    border: 0 !important;
    font-weight: 700 !important;
}

body.woocommerce-checkout form.checkout label.required_field .required {
    margin-left: 2px;
}

/* v8.4：折價券按鈕微調。避免按鈕文字裝飾線延伸到「＋」。 */
body.woocommerce-checkout .imv-coupon-toggle,
body.woocommerce-checkout .imv-coupon-toggle:hover,
body.woocommerce-checkout .imv-coupon-toggle:focus,
body.woocommerce-checkout .imv-coupon-toggle *,
body.woocommerce-checkout .imv-coupon-toggle:hover *,
body.woocommerce-checkout .imv-coupon-toggle:focus * {
    text-decoration: none !important;
}

body.woocommerce-checkout .imv-coupon-toggle > span:first-child {
    display: inline-block;
    border-bottom: 1px solid currentColor !important;
    line-height: 1.35;
    text-decoration: none !important;
}

body.woocommerce-checkout .imv-coupon-toggle .imv-coupon-toggle-icon {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border: 0 !important;
    border-bottom: 0 !important;
    text-decoration: none !important;
    box-shadow: none !important;
    outline: 0 !important;
}

/* v8.4：WooCommerce 結帳驗證錯誤提示 UI 優化 */
body.woocommerce-checkout .woocommerce-NoticeGroup-checkout,
body.woocommerce-checkout .woocommerce-notices-wrapper:not(:empty) {
    grid-column: 1 / -1;
    width: 100%;
}

body.woocommerce-checkout .woocommerce-NoticeGroup-checkout.imv-enhanced-notice-group {
    margin: 0 0 22px !important;
}

body.woocommerce-checkout .imv-checkout-error-heading {
    margin: 0 0 8px !important;
    color: #252930;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.5;
}

body.woocommerce-checkout .imv-checkout-error-subtitle {
    display: block;
    margin-top: 2px;
    color: #777777;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.6;
}

body.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error,
body.woocommerce-checkout .woocommerce-notices-wrapper > .woocommerce-error:not(.imv-coupon-message .woocommerce-error) {
    position: relative !important;
    margin: 0 0 20px !important;
    padding: 18px 20px 18px 22px !important;
    border: 1px solid rgba(214, 54, 56, 0.16) !important;
    border-left: 4px solid #ed9318 !important;
    border-radius: 16px !important;
    background: #fffaf4 !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.045) !important;
    color: #4a3420 !important;
    list-style: none !important;
}

body.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error::before,
body.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error::after,
body.woocommerce-checkout .woocommerce-notices-wrapper > .woocommerce-error::before,
body.woocommerce-checkout .woocommerce-notices-wrapper > .woocommerce-error::after,
body.woocommerce-checkout .woocommerce-error li::before,
body.woocommerce-checkout .woocommerce-error li::after {
    content: none !important;
    display: none !important;
}

body.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error li,
body.woocommerce-checkout .woocommerce-notices-wrapper > .woocommerce-error li {
    position: relative !important;
    margin: 0 !important;
    padding: 6px 0 6px 18px !important;
    border: 0 !important;
    color: #4a3420 !important;
    font-size: 14px !important;
    line-height: 1.65 !important;
    list-style: none !important;
}

body.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error li + li,
body.woocommerce-checkout .woocommerce-notices-wrapper > .woocommerce-error li + li {
    margin-top: 2px !important;
}

body.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error li::marker,
body.woocommerce-checkout .woocommerce-notices-wrapper > .woocommerce-error li::marker {
    content: '' !important;
}

body.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error li span.imv-error-dot,
body.woocommerce-checkout .woocommerce-notices-wrapper > .woocommerce-error li span.imv-error-dot {
    position: absolute;
    left: 0;
    top: 16px;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #ed9318;
}

/* v8.4：欄位錯誤狀態。不要用誇張紅叉，改成柔和提示。 */
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid-required-field,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid-email,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid-phone {
    position: relative;
}

body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid label,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid-required-field label,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid-email label,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid-phone label {
    color: #4a3420 !important;
}

body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid input.input-text,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid select,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid textarea,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid .select2-container--default .select2-selection--single,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid-required-field input.input-text,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid-required-field select,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid-required-field textarea,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid-required-field .select2-container--default .select2-selection--single {
    border-color: rgba(237, 147, 24, 0.75) !important;
    background-color: #fffaf4 !important;
    box-shadow: 0 0 0 3px rgba(237, 147, 24, 0.12) !important;
}

body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid input.input-text:focus,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid select:focus,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid textarea:focus,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid-required-field input.input-text:focus,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid-required-field select:focus,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid-required-field textarea:focus {
    border-color: #ed9318 !important;
    box-shadow: 0 0 0 4px rgba(237, 147, 24, 0.16) !important;
    outline: 0 !important;
}

/* 移除 OceanWP / WooCommerce / Checkout Field Editor 可能加上的紅色叉叉或錯誤 icon。 */
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid::before,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid::after,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid-required-field::before,
body.woocommerce-checkout form.checkout .form-row.woocommerce-invalid-required-field::after,
body.woocommerce-checkout form.checkout .form-row .woocommerce-input-wrapper::before,
body.woocommerce-checkout form.checkout .form-row .woocommerce-input-wrapper::after,
body.woocommerce-checkout form.checkout .thwcfd-field-wrapper.woocommerce-invalid::before,
body.woocommerce-checkout form.checkout .thwcfd-field-wrapper.woocommerce-invalid::after {
    content: none !important;
    display: none !important;
}

body.woocommerce-checkout form.checkout .form-row .woocommerce-error,
body.woocommerce-checkout form.checkout .form-row .thwcfd-error,
body.woocommerce-checkout form.checkout .form-row .error {
    margin-top: 6px !important;
    color: #b54708 !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
}

@media (max-width: 768px) {
    body.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error,
    body.woocommerce-checkout .woocommerce-notices-wrapper > .woocommerce-error {
        padding: 16px 16px 16px 18px !important;
        border-radius: 14px !important;
    }

    body.woocommerce-checkout .imv-checkout-error-heading {
        font-size: 14px;
    }

    body.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error li,
    body.woocommerce-checkout .woocommerce-notices-wrapper > .woocommerce-error li {
        font-size: 13px !important;
    }
}




/* =========================
   v8.9：結帳頁驗證錯誤提示再次優化
   目標：桌機在最上方、手機在最下方；移除左線條與重複背景；欄位下方提示改為紅字。
   ========================= */
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper:not(:empty) {
    grid-column: 1 / -1 !important;
    width: 100% !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout > .woocommerce-NoticeGroup-checkout.imv-enhanced-notice-group,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout > .woocommerce-notices-wrapper.imv-enhanced-notice-group {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    margin: 0 0 4px !important;
    align-self: start !important;
}

@media (min-width: 769px) {
    body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout.imv-has-checkout-errors #order_review {
        grid-row: 2 !important;
    }

    body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout.imv-has-checkout-errors .imv-invoice-section {
        grid-row: 3 !important;
    }

    body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout.imv-has-checkout-errors #customer_details {
        grid-row: 4 !important;
    }

    body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout.imv-has-checkout-errors .imv-checkout-order-summary {
        grid-row: 2 / span 8 !important;
    }
}

body.woocommerce-checkout:not(.woocommerce-order-received) .imv-enhanced-notice-group .woocommerce-error,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper > .woocommerce-error:not(.imv-coupon-message .woocommerce-error) {
    margin: 0 !important;
    padding: 18px 22px !important;
    border: 1px solid rgba(214, 54, 56, 0.24) !important;
    border-left: 1px solid rgba(214, 54, 56, 0.24) !important;
    border-radius: 18px !important;
    background: #fff7f7 !important;
    box-shadow: 0 14px 36px rgba(214, 54, 56, 0.08) !important;
    color: #8a1f1f !important;
    list-style: none !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .imv-checkout-error-heading {
    margin: 0 0 8px !important;
    color: #8a1f1f !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    line-height: 1.5 !important;
    text-align: right !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .imv-checkout-error-subtitle {
    display: block !important;
    margin-top: 2px !important;
    color: #9f3a38 !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    line-height: 1.65 !important;
    text-align: right !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .imv-enhanced-notice-group .woocommerce-error li,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error li,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper > .woocommerce-error li {
    margin: 0 !important;
    padding: 4px 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #b42318 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.65 !important;
    text-align: right !important;
    list-style: none !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .imv-enhanced-notice-group .woocommerce-error li span.imv-error-dot,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error li span.imv-error-dot,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper > .woocommerce-error li span.imv-error-dot {
    display: none !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid input.input-text,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid select,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid textarea,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid .select2-container--default .select2-selection--single,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid-required-field input.input-text,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid-required-field select,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid-required-field textarea,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid-required-field .select2-container--default .select2-selection--single {
    border-color: rgba(214, 54, 56, 0.65) !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(214, 54, 56, 0.10) !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid input.input-text:focus,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid select:focus,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid textarea:focus,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid-required-field input.input-text:focus,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid-required-field select:focus,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid-required-field textarea:focus {
    border-color: #d63638 !important;
    box-shadow: 0 0 0 4px rgba(214, 54, 56, 0.13) !important;
    outline: 0 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid label,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid-required-field label,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid-email label,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row.woocommerce-invalid-phone label {
    color: #252930 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row .woocommerce-error,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row .thwcfd-error,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row .error,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row .parsley-errors-list,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row .parsley-required {
    display: block !important;
    margin: 7px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-left: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #d63638 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.55 !important;
    text-align: left !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row .woocommerce-error::before,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row .woocommerce-error::after,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row .thwcfd-error::before,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row .thwcfd-error::after,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row .error::before,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row .error::after {
    content: none !important;
    display: none !important;
}

@media (max-width: 768px) {
    body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout > .woocommerce-NoticeGroup-checkout.imv-enhanced-notice-group,
    body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout > .woocommerce-notices-wrapper.imv-enhanced-notice-group {
        order: 99 !important;
        width: 100% !important;
        margin: 0 0 4px !important;
    }

    body.woocommerce-checkout:not(.woocommerce-order-received) .imv-enhanced-notice-group .woocommerce-error,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper > .woocommerce-error {
        padding: 16px 16px !important;
        border-radius: 16px !important;
    }

    body.woocommerce-checkout:not(.woocommerce-order-received) .imv-checkout-error-heading,
    body.woocommerce-checkout:not(.woocommerce-order-received) .imv-checkout-error-subtitle,
    body.woocommerce-checkout:not(.woocommerce-order-received) .imv-enhanced-notice-group .woocommerce-error li,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error li,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper > .woocommerce-error li {
        text-align: right !important;
    }
}

/* =========================
   v8.6：WooCommerce 付款完成 / 感謝頁 UIUX
   更簡單、更高級；不改流程、不覆蓋 template，只整理前端視覺。
   ========================= */

/* 感謝頁使用結帳頁同款極簡頁首，並隱藏原本 header / footer。 */
body.woocommerce-order-received #site-header,
body.woocommerce-order-received .elementor-location-header,
body.woocommerce-order-received header[data-elementor-type="header"],
body.woocommerce-order-received #site-footer,
body.woocommerce-order-received .elementor-location-footer,
body.woocommerce-order-received footer[data-elementor-type="footer"],
body.woocommerce-order-received #footer,
body.woocommerce-order-received #footer-widgets,
body.woocommerce-order-received #footer-bottom,
body.woocommerce-order-received #top-bar-wrap,
body.woocommerce-order-received #right-sidebar,
body.woocommerce-order-received aside.sidebar-container {
    display: none !important;
}

body.woocommerce-order-received {
    background: #f7f5f1 !important;
}

body.woocommerce-order-received #main {
    width: 100% !important;
    max-width: none !important;
    padding: 46px clamp(22px, 6vw, 104px) 86px !important;
    background: transparent !important;
}

body.woocommerce-order-received #content-wrap,
body.woocommerce-order-received #primary,
body.woocommerce-order-received #content,
body.woocommerce-order-received .content-area,
body.woocommerce-order-received .site-main,
body.woocommerce-order-received .elementor-section.elementor-top-section,
body.woocommerce-order-received .elementor-section.elementor-top-section > .elementor-container,
body.woocommerce-order-received .elementor-column,
body.woocommerce-order-received .elementor-widget-wrap,
body.woocommerce-order-received .elementor-widget-container,
body.woocommerce-order-received .elementor-widget-container > .woocommerce {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

body.woocommerce-order-received .elementor-widget-container > .woocommerce,
body.woocommerce-order-received .woocommerce-notices-wrapper,
body.woocommerce-order-received .woocommerce {
    max-width: 900px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

body.woocommerce-order-received .woocommerce-order {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
}

/* 成功主視覺：保留祝賀感，但不要太多區塊感。 */
body.woocommerce-order-received .woocommerce-thankyou-order-received,
body.woocommerce-order-received .woocommerce-notice--success,
body.woocommerce-order-received .woocommerce-order > p.woocommerce-notice {
    position: relative !important;
    margin: 0 !important;
    padding: 34px 34px 34px 104px !important;
    border: 1px solid rgba(237, 147, 24, 0.16) !important;
    border-radius: 28px !important;
    background: linear-gradient(135deg, #ffffff 0%, #fffaf2 100%) !important;
    box-shadow: 0 18px 46px rgba(30, 24, 12, 0.065) !important;
    color: #1f1f1f !important;
    font-size: clamp(25px, 3vw, 36px) !important;
    line-height: 1.28 !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
}

body.woocommerce-order-received .woocommerce-thankyou-order-received::before,
body.woocommerce-order-received .woocommerce-notice--success::before {
    content: '✓' !important;
    position: absolute !important;
    left: 34px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 52px !important;
    height: 52px !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #ed9318 !important;
    color: #ffffff !important;
    font-size: 28px !important;
    font-weight: 900 !important;
    box-shadow: 0 12px 26px rgba(237, 147, 24, 0.24) !important;
}

/* 訂單基本資訊：變成一條低噪音資訊列，避免卡片太多。 */
body.woocommerce-order-received ul.woocommerce-order-overview,
body.woocommerce-order-received .woocommerce-thankyou-order-details,
body.woocommerce-order-received ul.order_details {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 18px 24px !important;
    border: 1px solid #ece8df !important;
    border-radius: 22px !important;
    background: rgba(255, 255, 255, 0.72) !important;
    list-style: none !important;
    box-shadow: 0 10px 30px rgba(30, 24, 12, 0.035) !important;
}

/* 移除上方重複的總計，保留訂單表格底部總計即可。 */
body.woocommerce-order-received ul.woocommerce-order-overview li.woocommerce-order-overview__total,
body.woocommerce-order-received ul.woocommerce-order-overview li.total,
body.woocommerce-order-received .woocommerce-thankyou-order-details li.woocommerce-order-overview__total,
body.woocommerce-order-received .woocommerce-thankyou-order-details li.total,
body.woocommerce-order-received ul.order_details li.woocommerce-order-overview__total,
body.woocommerce-order-received ul.order_details li.total {
    display: none !important;
}

body.woocommerce-order-received ul.woocommerce-order-overview li,
body.woocommerce-order-received .woocommerce-thankyou-order-details li,
body.woocommerce-order-received ul.order_details li {
    margin: 0 !important;
    padding: 0 18px !important;
    border: 0 !important;
    border-right: 1px solid #eee9df !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #8a8174 !important;
    font-size: 12px !important;
    line-height: 1.45 !important;
    font-weight: 700 !important;
    text-transform: none !important;
}

body.woocommerce-order-received ul.woocommerce-order-overview li:last-child,
body.woocommerce-order-received .woocommerce-thankyou-order-details li:last-child,
body.woocommerce-order-received ul.order_details li:last-child {
    border-right: 0 !important;
}

body.woocommerce-order-received ul.woocommerce-order-overview li strong,
body.woocommerce-order-received .woocommerce-thankyou-order-details li strong,
body.woocommerce-order-received ul.order_details li strong {
    display: block !important;
    margin-top: 4px !important;
    color: #222222 !important;
    font-size: 14px !important;
    line-height: 1.45 !important;
    font-weight: 760 !important;
    word-break: break-word !important;
}

/* 訂單區塊：統一成乾淨大卡片。 */
body.woocommerce-order-received .woocommerce-order-details,
body.woocommerce-order-received .woocommerce-bacs-bank-details,
body.woocommerce-order-received .woocommerce-order-downloads,
body.woocommerce-order-received .imv-thankyou-billing-summary {
    margin: 0 !important;
    padding: 30px !important;
    border: 1px solid #ece8df !important;
    border-radius: 28px !important;
    background: #ffffff !important;
    box-shadow: 0 18px 46px rgba(30, 24, 12, 0.055) !important;
}

body.woocommerce-order-received .woocommerce-order-details__title,
body.woocommerce-order-received .woocommerce-bacs-bank-details h2,
body.woocommerce-order-received .woocommerce-order-downloads__title,
body.woocommerce-order-received .imv-thankyou-billing-title {
    margin: 0 0 20px !important;
    color: #202020 !important;
    font-size: 21px !important;
    line-height: 1.35 !important;
    font-weight: 800 !important;
    letter-spacing: -0.01em !important;
}

/* 課程開通信提醒：取消左線，改成更像產品提示卡。 */
body.woocommerce-order-received .imv-thankyou-course-notice {
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    margin: 0 0 24px !important;
    padding: 22px 24px !important;
    border: 1px solid rgba(237, 147, 24, 0.22) !important;
    border-radius: 22px !important;
    background: linear-gradient(135deg, #fff8ec 0%, #fffdf8 100%) !important;
    color: #3f2f1d !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.64), 0 12px 28px rgba(237, 147, 24, 0.08) !important;
}

body.woocommerce-order-received .imv-thankyou-course-notice-icon {
    flex: 0 0 38px !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #ed9318 !important;
    color: #ffffff !important;
    font-size: 20px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    box-shadow: 0 10px 22px rgba(237, 147, 24, 0.22) !important;
}

body.woocommerce-order-received .imv-thankyou-course-notice-content {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
}

body.woocommerce-order-received .imv-thankyou-course-notice-content strong {
    color: #202020 !important;
    font-size: 18px !important;
    line-height: 1.45 !important;
    font-weight: 850 !important;
    letter-spacing: -0.01em !important;
}

body.woocommerce-order-received .imv-thankyou-course-notice-content span {
    color: #4f3a22 !important;
    font-size: 14.5px !important;
    line-height: 1.75 !important;
}

/* 訂單表格：移除突兀表頭，改成簡潔明細。 */
body.woocommerce-order-received table.shop_table,
body.woocommerce-order-received .woocommerce-table--order-details {
    width: 100% !important;
    margin: 0 !important;
    border: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    background: transparent !important;
}

body.woocommerce-order-received table.shop_table thead {
    display: none !important;
}

body.woocommerce-order-received table.shop_table th,
body.woocommerce-order-received table.shop_table td {
    padding: 14px 0 !important;
    border: 0 !important;
    border-bottom: 1px solid #efebe3 !important;
    color: #2d2d2d !important;
    font-size: 14.5px !important;
    line-height: 1.65 !important;
    background: transparent !important;
    vertical-align: middle !important;
}

body.woocommerce-order-received table.shop_table td.product-name,
body.woocommerce-order-received table.shop_table th.product-name {
    text-align: left !important;
    font-weight: 720 !important;
}

body.woocommerce-order-received table.shop_table td.product-total,
body.woocommerce-order-received table.shop_table th.product-total,
body.woocommerce-order-received table.shop_table tfoot td {
    text-align: right !important;
}

body.woocommerce-order-received table.shop_table tfoot th {
    color: #777064 !important;
    font-weight: 700 !important;
}

body.woocommerce-order-received table.shop_table tfoot tr.order-total th,
body.woocommerce-order-received table.shop_table tfoot tr.order-total td,
body.woocommerce-order-received table.shop_table tfoot tr:last-child th,
body.woocommerce-order-received table.shop_table tfoot tr:last-child td {
    padding-top: 18px !important;
    border-bottom: 0 !important;
    color: #202020 !important;
    font-size: 18px !important;
    font-weight: 850 !important;
}

body.woocommerce-order-received table.shop_table tbody tr:last-child td {
    border-bottom: 1px solid #efebe3 !important;
}

body.woocommerce-order-received .woocommerce-table__product-name a,
body.woocommerce-order-received table.shop_table .product-name a {
    color: #202020 !important;
    text-decoration: none !important;
    font-weight: 780 !important;
}

/* 商品數量不顯示。 */
body.woocommerce-order-received .product-quantity,
body.woocommerce-order-received strong.product-quantity,
body.woocommerce-order-received .woocommerce-table__product-name .product-quantity {
    display: none !important;
}

/* 預設帳單地址區塊較難控制，改用外掛輸出的精簡帳單資訊，避免重複與雜訊。 */
body.woocommerce-order-received .woocommerce-customer-details {
    display: none !important;
}

body.woocommerce-order-received .imv-thankyou-billing-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 12px !important;
}

body.woocommerce-order-received .imv-thankyou-billing-item {
    min-width: 0 !important;
    padding: 16px 18px !important;
    border: 1px solid #efebe3 !important;
    border-radius: 18px !important;
    background: #fbfaf7 !important;
}

body.woocommerce-order-received .imv-thankyou-billing-item span {
    display: block !important;
    margin-bottom: 6px !important;
    color: #8a8174 !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    font-weight: 700 !important;
}

body.woocommerce-order-received .imv-thankyou-billing-item strong {
    display: block !important;
    color: #222222 !important;
    font-size: 14.5px !important;
    line-height: 1.55 !important;
    font-weight: 760 !important;
    word-break: break-word !important;
}

body.woocommerce-order-received .woocommerce-order .woocommerce-message,
body.woocommerce-order-received .woocommerce-order .woocommerce-info,
body.woocommerce-order-received .woocommerce-order .woocommerce-error {
    border-radius: 18px !important;
    border: 1px solid #ece8df !important;
    background: #ffffff !important;
    box-shadow: 0 10px 28px rgba(30, 24, 12, 0.04) !important;
}

/* 付款失敗狀態也保持乾淨，不改 WooCommerce 操作流程。 */
body.woocommerce-order-received .woocommerce-notice--error,
body.woocommerce-order-received .woocommerce-thankyou-order-failed {
    padding: 24px 28px !important;
    border: 1px solid rgba(214, 54, 56, 0.16) !important;
    border-radius: 22px !important;
    background: #fff7f7 !important;
    color: #4a1f1f !important;
    box-shadow: 0 12px 30px rgba(30, 24, 12, 0.045) !important;
}

@media (max-width: 900px) {
    body.woocommerce-order-received #main {
        padding: 34px 22px 64px !important;
    }

    body.woocommerce-order-received ul.woocommerce-order-overview,
    body.woocommerce-order-received .woocommerce-thankyou-order-details,
    body.woocommerce-order-received ul.order_details,
    body.woocommerce-order-received .imv-thankyou-billing-grid {
        grid-template-columns: 1fr !important;
    }

    body.woocommerce-order-received ul.woocommerce-order-overview li,
    body.woocommerce-order-received .woocommerce-thankyou-order-details li,
    body.woocommerce-order-received ul.order_details li {
        padding: 10px 0 !important;
        border-right: 0 !important;
        border-bottom: 1px solid #efebe3 !important;
    }

    body.woocommerce-order-received ul.woocommerce-order-overview li:last-child,
    body.woocommerce-order-received .woocommerce-thankyou-order-details li:last-child,
    body.woocommerce-order-received ul.order_details li:last-child {
        border-bottom: 0 !important;
    }

    body.woocommerce-order-received .woocommerce-thankyou-order-received,
    body.woocommerce-order-received .woocommerce-notice--success,
    body.woocommerce-order-received .woocommerce-order > p.woocommerce-notice {
        padding: 28px 24px 28px 88px !important;
    }

    body.woocommerce-order-received .woocommerce-thankyou-order-received::before,
    body.woocommerce-order-received .woocommerce-notice--success::before {
        left: 24px !important;
        width: 48px !important;
        height: 48px !important;
    }
}

@media (max-width: 600px) {
    body.woocommerce-order-received #main {
        padding: 24px 16px 54px !important;
    }

    body.woocommerce-order-received .woocommerce-thankyou-order-received,
    body.woocommerce-order-received .woocommerce-notice--success,
    body.woocommerce-order-received .woocommerce-order > p.woocommerce-notice {
        padding: 88px 22px 24px !important;
        font-size: 25px !important;
        text-align: left !important;
    }

    body.woocommerce-order-received .woocommerce-thankyou-order-received::before,
    body.woocommerce-order-received .woocommerce-notice--success::before {
        left: 22px !important;
        top: 24px !important;
        transform: none !important;
    }

    body.woocommerce-order-received .woocommerce-order-details,
    body.woocommerce-order-received .woocommerce-bacs-bank-details,
    body.woocommerce-order-received .woocommerce-order-downloads,
    body.woocommerce-order-received .imv-thankyou-billing-summary {
        padding: 22px !important;
        border-radius: 22px !important;
    }

    body.woocommerce-order-received .imv-thankyou-course-notice {
        align-items: flex-start !important;
        padding: 18px !important;
        border-radius: 18px !important;
    }

    body.woocommerce-order-received .imv-thankyou-course-notice-content strong {
        font-size: 17px !important;
    }

    body.woocommerce-order-received table.shop_table th,
    body.woocommerce-order-received table.shop_table td {
        font-size: 13.5px !important;
    }

    body.woocommerce-order-received table.shop_table tfoot tr.order-total th,
    body.woocommerce-order-received table.shop_table tfoot tr.order-total td,
    body.woocommerce-order-received table.shop_table tfoot tr:last-child th,
    body.woocommerce-order-received table.shop_table tfoot tr:last-child td {
        font-size: 16.5px !important;
    }
}

/* =========================
   v8.9：結帳頁 error 文字細修
   目標：保留外框警示感，但移除錯誤文字本身的背景；欄位下方提示統一紅字。
   ========================= */
body.woocommerce-checkout:not(.woocommerce-order-received) .imv-enhanced-notice-group .woocommerce-error li a,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error li a,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper > .woocommerce-error li a,
body.woocommerce-checkout:not(.woocommerce-order-received) .imv-enhanced-notice-group .woocommerce-error li a:hover,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error li a:hover,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper > .woocommerce-error li a:hover,
body.woocommerce-checkout:not(.woocommerce-order-received) .imv-enhanced-notice-group .woocommerce-error li a:focus,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error li a:focus,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper > .woocommerce-error li a:focus {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    outline: 0 !important;
    color: #b42318 !important;
    text-decoration: none !important;
    line-height: inherit !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .imv-enhanced-notice-group .woocommerce-error li a strong,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error li a strong,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper > .woocommerce-error li a strong {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    color: inherit !important;
    font-weight: 800 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .imv-enhanced-notice-group .woocommerce-error li a::before,
body.woocommerce-checkout:not(.woocommerce-order-received) .imv-enhanced-notice-group .woocommerce-error li a::after,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error li a::before,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error li a::after,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper > .woocommerce-error li a::before,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper > .woocommerce-error li a::after {
    content: none !important;
    display: none !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row .checkout-inline-error-message,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row p.checkout-inline-error-message,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout p.checkout-inline-error-message,
body.woocommerce-checkout:not(.woocommerce-order-received) #billing_phone_description.checkout-inline-error-message,
body.woocommerce-checkout:not(.woocommerce-order-received) .checkout-inline-error-message {
    display: block !important;
    margin: 7px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-left: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    color: #d63638 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.55 !important;
    text-align: left !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row .checkout-inline-error-message::before,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout .form-row .checkout-inline-error-message::after,
body.woocommerce-checkout:not(.woocommerce-order-received) .checkout-inline-error-message::before,
body.woocommerce-checkout:not(.woocommerce-order-received) .checkout-inline-error-message::after {
    content: none !important;
    display: none !important;
}

/* =========================
   v8.9：上方錯誤提示文字置左
   目標：保留 v8.9 的錯誤框視覺，只把錯誤內容文字從置右改回置左。
   ========================= */
body.woocommerce-checkout:not(.woocommerce-order-received) .imv-checkout-error-heading,
body.woocommerce-checkout:not(.woocommerce-order-received) .imv-checkout-error-subtitle,
body.woocommerce-checkout:not(.woocommerce-order-received) .imv-enhanced-notice-group .woocommerce-error li,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error li,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper > .woocommerce-error li,
body.woocommerce-checkout:not(.woocommerce-order-received) .imv-enhanced-notice-group .woocommerce-error li a,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error li a,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper > .woocommerce-error li a {
    text-align: left !important;
}

@media (max-width: 768px) {
    body.woocommerce-checkout:not(.woocommerce-order-received) .imv-checkout-error-heading,
    body.woocommerce-checkout:not(.woocommerce-order-received) .imv-checkout-error-subtitle,
    body.woocommerce-checkout:not(.woocommerce-order-received) .imv-enhanced-notice-group .woocommerce-error li,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error li,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper > .woocommerce-error li,
    body.woocommerce-checkout:not(.woocommerce-order-received) .imv-enhanced-notice-group .woocommerce-error li a,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error li a,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-notices-wrapper > .woocommerce-error li a {
        text-align: left !important;
    }
}

/* =========================
   v8.10：強制修正上方 WooCommerce checkout error 文字對齊
   原因：錯誤訊息實際可對齊的元素是 a，本身若為 inline，text-align 不會生效。
   ========================= */
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup.woocommerce-NoticeGroup-checkout,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout div[role="alert"],
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout ul.woocommerce-error,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout > .woocommerce-NoticeGroup-checkout,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout > .woocommerce-NoticeGroup-checkout div[role="alert"],
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout > .woocommerce-NoticeGroup-checkout ul.woocommerce-error {
    text-align: left !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout ul.woocommerce-error > li,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error > li,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout > .woocommerce-NoticeGroup-checkout ul.woocommerce-error > li {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    text-align: left !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout ul.woocommerce-error > li > a,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout .woocommerce-error > li > a,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout > .woocommerce-NoticeGroup-checkout ul.woocommerce-error > li > a,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout ul.woocommerce-error > li > a:hover,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-NoticeGroup-checkout ul.woocommerce-error > li > a:focus {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    text-align: left !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
}


/* =========================================================
   v8.16：購物車保守重整 + 結帳左側間距修正
   原則：
   1. 不碰 footer / Elementor footer / body 背景。
   2. 不包裝優惠券，不做展開收合，保留 WooCommerce 原生 coupon form。
   3. 不新增刪除叉叉，保留原本 HTML 內建的 × 或 Font Awesome icon。
   4. 左側商品列不顯示價格、數量、小計；金額只放右側總計。
   ========================================================= */

/* --- 結帳頁：保留欄位來源，發票/統編完全交由 Checkout Field Editor 類外掛 --- */
body.woocommerce-checkout:not(.woocommerce-order-received) .imv-invoice-section {
    display: none !important;
}

/* --- 結帳頁：避免 section 間距過大，保留清楚但更緊湊的節奏 --- */
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout {
    row-gap: 18px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details,
body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details.col2-set {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details .col-1,
body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details .col-2 {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields {
    width: 100% !important;
    margin: 0 !important;
    padding: 26px 28px !important;
    border: 1px solid #eeeeee !important;
    border-radius: 22px !important;
    background: #ffffff !important;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.04) !important;
    box-sizing: border-box !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields > h3,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields > h3 {
    margin: 0 0 16px !important;
    padding: 0 !important;
    border: 0 !important;
    color: #222222 !important;
    font-size: 21px !important;
    font-weight: 800 !important;
    line-height: 1.35 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li label,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li label *:not(img) {
    font-weight: 700 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #order_comments_field textarea,
body.woocommerce-checkout:not(.woocommerce-order-received) textarea#order_comments,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields textarea.input-text {
    min-height: 92px !important;
    padding: 13px 14px !important;
    border: 1px solid #dddddd !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    color: #222222 !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
    box-shadow: none !important;
    outline: none !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #order_comments_field textarea:focus,
body.woocommerce-checkout:not(.woocommerce-order-received) textarea#order_comments:focus,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields textarea.input-text:focus {
    border-color: #ed9318 !important;
    box-shadow: 0 0 0 3px rgba(237, 147, 24, 0.12) !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .elementor,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-section,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-container,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-column,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-widget-wrap,
body.woocommerce-checkout:not(.woocommerce-order-received) .elementor-widget-container,
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout {
    overflow: visible !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .imv-checkout-order-summary {
    position: sticky !important;
    top: 96px !important;
    align-self: start !important;
}

/* --- 購物車頁：只處理 cart 內容，不設定 body、footer、Elementor footer 背景 --- */
body.woocommerce-cart:not(.woocommerce-checkout) #main,
body.woocommerce-cart:not(.woocommerce-checkout) .site-main {
    width: 100% !important;
    max-width: none !important;
    min-height: calc(100vh - 230px) !important;
    padding: 48px clamp(24px, 6vw, 96px) 88px !important;
    box-sizing: border-box !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) #right-sidebar,
body.woocommerce-cart:not(.woocommerce-checkout) aside.sidebar-container,
body.woocommerce-cart:not(.woocommerce-checkout) #secondary {
    display: none !important;
}

/* 原生 WooCommerce cart：左右兩欄 */
body.woocommerce-cart:not(.woocommerce-checkout) main .woocommerce:has(> .woocommerce-cart-form),
body.woocommerce-cart:not(.woocommerce-checkout) .entry-content > .woocommerce:has(> .woocommerce-cart-form),
body.woocommerce-cart:not(.woocommerce-checkout) .elementor-widget-container > .woocommerce:has(> .woocommerce-cart-form) {
    width: min(1180px, 100%) !important;
    max-width: 1180px !important;
    margin: 0 auto !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px) !important;
    gap: 32px !important;
    align-items: start !important;
    box-sizing: border-box !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce > .woocommerce-notices-wrapper {
    grid-column: 1 / -1 !important;
    margin: 0 0 16px !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce > .woocommerce-cart-form {
    grid-column: 1 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce > .cart-collaterals {
    grid-column: 2 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    clear: none !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* Jet Woo Builder cart：只鎖 cart builder 內部，不碰 footer Elementor */
body.woocommerce-cart:not(.woocommerce-checkout) .jet-woo-builder-woocommerce-cart,
body.woocommerce-cart:not(.woocommerce-checkout) .jet-woo-builder-woocommerce-cart > .elementor {
    width: min(1180px, 100%) !important;
    max-width: 1180px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .jet-woo-builder-woocommerce-cart .elementor-section.elementor-inner-section > .elementor-container {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px) !important;
    gap: 32px !important;
    align-items: start !important;
    width: 100% !important;
    max-width: 1180px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .jet-woo-builder-woocommerce-cart .elementor-inner-column,
body.woocommerce-cart:not(.woocommerce-checkout) .jet-woo-builder-woocommerce-cart .elementor-inner-column > .elementor-widget-wrap {
    width: 100% !important;
    max-width: none !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .jet-woo-builder-woocommerce-cart .elementor-inner-column.elementor-col-50 {
    width: 100% !important;
}

/* 左側商品區：自然商品列，不做笨重外框 */
body.woocommerce-cart:not(.woocommerce-checkout) .elementor-jet-cart-table,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.shop_table {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart thead {
    display: none !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart tbody {
    display: block !important;
    width: 100% !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart tr.cart_item {
    display: grid !important;
    grid-template-columns: 96px minmax(0, 1fr) 36px !important;
    gap: 18px !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 120px !important;
    margin: 0 !important;
    padding: 18px 0 !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    background: transparent !important;
    box-shadow: none !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* 不顯示左側金額 / 數量 / 小計：支援原生與 Jet */
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart th.product-price,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart th.product-quantity,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart th.product-subtotal,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart th.table-heading-price,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart th.table-heading-quantity,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart th.table-heading-subtotal,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart th[class*="heading-price"],
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart th[class*="heading-quantity"],
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart th[class*="heading-subtotal"],
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-price,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-quantity,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-subtotal,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td[data-title="價錢"],
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td[data-title="價格"],
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td[data-title="數量"],
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td[data-title="總額"],
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td[data-title="小計"] {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-price::before,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-quantity::before,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-subtotal::before {
    content: none !important;
    display: none !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 96px !important;
    padding: 0 !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail a,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail img {
    display: block !important;
    width: 96px !important;
    height: 96px !important;
    max-width: 96px !important;
    object-fit: cover !important;
    border-radius: 16px !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-name {
    grid-column: 2 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
    padding: 0 !important;
    align-self: center !important;
    text-align: left !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-name a {
    display: block !important;
    color: #222222 !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    line-height: 1.55 !important;
    text-decoration: none !important;
}

/* 刪除按鈕：絕對不新增叉叉，只保留原本 HTML 內建的 × 或 <i class="fa-times"> */
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-remove {
    grid-column: 3 !important;
    grid-row: 1 !important;
    position: static !important;
    align-self: center !important;
    justify-self: end !important;
    width: auto !important;
    padding: 0 !important;
    text-align: right !important;
    background: transparent !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart a.remove {
    position: static !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #e8ded4 !important;
    border-radius: 999px !important;
    background: #ffffff !important;
    color: #9c6a58 !important;
    font-size: 20px !important;
    line-height: 1 !important;
    font-weight: 600 !important;
    text-indent: 0 !important;
    overflow: visible !important;
    text-decoration: none !important;
    box-shadow: none !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart a.remove::before,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart a.remove::after,
body.woocommerce-cart:not(.woocommerce-checkout) .elementor-jet-cart-table table.cart a.remove::before,
body.woocommerce-cart:not(.woocommerce-checkout) .elementor-jet-cart-table table.cart a.remove::after {
    content: none !important;
    display: none !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart a.remove i,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart a.remove svg,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart a.remove .fas,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart a.remove .fa,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart a.remove .fa-times {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: auto !important;
    height: auto !important;
    color: currentColor !important;
    font-size: 14px !important;
    line-height: 1 !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart a.remove:hover,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart a.remove:focus {
    border-color: #d63638 !important;
    background: #fff7f7 !important;
    color: #d63638 !important;
}

/* 優惠券：退回 WooCommerce 原本的 visible form，不收合、不展開、不包裝 */
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart tr:has(td.actions),
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.actions {
    display: block !important;
    width: 100% !important;
    margin: 16px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    text-align: left !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.actions .coupon {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: min(540px, 100%) !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.actions .coupon[hidden],
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.actions .coupon.imv-coupon-panel[hidden] {
    display: flex !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.actions .coupon label,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.actions br,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.actions button br {
    display: none !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.actions .coupon input.input-text,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.actions .coupon #coupon_code {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0 14px !important;
    border: 1px solid #dddddd !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    color: #222222 !important;
    font-size: 14px !important;
    box-shadow: none !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.actions .coupon button.button,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.actions .coupon input.button {
    flex: 0 0 auto !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0 16px !important;
    border: 1px solid #252930 !important;
    border-radius: 10px !important;
    background: #252930 !important;
    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    box-shadow: none !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.actions button[name="update_cart"],
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.actions input[name="update_cart"] {
    display: none !important;
}

/* 右側訂單金額 */
body.woocommerce-cart:not(.woocommerce-checkout) .cart-collaterals,
body.woocommerce-cart:not(.woocommerce-checkout) .elementor-jet-cart-totals {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals,
body.woocommerce-cart:not(.woocommerce-checkout) .cart-collaterals .cart_totals,
body.woocommerce-cart:not(.woocommerce-checkout) .elementor-jet-cart-totals .cart_totals {
    width: 100% !important;
    margin: 0 !important;
    padding: 26px !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    border-radius: 22px !important;
    background: #ffffff !important;
    box-shadow: 0 16px 42px rgba(30, 24, 12, 0.06) !important;
    box-sizing: border-box !important;
    position: sticky !important;
    top: 96px !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals h2 {
    margin: 0 0 16px !important;
    padding: 0 0 14px !important;
    border-bottom: 1px solid #eeeeee !important;
    background: transparent !important;
    color: transparent !important;
    font-size: 0 !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals h2::after {
    content: "訂單金額" !important;
    display: block !important;
    color: #222222 !important;
    font-size: 21px !important;
    line-height: 1.35 !important;
    font-weight: 900 !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table,
body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table tbody,
body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table tr,
body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table th,
body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table td {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table th,
body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table td {
    padding: 14px 0 !important;
    border: 0 !important;
    border-bottom: 1px solid #eeeeee !important;
    vertical-align: middle !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table tr:last-child th,
body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table tr:last-child td {
    border-bottom: 0 !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table th {
    color: #777777 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-align: left !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table td {
    color: #222222 !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    text-align: right !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .wc-proceed-to-checkout,
body.woocommerce-cart:not(.woocommerce-checkout) .wc-proceed-to-checkout p {
    width: 100% !important;
    margin: 18px 0 0 !important;
    padding: 0 !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .wc-proceed-to-checkout br,
body.woocommerce-cart:not(.woocommerce-checkout) .wc-proceed-to-checkout a.checkout-button br {
    display: none !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .wc-proceed-to-checkout a.checkout-button,
body.woocommerce-cart:not(.woocommerce-checkout) .wc-proceed-to-checkout .checkout-button.button,
body.woocommerce-cart:not(.woocommerce-checkout) .wc-proceed-to-checkout .button.alt,
body.woocommerce-cart:not(.woocommerce-checkout) a.checkout-button.button.alt.wc-forward {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 54px !important;
    margin: 0 !important;
    padding: 0 20px !important;
    border: 1px solid #ed9318 !important;
    border-radius: 14px !important;
    background: #ed9318 !important;
    color: #ffffff !important;
    font-size: 16px !important;
    font-weight: 900 !important;
    line-height: 1.2 !important;
    text-align: center !important;
    text-decoration: none !important;
    box-shadow: 0 14px 26px rgba(237, 147, 24, 0.22) !important;
    box-sizing: border-box !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .wc-proceed-to-checkout a.checkout-button:hover,
body.woocommerce-cart:not(.woocommerce-checkout) .wc-proceed-to-checkout a.checkout-button:focus {
    background: #d87f0d !important;
    border-color: #d87f0d !important;
    color: #ffffff !important;
}

@media (max-width: 1024px) {
    body.woocommerce-cart:not(.woocommerce-checkout) main .woocommerce:has(> .woocommerce-cart-form),
    body.woocommerce-cart:not(.woocommerce-checkout) .entry-content > .woocommerce:has(> .woocommerce-cart-form),
    body.woocommerce-cart:not(.woocommerce-checkout) .elementor-widget-container > .woocommerce:has(> .woocommerce-cart-form),
    body.woocommerce-cart:not(.woocommerce-checkout) .jet-woo-builder-woocommerce-cart .elementor-section.elementor-inner-section > .elementor-container {
        grid-template-columns: minmax(0, 1fr) 340px !important;
        gap: 24px !important;
    }
}

@media (max-width: 768px) {
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields {
        padding: 22px 18px !important;
        border-radius: 18px !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) #main,
    body.woocommerce-cart:not(.woocommerce-checkout) .site-main {
        padding: 28px 16px 72px !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) main .woocommerce:has(> .woocommerce-cart-form),
    body.woocommerce-cart:not(.woocommerce-checkout) .entry-content > .woocommerce:has(> .woocommerce-cart-form),
    body.woocommerce-cart:not(.woocommerce-checkout) .elementor-widget-container > .woocommerce:has(> .woocommerce-cart-form),
    body.woocommerce-cart:not(.woocommerce-checkout) .jet-woo-builder-woocommerce-cart .elementor-section.elementor-inner-section > .elementor-container {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce > .cart-collaterals,
    body.woocommerce-cart:not(.woocommerce-checkout) .cart-collaterals,
    body.woocommerce-cart:not(.woocommerce-checkout) .elementor-jet-cart-totals {
        margin-top: 24px !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart tr.cart_item {
        grid-template-columns: 82px minmax(0, 1fr) 32px !important;
        gap: 14px !important;
        min-height: 104px !important;
        padding: 14px 0 !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail,
    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail a,
    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail img {
        width: 82px !important;
        height: 82px !important;
        max-width: 82px !important;
        border-radius: 15px !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-name a {
        font-size: 16px !important;
        line-height: 1.5 !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.actions .coupon {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.actions .coupon button.button,
    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.actions .coupon input.button {
        width: 100% !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals,
    body.woocommerce-cart:not(.woocommerce-checkout) .cart-collaterals .cart_totals,
    body.woocommerce-cart:not(.woocommerce-checkout) .elementor-jet-cart-totals .cart_totals {
        position: static !important;
        padding: 22px !important;
        border-radius: 20px !important;
    }
}

/* =========================================================
   v8.17：購物車總計 / 結帳付款 UI 精修
   原則：不碰購物車 footer、不改優惠券功能、不改金流流程。
   ========================================================= */

/* --- 購物車頁：新增乾淨標題，不依賴 Elementor 標題 --- */
body.woocommerce-cart:not(.woocommerce-checkout) #main::before {
    content: "購物車" !important;
    display: block !important;
    width: min(1180px, 100%) !important;
    max-width: 1180px !important;
    margin: 0 auto 24px !important;
    padding: 0 !important;
    color: #222222 !important;
    font-size: clamp(26px, 3vw, 36px) !important;
    line-height: 1.2 !important;
    font-weight: 900 !important;
    letter-spacing: -0.02em !important;
    box-sizing: border-box !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) #main::after {
    content: "確認商品後，即可前往結帳完成課程購買。" !important;
    display: block !important;
    width: min(1180px, 100%) !important;
    max-width: 1180px !important;
    margin: -16px auto 28px !important;
    color: #777777 !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
    font-weight: 500 !important;
    box-sizing: border-box !important;
}

/* --- 購物車頁：移除「小計 / 總計」表格本身的灰色外框，只保留右側卡片外框 --- */
body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table,
body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table.shop_table_responsive,
body.woocommerce-cart:not(.woocommerce-checkout) .elementor-jet-cart-totals .cart_totals table.shop_table,
body.woocommerce-cart:not(.woocommerce-checkout) .cart-collaterals .cart_totals table.shop_table {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    background: transparent !important;
    margin: 0 !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table tbody,
body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table tfoot,
body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table tr,
body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table th,
body.woocommerce-cart:not(.woocommerce-checkout) .cart_totals table.shop_table td {
    border-left: 0 !important;
    border-right: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}

/* --- 按鈕陰影收斂：保留立體感，但不要暈染太重 --- */
body.woocommerce-cart:not(.woocommerce-checkout) .wc-proceed-to-checkout a.checkout-button,
body.woocommerce-cart:not(.woocommerce-checkout) .wc-proceed-to-checkout .checkout-button.button,
body.woocommerce-cart:not(.woocommerce-checkout) .wc-proceed-to-checkout .button.alt,
body.woocommerce-cart:not(.woocommerce-checkout) a.checkout-button.button.alt.wc-forward,
body.woocommerce-checkout:not(.woocommerce-order-received) #place_order,
body.woocommerce-checkout:not(.woocommerce-order-received) .imv-summary-actions #place_order,
body.woocommerce-checkout:not(.woocommerce-order-received) .imv-apply-coupon-button,
body.woocommerce-checkout:not(.woocommerce-order-received) button.button.alt,
body.woocommerce-checkout:not(.woocommerce-order-received) input.button.alt {
    box-shadow: 0 8px 16px rgba(237, 147, 24, 0.14) !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .wc-proceed-to-checkout a.checkout-button:hover,
body.woocommerce-cart:not(.woocommerce-checkout) .wc-proceed-to-checkout a.checkout-button:focus,
body.woocommerce-checkout:not(.woocommerce-order-received) #place_order:hover,
body.woocommerce-checkout:not(.woocommerce-order-received) #place_order:focus,
body.woocommerce-checkout:not(.woocommerce-order-received) .imv-apply-coupon-button:hover,
body.woocommerce-checkout:not(.woocommerce-order-received) .imv-apply-coupon-button:focus {
    box-shadow: 0 10px 18px rgba(237, 147, 24, 0.16) !important;
}

/* --- 結帳頁：付款方式文字黑色、正常粗體 --- */
body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li label,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li label span,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li label *:not(img) {
    color: #222222 !important;
    font-weight: 800 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li input[type="radio"] + label {
    color: #222222 !important;
    font-weight: 800 !important;
}

/* --- 結帳頁：付款方式展開提示框改為淺灰，不使用 WooCommerce / 金流外掛預設紫灰色 --- */
body.woocommerce-checkout:not(.woocommerce-order-received) #payment div.payment_box,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment div.payment_box.payment_method_ry_newebpay_credit,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment .payment_box.payment_method_ry_newebpay_credit {
    margin: 12px 0 0 !important;
    padding: 14px 16px !important;
    border: 1px solid #eeeeee !important;
    border-radius: 12px !important;
    background: #f7f7f7 !important;
    background-color: #f7f7f7 !important;
    color: #333333 !important;
    font-size: 14px !important;
    line-height: 1.7 !important;
    box-shadow: none !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #payment div.payment_box::before,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment div.payment_box.payment_method_ry_newebpay_credit::before,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment .payment_box.payment_method_ry_newebpay_credit::before {
    border-bottom-color: #f7f7f7 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #payment div.payment_box p {
    margin: 0 !important;
    color: #333333 !important;
}

/* --- 結帳頁：縮小左側 section 間距，讓付款方式 / 帳單資訊 / 額外資訊更緊湊 --- */
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout {
    row-gap: 12px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #order_review,
body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details,
body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details.col2-set {
    gap: 12px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .imv-summary-card,
body.woocommerce-checkout:not(.woocommerce-order-received) #order_review,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields {
    padding: 24px 26px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #order_review::before,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields > h3,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields > h3,
body.woocommerce-checkout:not(.woocommerce-order-received) .imv-section-title {
    margin-bottom: 12px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .imv-payment-security-notice {
    margin: -2px 0 14px !important;
}

@media (max-width: 768px) {
    body.woocommerce-cart:not(.woocommerce-checkout) #main::before,
    body.woocommerce-cart:not(.woocommerce-checkout) #main::after {
        width: 100% !important;
        max-width: 100% !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) #main::before {
        margin-bottom: 20px !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) #main::after {
        margin-top: -12px !important;
        margin-bottom: 22px !important;
        font-size: 14px !important;
    }

    body.woocommerce-checkout:not(.woocommerce-order-received) .imv-summary-card,
    body.woocommerce-checkout:not(.woocommerce-order-received) #order_review,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields {
        padding: 20px 18px !important;
    }
}


/* =========================================================
   v8.18：結帳頁左側間距強制收斂 + Select2 圖示重疊修正
   原則：不碰金流流程、不碰欄位來源、不碰 footer。
   ========================================================= */

/* 1) 結帳左側 section 間距：直接壓低 grid row-gap、卡片 margin、卡片 padding。
   這裡刻意放在 CSS 最後，用更高權重覆蓋前面所有版本。 */
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout {
    row-gap: 6px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #order_review,
body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details,
body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details.col2-set,
body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details .col-1,
body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details .col-2,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details,
body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details.col2-set {
    gap: 6px !important;
    row-gap: 6px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #order_review,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields {
    padding: 18px 22px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #payment,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment div.form-row,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields__field-wrapper,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields__field-wrapper {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #order_review::before,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields > h3,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields > h3 {
    margin-bottom: 8px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .imv-payment-security-notice {
    margin: 0 0 8px !important;
    padding: 10px 12px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #payment div.payment_box,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment div.payment_box.payment_method_ry_newebpay_credit,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment .payment_box.payment_method_ry_newebpay_credit {
    margin: 8px 0 0 !important;
    padding: 12px 14px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) form .form-row {
    margin-bottom: 10px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) form .form-row:last-child {
    margin-bottom: 0 !important;
}

/* 2) Select2 欄位：修正可清除叉叉與下拉箭頭重疊。
   性別欄位通常會被 Select2 包成 single select，這裡保留兩個 icon，但把 clear 往左。 */
body.woocommerce-checkout:not(.woocommerce-order-received) .select2-container--default .select2-selection--single {
    position: relative !important;
    min-height: 44px !important;
    padding-right: 0 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .select2-container--default .select2-selection--single .select2-selection__rendered {
    min-height: 44px !important;
    line-height: 44px !important;
    padding-left: 14px !important;
    padding-right: 64px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .select2-container--default .select2-selection--single .select2-selection__arrow {
    position: absolute !important;
    top: 50% !important;
    right: 12px !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    transform: translateY(-50%) !important;
    z-index: 1 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute !important;
    top: 50% !important;
    right: 38px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    float: none !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: translateY(-50%) !important;
    color: #999999 !important;
    font-size: 16px !important;
    line-height: 1 !important;
    font-weight: 700 !important;
    z-index: 2 !important;
    text-decoration: none !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .select2-container--default .select2-selection--single .select2-selection__clear:hover {
    color: #d63638 !important;
}

@media (max-width: 768px) {
    body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout,
    body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details,
    body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details.col2-set {
        gap: 8px !important;
        row-gap: 8px !important;
    }

    body.woocommerce-checkout:not(.woocommerce-order-received) #order_review,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields {
        padding: 18px 16px !important;
    }
}

/* =========================================================
   UIUX 細節極致優化補丁 (覆蓋上方原始設定)
   ========================================================= */

/* 1. 結帳頁 Section 間距微調 (縮小過大的空曠感) */
body.woocommerce-checkout form.checkout.woocommerce-checkout {
    row-gap: 16px !important; /* 原為 24px，拉近上下區塊距離 */
}
.imv-summary-card,
body.woocommerce-checkout #customer_details,
body.woocommerce-checkout #order_review,
body.woocommerce-checkout .imv-invoice-section {
    padding: 24px 28px !important; /* 原為 32px，微縮上下內距，左右保持舒適 */
}

/* 2. 結帳方式列表優化：增加間距、Logo 放大並靠右對齊 */
body.woocommerce-checkout #payment ul.payment_methods li {
    margin-bottom: 16px !important; /* 增加各付款方式之間的距離，避免誤觸 */
    padding-bottom: 8px !important;
}
body.woocommerce-checkout #payment ul.payment_methods li:last-child {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}
body.woocommerce-checkout #payment ul.payment_methods li label {
    width: 100% !important; /* 讓 label 撐滿整行，為了下面把 Logo 推到右邊做準備 */
    gap: 10px !important; /* 讓 radio 圓點與文字不要太擠 */
    align-items: center !important; 
}
body.woocommerce-checkout #payment ul.payment_methods li label img,
body.woocommerce-checkout #payment ul.payment_methods li img {
    max-height: 28px !important; /* 原為 22px，稍微放大提升辨識度 */
    max-width: 90px !important;
    margin-left: auto !important; /* ✨ 視覺魔法：把 Logo 全部推到最右側，排版變超整齊！ */
}
body.woocommerce-checkout #payment ul.payment_methods li.payment_method_linepay-tw label img.imv-linepay-logo,
body.woocommerce-checkout #payment ul.payment_methods li.payment_method_linepay-tw label img {
    max-height: 24px !important; /* LINE Pay 比例微調 */
    max-width: 80px !important;
}
/* 處理點選付款方式後展開的灰色說明區塊間距 */
body.woocommerce-checkout #payment div.payment_box {
    margin-top: 12px !important;
    margin-bottom: 16px !important;
    padding: 16px !important;
    background-color: #f8f9fa !important;
    border-radius: 8px !important;
}

/* 3. 購物車頁標題對齊 (確保與下方內容 1160px 左側邊緣切齊) */
body.woocommerce-cart .page-title,
body.woocommerce-cart h1.entry-title,
body.woocommerce-cart .woocommerce > .page-title,
body.woocommerce-cart .woocommerce > h1 {
    max-width: 1160px !important; 
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    text-align: left !important;
}

/* =========================================
   4. 額外細節贈送：絲滑互動與絕對對齊
   ========================================= */

/* A. 欄位 Focus 漸變過渡 (避免框線突然跳出的生硬感) */
body.woocommerce-checkout form .form-row input.input-text, 
body.woocommerce-checkout form .form-row select, 
body.woocommerce-checkout form .form-row textarea,
.imv-coupon-input {
    transition: border-color 0.25s ease, box-shadow 0.25s ease !important;
}

/* B. 按鈕點擊微反饋 (點下去有實體按鈕被壓下去的感覺) */
body.woocommerce-checkout #place_order:active,
.imv-coupon-row .imv-apply-coupon-button.button:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* C. 條款 Checkbox 與文字的「絕對垂直置中」 */
.imv-summary-actions .woocommerce-terms-and-conditions-wrapper label.checkbox {
    align-items: center !important; /* 原本是 flex-start，改成 center 治癒強迫症 */
}
.imv-summary-actions .woocommerce-terms-and-conditions-wrapper input[type="checkbox"] {
    margin-top: 0 !important; /* 拔掉原有的位移 */
}

/* =========================================================
   v8.20：付款方式同一行 + 購物車標題置中補丁
   原則：只修 UI，不動功能 / 金流 / 轉址 / footer。
   ========================================================= */

/* 1. 結帳頁：付款方式 radio 與付款文字強制同一行 */
body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    column-gap: 10px !important;
    row-gap: 0 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li > input[type="radio"] {
    flex: 0 0 auto !important;
    display: inline-block !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    position: static !important;
    vertical-align: middle !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li > input[type="radio"] + label,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li > label {
    flex: 1 1 0 !important;
    display: inline-flex !important;
    width: auto !important;
    max-width: calc(100% - 34px) !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    line-height: 1.4 !important;
    white-space: normal !important;
}

/* 讓付款方式說明框維持在下一整行，不擠壓 radio + label */
body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li > .payment_box,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li > div.payment_box {
    flex: 0 0 100% !important;
    width: 100% !important;
}

/* 2. 購物車頁：標題與說明文字置中 */
body.woocommerce-cart:not(.woocommerce-checkout) #main::before,
body.woocommerce-cart:not(.woocommerce-checkout) #main::after,
body.woocommerce-cart .page-title,
body.woocommerce-cart h1.entry-title,
body.woocommerce-cart .woocommerce > .page-title,
body.woocommerce-cart .woocommerce > h1 {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}


/* =========================================================
   v8.21 感謝頁跑版修正：訂單資訊列、課程提醒、帳單資訊獨立
   ========================================================= */

/* 訂單基本資訊列：清掉 WooCommerce/OceanWP 原生 float/width，避免電子郵件區塊掉位。 */
body.woocommerce-order-received ul.woocommerce-order-overview,
body.woocommerce-order-received .woocommerce-thankyou-order-details,
body.woocommerce-order-received ul.order_details {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    align-items: stretch !important;
    gap: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

body.woocommerce-order-received ul.woocommerce-order-overview::before,
body.woocommerce-order-received ul.woocommerce-order-overview::after,
body.woocommerce-order-received .woocommerce-thankyou-order-details::before,
body.woocommerce-order-received .woocommerce-thankyou-order-details::after,
body.woocommerce-order-received ul.order_details::before,
body.woocommerce-order-received ul.order_details::after {
    content: none !important;
    display: none !important;
}

body.woocommerce-order-received ul.woocommerce-order-overview li,
body.woocommerce-order-received .woocommerce-thankyou-order-details li,
body.woocommerce-order-received ul.order_details li {
    float: none !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: 68px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    word-break: break-word !important;
}

/* 若 WooCommerce 輸出多餘項目，仍只保留目前設計需要的核心資訊，避免第二排破壞版面。 */
body.woocommerce-order-received ul.woocommerce-order-overview li.woocommerce-order-overview__payment-method,
body.woocommerce-order-received .woocommerce-thankyou-order-details li.woocommerce-order-overview__payment-method,
body.woocommerce-order-received ul.order_details li.woocommerce-order-overview__payment-method,
body.woocommerce-order-received ul.order_details li.method {
    display: none !important;
}

body.woocommerce-order-received ul.woocommerce-order-overview li strong,
body.woocommerce-order-received .woocommerce-thankyou-order-details li strong,
body.woocommerce-order-received ul.order_details li strong {
    width: 100% !important;
    max-width: 100% !important;
}

/* 課程開通信提醒：確保它在訂單明細卡片內是完整寬度，不被 p / float / table 樣式影響。 */
body.woocommerce-order-received .woocommerce-order-details .imv-thankyou-course-notice {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    clear: both !important;
}

body.woocommerce-order-received .woocommerce-order-details .imv-thankyou-course-notice p,
body.woocommerce-order-received .imv-thankyou-course-notice-content p {
    margin: 0 !important;
    padding: 0 !important;
}

/* 帳單資訊：v8.21 已改由 woocommerce_thankyou 輸出，視覺上獨立於訂單明細卡片。 */
body.woocommerce-order-received .woocommerce-order-details + .imv-thankyou-billing-summary,
body.woocommerce-order-received .imv-thankyou-billing-summary {
    margin-top: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

@media (max-width: 900px) {
    body.woocommerce-order-received ul.woocommerce-order-overview,
    body.woocommerce-order-received .woocommerce-thankyou-order-details,
    body.woocommerce-order-received ul.order_details {
        grid-template-columns: 1fr !important;
        overflow: visible !important;
    }

    body.woocommerce-order-received ul.woocommerce-order-overview li,
    body.woocommerce-order-received .woocommerce-thankyou-order-details li,
    body.woocommerce-order-received ul.order_details li {
        min-height: 0 !important;
        justify-content: flex-start !important;
    }
}


/* =========================================================
   v8.22 感謝頁：課程開通信提醒卡距離修正
   目的：修掉提醒卡內部上下距離過鬆、文字區與 icon 對齊不自然的問題。
   只調整感謝頁前端 UI，不影響訂單流程。
   ========================================================= */
body.woocommerce-order-received .woocommerce-order-details .imv-thankyou-course-notice,
body.woocommerce-order-received .imv-thankyou-course-notice {
    display: grid !important;
    grid-template-columns: 34px minmax(0, 1fr) !important;
    align-items: center !important;
    column-gap: 16px !important;
    row-gap: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 0 22px !important;
    padding: 20px 24px !important;
    min-height: auto !important;
}

body.woocommerce-order-received .imv-thankyou-course-notice-icon {
    width: 34px !important;
    height: 34px !important;
    flex: 0 0 34px !important;
    align-self: center !important;
    margin: 0 !important;
    font-size: 18px !important;
    line-height: 1 !important;
}

body.woocommerce-order-received .imv-thankyou-course-notice-content {
    display: block !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.woocommerce-order-received .imv-thankyou-course-notice-content strong {
    display: block !important;
    margin: 0 0 8px !important;
    padding: 0 !important;
    font-size: 18px !important;
    line-height: 1.35 !important;
    font-weight: 850 !important;
}

body.woocommerce-order-received .imv-thankyou-course-notice-content span {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 14.5px !important;
    line-height: 1.65 !important;
}

body.woocommerce-order-received .imv-thankyou-course-notice > p,
body.woocommerce-order-received .imv-thankyou-course-notice-content > p {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

@media (max-width: 768px) {
    body.woocommerce-order-received .woocommerce-order-details .imv-thankyou-course-notice,
    body.woocommerce-order-received .imv-thankyou-course-notice {
        grid-template-columns: 32px minmax(0, 1fr) !important;
        column-gap: 12px !important;
        padding: 18px 18px !important;
        margin-bottom: 20px !important;
    }

    body.woocommerce-order-received .imv-thankyou-course-notice-icon {
        width: 32px !important;
        height: 32px !important;
        flex-basis: 32px !important;
        font-size: 17px !important;
    }

    body.woocommerce-order-received .imv-thankyou-course-notice-content strong {
        font-size: 17px !important;
        margin-bottom: 6px !important;
    }

    body.woocommerce-order-received .imv-thankyou-course-notice-content span {
        font-size: 14px !important;
        line-height: 1.65 !important;
    }
}


/* =========================================================
   v8.23：感謝頁提醒換行移除 + 結帳左側區塊內距/行高修正
   原則：只修 UI，不動付款流程 / 欄位來源 / 金流 / 轉址。
   ========================================================= */

/* 1) 感謝頁：提醒卡移除不必要換行後，改為自然橫向文字流，避免標題與說明被撐開。 */
body.woocommerce-order-received .imv-thankyou-course-notice {
    align-items: center !important;
    padding: 20px 24px !important;
}

body.woocommerce-order-received .imv-thankyou-course-notice-content {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: baseline !important;
    gap: 8px 10px !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.woocommerce-order-received .imv-thankyou-course-notice-content strong {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 18px !important;
    line-height: 1.55 !important;
    font-weight: 850 !important;
    white-space: nowrap !important;
}

body.woocommerce-order-received .imv-thankyou-course-notice-content span {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 14.5px !important;
    line-height: 1.75 !important;
}

body.woocommerce-order-received .imv-thankyou-course-notice-content br {
    display: none !important;
}

/* 2) 結帳頁：維持 section 間距不放大，但把「區塊裡面」的呼吸感補回來。 */
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout {
    row-gap: 14px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details,
body.woocommerce-checkout:not(.woocommerce-order-received) #customer_details.col2-set {
    gap: 14px !important;
    row-gap: 14px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #order_review,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields {
    padding: 28px 28px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #order_review::before,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields > h3,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields > h3 {
    margin-bottom: 18px !important;
    line-height: 1.35 !important;
}

/* 付款方式區：讓標題、提示、radio 選項之間不要擠在一起。 */
body.woocommerce-checkout:not(.woocommerce-order-received) .imv-payment-security-notice {
    margin: 0 0 18px !important;
    padding: 15px 16px !important;
    line-height: 1.8 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods {
    gap: 12px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li {
    margin-bottom: 14px !important;
    padding-bottom: 10px !important;
    line-height: 1.55 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li:last-child {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li > input[type="radio"] + label,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment ul.payment_methods li > label {
    line-height: 1.55 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #payment div.payment_box,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment div.payment_box.payment_method_ry_newebpay_credit,
body.woocommerce-checkout:not(.woocommerce-order-received) #payment .payment_box.payment_method_ry_newebpay_credit {
    margin-top: 14px !important;
    padding: 16px 18px !important;
    line-height: 1.75 !important;
}

/* 帳單資訊 / 額外資訊：欄位 label、input、select 的上下距離與行高。 */
body.woocommerce-checkout:not(.woocommerce-order-received) form .form-row,
body.woocommerce-checkout:not(.woocommerce-order-received) form .thwcfd-field-wrapper {
    margin-bottom: 18px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) form .form-row:last-child,
body.woocommerce-checkout:not(.woocommerce-order-received) form .thwcfd-field-wrapper:last-child {
    margin-bottom: 0 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) form .form-row label,
body.woocommerce-checkout:not(.woocommerce-order-received) form .thwcfd-field-wrapper label {
    margin-bottom: 8px !important;
    line-height: 1.55 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) form .form-row input.input-text,
body.woocommerce-checkout:not(.woocommerce-order-received) form .form-row select,
body.woocommerce-checkout:not(.woocommerce-order-received) form .form-row textarea {
    min-height: 46px !important;
    padding: 11px 15px !important;
    line-height: 1.6 !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) form .form-row textarea {
    min-height: 112px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .select2-container--default .select2-selection--single {
    min-height: 48px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .select2-container--default .select2-selection--single .select2-selection__rendered {
    min-height: 48px !important;
    line-height: 48px !important;
    padding-left: 15px !important;
}

@media (max-width: 768px) {
    body.woocommerce-order-received .imv-thankyou-course-notice-content {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
    }

    body.woocommerce-order-received .imv-thankyou-course-notice-content strong {
        white-space: normal !important;
    }

    body.woocommerce-checkout:not(.woocommerce-order-received) #order_review,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields {
        padding: 24px 18px !important;
    }

    body.woocommerce-checkout:not(.woocommerce-order-received) form .form-row,
    body.woocommerce-checkout:not(.woocommerce-order-received) form .thwcfd-field-wrapper {
        margin-bottom: 16px !important;
    }
}

/* =========================================================
   v8.24：結帳頁帳單資訊 / 額外資訊 Responsive + 指定間距覆蓋
   ========================================================= */
body.woocommerce-checkout:not(.woocommerce-order-received) form.checkout.woocommerce-checkout {
    row-gap: 0px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .imv-payment-security-notice {
    margin: 18px 0 24px !important;
    padding: 10px 18px !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) #order_review,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields {
    padding: 30px 24px !important;
}

/* 帳單資訊 / 額外資訊：RWD 基礎保護，避免手機版欄位撐破卡片 */
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields .form-row,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields .form-row,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields .thwcfd-field-wrapper,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields .thwcfd-field-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    float: none !important;
    clear: both !important;
}

body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields input,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields select,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields textarea,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields input,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields select,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields textarea,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields .select2-container,
body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields .select2-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

@media (max-width: 768px) {
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields,
    body.woocommerce-checkout:not(.woocommerce-order-received) #order_review {
        padding: 24px 18px !important;
        border-radius: 18px !important;
    }

    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields .form-row,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields .form-row,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields .thwcfd-field-wrapper,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields .thwcfd-field-wrapper {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        display: block !important;
    }
}

@media (max-width: 480px) {
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-billing-fields,
    body.woocommerce-checkout:not(.woocommerce-order-received) .woocommerce-additional-fields,
    body.woocommerce-checkout:not(.woocommerce-order-received) #order_review {
        padding: 22px 16px !important;
        border-radius: 16px !important;
    }

    body.woocommerce-checkout:not(.woocommerce-order-received) .imv-payment-security-notice {
        margin: 14px 0 18px !important;
        padding: 10px 14px !important;
    }
}

/* =========================================================
   v8.26：購物車手機版商品列修正
   目的：手機版顯示商品圖片、移除 data-title「商品」字樣、統一無連結商品名稱字重。
   原則：只修 UI，不動購物車功能 / 刪除功能 / 優惠券 / 轉址。
   ========================================================= */

/* 產品名稱可能是純文字，不一定有 <a>，所以 td 本身也要套字級與粗體。 */
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-name {
    color: #222222 !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    line-height: 1.55 !important;
    text-decoration: none !important;
    word-break: break-word !important;
}

body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-name a {
    color: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    line-height: inherit !important;
}

/* WooCommerce 手機版會用 data-title 產生「商品」兩字，這裡關掉，避免黏在產品名稱旁邊。 */
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-name::before,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-name:before,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.shop_table_responsive tr td.product-name::before,
body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.shop_table_responsive tr td.product-name:before {
    content: none !important;
    display: none !important;
}

/* 手機版：強制商品圖片不要被 WooCommerce smallscreen.css 隱藏。 */
@media (max-width: 768px) {
    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart tr.cart_item {
        display: grid !important;
        grid-template-columns: 82px minmax(0, 1fr) 32px !important;
        grid-template-areas: "thumb name remove" !important;
        column-gap: 14px !important;
        row-gap: 0 !important;
        align-items: center !important;
        width: 100% !important;
        min-height: 104px !important;
        padding: 14px 0 !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail {
        display: block !important;
        grid-area: thumb !important;
        width: 82px !important;
        min-width: 82px !important;
        max-width: 82px !important;
        height: 82px !important;
        min-height: 82px !important;
        padding: 0 !important;
        margin: 0 !important;
        text-align: left !important;
        visibility: visible !important;
        opacity: 1 !important;
        overflow: visible !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail::before,
    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail:before {
        content: none !important;
        display: none !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail a,
    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail img,
    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail .attachment-woocommerce_thumbnail,
    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail .woocommerce-placeholder {
        display: block !important;
        width: 82px !important;
        min-width: 82px !important;
        max-width: 82px !important;
        height: 82px !important;
        min-height: 82px !important;
        max-height: 82px !important;
        object-fit: cover !important;
        border-radius: 15px !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-name {
        display: block !important;
        grid-area: name !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        color: #222222 !important;
        font-size: 16px !important;
        font-weight: 800 !important;
        line-height: 1.5 !important;
        text-align: left !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-name a {
        display: inline !important;
        color: inherit !important;
        font-size: inherit !important;
        font-weight: inherit !important;
        line-height: inherit !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-remove {
        display: flex !important;
        grid-area: remove !important;
        align-items: center !important;
        justify-content: flex-end !important;
        width: 32px !important;
        min-width: 32px !important;
        max-width: 32px !important;
        padding: 0 !important;
        margin: 0 !important;
    }
}

@media (max-width: 480px) {
    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart tr.cart_item {
        grid-template-columns: 72px minmax(0, 1fr) 30px !important;
        column-gap: 12px !important;
        min-height: 94px !important;
        padding: 12px 0 !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail,
    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail a,
    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail img,
    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail .attachment-woocommerce_thumbnail,
    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-thumbnail .woocommerce-placeholder {
        width: 72px !important;
        min-width: 72px !important;
        max-width: 72px !important;
        height: 72px !important;
        min-height: 72px !important;
        max-height: 72px !important;
        border-radius: 13px !important;
    }

    body.woocommerce-cart:not(.woocommerce-checkout) .woocommerce-cart-form table.cart td.product-name {
        font-size: 15.5px !important;
        line-height: 1.5 !important;
    }
}
