/**
 * BIM 管理系統 - 主樣式表 (Main Stylesheet)
 * 
 * 此檔案作為 CSS 架構的入口點，負責導入所有模組。
 * 
 * CSS 架構:
 * ├── design-tokens.css  - 設計變數系統
 * ├── utilities.css      - Tailwind 相容工具類
 * ├── table-standards.css - 表格欄位寬度標準
 * ├── base.css           - 基礎樣式、動畫、列印
 * ├── layout.css         - 版面配置 (sidebar, header)
 * ├── components.css     - UI 元件 (buttons, forms, tables)
 * └── main.css           - 功能特定樣式 (本檔案)
 * 
 * 版本: 2.0.0
 * 更新日期: 2024-12-20
 */

/* ===== 核心樣式導入 ===== */
@import url('design-tokens.css');
@import url('utilities.css');
@import url('table-standards.css');
@import url('base.css');
@import url('layout.css');
@import url('components.css');

/* ===== 功能特定樣式 ===== */
/* 以下樣式為各功能模組專用，尚未適合獨立為單獨檔案 */

/* ===== Task Table Styles ===== */

/* 固定表格佈局 - 確保欄寬嚴格遵循設定 */
#view-tasks .table-standard {
    table-layout: fixed;
    width: 100%;
}

/* 統一欄位寬度與對齊 (nth-child 控制) */
/* 欄位順序: 1完成 | 2選擇 | 3任務名稱 | 4執行細節 | 5執行人員 | 6完成時間 | 7所需天數 | 8開始日期 | 9積分 | 10操作 */

#view-tasks .table-standard th,
#view-tasks .table-standard td {
    padding: 0.75rem 0.5rem;
    white-space: nowrap;
    text-align: center;
    /* 預設置中 */
}

/* 第1欄: 完成 (50px) */
#view-tasks .table-standard th:nth-child(1),
#view-tasks .table-standard td:nth-child(1) {
    width: 50px;
}

/* 第2欄: 選擇 (50px) */
#view-tasks .table-standard th:nth-child(2),
#view-tasks .table-standard td:nth-child(2) {
    width: 50px;
}

/* 第3欄: 任務名稱 (auto, 靠左) */
#view-tasks .table-standard th:nth-child(3),
#view-tasks .table-standard td:nth-child(3) {
    text-align: left;
}

/* 第4欄: 執行細節 (80px) */
#view-tasks .table-standard th:nth-child(4),
#view-tasks .table-standard td:nth-child(4) {
    width: 80px;
}

/* 第5欄: 執行人員 (100px) */
#view-tasks .table-standard th:nth-child(5),
#view-tasks .table-standard td:nth-child(5) {
    width: 100px;
}

/* 第6欄: 完成時間 (150px) */
#view-tasks .table-standard th:nth-child(6),
#view-tasks .table-standard td:nth-child(6) {
    width: 150px;
}

/* 第7欄: 所需天數 (80px) */
#view-tasks .table-standard th:nth-child(7),
#view-tasks .table-standard td:nth-child(7) {
    width: 80px;
}

/* 第8欄: 開始日期 (110px) */
#view-tasks .table-standard th:nth-child(8),
#view-tasks .table-standard td:nth-child(8) {
    width: 110px;
}

/* 第9欄: 積分 (80px) */
#view-tasks .table-standard th:nth-child(9),
#view-tasks .table-standard td:nth-child(9) {
    width: 80px;
}

/* 第10欄: 操作 (80px) */
#view-tasks .table-standard th:nth-child(10),
#view-tasks .table-standard td:nth-child(10) {
    width: 80px;
}

/* 選中列高亮 */
.task-row-selected {
    background-color: var(--color-indigo-50, #eef2ff) !important;
}

/* ===== 批次操作工具列 ===== */
.batch-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    background-color: var(--color-gray-100, #f3f4f6);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    min-height: 44px;
}

.batch-toolbar-default {
    display: flex;
    align-items: center;
}

.batch-select-all-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--color-gray-700, #374151);
}

.batch-toolbar-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.batch-toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.batch-selected-count {
    font-weight: 600;
    color: var(--color-indigo-600, #4f46e5);
}

.batch-cancel-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    color: var(--color-gray-600, #4b5563);
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: underline;
}

.batch-cancel-btn:hover {
    color: var(--color-gray-900, #111827);
}

.batch-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.batch-action-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    color: var(--color-gray-700, #374151);
    background: white;
    border: 1px solid var(--color-gray-300, #d1d5db);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s;
}

.batch-action-btn:hover {
    background: var(--color-gray-50, #f9fafb);
    border-color: var(--color-indigo-400, #818cf8);
    color: var(--color-indigo-600, #4f46e5);
}

/* ===== 標籤管理表格 (project-tags, source-tags, conflict-tags) ===== */
#view-project-tags .table-standard,
#view-source-tags .table-standard,
#view-conflict-tags .table-standard {
    table-layout: fixed;
    width: 100%;
}

#view-project-tags .table-standard th,
#view-project-tags .table-standard td,
#view-source-tags .table-standard th,
#view-source-tags .table-standard td,
#view-conflict-tags .table-standard th,
#view-conflict-tags .table-standard td {
    text-align: left;
}

/* 第1欄: 選擇 (80px，靠左貼齊) */
#view-project-tags .table-standard th:nth-child(1),
#view-project-tags .table-standard td:nth-child(1),
#view-source-tags .table-standard th:nth-child(1),
#view-source-tags .table-standard td:nth-child(1),
#view-conflict-tags .table-standard th:nth-child(1),
#view-conflict-tags .table-standard td:nth-child(1) {
    width: 80px;
    text-align: center;
    white-space: nowrap;
}

/* 第2欄: 標籤名稱 (自動填滿剩餘空間) */
#view-project-tags .table-standard th:nth-child(2),
#view-project-tags .table-standard td:nth-child(2),
#view-source-tags .table-standard th:nth-child(2),
#view-source-tags .table-standard td:nth-child(2),
#view-conflict-tags .table-standard th:nth-child(2),
#view-conflict-tags .table-standard td:nth-child(2) {
    width: auto;
}

/* 第3欄: 使用次數 (100px，置中) */
#view-project-tags .table-standard th:nth-child(3),
#view-project-tags .table-standard td:nth-child(3),
#view-source-tags .table-standard th:nth-child(3),
#view-source-tags .table-standard td:nth-child(3),
#view-conflict-tags .table-standard th:nth-child(3),
#view-conflict-tags .table-standard td:nth-child(3) {
    width: 100px;
    text-align: center;
    white-space: nowrap;
}

/* 第4欄: 操作 (100px，置中) */
#view-project-tags .table-standard th:nth-child(4),
#view-project-tags .table-standard td:nth-child(4),
#view-source-tags .table-standard th:nth-child(4),
#view-source-tags .table-standard td:nth-child(4),
#view-conflict-tags .table-standard th:nth-child(4),
#view-conflict-tags .table-standard td:nth-child(4) {
    width: 100px;
    text-align: center;
    white-space: nowrap;
}

/* ===== 積分統計表格 ===== */
#view-points .table-standard {
    table-layout: fixed;
    width: 100%;
}

/* 第1欄: 執行人員 (75%) */
#view-points .table-standard th:nth-child(1),
#view-points .table-standard td:nth-child(1) {
    width: 75%;
    text-align: left;
}

/* 第2欄: 總積分 (25%, 靠右) */
#view-points .table-standard th:nth-child(2),
#view-points .table-standard td:nth-child(2) {
    text-align: right;
}

/* ===== 使用者管理表格 ===== */
/* 欄位順序: 1登入帳號 | 2姓名 | 3狀態 | 4角色 | 5操作 */
#view-users .table-standard {
    table-layout: fixed;
    width: 100%;
}

#view-users .table-standard th,
#view-users .table-standard td {
    text-align: left;
}

/* 第5欄: 操作 (置中) */
#view-users .table-standard th:nth-child(5),
#view-users .table-standard td:nth-child(5) {
    text-align: center;
}

/* ===== 專案列表表格 ===== */
/* 欄位順序: 1專案名稱 | 2專案編號 | 3啟動日期 | 4專案標籤 | 5完成度 | 6操作 */
#view-projects .table-standard {
    table-layout: fixed;
    width: 100%;
}

#view-projects .table-standard th,
#view-projects .table-standard td {
    text-align: left;
}

/* 第1欄: 專案名稱 (30%) */
#view-projects .table-standard th:nth-child(1),
#view-projects .table-standard td:nth-child(1) {
    width: 30%;
}

/* 第4欄: 專案標籤 (20%) */
#view-projects .table-standard th:nth-child(4),
#view-projects .table-standard td:nth-child(4) {
    width: 20%;
}

/* 第5欄: 完成度 (置中) */
#view-projects .table-standard th:nth-child(5),
#view-projects .table-standard td:nth-child(5) {
    text-align: center;
}

/* 第6欄: 操作 (置中) */
#view-projects .table-standard th:nth-child(6),
#view-projects .table-standard td:nth-child(6) {
    text-align: center;
}

/* ===== 議題總表表格 ===== */
/* 欄位順序: 1完成 | 2編號 | 3檢討類型 | 4條件/位置 | 5內容說明 | 6重要程度 | 7對策 */
#view-issue-summary .table-standard {
    table-layout: fixed;
    width: 100%;
}

#view-issue-summary .table-standard th,
#view-issue-summary .table-standard td {
    text-align: left;
}

/* 第1欄: 完成 (4%, 置中) */
#view-issue-summary .table-standard th:nth-child(1),
#view-issue-summary .table-standard td:nth-child(1) {
    width: 4%;
    text-align: center;
}

/* 第2欄: 編號 (6%) */
#view-issue-summary .table-standard th:nth-child(2),
#view-issue-summary .table-standard td:nth-child(2) {
    width: 6%;
}

/* 第3欄: 檢討類型 (12%) */
#view-issue-summary .table-standard th:nth-child(3),
#view-issue-summary .table-standard td:nth-child(3) {
    width: 12%;
    white-space: nowrap;
}

/* 第4欄: 條件/位置 (14%) */
#view-issue-summary .table-standard th:nth-child(4),
#view-issue-summary .table-standard td:nth-child(4) {
    width: 14%;
}

/* 第5欄: 內容說明 (24%) */
#view-issue-summary .table-standard th:nth-child(5),
#view-issue-summary .table-standard td:nth-child(5) {
    width: 24%;
}

/* 第6欄: 重要程度 (8%, 置中) */
#view-issue-summary .table-standard th:nth-child(6),
#view-issue-summary .table-standard td:nth-child(6) {
    width: 8%;
    text-align: center;
}

/* 第7欄: 對策 (32%) */
#view-issue-summary .table-standard th:nth-child(7),
#view-issue-summary .table-standard td:nth-child(7) {
    width: 32%;
}

/* --- Task Field Unified Height Styles --- */
.task-field-input,
.task-field-display {
    display: inline-block;
    height: 30px;
    padding: 0 0.5rem;
    font-size: 0.875rem;
    line-height: 30px;
    border-radius: 0.25rem;
    box-sizing: border-box;
    vertical-align: middle;
}

.task-field-input {
    background-color: #fff;
    border: 1px solid #d1d5db;
}

.task-field-display {
    text-align: center;
    background-color: transparent;
    border: 1px solid transparent;
}

.task-field-date {
    width: 140px;
    text-align: center;
}

.task-field-number {
    width: 60px;
    text-align: center;
}

.task-field-unit {
    font-size: 0.875rem;
    color: #6b7280;
    vertical-align: middle;
}

.task-row .task-name-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.task-row .duration-input {
    width: 60px;
    text-align: center;
}

.task-row .points-input {
    width: 55px;
    text-align: right;
}

.points-cell {
    width: 100px;
}

.task-row input:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
}

.task-row.completed {
    color: #9ca3af;
    background-color: #f3f4f6;
}

.task-row.completed input,
.task-row.completed .task-name-input {
    background-color: #f3f4f6;
}

.task-row.completed .action-icon,
.task-row.completed .text-indigo-600 {
    color: #9ca3af;
}

.points-display {
    display: inline-block;
    padding-right: 1.25rem;
    text-align: right;
}

.compact-button {
    padding: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    background: none;
    border: none;
    cursor: pointer;
}

.compact-button>i {
    margin-right: 0.25rem;
}

/* ===== Action Icons & Controls ===== */
.action-icon {
    appearance: none;
    -webkit-appearance: none;
    margin: 0 2px;
    padding: 2px;
    font-size: 0.9rem;
    color: #6b7280;
    background-color: transparent !important;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.action-icon:hover {
    color: #1f2937;
}

.action-icon.disabled {
    color: #d1d5db;
    cursor: not-allowed;
}

.delete-icon:hover {
    color: #ef4444;
}

.drag-handle {
    cursor: grab;
}

/* ===== SortableJS Styles ===== */
.sortable-ghost {
    background: #c7d2fe;
    opacity: 0.5;
}

.sortable-drag {
    opacity: 1 !important;
}

/* ===== Points Table & Expandable Rows ===== */
.expandable-row {
    cursor: pointer;
}

.expandable-row:hover {
    background-color: #f9fafb;
}

.task-points-details>td {
    padding: 0 !important;
}

.task-points-details table {
    width: 100%;
    background-color: #f9fafb;
}

.task-points-details table td {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.task-points-details table tr:last-child td {
    border-bottom: none;
}

.task-points-details .points-task-name {
    padding-left: 3rem !important;
}

/* ===== Issues Dashboard ===== */
.stats-bar {
    display: flex;
    gap: 2rem;
    padding: 1.25rem;
    margin-bottom: 25px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.stat-item {
    text-align: center;
}

.stat-item .value {
    font-size: 2em;
    font-weight: 700;
    color: #0056b3;
}

.stat-item .label {
    font-size: 0.9em;
    color: #6c757d;
}

.tag {
    display: inline-block;
    padding: 4px 8px;
    margin: 2px;
    font-size: 0.85em;
    color: #495057;
    background-color: #e9ecef;
    border-radius: 4px;
}

/* ===== Dashboard ===== */
.dashboard-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.dashboard-card {
    padding: 1.5rem;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* ===== Popover & Standards Popover ===== */
.standards-popover {
    position: absolute;
    z-index: 100;
    min-width: 200px;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.standards-popover .popover-item-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s;
}

.standards-popover .popover-item-container:hover {
    background-color: #f3f4f6;
}

.standards-popover .popover-item {
    flex-grow: 1;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    text-decoration: none;
    color: #374151;
    cursor: pointer;
}

.standards-popover .popover-delete-btn {
    flex-shrink: 0;
    padding: 0.5rem;
    margin-right: 0.25rem;
    line-height: 1;
    color: #9ca3af;
    background: none;
    border: none;
    border-radius: 99px;
    cursor: pointer;
    transition: color 0.2s, background-color 0.2s;
}

.standards-popover .popover-delete-btn:hover {
    color: #ef4444;
    background-color: #fee2e2;
}

.standards-popover .popover-divider {
    height: 1px;
    margin: 0.5rem 0;
    background-color: #e5e7eb;
}

.standards-popover .popover-action-btn {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    text-align: left;
    color: #4f46e5;
    background: none;
    border: none;
    cursor: pointer;
}

.standards-popover .popover-action-btn:hover {
    background-color: #f3f4f6;
}

/* ===== Project Tags in Table ===== */
.project-tags-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.project-tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #3730a3;
    background-color: #e0e7ff;
    border-radius: 9999px;
}

.project-tag-pill .remove-project-tag-btn {
    padding: 0;
    margin-left: 0.5rem;
    color: #4f46e5;
    background: none;
    border: none;
    cursor: pointer;
}

.project-tag-pill .remove-project-tag-btn:hover {
    color: #312e81;
}

.add-project-tag-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    color: #4b5563;
    background-color: #f3f4f6;
    border: 1px dashed #d1d5db;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s;
}

.add-project-tag-btn:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
}

.project-tags-container .hidden-tags {
    display: none;
}

.project-tags-container .hidden-tags.is-expanded {
    display: contents;
}

.show-more-tags-btn,
.show-less-tags-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #4b5563;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s;
}

.show-more-tags-btn:hover,
.show-less-tags-btn:hover {
    background-color: #e5e7eb;
}

/* ===== Task Drag & Hierarchy Styles ===== */
.task-drag-handle {
    opacity: 0.5;
    cursor: grab;
    transition: opacity 0.2s;
}

.task-drag-handle:hover {
    opacity: 1;
}

.task-drag-handle:active {
    cursor: grabbing;
}

.task-row.sortable-ghost {
    background-color: #eef2ff;
    opacity: 0.8;
}

.task-row.sortable-chosen {
    background-color: #f5f3ff;
}

.subtask-row {
    background-color: #f5f5f5;
    border-left: 3px solid #818cf8;
}

.subtask-name-container {
    position: relative;
    padding-left: 2rem;
}

.subtask-name-container::before {
    position: absolute;
    left: 0.5rem;
    font-family: monospace;
    font-size: 0.875rem;
    color: #9ca3af;
    content: '└';
}

.task-promote-btn,
.task-demote-btn,
.task-delete-btn {
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.task-promote-btn:hover,
.task-demote-btn:hover {
    background-color: #e0e7ff;
}

.task-delete-btn:hover {
    background-color: #fee2e2;
}

/* ===== Gantt Chart Styles ===== */
.gantt-wrapper {
    overflow-x: auto;
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

.gantt-container {
    min-width: 100%;
}

.gantt-grid {
    display: grid;
    min-width: max-content;
}

.gantt-header {
    display: contents;
}

.gantt-header-cell {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 0.5rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    color: #6b7280;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.gantt-header-cell.gantt-task-cell {
    position: sticky;
    left: 0;
    z-index: 20;
    padding-left: 1rem;
    text-align: left;
    background-color: #f9fafb;
}

.gantt-body {
    display: contents;
}

.gantt-row {
    display: contents;
}

.gantt-row:hover .gantt-cell,
.gantt-row:hover .gantt-task-cell {
    background-color: #f9fafb;
}

.gantt-task-cell {
    position: sticky;
    left: 0;
    z-index: 5;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
    color: #1f2937;
    background-color: #fff;
    border-bottom: 1px solid #f3f4f6;
}

.gantt-subtask {
    padding-left: 2rem;
}

.gantt-task-name {
    font-weight: 500;
}

.gantt-assignee {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    color: #9ca3af;
}

.gantt-cell {
    border-bottom: 1px solid #f3f4f6;
    border-right: 1px solid #f9fafb;
    min-height: 2.5rem;
}

.gantt-bar {
    position: relative;
    background-color: #818cf8;
}

.gantt-bar::after {
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    height: 8px;
    background-color: var(--color-primary-500);
    border-radius: 2px;
    transform: translateY(-50%);
    content: '';
}

/* ===== Sidebar Collapse Styles ===== */

/* 標題樣式 */
.nav-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.nav-group-title:hover {
    background-color: var(--color-gray-50);
}

/* 收摺圖示 */
.nav-group-toggle {
    font-size: 0.875rem;
    color: var(--color-gray-500);
    transition: transform 0.2s;
}

.nav-group.collapsed .nav-group-toggle {
    transform: rotate(-90deg);
}

/* 隱藏項目 */
.nav-group.collapsed .nav-link {
    display: none;
}

/* 專案名稱警告圖示 */
#workspace-title .fa-circle-exclamation {
    margin-left: 0.25rem;
    font-size: 0.875rem;
}

/* ===== Nav Group Dynamic Spacing ===== */
.nav-group {
    margin-bottom: 1.5rem;
    /* Default spacing when expanded */
    transition: margin-bottom 0.3s ease;
}

.nav-group.collapsed {
    margin-bottom: 0.25rem;
    /* Reduced spacing when collapsed */
}

.nav-group:last-child {
    margin-bottom: 0;
}

/* 專案名稱小字體樣式 */
.small-project-name {
    font-size: 0.8rem;
    font-weight: normal;
    margin-left: 0.25rem;
    vertical-align: 1px;
}

/* ===== 工程實績表格 - 水平捲動 + Sticky Header ===== */

/* 表格容器：啟用水平捲動 */
#view-project-achievements .table-wrapper {
    overflow-x: auto;
    max-width: 100%;
    position: relative;
}

/* 表格基礎設定 */
#view-project-achievements .table-standard {
    table-layout: auto;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

/* Sticky Header：表頭固定在頂部 */
#view-project-achievements .table-standard thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--color-bg-table-header);
    white-space: nowrap;
}

/* 左側工程名稱欄固定 */
#view-project-achievements .table-standard th:first-child,
#view-project-achievements .table-standard td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background-color: inherit;
    min-width: 200px;
    max-width: 300px;
    white-space: normal;
}

/* 左上角表頭儲存格需要更高 z-index (sticky row + sticky column 交會點) */
#view-project-achievements .table-standard thead th:first-child {
    z-index: 15;
    background-color: var(--color-bg-table-header);
}

/* 資料欄位最小寬度 (防止壓縮) */
#view-project-achievements .table-standard th,
#view-project-achievements .table-standard td {
    white-space: nowrap;
}

/* 數據欄位寬度設定 */
#view-project-achievements .table-standard .col-floor-area {
    min-width: 130px;
    text-align: right;
}

#view-project-achievements .table-standard .col-cost {
    min-width: 100px;
    text-align: right;
}

#view-project-achievements .table-standard .col-location {
    min-width: 100px;
    text-align: center;
}

#view-project-achievements .table-standard .col-industry {
    min-width: 110px;
    text-align: center;
}

/* 右側操作欄固定 */
#view-project-achievements .table-standard th:last-child,
#view-project-achievements .table-standard td:last-child {
    position: sticky;
    right: 0;
    z-index: 5;
    background-color: inherit;
    min-width: 80px;
    text-align: center;
}

/* 右上角表頭儲存格 z-index */
#view-project-achievements .table-standard thead th:last-child {
    z-index: 15;
    background-color: var(--color-bg-table-header);
}

/* 水平捲動提示陰影 (左側) */
#view-project-achievements .table-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 200px;
    width: 16px;
    height: 100%;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.08), transparent);
    pointer-events: none;
    z-index: 6;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

/* 水平捲動提示陰影 (右側) */
#view-project-achievements .table-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 80px;
    width: 16px;
    height: 100%;
    background: linear-gradient(to left, rgba(0, 0, 0, 0.08), transparent);
    pointer-events: none;
    z-index: 6;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

/* 捲動時顯示陰影 (需 JS 控制 .is-scrollable 類別) */
#view-project-achievements .table-wrapper.is-scrollable-left::before {
    opacity: 1;
}

#view-project-achievements .table-wrapper.is-scrollable-right::after {
    opacity: 1;
}

/* ===== Project Achievements Map Styles ===== */

/* 工程實績視圖 - 左右分欄佈局 */
.project-achievements-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-6);
}

/* 桌面版：左右分欄 (≥1024px) */
@media (min-width: 1024px) {
    .project-achievements-layout {
        grid-template-columns: 7fr 5fr;
    }
}

/* 列表區塊樣式 */
.achievements-list-section {
    /* 與右側地圖相同高度 */
    height: calc(100vh - var(--header-height) - var(--spacing-6) * 2 - 3rem);
    overflow-y: auto;
}

/* 地圖區塊樣式 */
.achievements-map-section {
    height: calc(100vh - var(--header-height) - var(--spacing-6) * 2 - 3rem);
}

/* 列表內部容器：撐滿父容器高度 */
.achievements-list-section .table-card-dual,
.achievements-list-section .table-card-dual>.overflow-x-auto,
.achievements-list-section .table-card-dual>.border {
    height: 100%;
}

/* 地圖區塊的 Panel 需要 flex 佈局 */
.achievements-map-section .panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.achievements-map-section .panel__body {
    flex: 1;
    min-height: 0;
    padding: 0;
}

/* 地圖容器樣式 */
.map-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background-color: var(--color-gray-50, #f9fafb);
}

.map-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.map-placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* 縣市路徑樣式 */
.county-path {
    fill: #ffffff;
    stroke: var(--color-gray-300, #d1d5db);
    stroke-width: 1;
    stroke-linecap: round;
    stroke-linejoin: round;
    cursor: pointer;
    transition: fill 0.15s, stroke 0.15s, stroke-width 0.15s;
}

.county-path:hover {
    fill: var(--color-primary-100, #e0e7ff);
    stroke: var(--color-primary-400, #818cf8);
}

.county-path.selected {
    fill: var(--color-primary-200, #c7d2fe);
    stroke: var(--color-primary-600, #4f46e5);
    stroke-width: 2;
}