:root {
  --brand: #e23744;
  --brand-dark: #bd2532;
  --brand-soft: #fdeeef;
  --ink: #241f21;
  --ink-soft: #443c3e;
  --muted: #7f7477;
  --muted-light: #a29497;
  --bg: #f7f3f1;
  --surface: #ffffff;
  --line: #ece4e0;
  --line-strong: #ded3ce;
  --gold: #b98a3d;
  --success: #1a8b47;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(36, 31, 33, 0.04), 0 10px 30px rgba(36, 31, 33, 0.055);

  --el-color-primary: #e23744;
  --el-color-primary-light-3: #eb6a74;
  --el-color-primary-light-5: #f08b92;
  --el-color-primary-light-7: #f5adb2;
  --el-color-primary-light-8: #f8c3c7;
  --el-color-primary-light-9: #fdeced;
  --el-color-primary-dark-2: #bd2532;
  --el-border-radius-base: 8px;
  --el-font-size-base: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 64px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1180px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, #f04b56, var(--brand) 60%, var(--brand-dark));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(226, 55, 68, 0.28);
}

.brand-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.topbar-nav a {
  height: 34px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  transition: all 0.16s ease;
}

.topbar-nav a:hover {
  color: var(--ink);
  background: #faf5f3;
}

.topbar-nav a.is-active {
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 600;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  color: var(--ink-soft);
}

.user-role {
  font-size: 11px;
  color: var(--muted);
  background: #f4efec;
  border-radius: 999px;
  padding: 3px 8px;
}

.logout-btn {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 2px;
  transition: color 0.16s ease;
}

.logout-btn:hover {
  color: var(--brand);
}

/* ---------- 页面通用 ---------- */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 72px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0;
}

.page-sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 0;
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.panel-hint {
  font-size: 12px;
  color: var(--muted);
}

.panel-body {
  padding: 18px 20px 20px;
}

.panel-body.is-flush {
  padding: 0;
}

.panel-body.is-flush .el-table {
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

.el-dialog {
  border-radius: 16px;
  max-width: 92vw;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.toolbar-search {
  width: 250px;
}

.toolbar-select {
  width: 132px;
}

.toolbar-spacer {
  flex: 1;
}

/* ---------- 阶段标签 ---------- */
.stage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.stage::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}

.stage-pending {
  color: #b5700a;
  background: #fff4e3;
}

.stage-wechat_added {
  color: #1d62d6;
  background: #eaf2ff;
}

.stage-visit_booked {
  color: #6b3fd4;
  background: #f1ebff;
}

.stage-won {
  color: #1a8b47;
  background: #e7f7ee;
}

.stage-lost {
  color: #857a75;
  background: #f1eeec;
}

/* ---------- 表格 ---------- */
.table-wrap {
  overflow-x: auto;
}

.table-wrap .el-table {
  font-size: 13px;
}

.table-wrap .el-table th.el-table__cell {
  background: #faf6f4 !important;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 12.5px;
}

.table-wrap .el-table td.el-table__cell {
  color: var(--ink-soft);
}

.table-wrap .el-table__row {
  cursor: pointer;
}

.cell-strong {
  font-weight: 600;
  color: var(--ink);
}

.cell-muted {
  color: var(--muted-light);
}

.pagination-bar {
  display: flex;
  justify-content: flex-end;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--line);
}

/* ---------- 登录页 ---------- */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(226, 55, 68, 0.12), transparent 62%),
    radial-gradient(760px 480px at 88% 8%, rgba(185, 138, 61, 0.12), transparent 60%),
    radial-gradient(680px 520px at 50% 110%, rgba(226, 55, 68, 0.07), transparent 65%),
    #f9f5f3;
}

.login-body > #app {
  width: 100%;
  max-width: 404px;
}

.login-card {
  width: 100%;
  max-width: 404px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  padding: 42px 40px 32px;
  box-shadow: 0 2px 4px rgba(36, 31, 33, 0.03), 0 30px 80px rgba(36, 31, 33, 0.12);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.login-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #f04b56, var(--brand) 60%, var(--brand-dark));
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(226, 55, 68, 0.26);
}

.login-brand-text strong {
  display: block;
  font-size: 16px;
  font-weight: 650;
}

.login-brand-text span {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted-light);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-title {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.login-desc {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 28px;
  line-height: 1.7;
}

.login-card .el-input__wrapper {
  padding: 4px 14px;
  border-radius: 10px;
  background: #fbf8f7;
  box-shadow: 0 0 0 1px var(--line) inset;
}

.login-card .el-input__wrapper.is-focus {
  background: #fff;
  box-shadow: 0 0 0 1px var(--brand) inset;
}

.login-card .el-input__inner {
  height: 42px;
}

.login-submit {
  width: 100%;
  height: 44px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 10px !important;
  margin-top: 6px;
}

.login-foot {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 11.5px;
  color: var(--muted-light);
  line-height: 1.8;
}

/* ---------- 看板 ---------- */
.range-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 20px;
  margin-bottom: 18px;
}

.range-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.range-label {
  font-size: 13px;
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--metric-accent, var(--brand));
  opacity: 0.85;
}

.metric-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.metric-value {
  margin-top: 10px;
  font-size: 30px;
  font-weight: 650;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.metric-value small {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}

.metric-sub {
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--muted-light);
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.chart-box {
  height: 320px;
  width: 100%;
}

.section-gap {
  margin-bottom: 18px;
}

.rate-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rate-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: #f2ebe7;
  overflow: hidden;
  max-width: 140px;
}

.rate-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f08b92, var(--brand));
}

.rate-text {
  font-size: 12px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  min-width: 44px;
}

/* ---------- 线索详情 ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
  transition: color 0.16s ease;
}

.back-link:hover {
  color: var(--brand);
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-meta {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.detail-main,
.detail-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 24px;
}

.info-item.is-full {
  grid-column: 1 / -1;
}

.info-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}

.info-value {
  font-size: 14px;
  color: var(--ink);
  word-break: break-all;
  line-height: 1.6;
}

.info-value.is-empty {
  color: var(--muted-light);
}

.info-edit .el-form-item {
  margin-bottom: 0;
}

.info-edit .el-form-item__label {
  font-size: 12px;
  color: var(--muted);
  padding-bottom: 4px;
  line-height: 1.4;
}

.edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 20px 18px;
}

.stage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stage-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-soft);
  transition: all 0.16s ease;
  text-align: left;
}

.stage-option:hover {
  border-color: var(--line-strong);
  background: #fdfaf9;
}

.stage-option.is-current {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}

.stage-option.is-current .stage-option-check {
  opacity: 1;
}

.stage-option-check {
  opacity: 0;
  font-size: 12px;
  color: var(--brand);
}

.stage-option .stage {
  pointer-events: none;
}

.source-list {
  display: flex;
  flex-direction: column;
}

.source-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}

.source-row:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}

.source-row .source-label {
  color: var(--muted);
  flex-shrink: 0;
}

.source-row .source-value {
  color: var(--ink-soft);
  text-align: right;
  word-break: break-all;
}

.timeline {
  padding: 4px 20px 8px;
}

.timeline-item {
  position: relative;
  padding: 0 0 22px 24px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.timeline-item::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 20px;
  bottom: 2px;
  width: 1px;
  background: var(--line);
}

.timeline-item:last-child {
  padding-bottom: 4px;
}

.timeline-item:last-child::after {
  display: none;
}

.timeline-content {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.timeline-meta {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.timeline-stage-badge {
  font-size: 11px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 6px;
  padding: 2px 7px;
}

.timeline-empty {
  padding: 12px 20px 24px;
  font-size: 13px;
  color: var(--muted-light);
}

.follow-form {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--line);
  background: #fdfbfa;
  border-radius: 0 0 var(--radius) var(--radius);
}

.follow-form .el-textarea__inner {
  border-radius: 10px;
}

.follow-form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.follow-form-tip {
  font-size: 12px;
  color: var(--muted-light);
}

/* ---------- 新建线索弹窗 ---------- */
.dialog-form .el-form-item__label {
  font-size: 13px;
  color: var(--ink-soft);
}

.dialog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.dialog-grid .is-full {
  grid-column: 1 / -1;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .chart-grid,
  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .chart-box {
    height: 300px;
  }
  .topbar-inner {
    gap: 16px;
    padding: 0 16px;
  }
  .page {
    padding: 22px 16px 56px;
  }
}

@media (max-width: 640px) {
  .brand-name {
    font-size: 15px;
  }
  .topbar {
    height: auto;
  }
  .topbar-inner {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 10px 16px;
  }
  .topbar-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }
  .topbar-user {
    margin-left: auto;
  }
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .metric-value {
    font-size: 26px;
  }
  .toolbar-search {
    width: 100%;
  }
  .toolbar-select {
    width: calc(50% - 5px);
  }
  .info-grid,
  .dialog-grid {
    grid-template-columns: 1fr;
  }
  .login-card {
    padding: 32px 24px 26px;
  }
  .chart-box {
    height: 270px;
  }
  .pagination-bar {
    justify-content: center;
  }
  .detail-title-row .page-title {
    font-size: 20px;
  }
}
