/* ===================================
   数据分析面板样式
   =================================== */

/* 分析面板容器 */
.analytics-panel {
    display: none;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}

.analytics-panel.visible {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 面板标题栏 */
.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #0066ff 0%, #0052cc 100%);
    color: #fff;
}

.analytics-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analytics-header .close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.analytics-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* 完成率指标区 */
.analytics-rates {
    display: flex;
    gap: 20px;
    padding: 20px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.rate-card {
    flex: 1;
    min-width: 200px;
    background: #fff;
    border-radius: var(--radius-md);
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid #0066ff;
}

.rate-card.guarantee {
    border-left-color: #10b981;
}

.rate-card.target {
    border-left-color: #f59e0b;
}

.rate-card .rate-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.rate-card .rate-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.rate-card .rate-value.high {
    color: #10b981;
}

.rate-card .rate-value.medium {
    color: #f59e0b;
}

.rate-card .rate-value.low {
    color: #ef4444;
}

.rate-card .rate-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 内容区域 */
.analytics-body {
    padding: 24px;
}

.analytics-section {
    margin-bottom: 28px;
}

.analytics-section:last-child {
    margin-bottom: 0;
}

.analytics-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #0066ff;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 汇总表格 */
.analytics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.analytics-table thead th {
    background: #2d7a3a;
    color: #fff;
    padding: 10px 12px;
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid #1e6b2d;
}

.analytics-table tbody td {
    padding: 8px 12px;
    text-align: center;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

.analytics-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.analytics-table tbody tr:hover {
    background: #eff6ff;
}

.analytics-table tbody tr.total-row {
    background: #fef3c7 !important;
    font-weight: 700;
}

.analytics-table tbody td.manager-name {
    text-align: left;
    font-weight: 500;
    color: var(--text-primary);
}

/* 开票完成率颜色渐变 */
.analytics-table .rate-cell {
    font-weight: 600;
}

.rate-cell.rate-high {
    background: #dcfce7 !important;
    color: #166534;
}

.rate-cell.rate-medium {
    background: #fef9c3 !important;
    color: #854d0e;
}

.rate-cell.rate-low {
    background: #fee2e2 !important;
    color: #991b1b;
}

/* 图表与明细并排布局 */
.analytics-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.analytics-col-chart {
    flex: 1;
    min-width: 400px;
}

.analytics-col-detail {
    flex: 1;
    min-width: 400px;
}

/* 图表容器 */
.chart-container {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 16px;
    height: 360px;
    position: relative;
}

/* 交付中项目明细表 */
.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.detail-table thead th {
    background: #0066ff;
    color: #fff;
    padding: 8px 10px;
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid #0052cc;
}

.detail-table tbody td {
    padding: 7px 10px;
    text-align: center;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

.detail-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.detail-table tbody tr:hover {
    background: #eff6ff;
}

.detail-table tbody tr.detail-total-row {
    background: #dbeafe !important;
    font-weight: 700;
}

/* 说明区域 */
.analytics-notes {
    background: linear-gradient(135deg, #f0f9ff 0%, #e8f5ff 100%);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-md);
    padding: 20px 24px;
}

.analytics-notes h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 6px;
}

.analytics-notes ul {
    margin: 0;
    padding-left: 18px;
    line-height: 1.8;
}

.analytics-notes li {
    font-size: 13px;
    color: #334155;
    margin-bottom: 4px;
}

.analytics-notes li strong {
    color: #1e293b;
}

.analytics-notes .note-formula {
    font-family: 'Consolas', 'Monaco', monospace;
    background: rgba(0, 102, 255, 0.08);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    color: #0066ff;
}

/* 响应式 */
@media (max-width: 768px) {
    .analytics-rates {
        flex-direction: column;
    }

    .analytics-row {
        flex-direction: column;
    }

    .analytics-col-chart,
    .analytics-col-detail {
        min-width: 100%;
    }

    .analytics-table,
    .detail-table {
        font-size: 11px;
    }

    .analytics-table thead th,
    .analytics-table tbody td,
    .detail-table thead th,
    .detail-table tbody td {
        padding: 6px 8px;
    }
}