/* 企业管理咨询系统 - 主样式 */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --info: #0891b2;
    --bg: #f8fafc;
    --bg-white: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,.1);
    --radius: 8px;
    --sidebar-width: 240px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ========== 登录页 ========== */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: linear-gradient(135deg, #1e3a5f, #2563eb);
}
.login-box {
    background: white; border-radius: 12px; padding: 40px;
    width: 400px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.login-box h1 { text-align: center; margin-bottom: 8px; font-size: 24px; color: var(--primary); }
.login-box .subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 32px; font-size: 14px; }
.login-box .form-group { margin-bottom: 20px; }
.login-box label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.login-box input { 
    width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 14px; transition: border-color .2s;
}
.login-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.login-box button {
    width: 100%; padding: 12px; background: var(--primary); color: white; border: none;
    border-radius: 6px; font-size: 16px; font-weight: 600; cursor: pointer; transition: background .2s;
}
.login-box button:hover { background: var(--primary-dark); }
.login-box .error-msg { color: var(--danger); text-align: center; margin-top: 12px; font-size: 14px; display: none; }

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

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width); background: #1e293b; color: white;
    display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    overflow-y: auto;
}
.sidebar-header {
    padding: 20px; border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex; align-items: center; gap: 10px;
}
.sidebar-header .logo { width: 36px; height: 36px; background: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 18px; }
.sidebar-header h2 { font-size: 16px; font-weight: 600; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav .nav-group { margin-bottom: 8px; }
.sidebar-nav .nav-group-title { padding: 12px 20px 6px; font-size: 11px; text-transform: uppercase; color: rgba(255,255,255,.4); letter-spacing: 1px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px; padding: 10px 20px;
    color: rgba(255,255,255,.7); text-decoration: none; font-size: 14px;
    transition: all .2s; border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.05); color: white; }
.sidebar-nav a.active { background: rgba(37,99,235,.2); color: white; border-left-color: var(--primary); }
.sidebar-nav a .icon { width: 20px; text-align: center; font-size: 16px; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-footer .user-info { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sidebar-footer .avatar { width: 32px; height: 32px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.sidebar-footer .name { font-size: 14px; }
.sidebar-footer .role { font-size: 11px; color: rgba(255,255,255,.5); }
.sidebar-footer .logout-btn { color: rgba(255,255,255,.5); text-decoration: none; font-size: 12px; }
.sidebar-footer .logout-btn:hover { color: white; }

/* 主内容区 */
.main-content { margin-left: var(--sidebar-width); flex: 1; padding: 24px; }

/* 顶部栏 */
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.top-bar h1 { font-size: 22px; font-weight: 700; }

/* ========== 统计卡片 ========== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: white; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 16px;
}
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.stat-card .stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-card .stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-card .stat-icon.orange { background: #fef3c7; color: #f59e0b; }
.stat-card .stat-icon.red { background: #fee2e2; color: #dc2626; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; }
.stat-card .stat-label { color: var(--text-secondary); font-size: 13px; }

/* ========== 表格/列表 ========== */
.card {
    background: white; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.card-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.card-header h3 { font-size: 16px; font-weight: 600; }
.card-body { padding: 0; }
.card-body.padded { padding: 20px; }

.toolbar {
    display: flex; gap: 12px; align-items: center; padding: 12px 20px;
    border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.toolbar input[type="text"], .toolbar select {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}
.toolbar input[type="text"] { min-width: 200px; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--primary); }

.btn {
    padding: 8px 16px; border: none; border-radius: 6px; font-size: 13px; font-weight: 600;
    cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    transition: all .2s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { background: white; color: var(--primary); border: 1px solid var(--primary); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
table th { background: #f8fafc; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
table tr:hover { background: #f8fafc; }
table a { color: var(--primary); text-decoration: none; }
table a:hover { text-decoration: underline; }

/* 状态标签 */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-orange { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-yellow { background: #fef9c3; color: #854d0e; }

/* 进度条 */
.progress-bar {
    height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; margin-top: 4px;
}
.progress-bar .fill { height: 100%; background: var(--success); border-radius: 3px; transition: width .3s; }

/* ========== 弹窗 ========== */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.5); z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: white; border-radius: 12px; padding: 24px; width: 560px; max-width: 90vw;
    max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal h3 { margin-bottom: 20px; font-size: 18px; }
.modal .form-group { margin-bottom: 16px; }
.modal label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.modal input, .modal select, .modal textarea {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}
.modal textarea { min-height: 80px; resize: vertical; }
.modal input:focus, .modal select:focus, .modal textarea:focus { outline: none; border-color: var(--primary); }
.modal .form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }

/* ========== 漏斗图 ========== */
.funnel-container { padding: 20px; }
.funnel-item {
    display: flex; align-items: center; margin-bottom: 8px;
}
.funnel-bar {
    height: 40px; border-radius: 4px; display: flex; align-items: center; padding: 0 16px;
    color: white; font-size: 14px; font-weight: 600; transition: width .3s;
    min-width: 60px; position: relative;
}
.funnel-bar .count { margin-left: auto; }
.funnel-label { width: 120px; text-align: right; padding-right: 16px; font-size: 14px; color: var(--text-secondary); }

/* ========== 客户详情 ========== */
.detail-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 24px; border-bottom: 1px solid var(--border);
}
.detail-header h2 { font-size: 20px; }
.detail-header .meta { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.detail-tabs { display: flex; border-bottom: 2px solid var(--border); }
.detail-tabs .tab {
    padding: 12px 20px; cursor: pointer; font-size: 14px; font-weight: 600;
    color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: all .2s;
}
.detail-tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.detail-tabs .tab:hover { color: var(--primary); }
.tab-content { display: none; padding: 20px 24px; }
.tab-content.active { display: block; }

/* 跟进时间线 */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
    content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before {
    content: ''; position: absolute; left: -20px; top: 4px; width: 12px; height: 12px;
    border-radius: 50%; background: var(--primary); border: 2px solid white; box-shadow: 0 0 0 2px var(--primary);
}
.timeline-item .time { font-size: 12px; color: var(--text-secondary); }
.timeline-item .method { font-size: 12px; color: var(--primary); font-weight: 600; }
.timeline-item .content-text { margin-top: 4px; font-size: 14px; line-height: 1.6; }
.timeline-item .next-plan { margin-top: 6px; padding: 8px 12px; background: #f8fafc; border-radius: 6px; font-size: 13px; color: var(--text-secondary); }

/* ========== 合同状态流 ========== */
.status-flow {
    display: flex; align-items: center; gap: 0; padding: 20px 0;
}
.status-step {
    display: flex; align-items: center; gap: 8px; padding: 8px 16px;
    border-radius: 20px; font-size: 13px; font-weight: 600;
}
.status-step.done { background: #dcfce7; color: #166534; }
.status-step.current { background: #dbeafe; color: #1e40af; }
.status-step.pending { background: #f1f5f9; color: #94a3b8; }
.status-arrow { color: #94a3b8; margin: 0 4px; }

/* 响应式 */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-header h2, .sidebar-nav a span:not(.icon), .sidebar-nav .nav-group-title,
    .sidebar-footer .name, .sidebar-footer .role { display: none; }
    .main-content { margin-left: 60px; padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
