* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90d9;
    --primary-hover: #3a7bc8;
    --bg-color: #f0f4f8;
    --sidebar-bg: #ffffff;
    --header-bg: #b8c5d6;
    --text-color: #333333;
    --text-light: #666666;
    --border-color: #e0e0e0;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --success-color: #52c41a;
    --warning-color: #faad14;
    --danger-color: #ff4d4f;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-weight: 300;
}

* {
    font-weight: 300;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* 顶部导航栏 */
.header {
    background: var(--header-bg);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.logo {
    font-size: 20px;
    font-weight: 300;
    color: #2c3e50;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    font-size: 24px;
}

.username {
    color: #2c3e50;
}

.logout-btn {
    padding: 6px 16px;
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

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

/* 主容器 */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧导航 */
.sidebar {
    background: var(--sidebar-bg);
    width: 250px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width 0.3s;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 60px;
}

.collapse-btn {
    padding: 16px;
    background: #f5f7fa;
    border: none;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.collapse-btn:hover {
    background: #e8ecf1;
}

.nav-menu {
    padding: 8px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: #f5f7fa;
}

.nav-item.active {
    background: #e6f0ff;
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.nav-item .icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar.collapsed .nav-item .text {
    display: none;
}

.sidebar.collapsed .collapse-btn span {
    display: inline;
}

.sidebar.collapsed .collapse-btn {
    justify-content: center;
}

/* 主内容区域 */
.content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* 页面 */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* 仪表盘 */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    text-align: center;
}

.card h3 {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 16px;
    font-weight: 300;
}

.card .value {
    font-size: 32px;
    font-weight: 300;
    color: var(--primary-color);
}

/* 图表区域 */
.chart-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.chart-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--card-shadow);
}

.chart-card h3 {
    margin-bottom: 16px;
    color: var(--text-color);
}

#orderChart {
    width: 100%;
    height: auto;
    max-width: 100%;
}

#yearlyChart,
#monthlyComparisonChart {
    width: 100%;
    height: auto;
    max-width: 100%;
}

/* Canvas 高分辨率支持 */
canvas {
    max-width: 100%;
    height: auto;
}

/* 员工排名 */
#top-employees {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.employee-rank {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f5f7fa;
    border-radius: 6px;
}

.rank-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 300;
    font-size: 14px;
}

.rank-number.gold {
    background: #ffd700;
}

.rank-number.silver {
    background: #c0c0c0;
}

.rank-number.bronze {
    background: #cd7f32;
}

.employee-name {
    flex: 1;
}

.employee-score {
    font-weight: 300;
    color: var(--primary-color);
}

/* 页面头部 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 24px;
    color: var(--text-color);
}

/* 按钮 */
.btn-primary {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

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

.btn-secondary {
    padding: 10px 20px;
    background: white;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #f5f7fa;
}

/* 表格 */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

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

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

.data-table th {
    background: #f5f7fa;
    font-weight: 300;
    color: var(--text-color);
}

.data-table tr:hover {
    background: #f9fafb;
}

.data-table td img {
    display: block;
    margin: 0 auto;
}

/* 状态标签 */
.status-tag {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 300;
}

.status-pending {
    background: #fff7e6;
    color: var(--warning-color);
}

.status-processing {
    background: #e6f7ff;
    color: var(--primary-color);
}

.status-completed {
    background: #f6ffed;
    color: var(--success-color);
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.filter-bar input,
.filter-bar select {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.filter-bar input {
    flex: 1;
    max-width: 300px;
}

/* 排行榜 */
.ranking-section {
    margin-bottom: 24px;
}

.ranking-section h3 {
    margin-bottom: 16px;
    color: var(--text-color);
    font-size: 18px;
}

.ranking-list {
    background: white;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    padding: 16px;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-item:hover {
    background: #f9fafb;
}

/* 目标管理 */
.targets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.target-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--card-shadow);
}

.target-card h3 {
    margin-bottom: 16px;
}

.progress-bar {
    height: 12px;
    background: #e8e8e8;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    border-radius: 6px;
    transition: width 0.3s;
}

.progress-text {
    color: var(--text-light);
    font-size: 14px;
    font-weight: 300;
}

.target-subtext {
    color: var(--text-light);
    font-size: 12px;
    margin-top: 8px;
    opacity: 0.8;
}

.target-hierarchy {
    margin-top: 12px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f0f7ff 0%, #e6f0ff 100%);
    border-radius: 6px;
    font-size: 11px;
    color: var(--primary-color);
    border: 1px solid rgba(74, 144, 217, 0.2);
}

.target-hierarchy strong {
    font-size: 12px;
}

/* 年度对比分析 */
.year-comparison {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--card-shadow);
}

.year-comparison h3 {
    margin-bottom: 16px;
    color: var(--text-color);
    font-size: 18px;
}

.comparison-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.comparison-section h4 {
    margin-bottom: 12px;
    color: var(--text-color);
    font-size: 16px;
}

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

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

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

.comparison-table th {
    background: #f5f7fa;
    font-weight: 300;
    color: var(--text-color);
    white-space: nowrap;
}

.comparison-table tr:hover {
    background: #f9fafb;
}

.growth-up {
    color: var(--success-color);
    font-weight: 300;
}

.growth-down {
    color: var(--danger-color);
    font-weight: 300;
}

/* 分页控件 */
.pagination {
    background: white;
    border-radius: 8px;
    padding: 12px 20px;
    box-shadow: var(--card-shadow);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 表格复选框 */
.data-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 设置页面 */
.settings-section {
    margin-bottom: 32px;
}

.settings-section h3 {
    margin-bottom: 16px;
    color: var(--text-color);
    font-size: 18px;
}

.settings-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
}

.settings-card p {
    color: var(--text-light);
    line-height: 1.6;
}

/* 设置表单 */
.settings-form,
.feedback-form {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    max-width: 600px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 300;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* 表格复选框 */
.data-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 响应式 */
@media (max-width: 768px) {
    .chart-section {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 60px;
        height: calc(100vh - 60px);
        z-index: 99;
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-bar > div {
        width: 100%;
    }
    
    .filter-bar input {
        width: 100% !important;
    }
}
