﻿body {
    font-family: "Microsoft JhengHei", "微軟正黑體", "PingFang TC", "Heiti TC", "Noto Sans TC", sans-serif;
}

/* ── Light theme 底色：純白大面積太刺眼，改用淡灰當底色 ──
   直接改 Bootstrap 自己的 CSS 變數（而不是一個個元件另外補 class 規則），
   因為 card/table/form-control/modal/input-group-text/::file-selector-button...
   全部元件的背景、邊框都是從這四個變數算出來的，Choices.js 的 --choices-* 系列
   也預設對應到同一組變數（見下面 .choices 區塊）。改這裡，全站（含第三方套件）
   一起跟著變，之後要再調色只需要改這四行，不用每次踩雷才補一條規則。
   - --bs-body-bg      背景（card/table/form-control/modal/dropdown...）
   - --bs-border-color 邊框（form-control/form-select/card/table...）
   - --bs-tertiary-bg  次要底色（input-group-text、file 選擇按鈕、editor 工具列）
   - --bs-secondary-bg 更深一階的底色（上述元件的 hover 狀態）
   每個 -bg 變數 Bootstrap 都另外配了一份「逗號分隔 RGB」版本（給 .bg-body 這類
   透明度工具類用，例如 navbar 的 bg-body），是分開存的常數，不會自動跟著 hex 版本換算，
   沒補這三行就會出現「body 背景變灰、但 .bg-body 的 navbar 還是白的」這種不一致。 */
html[data-bs-theme="light"] {
    --bs-body-bg: #eceef1;
    --bs-body-bg-rgb: 236, 238, 241;
    --bs-border-color: #b9c0c9;
    --bs-tertiary-bg: #dde1e6;
    --bs-tertiary-bg-rgb: 221, 225, 230;
    --bs-secondary-bg: #cfd4da;
    --bs-secondary-bg-rgb: 207, 212, 218;
}

/* ── 列表頁篩選列 (#FilterPanel)：依寬度自動排版，換行時不留孤立空白 ──
   套用範圍：所有 *_List.cshtml 共用的 #FilterPanel + 搜尋框結構，改這裡即全後台生效，不用逐頁調整。
   只在 >=768px（Bootstrap md，對應 d-md-flex 生效的寬度）套用，避免蓋掉手機版 col-12 直向堆疊。
   768px~1499px：篩選欄位整行自己換行（固定寬度、不拉伸），搜尋框永遠整行在下面。
   >=1500px（篩選欄位+搜尋框放得下同一行）：篩選欄位緊湊排一行，搜尋框補滿剩餘空間。
   實測依據：6 個欄位（180px/個）+ 搜尋框最小需求，1500px 是安全的切換點，數字全部用 Chrome 實測量出，不是憑感覺猜的。 */
@media (min-width: 540px) {
    #FilterPanel {
        flex-grow: 1;
        flex-shrink: 1;
        flex-basis: 100%;
        flex-wrap: wrap;
    }

        #FilterPanel > .col {
            flex: 1 1 180px;
        }

        #FilterPanel + .col {
            flex: 1 1 100%;
            min-width: 0;
        }
}

@media (min-width: 1024px) {
    #FilterPanel {
        flex: 0 0 auto;
        flex-wrap: nowrap;
    }

        #FilterPanel + .col {
            flex: 1 1;
            min-width: 300px;
        }
}

/* ── Video Upload (Videos.cshtml) ───────────────────────────────────────────── */
.vup-wrap {
    margin-bottom: 1rem;
}

.vup-bar-wrap {
    height: 6px;
    border-radius: 3px;
    background: var(--bs-border-color, #dee2e6);
    overflow: hidden;
    margin: 6px 0 2px;
    display: none;
}

.vup-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--bs-primary, #0d6efd);
    border-radius: 3px;
    transition: width .2s;
}

.vup-status {
    font-size: 12px;
    opacity: .7;
    min-height: 16px;
}

.vup-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 13px;
}

    .vup-preview a {
        word-break: break-all;
    }

/* ── TipTap Editor ─────────────────────────────────────────────────────────── */
.tiptap-editor-wrap {
    border: 1px solid var(--bs-border-color, #ced4da);
    border-radius: .375rem;
    display: flex;
    flex-direction: column;
    /* 不設固定高度、不設 overflow，讓 sticky 可以對 modal 捲軸生效 */
}

/* 工具列 */
.tiptap-toolbar {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 5px 8px;
    border-bottom: 1px solid var(--bs-border-color, #ced4da);
    background: var(--bs-tertiary-bg, #f8f9fa);
    flex-shrink: 0;
    position: sticky;
    top: -1rem;
    z-index: 50;
    border-radius: .375rem .375rem 0 0;
}

.tiptap-toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.tiptap-toolbar button {
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 3px 7px;
    cursor: pointer;
    font-size: .82rem;
    color: var(--bs-body-color, #212529);
    line-height: 1.4;
    transition: background .15s;
    white-space: nowrap;
    flex-shrink: 0;
}

    .tiptap-toolbar button:hover {
        background: var(--bs-secondary-bg, #e9ecef);
    }

    .tiptap-toolbar button.is-active {
        background: var(--bs-primary, #0d6efd);
        color: #fff;
        border-color: var(--bs-primary, #0d6efd);
    }

.tiptap-toolbar .sep {
    width: 1px;
    align-self: stretch;
    background: var(--bs-border-color, #ced4da);
    margin: 2px 3px;
    flex-shrink: 0;
}

.tiptap-toolbar select {
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 2px 4px;
    font-size: .82rem;
    color: var(--bs-body-color, #212529);
    background-color: var(--bs-tertiary-bg, #f8f9fa);
    cursor: pointer;
    flex-shrink: 0;
}

    .tiptap-toolbar select:hover {
        background-color: var(--bs-secondary-bg, #e9ecef);
    }

    .tiptap-toolbar select:focus {
        outline: none;
        background-color: var(--bs-secondary-bg, #e9ecef);
    }

/* 顏色按鈕 */
.tiptap-color-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 3px 6px;
    cursor: pointer;
    font-size: .82rem;
    color: var(--bs-body-color, #212529);
    line-height: 1.4;
    transition: background .15s;
}

    .tiptap-color-btn:hover {
        background: var(--bs-secondary-bg, #e9ecef);
    }

    .tiptap-color-btn .color-bar {
        display: block;
        width: 14px;
        height: 3px;
        border-radius: 2px;
        margin-top: 1px;
    }

    .tiptap-color-btn input[type=color] {
        position: absolute;
        width: 0;
        height: 0;
        opacity: 0;
        pointer-events: none;
    }

/* 表格下拉 */
.tiptap-table-dropdown {
    position: relative;
    display: inline-block;
}

.tiptap-table-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1060;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #ced4da);
    border-radius: 4px;
    min-width: 130px;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    padding: 4px 0;
}

    .tiptap-table-menu.show {
        display: block;
    }

    .tiptap-table-menu button {
        display: block;
        width: 100%;
        text-align: left;
        padding: 5px 12px;
        background: none;
        border: none;
        font-size: .82rem;
        color: var(--bs-body-color, #212529);
        cursor: pointer;
        border-radius: 0;
    }

        .tiptap-table-menu button:hover {
            background: var(--bs-secondary-bg, #e9ecef);
        }

/* 編輯內容區 */
.tiptap-content {
    padding: 0;
    /*min-height: 260px;*/
    font-size: .95rem;
    line-height: 1.7;
    color: var(--bs-body-color, #212529);
    background: var(--bs-body-bg, #fff);
}

    .tiptap-content .ProseMirror {
        padding: 12px 14px;
        /*min-height: 260px;*/
        outline: none;
        background: transparent;
        caret-color: var(--bs-body-color, #212529);
    }

    .tiptap-content p {
        margin: .3em 0;
    }

    .tiptap-content h1 {
        font-size: 1.7em;
        margin: .7em 0 .35em;
    }

    .tiptap-content h2 {
        font-size: 1.4em;
        margin: .6em 0 .3em;
    }

    .tiptap-content h3 {
        font-size: 1.15em;
        margin: .5em 0 .25em;
    }

    .tiptap-content ul,
    .tiptap-content ol {
        padding-left: 1.5em;
        margin: .3em 0;
    }

    .tiptap-content blockquote {
        border-left: 3px solid var(--bs-border-color, #ced4da);
        margin: .5em 0;
        padding: .3em .8em;
        color: #888;
    }

    .tiptap-content hr {
        border: none;
        border-top: 1px solid var(--bs-border-color, #ced4da);
        margin: .8em 0;
    }

    .tiptap-content a {
        color: var(--bs-link-color, #0d6efd);
    }

    .tiptap-content figure {
        margin: 1.2em auto;
        text-align: center;
    }

        .tiptap-content figure img {
            max-width: 100%;
            height: auto;
            display: block;
            margin: 0 auto;
        }

    .tiptap-content figcaption {
        font-size: .85em;
        color: #888;
        margin-top: .3em;
    }

    .tiptap-content img.ProseMirror-selectednode {
        outline: 2px solid var(--bs-primary, #0d6efd);
    }

    /* 表格 */
    .tiptap-content table {
        border-collapse: collapse;
        width: 100%;
        margin: .6em 0;
        table-layout: fixed;
    }

    .tiptap-content th,
    .tiptap-content td {
        border: 1px solid var(--bs-border-color, #ced4da);
        padding: 5px 8px;
        vertical-align: top;
        min-width: 40px;
    }

    .tiptap-content th {
        background: var(--bs-tertiary-bg, #f8f9fa);
        font-weight: 600;
    }

    .tiptap-content .selectedCell {
        background: rgba(13,110,253,.1);
    }
/* ─────────────────────────────────────────────────────────────────────────── */

.sticky-top {
    background-color: var(--bs-body-bg);
}

    .sticky-top tr {
        border: 1px;
    }

/* .table-responsive 的 overflow-x:auto 依規範會連帶讓 overflow-y 變成 auto，
   使自己變成捲動容器，thead.sticky-top 只會吸附在「這個容器」而非視窗（改成 overflow:visible
   雖能讓 thead 吸附視窗，卻會讓橫向捲動失去邊界、拖著整頁跑版，兩者無法只用 overflow 兼顧）。
   解法：乾脆讓 .table-responsive 自己變成固定高度、可上下捲動的框（高度由 _Layout.cshtml 的
   setTableScrollHeight() 算出），横向、縱向捲動都在同一容器內完成，thead 改貼齊「這個容器」頂端（top:0）。
   手機版 thead 是 display:none（見 .table-mobile thead），不需要這套機制，維持整頁自然捲動。 */
@media (min-width: 768px) {
    .table-responsive:has(thead.sticky-top) {
        overflow-y: auto;
    }

        .table-responsive:has(thead.sticky-top) thead.sticky-top {
            top: 0;
            z-index: 90; /* 低於篩選列的 sticky-top(100)，避免蓋住展開中的 Choices 下拉選單 */
        }
}

/* ★ 防止寬表格撐破 flex 佈局 */
main.col {
    min-width: 0;
}

html[data-bs-theme="dark"] [class*="btn-outline-"] {
    --bs-text-opacity: 1;
    color: rgba(var(--bs-white-rgb), var(--bs-text-opacity)) !important;
}

html[data-bs-theme="dark"] .choices__inner {
    /*--bs-text-opacity: 0.65;*/
    background-color: rgba(var(--bs-dark-rgb), var(--bs-text-opacity)) !important;
}

html[data-bs-theme="dark"] .choices__list--dropdown,
html[data-bs-theme="dark"] .choices__list[aria-expanded] {
    /*--bs-text-opacity: 0.65;*/
    background-color: rgba(var(--bs-dark-rgb), 1) !important;
}

html[data-bs-theme="dark"] .choices[data-type*=select-one] .choices__input {
    /*--bs-text-opacity: 0.65;*/
    background-color: rgba(var(--bs-dark-rgb), var(--bs-text-opacity)) !important;
}

html[data-bs-theme="dark"] .choices__list--dropdown .choices__item--selectable.is-highlighted,
html[data-bs-theme="dark"] .choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
    /*--bs-text-opacity: 0.65;*/
    background-color: rgba(var(--bs-white-rgb), 1) !important;
    color: rgba(var(--bs-dark-rgb), 1) !important;
}

html[data-bs-theme="light"] [class*="btn-outline-"] {
    --bs-text-opacity: 1;
    /*color: rgba(var(--bs-block-rgb), var(--bs-text-opacity)) !important;*/
}


.form-floating {
    min-width: 150px;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    min-width: 300px;
}


/* === 手機：把每個 <td> 做成「標籤｜值」兩欄，穩定不跑版 === */
@media (max-width: 767.98px) {
    /* 隱藏表頭（桌機用 d-md-xx 類別顯示即可） */
    .table-mobile thead, .table-mobile colgroup {
        display: none !important;
    }

    /* 每列做成卡片外框 */
    .table-mobile tbody tr {
        display: block;
        padding: .75rem;
        margin-top: .5rem;
        border: 1px solid var(--bs-border-color);
        border-radius: .5rem;
        background-color: var(--bs-body-bg);
    }

    /* 每個 td 自己變兩欄 grid → 左標籤、右值 */
    .table-mobile td {
        display: grid;
        grid-template-columns: 5em 1fr; /* 左欄固定寬，右欄自動撐開 */
        gap: .25rem .5rem;
        align-items: center; /* 垂直置中 */
        justify-content: start; /* 水平靠左 */
        padding: .5rem !important;
        border: 0 !important;
        min-width: 0;
        white-space: normal;
        word-break: break-word;
        text-align: start !important;
    }

        /* 強化內部元素垂直置中（避免 input / checkbox 偏移） */
        .table-mobile td > * {
            vertical-align: middle;
            align-self: center; /* 重點：確保右側元素居中 */
        }

        /* 左側標籤 */
        .table-mobile td::before {
            content: attr(data-label);
            color: var(--bs-secondary-color);
            font-size: .875rem;
            line-height: 1.2;
            align-self: center; /* ← 改成 center，而不是 start */
        }


        /* 右側內容預設靠左；數字欄保持靠右 */
        .table-mobile td.text-end {
            text-align: right;
        }

            .table-mobile td.text-end::before {
                text-align: left;
            }

        /* 置中欄位（例如狀態 badge） */
        .table-mobile td.text-center {
            text-align: left;
        }
            /* 內容仍在右欄，通常左對齊更穩 */
            .table-mobile td.text-center > * {
                justify-self: start;
            }

        /* 操作欄：佔滿一整列，按鈕好點 */
        .table-mobile td[data-full] {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            padding-top: .5rem !important;
            white-space: normal !important;
        }

            .table-mobile td[data-full]::before {
                content: none;
            }

            .table-mobile td[data-full] > div {
                flex-direction: column !important;
                width: 100%;
            }

            .table-mobile td[data-full] .btn {
                width: 100%;
            }
}

/* 桌機維持表格語義與對齊 */
@media (min-width: 768px) {
    .table-mobile th, .table-mobile td {
        vertical-align: middle;
    }
}

/* === Sidebar 選單樣式已抽出至 style_sidebar.css === */

.table td,
.table th {
    vertical-align: middle !important;
}

/* === 操作欄固定在最右側（水平捲動時不消失） === */
.sticky-col-right {
    position: sticky;
    right: 0;
    z-index: 2;
    background-color: var(--bs-card-bg, var(--bs-body-bg));
    box-shadow: -3px 0 6px rgba(0, 0, 0, .12);
}

thead .sticky-col-right {
    z-index: 3;
}

/* 手機版卡片模式不需要 sticky */
/*@media (max-width: 767.98px) {
    .sticky-col-right {
        position: static;
        box-shadow: none;
    }
}*/

/* th 縮到最小，td 只需要不換行 */
.table th {
    width: 1px !important;
    min-width: 80px;
    white-space: nowrap !important;
}

.table td {
    white-space: nowrap !important;
}

    /* 加 .col-fill 的 th/td 才撐開換行 */
    .table th.col-fill,
    .table td.col-fill {
        width: auto !important;
        white-space: normal !important;
    }

/* 沒有 .col-fill 撐開時，最後一欄自動吃掉剩餘寬度，
   避免表格右側留白（沒有儲存格覆蓋的空白，上不到表頭底色，會出現一半灰一半白的接縫）。 */
.table > thead > tr > th:last-child,
.table > tbody > tr > td:last-child {
    width: auto !important;
}

/* 確保權重夠高：同時指定 html 屬性與 Jodit 的 class */
html[data-bs-theme="dark"] .jodit-container.jodit_theme_dark {
    /* --- 核心變數強制覆寫 --- */
    --jd-color-background-default: var(--bs-body-bg) !important; /* 編輯區背景 (黑) */
    --jd-color-panel: var(--bs-tertiary-bg) !important; /* 工具列背景 (深灰) */
    --jd-color-border: var(--bs-border-color) !important; /* 邊框線條 */
    --jd-color-text: var(--bs-body-color) !important; /* 文字顏色 */
    --jd-color-icon: var(--bs-secondary-color) !important; /* Icon 顏色 */
    /* 強制設定外框顏色 */
    border-color: var(--bs-border-color) !important;
    background-color: var(--bs-body-bg) !important;
}

    /* 1. 強制覆寫工具列 (Toolbar) 背景 */
    html[data-bs-theme="dark"] .jodit-container.jodit_theme_dark .jodit-toolbar__box {
        background-color: var(--bs-tertiary-bg) !important;
        border-bottom: 1px solid var(--bs-border-color) !important;
    }

    /* 2. 強制覆寫編輯工作區 (Workplace/Editor Area) 背景 */
    html[data-bs-theme="dark"] .jodit-container.jodit_theme_dark .jodit-workplace {
        background-color: var(--bs-body-bg) !important;
        border-color: var(--bs-border-color) !important;
    }

    html[data-bs-theme="dark"] .jodit-container.jodit_theme_dark .jodit-wysiwyg {
        background-color: var(--bs-body-bg) !important;
        border-color: var(--bs-border-color) !important;
        color: var(--bs-body-color) !important;
    }

    /* 3. 強制覆寫底部狀態列 (Status Bar) */
    html[data-bs-theme="dark"] .jodit-container.jodit_theme_dark .jodit-status-bar {
        background-color: var(--bs-tertiary-bg) !important;
        border-top: 1px solid var(--bs-border-color) !important;
        color: var(--bs-secondary-color) !important;
    }

/* 4. 修正 Popup (彈出視窗) 的背景 */
html[data-bs-theme="dark"] .jodit-popup {
    background-color: var(--bs-body-bg) !important;
    border: 1px solid var(--bs-border-color) !important;
}

html[data-bs-theme="dark"] .jodit-popup__content {
    background-color: var(--bs-body-bg) !important;
    color: var(--bs-body-color) !important;
}

/* =========================================
   Jodit Popup & Dialog Dark Mode Fix
   適配 Bootstrap 5 Dark Mode
   ========================================= */

/* 1. 彈出視窗外框與背景 */
[data-bs-theme="dark"] .jodit-dialog__box,
[data-bs-theme="dark"] .jodit-popup,
[data-bs-theme="dark"] .jodit-ui-popup {
    background-color: var(--bs-body-bg) !important;
    border: 1px solid var(--bs-border-color) !important;
    color: var(--bs-body-color) !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.5) !important;
}

/* 2. 標題列 (Header) 與 底部按鈕區 (Footer) */
[data-bs-theme="dark"] .jodit-dialog__header,
[data-bs-theme="dark"] .jodit-dialog__footer {
    background-color: var(--bs-tertiary-bg) !important; /* 比背景稍亮 */
    border-color: var(--bs-border-color) !important;
    color: var(--bs-heading-color) !important;
}

[data-bs-theme="dark"] .jodit-dialog__header-title {
    color: var(--bs-body-color) !important;
}

/* 3. 輸入框 (Input/Textarea/Select) - 關鍵修正 */
[data-bs-theme="dark"] .jodit-input,
[data-bs-theme="dark"] .jodit-ui-input,
[data-bs-theme="dark"] .jodit-ui-textarea,
[data-bs-theme="dark"] .jodit-ui-select {
    background-color: var(--bs-secondary-bg) !important; /* 深灰底 */
    color: var(--bs-body-color) !important; /* 白字 */
    border: 1px solid var(--bs-border-color) !important;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

    /* 輸入框 Focus 狀態 */
    [data-bs-theme="dark"] .jodit-input:focus,
    [data-bs-theme="dark"] .jodit-ui-input:focus {
        border-color: var(--bs-primary) !important;
        box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25) !important;
        background-color: var(--bs-body-bg) !important;
    }

/* 4. Tab 按鈕 (如圖片屬性裡的 '一般' / '進階') */
[data-bs-theme="dark"] .jodit-tabs__buttons .jodit-tabs__button {
    color: var(--bs-secondary-color) !important;
    border-bottom-color: var(--bs-border-color) !important;
}

[data-bs-theme="dark"] .jodit-tabs__buttons .jodit-tabs__button_active {
    color: var(--bs-primary) !important;
    background-color: transparent !important;
    border-bottom: 2px solid var(--bs-primary) !important;
}

/* 5. 按鈕 (Buttons) */
[data-bs-theme="dark"] .jodit-ui-button_variant_primary {
    background-color: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
}

[data-bs-theme="dark"] .jodit-ui-button:not(.jodit-ui-button_variant_primary):hover {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
}

/* 6. 修正關閉按鈕 (X) */
[data-bs-theme="dark"] .jodit-dialog__header-close svg,
[data-bs-theme="dark"] .jodit-popup__header-close svg {
    filter: invert(1) grayscale(100%); /* 將黑色 icon 轉為白色 */
}


/* Bootstrap-align Choices.js sizing via CSS variables */
.choices {
    --choices-font-size-md: 1rem;
    --choices-font-size-lg: 1rem;
    --choices-input-height: calc(1.5em + 0.75rem + 2px);
    --choices-inner-padding: 0 0.75rem;
    --choices-inner-one-padding: 0;
    --choices-list-single-padding: 0.375rem 2.25rem 0.375rem 0;
    --choices-border-radius: var(--bs-border-radius);
    --choices-keyline-color: var(--bs-border-color);
    --choices-bg-color: var(--bs-body-bg);
    /* 下拉清單本身、清單文字、hover 高亮這三個變數之前沒對應，預設值 (#fff/#333/#f2f2f2)
       跟主題色系脫鉤，才會出現「輸入框跟著變灰、下拉清單卻還是純白」的不一致。 */
    --choices-bg-color-dropdown: var(--bs-body-bg);
    --choices-text-color: var(--bs-body-color);
    --choices-highlighted-color: var(--bs-tertiary-bg);
    /* 預設 z-index:1 比 Bootstrap .input-group 按鈕的 z-index:2~5（focus 態）還低，
       下拉清單展開時會被同一列的日期選擇器圖示按鈕穿透蓋過去，要蓋過所有 input-group 內部狀態 */
    --choices-z-index: 10;
    margin-bottom: 0;
}

/* Choices.js + Bootstrap 5 Form Floating Patch */
.form-floating .choices {
    margin-bottom: 0; /* 修正對齊 */
}

    /* 調整 Choices 內部高度與內距以符合 Floating 規範 */
    .form-floating .choices .choices__inner {
        padding-top: 1.625rem;
        padding-bottom: .625rem;
        height: calc(3.5rem + 2px);
        min-height: calc(3.5rem + 2px);
        border-radius: var(--bs-border-radius);
        background-color: var(--bs-body-bg);
    }

    /* 強制 Label 保持浮動狀態並置於最上層 */
    .form-floating .choices ~ label {
        opacity: 0.65;
        transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
        z-index: 5; /* 確保在 Choices 之上 */
        pointer-events: none; /* 讓點擊穿透到選單 */
    }

    /* 修正下拉箭頭位置，避免被 Padding 擠壓 */
    .form-floating .choices[data-type*="select-one"]:after {
        margin-top: -5px;
        right: 0.75rem;
    }

    /* 展開的選單需蓋過其他欄位強制浮動的 label(z-index:5)，避免被下方欄位的 label 穿透 */
    .form-floating .choices .choices__list--dropdown,
    .form-floating .choices .choices__list[aria-expanded] {
        z-index: 10;
    }

    .form-floating .choices .choices__list--single {
        /* choices__inner 已加 padding-top/bottom 讓出 label 空間，這裡不再重複疊加垂直內距 */
        padding: 0 2.25rem 0 0;
    }

    .form-floating .choices .choices__item {
        color: var(--bs-body-color);
        opacity: initial;
    }

/* ── 必填欄位提示（label 前綴紅色 * ＋輸入框左邊框變色）───────────────────────
   純 CSS 標記，不寫入 DOM 文字內容，避免影響 JS（F_Save_CK/getLbl）讀取 label 文字時混入符號 */
.form-group:has([required]) > label::before,
.form-floating:has([required]) > label::before,
.input-group:has([required]) > label::before {
    content: "*";
    color: #ff5c5c; /* 固定色值，避免部分主題下 --bs-danger 對比不足看不清楚 */
    font-family: Arial, "Segoe UI", "Helvetica Neue", sans-serif; /* 避免繼承中文字型造成星號顯示不清楚 */
    font-weight: 700;
    font-size: 1.1em;
    margin-right: 3px;
}

.form-group:has([required]) .form-control,
.form-group:has([required]) .form-select,
.form-floating:has([required]) .form-control,
.form-floating:has([required]) .form-select {
    border-left: 3px solid #ff5c5c; /* 固定色值，避免部分主題下 --bs-danger 對比不足看不清楚 */
}

/* 上面的 * 記號 (font-size:1.1em) 會讓該 label 比同一個 .row 裡沒有 * 的 label 高約 2px，
   兩個欄位並排時（例如 col-md-6 + col-md-6）底下的輸入框就會對不齊，
   統一給所有 col-form-label 固定最小高度，吃掉這個差異 */
.col-form-label {
    min-height: 2.53rem;
}

/* 巢狀 modal 層次規則已搬到 Style_Msg.css（四專案共用同一份），見該檔 .modal-nested 區塊 */
