/* 智销云 - B2B SaaS设计系统 */
:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #e0e7ff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-700: #334155;
  --gray-900: #0f172a;
  --sidebar-width: 240px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; background: var(--gray-50); color: var(--gray-700); }
a { color: inherit; text-decoration: none; }

/* 加载屏 */
.loading-screen { display:flex; flex-direction:column; align-items:center; justify-content:center; height:100vh; }
.loading-spinner { width:40px; height:40px; border:3px solid var(--gray-200); border-top-color:var(--primary); border-radius:50%; animation:spin 0.8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* 布局 */
.app-layout { display:flex; height:100vh; overflow:hidden; }
.sidebar { width:var(--sidebar-width); background:#1e293b; color:#e2e8f0; display:flex; flex-direction:column; flex-shrink:0; overflow-y:auto; }
.main-content { flex:1; display:flex; flex-direction:column; overflow:hidden; }
.page-content { flex:1; overflow-y:auto; padding:1.5rem; }

/* 侧边栏 */
.sidebar-logo { padding:1.25rem 1rem; border-bottom:1px solid #334155; display:flex; align-items:center; gap:0.75rem; }
.sidebar-logo-icon { width:36px; height:36px; background:var(--primary); border-radius:8px; display:flex; align-items:center; justify-content:center; color:#fff; font-size:1rem; }
.sidebar-logo-text { font-weight:700; font-size:1.05rem; color:#f1f5f9; }
.sidebar-logo-sub { font-size:0.65rem; color:#94a3b8; }
.sidebar-section { padding:1rem 0.75rem 0.25rem; font-size:0.65rem; font-weight:600; color:#64748b; letter-spacing:0.08em; text-transform:uppercase; }
.sidebar-nav { padding:0.25rem 0.5rem; }
.sidebar-nav a, .nav-item { display:flex; align-items:center; gap:0.75rem; padding:0.6rem 0.75rem; border-radius:8px; color:#94a3b8; cursor:pointer; transition:all 0.15s; font-size:0.875rem; margin-bottom:1px; }
.sidebar-nav a:hover, .nav-item:hover { background:#334155; color:#f1f5f9; }
.sidebar-nav a.active, .nav-item.active { background:var(--primary); color:#fff; }
.sidebar-nav a i, .nav-item i { width:16px; text-align:center; font-size:0.875rem; }
.sidebar-footer { margin-top:auto; padding:1rem; border-top:1px solid #334155; }
.sidebar-user { display:flex; align-items:center; gap:0.5rem; }
.sidebar-user-avatar { width:32px; height:32px; background:var(--primary); border-radius:50%; display:flex; align-items:center; justify-content:center; color:#fff; font-size:0.8rem; font-weight:600; }
.sidebar-user-info { flex:1; }
.sidebar-user-name { font-size:0.8rem; font-weight:600; color:#f1f5f9; }
.sidebar-user-role { font-size:0.65rem; color:#64748b; }
.role-switcher { display:flex; gap:0.375rem; padding:0.75rem; }
.role-btn { flex:1; padding:0.375rem; border:1px solid #334155; border-radius:6px; background:transparent; color:#94a3b8; font-size:0.7rem; cursor:pointer; text-align:center; transition:all 0.15s; }
.role-btn.active { background:var(--primary); border-color:var(--primary); color:#fff; }

/* 顶部栏 */
.topbar { height:56px; background:#fff; border-bottom:1px solid var(--gray-200); display:flex; align-items:center; padding:0 1.5rem; gap:1rem; flex-shrink:0; }
.topbar-title { font-size:1.05rem; font-weight:600; color:var(--gray-900); }
.topbar-breadcrumb { font-size:0.8rem; color:var(--gray-500); }
.topbar-actions { margin-left:auto; display:flex; align-items:center; gap:0.75rem; }
.search-box { display:flex; align-items:center; gap:0.5rem; background:var(--gray-100); border:1px solid var(--gray-200); border-radius:8px; padding:0.375rem 0.75rem; font-size:0.825rem; color:var(--gray-500); min-width:200px; }

/* 卡片 */
.card { background:#fff; border-radius:12px; border:1px solid var(--gray-200); padding:1.25rem; }
.card-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:1rem; }
.card-title { font-size:0.95rem; font-weight:600; color:var(--gray-900); }
.card-subtitle { font-size:0.75rem; color:var(--gray-500); margin-top:0.125rem; }

/* 统计卡片 */
.stat-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); gap:1rem; margin-bottom:1.5rem; }
.stat-card { background:#fff; border-radius:12px; border:1px solid var(--gray-200); padding:1.25rem; position:relative; overflow:hidden; }
.stat-card::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; }
.stat-card.primary::before { background:var(--primary); }
.stat-card.success::before { background:var(--success); }
.stat-card.warning::before { background:var(--warning); }
.stat-card.info::before { background:var(--info); }
.stat-label { font-size:0.75rem; color:var(--gray-500); font-weight:500; }
.stat-value { font-size:1.75rem; font-weight:700; color:var(--gray-900); margin:0.25rem 0; line-height:1; }
.stat-meta { font-size:0.75rem; color:var(--gray-500); }
.stat-icon { position:absolute; right:1rem; top:50%; transform:translateY(-50%); opacity:0.1; font-size:3rem; color:var(--primary); }

/* 表格 */
.table-container { overflow-x:auto; border-radius:8px; border:1px solid var(--gray-200); }
table { width:100%; border-collapse:collapse; font-size:0.845rem; }
thead { background:var(--gray-50); }
th { padding:0.7rem 1rem; text-align:left; font-size:0.75rem; font-weight:600; color:var(--gray-500); text-transform:uppercase; letter-spacing:0.05em; border-bottom:1px solid var(--gray-200); }
td { padding:0.75rem 1rem; border-bottom:1px solid var(--gray-100); color:var(--gray-700); }
tr:last-child td { border-bottom:none; }
tr:hover td { background:var(--gray-50); }

/* 徽章/标签 */
.badge { display:inline-flex; align-items:center; gap:0.25rem; padding:0.2rem 0.6rem; border-radius:999px; font-size:0.7rem; font-weight:600; }
.badge-primary { background:var(--primary-light); color:var(--primary); }
.badge-success { background:#d1fae5; color:#065f46; }
.badge-warning { background:#fef3c7; color:#92400e; }
.badge-danger { background:#fee2e2; color:#991b1b; }
.badge-gray { background:var(--gray-100); color:var(--gray-500); }
.badge-info { background:#dbeafe; color:#1e40af; }

/* 阶段标签 */
.stage-badge { display:inline-flex; align-items:center; gap:0.35rem; padding:0.2rem 0.6rem; border-radius:6px; font-size:0.72rem; font-weight:700; }
.stage-I { background:#f0fdf4; color:#166534; border:1px solid #bbf7d0; }
.stage-A { background:#fff7ed; color:#9a3412; border:1px solid #fed7aa; }
.stage-G { background:#fffbeb; color:#78350f; border:1px solid #fde68a; }
.stage-C { background:#fef3c7; color:#92400e; border:1px solid #fcd34d; }
.stage-E { background:#eff6ff; color:#1e40af; border:1px solid #bfdbfe; }
.stage-P { background:#f0f9ff; color:#075985; border:1px solid #bae6fd; }
.stage-V { background:#faf5ff; color:#581c87; border:1px solid #e9d5ff; }
.stage-W { background:#d1fae5; color:#065f46; border:1px solid #6ee7b7; }
.stage-L { background:#fee2e2; color:#991b1b; border:1px solid #fca5a5; }

/* 按钮 */
.btn { display:inline-flex; align-items:center; gap:0.5rem; padding:0.5rem 1rem; border-radius:8px; font-size:0.845rem; font-weight:500; cursor:pointer; border:none; transition:all 0.15s; }
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-dark); }
.btn-secondary { background:var(--gray-100); color:var(--gray-700); border:1px solid var(--gray-200); }
.btn-secondary:hover { background:var(--gray-200); }
.btn-success { background:var(--success); color:#fff; }
.btn-success:hover { background:#059669; }
.btn-danger { background:var(--danger); color:#fff; }
.btn-danger:hover { background:#dc2626; }
.btn-sm { padding:0.35rem 0.75rem; font-size:0.78rem; }
.btn-ghost { background:transparent; color:var(--gray-500); }
.btn-ghost:hover { background:var(--gray-100); }

/* 表单 */
.form-group { margin-bottom:1rem; }
.form-label { display:block; font-size:0.8rem; font-weight:500; color:var(--gray-700); margin-bottom:0.35rem; }
.form-input, .form-select, .form-textarea { width:100%; padding:0.5rem 0.75rem; border:1px solid var(--gray-300); border-radius:8px; font-size:0.845rem; color:var(--gray-900); background:#fff; transition:border-color 0.15s; }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px rgba(79,70,229,0.1); }
.form-textarea { resize:vertical; min-height:80px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:1rem; }
.form-row-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:1rem; }

/* 模态框 */
.modal-overlay { position:fixed; inset:0; background:rgba(15,23,42,0.5); z-index:1000; display:flex; align-items:center; justify-content:center; padding:1rem; }
.modal { background:#fff; border-radius:16px; width:100%; max-width:600px; max-height:90vh; overflow-y:auto; box-shadow:0 25px 50px rgba(0,0,0,0.15); }
.modal-lg { max-width:800px; }
.modal-header { padding:1.25rem 1.5rem; border-bottom:1px solid var(--gray-200); display:flex; align-items:center; justify-content:space-between; }
.modal-title { font-size:1rem; font-weight:600; color:var(--gray-900); }
.modal-body { padding:1.5rem; }
.modal-footer { padding:1rem 1.5rem; border-top:1px solid var(--gray-200); display:flex; justify-content:flex-end; gap:0.75rem; }
.modal-close { background:none; border:none; cursor:pointer; color:var(--gray-500); font-size:1.25rem; padding:0.25rem; }
.modal-close:hover { color:var(--gray-900); }

/* 看板 */
.kanban-board { display:flex; gap:1rem; overflow-x:auto; padding-bottom:1rem; min-height:calc(100vh - 200px); }
.kanban-column { flex-shrink:0; width:240px; background:var(--gray-100); border-radius:12px; padding:0.75rem; }
.kanban-column-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:0.75rem; padding:0 0.25rem; }
.kanban-column-title { font-size:0.8rem; font-weight:700; }
.kanban-column-count { font-size:0.7rem; color:var(--gray-500); background:#fff; border-radius:99px; padding:0.1rem 0.5rem; }
.kanban-card { background:#fff; border-radius:10px; padding:0.85rem; margin-bottom:0.5rem; border:1px solid var(--gray-200); cursor:pointer; transition:all 0.15s; }
.kanban-card:hover { box-shadow:0 4px 12px rgba(0,0,0,0.1); transform:translateY(-1px); border-color:var(--primary); }
.kanban-card-title { font-size:0.8rem; font-weight:600; color:var(--gray-900); margin-bottom:0.35rem; }
.kanban-card-company { font-size:0.72rem; color:var(--gray-500); margin-bottom:0.5rem; }
.kanban-card-value { font-size:0.8rem; font-weight:600; color:var(--success); }
.kanban-card-footer { display:flex; align-items:center; justify-content:space-between; margin-top:0.5rem; }
.kanban-card-ae { font-size:0.7rem; color:var(--gray-400); }

/* 漏斗图 */
.funnel-container { display:flex; flex-direction:column; gap:0.5rem; padding:1rem 0; }
.funnel-stage { display:flex; align-items:center; gap:1rem; }
.funnel-label { width:90px; text-align:right; font-size:0.78rem; font-weight:600; color:var(--gray-700); }
.funnel-bar-wrap { flex:1; height:36px; background:var(--gray-100); border-radius:6px; overflow:hidden; position:relative; }
.funnel-bar { height:100%; border-radius:6px; transition:width 0.6s ease; display:flex; align-items:center; padding:0 0.75rem; }
.funnel-bar-text { font-size:0.72rem; font-weight:600; color:#fff; white-space:nowrap; }
.funnel-meta { width:120px; font-size:0.72rem; color:var(--gray-500); }

/* 时间线 */
.timeline { position:relative; padding-left:1.5rem; }
.timeline::before { content:''; position:absolute; left:0.4rem; top:0; bottom:0; width:2px; background:var(--gray-200); }
.timeline-item { position:relative; margin-bottom:1rem; }
.timeline-dot { position:absolute; left:-1.1rem; top:0.25rem; width:12px; height:12px; border-radius:50%; border:2px solid #fff; box-shadow:0 0 0 2px var(--gray-300); }
.timeline-dot.call { background:var(--info); box-shadow:0 0 0 2px #bfdbfe; }
.timeline-dot.meeting { background:var(--primary); box-shadow:0 0 0 2px var(--primary-light); }
.timeline-dot.demo { background:var(--warning); box-shadow:0 0 0 2px #fef3c7; }
.timeline-dot.proposal { background:var(--success); box-shadow:0 0 0 2px #d1fae5; }
.timeline-dot.email { background:var(--gray-400); box-shadow:0 0 0 2px var(--gray-200); }
.timeline-dot.note { background:var(--gray-300); }
.timeline-content { background:#fff; border:1px solid var(--gray-200); border-radius:10px; padding:0.75rem; }
.timeline-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:0.35rem; }
.timeline-title { font-size:0.82rem; font-weight:600; color:var(--gray-900); }
.timeline-time { font-size:0.7rem; color:var(--gray-400); }
.timeline-body { font-size:0.8rem; color:var(--gray-600); line-height:1.5; }

/* 评分条 */
.score-bar { margin-bottom:0.75rem; }
.score-bar-label { display:flex; justify-content:space-between; font-size:0.75rem; color:var(--gray-600); margin-bottom:0.3rem; }
.score-bar-track { height:8px; background:var(--gray-100); border-radius:99px; overflow:hidden; }
.score-bar-fill { height:100%; border-radius:99px; transition:width 0.6s ease; }
.score-high { background:linear-gradient(90deg, var(--success), #34d399); }
.score-mid { background:linear-gradient(90deg, var(--warning), #fbbf24); }
.score-low { background:linear-gradient(90deg, var(--danger), #f87171); }

/* 阶段进度 */
.stage-progress { display:flex; align-items:center; gap:0; overflow-x:auto; padding:0.5rem 0; }
.stage-step { display:flex; align-items:center; }
.stage-step-item { display:flex; flex-direction:column; align-items:center; gap:0.2rem; min-width:60px; }
.stage-step-circle { width:28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:0.65rem; font-weight:700; border:2px solid; }
.stage-step-circle.completed { background:var(--success); border-color:var(--success); color:#fff; }
.stage-step-circle.current { background:var(--primary); border-color:var(--primary); color:#fff; box-shadow:0 0 0 3px var(--primary-light); }
.stage-step-circle.pending { background:#fff; border-color:var(--gray-300); color:var(--gray-400); }
.stage-step-circle.lost { background:var(--danger); border-color:var(--danger); color:#fff; }
.stage-step-label { font-size:0.6rem; color:var(--gray-500); text-align:center; max-width:55px; line-height:1.2; }
.stage-connector { width:24px; height:2px; background:var(--gray-200); flex-shrink:0; margin-bottom:14px; }
.stage-connector.completed { background:var(--success); }

/* 工具卡片 */
.tool-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(280px, 1fr)); gap:1rem; }
.tool-card { background:#fff; border:1px solid var(--gray-200); border-radius:12px; padding:1.25rem; cursor:pointer; transition:all 0.15s; }
.tool-card:hover { border-color:var(--primary); box-shadow:0 4px 16px rgba(79,70,229,0.1); }
.tool-icon { width:40px; height:40px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:1.1rem; margin-bottom:0.75rem; }
.tool-name { font-size:0.875rem; font-weight:600; color:var(--gray-900); margin-bottom:0.25rem; }
.tool-desc { font-size:0.75rem; color:var(--gray-500); line-height:1.5; }
.tool-stage { font-size:0.7rem; color:var(--primary); font-weight:500; margin-top:0.5rem; }

/* 空状态 */
.empty-state { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:4rem 2rem; color:var(--gray-400); text-align:center; }
.empty-state i { font-size:3rem; margin-bottom:1rem; }
.empty-state h3 { font-size:1rem; font-weight:600; color:var(--gray-600); margin-bottom:0.5rem; }
.empty-state p { font-size:0.845rem; }

/* Toast通知 */
.toast-container { position:fixed; top:1rem; right:1rem; z-index:9999; display:flex; flex-direction:column; gap:0.5rem; }
.toast { display:flex; align-items:center; gap:0.75rem; background:#fff; border-radius:10px; padding:0.85rem 1rem; box-shadow:0 8px 24px rgba(0,0,0,0.12); border-left:4px solid; min-width:280px; animation:slideIn 0.3s ease; }
.toast.success { border-color:var(--success); }
.toast.error { border-color:var(--danger); }
.toast.info { border-color:var(--info); }
.toast.warning { border-color:var(--warning); }
.toast-icon { font-size:1rem; }
.toast.success .toast-icon { color:var(--success); }
.toast.error .toast-icon { color:var(--danger); }
.toast.info .toast-icon { color:var(--info); }
.toast-text { font-size:0.845rem; color:var(--gray-700); flex:1; }
@keyframes slideIn { from { transform:translateX(100%); opacity:0; } to { transform:translateX(0); opacity:1; } }

/* 详情面板 */
.detail-panel { display:grid; grid-template-columns:1fr 320px; gap:1.5rem; }
.detail-section { margin-bottom:1.5rem; }
.detail-section-title { font-size:0.8rem; font-weight:700; color:var(--gray-500); text-transform:uppercase; letter-spacing:0.05em; margin-bottom:0.75rem; padding-bottom:0.5rem; border-bottom:1px solid var(--gray-100); }
.detail-field { display:flex; gap:1rem; margin-bottom:0.6rem; align-items:flex-start; }
.detail-field-label { font-size:0.78rem; color:var(--gray-400); min-width:80px; flex-shrink:0; padding-top:0.1rem; }
.detail-field-value { font-size:0.845rem; color:var(--gray-800); font-weight:500; }

/* 警示框 */
.alert { display:flex; gap:0.75rem; padding:0.85rem 1rem; border-radius:8px; font-size:0.845rem; margin-bottom:1rem; }
.alert-warning { background:#fffbeb; border:1px solid #fde68a; color:#92400e; }
.alert-info { background:#eff6ff; border:1px solid #bfdbfe; color:#1e40af; }
.alert-success { background:#f0fdf4; border:1px solid #bbf7d0; color:#166534; }
.alert-danger { background:#fef2f2; border:1px solid #fecaca; color:#991b1b; }

/* 响应式 */
@media (max-width: 768px) {
  .sidebar { display:none; }
  .form-row, .form-row-3 { grid-template-columns:1fr; }
  .detail-panel { grid-template-columns:1fr; }
  .stat-grid { grid-template-columns:1fr 1fr; }
}

/* 精细化样式 */
.section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:1.25rem; }
.section-title { font-size:1.1rem; font-weight:700; color:var(--gray-900); }
.section-sub { font-size:0.8rem; color:var(--gray-500); margin-top:0.2rem; }
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:1rem; }
.grid-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:1rem; }
.flex-center { display:flex; align-items:center; }
.flex-between { display:flex; align-items:center; justify-content:space-between; }
.text-muted { color:var(--gray-400); font-size:0.78rem; }
.text-sm { font-size:0.845rem; }
.text-value { font-weight:600; color:var(--gray-900); }
.mt-1 { margin-top:0.5rem; }
.mt-2 { margin-top:1rem; }
.mb-1 { margin-bottom:0.5rem; }
.mb-2 { margin-bottom:1rem; }
.p-1 { padding:0.5rem; }
.gap-1 { gap:0.5rem; }
.chart-wrap { position:relative; height:220px; }
.win-loss-badge { display:inline-flex; align-items:center; gap:0.4rem; padding:0.35rem 0.85rem; border-radius:99px; font-size:0.8rem; font-weight:600; }
.win-badge { background:#d1fae5; color:#065f46; }
.lose-badge { background:#fee2e2; color:#991b1b; }
.probability-badge { display:inline-flex; align-items:center; gap:0.25rem; font-weight:700; }
