/**
 * YS CART — 結帳頁樣式
 *
 * Morandi 色系設計。表單欄位一致圓角、選擇卡片 UI、黏性訂單摘要。
 *
 * @version 2.0.0
 */

/* ─── 結帳頁包裹 ─── */
.ys-ec-checkout-wrapper {
    position: relative;
    max-width: 1140px;
    margin: 0 auto;
    padding: 24px 0;
    font-family: var(--ys-ec-font);
}

/* ─── 頂部訂單商品列表 ─── */
.ys-ec-checkout-top-review {
    margin-bottom: 24px;
}

/* ─── 兩欄佈局 ─── */
.ys-ec-checkout-columns {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 28px;
    align-items: start;
}

.ys-ec-checkout-content {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 28px;
    align-items: start;
}

.ys-ec-checkout-main {
    min-width: 0;
}

.ys-ec-checkout-sidebar {
    position: sticky;
    top: 100px;
}

/* ─── 區塊卡片（圓角陰影） ─── */
.ys-ec-checkout-section {
    background: var(--ys-ec-card-bg);
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius-lg);
    padding: 22px 24px;
    margin-bottom: 16px;
    box-shadow: var(--ys-ec-shadow);
}

.ys-ec-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--ys-ec-text);
    margin: 0 0 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--ys-ec-primary);
}

.ys-ec-section-title .dashicons {
    color: var(--ys-ec-primary);
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ─── 商品表格 ─── */
.ys-ec-order-items-table {
    overflow-x: auto;
}

.ys-ec-table {
    width: 100%;
    border-collapse: collapse;
}

.ys-ec-table thead th {
    text-align: left;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ys-ec-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--ys-ec-border);
}

.ys-ec-table tbody td {
    padding: 12px 10px;
    vertical-align: middle;
    border-bottom: 1px solid var(--ys-ec-border-light);
}

.ys-ec-table tbody tr:last-child td {
    border-bottom: none;
}

.ys-ec-th-qty,
.ys-ec-td-qty {
    min-width: 152px;
}

.ys-ec-th-price,
.ys-ec-th-qty,
.ys-ec-th-total,
.ys-ec-td-price,
.ys-ec-td-qty,
.ys-ec-td-total {
    text-align: center;
    white-space: nowrap;
}

.ys-ec-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ys-ec-item-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--ys-ec-border-light);
    flex-shrink: 0;
}

.ys-ec-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ys-ec-item-title {
    font-weight: 600;
    color: var(--ys-ec-text);
    font-size: 13px;
    line-height: 1.4;
}

.ys-ec-item-variant,
.ys-ec-item-sku {
    font-size: 12px;
    color: var(--ys-ec-text-muted);
}

.ys-ec-checkout-product-variant {
    font-size: 12px;
    color: var(--ys-ec-primary-dark);
    font-weight: 600;
}

/* 結帳頁隱藏 mini cart */
.ys-ec-checkout-wrapper ~ .ys-ec-mini-cart,
body.ys-ec-checkout-page .ys-ec-mini-cart,
.ys-ec-checkout-wrapper + .ys-ec-mini-cart,
body:has(.ys-ec-checkout-wrapper) .ys-ec-mini-cart {
    display: none !important;
}

/* 商品刪除按鈕 */
.ys-ec-th-remove {
    width: 36px;
}
.ys-ec-td-remove {
    text-align: center;
    vertical-align: middle;
}
.ys-ec-remove-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--ys-ec-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}
.ys-ec-remove-item:hover {
    background: var(--ys-ec-danger, #ef4444);
    color: #fff;
}
.ys-ec-remove-item .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* 價格：灰色刪除線原價 + Morandi danger 特價 */
.ys-ec-price-original {
    text-decoration: line-through;
    color: var(--ys-ec-text-muted);
    font-size: 13px;
    margin-right: 4px;
}

.ys-ec-price-sale {
    color: var(--ys-ec-danger);
    font-weight: 600;
}

/* ─── 優惠碼 ─── */
.ys-ec-coupon-row {
    display: flex;
    gap: 10px;
}

.ys-ec-coupon-row .ys-ec-input {
    flex: 1;
    min-width: 0;
}

.ys-ec-coupon-field-label {
    margin: 0 0 6px;
    color: var(--ys-ec-text);
    font-size: 13px;
    font-weight: 700;
}

.ys-ec-coupon-field-hint {
    margin: -2px 0 8px;
    color: var(--ys-ec-text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.ys-ec-claim-code-panel {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--ys-ec-border-light);
}

.ys-ec-coupon-message {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: var(--ys-ec-radius);
    font-size: 14px;
}

.ys-ec-coupon-message.ys-ec-msg-success {
    background: var(--ys-ec-success-light);
    color: #3d6b4a;
    border: 1px solid rgba(125, 171, 142, 0.3);
}

.ys-ec-coupon-message.ys-ec-msg-error {
    background: var(--ys-ec-danger-light);
    color: #8b4c4c;
    border: 1px solid rgba(192, 128, 128, 0.3);
}

.ys-ec-coupon-message.ys-ec-msg-notice {
    background: #fff8e8;
    color: #7a5412;
    border: 1px solid #e8c878;
}

.ys-ec-coupon-quick {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 3px;
    min-height: 44px;
    max-width: 100%;
    padding: 8px 12px;
    box-sizing: border-box;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    background: #fef3c7;
    color: #92400e;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
    text-align: left;
    white-space: normal;
}

.ys-ec-coupon-quick .dashicons {
    width: 14px;
    height: 14px;
    font-size: 14px;
}

.ys-ec-coupon-quick-desc {
    margin-left: 3px;
    color: #b45309;
    font-weight: 400;
}

.ys-ec-coupon-quick.is-disabled,
.ys-ec-coupon-quick[aria-disabled="true"],
.ys-ec-coupon-quick:disabled,
.ys-ec-coupon-quick[aria-busy="true"],
.ys-ec-coupon-row .ys-ec-btn:disabled,
.ys-ec-coupon-row .ys-ec-btn[aria-busy="true"] {
    opacity: 0.55;
    cursor: not-allowed !important;
}

/* ─── 購物金折抵區塊 ─── */
.ys-ec-credit-section {
    border-left: 3px solid var(--ys-ec-success);
}

/* v2.25.3：訂單 0 元封頂時，購物金區塊鎖定 */
.ys-ec-credit-section.ys-ec-credit-disabled {
    border-left-color: var(--ys-ec-text-muted, #9ca3af);
    opacity: 0.7;
}

.ys-ec-credit-section.ys-ec-credit-disabled .ys-ec-credit-balance-info {
    background: var(--ys-ec-body-bg, #f5f5f5);
    filter: grayscale(100%);
}

.ys-ec-credit-section.ys-ec-credit-disabled .ys-ec-credit-toggle {
    cursor: not-allowed;
    color: var(--ys-ec-text-muted, #9ca3af);
}

.ys-ec-credit-section.ys-ec-credit-disabled .ys-ec-credit-toggle input[type="checkbox"] {
    cursor: not-allowed;
}

.ys-ec-credit-cap-hint {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(143, 168, 184, 0.08);
    border: 1px solid rgba(143, 168, 184, 0.25);
    color: #3c4858;
    border-radius: var(--ys-ec-radius, 8px);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ys-ec-credit-cap-hint svg {
    flex-shrink: 0;
    color: var(--ys-ec-primary, #8fa8b8);
}

.ys-ec-credit-balance-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--ys-ec-success-light);
    border-radius: var(--ys-ec-radius);
    margin-bottom: 12px;
    gap: 12px;
}

.ys-ec-credit-balance-label {
    font-size: 14px;
    color: #3d6b4a;
    font-weight: 500;
}

.ys-ec-credit-balance-value {
    font-size: 20px;
    font-weight: 700;
    color: #3d6b4a;
}

.ys-ec-credit-action-row {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 12px;
}

.ys-ec-credit-toggle {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 8px 14px;
    border: 1px solid rgba(143, 168, 184, 0.42);
    border-radius: var(--ys-ec-radius);
    background: #fff;
    color: var(--ys-ec-text);
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ys-ec-credit-toggle:hover {
    border-color: var(--ys-ec-primary);
    color: var(--ys-ec-primary);
}

.ys-ec-credit-toggle:focus-within {
    outline: 2px solid rgba(143, 168, 184, 0.35);
    outline-offset: 2px;
}

.ys-ec-credit-toggle .ys-ec-checkbox {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.ys-ec-credit-toggle:has(.ys-ec-checkbox:checked) {
    background: rgba(143, 168, 184, 0.12);
    border-color: var(--ys-ec-primary);
    color: #3f5968;
}

.ys-ec-credit-input-wrap {
    margin-top: 12px;
    padding: 14px;
    background: var(--ys-ec-body-bg);
    border-radius: var(--ys-ec-radius);
    border: 1px solid var(--ys-ec-border-light);
}

.ys-ec-credit-input-row {
    display: grid;
    grid-template-columns: auto minmax(152px, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.ys-ec-credit-input-row label {
    font-size: 14px;
    font-weight: 500;
    color: var(--ys-ec-text);
    white-space: nowrap;
    margin: 0;
}

.ys-ec-credit-input-group {
    position: relative;
    min-width: 0;
}

.ys-ec-credit-input-prefix {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ys-ec-text-muted);
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
}

/* v2.55.6：購物金折抵輸入框需左側留白給「$」前綴、並維持 42px 高度。
   改走 CSS 變數覆寫（特異度 0,2,0 即可，無人競爭同名變數），由根源通用規則讀取，
   取代 v2.55.2 的 (0,3,1) 治標補丁，根治特異度競賽。 */
.ys-ec-credit-input-group .ys-ec-input {
    --ys-ec-input-pad-left: 36px;
    --ys-ec-input-min-h: 42px;
    width: 100%;
}

.ys-ec-credit-apply {
    min-width: 72px;
    min-height: 40px;
    white-space: nowrap;
}

.ys-ec-credit-use-max {
    grid-column: 2 / 4;
    justify-self: start;
    min-height: 36px;
    white-space: nowrap;
}

.ys-ec-credit-hint {
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--ys-ec-text-muted);
}

.ys-ec-credit-hint strong {
    color: var(--ys-ec-success);
}

/* ─── 運送方式 & 付款方式卡片（Radio Card UI） ─── */
.ys-ec-shipping-cards,
.ys-ec-payment-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ys-ec-card-option {
    display: block;
    cursor: pointer;
    border: 1.5px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius);
    padding: 14px 16px;
    transition: border-color var(--ys-ec-transition), box-shadow var(--ys-ec-transition), background-color var(--ys-ec-transition);
    background: var(--ys-ec-card-bg);
}

.ys-ec-card-option:hover {
    border-color: var(--ys-ec-primary-light);
    background: #fafcfd;
}

.ys-ec-card-option.ys-ec-card-active {
    border-color: var(--ys-ec-primary);
    background: var(--ys-ec-primary-bg);
    box-shadow: 0 0 0 1px var(--ys-ec-primary), 0 2px 8px rgba(122, 155, 174, 0.12);
}

.ys-ec-card-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ys-ec-card-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ys-ec-card-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ys-ec-primary-bg);
    border-radius: var(--ys-ec-radius);
    flex-shrink: 0;
    transition: background var(--ys-ec-transition);
}

.ys-ec-card-active .ys-ec-card-icon {
    background: var(--ys-ec-primary);
    color: #ffffff;
}

.ys-ec-card-active .ys-ec-card-icon .dashicons {
    color: #ffffff;
}

.ys-ec-card-icon .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: var(--ys-ec-primary-dark);
}

.ys-ec-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ys-ec-card-label {
    font-weight: 600;
    color: var(--ys-ec-text);
    font-size: 14px;
}

.ys-ec-card-desc {
    font-size: 12px;
    color: var(--ys-ec-text-muted);
    line-height: 1.4;
}

.ys-ec-card-price {
    font-weight: 600;
    font-size: 14px;
    color: var(--ys-ec-primary-dark);
    flex-shrink: 0;
}

.ys-ec-free {
    color: var(--ys-ec-success);
    font-weight: 600;
    font-size: 13px;
}

/* ─── 物流方式卡片（shipping-cards.php） ─── */
.ys-ec-shipping-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0;
}

.ys-ec-shipping-card {
    display: block;
    border: 1.5px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius);
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color var(--ys-ec-transition), box-shadow var(--ys-ec-transition), background var(--ys-ec-transition);
    background: var(--ys-ec-card-bg);
}

.ys-ec-shipping-card:hover {
    border-color: var(--ys-ec-primary-light);
    background: #fafcfd;
}

.ys-ec-shipping-card--active {
    border-color: var(--ys-ec-primary);
    background: var(--ys-ec-primary-bg);
    box-shadow: 0 0 0 1px var(--ys-ec-primary), 0 2px 8px rgba(122, 155, 174, 0.12);
}

.ys-ec-shipping-card__radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ys-ec-shipping-card__content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ys-ec-shipping-card__icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ys-ec-primary-bg);
    border-radius: var(--ys-ec-radius);
    transition: background var(--ys-ec-transition);
}

.ys-ec-shipping-card__icon .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: var(--ys-ec-primary-dark);
}

.ys-ec-shipping-card--active .ys-ec-shipping-card__icon {
    background: var(--ys-ec-primary);
}

.ys-ec-shipping-card--active .ys-ec-shipping-card__icon .dashicons {
    color: #ffffff;
}

.ys-ec-shipping-card__info {
    flex: 1;
    min-width: 0;
}

.ys-ec-shipping-card__title {
    font-weight: 600;
    font-size: 14px;
    color: var(--ys-ec-text);
    line-height: 1.3;
}

.ys-ec-shipping-card__desc {
    font-size: 11px;
    color: var(--ys-ec-text-light, var(--ys-ec-text-muted));
    margin-top: 2px;
    line-height: 1.4;
}

.ys-ec-shipping-card__free-hint {
    font-size: 11px;
    color: var(--ys-ec-success);
    margin-top: 2px;
}

.ys-ec-shipping-card__price {
    flex-shrink: 0;
    font-weight: 600;
    font-size: 14px;
    color: var(--ys-ec-primary-dark);
}

.ys-ec-shipping-card__price--free {
    color: var(--ys-ec-success);
}

.ys-ec-shipping-card__cvs-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--ys-ec-border-light);
}

/* ─── 物流卡片展開區塊（收件人表單嵌入卡片內） ─── */
.ys-ec-shipping-card__expand {
    margin: 12px -16px -14px;
    padding: 14px 16px;
    background: var(--ys-ec-primary-bg);
    border-top: 1px solid var(--ys-ec-border-light);
    border-radius: 0 0 6px 6px;
    animation: ysEcSlideDown 0.3s ease;
}

.ys-ec-expand-row {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.ys-ec-expand-field {
    flex: 1;
}

.ys-ec-expand-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ys-ec-text);
    margin-bottom: 4px;
    letter-spacing: 0.2px;
}

.ys-ec-checkout-wrapper .ys-ec-expand-field input,
.ys-ec-checkout-wrapper .ys-ec-expand-field select,
.ys-ec-expand-field input,
.ys-ec-expand-field select {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--ys-ec-border);
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    box-sizing: border-box;
    background-color: #ffffff;
    color: var(--ys-ec-text);
    font-family: var(--ys-ec-font);
    height: auto;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
    outline: none;
}

.ys-ec-checkout-wrapper .ys-ec-expand-field select {
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%236e7f8d'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    cursor: pointer;
}

.ys-ec-checkout-wrapper .ys-ec-expand-field input::placeholder,
.ys-ec-expand-field input::placeholder {
    color: var(--ys-ec-placeholder, #b0bcc6);
    opacity: 1;
}

.ys-ec-checkout-wrapper .ys-ec-expand-field input:focus,
.ys-ec-checkout-wrapper .ys-ec-expand-field select:focus,
.ys-ec-expand-field input:focus,
.ys-ec-expand-field select:focus {
    outline: none;
    border-color: var(--ys-ec-primary);
    box-shadow: 0 0 0 2px rgba(122, 155, 174, 0.15);
    background-color: #ffffff;
}

.ys-ec-expand-save {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--ys-ec-text-muted);
    cursor: pointer;
    margin-top: 6px;
}

.ys-ec-expand-save input[type="checkbox"] {
    accent-color: var(--ys-ec-primary);
}

.ys-ec-select-store-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 0;
    font-size: 13px;
    padding: 8px 14px;
}

.ys-ec-select-store-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* ─── 超商取貨 ─── */
.ys-ec-cvs-fields {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--ys-ec-border-light);
}

.ys-ec-cvs-store-info {
    margin-top: 0;
}

.ys-ec-cvs-store-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #ffffff;
    border: 1.5px solid var(--ys-ec-primary-light);
    border-radius: 6px;
    margin-top: 10px;
}

.ys-ec-cvs-store-card > .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: var(--ys-ec-primary-dark, #5a7a8c);
    flex-shrink: 0;
}

.ys-ec-cvs-store-details {
    flex: 1;
    min-width: 0;
}

.ys-ec-cvs-store-name {
    display: block;
    font-weight: 600;
    color: var(--ys-ec-text, #2c3e50);
}

.ys-ec-cvs-store-address {
    display: block;
    font-size: 13px;
    color: var(--ys-ec-text-muted, #94a3b8);
    margin-top: 2px;
}

.ys-ec-cvs-display {
    flex: 1;
    padding: 10px 14px;
    background: var(--ys-ec-body-bg);
    border: 1px solid var(--ys-ec-border);
    border-radius: var(--ys-ec-radius);
    font-size: 14px;
    min-height: 40px;
    display: flex;
    align-items: center;
}

.ys-ec-cvs-placeholder {
    color: var(--ys-ec-text-muted);
}

/* ─── 地址簿快速選擇器 ─── */
.ys-ec-address-selector {
    margin-bottom: 20px;
    padding: 14px 16px;
    background: var(--ys-ec-primary-bg, #f0f4f7);
    border: 1px solid var(--ys-ec-border-light, #e2e8f0);
    border-radius: var(--ys-ec-radius, 8px);
}

.ys-ec-address-selector__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ys-ec-text, #2c3e50);
    margin-bottom: 8px;
}

.ys-ec-address-selector .ys-ec-select {
    width: 100%;
}

/* 超商門市選擇器增強 */
.ys-ec-cvs-selector {
    margin-bottom: 12px;
}

/* ─── 表單欄位 ─── */
.ys-ec-form-row {
    margin-bottom: 14px;
}

.ys-ec-form-row label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ys-ec-text);
    margin-bottom: 5px;
    letter-spacing: 0.2px;
}

.ys-ec-required {
    color: var(--ys-ec-danger);
    font-weight: 400;
}

.ys-ec-form-row-half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* 加高 specificity 覆蓋 Blocksy 等主題的 form input 規則 */
.ys-ec-checkout-wrapper input.ys-ec-input,
.ys-ec-checkout-wrapper select.ys-ec-select,
.ys-ec-checkout-wrapper textarea.ys-ec-textarea,
.ys-ec-input,
.ys-ec-select,
.ys-ec-textarea {
    display: block;
    width: 100%;
    /* v2.55.6：padding 改走 CSS 變數，元件級規則只需覆寫變數（不必拼特異度），
       徹底消除「通用 input 規則 (0,2,1) 靜默覆蓋元件級 padding」的特異度競賽。 */
    padding-top: var(--ys-ec-input-pad-y, 9px);
    padding-right: var(--ys-ec-input-pad-right, var(--ys-ec-input-pad-x, 13px));
    padding-bottom: var(--ys-ec-input-pad-y, 9px);
    padding-left: var(--ys-ec-input-pad-left, var(--ys-ec-input-pad-x, 13px));
    font-size: 14px;
    line-height: 1.5;
    color: var(--ys-ec-text);
    background-color: #ffffff;
    border: 1.5px solid var(--ys-ec-border);
    border-radius: 6px;
    transition: border-color var(--ys-ec-transition), box-shadow var(--ys-ec-transition);
    box-sizing: border-box;
    font-family: var(--ys-ec-font);
    height: auto;
    min-height: var(--ys-ec-input-min-h, 0);
    max-width: 100%;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
    outline: none;
}

.ys-ec-checkout-wrapper select.ys-ec-select,
.ys-ec-select {
    /* v2.55.6：select 右側箭頭留白改走變數注入根源規則（與其他 input 一致）。 */
    --ys-ec-input-pad-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%236e7f8d'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    cursor: pointer;
}

.ys-ec-checkout-wrapper input.ys-ec-input::placeholder,
.ys-ec-input::placeholder {
    color: var(--ys-ec-placeholder, #b0bcc6);
    opacity: 1;
}

.ys-ec-checkout-wrapper input.ys-ec-input:focus,
.ys-ec-checkout-wrapper select.ys-ec-select:focus,
.ys-ec-checkout-wrapper textarea.ys-ec-textarea:focus,
.ys-ec-input:focus,
.ys-ec-select:focus,
.ys-ec-textarea:focus {
    outline: none;
    border-color: var(--ys-ec-primary);
    box-shadow: 0 0 0 3px rgba(122, 155, 174, 0.15);
    background-color: #ffffff;
}

.ys-ec-checkout-wrapper input.ys-ec-input.ys-ec-field-error,
.ys-ec-checkout-wrapper select.ys-ec-select.ys-ec-field-error,
.ys-ec-input.ys-ec-field-error,
.ys-ec-select.ys-ec-field-error {
    border-color: var(--ys-ec-danger);
    box-shadow: 0 0 0 3px rgba(192, 128, 128, 0.15);
}

.ys-ec-field-error-msg {
    display: block;
    font-size: 12px;
    color: var(--ys-ec-danger);
    margin-top: 4px;
}

.ys-ec-textarea {
    resize: vertical;
    /* v2.55.6：改走變數注入根源規則，避免結帳頁 (0,2,1) min-height 覆蓋使備註框塌成單行。 */
    --ys-ec-input-min-h: 80px;
}

/* 建立帳號區域 */
.ys-ec-create-account-section {
    padding: 16px;
    background: var(--ys-ec-primary-bg);
    border-radius: var(--ys-ec-radius);
    border: 1px solid var(--ys-ec-border-light);
}

.ys-ec-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--ys-ec-text);
}

.ys-ec-checkbox {
    accent-color: var(--ys-ec-primary);
}

.ys-ec-hint {
    font-size: 12px;
    color: var(--ys-ec-text-muted);
    margin-left: 4px;
}

/* ─── 訂單摘要側邊欄 ─── */
.ys-ec-order-summary {
    background: var(--ys-ec-card-bg);
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius-lg);
    padding: 20px 22px;
    margin-bottom: 14px;
    box-shadow: var(--ys-ec-shadow);
}

.ys-ec-summary-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--ys-ec-text);
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--ys-ec-primary);
}

.ys-ec-summary-title .dashicons {
    color: var(--ys-ec-primary);
}

.ys-ec-summary-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ys-ec-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.ys-ec-summary-label {
    color: var(--ys-ec-text-muted);
}

.ys-ec-summary-value {
    font-weight: 500;
    color: var(--ys-ec-text);
}

.ys-ec-summary-discount .ys-ec-summary-value {
    color: var(--ys-ec-success);
}

/* v2.35.45 — 訂單摘要內的優惠券「移除」內聯按鈕
 * 跟金額並排（金額右側 4px gap），小尺寸 × icon，hover 變紅
 */
.ys-ec-summary-discount--coupon .ys-ec-summary-value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
}

.ys-ec-summary-coupon-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid var(--ys-ec-border-light, #e5eaef);
    border-radius: 50%;
    background: #fff;
    color: var(--ys-ec-text-muted, #6e7f8d);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.ys-ec-summary-coupon-remove:hover {
    background: #fdecec;
    border-color: #f0bcbc;
    color: var(--ys-ec-danger, #bf7878);
    transform: scale(1.1);
}

.ys-ec-summary-coupon-remove:focus-visible {
    outline: 2px solid var(--ys-ec-primary, #7a9bae);
    outline-offset: 2px;
}

.ys-ec-summary-coupon-remove:disabled {
    opacity: 0.5;
    cursor: wait;
    transform: none;
}

.ys-ec-summary-divider {
    height: 1px;
    background: var(--ys-ec-border-light);
    margin: 16px 0;
}

.ys-ec-summary-total {
    font-size: 18px;
}

.ys-ec-summary-total .ys-ec-summary-label {
    font-weight: 600;
    color: var(--ys-ec-text);
}

.ys-ec-grand-total {
    font-size: 22px;
    font-weight: 700;
    color: var(--ys-ec-primary-dark);
}

.ys-ec-currency-note {
    text-align: center;
    font-size: 11px;
    color: var(--ys-ec-text-light, var(--ys-ec-text-muted));
    margin-top: 10px;
    margin-bottom: 0;
}

/* ─── 側邊欄區塊收窄 ─── */
.ys-ec-checkout-sidebar .ys-ec-checkout-section {
    padding: 18px 20px;
    margin-bottom: 12px;
}

.ys-ec-checkout-sidebar .ys-ec-section-title {
    font-size: 15px;
    margin-bottom: 14px;
    padding-bottom: 8px;
}

/* ─── 下單按鈕 ─── */
/* v2.59.5：下單按鈕規則以元素限定（button.…，特異性 0,1,1）——主題（例如 Blocksy）對
   `[type="submit"]` 的通用按鈕規則與 `.ys-ec-place-order-btn` 同為 0,1,0 且較晚載入，
   會蓋掉按鈕色、內距與字級；宣告內容不變。 */
button.ys-ec-place-order-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    /* v2.59.5：下單按鈕與商品卡／商品內頁主要按鈕同一來源——「商店設定 → 前台色彩」
       的按鈕色 token；尺寸與 active／disabled／loading 行為不變。 */
    background: var(--ys-ec-btn-color, var(--ys-ec-primary-dark, #6b8a9a));
    border: none;
    border-radius: var(--ys-ec-radius);
    cursor: pointer;
    transition: background-color var(--ys-ec-transition), transform 0.1s ease, box-shadow var(--ys-ec-transition);
    letter-spacing: 0.5px;
    font-family: var(--ys-ec-font);
}

button.ys-ec-place-order-btn:hover {
    background: var(--ys-ec-btn-hover, #5a7a8a);
    box-shadow: 0 4px 16px rgba(90, 125, 145, 0.35);
}

button.ys-ec-place-order-btn:active {
    transform: scale(0.98);
}

button.ys-ec-place-order-btn:disabled {
    background: var(--ys-ec-border);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ys-ec-place-order-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.ys-ec-checkout-terms {
    text-align: center;
    font-size: 11px;
    color: var(--ys-ec-text-light, var(--ys-ec-text-muted));
    margin-top: 10px;
    line-height: 1.6;
}

.ys-ec-checkout-terms a {
    color: var(--ys-ec-primary-dark);
    text-decoration: underline;
}

/* ─── 行動版送出按鈕（桌面隱藏） ─── */
.ys-ec-checkout-submit-mobile {
    display: none;
}

/* ─── 按鈕共用 ─── */
.ys-ec-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--ys-ec-radius);
    cursor: pointer;
    transition: all var(--ys-ec-transition);
    text-decoration: none;
    border: none;
    line-height: 1.4;
    font-family: var(--ys-ec-font);
}

.ys-ec-btn-primary {
    background: var(--ys-ec-primary);
    color: #ffffff;
}

.ys-ec-btn-primary:hover {
    background: var(--ys-ec-primary-dark);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(143, 168, 184, 0.35);
}

.ys-ec-btn-outline {
    background: transparent;
    color: var(--ys-ec-primary-dark);
    border: 1.5px solid var(--ys-ec-primary-light);
}

.ys-ec-btn-outline:hover {
    background: var(--ys-ec-primary);
    color: #ffffff;
    border-color: var(--ys-ec-primary);
}

.ys-ec-btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* ─── 提示訊息（登入/空購物車） ─── */
.ys-ec-checkout-notice {
    max-width: 480px;
    margin: 60px auto;
    text-align: center;
    padding: 48px 32px;
    background: var(--ys-ec-card-bg);
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius-lg);
    box-shadow: var(--ys-ec-shadow);
}

.ys-ec-notice-icon .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: var(--ys-ec-primary-light);
    margin-bottom: 16px;
}

.ys-ec-checkout-notice h3 {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--ys-ec-text);
}

.ys-ec-checkout-notice p {
    color: var(--ys-ec-text-muted);
    margin: 0 0 24px;
}

.ys-ec-notice-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ─── 載入中覆蓋層 ─── */
.ys-ec-checkout-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 62, 80, 0.4);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ys-ec-overlay-content {
    background: #ffffff;
    padding: 40px 50px;
    border-radius: var(--ys-ec-radius-lg);
    text-align: center;
    box-shadow: 0 20px 60px rgba(44, 62, 80, 0.2);
}

.ys-ec-overlay-content p {
    margin: 16px 0 0;
    color: var(--ys-ec-text);
    font-size: 16px;
    font-weight: 500;
}

.ys-ec-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--ys-ec-border);
    border-top-color: var(--ys-ec-primary);
    border-radius: 50%;
    animation: ys-ec-spin 0.8s linear infinite;
    margin: 0 auto;
}

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

/* ─── 感謝頁 ─── */
.ys-ec-thankyou-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
}

.ys-ec-thankyou-header {
    text-align: center;
    padding: 40px 0 30px;
}

.ys-ec-thankyou-icon .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    color: var(--ys-ec-success);
}

.ys-ec-thankyou-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 16px 0 8px;
    color: var(--ys-ec-text);
}

.ys-ec-thankyou-header p {
    color: var(--ys-ec-text-muted);
    font-size: 15px;
    margin: 0;
}

.ys-ec-thankyou-section {
    background: var(--ys-ec-card-bg);
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--ys-ec-shadow);
}

.ys-ec-thankyou-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px;
    color: var(--ys-ec-text);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ys-ec-border-light);
}

.ys-ec-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ys-ec-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ys-ec-info-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ys-ec-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ys-ec-info-value {
    font-size: 15px;
    color: var(--ys-ec-text);
    font-weight: 500;
}

/* 訂單狀態標籤（Morandi 配色） */
.ys-ec-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.ys-ec-status-pending {
    background: var(--ys-ec-warning-light);
    color: #7a6530;
}

.ys-ec-status-processing {
    background: var(--ys-ec-primary-bg);
    color: var(--ys-ec-primary-dark);
}

.ys-ec-status-completed {
    background: var(--ys-ec-success-light);
    color: #3d6b4a;
}

.ys-ec-thankyou-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 30px;
}

/* ─── 訂購人資訊區塊 ─── */
.ys-ec-orderer-toggle {
    margin-bottom: 16px;
}

.ys-ec-orderer-fields {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--ys-ec-border-light);
}

/* ─── 電子發票提示 ─── */
.ys-ec-invoice-notice {
    padding: 14px 18px;
}

.ys-ec-invoice-notice-text {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--ys-ec-text-muted);
    margin: 0;
    line-height: 1.5;
}

.ys-ec-invoice-notice-text .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--ys-ec-primary);
}

/* ─── 發票選項 ─── */
.ys-ec-invoice-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ys-ec-radio-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 2px solid var(--ys-ec-border);
    border-radius: var(--ys-ec-radius);
    cursor: pointer;
    transition: border-color var(--ys-ec-transition), background-color var(--ys-ec-transition);
    background: var(--ys-ec-card-bg);
}

.ys-ec-radio-card:hover {
    border-color: var(--ys-ec-primary-light);
    background: var(--ys-ec-primary-bg);
}

.ys-ec-radio-card:has(input:checked) {
    border-color: var(--ys-ec-primary);
    background: var(--ys-ec-primary-bg);
    box-shadow: 0 0 0 1px var(--ys-ec-primary);
}

.ys-ec-radio-card__input {
    accent-color: var(--ys-ec-primary);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.ys-ec-radio-card__label {
    font-size: 14px;
    font-weight: 500;
    color: var(--ys-ec-text);
}

.ys-ec-paper-invoice-fields {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--ys-ec-border-light);
}

/* ─── 收件方式面板 — 選擇物流後展開 ─── */
@keyframes ysEcSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ys-ec-recipient-panel {
    margin-top: 16px;
    padding: 20px;
    background: var(--ys-ec-primary-bg);
    border: 1px solid var(--ys-ec-primary-light);
    border-radius: var(--ys-ec-radius);
    animation: ysEcSlideDown 0.3s ease;
}

.ys-ec-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--ys-ec-text);
    margin: 0 0 16px;
}

.ys-ec-panel-title .dashicons {
    color: var(--ys-ec-primary);
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* 已儲存的收件方式卡片 */
.ys-ec-saved-recipients {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.ys-ec-recipient-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #fff;
    border: 2px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius);
    cursor: pointer;
    transition: border-color var(--ys-ec-transition), background-color var(--ys-ec-transition), box-shadow var(--ys-ec-transition);
}

.ys-ec-recipient-card:hover {
    border-color: var(--ys-ec-primary-light);
}

.ys-ec-recipient-card.active,
.ys-ec-recipient-card:has(input:checked) {
    border-color: var(--ys-ec-primary);
    background: var(--ys-ec-primary-bg);
    box-shadow: 0 0 0 1px var(--ys-ec-primary);
}

.ys-ec-recipient-card__radio {
    margin-top: 4px;
    accent-color: var(--ys-ec-primary);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.ys-ec-recipient-card__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ys-ec-recipient-card__name {
    font-weight: 600;
    font-size: 15px;
    color: var(--ys-ec-text);
}

.ys-ec-recipient-card__phone {
    font-size: 13px;
    color: var(--ys-ec-text-muted);
    margin-top: 2px;
}

.ys-ec-recipient-card__address {
    font-size: 13px;
    color: var(--ys-ec-text);
    margin-top: 4px;
    line-height: 1.5;
    word-break: break-word;
}

.ys-ec-recipient-card__type {
    display: inline-block;
    padding: 2px 8px;
    background: var(--ys-ec-primary-bg);
    color: var(--ys-ec-primary-dark);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 6px;
    align-self: flex-start;
}

/* 超商門市收件卡片特殊樣式 */
.ys-ec-recipient-card--cvs .ys-ec-recipient-card__type {
    background: var(--ys-ec-warning-light, #f5efe4);
    color: var(--ys-ec-warning-text, #7a6530);
}

/* 新增收件方式表單 */
.ys-ec-new-recipient {
    padding: 20px;
    background: #fff;
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius);
    margin-bottom: 16px;
    animation: ysEcSlideDown 0.3s ease;
}

.ys-ec-save-recipient-label {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--ys-ec-border-light);
}

.ys-ec-add-recipient-btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    border-style: dashed;
}

.ys-ec-add-recipient-btn:hover {
    border-style: solid;
}

/* ─── 訂購人地址欄位 ─── */
.ys-ec-orderer-address-fields {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--ys-ec-border-light);
}

/* ─── 加價購區塊 ─── */
.ys-ec-addon-section {
    border-left: 3px solid var(--ys-ec-warning);
}

.ys-ec-sidebar-addon {
    margin-bottom: 14px;
    padding: 14px;
    background: var(--ys-ec-card-bg);
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius);
    box-shadow: var(--ys-ec-shadow);
}

.ys-ec-sidebar-addon:empty,
.ys-ec-sidebar-addon:has(.ys-ec-addon-items:empty) {
    display: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    min-height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
}

/* addon-items 為空時整個 addon 隱藏 */
#ys-ec-sidebar-addon:has(#ys-ec-addon-items-sidebar:empty) {
    display: none !important;
}

/* addon-section 為空時隱藏 */
.ys-ec-addon-section:has(.ys-ec-addon-items:empty) {
    display: none !important;
}

/* ─── 付款展開區塊（ATM 銀行選擇、信用卡 embed 等） ─── */
.ys-ec-payment-expand {
    padding: 14px 16px;
    border-top: 1px solid var(--ys-ec-border-light);
    background-color: var(--ys-ec-primary-bg);
    margin: 12px -16px -14px;
    border-radius: 0 0 6px 6px;
}

.ys-ec-payment-expand label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ys-ec-text);
    margin-bottom: 5px;
}

.ys-ec-payment-expand .ys-ec-select {
    width: 100%;
}

.ys-ec-payment-expand-hint {
    margin: 5px 0 0;
    font-size: 12px;
    color: var(--ys-ec-text-muted);
}

/* ─── 信用卡 embed 展開區塊（含分期 embed，v2.21.0 新增） ─── */
/* 使用 .ys-ec-payment-expand 雙類別選擇器提高 specificity，確保白底覆蓋通用樣式 */
.ys-ec-payment-expand.ys-ec-credit-expand,
.ys-ec-payment-expand.ys-ec-installment-embed-expand {
    padding: 14px 16px;
    background-color: #ffffff;
}

.ys-ec-credit-expand #ys-ec-payuni-embed-container,
.ys-ec-installment-embed-expand #ys-ec-payuni-embed-installment-container {
    background-color: #ffffff;
    border-radius: 4px;
}

.ys-ec-credit-expand #ys-ec-payuni-embed-container iframe,
.ys-ec-installment-embed-expand #ys-ec-payuni-embed-installment-container iframe {
    display: block;
}

.ys-ec-credit-expand .ys-ec-saved-cards {
    margin-bottom: 12px;
}

.ys-ec-credit-expand .ys-ec-saved-cards label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 13px;
}

.ys-ec-credit-expand .ys-ec-saved-cards .ys-ec-select {
    width: 100%;
    margin-top: 4px;
}

.ys-ec-credit-expand .ys-ec-save-card-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-top: 8px;
}

.ys-ec-credit-expand .ys-ec-save-card-label span {
    font-size: 13px;
    color: var(--ys-ec-text-muted);
}

.ys-ec-credit-expand .ys-ec-embed-error {
    color: var(--ys-ec-danger);
    font-size: 13px;
    margin-top: 8px;
}

/* ─── 錯誤提示（Morandi 配色） ─── */
.ys-ec-alert {
    padding: 14px 18px;
    border-radius: var(--ys-ec-radius);
    margin-bottom: 20px;
    font-size: 14px;
}

.ys-ec-alert-error {
    background: var(--ys-ec-danger-light);
    border: 1px solid rgba(192, 128, 128, 0.3);
    color: #8b4c4c;
}

/* v2.52.34：結帳錯誤橫幅多筆訊息以換行符串接（伺服器端不再夾帶 <br>）。
   white-space 可繼承，套在橫幅上即讓單段 <p> 的換行正確呈現。 */
.ys-ec-checkout-error-banner {
    white-space: pre-line;
}

.ys-ec-alert-success {
    background: var(--ys-ec-success-light);
    border: 1px solid rgba(125, 171, 142, 0.3);
    color: #3d6b4a;
}

/* ─── RWD：平板 ─── */
@media (max-width: 1024px) {
    .ys-ec-checkout-columns {
        grid-template-columns: 1fr 300px;
        gap: 20px;
    }

    .ys-ec-checkout-content {
        grid-template-columns: 1fr 300px;
        gap: 20px;
    }
}

/* ─── RWD：手機 ─── */
@media (max-width: 768px) {
    #ys-ec-discount-section #ys-ec-coupon-code,
    #ys-ec-discount-section #ys-ec-claim-code,
    [data-ys-ec-discount-section] [data-ys-ec-coupon-code],
    [data-ys-ec-discount-section] [data-ys-ec-claim-code] {
        font-size: 16px;
    }

    #ys-ec-discount-section .ys-ec-coupon-row .ys-ec-btn,
    [data-ys-ec-discount-section] .ys-ec-coupon-row .ys-ec-btn {
        min-height: 44px;
    }

    .ys-ec-checkout-columns {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .ys-ec-checkout-content {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .ys-ec-checkout-sidebar {
        position: static;
        order: -1;
        margin-bottom: 20px;
    }

    /* 桌面版按鈕隱藏 */
    .ys-ec-checkout-sidebar .ys-ec-place-order-btn {
        display: none;
    }

    .ys-ec-checkout-sidebar .ys-ec-checkout-terms {
        display: none;
    }

    /* 行動版送出按鈕顯示 */
    .ys-ec-checkout-submit-mobile {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--ys-ec-card-bg);
        padding: 12px 16px;
        border-top: 1px solid var(--ys-ec-border-light);
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
        z-index: 100;
    }

    /* 底部固定按鈕留出空間 */
    .ys-ec-checkout-wrapper {
        padding-bottom: 100px;
    }

    .ys-ec-mobile-total {
        text-align: center;
        font-size: 14px;
        color: var(--ys-ec-text-muted);
        margin-bottom: 10px;
    }

    .ys-ec-mobile-total strong {
        font-size: 20px;
        color: var(--ys-ec-primary-dark);
    }

    .ys-ec-checkout-section {
        padding: 16px;
        border-radius: var(--ys-ec-radius);
        margin-bottom: 12px;
    }

    .ys-ec-form-row-half {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* 商品表格行動版 */
    .ys-ec-checkout-top-review .ys-ec-table thead {
        display: none;
    }

    .ys-ec-checkout-top-review .ys-ec-table tbody {
        display: grid;
        gap: 0;
    }

    .ys-ec-checkout-top-review .ys-ec-table tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(108px, auto);
        grid-template-areas:
            "product product"
            "price total"
            "qty remove";
        gap: 0;
        padding: 0 0 12px;
        border: 0;
        border-radius: 0;
        background: transparent;
        overflow: visible;
    }

    .ys-ec-checkout-top-review .ys-ec-table tbody tr + tr {
        padding-top: 12px;
        border-top: 1px solid var(--ys-ec-border-light);
    }

    .ys-ec-checkout-top-review .ys-ec-table tbody td {
        border: none;
        padding: 10px 16px 8px;
    }

    .ys-ec-checkout-top-review .ys-ec-td-product {
        grid-area: product;
        width: auto;
        border-bottom: 0;
    }

    .ys-ec-checkout-top-review .ys-ec-item-row {
        align-items: center;
        gap: 14px;
    }

    .ys-ec-checkout-top-review .ys-ec-item-thumb {
        width: 76px;
        height: 76px;
        border-radius: 8px;
        flex: 0 0 76px;
    }

    .ys-ec-checkout-top-review .ys-ec-item-title {
        font-size: 17px;
        line-height: 1.35;
    }

    .ys-ec-checkout-top-review .ys-ec-item-variant,
    .ys-ec-checkout-top-review .ys-ec-item-sku {
        font-size: 14px;
        line-height: 1.45;
    }

    .ys-ec-checkout-top-review .ys-ec-td-price {
        grid-area: price;
        display: flex;
        align-items: center;
        min-width: 0;
    }

    .ys-ec-checkout-top-review .ys-ec-td-qty {
        grid-area: qty;
        display: flex;
        align-items: center;
        min-width: 0;
    }

    .ys-ec-checkout-top-review .ys-ec-td-total {
        grid-area: total;
        display: flex;
        align-self: center;
        align-items: center;
        justify-content: flex-end;
        min-width: 0;
    }

    .ys-ec-checkout-top-review .ys-ec-td-remove {
        grid-area: remove;
        align-self: center;
        justify-self: end;
        padding-left: 4px;
    }

    .ys-ec-checkout-top-review .ys-ec-td-price,
    .ys-ec-checkout-top-review .ys-ec-td-qty,
    .ys-ec-checkout-top-review .ys-ec-td-total {
        text-align: left;
    }

    .ys-ec-checkout-top-review .ys-ec-td-price::before,
    .ys-ec-checkout-top-review .ys-ec-td-qty::before,
    .ys-ec-checkout-top-review .ys-ec-td-total::before {
        content: attr(data-label) "\FF1A";
        display: inline-block;
        flex: 0 0 auto;
        min-width: 42px;
        font-size: 14px;
        color: var(--ys-ec-text-muted);
        margin-right: 8px;
    }

    .ys-ec-checkout-top-review .ys-ec-qty-control {
        display: inline-flex;
        flex: 1 1 auto;
        min-width: 0;
        max-width: 164px;
        vertical-align: middle;
    }

    .ys-ec-checkout-top-review .ys-ec-qty-sm .ys-ec-qty-btn {
        flex: 0 0 30px;
        width: 30px;
        min-width: 30px;
        height: 34px;
        min-height: 34px;
    }

    .ys-ec-checkout-top-review .ys-ec-qty-sm .ys-ec-qty-input {
        flex: 1 1 58px;
        width: clamp(48px, 16vw, 82px);
        min-width: 48px;
        height: 34px;
        min-height: 34px;
        padding-inline: 4px;
    }

    .ys-ec-checkout-top-review .ys-ec-remove-btn {
        font-size: 22px;
        width: 36px;
        height: 36px;
    }

    .ys-ec-order-summary {
        border-radius: var(--ys-ec-radius);
    }

    .ys-ec-info-grid {
        grid-template-columns: 1fr;
    }

    .ys-ec-thankyou-actions {
        flex-direction: column;
    }

    .ys-ec-notice-actions {
        flex-direction: column;
    }

    .ys-ec-card-content {
        flex-wrap: wrap;
    }

    .ys-ec-card-price {
        width: 100%;
        text-align: right;
        margin-top: 4px;
    }

    /* 購物金折抵行動版 */
    .ys-ec-credit-input-row {
        grid-template-columns: 1fr auto;
    }

    .ys-ec-credit-input-row label {
        grid-column: 1 / -1;
        width: 100%;
    }

    .ys-ec-credit-input-group {
        min-width: 120px;
    }

    .ys-ec-credit-use-max {
        grid-column: 1 / -1;
    }

    /* 發票選項行動版 */
    .ys-ec-invoice-options {
        gap: 8px;
    }

    .ys-ec-radio-card {
        padding: 12px 14px;
    }

    /* 收件方式面板行動版（已移除獨立面板，保留向下相容） */
    .ys-ec-recipient-panel {
        padding: 14px;
        margin-top: 12px;
    }

    .ys-ec-recipient-card {
        padding: 12px;
        gap: 10px;
    }

    /* 物流卡片展開區塊行動版 */
    .ys-ec-expand-row {
        flex-direction: column;
        gap: 8px;
    }

    .ys-ec-shipping-card__expand {
        padding: 12px;
    }

    .ys-ec-new-recipient {
        padding: 14px;
    }

    .ys-ec-panel-title {
        font-size: 15px;
        margin-bottom: 12px;
    }

    /* 手機版商品明細收合 */
    .ys-ec-collapsible {
        cursor: pointer;
    }
    .ys-ec-collapsible .ys-ec-collapse-arrow {
        float: right;
        transition: transform 0.3s;
        font-size: 12px;
        line-height: 1;
    }
    .ys-ec-collapsible.collapsed .ys-ec-collapse-arrow {
        transform: rotate(-90deg);
    }
    .ys-ec-products-body.collapsed {
        display: none;
    }
}

/* ─── 結帳頁數量調整控制項 ─── */
.ys-ec-qty-sm {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
}

.ys-ec-qty-sm .ys-ec-qty-btn {
    width: 28px;
    height: 28px;
    font-size: 14px;
    border: 1px solid var(--ys-ec-border);
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ys-ec-text);
    transition: background-color var(--ys-ec-transition);
}

.ys-ec-qty-sm .ys-ec-qty-btn:hover {
    background: var(--ys-ec-primary-bg);
}

.ys-ec-qty-sm .ys-ec-qty-input {
    width: 92px;
    min-width: 92px;
    text-align: center;
    border: 1px solid var(--ys-ec-border);
    border-left: none;
    border-right: none;
    height: 28px;
    font-size: 13px;
    padding: 0 6px;
    -moz-appearance: textfield;
    color: var(--ys-ec-text);
    background: #fff;
    box-sizing: border-box;
}

.ys-ec-qty-sm .ys-ec-qty-input::-webkit-inner-spin-button,
.ys-ec-qty-sm .ys-ec-qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* v2.26.1：行動端 / 觸控裝置最小點擊目標 44x44（WCAG 2.5.5 / Apple HIG）*/
@media (hover: none) and (pointer: coarse) {
    .ys-ec-qty-sm .ys-ec-qty-btn {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    .ys-ec-qty-sm .ys-ec-qty-input {
        min-height: 44px;
        height: 44px;
        width: 100px;
        min-width: 100px;
        font-size: 16px;
    }
    .ys-ec-remove-item {
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
    }
}

/* 桌面版不顯示收合箭頭 */
@media (min-width: 769px) {
    .ys-ec-collapse-arrow {
        display: none;
    }
    .ys-ec-collapsible {
        cursor: default;
    }
}

/* 價格和數量區域字體 */
.ys-ec-td-price,
.ys-ec-td-qty,
.ys-ec-td-total {
    font-size: 13px;
}

/* ─── 已儲存收件方式選擇 ─── */
.ys-ec-saved-recipients {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.ys-ec-saved-recipient-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1.5px solid var(--ys-ec-border-light);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.ys-ec-saved-recipient-option:hover {
    border-color: var(--ys-ec-primary-light);
    background: #fafcfd;
}

.ys-ec-saved-recipient-option:has(input:checked) {
    border-color: var(--ys-ec-primary);
    background: #ffffff;
    box-shadow: 0 0 0 1px var(--ys-ec-primary), 0 2px 6px rgba(122, 155, 174, 0.15);
}

.ys-ec-saved-recipient-option input[type="radio"] {
    margin-top: 3px;
    flex-shrink: 0;
}

.ys-ec-saved-recipient-option input[type="radio"]:checked ~ .ys-ec-saved-recipient-info,
.ys-ec-saved-recipient-option input[type="radio"]:checked ~ span {
    color: var(--ys-ec-primary-dark, #6b8a9a);
}

.ys-ec-saved-recipient-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    line-height: 1.5;
}

.ys-ec-saved-recipient-store {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ys-ec-saved-recipient-store .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: var(--ys-ec-primary, #8fa8b8);
}

.ys-ec-saved-recipient-detail {
    font-size: 12px;
    color: var(--ys-ec-text-muted, #7b8a96);
}

.ys-ec-saved-recipient-addr {
    font-size: 12px;
    color: var(--ys-ec-text-muted, #7b8a96);
}

.ys-ec-new-recipient-option {
    border: 2px dashed var(--ys-ec-primary);
    align-items: center;
    color: var(--ys-ec-primary-dark);
    font-weight: 500;
    background: var(--ys-ec-primary-bg);
    padding: 14px 16px;
    gap: 10px;
}

.ys-ec-new-recipient-option:hover {
    border-color: var(--ys-ec-primary-dark);
    border-style: solid;
    background: #ffffff;
    color: var(--ys-ec-primary-dark);
    box-shadow: 0 2px 8px rgba(122, 155, 174, 0.15);
}

.ys-ec-new-recipient-option:has(input:checked) {
    border-color: var(--ys-ec-primary);
    border-style: solid;
    background: #ffffff;
    box-shadow: 0 0 0 1px var(--ys-ec-primary), 0 2px 6px rgba(122, 155, 174, 0.15);
}

.ys-ec-new-recipient-option .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
    color: var(--ys-ec-primary);
    flex-shrink: 0;
}

.ys-ec-new-recipient-label {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ys-ec-new-recipient-label strong {
    font-size: 14px;
    color: var(--ys-ec-primary-dark);
}

.ys-ec-new-recipient-label small {
    font-size: 11px;
    color: var(--ys-ec-text-muted);
    font-weight: 400;
}

/* ─── 贈品樣式 ─── */
.ys-ec-gift-badge {
    display: inline-block;
    background: #27ae60;
    color: #fff;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    margin-left: 4px;
    font-weight: 600;
    line-height: 1.4;
    vertical-align: middle;
}

.ys-ec-gift-price {
    color: #27ae60;
    font-weight: bold;
}

.ys-ec-qty-static {
    color: var(--ys-ec-text-muted, #999);
    font-size: 13px;
}

/* ─── PayUni embed SDK 載入中的送出鈕樣式 ─── */
button.ys-ec-place-order-btn.ys-ec-btn-loading {
    opacity: 0.65;
    cursor: wait;
    pointer-events: none;
}

.ys-ec-place-order-btn.ys-ec-btn-loading .dashicons {
    vertical-align: middle;
    margin-right: 4px;
}
