/* styles.css - 资源管道管理系统样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #818CF8;
    --secondary: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --purple: #8B5CF6;
    --cyan: #06B6D4;
    --dark: #1F2937;
    --gray: #6B7280;
    --light: #F3F4F6;
    --white: #FFFFFF;
    --border: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #F9FAFB;
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== 导航栏 ===== */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo {
    font-size: 1.5rem;
}

.nav-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--gray);
    font-weight: 500;
}

.nav-item:hover {
    background: var(--light);
    color: var(--dark);
}

.nav-item.active {
    background: var(--primary);
    color: var(--white);
}

.nav-icon {
    font-size: 1.1rem;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 5px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--dark);
    transition: all 0.3s ease;
}

/* ===== 容器 ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* ===== 页面 ===== */
.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

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

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.75rem;
    color: var(--dark);
    margin-bottom: 4px;
}

.page-desc {
    color: var(--gray);
    font-size: 0.95rem;
}

/* ===== 统计卡片 ===== */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.card-blue .card-icon { background: #EEF2FF; }
.card-green .card-icon { background: #ECFDF5; }
.card-orange .card-icon { background: #FFFBEB; }
.card-purple .card-icon { background: #F5F3FF; }
.card-red .card-icon { background: #FEF2F2; }

.card-content h3 {
    font-size: 0.875rem;
    color: var(--gray);
    font-weight: 500;
    margin-bottom: 4px;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1.2;
}

.card-content small {
    font-size: 0.8rem;
    color: var(--gray);
}

/* ===== 图表区域 ===== */
.chart-section, .overview-section, .config-section, .resource-section, .resource-detail-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.125rem;
    color: var(--dark);
}

.view-all {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.view-all:hover {
    text-decoration: underline;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.chart-card {
    background: var(--light);
    border-radius: var(--radius);
    padding: 16px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.chart-label {
    font-weight: 500;
    color: var(--dark);
}

.chart-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.chart-bar-bg {
    height: 12px;
    background: var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
    width: 0%;
}

.chart-bar-fill.monthly { background: linear-gradient(90deg, #4F46E5, #818CF8); }
.chart-bar-fill.weekly { background: linear-gradient(90deg, #10B981, #34D399); }
.chart-bar-fill.daily { background: linear-gradient(90deg, #F59E0B, #FBBF24); }

/* ===== 工具栏 ===== */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    background: var(--white);
    padding: 16px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--gray);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    min-width: 140px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 12px;
    flex: 1;
    max-width: 300px;
}

.search-icon {
    color: var(--gray);
    margin-right: 8px;
}

.search-box input {
    border: none;
    padding: 10px 0;
    font-size: 0.875rem;
    width: 100%;
}

.search-box input:focus {
    outline: none;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--light);
    color: var(--dark);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: var(--secondary);
    color: var(--white);
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-icon {
    font-size: 1rem;
}

/* ===== 表单面板 ===== */
.form-panel {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 2px solid var(--primary);
    display: none;
}

.form-panel.show {
    display: block;
    animation: slideDown 0.3s ease;
}

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

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.form-header h3 {
    font-size: 1.125rem;
    color: var(--dark);
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.btn-close:hover {
    color: var(--dark);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--dark);
}

.required {
    color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-with-suffix {
    display: flex;
    align-items: center;
}

.input-with-suffix input {
    border-radius: var(--radius) 0 0 var(--radius);
    border-right: none;
}

.input-suffix {
    padding: 10px 12px;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--gray);
    font-size: 0.875rem;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ===== 表格 ===== */
.table-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

table th {
    background: var(--light);
    font-weight: 600;
    color: var(--dark);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table tbody tr:hover {
    background: #F9FAFB;
}

.empty-row td {
    text-align: center !important;
    padding: 40px !important;
    color: var(--gray) !important;
    font-style: italic;
}

/* ===== 状态标签 ===== */
.status-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-tag.pending {
    background: #FEF3C7;
    color: #D97706;
}

.status-tag.progress {
    background: #DBEAFE;
    color: #2563EB;
}

.status-tag.completed {
    background: #D1FAE5;
    color: #059669;
}

.status-tag.paused {
    background: #FEE2E2;
    color: #DC2626;
}

/* ===== 操作按钮 ===== */
.action-btns {
    display: flex;
    gap: 6px;
}

.action-btn {
    padding: 6px 10px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn.edit {
    background: #FEF3C7;
    color: #D97706;
}

.action-btn.edit:hover {
    background: #FDE68A;
}

.action-btn.delete {
    background: #FEE2E2;
    color: #DC2626;
}

.action-btn.delete:hover {
    background: #FECACA;
}

/* ===== 进度条 ===== */
.progress-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-track {
    flex: 1;
    height: 8px;
    background: var(--light);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--gray);
    min-width: 36px;
    text-align: right;
}

/* ===== 资源网格 ===== */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.resource-card {
    background: var(--light);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.resource-info h4 {
    font-size: 0.95rem;
    color: var(--dark);
    margin-bottom: 4px;
}

.resource-info p {
    font-size: 0.8rem;
    color: var(--gray);
}

.resource-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.resource-count span {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--gray);
}

/* ===== 配置卡片 ===== */
.config-card {
    background: var(--light);
    border-radius: var(--radius);
    padding: 20px;
}

.config-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.config-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: var(--dark);
}

.config-icon {
    font-size: 1.25rem;
}

.config-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-input input {
    width: 80px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    text-align: center;
}

.config-unit {
    color: var(--gray);
}

/* ===== 模态框 ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

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

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-sm {
    max-width: 400px;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.25rem;
    color: var(--dark);
}

/* ===== Toast 提示 ===== */
.toast {
    position: fixed;
    top: 80px;
    right: 24px;
    padding: 14px 20px;
    border-radius: var(--radius);
    color: var(--white);
    font-weight: 500;
    z-index: 9999;
    animation: slideInRight 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.toast.success { background: var(--secondary); }
.toast.warning { background: var(--warning); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ===== 概览表格 ===== */
.overview-table-container {
    overflow-x: auto;
}

.overview-table {
    width: 100%;
}

.overview-table th,
.overview-table td {
    padding: 12px;
    font-size: 0.875rem;
}

/* ===== 超期警告 ===== */
.overdue {
    color: var(--danger);
}

.overdue-icon {
    margin-left: 4px;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }
    
    .nav-menu {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: 16px;
        box-shadow: var(--shadow-lg);
        display: none;
    }
    
    .nav-menu.show {
        display: flex;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .container {
        padding: 16px;
    }
    
    .dashboard-cards {
        grid-template-columns: 1fr 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group select,
    .filter-group input {
        min-width: auto;
        width: 100%;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: none;
    }
    
    .config-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 16px;
    }
    
    .card-value {
        font-size: 1.5rem;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
}

/* ===== 视图切换器 ===== */
.view-switcher {
    display: flex;
    gap: 4px;
    margin-left: auto;
    background: var(--light);
    padding: 4px;
    border-radius: var(--radius);
}

.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--gray);
    transition: all 0.2s ease;
}

.view-btn:hover {
    background: var(--border);
    color: var(--dark);
}

.view-btn.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ===== 甘特图区域 ===== */
.gantt-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.gantt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--light);
    border-bottom: 1px solid var(--border);
}

.gantt-header h2 {
    font-size: 1rem;
    color: var(--dark);
    margin: 0;
}

.gantt-controls {
    display: flex;
    gap: 8px;
}

.gantt-container {
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
}

/* ===== 甘特图主体 ===== */
.gantt-wrapper {
    min-width: 100%;
    display: flex;
    flex-direction: column;
}

.gantt-timeline {
    display: flex;
    border-bottom: 2px solid var(--border);
    background: #FAFBFC;
    position: sticky;
    top: 0;
    z-index: 10;
}

.gantt-timeline-spacer {
    width: 280px;
    min-width: 280px;
    border-right: 1px solid var(--border);
    padding: 8px 12px;
    font-weight: 600;
    color: var(--gray);
    font-size: 0.8rem;
    background: var(--light);
}

.gantt-timeline-days {
    display: flex;
    flex: 1;
}

.gantt-day {
    min-width: 40px;
    width: 40px;
    text-align: center;
    padding: 8px 4px;
    font-size: 0.75rem;
    color: var(--gray);
    border-right: 1px solid var(--border);
    background: var(--light);
}

.gantt-day.weekend {
    background: #F0F0F0;
    color: #999;
}

.gantt-day.today {
    background: #EEF2FF;
    color: var(--primary);
    font-weight: 600;
}

.gantt-day-month {
    font-size: 0.55rem;
    color: var(--primary);
    font-weight: 600;
}

.gantt-day-num {
    font-weight: 600;
    display: block;
}

.gantt-day-weekday {
    font-size: 0.65rem;
    opacity: 0.7;
}

/* ===== 项目分组 ===== */
.gantt-project {
    border-bottom: 1px solid var(--border);
}

.gantt-project-header {
    display: flex;
    align-items: center;
    background: #F8FAFC;
    border-bottom: 1px solid var(--border);
}

.gantt-project-name {
    width: 280px;
    min-width: 280px;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
    border-right: 1px solid var(--border);
    background: #F1F5F9;
}

.gantt-person-name {
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
}

.gantt-project-icon {
    font-size: 1rem;
}

.gantt-project-count {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--gray);
    margin-left: 4px;
}

.gantt-project-timeline {
    flex: 1;
    height: 44px;
    position: relative;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 39px,
        var(--border) 39px,
        var(--border) 40px
    );
}

/* ===== 任务行 ===== */
.gantt-task-row {
    display: flex;
    align-items: center;
    min-height: 48px;
    border-bottom: 1px solid #F0F0F0;
}

.gantt-task-row:hover {
    background: #FAFBFC;
}

.gantt-compact-row {
    min-height: 40px;
}

.gantt-compact-info {
    padding: 6px 16px 6px 36px !important;
}

.gantt-task-info {
    width: 280px;
    min-width: 280px;
    padding: 8px 16px 8px 36px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gantt-task-name {
    font-size: 0.875rem;
    color: var(--dark);
    font-weight: 500;
    cursor: pointer;
}

.gantt-task-name:hover {
    color: var(--primary);
}

.gantt-task-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    color: var(--gray);
}

.gantt-task-person {
    display: flex;
    align-items: center;
    gap: 2px;
}

.gantt-task-project {
    display: flex;
    align-items: center;
    gap: 2px;
}

.gantt-task-project-name {
    font-weight: 600;
    color: var(--dark);
}

.gantt-task-person-name {
    font-weight: 600;
    color: var(--dark);
}

.task-count-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    padding: 1px 4px;
    border-radius: 8px;
    margin-left: 4px;
    font-weight: normal;
}

.gantt-day-warning {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(251, 191, 36, 0.2);
    border-left: 1px solid rgba(251, 191, 36, 0.3);
    border-right: 1px solid rgba(251, 191, 36, 0.3);
    pointer-events: none;
    z-index: 1;
}

.gantt-day-danger {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(239, 68, 68, 0.2);
    border-left: 1px solid rgba(239, 68, 68, 0.4);
    border-right: 1px solid rgba(239, 68, 68, 0.4);
    pointer-events: none;
    z-index: 1;
}

.meta-progress {
    color: var(--secondary);
}

.meta-todo {
    color: var(--warning);
}

.resource-empty {
    text-align: center;
    padding: 40px;
    color: var(--gray);
    font-style: italic;
}

.resource-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.resource-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--light);
    border-radius: var(--radius);
    padding: 12px 16px;
    transition: all 0.2s ease;
}

.resource-item:hover {
    background: #E5E7EB;
}

.resource-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.resource-item-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
}

.resource-avatar {
    font-size: 1rem;
}

.resource-item-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--gray);
}

.resource-item-actions {
    display: flex;
    gap: 6px;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.gantt-task-ratio {
    color: var(--primary);
    font-weight: 500;
}

/* ===== 月度柱状图 ===== */
.monthly-chart-container {
    padding: 20px 0;
}

.chart-header-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
}

.chart-month-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    min-width: 120px;
    text-align: center;
}

.monthly-chart {
    display: flex;
    gap: 20px;
    height: 180px;
}

.chart-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--gray);
    padding: 10px 0;
    min-width: 35px;
    text-align: right;
}

.chart-bars {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 1px;
    border-bottom: 1px solid var(--border);
    border-left: 1px solid var(--border);
    padding: 10px 2px 0;
}

.chart-bar-item {
    flex: 1;
    min-width: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    cursor: pointer;
    position: relative;
}

.chart-bar-item:hover .bar-fill {
    opacity: 0.8;
}

.bar-fill {
    width: 100%;
    background: linear-gradient(180deg, #4F46E5, #818CF8);
    border-radius: 2px 2px 0 0;
    transition: height 0.3s ease;
    min-height: 2px;
}

.chart-bar-item.past .bar-fill {
    background: linear-gradient(180deg, #4F46E5, #818CF8);
}

.chart-bar-item.today .bar-fill {
    background: linear-gradient(180deg, #10B981, #34D399);
}

.chart-bar-item.future .bar-fill {
    background: linear-gradient(180deg, #F59E0B, #FBBF24);
}

.bar-day {
    font-size: 0.5rem;
    color: var(--gray);
    margin-top: 2px;
    position: absolute;
    bottom: -14px;
}

.chart-bar-item.today .bar-day {
    color: var(--secondary);
    font-weight: 600;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 25px;
    padding-top: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--gray);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color.past {
    background: linear-gradient(180deg, #4F46E5, #818CF8);
}

.legend-color.today {
    background: linear-gradient(180deg, #10B981, #34D399);
}

.legend-color.future {
    background: linear-gradient(180deg, #F59E0B, #FBBF24);
}

@media (max-width: 768px) {
    .monthly-chart {
        height: 150px;
    }
    
    .chart-bar-item {
        min-width: 8px;
    }
    
    .bar-day {
        font-size: 0.5rem;
    }
}

/* ===== 甘特条 ===== */
.gantt-task-bars {
    flex: 1;
    position: relative;
    height: 40px;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 39px,
        #F5F5F5 39px,
        #F5F5F5 40px
    );
}

.gantt-compact-row .gantt-task-bars {
    height: 40px;
}

.gantt-bar {
    position: absolute;
    top: 6px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0 8px;
    font-size: 0.7rem;
    color: white;
    font-weight: 500;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.gantt-compact-row .gantt-bar {
    top: 4px;
    height: 24px;
}

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

.gantt-bar.pending {
    background: linear-gradient(135deg, #F59E0B, #FBBF24);
}

.gantt-bar.progress {
    background: linear-gradient(135deg, #3B82F6, #60A5FA);
}

.gantt-bar.completed {
    background: linear-gradient(135deg, #10B981, #34D399);
}

.gantt-bar.paused {
    background: linear-gradient(135deg, #EF4444, #F87171);
}

.gantt-bar-overdue {
    border: 2px dashed #EF4444 !important;
}

/* ===== 今日线 ===== */
.gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--danger);
    z-index: 20;
    pointer-events: none;
}

.gantt-today-line::before {
    content: '今天';
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: white;
    background: var(--danger);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* ===== 甘特图空状态 ===== */
.gantt-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--gray);
}

.gantt-empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.gantt-empty-text {
    font-size: 0.95rem;
}

/* ===== 甘特图工具提示 ===== */
.gantt-tooltip {
    position: fixed;
    background: var(--dark);
    color: white;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    z-index: 1000;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    max-width: 280px;
}

.gantt-tooltip-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.gantt-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 4px;
    opacity: 0.9;
}

/* ===== 响应式甘特图 ===== */
@media (max-width: 768px) {
    .gantt-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .gantt-timeline-spacer {
        width: 160px;
        min-width: 160px;
    }
    
    .gantt-project-name {
        width: 160px;
        min-width: 160px;
        font-size: 0.85rem;
    }
    
    .gantt-task-info {
        width: 160px;
        min-width: 160px;
        padding-left: 24px;
    }
    
    .gantt-day {
        min-width: 32px;
        width: 32px;
        font-size: 0.65rem;
    }
    
    .gantt-task-bars {
        background: repeating-linear-gradient(
            90deg,
            transparent,
            transparent 31px,
            #F5F5F5 31px,
            #F5F5F5 32px
        );
    }
    
    .gantt-project-timeline {
        background: repeating-linear-gradient(
            90deg,
            transparent,
            transparent 31px,
            var(--border) 31px,
            var(--border) 32px
        );
    }
}

/* ===== 闲置资源样式 ===== */
.idle-bar {
    position: absolute;
    top: 8px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.idle-bar:hover {
    transform: scale(1.05);
    z-index: 10;
}

.idle-high {
    background: linear-gradient(135deg, #10B981, #34D399);
    color: white;
}

.idle-low {
    background: linear-gradient(135deg, #F59E0B, #FBBF24);
    color: white;
}

.idle-busy {
    background: linear-gradient(135deg, #EF4444, #F87171);
    color: white;
}

.idle-not-in-range {
    background: #E5E7EB;
    color: #9CA3AF;
}

.idle-text {
    font-size: 0.6rem;
}

/* 闲置统计卡片 */
.idle-summary-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-top: 24px;
}

.idle-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.idle-summary-card {
    background: var(--light);
    border-radius: var(--radius);
    padding: 16px;
    transition: all 0.2s ease;
}

.idle-summary-card:hover {
    background: #E5E7EB;
}

.idle-summary-name {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.idle-summary-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.idle-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.idle-label {
    font-size: 0.7rem;
    color: var(--gray);
}

.idle-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
}

.idle-value.idle-high {
    color: var(--secondary);
}

.idle-value.idle-low {
    color: var(--warning);
}

.idle-value.idle-busy {
    color: var(--danger);
}

.idle-bar-mini {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.idle-bar-mini-fill {
    height: 100%;
    border-radius: 3px;
}

.idle-bar-mini-fill.idle-high {
    background: linear-gradient(90deg, #10B981, #34D399);
}

.idle-bar-mini-fill.idle-low {
    background: linear-gradient(90deg, #F59E0B, #FBBF24);
}

.idle-bar-mini-fill.idle-busy {
    background: linear-gradient(90deg, #EF4444, #F87171);
}

.empty-text {
    text-align: center;
    color: var(--gray);
    padding: 20px;
    font-style: italic;
}

/* ===== AI 自动排期 ===== */
.ai-config-details {
    background: var(--light);
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.ai-config-summary {
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 500;
    color: var(--dark);
    user-select: none;
}

.ai-config-summary:hover {
    background: var(--border);
    border-radius: var(--radius);
}

.ai-config-body {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.ai-input-section {
    margin-bottom: 12px;
}

.ai-task-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.ai-task-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.ai-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.ai-preview-table th {
    background: var(--light);
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.ai-preview-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.ai-preview-table tr:hover td {
    background: #F9FAFB;
}

.ai-preview-table .ai-cell-input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
    background: transparent;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.ai-preview-table .ai-cell-input:hover {
    border-color: var(--border);
    background: white;
}

.ai-preview-table .ai-cell-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.ai-preview-table .ai-cell-select {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.ai-preview-table .ai-cell-select:hover {
    border-color: var(--border);
    background: white;
}

.ai-preview-table .ai-cell-select:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.ai-preview-table .btn-remove-row {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.ai-preview-table .btn-remove-row:hover {
    background: #FEF2F2;
}

.ai-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: ai-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes ai-spin {
    to { transform: rotate(360deg); }
}

.ai-tag-new {
    display: inline-block;
    background: #D1FAE5;
    color: #065F46;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 500;
}