﻿/* ========== Global Variables - 外资企业专业风格 ========== */
:root {
    /* 主色调 - 深蓝商务 */
    --primary: #1a365d;
    --primary-dark: #0f2744;
    --primary-light: #2c5282;
    --accent: #0066cc;
    --accent-hover: #0052a3;
    --accent-light: rgba(0,102,204,0.08);
    
    /* 渐变色 */
    --sidebar-gradient: linear-gradient(175deg, #0b1d33 0%, #132e52 35%, #1a3d6e 100%);
    --sales-card-gradient: linear-gradient(135deg, #0f2744 0%, #1a4570 50%, #1b5a96 100%);
    --accent-gradient: linear-gradient(135deg, #0066cc 0%, #0077ee 100%);
    
    /* 状态色 - 专业沉稳 */
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0369a1;
    --info-light: #e0f2fe;
    
    /* 中性色 - 高级灰 */
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --surface: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    /* 阴影 - 精致层次 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.1), 0 4px 8px -4px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 24px 40px -8px rgba(0, 0, 0, 0.12), 0 8px 12px -6px rgba(0, 0, 0, 0.08);
    --shadow-card-hover: 0 8px 24px -4px rgba(0, 0, 0, 0.12), 0 4px 8px -4px rgba(0, 0, 0, 0.08);
    
    /* 圆角 */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* 动效 */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* 尺寸 */
    --sidebar-width: 260px;
    --navbar-height: 72px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
    letter-spacing: -0.01em;
}

/* ========== 登录页面 - 佃农主题 ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: url('../images/rural-scene.png') center center / cover no-repeat;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(15, 30, 61, 0.7) 0%, rgba(10, 20, 41, 0.8) 100%);
    backdrop-filter: blur(2px);
}

.login-container {
    background: rgba(255, 255, 255, 0.98);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 420px;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-icon-wrapper {
    width: 100%;
    height: 160px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin: 0 auto 24px;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border);
}

.login-icon-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.5;
}

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

.login-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-form input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 400;
    transition: all 0.2s ease;
    outline: none;
    background: var(--card-bg);
    color: var(--text);
}

.login-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.login-form input::placeholder {
    color: var(--text-tertiary);
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
    margin-top: 8px;
    letter-spacing: 0.5px;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-login:active {
    transform: translateY(0);
}

.login-error {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--danger-light);
    color: var(--danger);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.login-hint {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.login-hint p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 6px 0;
    text-align: center;
}

.login-hint p:first-child {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

/* ========== 主应用布局 ========== */
.main-app {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

/* ========== 侧边栏 - 高级深色渐变 ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-gradient);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(0,102,204,0.12) 0%, transparent 70%);
    pointer-events: none;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 1;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent) 0%, #0052a3 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.sidebar-logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-menu {
    flex: 1;
    padding: 16px 12px;
    list-style: none;
    position: relative;
    z-index: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
    position: relative;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
    border-left-color: rgba(255, 255, 255, 0.3);
}

.menu-item.active {
    background: rgba(0, 102, 204, 0.25);
    color: white;
    border-left-color: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(0, 102, 204, 0.3);
    font-weight: 600;
}

.menu-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    transition: transform var(--transition);
}

.menu-item:hover .menu-icon {
    transform: scale(1.1);
}

/* ========== 主内容区 ========== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ========== 顶部导航 - 玻璃拟态 ========== */
.navbar {
    height: var(--navbar-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.company-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.company-selector label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.company-selector select {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 160px;
}

.company-selector select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

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

.period-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.period-btn {
    padding: 10px 20px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.period-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.period-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.custom-date {
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-date input {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--card-bg);
}

.custom-date span {
    color: var(--text-secondary);
    font-size: 14px;
}

#applyDateBtn {
    padding: 10px 18px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#applyDateBtn:hover {
    background: var(--accent-hover);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 500;
}

.user-role {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-role.landlord {
    background: var(--primary);
    color: white;
}

.user-role.foreman {
    background: var(--accent);
    color: white;
}

.user-role.tenant {
    background: var(--success);
    color: white;
}

.btn-logout {
    padding: 10px 20px;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: var(--danger-light);
}

/* ========== 内容区 ========== */
.content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.content-header {
    margin-bottom: 32px;
}

.content-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.content-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ========== 筛选栏 - 精致卡片 ========== */
.filter-bar {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* ========== 统计卡片 - 高级质感 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid var(--border-light);
    transition: all var(--transition);
    position: relative;
}

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

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

.stat-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-icon.blue {
    background: var(--info-light);
}

.stat-icon.green {
    background: var(--success-light);
}

.stat-icon.orange {
    background: var(--warning-light);
}

.stat-icon.red {
    background: var(--danger-light);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
    font-family: 'Inter', 'SF Mono', monospace;
}

.stat-change {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

.stat-prev {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-left: auto;
}

/* ========== 表格 - 专业商务 ========== */
.table-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid var(--border-light);
    overflow: hidden;
    margin-bottom: 32px;
    transition: box-shadow var(--transition);
}

.table-container:hover {
    box-shadow: var(--shadow);
}

.table-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.table-actions {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
}

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

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

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1.5px solid var(--border);
}

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

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

thead {
    background: var(--surface);
}

th {
    padding: 16px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

th.text-right {
    text-align: right;
}

td {
    padding: 16px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}

td.text-right {
    text-align: right;
}

tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.5);
}

tr:hover {
    background: rgba(0, 102, 204, 0.04);
}

tr:last-child td {
    border-bottom: none;
}

.total-row {
    background: var(--surface);
    font-weight: 700;
}

.total-row td {
    border-top: 2px solid var(--border);
    border-bottom: none;
}

/* 趋势指示器 */
.trend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
}

.trend.up {
    background: var(--success-light);
    color: var(--success);
}

.trend.down {
    background: var(--danger-light);
    color: var(--danger);
}

.trend.flat {
    background: var(--surface);
    color: var(--text-secondary);
}

/* 数值样式 */
.amount {
    font-family: 'Inter', 'SF Mono', monospace;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.amount.large {
    font-size: 16px;
}

/* ========== 图表区域 ========== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.chart-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid var(--border-light);
    transition: box-shadow var(--transition);
}

.chart-card:hover {
    box-shadow: var(--shadow);
}

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

.chart-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* ========== 页面区块 ========== */
.page-section,
.page {
    display: none;
}

.page-section.active,
.page.active {
    display: block;
}

.section-header {
    margin-bottom: 28px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* 确保 body 和主容器可正常滚动 */
    body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
        height: auto;
    }

    .main-app {
        flex-direction: column;
        min-height: auto;
    }

    .main-content {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        overflow: visible;
    }

    .content {
        padding: 16px;
        overflow-y: visible;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        flex: 1 0 auto;
    }

    /* 页面区块允许内容自然撑开 */
    .page {
        overflow: visible;
    }

    /* 表格容器支持横向滚动 */
    .table-container,
    .region-overview {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        -ms-overflow-style: -ms-autohiding-scrollbar;
    }

    /* 表格在小屏幕上水平滚动 */
    .data-table,
    .region-table {
        min-width: 700px;
        white-space: nowrap;
    }

    .data-table td,
    .data-table th,
    .region-table td,
    .region-table th {
        padding: 10px 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* 横向滚动容器加提示边框 */
    .region-overview {
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: var(--card-bg);
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .navbar {
        padding: 0 16px;
    }
    
    .nav-left, .nav-center {
        display: none;
    }

    /* 图表容器全宽 */
    .chart-container {
        width: 100%;
        max-width: 100%;
    }

    .region-charts .chart-box {
        min-height: 280px;
        height: 300px;
    }

    /* 日期选择器适配 */
    .region-date-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* 页面标题缩小 */
    .page-header h2,
    .page-header h3 {
        font-size: 18px;
    }

    /* 长工对比容器 */
    .foreman-comparison .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ========== 加载动画 ========== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

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

.empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-desc {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ========== 数据概览页面特定样式 ========== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.metric-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid var(--border-light);
    transition: all var(--transition);
    position: relative;
}

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

.metric-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.metric-icon {
    font-size: 24px;
}

.metric-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    font-family: 'Inter', monospace;
    letter-spacing: -0.02em;
}

.metric-comparison {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.metric-prev {
    font-size: 13px;
    color: var(--text-secondary);
}

.metric-change {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.metric-change.positive {
    background: var(--success-light);
    color: var(--success);
}

.metric-change.negative {
    background: var(--danger-light);
    color: var(--danger);
}

.btn-detail {
    width: 100%;
    padding: 12px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-detail:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--info-light);
}

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

.page-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.comparison-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.comparison-toggle label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.comparison-toggle select {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--card-bg);
    cursor: pointer;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

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

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text);
}

/* ========== 数据导入页面 ========== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    background: var(--surface);
    transition: all 0.2s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--accent);
    background: var(--info-light);
}

.upload-area.dragover {
    border-color: var(--accent);
    background: var(--info-light);
}

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

.upload-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ========== 区域概览特定样式 ========== */
.region-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.region-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

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

.region-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.region-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.region-stat {
    text-align: center;
}

.region-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.region-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========== 客户分析特定样式 ========== */
.customer-filters {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.customer-filters select,
.customer-filters input {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--card-bg);
}

.customer-filters input {
    min-width: 200px;
}

.view-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.view-btn {
    padding: 10px 18px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.view-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ========== 新增/丢失客户 ========== */
.customer-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

.customer-status.new {
    background: var(--success-light);
    color: var(--success);
}

.customer-status.lost {
    background: var(--danger-light);
    color: var(--danger);
}

/* ========== 调价监控 ========== */
.price-change-up {
    color: var(--danger);
    font-weight: 600;
}

.price-change-down {
    color: var(--success);
    font-weight: 600;
}

/* ========== 对比分析 ========== */
.comparison-section {
    margin-bottom: 32px;
}

.comparison-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}

/* ========== 数据状态 ========== */
.data-status {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-top: 24px;
}

.data-status-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.data-status-item {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 4px 0;
}

/* ========== 导出按钮 ========== */
.export-btn {
    padding: 10px 18px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-btn:hover {
    background: #047857;
    box-shadow: var(--shadow);
}

/* ========== 清除数据按钮 ========== */
.clear-btn {
    padding: 10px 18px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: #b91c1c;
    box-shadow: var(--shadow);
}

/* ========== 进度条 ========== */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ========== 图表容器 - 外资企业风格 ========== */
.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-top: 32px;
}

.chart-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border: 1px solid var(--border-light);
    transition: box-shadow var(--transition);
}

.chart-container:hover {
    box-shadow: var(--shadow);
}

.chart-container.full-width {
    grid-column: 1 / -1;
}

.chart-container h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

.chart-box {
    min-height: 300px;
}

/* ========== 筛选面板 ========== */
.filter-panel {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.filter-row {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-row:last-child {
    margin-bottom: 0;
}

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

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--card-bg);
    min-width: 140px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.btn-filter {
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-reset {
    padding: 10px 20px;
    background: var(--surface);
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-reset:hover {
    border-color: var(--text-secondary);
}

/* ========== 数据表格 ========== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

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

.data-table th {
    background: var(--surface);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table td {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--card-bg);
    transition: background var(--transition-fast);
}

.data-table tbody tr:nth-child(even) td {
    background: rgba(248, 250, 252, 0.6);
}

.data-table tbody tr:hover td {
    background: rgba(0, 102, 204, 0.04);
}

.data-table .total-row {
    background: var(--surface);
    font-weight: 700;
}

.data-table .total-row td {
    border-top: 2px solid var(--border);
}

/* ========== 表格工具栏 ========== */
.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
}

.table-toolbar span {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ========== 分页 ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 20px;
}

.pagination button {
    padding: 8px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.pagination button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ========== 视图切换 ========== */
.view-content {
    display: none;
}

.view-content.active {
    display: block;
}

/* ========== 矩阵图表 ========== */
.matrix-chart,
.map-chart {
    min-height: 500px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

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

.summary-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    text-align: center;
}

.summary-card.danger {
    border-color: var(--danger-light);
    background: var(--danger-light);
}

.summary-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.summary-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    font-family: 'Inter', monospace;
}

.summary-card.danger .summary-value {
    color: var(--danger);
}

/* ========== 区域概览特定样式 ========== */
.region-overview {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 32px;
}

.region-table th,
.region-table td {
    text-align: right;
    padding: 14px 16px;
}

.region-table th:first-child,
.region-table td:first-child {
    text-align: left;
}

.region-date-selector {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.region-charts {
    margin-top: 32px;
}

.foreman-comparison {
    margin-top: 48px;
}

.update-info {
    margin-top: 32px;
}

.info-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.info-card h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}

.info-card ul {
    list-style: none;
}

.info-card li {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 8px 0;
}

.date-info {
    font-size: 14px;
    color: var(--text-secondary);
}

.date-info strong {
    color: var(--text);
}

/* ========== 导入页面 ========== */
.import-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.import-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.import-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.import-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    background: var(--surface);
    transition: all 0.2s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--accent);
    background: var(--info-light);
}

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

.upload-hint {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 8px;
}

.upload-status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
}

.upload-status.success {
    background: var(--success-light);
    color: var(--success);
}

.upload-status.error {
    background: var(--danger-light);
    color: var(--danger);
}

.data-status {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.status-row:last-child {
    border-bottom: none;
}

.status-row span {
    font-size: 14px;
    color: var(--text-secondary);
}

.status-row strong {
    font-size: 14px;
    color: var(--text);
}

.import-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-danger {
    padding: 10px 18px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-export {
    padding: 10px 18px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-export:hover {
    background: #047857;
}

/* ========== 弹窗 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

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

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 8px 0;
}

.modal-chart {
    min-height: 300px;
    margin-bottom: 24px;
}

.variance-list {
    max-height: 300px;
    overflow-y: auto;
}

/* ========== 产品分析布局 ========== */
.product-analysis {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.product-analysis .chart-container:first-child {
    grid-column: 1 / -1;
}

/* ========== 对比分析布局 ========== */
.comparison-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.variance-table-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.variance-table-container h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
}

/* ========== 新增/丢失客户布局 ========== */
.new-customers-content,
.lost-customers-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ========== 调价监控布局 ========== */
.price-change-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ========== 高亮卡片 ========== */
.metric-card.highlight-new {
    border-color: var(--success-light);
}

.metric-card.highlight-lost {
    border-color: var(--danger-light);
}

.metric-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ========== 长工对比表格 ========== */
.foreman-table {
    margin-bottom: 24px;
}

.foreman-table h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: var(--radius);
}

/* ========== 月度分析页面 ========== */
.monthly-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.monthly-controls label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.monthly-controls input[type="month"] {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--card-bg);
}

.monthly-controls select {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--card-bg);
}

.monthly-controls input:focus,
.monthly-controls select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* ========== 数据概览大卡片 ========== */
.sales-overview-card {
    background: var(--sales-card-gradient);
    border-radius: 16px;
    padding: 40px;
    color: white;
    margin-bottom: 28px;
    box-shadow: 0 12px 40px rgba(15, 39, 68, 0.35), 0 4px 12px rgba(0, 102, 204, 0.15);
    position: relative;
    overflow: hidden;
}

.sales-overview-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
    pointer-events: none;
}

.sales-overview-card::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(0,153,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}
.sales-overview-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.sales-overview-icon { font-size: 32px; }
.sales-overview-label { font-size: 16px; font-weight: 500; opacity: 0.95; }
.sales-overview-value { font-size: 48px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 12px; }
.sales-overview-sub { font-size: 14px; opacity: 0.75; }
.content-subtitle { font-size: 13px; color: var(--text-secondary); margin-left: 16px; }
.stat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.stat-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }

/* ========== AI 工作台 ========== */
.ai-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.ai-page-header h2 {
    margin-bottom: 6px;
}

.ai-workspace {
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(360px, 1fr) minmax(260px, 340px);
    gap: 20px;
    align-items: start;
}

.ai-agents-panel,
.ai-meeting-panel,
.ai-tasks-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 22px;
}

.panel-title-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 18px;
}

.panel-title-row strong {
    font-size: 18px;
    color: var(--text);
}

.panel-kicker {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.agent-card {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: #fbfdff;
    margin-bottom: 12px;
}

.agent-card.active {
    border-color: rgba(0, 102, 204, 0.35);
    background: linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
}

.agent-avatar {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
    font-weight: 800;
    box-shadow: var(--shadow-sm);
}

.agent-avatar-ceo { background: linear-gradient(135deg, #1a365d, #0066cc); }
.agent-avatar-data { background: linear-gradient(135deg, #0369a1, #14b8a6); }
.agent-avatar-growth { background: linear-gradient(135deg, #7c2d12, #d97706); }
.agent-avatar-qa { background: linear-gradient(135deg, #374151, #64748b); }

.agent-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.agent-info strong {
    font-size: 14px;
    color: var(--text);
}

.agent-info span,
.agent-card em {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: normal;
}

.agent-card em {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    white-space: nowrap;
}

.meeting-feed {
    min-height: 390px;
    max-height: 520px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 2px 16px;
}

.meeting-message {
    width: min(86%, 620px);
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border-light);
}

.meeting-message.muted {
    background: #f8fafc;
}

.meeting-message .message-role {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 6px;
}

.meeting-message p {
    margin: 0;
    color: var(--text);
    line-height: 1.7;
}

.ai-command-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.ai-command-bar input {
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
}

.ai-command-bar input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.task-item {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
}

.task-item strong {
    display: block;
    color: var(--text);
    margin-bottom: 4px;
}

.task-item p,
.memory-box p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
}

.task-priority {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.task-priority.high { background: var(--danger); }
.task-priority.mid { background: var(--warning); }

.memory-box {
    margin-top: 18px;
    padding: 16px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #f8fafc 0%, #eef6ff 100%);
    border: 1px solid var(--border-light);
}

@media (max-width: 1200px) {
    .ai-workspace {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .ai-page-header,
    .ai-command-bar {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .meeting-message {
        width: 100%;
    }
}

/* ========== 2026-06 移动端与视觉优化 ========== */
.sidebar-mobile-header,
.mobile-menu-toggle,
.sidebar-backdrop {
    display: none;
}

.navbar {
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.content {
    width: 100%;
    max-width: 1680px;
    margin: 0 auto;
}

.page-header {
    gap: 12px;
    flex-wrap: wrap;
}

.chart-card,
.table-container,
.sales-overview-card,
.metric-card {
    border: 1px solid var(--border-light);
}

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 1024px) {
    body.nav-open {
        overflow: hidden;
    }

    .main-content {
        width: 100%;
        min-width: 0;
        max-width: 100vw;
    }

    .sidebar {
        width: min(82vw, 300px);
        z-index: 1002;
        box-shadow: 18px 0 40px rgba(15, 23, 42, 0.24);
    }

    .sidebar-mobile-header {
        min-height: 68px;
        padding: 0 14px 0 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }

    .sidebar-mobile-header strong {
        font-size: 17px;
        letter-spacing: 0;
    }

    .sidebar-close {
        width: 42px;
        height: 42px;
        border: 0;
        background: transparent;
        color: white;
        font-size: 30px;
        line-height: 1;
        cursor: pointer;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1001;
        display: block;
        border: 0;
        background: rgba(15, 23, 42, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }

    .sidebar-backdrop.visible {
        opacity: 1;
        visibility: visible;
    }

    .mobile-menu-toggle {
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        padding: 0;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: var(--card-bg);
        cursor: pointer;
    }

    .mobile-menu-toggle span {
        width: 19px;
        height: 2px;
        border-radius: 2px;
        background: var(--primary);
    }

    .navbar {
        min-height: 68px;
        height: auto;
        padding: 10px 20px;
    }

    .nav-left {
        gap: 12px;
    }

    .company-selector select {
        min-width: 210px;
    }

    .content {
        padding: 24px;
    }

    .metrics-grid,
    #companySalesGrid,
    #selfOperatedGrid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
        letter-spacing: 0;
    }

    .login-page {
        align-items: flex-end;
        padding: 20px 14px;
    }

    .login-container {
        width: 100%;
        max-width: 460px;
        padding: 26px 20px;
        border-radius: var(--radius-lg);
    }

    .login-icon-wrapper {
        height: 120px;
        margin-bottom: 18px;
    }

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

    .login-header h1 {
        font-size: 24px;
    }

    .navbar {
        width: 100%;
        min-width: 0;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
    }

    .nav-left {
        display: flex;
        flex: 1;
        min-width: 0;
    }

    .company-selector {
        flex: 1;
        min-width: 0;
    }

    .company-selector label {
        display: none;
    }

    .company-selector select {
        width: 100%;
        min-width: 0;
        max-width: 230px;
        padding: 10px 34px 10px 12px;
    }

    .nav-right {
        flex: 0 0 auto;
        gap: 8px;
    }

    .user-info {
        max-width: 92px;
        overflow: hidden;
        padding: 9px 10px;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .btn-logout {
        padding: 10px 12px;
        white-space: nowrap;
    }

    .content {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        padding: 18px 12px 28px;
        overflow-x: hidden;
    }

    .page,
    .page-header,
    .data-scope-alert,
    .alert-content,
    .alert-text,
    .region-overview,
    .region-charts,
    .foreman-comparison,
    .update-info {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .date-info {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 4px 12px;
    }

    .region-date-selector {
        width: 100%;
        min-width: 0;
        flex-wrap: wrap;
        align-items: center;
    }

    .region-date-selector input {
        max-width: 100%;
    }

    .data-scope-alert {
        margin-bottom: 16px;
    }

    .alert-content {
        align-items: flex-start;
    }

    .page-header {
        align-items: flex-start;
        margin-bottom: 18px;
    }

    .page-header h2,
    .section-header h2 {
        font-size: 21px;
    }

    .content-subtitle {
        width: 100%;
        margin-left: 0;
    }

    .sales-overview-card {
        padding: 24px 18px;
        margin-bottom: 20px;
        border-radius: var(--radius-lg);
    }

    .sales-overview-header {
        align-items: flex-start;
    }

    .sales-overview-label {
        font-size: 14px;
        line-height: 1.5;
    }

    .sales-overview-value {
        font-size: clamp(30px, 9vw, 42px);
        overflow-wrap: anywhere;
    }

    .sales-overview-sub {
        line-height: 1.7;
    }

    .metrics-grid,
    #companySalesGrid,
    #selfOperatedGrid,
    .stats-grid,
    .summary-cards,
    .dashboard-charts {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .metric-card,
    .chart-card,
    .chart-container,
    .ai-agents-panel,
    .ai-meeting-panel,
    .ai-tasks-panel {
        min-width: 0;
        padding: 18px;
        border-radius: var(--radius);
    }

    .chart-box,
    [id$="Chart"] {
        width: 100% !important;
        max-width: 100%;
        min-height: 300px;
    }

    .table-container,
    .variance-table-container {
        width: 100%;
        overflow-x: auto;
        border-radius: var(--radius);
    }

    .data-table,
    table {
        min-width: 680px;
    }

    .filter-panel,
    .filter-row,
    .monthly-controls,
    .project-controls {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group,
    .filter-group select,
    .filter-group input,
    .monthly-controls select,
    .monthly-controls input {
        width: 100%;
        min-width: 0;
    }

    .ai-page-header,
    .ai-command-bar {
        display: flex;
        width: 100%;
    }

    .ai-workspace {
        gap: 14px;
    }
}

@media (max-width: 390px) {
    .user-info {
        display: none;
    }

    .company-selector select {
        max-width: none;
    }
}

/* ========== 2026-06-09 UI 美化新增: 汉堡菜单动画 ========== */
.mobile-menu-toggle {
    transition: all var(--transition);
}

.mobile-menu-toggle span {
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    transform-origin: center;
}

body.nav-open .mobile-menu-toggle {
    background: var(--primary);
    border-color: var(--primary);
}

body.nav-open .mobile-menu-toggle span {
    background: white;
}

body.nav-open .mobile-menu-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

body.nav-open .mobile-menu-toggle span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

body.nav-open .mobile-menu-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ========== 页面切换过渡动画 ========== */
.page {
    animation: pageFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ========== 区域自营占位卡片美化 ========== */
.placeholder-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    border: 2px dashed var(--border) !important;
    border-radius: var(--radius-lg) !important;
    transition: all var(--transition);
}

.placeholder-card:hover {
    border-color: var(--accent) !important;
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%) !important;
}

/* ========== 按钮增强悬浮效果 ========== */
.btn-primary {
    transition: all var(--transition);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 102, 204, 0.3);
}

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

.btn-detail {
    transition: all var(--transition);
}

.btn-detail:hover {
    transform: translateY(-1px);
}

/* ========== 公司选择器增强 ========== */
.company-selector select {
    transition: all var(--transition);
}

.company-selector select:hover {
    border-color: var(--accent);
}

/* ========== 退出按钮增强 ========== */
.btn-logout {
    transition: all var(--transition);
}

/* ========== 侧边栏滚动条美化 ========== */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* ========== 数据导入预览 ========== */
.import-preview {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 20px;
    border: 1px solid var(--border);
}

.import-preview h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.preview-stat {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 14px 16px;
    text-align: center;
}

.preview-stat .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.preview-stat .stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

.preview-stat .stat-date {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.preview-detail {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.preview-detail table {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
}

.preview-detail th {
    background: var(--bg);
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    position: sticky;
    top: 0;
    z-index: 1;
}

.preview-detail td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.preview-detail tr:hover td {
    background: rgba(0, 102, 204, 0.03);
}

.preview-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-import-confirm {
    padding: 10px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-import-confirm:hover {
    background: #0052a3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.btn-import-cancel {
    padding: 10px 24px;
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-import-cancel:hover {
    background: var(--border-light);
}

.import-merge-result {
    padding: 16px;
    border-radius: var(--radius);
    margin-top: 16px;
    font-size: 14px;
}

.import-merge-result.success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid rgba(0, 200, 83, 0.2);
}

.import-merge-result h4 {
    color: var(--success);
    margin-bottom: 8px;
}

.no-permission-message {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    border: 2px dashed var(--border);
}

.no-permission-message .lock-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.no-permission-message h3 {
    font-size: 18px;
    color: var(--text);
    margin-bottom: 8px;
}

.no-permission-message p {
    font-size: 14px;
    color: var(--text-secondary);
}

.upload-loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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