/* ==========================================================================
   極光專案時程與任務分工看板 - 全域樣式表 (style.css)
   【專業設計師優化版】採用 #E3E3CE 奶油香檳金輕奢色調，結合毛玻璃與極致行動響應式
   ========================================================================== */

/* --- 1. 設計系統與全域變數 --- */
:root {
    /* 專業調配：以 #E3E3CE 為主色的深暖輕奢配色系統 */
    --primary: #E3E3CE;                   /* 核心奶油香檳金主色 */
    --primary-glow: rgba(227, 227, 206, 0.22);
    --primary-muted: rgba(227, 227, 206, 0.6);
    
    /* 輔助與深暖背景色 (營造頂級博物館/精品暗色美學) */
    --bg-app: hsl(40, 10%, 8%);           /* 應用程式深泥炭背景 */
    --bg-sidebar: hsl(40, 10%, 5%);       /* 側邊欄極深背景 */
    --bg-card: hsla(40, 8%, 13%, 0.68);    /* 毛玻璃卡片背景 */
    --bg-card-hover: hsla(40, 8%, 18%, 0.78);
    
    /* 奢華細邊框 */
    --border-glass: rgba(227, 227, 206, 0.12); /* 奶油金柔和細邊框 */
    --border-focus: #E3E3CE;
    
    /* 科技與狀態色彩 (與暖金主色調和之低飽和度狀態色) */
    --secondary: hsl(38, 30%, 65%);       /* 暖青銅/次要金 */
    --secondary-glow: rgba(197, 179, 150, 0.2);
    
    --color-todo: hsl(40, 6%, 60%);       /* 未開始：高級霧灰 */
    --color-progress: hsl(32, 70%, 58%);  /* 進行中：優雅琥珀橘 */
    --color-done: hsl(150, 45%, 45%);     /* 已完成：靜謐翡翠綠 */
    
    --priority-high: hsl(0, 75%, 62%);    /* 高優先：珊瑚朱紅 */
    --priority-medium: hsl(32, 70%, 58%);  /* 中優先：優雅琥珀橘 */
    --priority-low: hsl(150, 45%, 45%);   /* 低優先：靜謐翡翠綠 */
    
    /* 精緻文字色彩 */
    --text-main: hsl(40, 15%, 93%);       /* 主標題/白金文字 */
    --text-muted: hsl(40, 8%, 68%);       /* 輔助/暖灰色 */
    --text-dark: hsl(40, 10%, 6%);        /* 強烈對比暗字 */
    
    /* 專業比例與圓角 */
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    
    /* 順暢微動畫 */
    --transition-smooth: all 0.35s cubic-bezier(0.215, 0.61, 0.355, 1);
}

/* --- 2. 基礎重設與滾動條美化 --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    overflow: hidden; 
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 自訂輕奢風滾動條 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(227, 227, 206, 0.15);
    border-radius: 20px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-muted);
}

/* --- 3. 核心版面配置 (Sidebar & Main Grid) --- */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    /* 完美的背景疊加：讓太空壁紙融入暖深色調中，呈現大氣極簡質感 */
    background-image: 
        linear-gradient(rgba(24, 22, 20, 0.86), rgba(15, 14, 13, 0.93)),
        url('Planet9_Wallpaper_5000x2813.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* 側邊欄樣式 */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    padding: 30px 24px;
    flex-shrink: 0;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 40px;
}
.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    font-size: 1.3rem;
    box-shadow: 0 4px 20px var(--primary-glow);
}
.brand-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--primary);
}
.brand-text span {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* 導覽選單 */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: auto; 
}
.nav-item {
    background: transparent;
    border: 1px solid transparent;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-smooth);
}
.nav-item i {
    font-size: 1.05rem;
    transition: var(--transition-smooth);
}
.nav-item:hover {
    color: var(--primary);
    background-color: rgba(227, 227, 206, 0.05);
    border-color: rgba(227, 227, 206, 0.08);
}
.nav-item.active {
    color: var(--text-dark);
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 4px 20px var(--primary-glow);
    font-weight: 600;
}
.nav-item.active i {
    color: var(--text-dark);
    text-shadow: none;
}

/* 側邊欄統計小工具 */
.sidebar-widget {
    background: rgba(227, 227, 206, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    margin-top: 20px;
}
.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.widget-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}
.widget-header span {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}
.widget-progress-bar {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
}
.widget-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 10px;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.widget-stats {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.stat-item {
    display: flex;
    flex-direction: column;
    flex: 1;
}
.stat-num {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}
.stat-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- 4. 主內容顯示區結構 --- */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 頂部資訊列 */
.top-bar {
    padding: 24px 40px;
    background: rgba(15, 14, 13, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    z-index: 5;
}
.project-info .title-section {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 6px;
}
.project-info h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--primary);
}
.project-duration {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
.project-duration i {
    color: var(--secondary);
}

/* 內容主體區 */
.content-body {
    flex-grow: 1;
    padding: 30px 40px;
    overflow-y: auto;
    position: relative;
}

/* 頁籤內容顯示/隱藏 */
.tab-content {
    display: none;
    height: 100%;
    animation: fadeIn 0.45s cubic-bezier(0.215, 0.61, 0.355, 1);
}
.tab-content.active {
    display: flex;
    flex-direction: column;
}

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

/* 區塊共用標題 */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-shrink: 0;
}
.view-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.view-title i {
    font-size: 1.2rem;
    color: var(--primary);
}
.view-title h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* --- 5. 通用按鈕與設計細節 --- */
.btn {
    border: 1px solid transparent;
    padding: 10px 22px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.btn-primary {
    background: var(--primary);
    color: var(--text-dark);
    box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 6px 20px rgba(227, 227, 206, 0.4);
    opacity: 0.95;
}
.btn-secondary {
    background: rgba(227, 227, 206, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-glass);
}
.btn-secondary:hover {
    background: rgba(227, 227, 206, 0.12);
    border-color: rgba(227, 227, 206, 0.25);
}
.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: hsl(0, 80%, 65%);
    border: 1px solid rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
    background: hsl(0, 75%, 58%);
    border-color: hsl(0, 75%, 58%);
    color: white;
}
.icon-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}
.icon-btn:hover {
    background: rgba(227, 227, 206, 0.08);
    border-color: var(--border-glass);
    color: var(--primary);
}

/* 編輯專案的微型按鈕 */
.edit-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

/* --- 6. 甘特圖 (Gantt Chart) 樣式調校 --- */
.gantt-legend {
    display: flex;
    gap: 16px;
}
.legend-item {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.legend-dot.priority-high { background-color: var(--priority-high); }
.legend-dot.priority-medium { background-color: var(--priority-medium); }
.legend-dot.priority-low { background-color: var(--priority-low); }

/* 甘特圖外框毛玻璃 */
.gantt-wrapper {
    flex-grow: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    overflow: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.gantt-container {
    display: grid;
    min-width: 950px;
}

/* 時間軸表頭 */
.gantt-header-row {
    display: contents;
}
.gantt-header-side {
    background: rgba(20, 18, 17, 0.85);
    padding: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary);
    border-bottom: 2px solid var(--border-glass);
    position: sticky;
    left: 0;
    z-index: 4;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.gantt-header-cell {
    background: rgba(20, 18, 17, 0.65);
    padding: 14px 6px;
    text-align: center;
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-glass);
    border-left: 1px solid rgba(227, 227, 206, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.gantt-header-cell.weekend {
    background: rgba(20, 18, 17, 0.8);
    color: hsl(40, 10%, 45%);
}

/* 任務條行 */
.gantt-row {
    display: contents;
}
.gantt-row:hover .gantt-side-cell {
    background: rgba(227, 227, 206, 0.03);
}
.gantt-row:hover .gantt-grid-cell {
    background: rgba(227, 227, 206, 0.01);
}

.gantt-side-cell {
    padding: 18px 20px;
    background: rgba(25, 23, 21, 0.75);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    left: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}
.gantt-side-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
    transition: var(--transition-smooth);
}
.gantt-side-cell:hover .gantt-side-title {
    color: var(--primary);
}
.gantt-side-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
.gantt-side-meta span.avatar-badge {
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--text-dark);
    font-weight: 600;
}

/* 時間格 */
.gantt-grid-cell {
    border-bottom: 1px solid rgba(227, 227, 206, 0.04);
    border-left: 1px solid rgba(227, 227, 206, 0.04);
    min-height: 75px;
}
.gantt-grid-cell.weekend {
    background: rgba(255, 255, 255, 0.01);
}

/* 甘特長條 */
.gantt-bar-container {
    grid-column: 2 / -1; 
    position: relative;
    height: 100%;
    min-height: 75px;
    pointer-events: none; 
}

.gantt-bar-link {
    pointer-events: auto; 
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 32px;
    border-radius: var(--radius-sm);
    padding: 1.5px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s cubic-bezier(0.215, 0.61, 0.355, 1), box-shadow 0.25s ease;
    display: flex;
    overflow: hidden;
}
.gantt-bar-link:hover {
    transform: translateY(-50%) scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

/* 長條背景與填充 */
.gantt-bar-track {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}
.gantt-bar-fill {
    height: 100%;
    border-radius: 3px;
    position: absolute;
    left: 0;
    top: 0;
    transition: width 0.8s ease;
}
/* 漸層填充設定 */
.gantt-bar-fill.high {
    background: linear-gradient(90deg, var(--priority-high), #ff8a8a);
}
.gantt-bar-fill.medium {
    background: linear-gradient(90deg, var(--priority-medium), #ffcf76);
}
.gantt-bar-fill.low {
    background: linear-gradient(90deg, var(--priority-low), #9dffd2);
}

/* 甘特條文字 */
.gantt-bar-label {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 24px);
}

/* --- 7. 任務狀態看板 (Kanban Board) 樣式 --- */
.kanban-board {
    display: flex;
    gap: 24px;
    flex-grow: 1;
    overflow: hidden;
    height: 100%;
}
.kanban-column {
    flex: 1;
    background: rgba(22, 20, 19, 0.45);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
}
.column-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(227, 227, 206, 0.08);
}
.column-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 12px;
}
.column-dot.todo { background-color: var(--color-todo); }
.column-dot.progress { background-color: var(--color-progress); }
.column-dot.done { background-color: var(--color-done); }

.column-header h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.column-count {
    background: rgba(227, 227, 206, 0.08);
    border: 1px solid rgba(227, 227, 206, 0.15);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    margin-left: auto;
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
}

.kanban-cards {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-right: 4px;
}

/* 看板卡片 */
.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 18px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}
.task-card:hover {
    transform: translateY(-2px);
    border-color: rgba(227, 227, 206, 0.25);
    background: var(--bg-card-hover);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* 優先級左側飾條 */
.task-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}
.task-card.priority-high::before { background-color: var(--priority-high); }
.task-card.priority-medium::before { background-color: var(--priority-medium); }
.task-card.priority-low::before { background-color: var(--priority-low); }

.card-title {
    font-size: 0.96rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
    line-height: 1.45;
}
.card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(227, 227, 206, 0.05);
    padding-top: 12px;
}
.card-dates {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.card-assignee-badge {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    color: var(--text-dark);
}

/* --- 8. 數據儀表板 (Dashboard) 樣式 --- */
.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
    flex-shrink: 0;
}
.dash-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 22px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transition: var(--transition-smooth);
}
.dash-card:hover {
    transform: translateY(-2px);
    border-color: rgba(227, 227, 206, 0.2);
}
.card-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}
.card-icon.blue { background: rgba(14, 165, 233, 0.12); color: #38bdf8; }
.card-icon.orange { background: rgba(249, 115, 22, 0.12); color: #fb923c; }
.card-icon.green { background: rgba(16, 185, 129, 0.12); color: #34d399; }
.card-icon.purple { background: rgba(227, 227, 206, 0.1); color: var(--primary); }

.card-data h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.5px;
}
.card-data span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* 圖表版面 */
.dashboard-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}
.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.25);
}
.chart-header {
    margin-bottom: 22px;
}
.chart-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--primary);
}

/* 優先級圖表 */
.priority-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.prio-item-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 8px;
}
.prio-item-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}
.prio-item-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 工作載量進度條 */
.workload-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.workload-item {
    display: flex;
    flex-direction: column;
}
.workload-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85rem;
}
.workload-member {
    display: flex;
    align-items: center;
    gap: 10px;
}
.member-mini-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.workload-bar-wrapper {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}
.workload-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- 9. 團隊成員名單 (Team Manager) 樣式 --- */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}
.member-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transition: var(--transition-smooth);
    position: relative;
}
.member-card:hover {
    transform: translateY(-3px);
    border-color: rgba(227, 227, 206, 0.25);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

/* 頭像 */
.member-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 18px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    border: 2.5px solid rgba(227, 227, 206, 0.3);
}
.member-card h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.member-card p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 18px;
}
.member-task-info {
    font-size: 0.75rem;
    background: rgba(227, 227, 206, 0.03);
    border: 1px solid rgba(227, 227, 206, 0.08);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}
.member-actions {
    position: absolute;
    top: 14px;
    right: 14px;
}

/* --- 10. 對話視窗區 (Modal Popups) 樣式 --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 9, 8, 0.78);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.215, 0.61, 0.355, 1);
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: hsl(40, 10%, 10%);
    border: 1px solid rgba(227, 227, 206, 0.16);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
    transform: translateY(24px) scale(0.96);
    transition: transform 0.35s cubic-bezier(0.215, 0.61, 0.355, 1);
}
.modal-overlay.active .modal-card {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(227, 227, 206, 0.1);
}
.modal-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}
.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.close-btn:hover {
    color: var(--primary);
}

/* 對話框表單 */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}
.required {
    color: var(--priority-high);
}

/* 輸入框 */
input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(227, 227, 206, 0.15);
    border-radius: var(--radius-md);
    padding: 11px 16px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-smooth);
}
input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: var(--border-focus);
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 0 12px var(--primary-glow);
}

/* 滑塊 (Range Slider) */
.slider-wrapper {
    display: flex;
    align-items: center;
    height: 100%;
}
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 8px var(--primary-glow);
    transition: transform 0.15s ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.25);
}

/* 配色選擇器 */
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
    margin-top: 6px;
}
.color-swatch {
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    border: 2.5px solid transparent;
    transition: var(--transition-smooth);
}
.color-swatch:hover {
    transform: scale(1.15);
}
.color-swatch.selected {
    border-color: white;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

/* 對話框底欄 */
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid rgba(227, 227, 206, 0.1);
}
.right-buttons {
    display: flex;
    gap: 14px;
    margin-left: auto;
}

/* --- 11. 新增指標功能擴充樣式 --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2.5px 7px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.2;
    border: 1px solid transparent;
    margin-right: 6px;
    letter-spacing: 0.2px;
}
.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: hsl(0, 80%, 65%);
    border-color: rgba(239, 68, 68, 0.25);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.15);
}
.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fb923c;
    border-color: rgba(245, 158, 11, 0.25);
}

/* 成員績效量表 */
.member-performance-container {
    width: 100%;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(227, 227, 206, 0.05);
    text-align: left;
}
.performance-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 600;
}
.performance-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}
.performance-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ==========================================================================
   --- 12. 響應式手機版與平板極致優化 (Mobile Responsive) ---
   ========================================================================== */
@media (max-width: 992px) {
    .app-container {
        flex-direction: column;
        overflow-y: auto;
    }
    
    /* 側邊欄改為頂部導覽列 */
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-glass);
        padding: 16px 20px;
    }
    .brand {
        margin-bottom: 16px;
        justify-content: center;
    }
    
    /* 橫向滑動選單 */
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 6px;
        gap: 8px;
        margin-bottom: 0;
        scroll-snap-type: x mandatory;
        scrollbar-width: none; /* 隱藏火狐滾動條 */
    }
    .nav-menu::-webkit-scrollbar {
        display: none; /* 隱藏 Chrome/Safari 滾動條 */
    }
    .nav-item {
        padding: 10px 14px;
        font-size: 0.88rem;
        white-space: nowrap;
        scroll-snap-align: start;
        flex-shrink: 0;
    }
    .sidebar-widget {
        display: none; /* 行動端隱藏側欄小工具，以數據儀表板為主 */
    }
    
    /* 主內容區填滿行動版面 */
    .main-content {
        height: auto;
        overflow: visible;
    }
    .top-bar {
        padding: 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        background: rgba(15, 14, 13, 0.6);
    }
    .action-bar {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .btn {
        width: 100%;
        padding: 11px 16px;
    }
    
    .content-body {
        padding: 20px;
        overflow-y: visible;
    }
    
    /* 看板欄位改為垂直堆疊 */
    .kanban-board {
        flex-direction: column;
        overflow: visible;
        gap: 20px;
    }
    .kanban-column {
        max-height: 480px; /* 限制高度並允許內部滾動，防止頁面無限拉長 */
    }
    
    /* 甘特圖可橫向捲動 */
    .gantt-wrapper {
        margin-bottom: 20px;
    }
    
    /* 儀表板圖表網格改為單欄 */
    .dashboard-charts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 576px) {
    .action-bar {
        grid-template-columns: 1fr; /* 極小螢幕下按鈕單欄排列 */
    }
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .dashboard-stats-grid {
        grid-template-columns: 1fr; /* KPI 卡片改為單欄 */
    }
}
