/* ============================================
   销售管理系统 - 专业CRM样式
   设计风格: 飞鱼CRM风格 - 简洁、现代、专业
   ============================================ */

/* 基础重置 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* 主色调 - 专业蓝色系 */
    --primary: #1a73e8;
    --primary-light: #4285f4;
    --primary-dark: #1557b0;
    --primary-50: #e8f0fe;
    --primary-100: #d2e3fc;
    
    /* 辅助色 */
    --accent: #fbbc04;
    --accent-light: #fdd663;
    
    /* 功能色 */
    --success: #34a853;
    --success-50: #e6f4ea;
    --warning: #fbbc04;
    --warning-50: #fef7e0;
    --danger: #ea4335;
    --danger-50: #fce8e6;
    --info: #4285f4;
    --info-50: #e8f0fe;
    
    /* 灰度色 */
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f4;
    --gray-200: #e8eaed;
    --gray-300: #dadce0;
    --gray-400: #9aa0a6;
    --gray-500: #80868b;
    --gray-600: #5f6368;
    --gray-700: #3c4043;
    --gray-800: #202124;
    --gray-900: #1a1a2e;
    
    /* 布局 */
    --sidebar-width: 200px;
    --sidebar-collapsed-width: 72px;
    --topbar-height: 64px;
    
    /* 圆角 */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* 阴影 */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    
    /* 动画 */
    --transition-fast: all 0.15s ease;
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s ease;
    
    /* 字体 */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

html { 
    font-size: 14px; 
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
}

a { 
    color: var(--primary); 
    text-decoration: none; 
    transition: var(--transition-fast); 
}
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

/* ============================================
   应用布局
   ============================================ */
.app-layout { 
    display: flex; 
    min-height: 100vh; 
}

/* ============================================
   侧边栏 - 飞鱼CRM风格
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--gray-200);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition-slow);
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-100);
    min-height: 72px;
}

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

.logo-text { 
    font-size: 18px; 
    font-weight: 700; 
    color: var(--gray-900);
    white-space: nowrap;
    letter-spacing: -0.5px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-toggle:hover { 
    color: var(--gray-700); 
    background: var(--gray-100); 
}

/* 导航菜单 */
.sidebar-nav { 
    padding: 16px 12px; 
    flex: 1; 
    overflow-y: auto;
}

.nav-section { 
    margin-bottom: 24px; 
}

.nav-section-title {
    padding: 0 12px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--gray-500);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--gray-600);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-fast);
    border-radius: var(--radius);
    margin-bottom: 2px;
    position: relative;
}
.nav-item:hover { 
    color: var(--gray-900); 
    background: var(--gray-100); 
}
.nav-item.active {
    color: var(--primary);
    background: var(--primary-50);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}

.nav-icon { 
    width: 20px; 
    height: 20px; 
    flex-shrink: 0; 
    opacity: 0.8;
}
.nav-item.active .nav-icon {
    opacity: 1;
}

/* 用户信息 */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--gray-100);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius);
    transition: var(--transition-fast);
    cursor: pointer;
}
.user-profile:hover {
    background: var(--gray-100);
}

.user-avatar { 
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    overflow: hidden; 
    flex-shrink: 0; 
    background: var(--primary-50);
    display: flex;
    align-items: center;
    justify-content: center;
}
.user-avatar img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.user-info { 
    flex: 1;
    min-width: 0;
}
.user-name { 
    font-size: 14px; 
    font-weight: 600; 
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role { 
    font-size: 12px; 
    color: var(--gray-500);
    margin-top: 2px;
}

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

/* ============================================
   顶部栏
   ============================================ */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left { 
    display: flex; 
    align-items: center; 
    gap: 20px; 
}

.mobile-menu-btn { 
    display: none; 
    background: none; 
    border: none; 
    cursor: pointer; 
    color: var(--gray-600); 
    padding: 8px;
    border-radius: var(--radius);
    transition: var(--transition-fast);
}
.mobile-menu-btn:hover {
    background: var(--gray-100);
}

/* 面包屑 */
.breadcrumb { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    font-size: 14px; 
    color: var(--gray-500); 
}
.breadcrumb a { 
    color: var(--gray-500); 
    transition: var(--transition-fast);
}
.breadcrumb a:hover { 
    color: var(--primary); 
}
.breadcrumb .separator { 
    color: var(--gray-300); 
    margin: 0 4px;
}
.breadcrumb .current { 
    color: var(--gray-800); 
    font-weight: 600; 
}

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

/* 通知铃铛 */
.notification-bell {
    position: relative;
    cursor: pointer;
    color: var(--gray-500);
    padding: 10px;
    border-radius: var(--radius);
    transition: var(--transition-fast);
    background: none;
    border: none;
    font-family: inherit;
    font-size: 14px;
}
.notification-bell:hover { 
    color: var(--gray-700); 
    background: var(--gray-100); 
}

.notification-bell .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    padding: 0 4px;
}

/* 用户下拉菜单 */
.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: var(--transition-fast);
}
.user-dropdown:hover { 
    background: var(--gray-100); 
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 200px;
    padding: 8px;
    display: none;
    z-index: 200;
    margin-top: 8px;
}
.dropdown-menu.show { 
    display: block; 
    animation: fadeInDown 0.2s ease;
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--gray-700);
    font-size: 14px;
    border-radius: var(--radius);
    transition: var(--transition-fast);
}
.dropdown-item:hover { 
    background: var(--gray-100); 
    color: var(--gray-900); 
}

/* ============================================
   页面内容
   ============================================ */
.page-content { 
    padding: 32px; 
    flex: 1; 
}

.page-header { 
    margin-bottom: 32px; 
}
.page-header h1 { 
    font-size: 28px; 
    font-weight: 700; 
    color: var(--gray-900); 
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}
.page-subtitle { 
    color: var(--gray-500); 
    font-size: 16px; 
    font-weight: 400;
}

/* ============================================
   统计卡片 - 飞鱼CRM风格
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card:hover { 
    box-shadow: var(--shadow-md); 
    transform: translateY(-2px); 
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.stat-card-primary::before { background: var(--primary); }
.stat-card-success::before { background: var(--success); }
.stat-card-warning::before { background: var(--warning); }
.stat-card-danger::before { background: var(--danger); }
.stat-card-info::before { background: var(--info); }

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { 
    width: 28px; 
    height: 28px; 
}

.stat-card-primary .stat-icon { 
    background: var(--primary-50); 
    color: var(--primary); 
}
.stat-card-success .stat-icon { 
    background: var(--success-50); 
    color: var(--success); 
}
.stat-card-warning .stat-icon { 
    background: var(--warning-50); 
    color: var(--warning); 
}
.stat-card-danger .stat-icon { 
    background: var(--danger-50); 
    color: var(--danger); 
}
.stat-card-info .stat-icon { 
    background: var(--info-50); 
    color: var(--info); 
}

.stat-content { 
    flex: 1; 
}
.stat-value { 
    font-size: 32px; 
    font-weight: 700; 
    color: var(--gray-900); 
    line-height: 1.2;
    letter-spacing: -1px;
}
.stat-label { 
    font-size: 14px; 
    color: var(--gray-500); 
    margin-top: 4px;
    font-weight: 500;
}

/* ============================================
   内容网格
   ============================================ */
.content-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

/* ============================================
   卡片组件
   ============================================ */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-100);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}
.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-100);
}
.card-header h3 { 
    font-size: 16px; 
    font-weight: 600; 
    color: var(--gray-900); 
}
.card-link { 
    font-size: 14px; 
    color: var(--primary); 
    font-weight: 500;
}
.card-link:hover {
    color: var(--primary-dark);
}

.card-body { 
    padding: 20px 24px; 
}

/* ============================================
   列表组件
   ============================================ */
.list-group { 
    display: flex; 
    flex-direction: column; 
}
.list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-800);
    transition: var(--transition-fast);
}
.list-item:last-child { 
    border-bottom: none; 
}
.list-item:hover { 
    background: var(--gray-50); 
    margin: 0 -24px; 
    padding-left: 24px; 
    padding-right: 24px; 
    border-radius: var(--radius);
}

.list-item-content { 
    flex: 1; 
    min-width: 0; 
}
.list-item-title { 
    font-size: 14px; 
    font-weight: 600; 
    color: var(--gray-900); 
}
.list-item-desc { 
    font-size: 13px; 
    color: var(--gray-500); 
    margin-top: 4px; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap; 
}

.list-item-meta { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    flex-shrink: 0; 
}

/* ============================================
   时间线组件
   ============================================ */
.timeline { 
    position: relative; 
    padding-left: 28px; 
}
.timeline::before { 
    content: ''; 
    position: absolute; 
    left: 10px; 
    top: 0; 
    bottom: 0; 
    width: 2px; 
    background: var(--gray-200); 
    border-radius: 1px;
}
.timeline-item { 
    position: relative; 
    padding-bottom: 20px; 
}
.timeline-item:last-child { 
    padding-bottom: 0; 
}
.timeline-marker {
    position: absolute;
    left: -22px;
    top: 6px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px var(--primary);
}
.timeline-content { 
    background: var(--gray-50); 
    border-radius: var(--radius-lg); 
    padding: 16px; 
    border: 1px solid var(--gray-100);
}
.timeline-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 8px; 
}
.timeline-title { 
    font-size: 14px; 
    font-weight: 600; 
    color: var(--gray-900);
}
.timeline-time { 
    font-size: 12px; 
    color: var(--gray-500); 
    font-weight: 500;
}
.timeline-text { 
    font-size: 14px; 
    color: var(--gray-600); 
    line-height: 1.6; 
}

/* ============================================
   徽章组件
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}
.badge-default { 
    background: var(--gray-100); 
    color: var(--gray-700); 
}
.badge-primary { 
    background: var(--primary-50); 
    color: var(--primary); 
}
.badge-success { 
    background: var(--success-50); 
    color: var(--success); 
}
.badge-warning { 
    background: var(--warning-50); 
    color: var(--warning); 
}
.badge-danger { 
    background: var(--danger-50); 
    color: var(--danger); 
}

/* 状态徽章 */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}
.status-potential { 
    background: var(--info-50); 
    color: var(--info); 
}
.status-contacting { 
    background: var(--warning-50); 
    color: #b45309; 
}
.status-negotiating { 
    background: #f3e8ff; 
    color: #7c3aed; 
}
.status-signed { 
    background: var(--success-50); 
    color: var(--success); 
}
.status-lost { 
    background: var(--gray-100); 
    color: var(--gray-600); 
}

/* 提醒优先级 */
.priority-low { 
    border-left: 4px solid var(--gray-300); 
}
.priority-medium { 
    border-left: 4px solid var(--info); 
}
.priority-high { 
    border-left: 4px solid var(--warning); 
}
.priority-urgent { 
    border-left: 4px solid var(--danger); 
}

/* ============================================
   空状态
   ============================================ */
.empty-state { 
    text-align: center; 
    padding: 48px 24px; 
    color: var(--gray-500); 
}
.empty-state p { 
    font-size: 16px; 
    margin-top: 12px;
}

/* ============================================
   按钮组件
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-fast);
    line-height: 1.4;
    white-space: nowrap;
}
.btn:disabled { 
    opacity: 0.6; 
    cursor: not-allowed; 
}

.btn-sm { 
    padding: 6px 14px; 
    font-size: 13px; 
}

.btn-primary { 
    background: var(--primary); 
    color: #fff; 
    border-color: var(--primary); 
    box-shadow: 0 1px 2px rgba(26,115,232,0.3);
}
.btn-primary:hover { 
    background: var(--primary-dark); 
    border-color: var(--primary-dark); 
    color: #fff;
    box-shadow: 0 2px 4px rgba(26,115,232,0.4);
}

.btn-success { 
    background: var(--success); 
    color: #fff; 
    border-color: var(--success); 
}
.btn-success:hover { 
    background: #2d9249; 
    color: #fff;
}

.btn-warning { 
    background: var(--warning); 
    color: #fff; 
    border-color: var(--warning); 
}
.btn-warning:hover {
    color: #fff;
}

.btn-danger { 
    background: var(--danger); 
    color: #fff; 
    border-color: var(--danger); 
}
.btn-danger:hover { 
    background: #d33426; 
    color: #fff;
}

.btn-outline { 
    background: #fff; 
    color: var(--gray-700); 
    border-color: var(--gray-300); 
    box-shadow: var(--shadow-xs);
}
.btn-outline:hover { 
    background: var(--gray-50); 
    border-color: var(--gray-400); 
    box-shadow: var(--shadow);
}

.btn-block { 
    display: flex; 
    width: 100%; 
}

.btn-ghost { 
    background: transparent; 
    color: var(--gray-600); 
    border: none; 
}
.btn-ghost:hover { 
    background: var(--gray-100); 
    color: var(--gray-800); 
}

/* ============================================
   加载动画
   ============================================ */
.spinner { 
    animation: spin 1s linear infinite; 
    width: 20px; 
    height: 20px; 
}
@keyframes spin { 
    from { transform: rotate(0deg); } 
    to { transform: rotate(360deg); } 
}

/* ============================================
   表单组件 - 现代风格
   ============================================ */
.form-group { 
    margin-bottom: 20px; 
}
.form-group label { 
    display: block; 
    font-size: 13px; 
    font-weight: 600; 
    color: var(--gray-700); 
    margin-bottom: 6px; 
    letter-spacing: 0.01em;
}

.input-wrapper { 
    position: relative; 
    display: flex; 
    align-items: center; 
}
.input-icon { 
    position: absolute; 
    left: 14px; 
    width: 20px; 
    height: 20px; 
    color: var(--gray-400); 
    pointer-events: none; 
}

.input-wrapper input, 
.input-wrapper select, 
.input-wrapper textarea {
    width: 100%;
    padding: 12px 14px 12px 44px;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--gray-50);
    transition: all 0.2s ease;
    outline: none;
}
.input-wrapper input:focus, 
.input-wrapper select:focus, 
.input-wrapper textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,0.08);
    background: #fff;
}
.input-wrapper input::placeholder { 
    color: var(--gray-400); 
}

.password-toggle {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
    transition: var(--transition-fast);
}
.password-toggle:hover { 
    color: var(--gray-600); 
}

input:not([type]), 
input[type="text"], 
input[type="password"], 
input[type="email"], 
input[type="tel"], 
input[type="number"], 
input[type="date"], 
input[type="datetime-local"], 
select, 
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--gray-50);
    transition: all 0.2s ease;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.input-wrapper input[type="text"],
.input-wrapper input[type="password"],
.input-wrapper input[type="email"],
.input-wrapper input[type="tel"] {
    padding-left: 44px;
}

input:not([type]):focus, 
input[type="text"]:focus, 
input[type="password"]:focus, 
input[type="email"]:focus, 
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
select:focus, 
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,0.08);
    background: #fff;
}

input::placeholder, textarea::placeholder {
    color: var(--gray-400);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%239aa0a6' fill='none' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

textarea { 
    resize: vertical; 
    min-height: 100px; 
    line-height: 1.6;
}

/* ============================================
   自定义下拉框
   ============================================ */
.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--gray-50);
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    min-height: 42px;
}

.custom-select-trigger:hover {
    border-color: var(--gray-300);
}

.custom-select.open .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,0.08);
    background: #fff;
}

.custom-select-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-arrow {
    flex-shrink: 0;
    margin-left: 8px;
    color: var(--gray-400);
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
}

.custom-select.open .custom-select-arrow {
    transform: rotate(180deg);
    color: var(--primary);
}

.custom-select-dropdown {
    position: fixed;
    top: auto;
    left: auto;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.05);
    z-index: 9999;
    max-height: 240px;
    overflow-y: auto;
    padding: 4px;
    display: none;
    animation: dropdownFadeIn 0.15s ease;
}

.custom-select.open .custom-select-dropdown {
    display: block;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.custom-select-item {
    padding: 10px 12px;
    font-size: 14px;
    color: var(--gray-700);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.custom-select-item:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.custom-select-item.selected {
    background: var(--primary-50);
    color: var(--primary);
    font-weight: 600;
}

.custom-select-dropdown::-webkit-scrollbar {
    width: 6px;
}

.custom-select-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.custom-select-dropdown::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.form-options { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    margin-bottom: 24px; 
}
.checkbox-label { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    font-size: 14px; 
    color: var(--gray-600); 
    cursor: pointer; 
}
.checkbox-label input[type="checkbox"] { 
    width: 18px; 
    height: 18px; 
    accent-color: var(--primary); 
}
.forgot-link { 
    font-size: 14px; 
    color: var(--primary); 
    font-weight: 500;
}
.forgot-link:hover { 
    color: var(--primary-dark); 
}

.form-row { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 20px; 
}

/* ============================================
   提示框
   ============================================ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}
.alert-warning { 
    background: var(--warning-50); 
    color: #92400e; 
    border: 1px solid rgba(251,188,4,0.3); 
}
.alert-success { 
    background: var(--success-50); 
    color: #065f46; 
    border: 1px solid rgba(52,168,83,0.3); 
}
.alert-danger { 
    background: var(--danger-50); 
    color: #991b1b; 
    border: 1px solid rgba(234,67,53,0.3); 
}
.alert-info { 
    background: var(--info-50); 
    color: #1e40af; 
    border: 1px solid rgba(66,133,244,0.3); 
}

/* ============================================
   文字辅助
   ============================================ */
.text-muted { 
    color: var(--gray-500); 
    font-size: 13px; 
}
.text-primary { 
    color: var(--primary); 
}
.text-success { 
    color: var(--success); 
}
.text-danger { 
    color: var(--danger); 
}

/* ============================================
   表格组件
   ============================================ */
.table-wrapper { 
    overflow-x: auto; 
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-100);
}

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

table th, 
table td { 
    padding: 14px 20px; 
    text-align: left; 
    border-bottom: 1px solid var(--gray-100); 
}

table th { 
    background: var(--gray-50); 
    font-weight: 600; 
    font-size: 12px; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    color: var(--gray-600); 
    white-space: nowrap;
}

table tbody tr { 
    transition: var(--transition-fast); 
}
table tbody tr:hover { 
    background: var(--gray-50); 
}

table td { 
    font-size: 14px; 
    color: var(--gray-700);
}

/* ============================================
   分页组件
   ============================================ */
.pagination { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 6px; 
    margin-top: 24px; 
}
.pagination a, 
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--gray-200);
    color: var(--gray-700);
    background: #fff;
    transition: var(--transition-fast);
}
.pagination a:hover { 
    background: var(--gray-50); 
    border-color: var(--gray-300); 
    box-shadow: var(--shadow-xs);
}
.pagination .active { 
    background: var(--primary); 
    color: #fff; 
    border-color: var(--primary); 
    box-shadow: 0 1px 2px rgba(26,115,232,0.3);
}
.pagination .disabled { 
    opacity: 0.5; 
    pointer-events: none; 
}

/* ============================================
   工具栏
   ============================================ */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.toolbar-left { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    flex-wrap: wrap; 
}
.toolbar-right { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
}

.search-input {
    position: relative;
    min-width: 280px;
}
.search-input input {
    padding-left: 40px;
    padding-right: 14px;
    height: 42px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-300);
    background: #fff;
    transition: var(--transition-fast);
}
.search-input input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,0.1);
}

.filter-select {
    height: 42px;
    padding: 0 36px 0 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%236b7280' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
    appearance: none;
    cursor: pointer;
    transition: var(--transition-fast);
}
.filter-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,0.1);
}

/* ============================================
   模态框
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal-overlay.show { 
    display: flex; 
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 24px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-100);
}
.modal-header h3 { 
    font-size: 18px; 
    font-weight: 700; 
    color: var(--gray-900);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 8px;
    border-radius: var(--radius);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover { 
    color: var(--gray-600); 
    background: var(--gray-100); 
}

.modal-body { 
    padding: 28px; 
}

.modal-footer { 
    padding: 20px 28px; 
    display: flex; 
    justify-content: flex-end; 
    gap: 12px; 
    border-top: 1px solid var(--gray-100); 
}

/* ============================================
   消息气泡
   ============================================ */
.message-bubble {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 18px;
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.6;
}
.message-user {
    background: var(--primary);
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}
.message-assistant {
    background: var(--gray-100);
    color: var(--gray-800);
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

/* ============================================
   移动端遮罩
   ============================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
}

/* ============================================
   侧滑详情面板
   ============================================ */
.slide-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.slide-panel-overlay.show {
    opacity: 1;
    visibility: visible;
}

.slide-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 720px;
    height: 100vh;
    background: #fff;
    z-index: 1600;
    box-shadow: -4px 0 25px rgba(0,0,0,0.15);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.slide-panel.show {
    transform: translateX(0);
}

.slide-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.slide-panel-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

.slide-panel-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-500);
    font-size: 24px;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.slide-panel-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

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

.slide-panel-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    color: var(--gray-500);
    font-size: 14px;
}

@media (max-width: 768px) {
    .slide-panel {
        width: 100%;
    }
}

/* ============================================
   认证页面
   ============================================ */
.auth-page {
    background: var(--gray-50);
    min-height: 100vh;
}
.auth-container {
    display: flex;
    min-height: 100vh;
}
.auth-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: var(--gray-900);
    position: relative;
    overflow: hidden;
}
.auth-bg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    opacity: 0.3;
}
.auth-branding { 
    max-width: 440px; 
    color: #fff; 
    position: relative; 
    z-index: 1; 
}
.brand-logo { 
    margin-bottom: 32px; 
}
.auth-branding h1 { 
    font-size: 36px; 
    font-weight: 700; 
    margin-bottom: 16px;
    letter-spacing: -1px;
}
.auth-branding p { 
    font-size: 18px; 
    opacity: 0.8; 
    margin-bottom: 40px;
    line-height: 1.6;
}
.brand-features { 
    display: flex; 
    flex-direction: column; 
    gap: 16px; 
}
.feature-item { 
    display: flex; 
    align-items: center; 
    gap: 14px; 
    font-size: 16px; 
    opacity: 0.9;
    font-weight: 500;
}

.auth-right {
    width: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 48px;
}
.auth-form-container { 
    width: 100%; 
    max-width: 400px; 
}
.auth-form-header { 
    margin-bottom: 40px; 
}
.auth-form-header h2 { 
    font-size: 28px; 
    font-weight: 700; 
    color: var(--gray-900); 
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}
.auth-form-header p { 
    color: var(--gray-500); 
    font-size: 16px; 
}
.auth-form { 
    margin-bottom: 32px; 
}
.auth-footer { 
    text-align: center; 
    font-size: 14px; 
    color: var(--gray-500); 
}
.auth-footer a { 
    color: var(--primary); 
    font-weight: 600; 
}

/* ============================================
   AI聊天界面
   ============================================ */
.chat-container { 
    display: flex; 
    height: calc(100vh - var(--topbar-height) - 64px); 
    background: #fff;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.chat-sidebar {
    width: 300px;
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
}
.chat-sidebar-header { 
    padding: 20px; 
    border-bottom: 1px solid var(--gray-200); 
    background: #fff;
}
.chat-list { 
    flex: 1; 
    overflow-y: auto; 
    padding: 12px; 
}
.chat-item {
    padding: 14px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition-fast);
    margin-bottom: 4px;
}
.chat-item:hover { 
    background: #fff; 
    box-shadow: var(--shadow-xs);
}
.chat-item.active { 
    background: var(--primary-50); 
    box-shadow: var(--shadow-xs);
}
.chat-item-title { 
    font-size: 14px; 
    font-weight: 600; 
    color: var(--gray-900); 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap; 
}
.chat-item-time { 
    font-size: 12px; 
    color: var(--gray-500); 
    margin-top: 4px; 
}

.chat-main { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
}
.chat-messages { 
    flex: 1; 
    overflow-y: auto; 
    padding: 28px; 
}
.chat-input-area {
    padding: 20px 28px;
    border-top: 1px solid var(--gray-200);
    background: #fff;
}
.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}
.chat-input {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    outline: none;
    transition: var(--transition-fast);
}
.chat-input:focus { 
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px rgba(26,115,232,0.1); 
}

.chat-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(26,115,232,0.3);
}
.chat-send-btn:hover { 
    background: var(--primary-dark); 
    box-shadow: 0 4px 8px rgba(26,115,232,0.4);
}
.chat-send-btn:disabled { 
    opacity: 0.5; 
    cursor: not-allowed; 
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 1024px) {
    .content-grid { 
        grid-template-columns: 1fr; 
    }
    .stats-grid { 
        grid-template-columns: repeat(2, 1fr); 
    }
    .form-row { 
        grid-template-columns: 1fr; 
    }
}

@media (max-width: 768px) {
    .sidebar { 
        transform: translateX(-100%); 
    }
    .sidebar.show { 
        transform: translateX(0); 
    }
    .sidebar-overlay.show { 
        display: block; 
    }
    .main-content { 
        margin-left: 0; 
    }
    .mobile-menu-btn { 
        display: flex; 
    }
    .stats-grid { 
        grid-template-columns: 1fr; 
    }
    .topbar { 
        padding: 0 16px; 
    }
    .page-content { 
        padding: 20px; 
    }
    .user-info { 
        display: none; 
    }
    .auth-container { 
        flex-direction: column; 
    }
    .auth-left { 
        padding: 32px; 
        min-height: auto; 
    }
    .auth-right { 
        width: 100%; 
        padding: 32px; 
    }
    .chat-container { 
        flex-direction: column; 
    }
    .chat-sidebar { 
        width: 100%; 
        height: auto; 
        max-height: 200px; 
    }
    .toolbar { 
        flex-direction: column; 
        align-items: stretch; 
    }
    .toolbar-left, 
    .toolbar-right { 
        width: 100%; 
    }
    .search-input { 
        min-width: auto; 
    }
}