/* ===== 一体化工作台样式 ===== */

/* 重置默认样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
                'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #f5f6f8;
    overflow: hidden;
}

/* ===== 顶部导航栏 ===== */
.workbench-header {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 18px;
}

.product-info {
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    color: #1f2329;
}

.product-sub {
    font-size: 12px;
    color: #8f959e;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 20px;
}

.global-search {
    position: relative;
    width: 400px;
    max-width: 100%;
}

.global-search input {
    width: 100%;
    height: 36px;
    padding: 0 40px 0 16px;
    border: 1px solid #e1e4e8;
    border-radius: 18px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.global-search input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.global-search .search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #8f959e;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-icon {
    position: relative;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: #f5f6f8;
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #f5222d;
    color: #fff;
    border-radius: 9px;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}

.work-status-selector {
    position: relative;
}

.work-status-selector select {
    height: 32px;
    padding: 0 28px 0 10px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    background: #fff;
    appearance: none;
}

.user-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-dropdown:hover {
    background: #f5f6f8;
}

.user-name {
    font-size: 14px;
    color: #1f2329;
    font-weight: 500;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    min-width: 150px;
    z-index: 1001;
}

.dropdown-item {
    padding: 10px 16px;
    font-size: 14px;
    color: #1f2329;
    cursor: pointer;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #f5f6f8;
}

.dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

/* ===== 主体容器 ===== */
.workbench-container {
    display: flex;
    height: calc(100vh - 56px);
    margin-top: 56px;
}

/* ===== 左侧导航菜单 ===== */
.workbench-sidebar {
    width: 200px;
    background: #fff;
    border-right: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-nav {
    padding: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #1f2329;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    text-decoration: none;
}

.nav-item:hover {
    background: #f5f6f8;
    color: #667eea;
}

.nav-item.active {
    background: #f0f3ff;
    color: #667eea;
    font-weight: 500;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #667eea;
}

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

.nav-item-text {
    flex: 1;
}

.nav-item-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #f5222d;
    color: #fff;
    border-radius: 9px;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}

.nav-divider {
    height: 1px;
    background: #e8e8e8;
    margin: 8px 0;
}

/* ===== 主内容区域 ===== */
.workbench-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f5f6f8;
}

#moduleContainer {
    flex: 1;
    overflow: hidden;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #8f959e;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e8e8e8;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-state p {
    margin-top: 16px;
    font-size: 14px;
}

/* ===== 模块容器样式 ===== */
.module-content {
    height: 100%;
    background: #fff;
    animation: fadeIn 0.3s ease-in;
}

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

/* ===== 客户管理模块样式 ===== */
.customers-module {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f5f6f8;
}

.customers-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
}

.header-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.header-title h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2329;
    margin: 0;
}

.customer-count {
    font-size: 13px;
    color: #8f959e;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 280px;
    height: 36px;
    padding: 0 40px 0 12px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.search-box input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.search-box .search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #8f959e;
}

.btn-refresh {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    color: #1f2329;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-refresh:hover {
    border-color: #667eea;
    color: #667eea;
}

.customers-filters {
    padding: 16px 24px;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
}

.filter-tabs {
    display: flex;
    gap: 8px;
}

.filter-tab {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 14px;
    color: #1f2329;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tab:hover {
    background: #f5f6f8;
}

.filter-tab.active {
    background: #f0f3ff;
    color: #667eea;
    font-weight: 500;
}

.customers-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.customer-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.customer-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.customer-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102,126,234,0.1);
    transform: translateY(-2px);
}

.customer-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.customer-info {
    flex: 1;
    min-width: 0;
}

.customer-name {
    font-size: 15px;
    font-weight: 500;
    color: #1f2329;
    margin-bottom: 4px;
}

.customer-id {
    font-size: 12px;
    color: #8f959e;
    margin-bottom: 8px;
}

.customer-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #8f959e;
}

.meta-icon {
    font-size: 14px;
}

.customer-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    padding: 2px 8px;
    background: #f5f6f8;
    border-radius: 4px;
    font-size: 11px;
    color: #8f959e;
}

.customer-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-icon-small {
    width: 32px;
    height: 32px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon-small:hover {
    border-color: #667eea;
    color: #667eea;
}

.customers-pagination {
    padding: 16px 24px;
    background: #fff;
    border-top: 1px solid #e8e8e8;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    color: #1f2329;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover:not(.disabled) {
    border-color: #667eea;
    color: #667eea;
}

.pagination-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: #fff;
}

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

.pagination-ellipsis {
    padding: 0 8px;
    color: #8f959e;
}

/* 客户详情侧边栏 */
.customer-detail-sidebar {
    position: fixed;
    top: 56px;
    right: 0;
    width: 400px;
    height: calc(100vh - 56px);
    background: #fff;
    border-left: 1px solid #e8e8e8;
    box-shadow: -4px 0 16px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    z-index: 999;
    animation: slideInRight 0.3s ease;
}

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

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e8e8e8;
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1f2329;
    margin: 0;
}

.btn-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-close:hover {
    background: #f5f6f8;
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.customer-detail-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.detail-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1f2329;
    margin: 0 0 8px 0;
}

.detail-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}

.detail-name {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #1f2329;
}

.detail-id {
    text-align: center;
    font-size: 13px;
    color: #8f959e;
}

.detail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.detail-item .label {
    color: #8f959e;
}

.detail-item .value {
    color: #1f2329;
    font-weight: 500;
}

.btn-primary {
    height: 40px;
    padding: 0 24px;
    border: none;
    border-radius: 6px;
    background: #667eea;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-block {
    width: 100%;
}

.empty-state, .error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    color: #8f959e;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state p, .error-state p {
    font-size: 14px;
    margin-bottom: 16px;
}

/* ===== 数据统计模块样式 ===== */
.statistics-module {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f5f6f8;
}

.statistics-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
}

.statistics-header .header-title h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2329;
    margin: 0;
}

.statistics-header .subtitle {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #8f959e;
}

.statistics-header .header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-range {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #8f959e;
}

.date-range select {
    height: 32px;
    padding: 0 10px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    background: #f5f6f8;
    font-size: 13px;
    color: #8f959e;
}

.statistics-body {
    flex: 1;
    padding: 16px 24px 24px;
    overflow: auto;
}

.statistics-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.stat-card {
    padding: 16px 18px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e8e8e8;
}

.stat-card.primary {
    border-color: #667eea;
    box-shadow: 0 4px 14px rgba(102,126,234,0.16);
}

.stat-title {
    font-size: 13px;
    color: #8f959e;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 26px;
    font-weight: 600;
    color: #1f2329;
}

.stat-unit {
    font-size: 14px;
    margin-left: 4px;
    color: #8f959e;
}

.stat-desc {
    margin-top: 4px;
    font-size: 12px;
    color: #8f959e;
}

.stat-charts {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.5fr);
    gap: 16px;
}

.stat-chart-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e8e8e8;
    padding: 16px 18px 16px;
    display: flex;
    flex-direction: column;
}

.stat-chart-card.secondary {
    background: linear-gradient(135deg, #f9fafb 0%, #f5f6ff 100%);
}

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

.chart-title {
    font-size: 14px;
    font-weight: 500;
    color: #1f2329;
}

.chart-subtitle {
    margin-top: 2px;
    font-size: 12px;
    color: #8f959e;
}

.chart-body {
    flex: 1;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 32px;
    height: 180px;
    padding: 8px 0 4px;
}

.bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.bar {
    position: relative;
    width: 40px;
    min-height: 4px;
    border-radius: 20px 20px 6px 6px;
    background: linear-gradient(180deg, #667eea 0%, #4c6fff 100%);
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.bar-secondary {
    background: linear-gradient(180deg, #52c41a 0%, #3f9f14 100%);
}

.bar-value {
    position: absolute;
    top: -22px;
    font-size: 12px;
    color: #1f2329;
}

.bar-label {
    font-size: 12px;
    color: #8f959e;
}

.chart-footer {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    margin-top: 8px;
    font-size: 12px;
    color: #8f959e;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d9d9d9;
}

.legend-dot.primary {
    background: #667eea;
}

.legend-dot.secondary {
    background: #52c41a;
}

.chart-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
}

/* ===== 设置模块样式 ===== */
.settings-module {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f5f6f8;
}

.settings-header {
    padding: 20px 24px;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
}

.settings-header .header-title h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2329;
    margin: 0;
}

.settings-header .subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: #8f959e;
}

.settings-body {
    flex: 1;
    padding: 16px 24px 24px;
    overflow: auto;
}

.settings-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.5fr);
    gap: 16px;
}

.settings-section {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e8e8e8;
    padding: 16px 18px 18px;
    margin-bottom: 12px;
}

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

.section-title {
    font-size: 14px;
    font-weight: 500;
    color: #1f2329;
}

.section-subtitle {
    margin-top: 2px;
    font-size: 12px;
    color: #8f959e;
}

.section-body {
    margin-top: 6px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed #f0f0f0;
}

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

.settings-item .item-text {
    flex: 1;
}

.settings-item .item-title {
    font-size: 14px;
    color: #1f2329;
}

.settings-item .item-desc {
    margin-top: 2px;
    font-size: 12px;
    color: #8f959e;
}

.settings-item .item-control {
    flex-shrink: 0;
}

/* 开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d9d9d9;
    transition: .2s;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
}

.switch input:checked + .slider {
    background-color: #52c41a;
}

.switch input:checked + .slider:before {
    transform: translateX(20px);
}

.user-profile {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

.user-avatar-large {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #fff;
    flex-shrink: 0;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-name-large {
    font-size: 16px;
    font-weight: 600;
    color: #1f2329;
}

.user-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: #8f959e;
}

.user-meta-item::before {
    content: '•';
    margin: 0 4px 0 0;
}

.user-extra {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px 16px;
    font-size: 13px;
}

.user-extra-item .label {
    display: block;
    font-size: 12px;
    color: #8f959e;
    margin-bottom: 2px;
}

.user-extra-item .value {
    color: #1f2329;
}

/* 骨架屏样式 */
.user-profile-skeleton {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-skeleton {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #f0f0f0;
}

.text-skeleton {
    height: 12px;
    border-radius: 4px;
    background: #f0f0f0;
    margin-bottom: 6px;
}

.text-skeleton.short {
    width: 80px;
}

.text-skeleton.long {
    width: 160px;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .workbench-sidebar {
        width: 60px;
    }
    
    .nav-item-text {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
        padding: 12px;
    }
    
    .product-info {
        display: none;
    }
    
    .global-search {
        display: none;
    }
    
    .customer-cards {
        grid-template-columns: 1fr;
    }
    
    .customer-detail-sidebar {
        width: 100%;
    }
}

