/* 全局样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f5f6fa; color: #1f2937; font-size: 14px; }
a { text-decoration: none; color: inherit; cursor: pointer; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #1e293b; color: #cbd5e1; padding: 20px 0; flex-shrink: 0; }
.sidebar .logo { padding: 0 20px 20px; font-size: 18px; font-weight: 600; color: white; border-bottom: 1px solid #334155; margin-bottom: 16px; }
.sidebar .logo span { color: #10b981; }
.menu-item { padding: 11px 20px; cursor: pointer; display: block; color: #cbd5e1; }
.menu-item:hover { background: #334155; color: white; }
.menu-item.active { background: #10b981; color: white; }
.menu-group { font-size: 12px; color: #64748b; padding: 16px 20px 8px; }

.main { flex: 1; display: flex; flex-direction: column; }
.topbar { background: white; padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.topbar .crumb { color: #6b7280; }
.topbar .crumb b { color: #1f2937; }
.topbar .user { display: flex; align-items: center; gap: 8px; }
.topbar .avatar { width: 32px; height: 32px; border-radius: 50%; background: #10b981; color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; }

.content { padding: 24px; flex: 1; overflow: auto; }

/* 通用组件 */
.btn { padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.btn-primary { background: #10b981; color: white; }
.btn-primary:hover { background: #059669; }
.btn-ghost { background: white; color: #1f2937; border: 1px solid #e5e7eb; }
.btn-ghost:hover { background: #f9fafb; }
.btn-danger { background: #ef4444; color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.card { background: white; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); padding: 20px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.page-title { font-size: 20px; font-weight: 600; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; background: white; padding: 4px; border-radius: 8px; width: fit-content; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.tab { padding: 8px 16px; border-radius: 4px; cursor: pointer; color: #6b7280; font-size: 13px; }
.tab.active { background: #10b981; color: white; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.tag-s0 { background: #f1f5f9; color: #475569; }
.tag-s1 { background: #dbeafe; color: #2563eb; }
.tag-s2 { background: #ddd6fe; color: #7c3aed; }
.tag-s3 { background: #fef3c7; color: #d97706; }
.tag-s4 { background: #fed7aa; color: #ea580c; }
.tag-s5 { background: #d1fae5; color: #047857; }
.tag-s6 { background: #c7d2fe; color: #4338ca; }
.tag-s7 { background: #fee2e2; color: #dc2626; }
.tag-agent { background: #f3e8ff; color: #7c3aed; }
.tag-warn { background: #fee2e2; color: #dc2626; }
.tag-pool { background: #dbeafe; color: #1e40af; }

/* 表格 */
table { width: 100%; border-collapse: collapse; }
th { background: #f8fafc; padding: 12px; text-align: left; color: #6b7280; font-size: 12px; font-weight: 500; border-bottom: 1px solid #f1f5f9; }
td { padding: 12px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
tr:hover { background: #f8fafc; }

/* 输入框 */
input, select, textarea { padding: 6px 10px; border: 1px solid #e5e7eb; border-radius: 4px; font-size: 13px; outline: none; font-family: inherit; }
input:focus, select:focus, textarea:focus { border-color: #10b981; }
label { display: block; font-size: 12px; color: #6b7280; margin-bottom: 4px; }

/* 登录页 */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #10b981 0%, #059669 100%); display: flex; align-items: center; justify-content: center; }
.login-card { background: white; border-radius: 16px; padding: 40px; width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.login-logo { text-align: center; font-size: 28px; font-weight: 700; color: #047857; margin-bottom: 8px; }
.login-logo span { color: #10b981; }
.login-sub { text-align: center; color: #6b7280; font-size: 13px; margin-bottom: 30px; }
.login-form .form-row { margin-bottom: 16px; }
.login-form input { width: 100%; padding: 10px 14px; font-size: 14px; }
.login-form .btn { width: 100%; padding: 12px; font-size: 15px; justify-content: center; margin-top: 8px; }
.quick-accounts { margin-top: 24px; padding-top: 20px; border-top: 1px solid #f1f5f9; }
.quick-accounts .title { font-size: 12px; color: #6b7280; margin-bottom: 10px; }
.quick-account { display: flex; align-items: center; gap: 8px; padding: 10px; background: #f8fafc; border-radius: 6px; margin-bottom: 6px; cursor: pointer; transition: all 0.2s; }
.quick-account:hover { background: #ecfdf5; border: 1px solid #10b981; }
.quick-account .name { font-weight: 500; flex: 1; }
.quick-account .role { font-size: 11px; color: #6b7280; }

/* 弹窗 */
.modal-mask { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: white; border-radius: 12px; padding: 24px; width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; align-items: center; }
.modal-close { cursor: pointer; color: #6b7280; font-size: 20px; }
.modal-body { padding: 4px 0; }
.form-row { margin-bottom: 14px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; }
.form-row textarea { min-height: 80px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid #f1f5f9; }

/* 仪表盘卡片 */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.metric { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.metric .label { color: #6b7280; font-size: 13px; }
.metric .value { font-size: 28px; font-weight: 700; color: #1f2937; margin: 8px 0 4px; }
.metric .delta { font-size: 12px; }
.delta.up { color: #10b981; }
.delta.down { color: #ef4444; }

.todo-list { }
.todo-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; align-items: center; }
.todo-item:last-child { border-bottom: none; }
.todo-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.todo-icon.urgent { background: #fee2e2; color: #dc2626; }
.todo-icon.warn { background: #fef3c7; color: #d97706; }
.todo-icon.normal { background: #dbeafe; color: #2563eb; }
.todo-body { flex: 1; }
.todo-title { font-weight: 500; }
.todo-meta { color: #6b7280; font-size: 12px; margin-top: 2px; }

/* 看板 */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.column { background: #f1f5f9; border-radius: 8px; min-width: 240px; flex: 1; }
.col-header { padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; }
.col-title { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.col-count { background: white; color: #475569; padding: 1px 8px; border-radius: 10px; font-size: 11px; }
.col-cards { padding: 0 8px 8px; }
.kanban-card { background: white; padding: 10px 12px; border-radius: 6px; margin-bottom: 8px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.kanban-card .kc-name { font-weight: 500; font-size: 13px; margin-bottom: 4px; }
.kanban-card .kc-meta { color: #6b7280; font-size: 11px; display: flex; gap: 8px; flex-wrap: wrap; }

/* 客户详情 */
.cust-header { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid #f1f5f9; margin-bottom: 16px; }
.cust-avatar { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, #10b981, #34d399); color: white; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 600; }
.cust-name { font-size: 20px; font-weight: 600; }
.cust-meta { color: #6b7280; font-size: 13px; margin-top: 4px; }
.cust-stats { display: flex; gap: 24px; margin-top: 12px; }
.stat-item { }
.stat-label { color: #6b7280; font-size: 12px; }
.stat-value { font-size: 18px; font-weight: 600; margin-top: 4px; }
.stat-value.warn { color: #d97706; }
.stat-value.danger { color: #dc2626; }
.stat-value.ok { color: #10b981; }

.timeline { padding: 12px 0; }
.tl-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: #e5e7eb; }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; z-index: 1; color: white; }
.tl-dot.comm { background: #3b82f6; }
.tl-dot.trial { background: #f59e0b; }
.tl-dot.order { background: #8b5cf6; }
.tl-dot.stage { background: #6366f1; }
.tl-content { flex: 1; }
.tl-time { color: #6b7280; font-size: 11px; }
.tl-title { font-weight: 500; font-size: 14px; margin-top: 2px; }
.tl-detail { color: #6b7280; font-size: 13px; margin-top: 4px; line-height: 1.5; }

/* 列表视图 */
.list-card { background: white; border-radius: 8px; }
.empty { padding: 60px 20px; text-align: center; color: #94a3b8; }
.actions-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filter-bar select, .filter-bar input { min-width: 120px; }

/* 工具 */
.muted { color: #9ca3af; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.font-mono { font-family: 'SF Mono', 'Monaco', monospace; }
