/* ── 產品管理專用：資料卡片表格 (Data Table) ── */
.data-table {
    width: calc(100% - 4px);
    margin: 8px auto;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #003366;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
}
.data-table thead th {
    background: #003366;
    color: #ffffff;
    font-weight: 700;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 15px;
}
.data-table thead th:last-child {
    border-right: none;
}
.data-table tbody td {
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    transition: all 0.2s;
}
.data-table tbody td:last-child {
    border-right: none;
}
.data-table tbody tr:last-child td {
    border-bottom: none;
}
.data-table tbody tr:nth-child(even) td {
    background: rgba(248, 250, 252, 0.8);
}
.data-table tbody tr:hover td {
    background: #f1f5f9;
}
.data-table .mobile-text { display: none; }

@media (max-width: 768px) {
    /* 確保在窄螢幕下標題列依然顯示，以符合「所有表格一致」的要求 */
    .data-table thead { display: table-header-group; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: table; width: 100%; border-collapse: collapse; }
    .data-table tr { display: table-row; border: none; }
    .data-table td { display: table-cell; text-align: left; padding: 12px 16px; border-bottom: 1px solid #f1f5f9; position: static; }
    .data-table td::before { display: none; }
}

/* 休假加班明細：將時段或假別原先可用寬度的 20% 平分給兩個時數或天數欄。 */
@media (min-width: 769px) {
    .leave-balance-detail-wrapper {
        --leave-balance-min-table-width: 640px;
        container-type: inline-size;
        overflow-x: auto;
    }

    .data-table.leave-balance-detail-table {
        table-layout: fixed;
        min-width: var(--leave-balance-min-table-width);
        overflow-wrap: anywhere;
    }

    .leave-balance-detail-table .leave-balance-duration {
        /* 其餘欄位原先共占 540px，加上表格左右邊框共 542px。每個數量欄取得剩餘欄寬的 10%。 */
        width: calc(100px + (max(var(--leave-balance-min-table-width), 100cqi - 4px) - 542px) / 10);
    }
}

/* ── 進銷存單據明細：專業輸入表格 (Items Table) ── */
.items-table {
    width: calc(100% - 4px);
    margin: 8px auto;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 15px;
    border: 1px solid #003366;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
}
.items-table th {
    background-color: #003366;
    color: #fff;
    padding: 10px 12px;
    text-align: left;
    white-space: nowrap;
    font-weight: 600;
    font-size: 15px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}
.items-table th.right {
    text-align: right;
}
.items-table th.center {
    text-align: center;
}
.items-table th:last-child {
    border-right: none;
}
.items-table td {
    padding: 5px 6px;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    vertical-align: middle;
}
.items-table td:last-child {
    border-right: none;
}
.items-table tr:nth-child(even) td {
    background-color: rgba(248, 250, 252, 0.8);
}
.items-table tr:hover td {
    background-color: #cbd5e1 !important;
}

/* 明細行與合計區輸入框 (Cell Inputs) */
.cell-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 15px;
    font-family: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
    background: #fff;
    transition: border-color 0.2s;
}
.cell-input:focus {
    outline: none;
    border-color: #003366;
    box-shadow: 0 0 0 2px rgba(0, 51, 102, 0.1);
}

/* 數值欄位規範：支援 10 碼金額 / 8 碼數量 */
.cell-input.number { 
    text-align: right !important; 
    font-variant-numeric: tabular-nums; /* 強制等寬數字，確保垂直對齊 */
    padding-right: 6px;
}

/* 摘要/總計列 */
.summary-row td {
    background-color: #f0f4fa !important;
    font-weight: 700;
    color: #003366;
    border-top: 2px solid #003366;
}

/* ── 通用搜尋組件樣式 (Modal & Popup Picker) ── */

/* 搜尋浮層容器 (Popup Picker) */
.search-picker-popup {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    background: #fff;
    border: 2px solid #003366;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 51, 102, 0.25);
    width: 720px;
    max-width: 95vw;
    max-height: 520px;
    overflow-y: auto;
    display: none;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* 視窗標題列 (Popup/Modal Header) */
.popup-header {
    padding: 14px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}
.popup-header h3 { font-size: 16px; color: #003366; margin: 0; font-weight: 700; }
.popup-close { cursor: pointer; color: #64748b; font-size: 24px; transition: color 0.2s; }
.popup-close:hover { color: #dc2626; }

/* 搜尋框區塊 (Search Box inside Modal/Popup) */
.popup-search-area {
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 12px;
}

/* 表格容器與間距 (Table Container) */
.picker-table-container {
    padding: 0 20px 20px 20px;
}

/* Picker 專用表格樣式 */
.picker-table {
    width: calc(100% - 4px);
    margin: 8px auto;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 16px;
    border: 1px solid #003366;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
}

/* 加大 Checkbox 尺寸 */
.picker-table input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #003366;
}
.picker-table thead {
    position: sticky;
    top: 0; /* 若在 table-container 內 */
    z-index: 9;
}
.picker-table th {
    background: #003366;
    color: #ffffff;
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    border-bottom: none;
    font-size: 15px;
}
.picker-table tr.picker-row {
    cursor: pointer;
    transition: all 0.15s;
}
.picker-table tr.picker-row:hover {
    background: #f1f5f9 !important;
}
.picker-table tr.picker-row td {
    padding: 16px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}
.picker-table tr.picker-row .emp-text {
    font-weight: 700;
    color: #003366;
}
.picker-table tr.picker-row .sub-text {
    color: #64748b;
    font-size: 13px;
}
.picker-table tr.picker-row .num-text {
    text-align: right;
    font-weight: 700;
    color: #003366;
    font-family: 'Inter', sans-serif;
}

/* 強制 Modal 表格寬度與對齊 */
.modal-data-table th, .modal-data-table td {
    padding: 16px 20px !important;
    font-size: 16px !important;
}


/* ── 客戶/地址選取組合樣式 (Input + Picker Button) ── */
.cus-select-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}
.cus-select-wrap .form-control {
    flex: 1;
}
.cus-select-wrap .btn-sm {
    height: 38px;
    min-width: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    background: #003366;
    border: none;
}
.cus-select-wrap .btn-sm:hover {
    background: #004080;
}

/* ── 彈窗樣式 (Modal) ── */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #003366;
    font-size: 1.25rem;
    font-weight: 700;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: #ef4444;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f8fafc;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

/* ── 玻璃擬態卡片 (Glass Card) ── */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 51, 102, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    box-shadow: 0 12px 40px rgba(0, 51, 102, 0.1);
}

/* ── 按鈕輔助樣式 ── */
.text-danger {
    color: #dc2626 !important;
}

.text-danger:hover {
    background-color: #fef2f2 !important;
    border-color: #fecaca !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── 列表工具列 (List Toolbar) ── */
.list-toolbar-container .toolbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.list-toolbar-container .toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    flex: 1;
}

.list-toolbar-container .toolbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.list-toolbar-container .filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.list-toolbar-container .filter-item span {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
}

.list-toolbar-container .filter-item .form-control {
    width: 150px;
    padding: 8px 12px;
    border-radius: 8px;
}

.list-toolbar-container .search-box {
    width: 250px;
    position: relative;
}

.list-toolbar-container .search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.list-toolbar-container .search-box .form-control {
    padding-left: 36px;
    border-radius: 8px;
}
/* 統一日期輸入元件：文字輸入搭配原生月曆選擇器。 */
.date-input {
    display: flex;
    flex: 1;
    min-width: 0;
    position: relative;
}

.date-input [data-date-display] {
    flex: 1;
    min-width: 0;
}

.date-input .date-picker-btn {
    flex: 0 0 auto;
}

.date-input-native {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* HR 未審核單據查詢：驗證與唯讀提示共用樣式。 */
.reauth-card {
    max-width: 720px;
    margin: 0 auto 24px;
    padding: 28px;
}

.reauth-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
}

.readonly-notice {
    margin: 0 0 18px;
    padding: 12px 16px;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 14px;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .reauth-grid { grid-template-columns: 1fr; }
}


/* ── 二次驗證外殼 (Re-auth Login Shell) ── */
.reauth-login-shell .login-container { min-height: 430px; padding: 10px 20px 28px; }
.reauth-login-shell .login-box { max-width: 520px; }
.reauth-login-shell .login-box .form-group { display:flex; align-items:center; gap:12px; margin-bottom:20px; }
.reauth-login-shell .login-box .form-label { width:100px; min-width:100px; margin-bottom:0; text-align:right; white-space:nowrap; }
.reauth-login-shell .login-box .form-control-wrapper { flex:1; }
.reauth-login-shell .login-box .form-control { width:100%; }
.reauth-login-shell .login-note { margin:0 0 22px; color:#64748b; font-size:14px; line-height:1.6; text-align:left; }
.reauth-login-shell #verify-message { min-height:20px; margin:14px 0 0; color:#b91c1c; font-size:14px; text-align:center; }
@media (max-width: 560px) {
    .reauth-login-shell .login-box { padding:28px 22px; }
    .reauth-login-shell .login-box .form-group { display:block; margin-bottom:16px; }
    .reauth-login-shell .login-box .form-label { display:block; width:auto; text-align:left; margin-bottom:6px; }
}

/* ── 頁面內容通用區塊 ── */
.page-content { padding: 0 30px 30px; }
@media (max-width: 560px) { .page-content { padding:0 12px 20px; } }
.setting-area, .query-area { display: none; }
.setting-area.visible, .query-area.visible { display: block; }

/* ── 設定卡片 (Config Card) ── */
.config-card { background: #fff; border-radius: 8px; padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.config-card h2 { font-size: 16px; margin-top: 0; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid #e2e8f0; color: #1e293b; }
.form-row { display: flex; gap: 20px; margin-bottom: 15px; }
.form-col { flex: 1; display: flex; align-items: center; gap: 10px; }
.form-col .form-label { margin-bottom: 0; min-width: 110px; text-align: right; font-weight: 500; font-size: 14px; color: #475569; flex-shrink: 0; }

/* 排班參數沿用共用卡片與表單，僅補足矩陣及設定區排列。 */
.schedule-settings [hidden] { display: none !important; }
.schedule-settings .schedule-summary { display:flex; flex-wrap:wrap; align-items:center; gap:12px 24px; padding:18px 20px; margin-bottom:18px; background:#eef5fc; border:1px solid #dbe7f3; border-radius:10px; color:#003366; }
.schedule-settings .schedule-summary strong { margin-left:12px; }
.schedule-settings .schedule-summary p { margin:0; color:#475569; font-size:14px; }
.schedule-settings .schedule-tabs { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:18px; }
.schedule-settings .schedule-tabs button { border:1px solid #cbd5e1; background:#fff; color:#475569; padding:12px 20px; border-radius:8px; font:inherit; cursor:pointer; }
.schedule-settings .schedule-tabs button[aria-selected="true"] { background:#003366; color:#fff; border-color:#003366; }
.schedule-settings .schedule-help { color:#64748b; line-height:1.7; font-size:14px; margin-bottom:18px; }
.schedule-settings .schedule-message { min-height:24px; margin-bottom:14px; color:#166534; }
.schedule-settings .schedule-message.is-error { color:#b91c1c; }
.schedule-settings .schedule-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:18px; }
.schedule-settings .schedule-filters { display:flex; align-items:flex-end; gap:16px; flex-wrap:wrap; margin-bottom:20px; }
.schedule-settings .schedule-filters label { min-width:180px; flex:0 1 260px; }
.schedule-settings label > span { display:block; margin-bottom:7px; font-weight:500; font-size:14px; color:#475569; }
.schedule-settings .schedule-form-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px 22px; }
.schedule-settings .schedule-date-field > label { display:block; margin-bottom:7px; font-weight:500; font-size:14px; color:#475569; }
.schedule-settings .date-input .date-picker-btn { height:40px; padding:0 14px; }
.schedule-settings .schedule-staff-input { min-width:100px; max-width:160px; }
.schedule-settings .schedule-demand-scroll { max-height:580px; overflow:auto; }
.schedule-settings .schedule-demand-scroll .schedule-demand-table { display:table !important; min-width:100% !important; width:max-content !important; margin:0 !important; background:#fff !important; }
.schedule-settings .schedule-demand-table thead { display:table-header-group !important; }
.schedule-settings .schedule-demand-table tbody { display:table-row-group !important; }
.schedule-settings .schedule-demand-table tr { display:table-row !important; border:0 !important; box-shadow:none !important; }
.schedule-settings .schedule-demand-table th,.schedule-settings .schedule-demand-table td { display:table-cell !important; width:auto !important; padding:12px !important; white-space:nowrap !important; }
.schedule-settings .schedule-demand-table td::before { display:none !important; content:none !important; }
.schedule-settings .schedule-demand-scroll { overflow:auto !important; }
.schedule-settings .schedule-demand-table th { position:sticky; top:0; z-index:2; background:#eef5fc; color:#003366; }
.schedule-settings .schedule-demand-table td:first-child,.schedule-settings .schedule-demand-table th:first-child { position:sticky; left:0; white-space:nowrap; background:#f8fafc; z-index:1; }
.schedule-settings .schedule-demand-table th:first-child { z-index:3; }
.schedule-settings .schedule-list-title { margin-top:30px; }
.employee-shifts .employee-shift-heading { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin-bottom:16px; }
.employee-shifts .employee-shift-heading h2 { margin:0; flex:1; }
.employee-shifts .employee-shift-badge { padding:5px 12px; border-radius:16px; background:#eef5fc; color:#003366; font-size:13px; }
.employee-shifts .employee-shift-enable { display:flex; align-items:center; gap:10px; margin-bottom:20px; }
.employee-shifts .employee-shift-enable > span { margin:0; }
.employee-shifts .employee-shift-warning { padding:12px 16px; background:#fffbeb; color:#92400e; border-radius:8px; margin-bottom:18px; }
.employee-shifts .employee-shift-note { margin-top:16px; }
.employee-shifts .schedule-demand-table th { max-width:260px; white-space:normal !important; }
.employee-shifts .schedule-demand-table td:not(:first-child) { text-align:center; }
.employee-shifts [type="checkbox"] { width:18px; height:18px; accent-color:#003366; }
.schedule-settings .schedule-rule-actions { display:flex; flex-wrap:nowrap; align-items:center; justify-content:center; gap:8px; }
.schedule-settings .schedule-rule-actions .btn { padding:4px 8px; min-width:30px; height:26px; border-radius:4px; font-size:14px; gap:0; }
.schedule-settings .schedule-rule-actions .btn-danger { background:#ef4444; color:#fff; border:0; }
.schedule-settings .schedule-rule-actions .btn-danger:hover { background:#dc2626; color:#fff; }
.schedule-settings .schedule-rule-date { white-space:nowrap; }
.schedule-settings-shell .schedule-confirm-dialog { border:0; border-radius:12px; padding:24px; max-width:420px; width:calc(100% - 32px); color:#1e293b; box-shadow:0 20px 60px #0003; }
.schedule-settings-shell .schedule-confirm-dialog::backdrop { background:#0f172a80; }
.schedule-settings-shell .schedule-confirm-dialog h2 { margin-bottom:16px; color:#003366; }
.schedule-settings-shell .schedule-confirm-dialog p { margin-bottom:12px; }
.schedule-settings-shell .schedule-dialog-actions { display:flex; justify-content:flex-end; gap:12px; margin-top:24px; }
.schedule-settings .schedule-departments { margin:0 0 20px; padding:14px 16px; border:1px solid #cbd5e1; border-radius:8px; }
.schedule-settings .schedule-departments legend { padding:0 6px; color:#475569; font-size:14px; }
.schedule-settings .schedule-department-options { display:flex; flex-wrap:wrap; gap:12px 24px; }
.schedule-settings .schedule-department-options label { display:flex; gap:8px; align-items:center; cursor:pointer; }
.schedule-settings .schedule-department-options label > span { margin:0; }
.schedule-settings input[type="checkbox"] { width:18px; height:18px; accent-color:#003366; }
.schedule-settings button:disabled { opacity:.55; cursor:wait; }
.schedule-settings button:focus-visible { outline:3px solid #60a5fa; outline-offset:2px; }
@media (max-width:1000px) { .schedule-settings .schedule-form-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:600px) { .schedule-settings .schedule-form-grid { grid-template-columns:1fr; } .schedule-settings .schedule-filters label { flex:1 1 100%; } .schedule-settings .schedule-tabs button { flex:1 1 auto; padding:10px; } }

/* ── 其他共用元件 ── */
.type-badge { display:inline-block; padding:4px 10px; border-radius:999px; font-size:15px; font-weight:600; }
.type-leave { background:#eff6ff; color:#1d4ed8; }
.type-overtime { background:#f5f3ff; color:#6d28d9; }
.empty-state { padding: 54px; text-align: center; color: #64748b; }
.empty-state i { display:block; margin-bottom:12px; font-size:42px; color:#94a3b8; }
.json-editor { width: 100%; height: 300px; font-family: monospace; font-size: 13px; padding: 10px; border: 1px solid #cbd5e1; border-radius: 4px; resize: vertical; }

/* ── 請假申請剩餘時數提示 ── */
.leave-balance-summary {
    margin-top: 8px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}
.leave-balance-summary.is-loading { color: #64748b; }
.leave-balance-summary.is-ready { color: #15803d; font-weight: 600; }
.leave-balance-summary.is-warning { color: #b45309; }
.leave-balance-summary.is-insufficient { color: #b91c1c; font-weight: 700; }
.leave-balance-row {
    display: block;
    grid-column: span 2;
    margin-top: -2px;
    padding-left: 122px;
    text-align: left;
}
.leave-balance-row .leave-balance-summary { margin-top: 0; }
@media (max-width: 768px) {
    .leave-balance-row {
        grid-column: span 1;
        padding-left: 93px;
    }
}


/* 員工每週班別矩陣：固定左側員工資訊，七日班別可水平捲動。 */
.employee-shifts .employee-week-matrix-scroll { max-height:70vh; overflow:auto; isolation:isolate; }
.employee-shifts .employee-week-matrix { min-width:0; width:max-content; border-collapse:separate; border-spacing:0; table-layout:auto; }
.employee-shifts .employee-week-matrix th:first-child { width:auto; }
.employee-shifts .employee-week-matrix thead th { position:sticky; top:0; z-index:2; text-align:center; white-space:normal; background:#003366; color:#fff; }
.employee-shifts .employee-week-matrix thead th:first-child { left:0; z-index:4; }
.employee-shifts .employee-week-matrix .employee-week-identity { position:sticky; left:0; z-index:1; background:#f5f9fe; color:#003366; text-align:left; font-weight:400; box-shadow:2px 0 3px #00336612; }
.employee-shifts .employee-week-identity > strong { display:block; overflow-wrap:anywhere; }
.employee-shifts .employee-week-department { display:block; margin:5px 0; color:#64748b; font-size:13px; }
.employee-shifts .employee-week-identity .employee-shift-enable { margin:12px 0 0; }
.employee-shifts .employee-week-identity .employee-shift-warning { margin:12px 0 0; padding:8px; font-size:13px; }
.employee-shifts .employee-week-matrix td { vertical-align:top; text-align:left; }
.employee-shifts .employee-week-choices { display:flex; flex-direction:column; gap:4px; }
.employee-shifts .employee-week-choice { display:flex; align-items:flex-start; gap:6px; margin:0; cursor:pointer; white-space:nowrap; }
.employee-shifts .employee-week-choice input { flex:none; margin-top:3px; }
.employee-shifts .employee-week-choice > span { margin:0; overflow-wrap:anywhere; }


/* 矩陣在窄螢幕維持表格，避免一般手機資料表卡片規則改變星期欄位。 */
.employee-shifts .employee-week-matrix-scroll { overflow:auto !important; max-width:100%; }
.employee-shifts table.employee-week-matrix { display:table !important; min-width:0 !important; width:max-content !important; background:#fff !important; }
.employee-shifts .employee-week-matrix thead { display:table-header-group !important; }
.employee-shifts .employee-week-matrix tbody { display:table-row-group !important; width:auto !important; }
.employee-shifts .employee-week-matrix tr { display:table-row !important; width:auto !important; margin:0 !important; padding:0 !important; border:0 !important; border-radius:0 !important; box-shadow:none !important; overflow:visible; }
.employee-shifts .employee-week-matrix td,.employee-shifts .employee-week-matrix th { display:table-cell !important; padding:6px 8px !important; white-space:normal !important; border-bottom:1px solid #dbe5f1; }
.employee-shifts .employee-week-matrix td { width:auto !important; }
.employee-shifts .employee-week-matrix td::before { display:none !important; content:none !important; }

.employee-shifts .employee-week-matrix tbody .employee-week-identity { background:#f5f9fe !important; color:#003366 !important; font-weight:400 !important; }
.employee-shifts .employee-week-matrix th:first-child { width:auto !important; }


.employee-shifts .employee-week-identity > strong { white-space:nowrap; }
.employee-shifts .employee-week-identity .employee-shift-enable { margin:6px 0 0; white-space:nowrap; }
.employee-shifts .employee-week-identity > p { max-width:180px; margin:6px 0 0; }
.employee-shifts .employee-week-choice > span { white-space:nowrap; }

/* 智慧排班沿用共用品牌色與卡片，維持原排班作業的員工／整月日期矩陣。 */
.smart-schedule .smart-legend { display:flex; flex-wrap:wrap; gap:8px 14px; }
.smart-schedule .smart-legend > span { padding:6px 10px; border-radius:6px; }
.smart-schedule .smart-table-scroll { overflow:auto !important; max-height:68vh; max-width:100%; isolation:isolate; }
.smart-schedule .smart-month-table { display:table !important; border-collapse:separate; border-spacing:0; width:max-content; font-size:14px; }
.smart-schedule .smart-month-table th,.smart-schedule .smart-month-table td { display:table-cell !important; padding:8px 6px; min-width:94px; border-right:1px solid #dbe5f1; border-bottom:1px solid #dbe5f1; text-align:center; white-space:nowrap; }
.smart-schedule .smart-month-table thead th { position:sticky; top:0; z-index:3; color:#fff; background:#003366; }
.smart-schedule .smart-month-table small { display:block; font-weight:400; margin-top:4px; }
.smart-schedule .smart-month-table tr > :first-child { position:sticky; left:0; z-index:2; min-width:150px; max-width:210px; white-space:normal; background:#eef5fc; color:#003366; text-align:left; }
.smart-schedule .smart-month-table thead th:first-child { z-index:4; color:#fff; background:#003366; }
.smart-schedule .smart-stats { max-width:230px; white-space:normal !important; }
.smart-schedule .smart-cell-kind-W { background:#e8f5e9; color:#14532d; }
.smart-schedule .smart-cell-kind-R { background:#8b4513; color:#fff; }
.smart-schedule .smart-cell-kind-H { background:#0f766e; color:#fff; }
.smart-schedule .smart-cell-kind-N { background:#9f1239; color:#fff; }
.smart-schedule .smart-cell-kind-L { background:#fef3c7; color:#92400e; }
.smart-schedule .smart-cell-kind-O { background:#ede9fe; color:#5b21b6; }
.smart-schedule .smart-cell-kind-U,.smart-schedule .smart-cell-kind-X { background:#f1f5f9; color:#64748b; }
.smart-schedule .smart-shortage { background:#fff1f2; color:#b91c1c; font-weight:600; }
.smart-schedule .smart-issues { line-height:1.8; padding-left:24px; max-height:400px; overflow:auto; }

/* 智慧排班草稿沿用排班作業的雙列表頭與窄格輸入。 */
.smart-schedule .smart-legend { display:block; }
.smart-schedule .smart-class-reference { margin-bottom:18px; }
.smart-schedule .smart-class-reference th:first-child { width:60px; text-align:center; }
.smart-schedule .smart-class-reference th:nth-child(2) { width:100px; text-align:center; }
.smart-schedule .smart-class-reference td:nth-child(2) { text-align:center; font-weight:800; color:#003366; }
.smart-schedule .smart-class-reference td:nth-child(3) { font-weight:600; color:#003366; }
.smart-schedule .smart-class-reference td:nth-child(4),.smart-schedule .smart-class-reference td:nth-child(5) { font-size:14px; }
.smart-schedule .smart-class-reference th:last-child,.smart-schedule .smart-class-reference td:last-child { text-align:right; }
.smart-schedule .smart-class-reference td:last-child { font-weight:700; color:#003366; }
.smart-schedule .smart-class-color { display:flex; align-items:center; justify-content:center; gap:8px; font-size:13px; font-weight:600; color:#64748b; }
.smart-schedule .smart-class-swatch { display:inline-block; flex-shrink:0; width:24px; height:24px; border:1px solid #e2e8f0; border-radius:4px; }
.smart-schedule .smart-day-badges { display:flex; flex-wrap:wrap; gap:10px; }
.smart-schedule .smart-day-badges span { padding:6px 12px; border-radius:12px; }
.smart-schedule .smart-edit-table { font-size:13px; }
.smart-schedule .smart-edit-table th,.smart-schedule .smart-edit-table td { min-width:48px; padding:8px 4px; }
.smart-schedule .smart-edit-table tbody tr > :first-child { min-width:78px; max-width:140px; white-space:nowrap; padding:8px 12px; background:#f8fafc; }
.smart-schedule .smart-edit-table thead tr:first-child th { height:38px; box-sizing:border-box; }
.smart-schedule .smart-edit-table thead tr:nth-child(2) th { top:38px; }
.smart-schedule .smart-edit-table thead tr:nth-child(2) th:first-child { left:auto; z-index:3; min-width:48px; max-width:none; text-align:center; white-space:nowrap; }
.smart-schedule .smart-edit-table thead th[rowspan] { min-width:78px; background:#002244; }
.smart-schedule .smart-edit-table .smart-weekend { background:#fef2f2 !important; color:#ef4444 !important; }
.smart-schedule .smart-edit-input { width:40px; height:32px; padding:0; border:1px solid #cbd5e1; border-radius:4px; font-size:13px; font-weight:600; text-align:center; box-sizing:border-box; }
.smart-schedule .smart-edit-input:focus { outline:2px solid #0066cc; outline-offset:1px; }
.smart-schedule .smart-edit-input:disabled { opacity:1; cursor:default; }
.smart-schedule .smart-cell-kind-INVALID { border-color:#ef4444; background:#fee2e2; color:#b91c1c; }
.smart-schedule .smart-edit-table .smart-stats { min-width:160px; }
.smart-schedule .smart-table-scroll[hidden] { display:none !important; }

/* 姓名欄依文字縮至最窄，底部完整統計名稱換行以免撐寬。 */
.smart-schedule .smart-edit-table thead tr:first-child th:first-child,
.smart-schedule .smart-edit-table tbody tr > :first-child { width:1px; min-width:0; max-width:none; padding-left:6px; padding-right:6px; white-space:nowrap; }
.smart-schedule .smart-edit-table tfoot tr > :first-child { width:1px; min-width:0; max-width:none; padding-left:6px; padding-right:6px; white-space:nowrap; }

/* 排班作業其他休假沿用智慧排班日別色。 */
.schedule-input.val-假 { background:#ede9fe; color:#5b21b6; border-color:#c4b5fd; }
.badge-o { background:#ede9fe; color:#5b21b6; padding:6px 12px; border-radius:12px; font-size:14px; font-weight:600; }


/* 智慧排班月份欄縮窄，保留原生月份與日曆操作。 */
.smart-schedule .schedule-filters label.smart-month-filter { flex:0 0 170px; min-width:0; width:170px; max-width:100%; }
.smart-schedule .smart-month-filter input { width:100%; min-width:0; box-sizing:border-box; }

/* 智慧排班匯出與發布操作置於班表下方靠右，窄畫面可換行。 */
.smart-schedule .smart-roster-actions { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:16px; margin-top:18px; }

/* 員工排班日別圖例與智慧排班採相同文字及配色。 */
.schedule-day-badges { flex-wrap:wrap; }
.schedule-day-badges > div { padding:6px 12px; border-radius:12px; font-size:16px; font-weight:400; }
.schedule-day-badges .badge-l { background:#fef3c7; color:#92400e; }

/* 預先指定欄位與標籤同列，日期沿用共用日曆選取元件。 */
.smart-fixed-off-fields { display:flex; flex-wrap:nowrap; align-items:center; gap:16px; margin:14px 0; overflow-x:auto; padding-bottom:4px; }
.smart-fixed-off-fields > label,.smart-fixed-off-fields .smart-fixed-off-date { display:flex; flex:0 0 auto; flex-direction:row; align-items:center; gap:8px; width:auto; max-width:none; white-space:nowrap; }
.smart-fixed-off-fields .smart-fixed-off-date > label { margin:0; }
.smart-fixed-off-fields .form-control { width:140px; box-sizing:border-box; }
.smart-fixed-off-fields #fixed-off-employee { width:200px; }
.smart-fixed-off-fields .smart-fixed-off-date .date-input { width:200px; flex:none; }
.smart-fixed-off-fields .smart-fixed-off-date .date-picker-btn { height:40px; padding:0 12px; }
.smart-fixed-off-fields > button { flex:0 0 auto; white-space:nowrap; }
