/* ── Cart Modal ── */
    #cartModal .modal-dialog { max-width: 440px; }
    #cartModal .modal-content {
        border-radius: 16px;
        border: none;
        box-shadow: 0 8px 32px rgba(0,0,0,0.16);
    }
    #cartModal.fade .modal-dialog {
        transform: scale(0.92) translateY(-6px);
        transition: transform 0.28s cubic-bezier(0.34, 1.15, 0.64, 1);
    }
    #cartModal.fade.show .modal-dialog {
        transform: scale(1) translateY(0);
    }

    /* Header：商品圖 */
    #cartModalImg {
        width: 80px;
        height: 80px;
        object-fit: cover;
        border-radius: 8px;
    }

    /* Header：商品名稱（2行截斷） */
    #cartModalTitle {
        font-size: 1.1rem;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Header：價格列 */
    /* 售價列緊接商品名稱下一行；行高收緊，避免與名稱之間多出空白 */
    #cartModal .tk-cart-price { line-height: 1; }
    #cartModal .tk-cart-price > span { line-height: 1; }
    #cartModalSalePrice { color: #FF7F32; }

    /* 原價（刪除線）與庫存文字：灰色 #8f8f8f */
    #cartModal #cartModalOrigPrice,
    #cartModal #cartModalStock {
        color: #8f8f8f;
    }
    /* 庫存文字字級與「組合內容」數量（.tk-cart-section-sub）相同 */
    #cartModal #cartModalStock {
        font-size: 12px;
    }
    /* 組合商品：內容物清單 */
    /* 整組一個圓角外框，成員之間以細線分隔；色點＋規格副標｜規格名稱｜數量（比照商品頁） */
    #cartModal .tk-group-list {
        display: block;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        background: #fff;
        overflow: hidden;
    }
    #cartModal .tk-group-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 8px 14px;
        font-size: 14px;
        line-height: 1.5;
        color: #1f2937;
    }
    #cartModal .tk-group-item + .tk-group-item { border-top: 1px solid #e5e7eb; }
    #cartModal .tk-group-dot {
        flex: 0 0 auto;
        width: 10px;
        height: 10px;
        border-radius: 50%;
    }
    #cartModal .tk-group-name {
        flex: 0 1 auto;
        min-width: 0;
        max-width: 45%;
        word-break: break-word;
    }
    #cartModal .tk-group-spec {
        flex: 1 1 auto;
        min-width: 0;
        text-align: right;
        word-break: break-word;
    }
    #cartModal .tk-group-item--no-tag .tk-group-spec { text-align: left; }
    /* 數量接在規格名稱後面，間距約一個空白（抵銷整列 12px gap） */
    #cartModal .tk-group-qty {
        flex: 0 0 auto;
        margin-left: -8px;
        text-align: right;
        white-space: nowrap;
    }
    /* 組合商品「自定規格顯示」：不畫外框，只留色塊＋規格文字（比照商品頁 .spec-option.custom-spec） */
    #cartModal .tk-group-custom-spec {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 2px 0;
        font-size: 15px;
        line-height: 1.5;
        color: #1f2937;
    }
    #cartModal .tk-group-custom-tag {
        flex: 0 0 auto;
        min-width: 40px;
        padding: 5px 14px;
        border-radius: 10px;
        background: #f9a8d4;
        color: #ffffff;
        font-size: 14px;
        font-weight: 500;
        text-align: center;
    }
    #cartModal .tk-group-custom-text {
        flex: 1 1 auto;
        min-width: 0;
        word-break: break-word;
    }
    #cartModal .tk-cart-section-sub {
        font-size: 12px;
        color: #6b7280;
    }

    /* 區塊標題（規格/容量、組合內容、優惠活動、選擇數量） */
    #cartModal .tk-cart-section-title {
        display: inline-block;
        font-size: 16px;
        font-weight: 700;
        color: #111827;
    }

    /* 規格列表：一個規格一列 */
    #cartModalSpecList,
    #cartModalGroupSpecList {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    /* 規格按鈕：整列寬、文字靠左；選中列淺橘底並在右側打勾 */
    #cartModal .tk-spec-btn {
        position: relative;
        width: 100%;
        padding: 10px 44px 10px 16px;
        border: 1px solid #e5e7eb;
        border-radius: 14px;
        background: #fff;
        color: #1f2937;
        font-size: 14px;
        font-weight: 400;
        line-height: 1.5;
        cursor: pointer;
        transition: all 0.15s;
        text-align: left;
        word-break: break-word;
    }
    #cartModal .tk-spec-btn.active {
        border-color: #f8d3b4;
        background: #fff4ea;
        color: #1f2937;
    }
    #cartModal .tk-spec-btn.active::after {
        content: '';
        position: absolute;
        top: 50%;
        right: 14px;
        width: 18px;
        height: 18px;
        transform: translateY(-50%);
        background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%23f9b27c'/%3E%3Cpath d='M4.4 8.3l2.4 2.4 4.8-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    }
    /* 缺貨規格按鈕：灰色文字、禁止點擊 */
    #cartModal .tk-spec-btn--oos {
        opacity: 0.4;
        cursor: not-allowed;
        color: #808080;
    }

    /* 數量控件外框 */
    .tk-qty-wrap {
        border: 1px solid #e5e7eb;
        border-radius: 99px;
    }

    /* 底部按鈕列：上方細線與內容分隔 */
    #cartModal .modal-footer {
        border-top: 1px solid #e5e7eb;
    }
    #cartModal .modal-footer > * {
        margin: 0;
    }

    /* 數量輸入框 */
    #cartModalQtyDisplay {
        width: 38px;
        height: 32px;
        border: none;
        outline: none;
        background: transparent;
        color: #111827;
        font-size: 16px;
        font-weight: 700;
        text-align: center;
        padding: 0;
        appearance: textfield;
        -moz-appearance: textfield;
    }
    #cartModalQtyDisplay::-webkit-outer-spin-button,
    #cartModalQtyDisplay::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    /* 數量 +/- 按鈕 */
    .tk-qty-btn {
        width: 32px;
        height: 32px;
        border: none;
        background: transparent;
        font-size: 18px;
        line-height: 1;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: #374151;
    }
    #cartModalQtyMinus { border-radius: 50% 0 0 50%; }
    #cartModalQtyPlus  { border-radius: 0 50% 50% 0; }
    .tk-qty-btn:disabled {
        color: #808080;
        cursor: default;
    }

    /* 確認按鈕 */
    .tk-confirm-btn {
        width: 100%;
        height: 48px;
        border: none;
        border-radius: 12px;
        background: #FF7F32;
        color: #fff;
        font-size: 15px;
        font-weight: 700;
        cursor: pointer;
        transition: background 0.15s, border-color 0.15s, color 0.15s;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }
    .tk-confirm-btn:disabled {
        background: #d1d5db;
        cursor: default;
    }
    .tk-confirm-btn:not(:disabled):hover {
        background: #d95a1a;
    }
    /* 貨到通知模式：灰藍邊框風格，與商品卡片 btn-restock 一致 */
    .tk-confirm-btn[data-mode="restock"] {
        background: #f8fafc;
        color: #334155;
        border: 2px solid #64748b;
    }
    .tk-confirm-btn[data-mode="restock"]:not(:disabled):hover {
        background: #e2e8f0;
        border-color: #475569;
    }

    /* 已達庫存上限提示 */
    .tk-qty-hint { font-size: 12px; color: #f26522; }

    /* 保存期限 / 注意事項 */
    .tk-info-content { font-size: 12px; }
    .tk-notice-divider { border-bottom: 1px solid #e5e7eb; }
    #cartModalNoticeContent p { margin-bottom: 0.25rem; }
    /* 自定義說明（Product.PCustomNote）：橘色「★ 文字」。組合內容作為成員清單最後一列（.tk-group-item--note），
       一般商品／自定規格／無成員時為獨立一列（.tk-custom-note--boxed，比照商品頁規格列外框） */
    #cartModal .tk-custom-note {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 14px;
        line-height: 1.5;
        color: #f26522;
        font-weight: 600;
    }
    #cartModal .tk-custom-note--boxed {
        padding: 8px 14px;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        background: #ffffff;
    }
    #cartModal .tk-group-item--note {
        color: #f26522;
        font-weight: 600;
        gap: 8px;
    }
    #cartModal .tk-custom-note-star {
        flex: 0 0 auto;
        line-height: 1;
    }
    #cartModal .tk-custom-note-text {
        flex: 1 1 auto;
        font-weight: 400;
        min-width: 0;
        word-break: break-word;
    }

    /* 優惠活動（與商品詳細頁同內容）：淺橘底框＋票券圖示 */
    /* 導流面版：橘框可點擊連結，左圖示＋分隔線＋文案＋右箭頭（比照商品頁 .product-guide-panel） */
    #cartModal .tk-cart-guide {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 8px 14px;
        border: 1px solid #f26522;
        border-radius: 10px;
        background: #ffffff;
        color: #f26522;
        font-size: 14px;
        line-height: 1.5;
        text-decoration: none;
    }
    #cartModal .tk-cart-guide:hover,
    #cartModal .tk-cart-guide:focus {
        color: #f26522;
        text-decoration: none;
        background: #fff4ea;
    }
    #cartModal .tk-cart-guide-icon {
        flex: 0 0 auto;
        width: 32px;
        height: 32px;
        object-fit: contain;
    }
    #cartModal .tk-cart-guide-divider {
        flex: 0 0 auto;
        align-self: stretch;
        width: 1px;
        background: #f8d3b4;
    }
    #cartModal .tk-cart-guide-text {
        flex: 1 1 auto;
        min-width: 0;
        word-break: break-word;
    }
    #cartModal .tk-cart-guide > .bi {
        flex: 0 0 auto;
        font-size: 14px;
    }

    .tk-cart-event {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        background: #fff4ea;
        border: 1px solid #f8d3b4;
        border-radius: 12px;
        padding: 9px 14px;
        font-size: 13px;
        line-height: 1.7;
        color: #374151;
    }
    .tk-cart-event-icon {
        flex: 0 0 auto;
        width: 22px;
        height: 22px;
        margin-top: 1px;
        object-fit: contain;
    }
    #cartModalEventContent {
        flex: 1 1 auto;
        min-width: 0;
    }
    /* 摘要列：一筆活動一列，只列滿額折，超過 3 列折疊 */
    .tk-cart-event .evt-sum-line { padding: 3px 0; line-height: 1.8; word-break: break-word; }
    .tk-cart-event .evt-sum-toggle {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 4px 0;
        border: 0;
        background: transparent;
        font-size: 12px;
        font-weight: 600;
        color: #c2410c;
        cursor: pointer;
    }
    .tk-cart-event .evt-sum-toggle .bi {
        font-size: 11px;
        transition: transform 0.2s ease;
    }
    .tk-cart-event .evt-sum-toggle[aria-expanded="true"] .bi {
        transform: rotate(180deg);
    }
    .tk-cart-event .evt-sum-kind { display: inline-block; margin-right: 3px; padding: 0 4px; border-radius: 3px; font-size: 11px; font-weight: 600; line-height: 1.6; vertical-align: 1px; }
    .tk-cart-event .evt-sum-kind.is-gift { background: #fde3d6; color: #c2410c; }
    .tk-cart-event .evt-sum-kind.is-discount { background: #dde7fa; color: #1d4ed8; }
    .tk-cart-event .evt-sum-cond { margin-right: 3px; font-weight: 600; color: #1f2937; white-space: nowrap; }
    .tk-cart-event .evt-sum-scope { margin-right: 3px; color: #b45309; font-weight: 600; }
    .tk-cart-event .evt-sum-end { margin-right: 0; color: #4b5563; white-space: nowrap; }
    /* 保存期限（可折疊，預設折疊）；組合商品逐筆列出各子商品保存期限 */
    .tk-cart-expiry-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 2px 0;
        border: 0;
        background: transparent;
        color: inherit;
        font-size: inherit;
        text-align: left;
        cursor: pointer;
    }
    .tk-cart-expiry-title { font-weight: 600; }
    .tk-cart-expiry-chevron { font-size: 11px; color: #808080; transition: transform 0.2s ease; }
    .tk-cart-expiry-toggle[aria-expanded="true"] .tk-cart-expiry-chevron { transform: rotate(180deg); }
    .tk-cart-expiry-body { margin-top: 2px; }
    .tk-cart-expiry-row { line-height: 1.5; padding-left: 14px; }

    /* 貨到通知 / 加入購物車 Loading 遮罩 */
    .tk-loading-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        align-items: center;
        justify-content: center;
        z-index: 10001;
    }
    .tk-loading-overlay.is-visible { display: flex; }
    .tk-loading-spinner {
        width: 50px;
        height: 50px;
        border: 4px solid #f3f3f3;
        border-top-color: #007bff;
        border-radius: 50%;
        animation: tkOverlaySpin 1s linear infinite;
    }
    @keyframes tkOverlaySpin {
        to { transform: rotate(360deg); }
    }

    /* 數量滾輪選擇器 */
    .tk-qty-picker {
        position: fixed;
        inset: 0;
        display: flex;
        align-items: flex-end;
        justify-content: center;
        z-index: 1065;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.22s ease, visibility 0.22s ease;
    }
    .tk-qty-picker.is-open {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }
    .tk-qty-picker__backdrop {
        position: absolute;
        inset: 0;
        background: rgba(17, 24, 39, 0.42);
    }
    .tk-qty-picker__sheet {
        position: relative;
        width: min(100%, 440px);
        background: #fff;
        border-radius: 18px 18px 0 0;
        transform: translateY(100%);
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
        box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.18);
        overflow: hidden;
    }
    .tk-qty-picker.is-open .tk-qty-picker__sheet {
        transform: translateY(0);
    }
    .tk-qty-picker__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 14px 16px 10px;
        border-bottom: 1px solid #f3f4f6;
    }
    .tk-qty-picker__title {
        font-size: 15px;
        font-weight: 700;
        color: #111827;
    }
    .tk-qty-picker__action {
        border: none;
        background: transparent;
        padding: 6px 4px;
        font-size: 14px;
        font-weight: 600;
    }
    .tk-qty-picker__action.is-cancel {
        color: #6b7280;
    }
    .tk-qty-picker__action.is-confirm {
        color: #f26522;
    }
    .tk-qty-picker__body {
        position: relative;
        height: 200px;
        overflow: hidden;
    }
    .tk-qty-picker__wheel {
        height: 100%;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: y mandatory;
        scrollbar-width: none;
        overflow-x: hidden;
    }
    .tk-qty-picker__wheel::-webkit-scrollbar {
        display: none;
    }
    .tk-qty-picker__spacer {
        height: 80px;
        flex-shrink: 0;
        pointer-events: none;
    }
    .tk-qty-picker__item {
        display: block;
        width: 100%;
        height: 40px;
        border: none;
        background: transparent;
        color: #6b7280;
        font-size: 24px;
        font-weight: 500;
        text-align: center;
        scroll-snap-align: center;
        transition: color 0.16s ease, transform 0.16s ease, font-weight 0.16s ease;
    }
    .tk-qty-picker__item.is-active {
        color: #111827;
        font-weight: 700;
        transform: scale(1.04);
    }
    .tk-qty-picker__highlight {
        position: absolute;
        top: 50%;
        left: 16px;
        right: 16px;
        height: 40px;
        transform: translateY(-50%);
        border-top: 1px solid #e5e7eb;
        border-bottom: 1px solid #e5e7eb;
        border-radius: 10px;
        background: rgba(249, 250, 251, 0.85);
        pointer-events: none;
    }
    #cartModal.qty-wheel-open {
        padding-bottom: 35px !important;
    }

    /* 手機版：底部滑出 */
    @media (max-width: 767px) {
        #cartModal {
            align-items: flex-end;
            padding: 0 0 10px !important;
        }
        #cartModal .modal-dialog {
            margin: 0;
            width: 100%;
            max-width: 100%;
            transform: translateY(110%);
            transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1) !important;
        }
        #cartModal.fade.show .modal-dialog {
            transform: translateY(0) !important;
        }
        #cartModal .modal-content {
            border-radius: 16px;
            max-height: 90dvh;
            overflow-y: auto;
        }
        .tk-qty-picker__sheet {
            width: 100%;
        }
    }

    /* ── 觸控裝置：停用 :hover（桌機不受影響）── */
    @media (hover: none) {
        .tk-confirm-btn:not(:disabled):hover { background: #FF7F32; }
        .tk-confirm-btn[data-mode="restock"]:not(:disabled):hover {
            background: #f8fafc;
            border-color: #64748b;
            color: #334155;
        }
    }
