:root {
    --primary: #1677FF;
    --sidebar-bg: #001529;
    --sidebar-text: #ffffffa6;
    --sidebar-active: #1677FF;
    --bg-body: #F0F2F5;
    --card-bg: #FFFFFF;
    --text-primary: #1D2129;
    --text-secondary: #86909C;
}

body {
    background-color: var(--bg-body);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 220px;
    background: var(--sidebar-bg);
    padding-top: 60px;
    overflow-y: auto;
    z-index: 100;
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 10px 20px;
    border-radius: 0;
    transition: all 0.2s;
}

.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

.sidebar .nav-link.active {
    color: #fff;
    background: var(--sidebar-active);
}

.sidebar .nav-link .icon {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.sidebar .divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 8px 16px;
}

/* 顶部导航 */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    z-index: 200;
    display: flex;
    align-items: center;
    padding: 0 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 4px;
    height: 100%;
}

.topbar-brand-icon {
    height: 56px;
    width: 56px;
    object-fit: contain;
}

.topbar-brand-text {
    color: var(--primary);
    font-size: 22px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.topbar-link {
    font-size: 14px;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
}

.topbar-link:hover {
    color: var(--primary);
}

.topbar .user-menu {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

/* 主内容区 */
.main-content {
    margin-left: 220px;
    margin-top: 64px;
    padding: 24px;
    min-height: calc(100vh - 56px);
}

/* 卡片 */
.card-crm {
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    padding: 20px;
    margin-bottom: 16px;
}

/* 统计卡片 */
.stat-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid var(--primary);
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-card .stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 页面标题 */
.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* 表格 */
.table-crm {
    width: 100%;
    border-collapse: collapse;
}

.table-crm th {
    background: #fafafa;
    padding: 12px 16px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 1px solid #e8e8e8;
    font-size: 13px;
}

.table-crm td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    color: var(--text-primary);
}

.table-crm tr:hover {
    background: #f5f5f5;
}

/* 可排序表头 */
th.sortable {
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

th.sortable .sort-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

th.sortable .sort-link:hover {
    color: var(--primary);
}

th.sortable.sorted {
    color: var(--primary);
}

th.sortable .sort-arrow {
    font-size: 0.75em;
    opacity: 0.5;
    line-height: 1;
}

th.sortable.sorted .sort-arrow {
    opacity: 1;
    font-weight: 700;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .topbar .logo {
        margin-left: 0;
    }
}
