/**
 * YS CART — 會員中心與登入/註冊樣式
 *
 * Morandi 色系設計。使用 .ys-ec- 前綴，繼承 ys-ec-common.css 的 CSS 變數。
 *
 * @version 2.0.0
 */

/* ─── 認證表單（登入/註冊）─── */

.ys-ec-auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 16px;
    min-height: 60vh;
}

.ys-ec-auth-form {
    background: var(--ys-ec-card-bg);
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--ys-ec-shadow);
}

.ys-ec-auth-form-wide {
    max-width: 540px;
}

.ys-ec-auth-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--ys-ec-text);
    margin: 0 0 24px;
    text-align: center;
}

.ys-ec-auth-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: var(--ys-ec-text-muted);
}

.ys-ec-dashboard-auth {
    max-width: 1120px;
    margin: 0 auto;
    padding: 40px 16px;
}

.ys-ec-dashboard-auth-header {
    max-width: 720px;
    margin: 0 auto 28px;
    text-align: center;
}

.ys-ec-dashboard-auth-header h2 {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.25;
    color: var(--ys-ec-text);
}

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

.ys-ec-dashboard-auth-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    align-items: start;
}

.ys-ec-dashboard-auth-panel .ys-ec-auth-wrapper {
    display: block;
    min-height: 0;
    padding: 0;
}

.ys-ec-dashboard-auth-panel .ys-ec-auth-form {
    max-width: none;
    min-height: 100%;
}

.ys-ec-dashboard-auth-panel .ys-ec-auth-footer {
    display: none;
}

/* ─── 表單通用 ─── */

.ys-ec-form-group {
    margin-bottom: 16px;
    position: relative;
}

.ys-ec-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ys-ec-text);
    margin-bottom: 6px;
}

.ys-ec-form-group input[type="text"],
.ys-ec-form-group input[type="email"],
.ys-ec-form-group input[type="password"],
.ys-ec-form-group input[type="tel"],
.ys-ec-form-group input[type="date"],
.ys-ec-form-group input[type="number"],
.ys-ec-form-group select,
.ys-ec-form-group textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ys-ec-text);
    background: var(--ys-ec-card-bg);
    border: 1.5px solid var(--ys-ec-border);
    border-radius: var(--ys-ec-radius);
    transition: border-color var(--ys-ec-transition), box-shadow var(--ys-ec-transition);
    box-sizing: border-box;
    font-family: var(--ys-ec-font);
}

/* 會員中心表單欄位高度統一：input／date／select 一律等高（date 內建控制不撐高） */
.ys-ec-form-group input[type="date"] {
    min-height: 44px;
    height: 44px;
}
.ys-ec-form-group textarea {
    height: auto;
    min-height: 88px;
}

/* Email 等欄位尾端的行內狀態標記（勾勾／未驗證），貼齊 input 右側 */
.ys-ec-input-affix {
    position: relative;
}
.ys-ec-input-affix > input {
    padding-right: 40px;
}
.ys-ec-input-affix__check,
.ys-ec-input-affix__warn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    line-height: 1;
    pointer-events: none;
}
.ys-ec-input-affix__check {
    color: var(--ys-ec-success);
    font-size: 16px;
    font-weight: 700;
}
.ys-ec-input-affix__warn {
    color: var(--ys-ec-warning);
    font-size: 12px;
    font-weight: 600;
}

.ys-ec-form-group input:focus,
.ys-ec-form-group select:focus,
.ys-ec-form-group textarea:focus {
    outline: none;
    border-color: var(--ys-ec-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ys-ec-account-primary) 20%, transparent);
}

.ys-ec-form-group input:disabled,
.ys-ec-form-group input[readonly] {
    background: var(--ys-ec-body-bg);
    color: var(--ys-ec-text-muted);
    cursor: not-allowed;
}

/* 錯誤欄位標示 */
.ys-ec-has-error input,
.ys-ec-has-error select {
    border-color: var(--ys-ec-danger);
}

.ys-ec-has-error label {
    color: var(--ys-ec-danger);
}

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

/* Select 下拉選單 — 高 specificity 覆蓋 Blocksy 等主題的 height/padding */
.ys-ec-auth-wrapper .ys-ec-form-group select,
.ys-ec-auth-modal .ys-ec-form-group select,
.ys-ec-form .ys-ec-form-group select,
.ys-ec-auth-overlay select#ys-ec-reg-country {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: none !important;
    padding: 10px 34px 10px 12px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    color: var(--ys-ec-text);
    background-color: var(--ys-ec-card-bg) !important;
    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 fill='%236e7f8d' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px !important;
    border: 1.5px solid var(--ys-ec-border) !important;
    border-radius: var(--ys-ec-radius) !important;
    box-sizing: border-box !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    cursor: pointer;
    font-family: var(--ys-ec-font);
}

/* 表單行（多欄排列） */
.ys-ec-form-row {
    display: flex;
    gap: 16px;
}

.ys-ec-form-row-between {
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.ys-ec-form-half {
    flex: 1;
}

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

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

/* ─── 按鈕 ─── */

.ys-ec-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    border: 1px solid transparent;
    border-radius: var(--ys-ec-radius);
    cursor: pointer;
    transition: background-color var(--ys-ec-transition), border-color var(--ys-ec-transition), box-shadow var(--ys-ec-transition);
    text-decoration: none;
    font-family: var(--ys-ec-font);
}

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

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

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

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

.ys-ec-btn-block {
    display: flex;
    width: 100%;
}

/* 會員中心按鈕色彩對比修正 */
.ys-ec-dashboard-wrapper .ys-ec-btn-primary {
    background: var(--ys-ec-primary-dark, #6b8a9a);
    color: #fff;
    border-color: var(--ys-ec-primary-dark, #6b8a9a);
}

.ys-ec-dashboard-wrapper .ys-ec-btn-primary:hover {
    background: color-mix(in srgb, var(--ys-ec-primary-dark, #6b8a9a) 82%, #000);
    border-color: color-mix(in srgb, var(--ys-ec-primary-dark, #6b8a9a) 82%, #000);
}

/* ─── 按鈕尺寸變體 ─── */

.ys-ec-btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    min-height: 36px;
    line-height: 1.4;
}

.ys-ec-dashboard-wrapper .ys-ec-btn,
.ys-ec-dashboard-wrapper .ys-ec-btn-sm,
.ys-ec-dashboard-wrapper a.ys-ec-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    text-decoration: none;
    box-sizing: border-box;
    min-height: 36px;
    padding: 8px 16px;
    line-height: 1.4;
}

/* 訂單狀態標籤（前端） */
.ys-ec-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* ─── 連結 ─── */

.ys-ec-link {
    color: var(--ys-ec-primary-dark);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--ys-ec-transition);
}

.ys-ec-link:hover {
    text-decoration: underline;
    color: var(--ys-ec-primary);
}

.ys-ec-link-muted {
    color: var(--ys-ec-text-muted);
    text-decoration: none;
    font-size: 13px;
}

.ys-ec-link-muted:hover {
    color: var(--ys-ec-primary-dark);
}

/* ─── 提示訊息（Morandi 配色） ─── */

.ys-ec-alert {
    padding: 12px 16px;
    border-radius: var(--ys-ec-radius);
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.6;
}

.ys-ec-alert p {
    margin: 0;
}

.ys-ec-alert p + p {
    margin-top: 4px;
}

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

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

.ys-ec-alert-warning {
    background: var(--ys-ec-warning-light);
    color: var(--ys-ec-warning-text, #7a6530);
    border: 1px solid rgba(196, 166, 122, 0.3);
}

.ys-ec-alert-info {
    background: var(--ys-ec-primary-bg);
    color: var(--ys-ec-primary-dark);
    border: 1px solid color-mix(in srgb, var(--ys-ec-account-primary) 30%, transparent);
}

/* ─── 會員中心佈局 ─── */

.ys-ec-dashboard-wrapper {
    max-width: var(--ys-ec-account-max, 1120px);
    margin: 0 auto;
    padding: 24px 16px;
    font-family: var(--ys-ec-font);
}

.ys-ec-dashboard-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* 側邊欄（乾淨卡片 + 圖示） */
.ys-ec-dashboard-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--ys-ec-card-bg);
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius-lg);
    overflow: hidden;
    box-shadow: var(--ys-ec-shadow);
}

/* === 會員資料卡片（v2.35.43 — tier-color aware 漸層底色）===
 * Caller 在 wrapper 加 style="--tier-color: <?php echo $badge_color; ?>"
 * 會讓 avatar、漸層、徽章共享同一顏色
 */
.ys-ec-dashboard-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    border-bottom: 1px solid var(--ys-ec-border-light);
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--tier-color, var(--ys-ec-primary, #7a9bae)) 7%, transparent) 0%,
        transparent 100%
    );
}

@supports not (background: color-mix(in srgb, red, blue)) {
    .ys-ec-dashboard-user-card {
        background: var(--ys-ec-primary-bg, #edf3f7);
    }
}

.ys-ec-avatar img {
    border-radius: 50%;
    width: 48px;
    height: 48px;
}

/* 用戶姓名首字縮寫圖示（用 tier-color 著色） */
.ys-ec-user-initial {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--tier-color, var(--ys-ec-primary, #7a9bae));
    box-shadow: 0 2px 6px color-mix(in srgb, var(--tier-color, var(--ys-ec-primary, #7a9bae)) 30%, transparent);
}

@supports not (background: color-mix(in srgb, red, blue)) {
    .ys-ec-user-initial {
        background: var(--ys-ec-primary, #7a9bae);
        box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    }
}

.ys-ec-user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ys-ec-user-info strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--ys-ec-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.ys-ec-user-info .ys-ec-tier-badge {
    align-self: flex-start;
}

/* === 會員等級徽章（v2.35.43 — 支援 tier-color 動態主題）===
 * 用法：<span class="ys-ec-tier-badge" style="--tier-color: <?php echo $tier->badge_color; ?>">VIP</span>
 * 沒提供 --tier-color 時 fallback 到主色（保持舊行為向下相容）
 */
.ys-ec-tier-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--tier-color, var(--ys-ec-primary-dark));
    background: color-mix(in srgb, var(--tier-color, var(--ys-ec-primary)) 14%, #fff);
    border: 1px solid color-mix(in srgb, var(--tier-color, var(--ys-ec-primary)) 28%, transparent);
    padding: 3px 10px;
    border-radius: 999px;
}

/* 不支援 color-mix 的舊瀏覽器 fallback (~Safari 16.1 之前) */
@supports not (background: color-mix(in srgb, red, blue)) {
    .ys-ec-tier-badge {
        color: var(--ys-ec-primary-dark);
        background: var(--ys-ec-primary-bg);
        border-color: transparent;
    }
}

/* 側邊欄導覽（active 主色背景 + 左邊框） */
.ys-ec-dashboard-nav ul {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.ys-ec-dashboard-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--ys-ec-text);
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.ys-ec-dashboard-nav li a:hover {
    background: var(--ys-ec-primary-bg);
}

.ys-ec-dashboard-nav li.ys-ec-active a {
    background: var(--ys-ec-primary-bg);
    color: var(--ys-ec-primary-dark);
    font-weight: 600;
    border-left: 3px solid var(--ys-ec-primary);
}

.ys-ec-dashboard-nav li.ys-ec-active a .dashicons {
    color: var(--ys-ec-primary-dark);
}

.ys-ec-dashboard-nav .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: var(--ys-ec-text-muted);
}

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

.ys-ec-logout-link {
    color: var(--ys-ec-danger) !important;
}

/* 內容區（卡片包裹） */
.ys-ec-dashboard-content {
    flex: 1;
    min-width: 0;
    background: var(--ys-ec-card-bg);
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius-lg);
    padding: 24px;
    box-shadow: var(--ys-ec-shadow);
    /* 統一會員中心字體 */
    font-size: 14px;
    line-height: 1.6;
    color: var(--ys-ec-text, #2c3e50);
}

.ys-ec-dashboard-content h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
}

.ys-ec-dashboard-content h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.ys-ec-dashboard-content table {
    font-size: 13px;
}

.ys-ec-dashboard-content table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ys-ec-text-muted);
}

/* ─── 總覽分頁 ─── */

.ys-ec-welcome-banner {
    margin-bottom: 24px;
}

.ys-ec-welcome-banner h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--ys-ec-text);
}

.ys-ec-welcome-banner p {
    font-size: 14px;
    color: var(--ys-ec-text-muted);
    margin: 0;
}

/* === ADDRESS CARD（v2.35.43 — 還原 Phase E+F 失落的設計）===
 * 用於 templates/account/addresses.php 宅配地址 / 超商取貨門市清單
 *
 * Markup:
 *   <div class="ys-ec-address-card [ys-ec-address-card--default]">
 *     <dl class="ys-ec-ty-dl">
 *       <dt>收件人</dt><dd>...</dd>
 *       ...
 *     </dl>
 *   </div>
 */
.ys-ec-address-card {
    background: var(--ys-ec-card-bg, #fff);
    border: 1px solid var(--ys-ec-border-light, #e5eaef);
    border-radius: var(--ys-ec-radius-lg, 12px);
    box-shadow: var(--ys-ec-shadow, 0 1px 3px rgba(0,0,0,0.04));
    padding: 18px 20px;
    margin-bottom: 12px;
    transition: box-shadow var(--ys-ec-transition, 0.2s ease),
                border-color var(--ys-ec-transition, 0.2s ease);
    position: relative;
}

.ys-ec-address-card:hover {
    box-shadow: var(--ys-ec-shadow-hover, 0 4px 12px rgba(0,0,0,0.08));
    border-color: var(--ys-ec-border, #d4dbe2);
}

.ys-ec-address-card--default {
    border-color: var(--ys-ec-primary-light, #b6c8d3);
    box-shadow: 0 0 0 1px var(--ys-ec-primary-light, #b6c8d3),
                var(--ys-ec-shadow, 0 1px 3px rgba(0,0,0,0.04));
}

.ys-ec-address-card--default::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 3px;
    border-radius: 2px;
    background: var(--ys-ec-primary, #7a9bae);
}

.ys-ec-address-card .ys-ec-ty-dl {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 8px 16px;
    margin: 0;
}

.ys-ec-address-card .ys-ec-ty-dl dt {
    color: var(--ys-ec-text-muted, #6e7f8d);
    font-size: 13px;
    font-weight: 500;
    padding-top: 2px;
    margin: 0;
}

.ys-ec-address-card .ys-ec-ty-dl dd {
    color: var(--ys-ec-text, #2d3a45);
    font-size: 14px;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.ys-ec-address-card .ys-ec-ty-dl dd > strong {
    margin-right: 4px;
}

/* 操作列：最後一組 dt/dd 加分隔線 */
.ys-ec-address-card .ys-ec-ty-dl dt:last-of-type,
.ys-ec-address-card .ys-ec-ty-dl dt:last-of-type + dd {
    border-top: 1px dashed var(--ys-ec-border-light, #e5eaef);
    padding-top: 12px;
    margin-top: 4px;
}

.ys-ec-address-card .ys-ec-ty-dl dd form + form {
    margin-left: 4px;
}

@media (max-width: 640px) {
    .ys-ec-address-card {
        padding: 14px 16px;
    }
    .ys-ec-address-card .ys-ec-ty-dl {
        grid-template-columns: 1fr;
        gap: 2px 0;
    }
    .ys-ec-address-card .ys-ec-ty-dl dt {
        padding-top: 10px;
        font-size: 12px;
    }
    .ys-ec-address-card .ys-ec-ty-dl dt:first-of-type {
        padding-top: 0;
    }
    .ys-ec-address-card--default::before {
        top: 10px;
        bottom: 10px;
    }
}

/* === TIER PROGRESS BAR（v2.35.43）=== */
.ys-ec-tier-progress {
    display: block;
    width: 100%;
    height: 6px;
    background: var(--ys-ec-border-light, #e5eaef);
    border-radius: 999px;
    overflow: hidden;
    margin: 8px 0 6px;
}

.ys-ec-tier-progress__fill {
    display: block;
    height: 100%;
    width: var(--progress, 0%);
    background: var(--tier-color, var(--ys-ec-primary, #7a9bae));
    border-radius: inherit;
    transition: width 0.6s cubic-bezier(.2,.8,.2,1);
}

.ys-ec-tier-progress__caption {
    display: block;
    font-size: 12px;
    color: var(--ys-ec-text-muted, #6e7f8d);
    margin-top: 4px;
}

/* === TIER LIST ROW（v2.35.43 — tier.php 等級一覽 left-border accent）===
 * 每張等級 row 的 wrapper 帶 style="--tier-color: <hex>"，產生左側 accent + 微微的漸層
 */
.ys-ec-tier-list-row {
    border-left: 4px solid var(--tier-color, var(--ys-ec-border, #d4dbe2));
    padding-left: 16px;
    transition: background 0.3s ease;
}

.ys-ec-tier-list-row--current {
    background: color-mix(in srgb, var(--tier-color, var(--ys-ec-primary, #7a9bae)) 6%, #fff);
}

@supports not (background: color-mix(in srgb, red, blue)) {
    .ys-ec-tier-list-row--current {
        background: var(--ys-ec-primary-bg, #edf3f7);
    }
}

.ys-ec-tier-list-row__name {
    font-size: 13px;
    padding: 4px 12px;
}

/* === PAYMENT CARDS（v2.39.14 — Item 1 信用卡式版型重設計）=========================
 * 設計重點：
 *   - 卡片視覺：圓角 12px、box-shadow（hover 時 lift）、padding 20-24px
 *   - 預設卡片：2px Morandi 綠邊 + 漸層背景 + 右上 pill badge
 *   - 卡號：等寬字、letter-spacing、字級 1.5rem~1.75rem
 *   - meta 列：水平排列三欄（卡別 / 到期 / 金流）
 *   - 操作按鈕：右下 actions footer，secondary outline + danger outline
 *   - 行動版：< 480px 時 actions 與 meta 改直排
 *
 * Token：使用 ys-ec-common.css 已定義的 Morandi 變數
 *   --ys-ec-primary / --ys-ec-success / --ys-ec-danger / --ys-ec-warning
 *   --ys-ec-text / --ys-ec-text-muted / --ys-ec-border / --ys-ec-border-light
 * ============================================================================ */

/* 列表容器 */
.ys-ec-payment-cards-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ys-ec-cards-manage__hint {
    font-size: 14px;
    color: var(--ys-ec-text-muted, #6e7f8d);
    margin: 0 0 4px;
}

/* 信用卡式容器 */
.ys-ec-payment-card {
    position: relative;
    background: var(--ys-ec-card-bg, #fff);
    border: 1px solid var(--ys-ec-border-light, #e5eaef);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 20px 24px;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
        "header"
        "number"
        "divider"
        "meta"
        "actions";
    gap: 14px;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.ys-ec-payment-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.09);
}

.ys-ec-payment-card:focus-within {
    outline: 2px solid var(--ys-ec-primary, #7a9bae);
    outline-offset: 2px;
}

/* 預設卡片：Morandi 綠邊 + 淺漸層背景 */
.ys-ec-payment-card--default {
    border: 2px solid var(--ys-ec-success, #6ea383);
    padding: 19px 23px; /* 補回 1px 邊框造成的內距差 */
    background:
        linear-gradient(135deg, rgba(110, 163, 131, 0.06) 0%, transparent 60%),
        var(--ys-ec-card-bg, #fff);
    box-shadow: 0 2px 10px rgba(110, 163, 131, 0.12);
}

.ys-ec-payment-card--default:hover {
    box-shadow: 0 6px 20px rgba(110, 163, 131, 0.18);
}

/* ─── 卡片頭部：金流名稱 + 預設 badge ─── */
.ys-ec-payment-card__header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 24px;
}

.ys-ec-payment-card__brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--ys-ec-text-muted, #6e7f8d);
    text-transform: uppercase;
}

.ys-ec-payment-card__brand-name {
    color: var(--ys-ec-text, #2d3a45);
}

/* badge（pill 形狀） — fallback 樣式（避免被 .ys-ec-badge 全域樣式覆蓋）*/
.ys-ec-payment-card__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    border-radius: 999px;
    white-space: nowrap;
}

.ys-ec-badge--success.ys-ec-payment-card__badge,
.ys-ec-payment-card__badge.ys-ec-badge--success {
    background: var(--ys-ec-success-bg, #e8f3ec);
    color: var(--ys-ec-success-text, #3a6548);
    border: 1px solid var(--ys-ec-success, #6ea383);
}

/* ─── 卡號（信用卡靈魂視覺） ─── */
.ys-ec-payment-card__number {
    grid-area: number;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--ys-ec-text, #2d3a45);
    line-height: 1.2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 4px 0;
}

.ys-ec-payment-card__number-last4 {
    color: var(--ys-ec-primary-dark, #5a7d91);
    font-weight: 700;
}

/* ─── 分隔線 ─── */
.ys-ec-payment-card__divider {
    grid-area: divider;
    height: 1px;
    background: var(--ys-ec-border-light, #e5eaef);
    margin: 2px 0;
}

/* ─── meta 列（卡別 / 到期 / 金流，水平排列） ─── */
.ys-ec-payment-card__meta {
    grid-area: meta;
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin: 0;
    padding: 0;
}

.ys-ec-payment-card__meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
}

.ys-ec-payment-card__meta-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--ys-ec-text-muted, #6e7f8d);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0;
}

.ys-ec-payment-card__meta-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ys-ec-text, #2d3a45);
    margin: 0;
}

/* ─── 操作按鈕區 ─── */
.ys-ec-payment-card__actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 4px;
    border: 0;
}

.ys-ec-payment-card__current-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ys-ec-text-muted, #6e7f8d);
    margin-right: auto; /* 推到最左邊；刪除鈕貼右 */
    font-style: italic;
}

/* ─── 按鈕變體：secondary（中性 outline）─── */
.ys-ec-btn--secondary,
.ys-ec-btn-outline.ys-ec-btn--secondary {
    background: transparent;
    color: var(--ys-ec-text, #2d3a45);
    border: 1px solid var(--ys-ec-border, #d4dbe2);
}

.ys-ec-btn--secondary:hover,
.ys-ec-btn-outline.ys-ec-btn--secondary:hover {
    background: var(--ys-ec-primary-bg, #edf3f7);
    color: var(--ys-ec-primary-dark, #5a7d91);
    border-color: var(--ys-ec-primary, #7a9bae);
}

/* ─── 按鈕變體：danger-outline（危險 outline）─── */
.ys-ec-btn--danger-outline {
    background: transparent;
    color: var(--ys-ec-danger-text, #8b4c4c);
    border: 1px solid var(--ys-ec-danger, #bf7878);
}

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

.ys-ec-btn--danger-outline:focus-visible {
    outline: 2px solid var(--ys-ec-danger, #bf7878);
    outline-offset: 2px;
}

/* ─── 空狀態（付款方式專屬） ─── */
.ys-ec-payment-cards-empty {
    background: var(--ys-ec-card-bg, #fff);
    border: 1px dashed var(--ys-ec-border, #d4dbe2);
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    color: var(--ys-ec-text-muted, #6e7f8d);
}

.ys-ec-payment-cards-empty__icon {
    display: inline-flex;
    color: var(--ys-ec-primary-light, #a8c2d0);
    margin-bottom: 12px;
}

.ys-ec-payment-cards-empty__title {
    font-size: 1rem;
    color: var(--ys-ec-text, #2d3a45);
    margin: 0 0 6px;
}

.ys-ec-payment-cards-empty__sub {
    font-size: 0.9rem;
    color: var(--ys-ec-text-muted, #6e7f8d);
    margin: 0;
}

/* ─── RWD：mobile (<480px) 卡號縮小、meta/actions 改直排 ─── */
@media (max-width: 480px) {
    .ys-ec-payment-card {
        padding: 16px 18px;
        gap: 12px;
    }

    .ys-ec-payment-card--default {
        padding: 15px 17px;
    }

    .ys-ec-payment-card__number {
        font-size: 1.25rem;
        gap: 6px;
        letter-spacing: 0.06em;
    }

    .ys-ec-payment-card__meta {
        flex-direction: column;
        gap: 8px;
    }

    .ys-ec-payment-card__meta-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .ys-ec-payment-card__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .ys-ec-payment-card__actions .ys-ec-btn {
        width: 100%;
        text-align: center;
    }

    .ys-ec-payment-card__current-label {
        margin: 0 0 4px;
        text-align: center;
    }
}

/* ─── 中等斷點（481-640px） — 維持 grid 但稍微鬆綁 padding ─── */
@media (min-width: 481px) and (max-width: 640px) {
    .ys-ec-payment-card {
        padding: 18px 20px;
    }

    .ys-ec-payment-card__number {
        font-size: 1.4rem;
    }
}

/* === VERIFIED / UNVERIFIED BADGE（v2.35.43 — profile.php P2 還原）=== */
.ys-ec-verified-badge,
.ys-ec-unverified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
}

.ys-ec-verified-badge {
    color: #2f6f4d;
    background: #e7f4ec;
    border-color: #b9dec7;
}

.ys-ec-unverified-badge {
    color: #8a5a14;
    background: #fdf3e0;
    border-color: #f0d8a6;
}

/* === 會員等級卡片（重新設計）=== */
.ys-ec-tier-card {
    background: #fff;
    border: 1px solid var(--ys-ec-border-light, #e2e8ed);
    border-radius: 12px;
    padding: 0;
    margin-bottom: 24px;
    overflow: hidden;
}

.ys-ec-tier-card-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #f0f4f8 0%, #e8eff5 100%);
    border-bottom: 1px solid var(--ys-ec-border-light, #e2e8ed);
}

.ys-ec-tier-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--ys-ec-primary, #8fa8b8);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ys-ec-tier-icon .dashicons {
    color: #fff;
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.ys-ec-tier-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ys-ec-text-muted, #7b8a96);
    font-weight: 600;
}
.ys-ec-tier-name-display {
    font-size: 22px;
    font-weight: 700;
    color: var(--ys-ec-text, #2c3e50);
    margin: 2px 0;
}
.ys-ec-tier-validity {
    font-size: 12px;
    color: var(--ys-ec-text-muted, #7b8a96);
}

/* 升級進度區塊 */
.ys-ec-upgrade-section {
    padding: 16px 24px;
    border-bottom: 1px solid var(--ys-ec-border-light, #e2e8ed);
}
.ys-ec-upgrade-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--ys-ec-text, #2c3e50);
}
.ys-ec-upgrade-fraction {
    font-weight: 600;
    color: var(--ys-ec-primary-dark, #6b8a9a);
}
.ys-ec-upgrade-bar {
    height: 8px;
    background: #e8edf2;
    border-radius: 4px;
    overflow: hidden;
}
.ys-ec-upgrade-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ys-ec-primary, #8fa8b8), var(--ys-ec-success, #7dab8e));
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 2px;
}
.ys-ec-upgrade-hint {
    font-size: 12px;
    color: var(--ys-ec-success, #7dab8e);
    margin-top: 6px;
    font-weight: 500;
}

/* 會員權益摘要 */
.ys-ec-tier-perks {
    padding: 12px 24px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.ys-ec-perk-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--ys-ec-text, #2c3e50);
}
.ys-ec-perk-item .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: var(--ys-ec-primary, #8fa8b8);
}

/* === 前往購物按鈕 === */
.ys-ec-btn-shop {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: var(--ys-ec-primary, #8fa8b8);
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}
.ys-ec-btn-shop:hover {
    background: var(--ys-ec-primary-dark, #6b8a9a);
    color: #fff;
}
.ys-ec-btn-shop .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* === 會員等級一覽（彈性卡片網格，支援任意數量） === */
.ys-ec-tier-levels {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* 等級卡片項目 */
.ys-ec-tier-card-item {
    position: relative;
    background: var(--ys-ec-card-bg, #fff);
    border: 1.5px solid var(--ys-ec-border-light, #e2e8ed);
    border-radius: 12px;
    padding: 24px 20px;
    text-align: center;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.ys-ec-tier-card-item:hover {
    box-shadow: var(--ys-ec-shadow-hover, 0 4px 12px rgba(0,0,0,0.08));
}
.ys-ec-tier-card-item--current {
    border-color: var(--ys-ec-primary, #8fa8b8);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ys-ec-account-primary) 20%, transparent);
}

/* 「目前等級」標籤 */
.ys-ec-tier-level-current-tag {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ys-ec-primary, #8fa8b8);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
    white-space: nowrap;
}

/* 等級徽章圓形圖示 */
.ys-ec-tier-card-item__badge {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}
.ys-ec-tier-card-item__badge .dashicons {
    color: #fff;
    font-size: 24px;
    width: 24px;
    height: 24px;
}

/* 等級名稱 */
.ys-ec-tier-card-item__name {
    font-size: 18px;
    font-weight: 700;
    color: var(--ys-ec-text, #2c3e50);
    margin-bottom: 6px;
}

/* 升級條件 */
.ys-ec-tier-card-item__condition {
    font-size: 12px;
    color: var(--ys-ec-text-muted, #7b8a96);
    margin-bottom: 16px;
}

/* 權益列表 */
.ys-ec-tier-card-item__benefits {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 13px;
    color: var(--ys-ec-text, #2c3e50);
    text-align: left;
}
.ys-ec-tier-card-item__benefits li {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}
.ys-ec-tier-card-item__benefits .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: var(--ys-ec-primary, #8fa8b8);
    flex-shrink: 0;
}

/* 等級變動操作標籤 */
.ys-ec-status-tier-upgrade {
    background: var(--ys-ec-success-light, #e8f5ed);
    color: var(--ys-ec-success-text, #3d6b4a);
}
.ys-ec-status-tier-downgrade {
    background: var(--ys-ec-danger-light, #f5e8e8);
    color: var(--ys-ec-danger-text, #8b4c4c);
}
.ys-ec-status-tier-renew {
    background: var(--ys-ec-primary-bg, #edf2f7);
    color: var(--ys-ec-primary-dark, #6b8a9a);
}
.ys-ec-status-tier-manual {
    background: var(--ys-ec-warning-light, #f5f0e0);
    color: var(--ys-ec-warning-text, #7a6530);
}

/* 統計卡片 */
.ys-ec-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.ys-ec-stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--ys-ec-body-bg);
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius);
    transition: box-shadow var(--ys-ec-transition);
}

.ys-ec-stat-card:hover {
    box-shadow: var(--ys-ec-shadow-hover);
}

.ys-ec-stat-icon {
    font-size: 28px;
    width: 28px;
    height: 28px;
    color: var(--ys-ec-primary);
    flex-shrink: 0;
}

.ys-ec-stat-body {
    display: flex;
    flex-direction: column;
}

.ys-ec-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--ys-ec-text);
    line-height: 1.2;
}

.ys-ec-stat-label {
    font-size: 12px;
    color: var(--ys-ec-text-muted);
    margin-top: 2px;
}

/* ─── 區塊 ─── */

.ys-ec-section {
    margin-bottom: 24px;
}

.ys-ec-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ys-ec-text);
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--ys-ec-primary);
}

.ys-ec-section-footer {
    margin-top: 12px;
    text-align: right;
}

/* ─── 訂單表格（一致的 Morandi 狀態標籤） ─── */

.ys-ec-order-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

.ys-ec-order-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--ys-ec-border-light);
    color: var(--ys-ec-text);
}

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

.ys-ec-order-table tr:hover td {
    background: var(--ys-ec-primary-bg);
}

.ys-ec-order-table a {
    color: var(--ys-ec-primary-dark);
    text-decoration: none;
    font-weight: 500;
}

.ys-ec-order-table a:hover {
    text-decoration: underline;
}

/* 訂單列表統一字體 */
.ys-ec-orders-table th,
.ys-ec-orders-table td,
.ys-ec-order-table th,
.ys-ec-order-table td {
    padding: 10px 12px;
    font-size: 13px;
}

.ys-ec-orders-table .order-number,
.ys-ec-order-table a {
    font-weight: 600;
    color: var(--ys-ec-primary-dark);
}

.ys-ec-orders-table .order-status,
.ys-ec-order-table .ys-ec-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

/* 訂單狀態標籤（Morandi 配色） */
.ys-ec-status {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

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

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

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

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

.ys-ec-status-cancelled {
    background: var(--ys-ec-body-bg);
    color: var(--ys-ec-text-muted);
}

.ys-ec-status-refunded {
    background: var(--ys-ec-danger-light);
    color: var(--ys-ec-danger-text, #8b4c4c);
}

.ys-ec-status-failed {
    background: var(--ys-ec-danger-light);
    color: var(--ys-ec-danger-text, #8b4c4c);
}

.ys-ec-status-on-hold {
    background: var(--ys-ec-warning-light);
    color: var(--ys-ec-warning-text, #7a6530);
}

/* ─── 空狀態 ─── */

.ys-ec-empty-state {
    text-align: center;
    padding: 40px 16px;
    color: var(--ys-ec-text-muted);
}

.ys-ec-empty-state p {
    margin: 0 0 16px;
    font-size: 14px;
}

/* ─── 訂閱管理 ─── */

.ys-ec-subscriptions-tab .ys-ec-section-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--ys-ec-text);
}

.ys-ec-subscriptions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ys-ec-subscription-card {
    background: var(--ys-ec-card-bg);
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius-lg, 12px);
    padding: 20px;
    transition: box-shadow var(--ys-ec-transition);
}

.ys-ec-subscription-card:hover {
    box-shadow: var(--ys-ec-shadow-hover, 0 4px 12px rgba(0, 0, 0, 0.08));
}

.ys-ec-sub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.ys-ec-sub-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: var(--ys-ec-text);
}

/* 訂閱狀態徽章 */
.ys-ec-sub-badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
}

.ys-ec-sub-badge-active {
    background: var(--ys-ec-success-light);
    color: #3d6b4a;
}

.ys-ec-sub-badge-pending {
    background: var(--ys-ec-primary-bg);
    color: var(--ys-ec-primary-dark);
}

.ys-ec-sub-badge-on-hold {
    background: var(--ys-ec-warning-light);
    color: var(--ys-ec-warning-text, #7a6530);
}

.ys-ec-sub-badge-suspended {
    background: var(--ys-ec-danger-light);
    color: var(--ys-ec-danger-text, #8b4c4c);
}

.ys-ec-sub-badge-cancelled {
    background: #e8e8e8;
    color: #666;
}

.ys-ec-sub-badge-expired {
    background: #e8e8e8;
    color: #999;
}

/* 訂閱詳情 */
.ys-ec-sub-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--ys-ec-border-light);
}

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

.ys-ec-sub-detail-label {
    font-size: 12px;
    color: var(--ys-ec-text-muted);
    font-weight: 500;
}

.ys-ec-sub-detail-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--ys-ec-text);
}

/* 訂閱操作按鈕 */
.ys-ec-sub-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ys-ec-btn-danger {
    background: var(--ys-ec-danger);
    color: #fff;
    border: 1px solid var(--ys-ec-danger);
}

.ys-ec-btn-danger:hover {
    background: #a86868;
    border-color: #a86868;
}

.ys-ec-btn-loading {
    opacity: 0.6;
    pointer-events: none;
    cursor: not-allowed;
}

.ys-ec-sub-expired-notice {
    font-size: 12px;
    color: var(--ys-ec-danger-text, #8b4c4c);
    font-style: italic;
}

/* 訂閱管理 RWD */
@media (max-width: 480px) {
    .ys-ec-sub-header {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .ys-ec-sub-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .ys-ec-sub-actions .ys-ec-btn {
        text-align: center;
    }
}

/* 訂閱物流資料：原生 template 與 headless account mount 共用 */
.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--ys-ec-border-light);
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-toggle,
.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-actions .ys-ec-btn,
.ys-ec-subscriptions-tab [data-ys-ec-sub-role="select-store"] {
    min-height: 44px;
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-panel {
    margin-top: 12px;
    padding: 16px;
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius-lg, 12px);
    background: var(--ys-ec-body-bg);
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-panel[hidden],
.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-form[hidden],
.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-fields[hidden] {
    display: none !important;
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-panel__title {
    margin: 0 0 12px;
    color: var(--ys-ec-text);
    font-size: 15px;
    font-weight: 700;
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-current {
    display: grid;
    grid-template-columns: minmax(88px, auto) minmax(0, 1fr);
    gap: 8px 16px;
    margin: 0;
    font-size: 14px;
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-current dt {
    color: var(--ys-ec-text-muted);
    font-weight: 600;
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-current dd {
    min-width: 0;
    margin: 0;
    color: var(--ys-ec-text);
    overflow-wrap: anywhere;
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-message {
    min-height: 1.5em;
    margin: 12px 0 0;
    color: var(--ys-ec-text-muted);
    font-size: 13px;
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-message[data-state="error"] {
    color: var(--ys-ec-danger-text, #8b4c4c);
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-message[data-state="success"] {
    color: var(--ys-ec-success-text, #3d6b4a);
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-message[data-state="warning"] {
    color: var(--ys-ec-warning-text, #7a6530);
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-form {
    margin-top: 16px;
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
    color: var(--ys-ec-text);
    font-size: 13px;
    font-weight: 600;
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-field--wide {
    grid-column: 1 / -1;
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-field input,
.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-field select {
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
    padding: 9px 11px;
    border: 1px solid var(--ys-ec-border);
    border-radius: var(--ys-ec-radius-md, 8px);
    background: var(--ys-ec-card-bg);
    color: var(--ys-ec-text);
    font: inherit;
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-field input:focus-visible,
.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-field select:focus-visible,
.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-toggle:focus-visible,
.ys-ec-subscriptions-tab [data-ys-ec-sub-role="select-store"]:focus-visible {
    outline: 2px solid var(--ys-ec-primary);
    outline-offset: 2px;
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-fields {
    min-width: 0;
    margin: 16px 0 0;
    padding: 14px;
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius-md, 8px);
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-fields legend {
    padding: 0 6px;
    color: var(--ys-ec-text);
    font-size: 13px;
    font-weight: 700;
}

.ys-ec-subscriptions-tab [data-ys-ec-sub-role="select-store"] {
    margin-top: 12px;
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-form[aria-busy="true"] {
    opacity: 0.72;
}

@media (max-width: 640px) {
    .ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-panel {
        padding: 12px;
    }

    .ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-current,
    .ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-grid {
        grid-template-columns: 1fr;
    }

    .ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-current dd {
        margin-bottom: 6px;
    }

    .ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-field--wide {
        grid-column: auto;
    }

    .ys-ec-subscriptions-tab .ys-ec-sub-fulfillment-actions .ys-ec-btn {
        width: 100%;
    }
}

/* ─── 帳號設定（乾淨卡片佈局） ─── */

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

.ys-ec-fieldset legend {
    font-size: 15px;
    font-weight: 700;
    color: var(--ys-ec-text);
    padding: 0 8px;
}

.ys-ec-fieldset-desc {
    font-size: 13px;
    color: var(--ys-ec-text-muted);
    margin: 0 0 16px;
}

.ys-ec-verified-badge {
    display: inline-block;
    font-size: 12px;
    color: var(--ys-ec-success);
    font-weight: 600;
    margin-top: 4px;
}

.ys-ec-unverified-badge {
    display: inline-block;
    font-size: 12px;
    color: var(--ys-ec-warning);
    font-weight: 600;
    margin-top: 4px;
}

.ys-ec-form-actions {
    padding-top: 8px;
}

/* ─── 通知 ─── */

.ys-ec-notice {
    padding: 16px 20px;
    border-radius: var(--ys-ec-radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.ys-ec-notice-info {
    background: var(--ys-ec-primary-bg);
    color: var(--ys-ec-primary-dark);
    border: 1px solid color-mix(in srgb, var(--ys-ec-account-primary) 30%, transparent);
}

/* ─── 購物金頁面 ─── */

.ys-ec-credit-page h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--ys-ec-text);
}

/* 統計卡片網格 */
.ys-ec-credit-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.ys-ec-credit-stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 16px;
    background: var(--ys-ec-card-bg);
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius-lg, 12px);
    transition: box-shadow var(--ys-ec-transition);
}

.ys-ec-credit-stat-card:hover {
    box-shadow: var(--ys-ec-shadow-hover, 0 4px 12px rgba(0, 0, 0, 0.08));
}

.ys-ec-credit-stat-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ys-ec-radius, 8px);
    flex-shrink: 0;
}

.ys-ec-credit-stat-icon .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
    color: inherit;
}

/* 各統計卡片配色 */
.ys-ec-credit-stat-balance .ys-ec-credit-stat-icon {
    background: var(--ys-ec-success-light);
    color: #3d6b4a;
}
.ys-ec-credit-stat-balance .ys-ec-credit-stat-value {
    color: #3d6b4a;
}

.ys-ec-credit-stat-expiring .ys-ec-credit-stat-icon {
    background: var(--ys-ec-warning-light);
    color: #7a6530;
}
.ys-ec-credit-stat-expiring .ys-ec-credit-stat-value {
    color: #7a6530;
}

.ys-ec-credit-stat-earned .ys-ec-credit-stat-icon {
    background: var(--ys-ec-primary-bg);
    color: var(--ys-ec-primary-dark);
}
.ys-ec-credit-stat-earned .ys-ec-credit-stat-value {
    color: var(--ys-ec-primary-dark);
}

.ys-ec-credit-stat-spent .ys-ec-credit-stat-icon {
    background: var(--ys-ec-danger-light);
    color: #8b4c4c;
}
.ys-ec-credit-stat-spent .ys-ec-credit-stat-value {
    color: #8b4c4c;
}

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

.ys-ec-credit-stat-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

.ys-ec-credit-stat-label {
    font-size: 12px;
    color: var(--ys-ec-text-muted);
    font-weight: 500;
}

/* 交易紀錄表格外層 */
.ys-ec-credit-history-table-wrap {
    overflow-x: auto;
}

/* 類型標籤（badge） */
.ys-ec-credit-type-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.ys-ec-credit-type-earn {
    background: var(--ys-ec-success-light);
    color: #3d6b4a;
}

.ys-ec-credit-type-birthday {
    background: #f5e8f0;
    color: #8b4c7a;
}

.ys-ec-credit-type-refund {
    background: var(--ys-ec-primary-bg);
    color: var(--ys-ec-primary-dark);
}

.ys-ec-credit-type-manual {
    background: var(--ys-ec-warning-light);
    color: #7a6530;
}

.ys-ec-credit-type-register {
    background: #e8f0f5;
    color: #4c6b8b;
}

.ys-ec-credit-type-spend {
    background: var(--ys-ec-danger-light);
    color: #8b4c4c;
}

.ys-ec-credit-type-expired,
.ys-ec-credit-type-expire_deduct {
    background: var(--ys-ec-body-bg);
    color: var(--ys-ec-text-muted);
}

.ys-ec-credit-type-campaign {
    background: #f0e8f5;
    color: #6b4c8b;
}

/* 分頁導覽 */
.ys-ec-credit-pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.ys-ec-credit-page-link,
.ys-ec-credit-page-current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--ys-ec-radius, 8px);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color var(--ys-ec-transition), border-color var(--ys-ec-transition), color var(--ys-ec-transition), box-shadow var(--ys-ec-transition);
}

.ys-ec-credit-page-link {
    color: var(--ys-ec-text);
    background: var(--ys-ec-body-bg);
    border: 1px solid var(--ys-ec-border-light);
}

.ys-ec-credit-page-link:hover {
    background: var(--ys-ec-primary-bg);
    border-color: var(--ys-ec-primary);
    color: var(--ys-ec-primary-dark);
}

.ys-ec-credit-page-current {
    background: var(--ys-ec-primary);
    color: #ffffff;
    border: 1px solid var(--ys-ec-primary);
    font-weight: 700;
}

/* ─── 購物金歷史表格 ─── */

.ys-ec-credit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

.ys-ec-credit-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--ys-ec-border-light);
    color: var(--ys-ec-text);
}

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

.ys-ec-credit-positive {
    color: var(--ys-ec-success);
    font-weight: 600;
}

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

/* ─── 響應式：平板以下 ─── */

@media (max-width: 768px) {
    .ys-ec-dashboard-layout {
        flex-direction: column;
    }

    .ys-ec-dashboard-sidebar {
        width: 100%;
    }

    .ys-ec-dashboard-nav ul {
        display: flex;
        overflow-x: auto;
        padding: 0;
        gap: 0;
        -webkit-overflow-scrolling: touch;
    }

    .ys-ec-dashboard-nav li {
        flex-shrink: 0;
    }

    .ys-ec-dashboard-nav li a {
        padding: 10px 14px;
        white-space: nowrap;
        font-size: 13px;
    }

    .ys-ec-dashboard-nav li.ys-ec-active a {
        border-left: none;
        border-bottom: 3px solid var(--ys-ec-primary);
    }

    .ys-ec-nav-divider {
        display: none;
    }

    .ys-ec-dashboard-user-card {
        padding: 12px 16px;
    }

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

    .ys-ec-form-row {
        flex-direction: column;
        gap: 0;
    }

    .ys-ec-form-half {
        flex: none;
        width: 100%;
    }

    .ys-ec-order-table {
        font-size: 13px;
    }

    .ys-ec-order-table th,
    .ys-ec-order-table td {
        padding: 8px;
    }

    .ys-ec-tier-card-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .ys-ec-tier-perks {
        flex-direction: column;
        gap: 8px;
    }

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

    .ys-ec-tier-card-item {
        padding: 20px 16px;
    }

    .ys-ec-auth-form {
        padding: 24px 16px;
    }

    /* 購物金統計卡片響應式 */
    .ys-ec-credit-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

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

    .ys-ec-credit-stat-value {
        font-size: 18px;
    }

    /* 交易紀錄行動版 */
    .ys-ec-credit-table thead {
        display: none;
    }

    .ys-ec-credit-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        padding: 12px 0;
        border-bottom: 1px solid var(--ys-ec-border-light);
        gap: 4px 12px;
    }

    .ys-ec-credit-table tbody td {
        border: none;
        padding: 2px 0;
        font-size: 13px;
    }

    .ys-ec-credit-table tbody td::before {
        content: attr(data-label) "\FF1A";
        font-size: 11px;
        color: var(--ys-ec-text-muted);
        margin-right: 4px;
    }

    .ys-ec-credit-table tbody td:nth-child(1) {
        width: 100%;
        font-size: 12px;
        color: var(--ys-ec-text-muted);
    }
}

/* ─── 響應式：小手機 ─── */

@media (max-width: 900px) {
    .ys-ec-dashboard-auth-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .ys-ec-auth-wrapper {
        padding: 20px 12px;
    }

    .ys-ec-dashboard-auth {
        padding: 24px 12px;
    }

    .ys-ec-dashboard-auth-header {
        margin-bottom: 20px;
    }

    .ys-ec-dashboard-auth-header h2 {
        font-size: 22px;
    }

    .ys-ec-dashboard-wrapper {
        padding: 16px 12px;
    }

    .ys-ec-dashboard-content {
        padding: 12px;
        border: none;
        border-radius: 0;
        box-shadow: none;
        width: 100%;
        box-sizing: border-box;
    }

    /* 帳號頁標題字體縮小 */
    .ys-ec-dashboard-content h2 {
        font-size: 18px;
    }
    .ys-ec-dashboard-content h3 {
        font-size: 15px;
    }

    /* 導航改為下拉選單式（更緊湊） */
    .ys-ec-dashboard-nav ul {
        gap: 2px;
        padding: 4px 0;
        scrollbar-width: none;
    }
    .ys-ec-dashboard-nav ul::-webkit-scrollbar {
        display: none;
    }
    .ys-ec-dashboard-nav li a {
        padding: 8px 12px;
        font-size: 12px;
        gap: 4px;
    }
    .ys-ec-dashboard-nav .dashicons {
        font-size: 14px; width: 14px; height: 14px;
    }

    /* 訂單表格全寬 */
    .ys-ec-order-table {
        display: block; width: 100%; overflow-x: auto;
    }

    /* 確保內容區全寬 */
    .ys-ec-dashboard-wrapper {
        padding: 8px 0;
    }
    .ys-ec-dashboard-layout {
        gap: 0;
    }
    .ys-ec-dashboard-sidebar {
        border: none; border-radius: 0; box-shadow: none;
    }

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

/* ════════════════════════════════════════════════
   前端表格樣式 (.ys-ec-table in dashboard)
   ════════════════════════════════════════════════ */
.ys-ec-dashboard-wrapper .ys-ec-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--ys-ec-border);
    border-radius: var(--ys-ec-radius);
    overflow: hidden;
    font-size: 14px;
}

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

.ys-ec-dashboard-wrapper .ys-ec-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--ys-ec-border-light);
    color: var(--ys-ec-text);
    vertical-align: middle;
}

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

.ys-ec-dashboard-wrapper .ys-ec-table tbody tr:hover {
    background: color-mix(in srgb, var(--ys-ec-account-primary) 4%, transparent);
}

/* 狀態 badge 顏色 */
.ys-ec-status-pending  { background: var(--ys-ec-warning-light, #f5efe4); color: var(--ys-ec-warning-text, #7a6530); }
.ys-ec-status-paid     { background: var(--ys-ec-success-light, #e6f2ea); color: var(--ys-ec-success-text, #3d6b4a); }
.ys-ec-status-processing { background: var(--ys-ec-primary-bg); color: var(--ys-ec-primary-dark); }
.ys-ec-status-shipped  { background: var(--ys-ec-primary-bg); color: var(--ys-ec-primary-dark); }
.ys-ec-status-completed { background: var(--ys-ec-success-light, #e6f2ea); color: var(--ys-ec-success-text, #3d6b4a); }
.ys-ec-status-cancelled { background: var(--ys-ec-danger-light, #f5e6e6); color: var(--ys-ec-danger-text, #8b4c4c); }
.ys-ec-status-refunded { background: var(--ys-ec-danger-light, #f5e6e6); color: var(--ys-ec-danger-text, #8b4c4c); }
.ys-ec-status-failed   { background: var(--ys-ec-danger-light, #f5e6e6); color: var(--ys-ec-danger-text, #8b4c4c); }

/* 前端按鈕對比度 */
.ys-ec-dashboard-wrapper .ys-ec-btn-primary {
    background: var(--ys-ec-primary-dark);
    color: #fff;
    text-decoration: none;
}

.ys-ec-dashboard-wrapper .ys-ec-btn-primary:hover {
    background: color-mix(in srgb, var(--ys-ec-primary-dark, #6b8a9a) 82%, #000);
    color: #fff;
}

.ys-ec-dashboard-wrapper .ys-ec-btn-outline {
    background: transparent;
    color: var(--ys-ec-primary-dark);
    border: 1.5px solid var(--ys-ec-primary);
    text-decoration: none;
}

.ys-ec-dashboard-wrapper .ys-ec-btn-outline:hover {
    background: var(--ys-ec-primary-dark);
    color: #fff;
}

.ys-ec-dashboard-wrapper .ys-ec-btn-sm {
    min-height: 32px;
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 6px;
}

/* 訂單表格 RWD */
@media (max-width: 768px) {
    .ys-ec-dashboard-wrapper .ys-ec-table thead { display: none; }
    .ys-ec-dashboard-wrapper .ys-ec-table tbody tr {
        display: block;
        margin-bottom: 16px;
        border: 1px solid var(--ys-ec-border-light);
        border-radius: var(--ys-ec-radius);
        overflow: hidden;
    }
    .ys-ec-dashboard-wrapper .ys-ec-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 16px;
        border-bottom: 1px solid var(--ys-ec-border-light);
    }
    .ys-ec-dashboard-wrapper .ys-ec-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 12px;
        color: var(--ys-ec-text-muted);
        text-transform: uppercase;
    }
}

/* ═══════════════════════════════════════════
   優惠券卡片 — 票券風格
   用於會員中心「我的優惠券」及前台「領券中心」
   ═══════════════════════════════════════════ */

/* 優惠券分頁切換 */
.ys-ec-coupon-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--ys-ec-border-light);
    margin-bottom: 24px;
}

.ys-ec-coupon-tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ys-ec-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.ys-ec-coupon-tab:hover {
    color: var(--ys-ec-text);
}

.ys-ec-coupon-tab.active {
    color: var(--ys-ec-primary-dark);
    border-bottom-color: var(--ys-ec-primary);
}

.ys-ec-coupon-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--ys-ec-primary);
    border-radius: 10px;
    margin-left: 6px;
}

/* 優惠券卡片網格 */
.ys-ec-coupon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* 票券風格卡片 */
.ys-ec-coupon-card {
    display: flex;
    background: var(--ys-ec-card-bg);
    border: 1.5px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius-lg, 12px);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.ys-ec-coupon-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

/* 左側折扣值區域 — 票券虛線分隔 */
.ys-ec-coupon-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    padding: 20px 16px;
    background: var(--ys-ec-primary);
    color: #fff;
    position: relative;
}

/* 票券鋸齒效果 — 右側虛線 */
.ys-ec-coupon-left::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 10px;
    bottom: 10px;
    width: 0;
    border-right: 2px dashed var(--ys-ec-card-bg, #fff);
}

.ys-ec-coupon-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.ys-ec-coupon-type-label {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.85;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 右側資訊區域 */
.ys-ec-coupon-right {
    flex: 1;
    min-width: 0;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ys-ec-coupon-desc {
    font-size: 15px;
    font-weight: 700;
    color: var(--ys-ec-text);
    line-height: 1.3;
    margin-bottom: 2px;
}

.ys-ec-coupon-code-display code {
    box-sizing: border-box;
    display: inline-block;
    max-width: 100%;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--ys-ec-primary-dark);
    background: color-mix(in srgb, var(--ys-ec-account-primary) 10%, transparent);
    border-radius: 4px;
    font-family: 'SF Mono', 'Consolas', monospace;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.ys-ec-coupon-condition {
    font-size: 12px;
    color: var(--ys-ec-text-muted);
}

.ys-ec-coupon-expire {
    font-size: 12px;
    color: var(--ys-ec-text-muted);
}

.ys-ec-coupon-remaining {
    font-size: 12px;
    color: var(--ys-ec-warning, #e6a23c);
    font-weight: 600;
}

/* 狀態標章 */
.ys-ec-coupon-status-badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    margin-top: 4px;
    width: fit-content;
}

.ys-ec-coupon-status--used {
    background: var(--ys-ec-border-light);
    color: var(--ys-ec-text-muted);
}

.ys-ec-coupon-status--expired {
    background: rgba(220, 53, 69, 0.1);
    color: var(--ys-ec-danger, #dc3545);
}

/* 停用狀態 */
.ys-ec-coupon-card--disabled {
    opacity: 0.55;
    filter: grayscale(0.3);
}

.ys-ec-coupon-card--disabled:hover {
    transform: none;
    box-shadow: none;
}

.ys-ec-coupon-card--disabled .ys-ec-coupon-left {
    background: var(--ys-ec-text-muted, #9ca3af);
}

/* 已領取狀態 */
.ys-ec-coupon-card--claimed {
    opacity: 0.7;
}

.ys-ec-coupon-card--claimed .ys-ec-coupon-left {
    background: var(--ys-ec-success, #27ae60);
}

/* ═══ 領券中心頁面 ═══ */

.ys-ec-coupon-center {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.ys-ec-coupon-center-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--ys-ec-border-light);
}

.ys-ec-coupon-center-header h2 {
    font-size: 26px;
    font-weight: 800;
    color: var(--ys-ec-text);
    margin: 0 0 8px;
}

.ys-ec-coupon-center-header h2 .dashicons {
    font-size: 28px;
    vertical-align: middle;
    margin-right: 8px;
    color: var(--ys-ec-primary);
}

.ys-ec-coupon-center-subtitle {
    font-size: 15px;
    color: var(--ys-ec-text-muted);
    margin: 0 0 16px;
}

/* 領券中心 — 輸碼區 */
.ys-ec-coupon-code-input-section {
    max-width: 480px;
    margin: 0 auto 32px;
}

.ys-ec-coupon-code-input-wrap {
    display: flex;
    gap: 8px;
}

.ys-ec-coupon-code-input-wrap input {
    flex: 1;
    padding: 10px 14px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: 1.5px solid var(--ys-ec-border);
    border-radius: var(--ys-ec-radius);
    background: var(--ys-ec-card-bg);
    color: var(--ys-ec-text);
    transition: border-color 0.2s;
}

.ys-ec-coupon-code-input-wrap input:focus {
    outline: none;
    border-color: var(--ys-ec-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ys-ec-account-primary) 20%, transparent);
}

.ys-ec-coupon-code-input-wrap input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ys-ec-coupon-code-msg {
    margin-top: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--ys-ec-radius);
}

.ys-ec-coupon-code-msg--success {
    background: rgba(39, 174, 96, 0.1);
    color: var(--ys-ec-success, #27ae60);
}

.ys-ec-coupon-code-msg--error {
    background: rgba(220, 53, 69, 0.1);
    color: var(--ys-ec-danger, #dc3545);
}

.ys-ec-coupon-code-msg--status {
    background: color-mix(in srgb, var(--ys-ec-account-primary) 12%, transparent);
    color: var(--ys-ec-primary-dark);
}

/* 領券中心 — 卡片網格 */
.ys-ec-coupon-center-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
}

/* 領券中心卡片 — 加大、含按鈕 */
.ys-ec-coupon-card--center .ys-ec-coupon-right {
    padding: 20px 24px;
}

.ys-ec-coupon-action {
    margin-top: 8px;
}

.ys-ec-coupon-hint {
    font-size: 12px;
    color: var(--ys-ec-text-muted);
    font-style: italic;
}

/* 停用按鈕 */
.ys-ec-btn-disabled,
.ys-ec-btn-disabled:hover,
.ys-ec-coupon-center .ys-ec-btn:disabled,
.ys-ec-coupon-center .ys-ec-btn[aria-busy="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* ═══ 響應式設計 ═══ */

@media (max-width: 640px) {
    .ys-ec-coupon-code-input-wrap input {
        min-height: 44px;
        font-size: 16px;
    }

    .ys-ec-coupon-center .ys-ec-btn {
        min-height: 44px;
    }

    .ys-ec-coupon-grid,
    .ys-ec-coupon-center-grid {
        grid-template-columns: 1fr;
    }

    .ys-ec-coupon-left {
        min-width: 80px;
        padding: 16px 12px;
    }

    .ys-ec-coupon-value {
        font-size: 22px;
    }

    .ys-ec-coupon-right {
        padding: 12px 14px;
    }

    .ys-ec-coupon-desc {
        font-size: 14px;
    }

    .ys-ec-coupon-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .ys-ec-coupon-tab {
        padding: 8px 14px;
        font-size: 13px;
        white-space: nowrap;
    }

    .ys-ec-coupon-center-header h2 {
        font-size: 22px;
    }

    .ys-ec-coupon-code-input-wrap {
        flex-direction: column;
    }

    .ys-ec-coupon-code-input-wrap .ys-ec-btn {
        width: 100%;
    }
}

/* ─── 通知中心 ─── */

.ys-ec-notifications-page .ys-ec-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 22px;
    font-weight: 700;
    color: var(--ys-ec-text);
    margin: 0 0 8px;
}

.ys-ec-notifications-page .ys-ec-section-title .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
}

.ys-ec-notifications-page .ys-ec-section-desc {
    font-size: 14px;
    color: var(--ys-ec-text-secondary, #64748b);
    margin: 0 0 20px;
}

/* 篩選按鈕列 */
.ys-ec-notif-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ys-ec-notif-filter {
    padding: 6px 16px;
    border: 1px solid var(--ys-ec-border-light, #e2e8f0);
    border-radius: 20px;
    background: var(--ys-ec-card-bg, #fff);
    color: var(--ys-ec-text-secondary, #64748b);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.ys-ec-notif-filter:hover {
    border-color: var(--ys-ec-primary, #8b7355);
    color: var(--ys-ec-primary, #8b7355);
}

.ys-ec-notif-filter.active {
    background: var(--ys-ec-primary, #8b7355);
    border-color: var(--ys-ec-primary, #8b7355);
    color: #fff;
}

/* 通知列表 */
.ys-ec-notification-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ys-ec-notification-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--ys-ec-border-light, #f1f5f9);
    transition: background 0.15s ease;
}

.ys-ec-notification-item:last-child {
    border-bottom: none;
}

.ys-ec-notification-item:hover {
    background: var(--ys-ec-bg-hover, rgba(0, 0, 0, 0.02));
    border-radius: 8px;
    padding-left: 12px;
    padding-right: 12px;
    margin-left: -12px;
    margin-right: -12px;
}

/* 圖示圓 */
.ys-ec-notif-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.ys-ec-notif-icon .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* 內容區 */
.ys-ec-notif-content {
    flex: 1;
    min-width: 0;
}

.ys-ec-notif-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ys-ec-text, #1e293b);
    line-height: 1.4;
}

.ys-ec-notif-detail {
    font-size: 13px;
    color: var(--ys-ec-text-secondary, #64748b);
    margin-top: 2px;
    line-height: 1.4;
}

.ys-ec-notif-time {
    font-size: 12px;
    color: var(--ys-ec-text-muted, #94a3b8);
    margin-top: 4px;
}

/* 到期預警特殊樣式 */
.ys-ec-notification-item[data-category="warning"] {
    background: #fef2f2;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    border-bottom: none;
}

.ys-ec-notification-item[data-category="warning"]:hover {
    background: #fee2e2;
}

.ys-ec-notification-item[data-category="warning"] .ys-ec-notif-title {
    color: #991b1b;
}

.ys-ec-notification-item[data-category="warning"] .ys-ec-notif-detail {
    color: #b91c1c;
}

/* 空狀態 */
.ys-ec-notifications-page .ys-ec-empty-state {
    text-align: center;
    padding: 60px 20px;
}

.ys-ec-notifications-page .ys-ec-empty-state h3 {
    font-size: 18px;
    color: var(--ys-ec-text, #1e293b);
    margin: 16px 0 8px;
}

.ys-ec-notifications-page .ys-ec-empty-state p {
    font-size: 14px;
    color: var(--ys-ec-text-secondary, #64748b);
}

/* 響應式 */
@media (max-width: 640px) {
    .ys-ec-notification-item {
        gap: 10px;
        padding: 12px 0;
    }

    .ys-ec-notif-icon {
        width: 32px;
        height: 32px;
    }

    .ys-ec-notif-icon .dashicons {
        font-size: 16px;
        width: 16px;
        height: 16px;
    }

    .ys-ec-notif-title {
        font-size: 13px;
    }

    .ys-ec-notif-detail {
        font-size: 12px;
    }

    .ys-ec-notif-filters {
        gap: 6px;
    }

    .ys-ec-notif-filter {
        padding: 5px 12px;
        font-size: 12px;
    }
}
.ys-ec-social-login {
    margin: 18px 0 22px;
}

.ys-ec-social-login__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    color: #64748b;
    font-size: 13px;
}

.ys-ec-social-login__divider::before,
.ys-ec-social-login__divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.ys-ec-social-login__buttons,
.ys-ec-social-account-list {
    display: grid;
    gap: 12px;
}

.ys-ec-social-login__button,
.ys-ec-social-account-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #dbe4ee;
    border-radius: 8px;
    background: #fff;
    color: #172033;
    text-decoration: none;
}

.ys-ec-social-login__button {
    justify-content: center;
    font-weight: 700;
}

.ys-ec-social-login__button:hover,
.ys-ec-social-account-card:hover {
    border-color: #94a3b8;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.ys-ec-social-login__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #e8f1ff;
    color: #2563eb;
    font-size: 12px;
}

.ys-ec-social-login__button--line .ys-ec-social-login__icon {
    background: #e9fbe9;
    color: #06c755;
}

.ys-ec-social-account-card p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 13px;
}

.ys-ec-social-account-card__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 640px) {
    .ys-ec-social-account-card {
        align-items: stretch;
        flex-direction: column;
    }

    .ys-ec-social-account-card__actions .ys-ec-btn {
        width: 100%;
        justify-content: center;
    }
}

/* v2.43.5 account visual refinement: single SaaS surface aliases. */
.ys-ec-account-shell,
.ys-ec-dashboard-wrapper {
    --ys-ec-account-max: 1120px;
    --ys-ec-account-surface-radius: 12px;
    --ys-ec-account-surface-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    max-width: var(--ys-ec-account-max);
    padding: 28px 16px;
    letter-spacing: 0;
}

.ys-ec-dashboard-layout {
    display: grid;
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.ys-ec-account-sidebar,
.ys-ec-dashboard-sidebar {
    width: auto;
    background: var(--ys-ec-card-bg, #fff);
    border: 1px solid var(--ys-ec-border-light, #e5eaef);
    border-radius: var(--ys-ec-account-surface-radius);
    box-shadow: var(--ys-ec-account-surface-shadow);
    overflow: hidden;
}

.ys-ec-dashboard-user-card {
    padding: 18px 16px;
}

.ys-ec-dashboard-nav ul {
    padding: 8px;
}

.ys-ec-dashboard-nav li a {
    min-height: 38px;
    border-radius: 8px;
    border-left: 0;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.ys-ec-dashboard-nav li.ys-ec-active a {
    border-left: 0;
    box-shadow: inset 3px 0 0 var(--ys-ec-primary, #7a9bae);
}

.ys-ec-nav-divider {
    margin: 6px 8px;
}

.ys-ec-account-surface,
.ys-ec-dashboard-content {
    width: 100%;
    background: var(--ys-ec-card-bg, #fff);
    border: 1px solid var(--ys-ec-border-light, #e5eaef);
    border-radius: var(--ys-ec-account-surface-radius);
    box-shadow: var(--ys-ec-account-surface-shadow);
    padding: 24px;
    box-sizing: border-box;
}

.ys-ec-dashboard-content > .ys-ec-ty,
.ys-ec-dashboard-content > .ys-ec-orders-tab,
.ys-ec-dashboard-content > .ys-ec-account-section,
.ys-ec-dashboard-content > .ys-ec-credit-page { /* v2.56.0：修拼錯（原 credits-page 為 dead selector，DOM 實際是單數） */
    display: grid;
    gap: 20px;
}

.ys-ec-dashboard-content .ys-ec-ty-section,
.ys-ec-dashboard-content .ys-ec-account-section {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 0;
}

.ys-ec-dashboard-content .ys-ec-ty-section + .ys-ec-ty-section {
    border-top: 1px solid var(--ys-ec-border-light, #e5eaef);
    padding-top: 20px;
}

.ys-ec-dashboard-content .ys-ec-ty-section__header,
.ys-ec-dashboard-content .ys-ec-account-section__head {
    align-items: flex-start;
    border-bottom: 1px solid var(--ys-ec-border-light, #e5eaef);
    gap: 12px;
    margin: 0 0 16px;
    padding-bottom: 12px;
}

.ys-ec-dashboard-content .ys-ec-account-section__head h3,
.ys-ec-dashboard-content .ys-ec-account-section__head p {
    margin: 0;
}

.ys-ec-dashboard-content .ys-ec-account-section__head h3 {
    color: var(--ys-ec-text, #2d3a45);
    font-size: 18px;
    font-weight: 700;
}

.ys-ec-dashboard-content .ys-ec-account-section__head p {
    color: var(--ys-ec-text-muted, #6e7f8d);
    font-size: 14px;
}

.ys-ec-dashboard-content .ys-ec-fieldset {
    background: transparent;
    border: 0;
    border-radius: 0;
    margin: 0;
    padding: 0;
}

.ys-ec-dashboard-content .ys-ec-form {
    display: grid;
    gap: 20px;
}

.ys-ec-dashboard-content .ys-ec-form-group {
    max-width: min(520px, 100%);
}

.ys-ec-dashboard-content .ys-ec-form-row {
    flex-wrap: wrap;
    gap: 16px;
}

.ys-ec-dashboard-content .ys-ec-form-row .ys-ec-form-group {
    flex: 1 1 240px;
    max-width: none;
}

.ys-ec-dashboard-content .ys-ec-form-group--compact {
    flex: 0 1 120px;
    max-width: 140px;
}

.ys-ec-dashboard-content .ys-ec-form-group--fill {
    flex: 1 1 220px;
    max-width: none;
}

.ys-ec-dashboard-content .ys-ec-form-group input[type="text"],
.ys-ec-dashboard-content .ys-ec-form-group input[type="email"],
.ys-ec-dashboard-content .ys-ec-form-group input[type="password"],
.ys-ec-dashboard-content .ys-ec-form-group input[type="tel"],
.ys-ec-dashboard-content .ys-ec-form-group input[type="date"],
.ys-ec-dashboard-content .ys-ec-form-group input[type="number"],
.ys-ec-dashboard-content .ys-ec-form-group select {
    min-height: 44px;
}

.ys-ec-dashboard-content .ys-ec-form-group textarea {
    max-width: min(720px, 100%);
}

.ys-ec-dashboard-content .ys-ec-form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 0;
}

.ys-ec-inline-form {
    display: inline-flex;
}

.ys-ec-inline-form + .ys-ec-inline-form {
    margin-left: 6px;
}

.ys-ec-account-return-link {
    margin-bottom: 16px;
}

.ys-ec-account-empty-action {
    margin-top: 12px;
}

.ys-ec-account-inline-gap {
    margin-left: 4px;
}

.ys-ec-orders-table-wrap td:last-child,
.ys-ec-invoice-table-wrap td:last-child {
    min-width: 180px;
}

.ys-ec-orders-table-wrap td:last-child {
    white-space: normal;
}

.ys-ec-orders-table-wrap td:last-child .ys-ec-btn {
    margin: 0;
    vertical-align: middle;
}

.ys-ec-orders-table-wrap td:last-child .ys-ec-account-inline-gap {
    margin-left: 0;
}

.ys-ec-orders-table-wrap .ys-ec-orders-payment {
    min-width: 8em;
    white-space: nowrap;
}

.ys-ec-dashboard-wrapper .ys-ec-orders-table-wrap .ys-ec-account-actions {
    gap: 6px 8px;
}

.ys-ec-account-repay-notice {
    background: var(--ys-ec-info-bg, #edf3f7);
    border: 1px solid var(--ys-ec-account-line, #d8dee4);
    border-radius: var(--ys-ec-account-radius-sm, 8px);
    color: var(--ys-ec-account-body, #4c505b);
    display: grid;
    font-size: 13px;
    gap: 6px;
    line-height: 1.6;
    margin: 0 0 16px;
    overflow-wrap: anywhere;
    padding: 12px 16px;
}

.ys-ec-account-repay-notice p {
    margin: 0;
}

.ys-ec-dashboard-wrapper .ys-ec-orders-payment-state td {
    padding-top: 0;
}

.ys-ec-orders-payment-state .ys-ec-account-repay-notice {
    margin-bottom: 0;
}

.ys-ec-orders-table-wrap,
.ys-ec-credit-history-table-wrap,
.ys-ec-credit-table-wrap {
    overflow-x: auto;
    width: 100%;
}

.ys-ec-dashboard-wrapper .ys-ec-table {
    box-shadow: none;
    min-width: 640px;
}

.ys-ec-pagination,
.ys-ec-credit-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}

.ys-ec-page-link,
.ys-ec-pagination .ys-ec-btn,
.ys-ec-credit-pagination .ys-ec-btn {
    min-width: 36px;
}

.ys-ec-account-tabs-scroll,
.ys-ec-coupon-tabs {
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.ys-ec-coupon-tabs {
    background: var(--ys-ec-body-bg, #f6f8fa);
    border: 1px solid var(--ys-ec-border-light, #e5eaef);
    border-radius: 10px;
    gap: 4px;
    margin-bottom: 20px;
    padding: 4px;
}

.ys-ec-coupon-tab {
    border-bottom: 0;
    border-radius: 8px;
    flex: 0 0 auto;
    margin-bottom: 0;
    min-height: 38px;
    white-space: nowrap;
}

.ys-ec-coupon-tab.active {
    background: var(--ys-ec-card-bg, #fff);
    border-bottom-color: transparent;
    box-shadow: inset 0 0 0 1px var(--ys-ec-border-light, #e5eaef);
}

.ys-ec-dashboard-content .ys-ec-address-card,
.ys-ec-dashboard-content .ys-ec-coupon-card,
.ys-ec-dashboard-content .ys-ec-payment-card,
.ys-ec-dashboard-content .ys-ec-subscription-card,
.ys-ec-dashboard-content .ys-ec-tier-list-row,
.ys-ec-dashboard-content .ys-ec-social-account-card,
.ys-ec-dashboard-content .ys-ec-credit-stat-card {
    border-color: var(--ys-ec-border-light, #e5eaef);
    border-radius: 10px;
    box-shadow: none;
}

.ys-ec-dashboard-content .ys-ec-payment-card--default {
    border-color: var(--ys-ec-success, #6ea383);
}

.ys-ec-dashboard-content .ys-ec-address-card:hover,
.ys-ec-dashboard-content .ys-ec-coupon-card:hover,
.ys-ec-dashboard-content .ys-ec-payment-card:hover,
.ys-ec-dashboard-content .ys-ec-subscription-card:hover,
.ys-ec-dashboard-content .ys-ec-social-account-card:hover {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    transform: none;
}

.ys-ec-dashboard-content .ys-ec-subscription-card,
.ys-ec-dashboard-content .ys-ec-tier-list-row {
    background: var(--ys-ec-card-bg, #fff);
    border: 1px solid var(--ys-ec-border-light, #e5eaef);
    margin: 0 0 12px;
    padding: 16px;
}

.ys-ec-dashboard-content .ys-ec-tier-list-row {
    border-left: 4px solid var(--tier-color, var(--ys-ec-border, #d4dbe2));
}

.ys-ec-ty-dl__row--full {
    grid-column: 1 / -1;
}

.ys-ec-dashboard-content .ys-ec-social-account-card {
    background: var(--ys-ec-card-bg, #fff);
    color: var(--ys-ec-text, #2d3a45);
}

.ys-ec-dashboard-content .ys-ec-social-account-card p {
    color: var(--ys-ec-text-muted, #6e7f8d);
}

.ys-ec-dashboard-content .ys-ec-section-title,
.ys-ec-dashboard-content .ys-ec-subsection-title {
    margin: 0;
}

.ys-ec-dashboard-content .ys-ec-credit-stats {
    margin-bottom: 0;
}

.ys-ec-dashboard-wrapper a:focus-visible,
.ys-ec-dashboard-wrapper button:focus-visible,
.ys-ec-dashboard-wrapper input:focus-visible,
.ys-ec-dashboard-wrapper select:focus-visible,
.ys-ec-dashboard-wrapper textarea:focus-visible {
    outline: 2px solid var(--ys-ec-primary, #7a9bae);
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .ys-ec-account-shell,
    .ys-ec-dashboard-wrapper {
        padding: 16px 12px;
    }

    .ys-ec-dashboard-layout {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .ys-ec-account-sidebar,
    .ys-ec-dashboard-sidebar {
        width: 100%;
    }

    .ys-ec-dashboard-nav ul {
        display: flex;
        gap: 4px;
        overflow-x: auto;
        padding: 6px;
        scrollbar-width: none;
    }

    .ys-ec-dashboard-nav ul::-webkit-scrollbar,
    .ys-ec-account-tabs-scroll::-webkit-scrollbar {
        display: none;
    }

    .ys-ec-dashboard-nav li {
        flex: 0 0 auto;
    }

    .ys-ec-dashboard-nav li a {
        border-left: 0;
        font-size: 13px;
        padding: 8px 12px;
        white-space: nowrap;
    }

    .ys-ec-dashboard-nav li.ys-ec-active a {
        border-bottom: 0;
        box-shadow: inset 0 -2px 0 var(--ys-ec-primary, #7a9bae);
    }

    .ys-ec-account-surface,
    .ys-ec-dashboard-content {
        border: 1px solid var(--ys-ec-border-light, #e5eaef);
        border-radius: var(--ys-ec-account-surface-radius);
        box-shadow: var(--ys-ec-account-surface-shadow);
        padding: 18px 14px;
    }

    .ys-ec-dashboard-content .ys-ec-form-row {
        flex-direction: column;
        gap: 0;
    }

    .ys-ec-dashboard-content .ys-ec-form-row .ys-ec-form-group,
    .ys-ec-dashboard-content .ys-ec-form-group--compact,
    .ys-ec-dashboard-content .ys-ec-form-group--fill {
        flex: none;
        max-width: min(520px, 100%);
        width: 100%;
    }

    .ys-ec-dashboard-wrapper .ys-ec-table {
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .ys-ec-account-shell,
    .ys-ec-dashboard-wrapper {
        padding: 12px;
    }

    .ys-ec-account-surface,
    .ys-ec-dashboard-content {
        padding: 16px 12px;
    }

    .ys-ec-inline-form {
        display: flex;
        width: 100%;
    }

    .ys-ec-inline-form + .ys-ec-inline-form {
        margin: 6px 0 0;
    }

    .ys-ec-inline-form .ys-ec-btn {
        width: 100%;
    }

    .ys-ec-account-inline-gap {
        margin-left: 0;
        margin-top: 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ys-ec-dashboard-wrapper *,
    .ys-ec-dashboard-wrapper *::before,
    .ys-ec-dashboard-wrapper *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* v2.43.5 visual refinement: match the admin single-surface rhythm without
 * changing public account route, form, nonce, or data attributes. */
@media (max-width: 1024px) {
    .ys-ec-dashboard-nav ul {
        gap: 4px;
        scrollbar-width: thin;
    }
}

@media (max-width: 782px) {
    .ys-ec-dashboard-wrapper {
        max-width: none;
        padding: 16px 12px;
    }

    /* v2.56.0：移除舊「白名單容器 mobile padding:18」——content 自身已有 mobile padding，
       疊加造成 ty 頁雙重內縮（36px）且 add-on 容器不在名單、寬度不一致。
       統一由 .ys-ec-dashboard-content 的 mobile padding 提供內縮（檔尾通用合約歸零容器 padding）。 */

    .ys-ec-dashboard-nav ul {
        -webkit-overflow-scrolling: touch;
    }
}

/* v2.43.5 final account aliases: keep content as the only primary panel. */
.ys-ec-dashboard-content > .ys-ec-ty,
.ys-ec-dashboard-content > .ys-ec-orders-tab,
.ys-ec-dashboard-content > .ys-ec-account-section,
.ys-ec-dashboard-content > .ys-ec-credit-page, /* v2.56.0：修拼錯（原 credits-page） */
.ys-ec-dashboard-content > form.ys-ec-form {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.ys-ec-dashboard-content :where(.ys-ec-ty-section__header, .ys-ec-account-section__head) {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.ys-ec-dashboard-content :where(.ys-ec-ty-section__title) {
    color: var(--ys-ec-text, #2d3a45);
    flex: 1 1 auto;
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.ys-ec-dashboard-content :where(.ys-ec-ty-section__badge) {
    align-items: center;
    background: var(--ys-ec-primary-bg, #edf3f7);
    border-radius: 999px;
    color: var(--ys-ec-primary-dark, #5a7d91);
    display: inline-flex;
    font-size: 12px;
    font-weight: 600;
    gap: 4px;
    padding: 3px 10px;
}

.ys-ec-dashboard-content :where(.ys-ec-ty-dl) {
    display: grid;
    gap: 10px 16px;
    grid-template-columns: minmax(120px, max-content) 1fr;
    margin: 0;
}

.ys-ec-dashboard-content :where(.ys-ec-ty-dl dt) {
    color: var(--ys-ec-text-muted, #6e7f8d);
    font-size: 13px;
    font-weight: 600;
    margin: 0;
}

.ys-ec-dashboard-content :where(.ys-ec-ty-dl dd) {
    margin: 0;
    min-width: 0;
}

@media (max-width: 640px) {
    .ys-ec-dashboard-content :where(.ys-ec-ty-dl) {
        grid-template-columns: 1fr;
    }
}

/* v2.43.7 account/admin visual parity.
 * Keep the customer account surface on ys-ec-* classes, but align the color,
 * spacing, table, and button rhythm with the admin SaaS shell. */
.ys-ec-account-shell,
.ys-ec-dashboard-wrapper {
    --ys-ec-account-max: 1120px;
    --ys-ec-account-content-max: 860px;
    --ys-ec-account-bg: #f8f9fb;
    --ys-ec-account-card: #ffffff;
    --ys-ec-account-line: #edf0f6;
    --ys-ec-account-line-strong: #dfe5ef;
    --ys-ec-account-text: #09090a;
    --ys-ec-account-heading: var(--ys-ec-account-text);
    --ys-ec-account-body: #4c505b;
    --ys-ec-account-muted: #64748b;
    /* 會員中心主色單向沿用商店前台色票（fe_*→:root 的 --ys-ec-primary*）；
       保留原本的藍色僅作為 :root 未設定時的 fallback，不再自立品牌色。 */
    --ys-ec-account-primary: var(--ys-ec-primary, #1f5dcf);
    --ys-ec-account-primary-hover: var(--ys-ec-primary-dark, #174fc7);
    --ys-ec-account-primary-soft: var(--ys-ec-primary-bg, #eef5ff);
    --ys-ec-account-primary-tint: var(--ys-ec-primary-light, #dde9ff);
    --ys-ec-account-success: #13a86b;
    --ys-ec-account-success-soft: #e9f8f1;
    --ys-ec-account-warning: #b7791f;
    --ys-ec-account-warning-soft: #fff6df;
    --ys-ec-account-danger: #c13f3f;
    --ys-ec-account-danger-soft: #fff0f0;
    --ys-ec-account-radius: 12px;
    --ys-ec-account-radius-sm: 8px;
    --ys-ec-account-shadow: 0 10px 28px rgba(22, 34, 51, 0.055);
    /* 不再反向覆蓋商店品牌主色（--ys-ec-primary*）：account-primary 已單向沿用它，
       這裡若再回寫即造成 custom-property 循環，並會遮蔽 fe_* 品牌色。僅保留會員中心
       自有的內文與中性表面 token（單向定義，無循環）。 */
    --ys-ec-text: var(--ys-ec-account-text);
    --ys-ec-text-muted: var(--ys-ec-account-muted);
    --ys-ec-card-bg: var(--ys-ec-account-card);
    --ys-ec-border-light: var(--ys-ec-account-line);
    background: var(--ys-ec-account-bg);
    box-shadow: 0 0 0 100vmax var(--ys-ec-account-bg);
    clip-path: inset(0 -100vmax);
    color: var(--ys-ec-account-body);
    margin: 0 auto;
    max-width: none;
    padding: 32px 0;
    width: min(calc(100% - 48px), var(--ys-ec-account-max));
}

.ys-ec-dashboard-layout {
    gap: 24px;
    grid-template-columns: minmax(220px, 240px) minmax(0, 1fr);
}

.ys-ec-account-sidebar,
.ys-ec-dashboard-sidebar,
.ys-ec-account-surface,
.ys-ec-dashboard-content {
    background: var(--ys-ec-account-card);
    border: 1px solid var(--ys-ec-account-line);
    border-radius: var(--ys-ec-account-radius);
    box-shadow: var(--ys-ec-account-shadow);
}

.ys-ec-dashboard-content {
    color: var(--ys-ec-account-body);
    padding: 26px;
}

.ys-ec-dashboard-content > .ys-ec-orders-tab,
.ys-ec-dashboard-content > .ys-ec-order-detail,
.ys-ec-dashboard-content > .ys-ec-account-invoice-list {
    margin-left: 0;
    margin-right: auto;
    max-width: var(--ys-ec-account-content-max);
    width: 100%;
}

.ys-ec-dashboard-user-card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
    border-bottom: 1px solid var(--ys-ec-account-line);
    padding: 20px 18px;
}

.ys-ec-user-initial {
    background: var(--ys-ec-account-primary);
    box-shadow: 0 10px 22px color-mix(in srgb, var(--ys-ec-account-primary) 22%, transparent);
    color: #ffffff;
}

.ys-ec-user-info h3,
.ys-ec-dashboard-content h1,
.ys-ec-dashboard-content h2,
.ys-ec-dashboard-content h3,
.ys-ec-dashboard-content .ys-ec-ty-section__title,
.ys-ec-dashboard-content .ys-ec-account-section__head h3 {
    color: var(--ys-ec-account-text);
    letter-spacing: 0;
}

.ys-ec-dashboard-content p,
.ys-ec-dashboard-content .ys-ec-account-section__head p,
.ys-ec-dashboard-content .ys-ec-ty-dl dt {
    color: var(--ys-ec-account-muted);
}

.ys-ec-dashboard-nav ul {
    gap: 4px;
    padding: 10px;
}

.ys-ec-dashboard-nav li a {
    align-items: center;
    border-left: 0;
    border-radius: var(--ys-ec-account-radius-sm);
    color: var(--ys-ec-account-body);
    font-weight: 650;
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.ys-ec-dashboard-nav .dashicons {
    color: var(--ys-ec-account-muted);
}

.ys-ec-dashboard-nav li a:hover {
    background: var(--ys-ec-account-primary-soft);
    color: var(--ys-ec-account-primary);
    transform: translateX(1px);
}

.ys-ec-dashboard-nav li a:hover .dashicons {
    color: var(--ys-ec-account-primary);
}

.ys-ec-dashboard-nav li.ys-ec-active a {
    background: var(--ys-ec-account-primary);
    border-left: 0;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--ys-ec-account-primary) 18%, transparent);
    color: #ffffff;
}

.ys-ec-dashboard-nav li.ys-ec-active a .dashicons {
    color: #ffffff;
}

.ys-ec-nav-divider {
    border-color: var(--ys-ec-account-line);
    margin: 8px 10px;
}

.ys-ec-dashboard-content .ys-ec-ty-section + .ys-ec-ty-section,
.ys-ec-dashboard-content .ys-ec-ty-section__header,
.ys-ec-dashboard-content .ys-ec-account-section__head {
    border-color: var(--ys-ec-account-line);
}

.ys-ec-dashboard-content .ys-ec-form-group input[type="text"],
.ys-ec-dashboard-content .ys-ec-form-group input[type="email"],
.ys-ec-dashboard-content .ys-ec-form-group input[type="password"],
.ys-ec-dashboard-content .ys-ec-form-group input[type="tel"],
.ys-ec-dashboard-content .ys-ec-form-group input[type="date"],
.ys-ec-dashboard-content .ys-ec-form-group input[type="number"],
.ys-ec-dashboard-content .ys-ec-form-group select,
.ys-ec-dashboard-content .ys-ec-form-group textarea {
    background: #ffffff;
    border-color: var(--ys-ec-account-line-strong);
    border-radius: var(--ys-ec-account-radius-sm);
    color: var(--ys-ec-account-text);
}

.ys-ec-dashboard-content .ys-ec-form-group input:focus,
.ys-ec-dashboard-content .ys-ec-form-group select:focus,
.ys-ec-dashboard-content .ys-ec-form-group textarea:focus {
    border-color: var(--ys-ec-account-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ys-ec-account-primary) 16%, transparent);
}

.ys-ec-orders-table-wrap,
.ys-ec-credit-history-table-wrap,
.ys-ec-credit-table-wrap {
    border: 1px solid var(--ys-ec-account-line);
    border-radius: var(--ys-ec-account-radius);
    box-shadow: 0 8px 22px rgba(22, 34, 51, 0.035);
    overflow: auto;
}

.ys-ec-orders-table-wrap {
    background: #ffffff;
}

.ys-ec-dashboard-wrapper .ys-ec-table {
    background: #ffffff;
    border: 0;
    border-collapse: separate;
    border-spacing: 0;
    box-shadow: none;
    min-width: 720px;
    width: 100%;
}

.ys-ec-dashboard-wrapper .ys-ec-table thead th {
    background: #fbfcff;
    border-bottom: 1px solid var(--ys-ec-account-line);
    border-left: 0;
    border-right: 0;
    color: var(--ys-ec-account-muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    padding: 14px 16px;
    text-transform: none;
}

.ys-ec-dashboard-wrapper .ys-ec-table tbody td {
    border-bottom: 1px solid var(--ys-ec-account-line);
    border-left: 0;
    border-right: 0;
    color: var(--ys-ec-account-body);
    padding: 16px;
}

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

.ys-ec-dashboard-wrapper .ys-ec-table tbody tr:hover {
    background: #fbfcff;
}

.ys-ec-dashboard-wrapper .ys-ec-table a {
    color: var(--ys-ec-account-primary);
    font-weight: 700;
}

.ys-ec-dashboard-wrapper .ys-ec-btn,
.ys-ec-dashboard-wrapper .ys-ec-btn-sm,
.ys-ec-dashboard-wrapper a.ys-ec-btn,
.ys-ec-dashboard-wrapper button.ys-ec-btn {
    align-items: center;
    border-radius: var(--ys-ec-account-radius-sm);
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    letter-spacing: 0;
    min-height: 36px;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

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

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

.ys-ec-dashboard-wrapper .ys-ec-btn-outline {
    background: #ffffff;
    border-color: var(--ys-ec-account-line-strong);
    color: var(--ys-ec-account-body);
}

.ys-ec-dashboard-wrapper .ys-ec-btn-outline:hover {
    background: var(--ys-ec-account-primary-soft);
    border-color: var(--ys-ec-account-primary-tint);
    color: var(--ys-ec-account-primary);
}

.ys-ec-dashboard-wrapper .ys-ec-table a.ys-ec-btn-primary,
.ys-ec-dashboard-wrapper .ys-ec-table a.ys-ec-btn-primary:hover {
    color: #ffffff;
}

.ys-ec-dashboard-wrapper .ys-ec-table a.ys-ec-btn-outline {
    color: var(--ys-ec-account-body);
}

.ys-ec-dashboard-wrapper .ys-ec-table a.ys-ec-btn-outline:hover {
    color: var(--ys-ec-account-primary);
}

.ys-ec-dashboard-wrapper .ys-ec-btn.ys-ec-account-repay-link,
.ys-ec-dashboard-wrapper .ys-ec-btn.ys-ec-account-repay-link:hover,
.ys-ec-dashboard-wrapper .ys-ec-btn.ys-ec-account-repay-link:active {
    box-shadow: none;
}

.ys-ec-dashboard-wrapper .ys-ec-btn.ys-ec-account-repay-link:focus-visible {
    outline: 2px solid var(--ys-ec-account-primary);
    outline-offset: 3px;
}

.ys-ec-dashboard-wrapper :where(.ys-ec-status-badge, .ys-ec-badge, .ys-ec-ty-section__badge) {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    min-height: 26px;
    padding: 4px 10px;
}

.ys-ec-dashboard-wrapper :where(.ys-ec-status-processing, .ys-ec-status-pending, .ys-ec-badge-info, .ys-ec-ty-section__badge) {
    background: var(--ys-ec-account-primary-soft);
    color: var(--ys-ec-account-primary);
}

.ys-ec-dashboard-wrapper :where(.ys-ec-status-completed, .ys-ec-badge-success) {
    background: var(--ys-ec-account-success-soft);
    color: var(--ys-ec-account-success);
}

.ys-ec-dashboard-wrapper :where(.ys-ec-status-cancelled, .ys-ec-status-failed, .ys-ec-badge-danger) {
    background: var(--ys-ec-account-danger-soft);
    color: var(--ys-ec-account-danger);
}

.ys-ec-dashboard-wrapper :where(.ys-ec-status-on-hold, .ys-ec-badge-warning) {
    background: var(--ys-ec-account-warning-soft);
    color: var(--ys-ec-account-warning);
}

.ys-ec-dashboard-wrapper a:focus-visible,
.ys-ec-dashboard-wrapper button:focus-visible,
.ys-ec-dashboard-wrapper input:focus-visible,
.ys-ec-dashboard-wrapper select:focus-visible,
.ys-ec-dashboard-wrapper textarea:focus-visible {
    outline-color: var(--ys-ec-account-primary);
    outline-offset: 3px;
}

@media (max-width: 1024px) {
    .ys-ec-account-shell,
    .ys-ec-dashboard-wrapper {
        width: min(calc(100% - 32px), var(--ys-ec-account-max));
    }

    .ys-ec-dashboard-layout {
        gap: 18px;
        grid-template-columns: minmax(208px, 232px) minmax(0, 1fr);
    }
}

@media (max-width: 782px) {
    .ys-ec-account-shell,
    .ys-ec-dashboard-wrapper {
        padding: 20px 0;
        width: calc(100% - 24px);
    }

    .ys-ec-dashboard-layout {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .ys-ec-dashboard-nav ul {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding: 8px;
        scrollbar-width: none;
    }

    .ys-ec-dashboard-nav li {
        flex: 0 0 auto;
    }

    .ys-ec-dashboard-nav li a {
        min-height: 40px;
        padding: 9px 12px;
        white-space: nowrap;
    }

    .ys-ec-dashboard-nav li.ys-ec-active a {
        box-shadow: 0 8px 18px color-mix(in srgb, var(--ys-ec-account-primary) 16%, transparent);
    }

    .ys-ec-dashboard-content {
        padding: 18px 14px;
    }

    .ys-ec-dashboard-wrapper .ys-ec-table {
        min-width: 680px;
    }

    .ys-ec-dashboard-wrapper .ys-ec-table thead {
        display: table-header-group;
    }

    .ys-ec-dashboard-wrapper .ys-ec-table tbody tr {
        border: 0;
        border-radius: 0;
        display: table-row;
        margin-bottom: 0;
        overflow: visible;
    }

    .ys-ec-dashboard-wrapper .ys-ec-table tbody td {
        align-items: normal;
        display: table-cell;
        justify-content: normal;
    }

    .ys-ec-dashboard-wrapper .ys-ec-table tbody td::before {
        content: none;
        display: none;
    }
}

@media (max-width: 480px) {
    .ys-ec-account-shell,
    .ys-ec-dashboard-wrapper {
        width: calc(100% - 20px);
    }

    .ys-ec-dashboard-content {
        padding: 16px 12px;
    }
}

/* v2.44.1 Account order / INVOICE refinement */
.ys-ec-account-shell,
.ys-ec-dashboard-wrapper {
    max-width: var(--ys-ec-account-max);
    width: min(calc(100% - 48px), var(--ys-ec-account-max));
}

.ys-ec-dashboard-content {
    text-align: left;
}

.ys-ec-order-view-wrap {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* v2.44.4 Account order detail redesign */
.ys-ec-order-detail {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 100%;
}

.ys-ec-order-detail__toolbar {
    display: flex;
    justify-content: flex-start;
}

.ys-ec-order-detail__hero {
    align-items: center;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid var(--ys-ec-account-line);
    border-radius: var(--ys-ec-account-radius);
    box-shadow: 0 14px 32px rgba(22, 34, 51, 0.06);
    display: flex;
    gap: 18px;
    justify-content: space-between;
    padding: 24px;
}

.ys-ec-order-detail__hero h2 {
    color: var(--ys-ec-account-heading);
    font-size: clamp(24px, 3vw, 32px);
    letter-spacing: 0;
    line-height: 1.18;
    margin: 0;
}

.ys-ec-order-detail__hero-meta {
    align-items: center;
    color: var(--ys-ec-account-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

/* Keep the status text on the same left edge as the order number, only in the hero. */
.ys-ec-order-detail__hero-meta .ys-ec-status-badge {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding-inline: 0;
}

.ys-ec-order-detail__hero-total {
    align-items: flex-end;
    display: flex;
    flex-direction: column;
    gap: 4px;
    white-space: nowrap;
}

.ys-ec-order-detail__hero-total span,
.ys-ec-order-detail__meta-grid dt,
.ys-ec-order-detail__item-main span {
    color: var(--ys-ec-account-muted);
    font-size: 13px;
}

.ys-ec-order-detail__hero-total strong {
    color: var(--ys-ec-account-heading);
    font-size: 28px;
    line-height: 1;
}

.ys-ec-dashboard-content > .ys-ec-order-detail .ys-ec-account-section,
.ys-ec-order-detail__section {
    background: #ffffff;
    border: 1px solid var(--ys-ec-account-line);
    border-radius: var(--ys-ec-account-radius);
    box-shadow: 0 8px 22px rgba(22, 34, 51, 0.035);
    padding: 22px 24px;
}

.ys-ec-order-detail__meta-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
}

.ys-ec-order-detail__meta-grid > div {
    background: #f8fbff;
    border: 1px solid var(--ys-ec-account-line);
    border-radius: var(--ys-ec-account-radius-sm);
    min-width: 0;
    padding: 14px 16px;
}

.ys-ec-order-detail__meta-grid dt {
    font-weight: 700;
    margin: 0 0 6px;
}

.ys-ec-order-detail__meta-grid dd {
    color: var(--ys-ec-account-body);
    font-weight: 700;
    margin: 0;
    overflow-wrap: anywhere;
}

/* 待繳費資訊（ATM 轉帳 / 超商代碼）——顧客關掉感謝頁之後回來找的地方。
   沿用 meta-grid 的版面，只補足「這是待辦事項」需要的視覺重量。 */
.ys-ec-order-detail__payment {
    border-left: 3px solid #f59e0b;
}

.ys-ec-order-detail__paycode {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--ys-ec-account-radius-sm);
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 16px;
    letter-spacing: 0.06em;
    padding: 6px 10px;
    /* 代碼要能整串選取複製，長號碼在窄螢幕也不得被截斷。 */
    overflow-wrap: anywhere;
    user-select: all;
}

.ys-ec-order-detail__payment .ys-ec-order-detail__copy {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: var(--ys-ec-account-radius-sm);
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    height: auto;
    line-height: 1.5;
    max-width: 100%;
    min-height: 44px;
    padding: 0;
    text-align: start;
}

.ys-ec-order-detail__copy .ys-ec-order-detail__paycode {
    color: var(--ys-ec-text, #2c3e50);
    min-width: 0;
}

.ys-ec-order-detail__copy .ys-ec-ty-copy-btn__label {
    color: var(--ys-ec-link-color, #6b8a9a);
    font-size: 13px;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ys-ec-order-detail__copy:focus-visible {
    outline: 2px solid var(--ys-ec-primary-dark, #5a7d91);
    outline-offset: 3px;
}

/* The shared copy announcer is also used on account pages without thank-you CSS. */
#ys-ec-ty-live-region.ys-ec-ty-sr-only {
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.ys-ec-order-detail__mono {
    color: var(--ys-ec-account-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 400;
}

.ys-ec-order-detail__payment-note {
    color: var(--ys-ec-account-muted);
    font-size: 13px;
    margin: 12px 0 0;
}

.ys-ec-order-detail__count {
    align-items: center;
    background: #eef5ff;
    border-radius: 999px;
    color: var(--ys-ec-account-primary);
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    min-height: 28px;
    padding: 4px 12px;
}

.ys-ec-order-detail__items {
    border: 1px solid var(--ys-ec-account-line);
    border-radius: var(--ys-ec-account-radius-sm);
    overflow: hidden;
}

.ys-ec-order-detail__item {
    align-items: center;
    display: grid;
    gap: 14px;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    padding: 14px 16px;
}

.ys-ec-order-detail__item + .ys-ec-order-detail__item {
    border-top: 1px solid var(--ys-ec-account-line);
}

.ys-ec-order-detail__item-thumb {
    background: #eef5ff;
    border: 1px solid var(--ys-ec-account-line);
    border-radius: 14px;
    height: 56px;
    object-fit: cover;
    width: 56px;
}

.ys-ec-order-detail__item-thumb--empty {
    align-items: center;
    color: var(--ys-ec-account-primary);
    display: flex;
    justify-content: center;
}

.ys-ec-order-detail__item-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ys-ec-order-detail__item-main strong {
    color: var(--ys-ec-account-heading);
}

.ys-ec-order-detail__item-total {
    color: var(--ys-ec-account-heading);
    font-size: 16px;
    font-weight: 800;
    white-space: nowrap;
}

.ys-ec-order-detail__summary {
    display: grid;
    gap: 10px;
    max-width: 520px;
}

.ys-ec-order-detail__summary-row {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.ys-ec-order-detail__summary-row span {
    color: var(--ys-ec-account-muted);
    font-weight: 700;
}

.ys-ec-order-detail__summary-row strong {
    color: var(--ys-ec-account-heading);
}

.ys-ec-order-detail__summary-row--total {
    border-top: 1px solid var(--ys-ec-account-line);
    margin-top: 4px;
    padding-top: 14px;
}

.ys-ec-order-detail__summary-row--total span,
.ys-ec-order-detail__summary-row--total strong {
    color: var(--ys-ec-account-heading);
    font-size: 18px;
}

.ys-ec-order-detail__receipt .ys-ec-order-print-actions {
    margin-top: 4px;
}

.ys-ec-order-detail__receipt {
    border-style: dashed;
}

.ys-ec-account-return-link,
.ys-ec-order-print-actions {
    align-self: flex-start;
}

.ys-ec-order-print-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.ys-ec-account-print-link .dashicons {
    font-size: 18px;
    height: 18px;
    margin-right: 6px;
    width: 18px;
}

.ys-ec-dashboard-content > .ys-ec-account-invoice-list {
    background: #ffffff;
    border: 1px solid var(--ys-ec-account-line);
    border-radius: var(--ys-ec-account-radius);
    box-shadow: 0 8px 22px rgba(22, 34, 51, 0.035);
    padding: 24px;
}

.ys-ec-account-eyebrow {
    color: var(--ys-ec-account-muted);
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 4px;
}

.ys-ec-invoice-table-wrap {
    border: 1px solid var(--ys-ec-account-line);
    border-radius: var(--ys-ec-account-radius-sm);
    max-width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.ys-ec-invoice-table {
    min-width: 680px;
}

.ys-ec-invoice-table td code {
    background: #f5f7fb;
    border-radius: 6px;
    color: var(--ys-ec-account-body);
    display: inline-flex;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    padding: 4px 6px;
}

.ys-ec-invoice-table td small {
    color: var(--ys-ec-account-muted);
    display: block;
    font-size: 12px;
    margin-top: 4px;
}

.ys-ec-invoice-error {
    color: var(--ys-ec-account-danger) !important;
}

.ys-ec-invoice-status {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    min-height: 26px;
    padding: 4px 10px;
}

.ys-ec-invoice-status--issued {
    background: var(--ys-ec-account-success-soft);
    color: var(--ys-ec-account-success);
}

.ys-ec-invoice-status--voided {
    background: #eef2f7;
    color: var(--ys-ec-account-muted);
}

.ys-ec-invoice-status--failed {
    background: var(--ys-ec-account-danger-soft);
    color: var(--ys-ec-account-danger);
}

.ys-ec-invoice-status--pending {
    background: var(--ys-ec-account-warning-soft);
    color: var(--ys-ec-account-warning);
}

.ys-ec-account-empty-inline {
    background: #f8fbff;
    border: 1px dashed var(--ys-ec-account-line-strong);
    border-radius: var(--ys-ec-account-radius-sm);
    color: var(--ys-ec-account-muted);
    padding: 16px;
}

/* v2.44.12 shared account primitives for tab surfaces. */
.ys-ec-account-card,
.ys-ec-dashboard-content .ys-ec-account-card {
    background: #ffffff;
    border: 1px solid var(--ys-ec-account-line);
    border-radius: var(--ys-ec-account-radius);
    box-shadow: 0 8px 22px rgba(22, 34, 51, 0.035);
    box-sizing: border-box;
    max-width: 100%;
    padding: 20px;
    text-align: left;
}

.ys-ec-account-list,
.ys-ec-dashboard-content .ys-ec-account-list {
    max-width: 100%;
    min-width: 0;
    width: 100%;
}

.ys-ec-account-actions,
.ys-ec-dashboard-content .ys-ec-account-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
}

.ys-ec-account-actions .ys-ec-btn,
.ys-ec-account-actions .ys-ec-btn-sm,
.ys-ec-dashboard-content .ys-ec-account-actions .ys-ec-btn,
.ys-ec-dashboard-content .ys-ec-account-actions .ys-ec-btn-sm {
    margin: 0;
}

.ys-ec-account-empty-state,
.ys-ec-dashboard-content .ys-ec-account-empty-state {
    background: #f8fbff;
    border: 1px dashed var(--ys-ec-account-line-strong);
    border-radius: var(--ys-ec-account-radius-sm);
    color: var(--ys-ec-account-muted);
    padding: 16px;
    text-align: left;
}

.ys-ec-account-empty-state p,
.ys-ec-dashboard-content .ys-ec-account-empty-state p {
    margin: 0;
}

.ys-ec-account-empty-state p + p,
.ys-ec-account-empty-state .ys-ec-account-actions,
.ys-ec-dashboard-content .ys-ec-account-empty-state p + p,
.ys-ec-dashboard-content .ys-ec-account-empty-state .ys-ec-account-actions {
    margin-top: 12px;
}

.ys-ec-account-hidden {
    display: none;
}

#ys-ec-card-message:empty,
.ys-ec-dashboard-content #ys-ec-card-message:empty {
    display: none;
}

.ys-ec-coupon-section + .ys-ec-coupon-section,
.ys-ec-dashboard-content .ys-ec-coupon-section + .ys-ec-coupon-section {
    display: none;
}

@media (max-width: 782px) {
    .ys-ec-account-shell,
    .ys-ec-dashboard-wrapper {
        max-width: none;
        width: calc(100% - 24px);
    }

    .ys-ec-dashboard-content > .ys-ec-account-invoice-list {
        padding: 18px 14px;
    }

    .ys-ec-order-detail__hero {
        align-items: flex-start;
        flex-direction: column;
        padding: 20px 16px;
    }

    .ys-ec-order-detail__hero-total {
        align-items: flex-start;
    }

    .ys-ec-dashboard-content > .ys-ec-order-detail .ys-ec-account-section,
    .ys-ec-order-detail__section {
        padding: 18px 14px;
    }

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

    .ys-ec-order-detail__item {
        grid-template-columns: 48px minmax(0, 1fr);
    }

    .ys-ec-order-detail__item-thumb {
        height: 48px;
        width: 48px;
    }

    .ys-ec-order-detail__item-total {
        grid-column: 2;
        justify-self: start;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   v2.56.0 dashboard tab 通用合約（UI 合約通用化 A 案，RD 2026-07-03）
   目標：surface（.ys-ec-dashboard-content）是唯一白卡，任何 tab（含 add-on）
   的第一層容器自動對齊——不再依賴 class 白名單枚舉。
   本區塊刻意置於檔尾：需以 cascade 後位勝過 v2.44.12 primitives
   （.ys-ec-dashboard-content .ys-ec-account-card 白卡樣式，同具體度、位置在前，
   正是 social-accounts 重複框的成因）。
   ═══════════════════════════════════════════════════════════════════════ */

/* 1) 第一層容器 margin 歸零：頂距節奏統一由 surface 的 padding 提供
      （治「掛 ys-ec-ty 的頁 51px vs 其他頁 27px」兩派頂距）。 */
.ys-ec-dashboard-content > * {
    margin-top: 0;
    margin-bottom: 0;
}

/* 2) .ys-ec-ty 在 dashboard 內自動等效 v2.25.1 的 --dashboard 模式
      （max-width:960/margin:24 auto/padding:0 16 是獨立頁設計；scoped 於
      dashboard-content 內，獨立 thankyou 頁不受影響）。 */
.ys-ec-dashboard-content .ys-ec-ty {
    max-width: none;
    margin: 0;
    padding: 0;
}

/* 3) add-on tab 容器公開合約 alias：add-on 根容器可掛 .ys-ec-tab-body
      取得與 core 容器相同的 grid 節奏（不掛也會因 1) 歸零而基本對齊）。 */
.ys-ec-dashboard-content > .ys-ec-tab-body {
    display: grid;
    gap: 20px;
}

/* 4) account-card 壓平：
      - 第一層（surface 內第一層不得再是白卡；social-accounts 重複框成因）
      - 任意層的 .ys-ec-ty-section 同掛 .ys-ec-account-card（downloads/coupons/
        subscriptions/notifications 四頁）——v2.43.5 合約本就壓平 ty-section
        （「壓平＋分隔線」語言），v2.44.12 primitives 白卡把它蓋回，屬同款漂移。
      內層功能卡（如 .ys-ec-social-account-card、地址卡、付款卡列表項）不受影響。 */
.ys-ec-dashboard-content > .ys-ec-account-card,
.ys-ec-dashboard-content .ys-ec-ty-section.ys-ec-account-card,
.ys-ec-dashboard-content > .ys-ec-tab-body {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

/* ── v2.56.0 UX P3：sidebar 手風琴（tab children 次頁面收合） ── */

.ys-ec-dashboard-nav .ys-ec-nav-accordion {
    margin: 0;
}

.ys-ec-dashboard-nav .ys-ec-nav-accordion summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    list-style: none;
    color: inherit;
    font-size: inherit;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.ys-ec-dashboard-nav .ys-ec-nav-accordion summary::-webkit-details-marker {
    display: none;
}

.ys-ec-dashboard-nav .ys-ec-nav-accordion summary:hover {
    background: var(--ys-ec-body-bg, #f6f8fa);
}

.ys-ec-dashboard-nav .ys-ec-nav-caret {
    margin-left: auto;
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: var(--ys-ec-text-muted, #8a99a8);
    transition: transform 0.18s ease;
}

.ys-ec-dashboard-nav .ys-ec-nav-accordion[open] > summary .ys-ec-nav-caret {
    transform: rotate(180deg);
}

.ys-ec-nav-group.ys-ec-active > .ys-ec-nav-accordion > summary {
    box-shadow: inset 3px 0 0 var(--ys-ec-primary, #7a9bae);
    background: var(--ys-ec-body-bg, #f6f8fa);
    font-weight: 600;
}

.ys-ec-dashboard-nav .ys-ec-nav-sub {
    list-style: none;
    margin: 2px 0 4px;
    padding: 0 0 0 34px;
    display: grid;
    gap: 2px;
}

.ys-ec-dashboard-nav .ys-ec-nav-sub li a {
    display: block;
    padding: 6px 10px;
    min-height: 0;
    border-radius: 6px;
    font-size: 13px;
    color: var(--ys-ec-text-muted, #62727f);
    /* 父層 li.ys-ec-active 的後代 a 深藍規則會串染子項 → explicit 蓋回。 */
    background: transparent;
    box-shadow: none;
    font-weight: 500;
}

.ys-ec-dashboard-nav .ys-ec-nav-group.ys-ec-active .ys-ec-nav-sub li:not(.ys-ec-active) a {
    background: transparent;
    color: var(--ys-ec-text-muted, #62727f);
    font-weight: 500;
    box-shadow: none;
    border-left: 0;
}

.ys-ec-dashboard-nav .ys-ec-nav-sub li a:hover {
    background: var(--ys-ec-body-bg, #f6f8fa);
    color: var(--ys-ec-text, #2d3a45);
}

.ys-ec-dashboard-nav .ys-ec-nav-sub li.ys-ec-active a {
    color: var(--ys-ec-primary-dark, #5a7d91);
    background: var(--ys-ec-primary-bg, #edf3f7);
    font-weight: 600;
    box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
    .ys-ec-dashboard-nav .ys-ec-nav-caret,
    .ys-ec-dashboard-nav .ys-ec-nav-accordion summary {
        transition: none;
    }
}

/* review M3：≤782px sidebar 為橫捲 flex 模式——手風琴收斂：
   summary 對齊相鄰 tab 高度/nowrap；展開子項改橫向排列（縮排歸零），避免撐爆橫捲列。 */
@media (max-width: 782px) {
    .ys-ec-dashboard-nav .ys-ec-nav-group {
        flex: 0 0 auto;
    }

    .ys-ec-dashboard-nav .ys-ec-nav-accordion summary {
        min-height: 40px;
        white-space: nowrap;
    }

    .ys-ec-dashboard-nav .ys-ec-nav-sub {
        display: flex;
        flex-wrap: nowrap;
        gap: 4px;
        padding: 0 0 4px;
    }

    .ys-ec-dashboard-nav .ys-ec-nav-sub li a {
        white-space: nowrap;
        padding: 6px 10px;
    }
}
