.d-none {
    display: none !important;
}

.success-word {
    color: #28a745;
    font-size: 0.8em;
}

.text-red {
    color: #ee535f !important;
}

.button-disabled {
    background: #f5f5f5 !important;
    color: #999 !important;
    border: 1px solid #ddd !important;
    cursor: not-allowed !important;
}

.logo a.logo-link,
.logo a.logo-link:hover,
.logo a.logo-link:visited,
.logo a.logo-link:active,
.logo a.logo-link:focus,
.logo a.logo-link * {
    text-decoration: none !important;
    color: inherit !important;
    border-bottom: none !important;
}

.logo a.logo-link {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

/* Select2 容器樣式 */
.select2-container--default .select2-selection--single {
    border: 1px solid #d1d5db !important;
    border-radius: 0.375rem !important;
    height: 42px !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0.75rem !important;
    padding-right: 2.5rem !important;
    color: #374151 !important;
    font-size: 1rem !important;
    /* 調整為 1rem */
    line-height: 1.5rem !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    height: 100% !important;
}

/* 只保留原始的箭頭，移除我新增的偽元素 */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    position: absolute !important;
    right: 0.75rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    height: 20px !important;
    width: 20px !important;
}

/* 移除我之前新增的 ::after 偽元素 */
.select2-container--default .select2-selection--single .select2-selection__arrow::after {
    display: none !important;
}

/* 確保原始箭頭樣式正確 */
.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #6b7280 transparent transparent transparent !important;
    border-style: solid !important;
    border-width: 5px 4px 0 4px !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
}

/* 開啟狀態的箭頭方向 */
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent #6b7280 transparent !important;
    border-width: 0 4px 5px 4px !important;
}

/* 其他樣式保持不變 */
.select2-results__option {
    padding: 0.75rem 1rem !important;
    color: #374151 !important;
    font-size: 1rem !important;
    /* 調整為 1rem */
    line-height: 1.5rem !important;
    display: flex !important;
    align-items: center !important;
}

.select2-results__option--highlighted {
    background-color: #3b82f6 !important;
    color: white !important;
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid #d1d5db !important;
    border-radius: 0.25rem !important;
    padding: 0.75rem !important;
    margin: 0.5rem !important;
    width: calc(100% - 1rem) !important;
    font-size: 1rem !important;
    /* 調整為 1rem */
}

.select2-dropdown {
    border: 1px solid #d1d5db !important;
    border-radius: 0.375rem !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
    background-color: white !important;
}

/* 強制 Select2 下拉選單往下開啟 */
.select2-dropdown {
    top: 100% !important;
    bottom: auto !important;
}

/* 確保下拉選單始終在下方，覆蓋 Select2 的自動判斷 */
.select2-container--open .select2-dropdown {
    top: 100% !important;
    bottom: auto !important;
    transform: none !important;
}

/* 自定義樣式 - 讓 a 標籤看起來像 button */
.btn-link {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 0;
    outline: 0;
    cursor: pointer;
    background: none;
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    padding: 0.25em;
    text-decoration: none;
    color: inherit;
}

.btn-link:hover {
    text-decoration: none;
    color: inherit;
}

.btn-link:focus {
    outline: 0;
}

.btn-link img {
    height: 1.25em;
    max-width: none;
}

/* 無資料提示樣式 */
.no-data {
    padding: 2rem;
    color: #666;
    text-align: center;
    font-weight: bold;
    display: block;
    width: 100%;
}

/* 分頁資訊樣式 */
.pagination-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1em auto;
    gap: 0.5rem;
}

.pagination-info {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.pagination-text {
    color: #666;
    font-size: 0.9rem;
    text-align: center;
    white-space: nowrap;
}

.pages {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 商店擁有者標籤樣式 */
.owner-badge {
    background: #f8f9fa;
    color: #6c757d;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid #e9ecef;
    margin-left: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.owner-badge::before {
    content: "●";
    color: #28a745;
    font-size: 0.5rem;
}

/* 寬輸入框樣式 - 用於金流設定等需要更寬的輸入框 */
.input-wide {
    width: 100% !important;
    min-width: 400px !important;
    max-width: 600px !important;
    flex: 1 !important;
    -webkit-box-flex: 1 !important;
    -ms-flex: 1 !important;
}

/* 標準輸入框樣式 - 用於 Email 等一般輸入框 */
.input-normal {
    width: 100% !important;
    min-width: 250px !important;
    max-width: 350px !important;
    flex: 1 !important;
    -webkit-box-flex: 1 !important;
    -ms-flex: 1 !important;
}

/* 全寬輸入框樣式 - 用於需要填滿可用空間的輸入框 */
.input-full {
    width: 100% !important;
    flex: 1 !important;
    -webkit-box-flex: 1 !important;
    -ms-flex: 1 !important;
}

/* 品牌列表 hover 效果 */
.item a {
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.item a:hover {
    color: #374151 !important;
    transform: translateX(2px);
}

.item .button {
    transition: all 0.3s ease;
}

.item .button:hover {
    background: var(--blue) !important;
    color: white !important;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.item .button:hover img {
    filter: brightness(0) invert(1);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .pagination-text {
        font-size: 0.8rem;
    }

    .owner-badge {
        font-size: 0.7rem;
        padding: 0.1rem 0.3rem;
    }

    .input-wide {
        min-width: 300px !important;
        max-width: 100% !important;
    }

    .input-normal {
        min-width: 200px !important;
        max-width: 100% !important;
    }
}

/* 按鈕區域排版 */
.buttons-flex {
    display: flex;
    align-items: center;
}

/* 提醒文字樣式 */
.reminder-text {
    color: red;
    margin-right: 15px;
    font-size: 14px;
}

/* iOS Safari Modal 觸控修復 - 桌機版保持原樣 */
.popup .close {
    /* 桌機版：完全保持原始樣式，只增加觸控區域 */
    min-width: 44px !important;
    min-height: 44px !important;
    /* 確保在最上層 */
    z-index: 9999 !important;
    /* 增加觸控響應 */
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    /* 確保可點擊 */
    cursor: pointer !important;
    /* 增加視覺反饋 */
    transition: all 0.2s ease;
}

.popup .close:hover {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
}

.popup .close:active {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(0.95);
}

/* 手機版 X 圖示保持原始樣式 */
@media (max-width: 768px) {

    .popup .close span:before,
    .popup .close span:after {
        /* 保持原始線條粗細和顏色 */
        height: 3px !important;
        background: var(--blue) !important;
    }
}

/* Modal 按鈕區域修復 */
.popup .buttons {
    /* 確保按鈕區域有足夠的觸控空間 */
    padding: 1rem 0 !important;
    margin-top: 1rem !important;
    /* 增加觸控間距 */
    gap: 1rem !important;
}

.popup .buttons .button {
    /* 增加按鈕最小觸控區域 */
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0.75rem 1.5rem !important;
    /* 確保按鈕可點擊 */
    z-index: 1000 !important;
    position: relative !important;
    /* iOS Safari 觸控優化 */
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    /* 增加視覺反饋 */
    transition: all 0.2s ease;
}

.popup .buttons .button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.popup .buttons .button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Modal 容器修復 */
.popup .popup-box {
    /* 確保內容不會被截斷 */
    max-height: 90vh !important;
    overflow-y: auto !important;
    /* 增加觸控滾動支援 */
    -webkit-overflow-scrolling: touch !important;
    /* 確保在 iOS 上正確顯示 */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    /* 手機版：確保底部有足夠空間 */
    margin-bottom: 80px !important;
}

/* iOS Safari 特定修復 */
@supports (-webkit-touch-callout: none) {
    .popup {
        /* iOS Safari 視窗高度修復 */
        height: 100vh !important;
        height: -webkit-fill-available !important;
    }

    .popup .popup-box {
        /* 確保在 iOS 上正確定位 */
        position: relative !important;
        margin: auto !important;
    }

    .popup .close {
        /* iOS 觸控優化 */
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
}

/* Breadcrumb 按鈕區域高度一致性 */
.crumb-bar .buttons {
    min-height: 36px;
    display: flex;
    align-items: center;
}

/* 行動版下拉選單間距調整 */
@media (max-width: 768px) {
    header .account-menu a {
        padding: 0.75em 0 !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
    }

    header .account-menu {
        min-width: 180px !important;
        padding: 1.5em !important;
    }
}

/* 搜尋表單樣式優化 */
.search {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.search-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.search .button {
    align-self: flex-end;
    margin-top: 0.5rem;
}

/* 產品列表頁面樣式（已移除 .field-wide 與 .field-2-3，避免未使用樣式） */

.field-date {
    flex: 0 0 auto;
    min-width: 200px;
}

.field-date .field-content input {
    width: 100%;
}

/* 日期時間輸入框樣式修復 */

/* 專門針對日期時間輸入框的樣式修復 */
input[type="date"],
input[type="time"] {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    box-sizing: border-box !important;
    height: auto !important;
    min-height: 2.5em !important;
    padding: 0.5em !important;
}

/* 桌機版保持原本寬度，行動版才使用 100% 寬度 */
.field-content input[type="date"],
.field-content input[type="time"] {
    box-sizing: border-box !important;
}

/* 確保桌機版 field-date 保持原本寬度 */
@media screen and (min-width: 821px) {

    .field-date .field-content input[type="date"],
    .field-date .field-content input[type="time"] {
        width: 100% !important;
        max-width: none !important;
    }
}

/* 合併至下方更完整的 820px 區塊，避免重複 */

/* iPhone Safari 特殊調整 */
@media screen and (max-width: 414px) {
    .field-date {
        min-width: 0 !important;
        flex: 1 1 100% !important;
        width: 100% !important;
    }

    .field-date .field-content input {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .search-row {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .search-row .field {
        width: 100% !important;
        margin-bottom: 0.5rem !important;
    }

    /* iPhone 上的日期時間輸入框調整 */
    input[type="date"],
    input[type="time"] {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        height: auto !important;
        min-height: 2.5em !important;
        padding: 0.5em !important;
    }

    /* 強制覆蓋所有可能的樣式衝突 */
    .field .field-content input[type="date"],
    .field .field-content input[type="time"] {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* 訂單列表頁面樣式 */
.field-uniform {
    flex: 1;
    min-width: 0;
}

.field-uniform .field-content input,
.field-uniform .field-content select {
    width: 100%;
}

/* 顯示列數上方分隔線 */
.pagination-pre-page {
    border-top: 1px solid #e5e5e5;
    padding-top: 1rem;
    margin-top: 1rem;
}

/* 820px 以下的行動版日期時間欄位樣式 */
@media screen and (max-width: 820px) {

    input[type="date"],
    input[type="time"] {
        width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        -webkit-box-flex: none !important;
        -ms-flex: none !important;
        height: auto !important;
        min-height: 2.5em !important;
        padding: 0.5em !important;
    }
}

/* 響應式修復 */
@media (max-width: 1200px) {
    .search-row {
        flex-wrap: wrap;
    }

    .field {
        flex: 1 1 350px;
        min-width: 300px;
    }

    .input-wide {
        min-width: 300px !important;
    }
}

@media (max-width: 1024px) {
    .field {
        flex: 1 1 280px;
        min-width: 250px;
    }

    .input-wide {
        min-width: 250px !important;
    }
}

@media (max-width: 768px) {
    .search {
        padding: 1rem;
        margin: 0 -1rem 1rem -1rem;
    }

    .search-row {
        flex-direction: column;
        gap: 0.75rem;
        /* 行動版欄位要置左且撐滿寬度，不要靠右 */
        align-items: stretch;
    }

    .field,
    .field-uniform,
    .field-date {
        flex: 1;
        min-width: 0;
        width: 100%;
    }

    /* iPhone Safari 特殊調整 */
    .field-date {
        min-width: 0 !important;
        flex: 1 1 100% !important;
    }

    .field-date .field-content input {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    /* 標籤與內容全部滿版排列，避免被擠到右側 */
    .field .field-title,
    .field .field-content {
        width: 100%;
    }

    .field-content input,
    .field-content select {
        width: 100% !important;
        max-width: 100%;
    }

    /* 行動版日期時間欄位樣式 */
    input[type="date"],
    input[type="time"] {
        width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        -webkit-box-flex: none !important;
        -ms-flex: none !important;
        height: auto !important;
        min-height: 2.5em !important;
        padding: 0.5em !important;
    }

    /* 行動版搜尋欄位調整 */
    .search-row .field {
        width: 100% !important;
        margin-bottom: 1rem !important;
    }

    .search .button {
        align-self: center;
        width: 100%;
        max-width: 200px;
    }

    .input-wide {
        min-width: 200px !important;
        max-width: 100% !important;
    }

    .input-normal {
        min-width: 150px !important;
        max-width: 100% !important;
    }

    /* 表格響應式處理 */
    .scroll-x {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 800px;
    }

    /* 按鈕區域響應式 */
    .row {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .btn-link {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.popup .close {
    /* 手機版：真正固定在螢幕右上角，不隨內容滾動 */
    position: fixed !important;
    top: 1rem !important;
    right: 1rem !important;
    z-index: 10000 !important;
    /* 增加觸控區域但保持原始外觀 */
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 6px !important;
    /* 保持原始 X 大小，不要額外的圓形背景 */
    width: 1em !important;
    height: 1em !important;
    /* 移除圓形背景，保持原始樣式 */
    background: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    /* 確保在 Modal 上方且不隨滾動移動 */
    transform: translateZ(0) !important;
    /* 確保不會被其他元素覆蓋 */
    pointer-events: auto !important;
}

.popup .buttons .button {
    /* 手機上增加按鈕大小 */
    min-width: 48px !important;
    min-height: 48px !important;
    padding: 1rem 1.5rem !important;
    font-size: 1rem !important;
}

.popup .popup-box {
    /* 手機上調整間距 */
    padding: 1.5rem 1.5rem 0 1.5rem !important;
    margin: 1rem !important;
    width: calc(100% - 2rem) !important;
    /* 手機版：確保有足夠空間但不強制固定高度 */
    max-height: calc(100vh - 100px) !important;
    margin-bottom: 0 !important;
    /* 確保內容可以正常滾動 */
    overflow-y: auto !important;
}

/* 手機版按鈕區域特殊處理 */
.popup .buttons {
    /* 貼近 Modal 底部，不要固定在螢幕底部 */
    position: relative !important;
    bottom: auto !important;
    background: white !important;
    padding: 1rem 1.5rem !important;
    margin: 0 !important;
    border-top: 1px solid #e5e5e5 !important;
    z-index: 1000 !important;
    /* 確保按鈕區域緊貼內容，減少間距 */
    margin-top: 0.5rem !important;
}


/* 付款方式顯示樣式 */
.payment-methods-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.payment-methods-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.payment-methods-checkboxes {
    display: flex;
    gap: 15px;
}

.payment-method-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 使用者條款樣式 */
.terms-item {
    margin-bottom: 1.5rem;
}

.word-blue {
    margin-bottom: 1.5rem;
}

.terms-item h4 {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 1rem;
}

.terms-item p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.terms-item ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.terms-item ol li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.terms-item ul {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.terms-item li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* Logo 響應式切換樣式 */
.logo-long {
    display: block !important;
    height: 24px !important;
    /* 保持原始高度，不影響 header */
    width: auto !important;
    transform: scale(5) !important;
    /* 放大 3.5 倍讓 logo 看起來更大 */
    transform-origin: left center !important;
    /* 從左側中心點放大 */
    margin-right: 90px !important;
    /* 增加右邊距讓文字往旁邊 float */
}

.logo-square {
    display: none !important;
    height: 24px !important;
    /* 保持原始高度，不影響 header */
    width: auto !important;
    transform: scale(2) !important;
    /* 放大 2 倍讓 logo 看起來更大 */
    transform-origin: left center !important;
    /* 從左側中心點放大 */
    margin-right: 10px !important;
    /* 增加右邊距讓文字往旁邊 float */
}

/* 在小螢幕上顯示方形 logo */
@media (max-width: 768px) {
    .logo-long {
        display: none !important;
    }

    .logo-square {
        display: block !important;
    }
}

/* 在中等螢幕上根據寬度動態切換 */
@media (min-width: 769px) and (max-width: 1024px) {
    .logo-long {
        display: block !important;
    }

    .logo-square {
        display: none !important;
    }
}

/* 確保 logo 容器不會過大 */
.logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    /* 增加間距讓視覺更平衡 */
}

.logo-link img {
    flex-shrink: 0;
}

/* 確保 logo 與文字垂直對齊 */
.logo-link h1 {
    margin: 0;
    font-size: 1.5rem;
    /* 確保文字大小一致 */
    line-height: 1.2;
}

/* Header 佈局強化：只在行動版生效，避免影響桌機 */
@media (max-width: 768px) {
    header {
        gap: 0.75rem;
    }

    header .logo {
        flex: 0 0 auto !important;
    }

    header .account {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.75rem !important;
        margin-left: auto !important;
        justify-content: flex-end !important;
    }

    /* 三區塊：logo | 商店名稱(伸縮) | 使用者名稱 */
    header .account .account-link {
        flex: 1 1 auto !important;
        max-width: 100% !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        font-weight: 600 !important;
        letter-spacing: 0.2px;
        /* 改用文字底線，避免下底線撐滿寬度 */
        border-bottom: 0 !important;
        text-decoration: underline !important;
        text-decoration-color: currentColor !important;
        text-underline-offset: 2px;
    }

    header .account .account-name {
        flex: 0 0 auto !important;
        margin-left: 0 !important;
        display: inline-flex !important;
    }
}

/* 桌機版恢復原樣（避免被上方規則影響） */
@media (min-width: 769px) {
    header .logo {
        flex: initial !important;
    }

    header .account {
        flex: initial !important;
        min-width: auto !important;
        display: flex;
    }

    header .account .account-link {
        max-width: none !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }
}

/* 表格字體大小一致性修復 */
.table-liner th,
.table-liner td {
    font-size: 0.9em !important;
    line-height: 1.5 !important;
}

/* iOS Safari 自動放大字體修正（避免 <td> 比 <th> 大） */
.table-liner,
.table-liner th,
.table-liner td {
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
}

/* 保證表格內連結不被單獨放大 */
.table-liner td a,
.table-liner th a {
    font-size: inherit !important;
    line-height: inherit !important;
}

/* Dashboard notice 連結樣式 */
.notice a {
    color: #50bdc3;
    text-decoration: underline;
    border-bottom: none;
}

.notice a:hover,
.notice a:focus {
    color: #50bdc3;
    text-decoration: underline;
    border-bottom: none;
}

/* 有橫向卷軸容器時也關閉 iOS 自動放大，避免內部元素被放大 */
.scroll-x {
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
}

/* 行動版表格字體大小調整 */
@media (max-width: 768px) {

    .table-liner th,
    .table-liner td {
        font-size: 0.85em !important;
        line-height: 1.4 !important;
    }
}

/* Footer 樣式 */
footer {
    text-align: center;
    padding: 1rem;
    color: #666;
    font-size: 0.9rem;
    border-top: 1px solid #e5e5e5;
}