/* style.css - 专为手机端极速跟进打造的高级CRM自适应样式 (零外部依赖，国内100%秒开) */
:root {
  --primary: #1877f2;
  --primary-hover: #166fe5;
  --primary-light: #e7f3ff;
  --bg-main: #f0f2f5;
  --surface: #ffffff;
  --border: #e4e6eb;
  --text-main: #050505;
  --text-muted: #65676b;
  --danger: #e41e3f;
  --danger-bg: #fde8e8;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --success: #31a24c;
  --success-bg: #e7f7ed;
  --info: #0284c7;
  --info-bg: #e0f2fe;
  --advisor-bg: #faf5ff;
  --advisor-border: #e9d5ff;
  --advisor-text: #7e22ce;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.45;
  font-size: 15px;
  padding-bottom: 85px; /* 为移动端底部导航与吸底工具栏留充足间隙 */
}

/* 顶部极简导航 */
.navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.nav-brand {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.nav-brand span {
  font-size: 11px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
}
.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.role-tag {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.role-tag.agent { background: #e7f3ff; color: #1877f2; }
.role-tag.advisor { background: #f3e8ff; color: #7e22ce; }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px;
}

/* 统计卡片网格 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.stat-card.alert {
  background: var(--danger-bg);
  border-color: #fca5a5;
}
.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.stat-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 4px;
}
.stat-card.alert .stat-val {
  color: var(--danger);
}

/* 卡片容器 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
  overflow: hidden;
}
.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 16px;
}
.card-body {
  padding: 16px;
}

/* 移动端高频交互：点击胶囊/标签 (Chips) */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  margin-bottom: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 13px;
  background: #f0f2f5;
  color: #334155;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  min-height: 32px;
}
.chip:active {
  background: #e2e8f0;
  transform: scale(0.97);
}
.chip.active, .chip.selected {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  font-weight: 600;
}
.chip.chip-amber { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.chip.chip-green { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.chip.chip-purple { background: #f3e8ff; color: #6b21a8; border-color: #e9d5ff; }

/* 客户快速水平滚动条 (最近跟进/常看客户，一触即达) */
.quick-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.quick-scroll::-webkit-scrollbar {
  display: none;
}
.quick-cust-card {
  flex: 0 0 auto;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  text-decoration: none;
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.quick-cust-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* 按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  min-height: 44px; /* 移动端大触摸热区 */
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text-main);
}
.btn-block { width: 100%; }
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  min-height: 34px;
  border-radius: 8px;
}

/* 标签徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}
.badge-red { background: var(--danger-bg); color: var(--danger); border: 1px solid #fca5a5; }
.badge-amber { background: var(--warning-bg); color: #b45309; border: 1px solid #fcd34d; }
.badge-blue { background: var(--info-bg); color: var(--info); border: 1px solid #bfdbfe; }
.badge-green { background: var(--success-bg); color: var(--success); border: 1px solid #a7f3d0; }
.badge-gray { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

/* 客户列表卡片流 */
.customer-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: block;
  text-decoration: none;
  color: inherit;
  transition: background 0.1s;
}
.customer-item:last-child { border-bottom: none; }
.customer-item:active { background: #f8fafc; }
.item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.cust-name {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}
.item-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.item-action {
  font-size: 13px;
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--primary);
  color: #334155;
}
.item-action.overdue {
  border-left-color: var(--danger);
  background: var(--danger-bg);
  color: #991b1b;
}

/* 表单与输入框 */
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #1e293b;
}
.form-control {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.12);
}
textarea.form-control {
  min-height: 85px;
  resize: vertical;
}

/* 时间线 Timeline */
.timeline {
  position: relative;
  padding-left: 20px;
  margin-top: 12px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: #cbd5e1;
}
.timeline-item {
  position: relative;
  margin-bottom: 18px;
}
.timeline-dot {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px #94a3b8;
}
.timeline-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.timeline-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.timeline-body {
  font-size: 14px;
  color: #1e293b;
  margin-bottom: 8px;
  white-space: pre-wrap;
}
.timeline-next {
  font-size: 13px;
  background: #eff6ff;
  border: 1px dashed #93c5fd;
  padding: 6px 10px;
  border-radius: 6px;
  color: #1d4ed8;
}

/* 提示与Toast */
.toast-msg {
  position: fixed;
  bottom: 75px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.9);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.toast-msg.show {
  opacity: 1;
}

/* 移动端底部固定导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 58px;
  background: #ffffff;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.03);
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px;
}
.bottom-nav-item.active {
  color: var(--primary);
  font-weight: 700;
}
.bottom-nav-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

/* PC 端菜单 */
@media (min-width: 860px) {
  body {
    padding-bottom: 20px;
  }
  .bottom-nav {
    display: none;
  }
  .pc-nav-links {
    display: flex;
    gap: 16px;
  }
  .pc-nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
  }
  .pc-nav-links a:hover {
    color: var(--primary);
  }
}
@media (max-width: 859px) {
  .pc-nav-links {
    display: none;
  }
}
