/* ================================================
   系统驱动型人格转型管理系统 - 主样式表
   双主题 · 极简设计 · 现代美学 · 移动端适配
   ================================================ */

/* ---- CSS变量（深色主题 - 默认） ---- */
:root,
[data-theme="dark"] {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.3);
    --success: #10b981;
    --success-light: #34d399;
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --danger: #ef4444;
    --danger-light: #f87171;
    --info: #06b6d4;
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --bg-card: rgba(26, 26, 46, 0.8);
    --bg-card-hover: rgba(30, 30, 55, 0.95);
    --bg-input: rgba(15, 15, 26, 0.6);
    --bg-overlay: rgba(0, 0, 0, 0.7);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-bright: #f8fafc;
    --border: rgba(99, 102, 241, 0.15);
    --border-hover: rgba(99, 102, 241, 0.3);
    --border-active: rgba(99, 102, 241, 0.5);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--primary-glow);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --bg-gradient-1: rgba(99, 102, 241, 0.08);
    --bg-gradient-2: rgba(139, 92, 246, 0.06);
    --bg-gradient-3: rgba(6, 182, 212, 0.04);
    --chart-grid: rgba(99, 102, 241, 0.08);
    --chart-text: #64748b;
}

/* ---- 亮色主题 ---- */
[data-theme="light"] {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --primary-glow: rgba(79, 70, 229, 0.2);
    --success: #059669;
    --success-light: #10b981;
    --warning: #d97706;
    --warning-light: #f59e0b;
    --danger: #dc2626;
    --danger-light: #ef4444;
    --info: #0891b2;
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(255, 255, 255, 1);
    --bg-input: rgba(241, 245, 249, 0.8);
    --bg-overlay: rgba(15, 23, 42, 0.5);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-bright: #0f172a;
    --border: rgba(148, 163, 184, 0.3);
    --border-hover: rgba(79, 70, 229, 0.3);
    --border-active: rgba(79, 70, 229, 0.5);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 15px rgba(79, 70, 229, 0.15);
    --bg-gradient-1: rgba(79, 70, 229, 0.04);
    --bg-gradient-2: rgba(139, 92, 246, 0.03);
    --bg-gradient-3: rgba(6, 182, 212, 0.02);
    --chart-grid: rgba(148, 163, 184, 0.15);
    --chart-text: #64748b;
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

/* 全局背景动画 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 50%, var(--bg-gradient-1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, var(--bg-gradient-2) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, var(--bg-gradient-3) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    transition: background 0.5s ease;
}

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

a:hover {
    color: var(--primary);
}

/* ---- 滚动条 ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ================================================
   登录/注册页面
   ================================================ */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-lg);
    position: relative;
    z-index: 1;
}

.auth-box {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: fadeInUp 0.6s ease;
}

.auth-box .logo {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.auth-box .logo h1 {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-xs);
}

.auth-box .logo p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-tabs {
    display: flex;
    margin-bottom: var(--space-lg);
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 3px;
}

.auth-tab {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    text-align: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
    border: none;
    background: none;
    font-size: 0.9rem;
}

.auth-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ---- 表单通用样式 ---- */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-xs);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ---- 按钮 ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 2px 10px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--primary-glow);
}

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

.btn-success:hover {
    background: var(--success-light);
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning);
    color: #1a1a2e;
}

.btn-warning:hover {
    background: var(--warning-light);
    transform: translateY(-1px);
}

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

.btn-danger:hover {
    background: var(--danger-light);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    border-color: var(--primary);
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ================================================
   主布局
   ================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    overflow-x: hidden;
    width: 100%;
}

/* ---- 侧边栏 ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-header .subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-md) var(--space-sm);
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2px;
    font-size: 0.9rem;
    position: relative;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.nav-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.05));
    color: var(--primary-light);
    font-weight: 500;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-item .icon {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: var(--space-sm);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--info));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: white;
}

.user-details .name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.user-details .role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ---- 主内容区 ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: var(--space-xl);
    min-height: 100vh;
    transition: var(--transition);
    overflow-x: hidden;
    max-width: 100vw;
    min-width: 0;
}

/* ---- 页面头部 ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-bright);
}

.page-header .subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-actions {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

/* ================================================
   卡片组件
   ================================================ */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-bright);
    display: flex;
    align-items: center;
    gap: 8px;
}



/* ---- 统计卡片 ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 0 var(--radius-lg) 0 50%;
    opacity: 0.08;
}

.stat-card.purple::after {
    background: var(--primary);
}

.stat-card.green::after {
    background: var(--success);
}

.stat-card.orange::after {
    background: var(--warning);
}

.stat-card.red::after {
    background: var(--danger);
}

.stat-card.blue::after {
    background: var(--info);
}

.stat-card .stat-icon {
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-bright);
}

.stat-card .stat-change {
    font-size: 0.75rem;
    margin-top: var(--space-xs);
}

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

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

/* ---- 系统状态标签 ---- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge.stable {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-light);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.unstable {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-light);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.crisis {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-light);
    border: 1px solid rgba(239, 68, 68, 0.3);
    animation: pulse 2s infinite;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.green {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.status-dot.yellow {
    background: var(--warning);
    box-shadow: 0 0 6px var(--warning);
}

.status-dot.red {
    background: var(--danger);
    box-shadow: 0 0 6px var(--danger);
    animation: pulse 2s infinite;
}

/* ================================================
   模块页面样式
   ================================================ */

/* 页面切换 */
.page-section {
    display: none;
}

.page-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ---- 时间块/任务列表 ---- */
.time-block-group {
    margin-bottom: var(--space-lg);
}

.time-block-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    border-left: 3px solid var(--primary);
}

.time-block-header .time-range {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 4px;
}

.time-block-header .block-title {
    font-weight: 600;
    color: var(--text-bright);
}

.task-list {
    padding-left: var(--space-md);
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
}

.task-item:hover {
    background: rgba(99, 102, 241, 0.05);
}

.task-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-hover);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.task-checkbox:hover {
    border-color: var(--primary);
}

.task-checkbox.completed {
    background: var(--success);
    border-color: var(--success);
}

.task-checkbox.completed::after {
    content: '✓';
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
}

.task-item.completed .task-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-title {
    flex: 1;
    font-size: 0.9rem;
}

.task-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition-fast);
}

.task-item:hover .task-actions {
    opacity: 1;
}

.task-action-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: var(--transition-fast);
}

.task-action-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-light);
}

.task-action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-light);
}

/* ---- 客户列表 ---- */
.customer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
    gap: var(--space-md);
}

.customer-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.customer-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.customer-card .customer-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 4px;
}

.customer-card .customer-product {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.customer-card .customer-meta {
    display: flex;
    gap: 12px;
    margin-top: var(--space-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.customer-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.customer-status.potential {
    background: rgba(6, 182, 212, 0.15);
    color: var(--info);
}

.customer-status.following {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.customer-status.signed {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-light);
}

.customer-status.lost {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-light);
}

.overdue-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-light);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    animation: pulse 2s infinite;
}

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

.data-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 12px 14px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(99, 102, 241, 0.05);
}

.data-table tr:hover td {
    background: rgba(99, 102, 241, 0.03);
}

.amount-income {
    color: var(--success-light);
}

.amount-expense {
    color: var(--danger-light);
}

/* ---- 心理日志 ---- */
.mood-input-area {
    margin-bottom: var(--space-lg);
}

.mood-log-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.mood-log-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    position: relative;
}

.mood-log-item .log-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.mood-log-item .log-content {
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.mood-log-item .log-analysis {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: var(--space-sm);
    background: rgba(99, 102, 241, 0.05);
    border-radius: var(--radius-sm);
}

.mood-score {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.mood-score.positive {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-light);
}

.mood-score.neutral {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.mood-score.negative {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-light);
}

/* ================================================
   模态框
   ================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-bright);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
}

/* ================================================
   预警/提醒
   ================================================ */
.alert-banner {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideDown 0.5s ease;
}

.alert-banner.warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning-light);
}

.alert-banner.danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger-light);
}

.alert-banner.info {
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: var(--info);
}

.alert-banner.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success-light);
}

.alert-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-content {
    flex: 1;
}

.alert-content .alert-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.alert-content .alert-text {
    font-size: 0.85rem;
    opacity: 0.85;
}

.alert-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    opacity: 0.6;
    font-size: 1rem;
    transition: var(--transition-fast);
}

.alert-close:hover {
    opacity: 1;
}

/* ---- Toast通知 ---- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.85rem;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s ease;
    min-width: 260px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
    color: #1a1a2e;
}

.toast.info {
    background: var(--info);
}

/* ================================================
   图表区域
   ================================================ */
.chart-container {
    position: relative;
    height: 280px;
    padding: var(--space-md);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-lg);
}

/* ================================================
   沟通记录
   ================================================ */
.comm-timeline {
    position: relative;
    padding-left: var(--space-lg);
}

.comm-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.comm-item {
    position: relative;
    margin-bottom: var(--space-lg);
    padding-left: var(--space-md);
}

.comm-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg-secondary);
}

.comm-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.comm-type {
    display: inline-flex;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-light);
    margin-bottom: 4px;
}

.comm-content {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: var(--space-sm);
}

.comm-ai {
    font-size: 0.8rem;
    background: rgba(99, 102, 241, 0.05);
    border-left: 3px solid var(--primary);
    padding: var(--space-sm) var(--space-md);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-top: var(--space-sm);
}

.comm-ai .ai-label {
    font-size: 0.7rem;
    color: var(--primary-light);
    font-weight: 600;
    margin-bottom: 4px;
}

/* ================================================
   管理员页面
   ================================================ */
.admin-login-box {
    max-width: 380px;
    margin: 0 auto;
    padding-top: 15vh;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.setting-item {
    display: grid;
    grid-template-columns: 200px 1fr auto;
    gap: var(--space-md);
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.setting-item .setting-label {
    font-weight: 500;
    color: var(--text-primary);
}

.setting-item .setting-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ================================================
   空状态
   ================================================ */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: var(--space-md);
}

/* ================================================
   加载状态
   ================================================ */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ================================================
   动画
   ================================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

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

/* ================================================
   响应式
   ================================================ */
/* ================================================
   主题切换按钮
   ================================================ */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
    font-family: inherit;
    width: 100%;
    justify-content: center;
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

.theme-toggle .theme-icon {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-icon {
    transform: rotate(30deg);
}

/* ================================================
   移动端适配
   ================================================ */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2rem;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

/* 侧边栏遮罩 */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    body {
        line-height: 1.7;
    }

    .mobile-menu-btn {
        display: flex !important;
        width: 46px;
        height: 46px;
        font-size: 1.4rem;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-nav .nav-item {
        padding: 14px 18px;
        font-size: 1rem;
        gap: 14px;
    }

    .sidebar-nav .nav-item .icon {
        font-size: 1.2rem;
    }

    .main-content {
        margin-left: 0;
        padding: var(--space-lg) var(--space-md);
        padding-top: 65px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .page-header .subtitle {
        font-size: 0.9rem;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .header-actions .btn {
        font-size: 0.95rem;
        padding: 10px 16px;
    }

    /* 统计卡片 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }

    .stat-card {
        padding: var(--space-md);
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    .stat-card .stat-label {
        font-size: 0.85rem;
    }

    .stat-card .stat-icon {
        font-size: 1.3rem;
    }

    /* 客户列表 */
    .customer-grid {
        grid-template-columns: 1fr;
    }

    .customer-card {
        padding: var(--space-lg);
    }

    .customer-card .customer-name {
        font-size: 1.1rem;
        word-break: break-all;
    }

    .customer-card .customer-product {
        font-size: 0.9rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .customer-card .customer-meta {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 0.9rem;
    }

    .customer-status {
        font-size: 0.85rem;
        padding: 3px 10px;
    }

    .overdue-badge {
        font-size: 0.8rem;
        padding: 3px 8px;
        top: 10px;
        right: 10px;
    }

    /* 筛选栏 */
    .filter-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: var(--space-sm);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .filter-bar::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        flex-shrink: 0;
        white-space: nowrap;
        font-size: 0.9rem;
        padding: 8px 16px;
    }

    /* 图表 */
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 220px;
    }

    /* 卡片 */
    .card {
        padding: var(--space-lg);
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }

    .card-header h3 {
        font-size: 1.1rem;
    }

    /* 表单 */
    .form-row {
        grid-template-columns: 1fr;
    }

    .form-group label {
        font-size: 0.95rem;
        margin-bottom: 6px;
    }

    .form-control {
        font-size: 1rem;
        padding: 12px 14px;
    }

    /* 模态框 */
    .modal {
        width: 95%;
        max-height: 90vh;
        padding: var(--space-lg);
        border-radius: var(--radius-lg);
    }

    .modal-header h3 {
        font-size: 1.2rem;
    }

    /* 客户详情面板 - 移动端全屏覆盖 */
    .detail-panel {
        position: fixed !important;
        width: 100% !important;
        max-width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        height: 100dvh !important;
        transform: translateX(100%);
        transition: transform 0.3s ease !important;
        border-left: none !important;
        z-index: 300 !important;
    }

    .detail-panel.open {
        right: 0 !important;
        transform: translateX(0) !important;
    }

    .detail-panel-header {
        padding: var(--space-md) var(--space-lg);
        position: sticky;
        top: 0;
        background: var(--bg-secondary);
        z-index: 10;
        flex-shrink: 0;
    }

    .detail-panel-header h3 {
        font-size: 1.2rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: calc(100% - 50px);
    }

    .detail-panel-header .modal-close {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
        flex-shrink: 0;
    }

    .detail-panel-body {
        padding: var(--space-md) var(--space-lg);
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .detail-panel-body .text-sm {
        font-size: 0.95rem;
        word-break: break-word;
    }

    .detail-panel-body h4 {
        font-size: 1.1rem;
    }

    .detail-panel-body p {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .detail-panel-body .flex {
        flex-wrap: wrap;
    }

    .detail-panel-body #detail-customer-info {
        overflow: hidden;
    }

    .detail-panel-footer {
        padding: var(--space-md);
        flex-shrink: 0;
    }

    .detail-panel-footer .form-row {
        grid-template-columns: 1fr;
    }

    .detail-footer-row {
        grid-template-columns: 1fr;
    }

    .detail-panel-footer .form-control {
        font-size: 1rem;
    }

    /* 沟通记录 */
    .comm-timeline {
        padding-left: var(--space-md);
    }

    .comm-date {
        font-size: 0.85rem;
    }

    .comm-type {
        font-size: 0.8rem;
        padding: 2px 8px;
    }

    .comm-content {
        font-size: 0.95rem;
    }

    .comm-ai {
        font-size: 0.9rem;
        padding: var(--space-md);
    }

    .comm-ai .ai-label {
        font-size: 0.8rem;
    }

    /* 数据表格 */
    .data-table {
        font-size: 0.9rem;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }

    /* 任务列表 */
    .time-block-header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 14px 16px;
    }

    .time-block-header .block-title {
        font-size: 1rem;
    }

    .time-block-header .time-range {
        font-size: 0.85rem;
    }

    .task-item {
        padding: 12px 14px;
    }

    .task-title {
        font-size: 1rem;
    }

    .task-actions {
        opacity: 1;
    }

    .task-checkbox {
        width: 24px;
        height: 24px;
    }

    /* 按钮 */
    .btn {
        font-size: 0.95rem;
        padding: 11px 20px;
    }

    .btn-sm {
        font-size: 0.9rem;
        padding: 8px 14px;
    }

    /* 心理状态 */
    .mood-input-area textarea {
        font-size: 1rem;
    }

    /* 负债卡片 */
    .debt-card {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
        font-size: 0.95rem;
    }

    /* 预警提示 */
    .alert-banner {
        padding: var(--space-md);
        font-size: 0.95rem;
    }

    .alert-content .alert-title {
        font-size: 1rem;
    }

    .alert-content .alert-text {
        font-size: 0.9rem;
    }

    /* 设置页 */
    .setting-item {
        grid-template-columns: 1fr;
    }

    /* 登录注册 */
    .auth-box {
        padding: var(--space-lg);
        border-radius: var(--radius-lg);
    }

    .auth-box .logo h1 {
        font-size: 1.5rem;
    }

    .auth-box .logo p {
        font-size: 0.95rem;
    }

    .auth-tab {
        font-size: 1rem;
        padding: 10px;
    }

    /* 状态标签 */
    .status-badge {
        font-size: 0.85rem;
        padding: 4px 10px;
    }

    /* Toast通知 */
    .toast-container {
        top: auto;
        bottom: 16px;
        right: 16px;
        left: 16px;
    }

    .toast {
        min-width: auto;
        width: 100%;
        font-size: 0.95rem;
        padding: 14px 20px;
    }

    /* 空状态 */
    .empty-state .icon {
        font-size: 3.5rem;
    }

    .empty-state p {
        font-size: 1rem;
    }

    /* 页面区块防溢出 */
    .page-section {
        width: 100%;
        max-width: 100%;
    }

    /* 数据表格可横向滚动 */
    .data-table {
        font-size: 0.9rem;
        min-width: 500px;
    }

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

    /* 卡片内容可滚动 */
    .card {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 图表容器防溢出 */
    .chart-container {
        max-width: 100%;
        overflow: hidden;
    }

    /* 登录注册页移动端 */
    .auth-container {
        padding: var(--space-md);
    }

    .auth-box {
        max-width: 100%;
        width: 100%;
    }

    /* 文本内容防溢出 */
    .mood-log-item .log-content,
    .mood-log-item .log-analysis,
    .comm-content,
    .comm-ai,
    .alert-content .alert-text {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* 模态框防溢出 */
    .modal {
        overflow-y: auto;
        overflow-x: hidden;
        max-width: 100%;
    }

    /* 负债卡片防溢出 */
    .debt-card {
        word-break: break-word;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stat-card .stat-value {
        font-size: 1.2rem;
    }

    .stat-card .stat-label {
        font-size: 0.8rem;
    }

    .page-header h1 {
        font-size: 1.35rem;
    }

    .customer-card {
        padding: var(--space-md);
    }

    .customer-card .customer-meta {
        flex-direction: column;
        gap: 4px;
    }

    .customer-card .customer-meta span {
        font-size: 0.85rem;
    }

    .filter-btn {
        padding: 7px 12px;
        font-size: 0.85rem;
    }

    .customer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .main-content {
        padding: var(--space-md) var(--space-sm);
        padding-top: 60px;
    }

    .card {
        padding: var(--space-md);
    }
}

/* ---- 通用工具类 ---- */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-sm {
    gap: var(--space-sm);
}

.gap-md {
    gap: var(--space-md);
}

.gap-lg {
    gap: var(--space-lg);
}

.mt-sm {
    margin-top: var(--space-sm);
}

.mt-md {
    margin-top: var(--space-md);
}

.mt-lg {
    margin-top: var(--space-lg);
}

.mb-md {
    margin-bottom: var(--space-md);
}

.mb-lg {
    margin-bottom: var(--space-lg);
}

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

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.8rem;
}

.hidden {
    display: none !important;
}

.w-full {
    width: 100%;
}

/* 行内表单组 */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: var(--space-md);
}

/* 筛选/Tab 栏 */
.filter-bar {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
    font-family: inherit;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* 通信类型颜色 */
.comm-type.call {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-light);
}

.comm-type.meeting {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-light);
}

.comm-type.email {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info);
}

.comm-type.wechat {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-light);
}

/* 负债列表 */
.debt-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.debt-card:hover {
    border-color: var(--border-hover);
}

.debt-progress {
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    margin-top: var(--space-sm);
    overflow: hidden;
}

.debt-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--danger), var(--warning));
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* 客户详情面板 */
.detail-panel {
    position: fixed;
    top: 0;
    right: -500px;
    width: 480px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    z-index: 200;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.detail-panel.open {
    right: 0;
}

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

.detail-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

.detail-panel-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border);
}

.detail-footer-row {
    grid-template-columns: 1fr auto;
}