/* 芒果喜番 CRM · 公共样式
   文档 4 + 8 节: 移动端兼容 (flexbox + overflow-x:auto) */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  color: #2c3e50;
  background: #f4f6fa;
  -webkit-font-smoothing: antialiased;
}
a { color: #1976d2; text-decoration: none; }
a:hover { text-decoration: underline; }
button, .btn {
  cursor: pointer;
  border: 1px solid #d0d7de;
  background: #fff;
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 14px;
  color: #2c3e50;
  transition: all .15s;
}
button:hover, .btn:hover { background: #f0f3f7; }
button.primary, .btn.primary {
  background: #1976d2; color: #fff; border-color: #1976d2;
}
button.primary:hover, .btn.primary:hover { background: #1565c0; }
button.danger { background: #e53935; color: #fff; border-color: #e53935; }
button.danger:hover { background: #c62828; }
button:disabled { opacity: .55; cursor: not-allowed; }

input[type="text"], input[type="password"], input[type="number"],
input[type="datetime-local"], input[type="date"], select, textarea {
  width: 100%;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  padding: 7px 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #1976d2;
  box-shadow: 0 0 0 2px rgba(25,118,210,.15);
}
textarea { resize: vertical; min-height: 70px; }

/* ===== 顶栏 ===== */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  background: #1976d2; color: #fff; padding: 0 20px; height: 52px;
  position: sticky; top: 0; z-index: 10;
}
.app-header .logo { font-weight: 600; font-size: 16px; }
.app-header nav { display: flex; gap: 6px; }
.app-header nav a {
  color: #fff; padding: 6px 12px; border-radius: 4px;
  font-size: 14px;
}
.app-header nav a.active, .app-header nav a:hover { background: rgba(255,255,255,.18); text-decoration: none; }
.app-header .user { font-size: 13px; }
.app-header .user .logout { margin-left: 12px; cursor: pointer; opacity: .85; }
.app-header .user .logout:hover { opacity: 1; }

/* ===== 容器 ===== */
.container { max-width: 1280px; margin: 0 auto; padding: 16px; }

/* ===== 卡片 ===== */
.card {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  padding: 16px;
  margin-bottom: 14px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

/* ===== 筛选栏 ===== */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  background: #fff; border-radius: 6px; padding: 14px;
  margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.filter-bar .item { display: flex; flex-direction: column; min-width: 130px; }
.filter-bar .item label { font-size: 12px; color: #6a737d; margin-bottom: 4px; }
.filter-bar .actions { display: flex; gap: 8px; align-items: center; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; background: #fff; border-radius: 6px; }
table.data { width: 100%; border-collapse: collapse; min-width: 900px; }
table.data th, table.data td {
  padding: 10px 12px; border-bottom: 1px solid #eef0f3; white-space: nowrap;
  font-size: 13px; text-align: left;
}
table.data th { background: #fafbfc; font-weight: 600; color: #4a5568; }
table.data tbody tr:hover { background: #f6faff; }

/* ===== 评级 chip ===== */
.grade {
  display: inline-block; padding: 2px 8px; border-radius: 3px;
  font-size: 12px; font-weight: 600; color: #fff;
}
.grade.S { background: #8e24aa; }
.grade.A { background: #1976d2; }
.grade.B { background: #43a047; }
.grade.C { background: #fb8c00; }

/* ===== 阶段标签 ===== */
.stage-tag {
  display: inline-block; padding: 2px 8px; border-radius: 3px;
  font-size: 12px; color: #fff;
}
.stage-tag.lead    { background: #607d8b; }
.stage-tag.follow  { background: #0288d1; }
.stage-tag.intent  { background: #f57c00; }
.stage-tag.convert { background: #43a047; }
.stage-tag.after   { background: #6a1b9a; }

/* ===== 来源 ===== */
.src-tag {
  display: inline-block; padding: 1px 7px; border-radius: 3px;
  font-size: 12px; background: #eceff1; color: #455a64;
}

/* ===== 阶段进度条 ===== */
.stage-progress {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; padding: 18px 20px; border-radius: 6px; margin-bottom: 14px;
}
.stage-progress .step {
  flex: 1; text-align: center; position: relative; color: #9aa5b1;
  font-size: 13px;
}
.stage-progress .step .dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: #eceff1; color: #9aa5b1; line-height: 28px;
  margin: 0 auto 6px; font-weight: 600;
}
.stage-progress .step.done .dot { background: #43a047; color: #fff; }
.stage-progress .step.current .dot { background: #1976d2; color: #fff; box-shadow: 0 0 0 4px rgba(25,118,210,.18); }
.stage-progress .step .ts { font-size: 11px; color: #b0bec5; }
.stage-progress .bar {
  position: absolute; top: 14px; left: 50%; right: -50%; height: 2px; background: #eceff1; z-index: -1;
}
.stage-progress .step.done .bar { background: #43a047; }

/* ===== Tab ===== */
.tabs { display: flex; border-bottom: 1px solid #e0e4e8; margin-bottom: 14px; }
.tabs .tab {
  padding: 10px 16px; cursor: pointer; color: #6a737d;
  border-bottom: 2px solid transparent; font-size: 14px;
}
.tabs .tab.active { color: #1976d2; border-color: #1976d2; font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== 时间线 ===== */
.timeline { padding-left: 16px; border-left: 2px solid #e0e4e8; }
.timeline .item { position: relative; padding: 0 0 16px 18px; }
.timeline .item::before {
  content: ''; position: absolute; left: -7px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%; background: #1976d2;
}
.timeline .item .meta { font-size: 12px; color: #9aa5b1; margin-bottom: 4px; }
.timeline .item .content { color: #2c3e50; }

/* ===== 模态框 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; border-radius: 6px; min-width: 380px; max-width: 90vw;
  max-height: 88vh; overflow-y: auto; box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid #eef0f3;
  font-size: 15px; font-weight: 600;
}
.modal-head .close { cursor: pointer; color: #9aa5b1; font-size: 20px; }
.modal-body { padding: 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid #eef0f3; text-align: right; }
.modal-foot .btn + .btn { margin-left: 8px; }

/* ===== 表单 ===== */
.form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.form-row .field { flex: 1; min-width: 180px; }
.form-row .field label { display: block; font-size: 12px; color: #6a737d; margin-bottom: 4px; }
.form-row .field .required::after { content: ' *'; color: #e53935; }

/* ===== 信息条 ===== */
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 24px; }
.info-grid .kv { font-size: 13px; }
.info-grid .kv .k { color: #6a737d; }
.info-grid .kv .v { color: #2c3e50; margin-left: 6px; }

/* ===== 提示 ===== */
.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  background: #323232; color: #fff; padding: 8px 18px; border-radius: 4px;
  font-size: 13px; z-index: 200; box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.toast.error { background: #c62828; }
.toast.ok    { background: #2e7d32; }

/* ===== 浮动按钮 ===== */
.fab {
  position: fixed; right: 24px; bottom: 24px;
  background: #1976d2; color: #fff;
  border-radius: 50%; width: 56px; height: 56px; line-height: 56px;
  text-align: center; font-size: 30px; box-shadow: 0 6px 20px rgba(25,118,210,.45);
  cursor: pointer; user-select: none;
}
.fab:hover { background: #1565c0; text-decoration: none; }

/* ===== 登录页 ===== */
.login-bg {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1976d2, #42a5f5);
}
.login-box {
  background: #fff; border-radius: 10px; padding: 32px 36px;
  width: 360px; box-shadow: 0 10px 40px rgba(0,0,0,.18);
}
.login-box h1 { margin: 0 0 4px; font-size: 22px; color: #1976d2; }
.login-box .sub { color: #9aa5b1; font-size: 13px; margin-bottom: 22px; }
.login-box .item { margin-bottom: 14px; }
.login-box .item label { display: block; font-size: 12px; color: #6a737d; margin-bottom: 4px; }
.login-box .submit { width: 100%; padding: 10px; font-size: 15px; }

/* ===== 分页 ===== */
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 12px 0; }
.pager .info { color: #6a737d; font-size: 13px; margin-right: auto; }

/* ===== 空态 ===== */
.empty { text-align: center; color: #9aa5b1; padding: 40px 0; }
