/* ============================================================
   医疗器械 CRM Demo — 自定义样式
   ============================================================ */

/* ===== 导出下拉菜单 ===== */
.export-menu { display: none; }
.export-menu-item { padding: 10px 14px; cursor: pointer; white-space: nowrap; font-size: 13px; color: #1e293b; border-bottom: 1px solid #f1f5f9; }
.export-menu-item:hover { background: #f1f5f9; }
.export-menu-item:last-child { border-bottom: none; }

/* ===== 全局自适应基础（不依赖@media，始终生效） ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  max-width: 100vw;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  max-width: 100vw;
  margin: 0;
}

img, video, canvas, svg, table {
  max-width: 100%;
}

input, select, textarea, button {
  max-width: 100%;
  font-family: inherit;
}

:root {
  --teal-50: #f0fdfa;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --purple-50: #f5f3ff;
  --purple-500: #8b5cf6;
  --purple-600: #7c3aed;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  background: var(--slate-50);
  color: var(--slate-800);
  -webkit-font-smoothing: antialiased;
}

/* ===== Layout ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
}

.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--slate-900);
  color: #fff;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 40;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
}

.sidebar-header .logo .icon {
  width: 36px; height: 36px;
  background: var(--teal-500);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.sidebar-nav { padding: 12px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #94a3b8;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}

.nav-item.active {
  color: #fff;
  background: rgba(20,184,166,0.15);
  border-left-color: var(--teal-500);
}

.nav-item .icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.nav-item .nav-label {
  flex: 1;
}

.nav-item .nav-badge {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  padding: 0 5px;
  flex-shrink: 0;
}

.nav-item .drag-handle {
  opacity: 0;
  color: #64748b;
  font-size: 14px;
  letter-spacing: -2px;
  transition: opacity 0.15s;
  user-select: none;
}

.nav-item:hover .drag-handle { opacity: 1; }

.nav-item[draggable="true"] { -webkit-user-drag: element; }

.nav-item.dragging {
  opacity: 0.4;
}

.nav-item.drag-over {
  border-top: 2px solid #14b8a6;
  margin-top: -2px;
  background: rgba(20,184,166,0.1);
}

/* 系统管理折叠分组 */
.nav-system {
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 8px;
  padding-top: 4px;
}
.nav-system-title {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #94a3b8;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.nav-system-title:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}
.nav-system-title.active {
  color: #fff;
  background: rgba(20,184,166,0.15);
  border-left-color: var(--teal-500);
}
.nav-system-title .icon { font-size: 18px; width: 24px; text-align: center; }
.nav-system-title .nav-label { flex: 1; }
.nav-system-title .nav-arrow { color: #64748b; font-size: 12px; }
.nav-item-system {
  padding-left: 42px;
  font-size: 13px;
}

.sidebar-footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 13px;
  color: #94a3b8;
}

.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ===== Top Bar ===== */
.topbar {
  background: #fff;
  padding: 14px clamp(12px, 3vw, 28px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--slate-200);
  position: sticky;
  top: 0;
  z-index: 30;
  max-width: 100%;
  overflow: hidden;
  gap: 8px;
}

.topbar h1 {
  font-size: clamp(14px, 3vw, 18px);
  font-weight: 600;
  color: var(--slate-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--slate-500);
  flex-shrink: 0;
  min-width: 0;
  overflow: hidden;
}

.topbar .user-avatar {
  width: 34px; height: 34px;
  background: var(--teal-500);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.content-area {
  flex: 1;
  padding: clamp(12px, 3vw, 28px);
  overflow-x: hidden;
  max-width: 100%;
  min-width: 0;
}

/* ===== Dashboard ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: clamp(10px, 2vw, 18px);
  margin-bottom: 28px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  border: 1px solid var(--slate-200);
  transition: box-shadow 0.2s;
}

.stat-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.stat-card .label {
  font-size: 13px;
  color: var(--slate-500);
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 32px;
  font-weight: 700;
  color: var(--slate-900);
}

.stat-card .change {
  font-size: 12px;
  margin-top: 6px;
}

.stat-card .change.up { color: #16a34a; }
.stat-card .change.down { color: #dc2626; }

.stat-card .icon-box {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}

/* Funnel */
.funnel-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.funnel-card {
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  border: 1px solid var(--slate-200);
}

.funnel-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 18px;
  color: var(--slate-900);
}

.funnel-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.funnel-bar .stage-name {
  width: clamp(50px, 15vw, 80px);
  font-size: 13px;
  color: var(--slate-600);
  text-align: right;
  flex-shrink: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.funnel-bar .bar-track {
  flex: 1;
  height: 28px;
  background: var(--slate-100);
  border-radius: 6px;
  overflow: hidden;
}

.funnel-bar .bar-fill {
  height: 100%;
  border-radius: 6px;
  display: flex; align-items: center;
  padding-left: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  transition: width 0.5s ease;
}

.funnel-bar .count {
  width: 30px;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
}

/* Activity feed */
.activity-card {
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  border: 1px solid var(--slate-200);
}

.activity-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--slate-100);
}

.activity-item:last-child { border-bottom: none; }

.activity-item .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-item .content { flex: 1; }
.activity-item .content .title { font-size: 13px; color: var(--slate-700); }
.activity-item .content .date { font-size: 11px; color: var(--slate-400); margin-top: 2px; }

/* ===== Kanban Board ===== */
.kanban-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

/* ===== 管理视图：筛选器+图表+卡片 ===== */
.manage-filters {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.filter-row + .filter-row { margin-top: 12px; }

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-label {
  font-size: 12px;
  color: var(--slate-500);
  font-weight: 500;
  white-space: nowrap;
}

.time-btn-group { display: inline-flex; gap: 0; border-radius: 6px; overflow: hidden; border: 1px solid var(--slate-200); }
.time-btn {
  background: #fff;
  border: none;
  border-right: 1px solid var(--slate-200);
  padding: 6px 12px;
  font-size: 12px;
  color: var(--slate-600);
  cursor: pointer;
  transition: all 0.15s;
}
.time-btn:last-child { border-right: none; }
.time-btn:hover { background: var(--slate-50); }
.time-btn.active {
  background: var(--teal-500);
  color: #fff;
  font-weight: 500;
}

.search-input {
  padding: 6px 12px;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  font-size: 13px;
  min-width: 0;
  width: 100%;
  max-width: 260px;
  box-sizing: border-box;
}
.search-input:focus {
  outline: none;
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(20,184,166,0.1);
}

.btn-reset {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--slate-600);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-reset:hover { background: var(--slate-50); color: var(--slate-800); }

.manage-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-mini {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 12px 16px;
  text-align: center;
  transition: all 0.15s;
}
.stat-mini-clickable {
  cursor: pointer;
  border-color: var(--slate-300);
}
.stat-mini-clickable:hover {
  background: var(--slate-50);
  border-color: var(--teal-500);
  box-shadow: 0 2px 8px rgba(20,184,166,0.12);
  transform: translateY(-1px);
}
.stat-mini-clickable:active { transform: translateY(0); }
.stat-mini-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--slate-800);
  line-height: 1.2;
}
.stat-mini-label {
  font-size: 11px;
  color: var(--slate-500);
  margin-top: 4px;
}

/* 客户列表：桌面表格 + 手机卡片双布局 */
.customer-table-wrap { display: block; overflow-x: auto; }
.customer-card-list { display: none; }

/* 手机端卡片式客户列表 */
@media (max-width: 768px) {
  .customer-table-wrap { display: none; }
  .customer-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }
  .customer-card {
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: all 0.15s;
  }
  .customer-card:active { background: var(--slate-50); transform: translateY(-1px); }
  .customer-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .customer-card-type { font-size: 16px; flex: none; }
  .customer-card-name { flex: 1 1 auto; min-width: 0; font-size: 15px; color: var(--slate-800); overflow-wrap: anywhere; }
  .customer-card-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 7px; font-size: 12px; color: var(--slate-500); }
  .customer-card-extra { color: var(--slate-600); }
}

.manage-charts {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 20px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.manage-charts .dash-card {
  flex: 1 1 min(100%, 380px);
  min-width: 0;
  overflow: hidden;
}

/* 工作台省份分布图：两图等宽 */
.dash-province-charts .dash-card {
  flex: 1 1 min(100%, 300px) !important;
  min-width: 0 !important;
}

/* ===== HTML/CSS 柱状图 ===== */
.bar-chart-wrap {
  position: relative;
  height: clamp(200px, 35vw, 260px);
  padding: 40px 4px 48px 32px;
  margin-top: 8px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.chart-sort-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.chart-sort-btn {
  padding: 3px 8px;
  font-size: 11px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.15s;
}
.chart-sort-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.chart-sort-btn.active {
  background: #0f766e;
  color: #fff;
  border-color: #0f766e;
}
.bar-grid {
  position: absolute;
  left: 32px;
  right: 0;
  top: 16px;
  bottom: 36px;
  pointer-events: none;
}
.bar-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  border-bottom: 1px dashed #e2e8f0;
}
.bar-grid-line[data-v="0"] { border-bottom-style: solid; border-color: #cbd5e1; }
.bar-grid-val {
  position: absolute;
  left: -28px;
  top: -8px;
  font-size: 10px;
  color: #94a3b8;
}
.bar-cols {
  position: relative;
  height: 100%;
  display: flex;
  align-items: flex-end;
  gap: clamp(2px, 1vw, 8px);
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: visible;
}
.bar-col {
  flex: 1 1 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  cursor: pointer;
  position: relative;
  min-width: 0;
  transition: transform 0.1s;
  overflow: visible;
}
.bar-col:hover { transform: translateY(-2px); }
.bar-track {
  width: 100%;
  max-width: clamp(24px, 5vw, 64px);
  flex: 0 1 auto;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.bar-fill {
  position: relative;
  width: 100%;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: filter 0.15s;
}
.bar-col:hover .bar-fill { filter: brightness(1.1); }
.bar-value {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  margin-bottom: 4px;
  font-size: clamp(9px, 1.5vw, 12px);
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
}
.bar-label {
  position: absolute;
  bottom: -36px;
  left: -4px;
  right: -4px;
  text-align: center;
  font-size: clamp(7px, 1.5vw, 9px);
  color: #475569;
  white-space: normal;
  word-break: break-all;
  line-height: 1.2;
  max-height: 32px;
  overflow: hidden;
}

@media (max-width: 768px) {
  .manage-charts { flex-direction: column; }
  .manage-charts .dash-card:nth-child(1),
  .manage-charts .dash-card:nth-child(2) { flex: 1 1 auto; min-width: 0; }
}

.manage-section-title h3 {
  font-size: 15px;
  margin: 0 0 12px;
  color: var(--slate-800);
}

@media (max-width: 768px) {
  .filter-row { gap: 8px; }
  .search-input { min-width: 0; max-width: 100%; }
}

.kanban-search {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-search input {
  padding: 8px 14px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  font-size: 13px;
  width: 100%;
  max-width: 260px;
  min-width: 0;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}

.kanban-search input:focus {
  border-color: var(--teal-500);
}

.btn-add {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--teal-500);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-add:hover { background: var(--teal-600); }

.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
  min-height: 500px;
}

.kanban-column {
  flex: 1;
  min-width: 280px;
  background: var(--slate-100);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
}

.kanban-column.drag-over {
  background: var(--slate-200);
  outline: 2px dashed var(--teal-500);
  outline-offset: -2px;
}

.column-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.column-header .title-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-header .stage-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}

.column-header .title {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-700);
}

.column-header .count-badge {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--slate-500);
  font-weight: 500;
}

.column-body {
  flex: 1;
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 60px;
}

/* Kanban Card — 桌面：长条形横排 */
.kanban-card {
  background: #fff;
  border-radius: 8px;
  padding: 10px 16px;
  border: 1px solid var(--slate-200);
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.kanban-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.kanban-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-800);
  margin: 0;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.card-meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  font-size: 12px;
  color: var(--slate-500);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
}

.card-meta .tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* 意向资料未填红色提醒 */
.tag-alert {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
  font-weight: 600;
  cursor: pointer;
  animation: pulse-alert 1.6s ease-in-out infinite;
}
.tag-alert:hover {
  background: #fee2e2 !important;
}

@keyframes pulse-alert {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.4); }
  50%      { box-shadow: 0 0 0 4px rgba(220,38,38,0); }
}

.card-footer {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--slate-400);
  border-top: none;
  padding-top: 0;
  margin: 0;
  margin-left: auto;
  flex-shrink: 0;
}

.card-footer .value {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
}

.card-footer .follow-up {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-footer .follow-up.urgent {
  color: #d97706;
  font-weight: 500;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(8px, 2vw);
  overflow-y: auto;
}

.modal-box {
  background: #fff;
  border-radius: 12px;
  width: min(100%, 640px);
  max-width: min(calc(100vw - 16px), 640px);
  max-height: 85vh;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

.modal-box.large {
  max-width: min(calc(100vw - 16px), 780px);
}

/* .modal-content used in compare-view and other places */
.modal-content {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  padding: 24px;
  width: min(100%, 380px);
  max-width: min(calc(100vw - 16px), 380px);
  max-height: 85vh;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

.modal-header {
  padding: clamp(12px, 3vw, 20px) clamp(14px, 3vw, 24px);
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 100%;
  overflow: hidden;
}

.modal-header h2 {
  font-size: clamp(15px, 3vw, 18px);
  word-break: break-word;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 17px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--slate-400);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.modal-close:hover { color: var(--slate-600); }

.modal-body {
  padding: clamp(12px, 3vw, 24px);
  overflow-x: hidden;
  max-width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 16px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.form-field.full { grid-column: 1 / -1; }

.form-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-600);
}

.form-field input,
.form-field select,
.form-field textarea {
  padding: 8px 12px;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
  width: 100%;
  min-width: 0;
  background: #f1f5f9;
  color: #334155;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--teal-500);
}

.form-field textarea { resize: vertical; min-height: 60px; }

/* 经销商搜索框（旧版，保留兼容） */
.distributor-search-input {
  padding: 8px 12px;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
  width: 100%;
  min-width: 0;
  background: #f1f5f9;
  margin-bottom: 4px;
}

.distributor-search-input:focus {
  border-color: var(--teal-500);
}

/* ★ 经销商选择器 */
.dist-selector {
  position: relative;
  width: 100%;
}

.dist-selector-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  color: var(--slate-700);
  transition: border-color 0.15s;
  min-height: 38px;
}

.dist-selector-trigger:hover {
  border-color: var(--teal-400);
}

.dist-selector-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.dist-selector-arrow {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--slate-400);
  margin-left: 8px;
  flex-shrink: 0;
}

/* 经销商选择子弹窗（叠加在主弹窗上） */
.dist-sub-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

/* 经销商选择弹窗 */
.dist-modal-search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  margin-bottom: 8px;
  box-sizing: border-box;
  background: #f8fafc;
}

.dist-modal-search:focus {
  border-color: var(--teal-400);
  background: #fff;
}

/* 感兴趣产品选择器 */
.interested-selector {
  position: relative;
  width: 100%;
}

.interested-selector-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  min-height: 38px;
  transition: border-color 0.2s;
}

.interested-selector-trigger:hover {
  border-color: #14b8a6;
}

.interested-selector-value {
  flex: 1;
  font-size: 14px;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.interested-selector-arrow {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #64748b;
  margin-left: 8px;
  flex-shrink: 0;
}

/* 感兴趣产品选择弹窗选项 */
.interested-modal-option {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 4px;
}

.interested-modal-option:hover {
  background: #f1f5f9;
}

.interested-modal-option input[type="checkbox"] {
  margin-right: 10px;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.interested-modal-option span {
  font-size: 14px;
  color: #0f172a;
}

.interested-modal-selected {
  background: #f0fdfa;
}

.interested-modal-selected span {
  color: #0f766e;
  font-weight: 500;
}

.dist-modal-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--slate-100);
  border-radius: 6px;
}

.dist-modal-option {
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  color: var(--slate-700);
  border-bottom: 1px solid var(--slate-50);
  transition: background 0.1s;
}

.dist-modal-option:last-child {
  border-bottom: none;
}

.dist-modal-option:hover {
  background: #f1f5f9;
}

.dist-modal-option.dist-modal-selected {
  background: #f0fdfa;
  color: var(--teal-700);
  font-weight: 500;
}

/* 产品多选下拉框 */
.form-field select[multiple] {
  padding: 6px 8px;
  min-height: 80px;
  line-height: 1.6;
}
.form-field select[multiple] option {
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.form-field select[multiple] option:checked {
  background: var(--teal-500);
  color: #fff;
}

/* 产品多选复选框组 */
.product-checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  align-items: center;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  min-height: 40px;
}
/* 手机端隐藏下拉产品选择 */
.mobile-product-select {
  display: none;
  width: 100%;
  min-height: 40px;
  height: 40px;
  padding: 8px 36px 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  background: #f1f5f9;
  color: #334155;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.mobile-product-select option {
  padding: 8px 12px;
}
.product-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--slate-700);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--teal-500);
  cursor: pointer;
}

.other-product-input {
  border: 1px solid var(--slate-300);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  color: var(--slate-700);
  outline: none;
  transition: border-color 0.15s;
}
.other-product-input:focus {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.15);
}

/* 关联选择列表 */
.checkbox-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--slate-700);
  transition: background 0.15s;
}

.checkbox-item:hover {
  background: var(--slate-50);
}

.checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--teal-500);
}

.checkbox-item span:nth-child(2) {
  flex: 1;
  font-weight: 500;
}

/* ===== 联想输入 ===== */
.suggest-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  max-height: 240px;
  overflow-y: auto;
  z-index: 50;
  margin-top: 4px;
}

.suggest-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  border-bottom: 1px solid var(--slate-50);
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover { background: var(--slate-50); }
.suggest-name { color: #0f172a; font-weight: 500; }
.suggest-meta { color: #94a3b8; font-size: 12px; }

/* ===== 意向资料区块 ===== */
.intent-info-block {
  grid-column: 1 / -1;
  background: #f8fafc;
  border: 1px dashed var(--slate-300);
  border-radius: 10px;
  padding: 16px;
  margin-top: 8px;
}
.intent-info-block .form-grid { margin: 0; }

/* ===== 阶段确认按钮（跟进后弹窗） ===== */
.btn-stage-pick {
  padding: 14px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  transition: transform 0.1s, box-shadow 0.15s;
}
.btn-stage-pick:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.modal-footer {
  padding: clamp(10px, 3vw, 16px) clamp(14px, 3vw, 24px);
  border-top: 1px solid var(--slate-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 100%;
}

.btn-secondary {
  padding: 8px 20px;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  color: var(--slate-600);
}

.btn-secondary:hover { background: var(--slate-200); }

.btn-primary {
  padding: 8px 20px;
  background: var(--teal-500);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
}

.btn-primary:hover { background: var(--teal-600); }

/* ===== Detail View ===== */
.detail-section {
  margin-bottom: 24px;
}

.detail-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--slate-100);
}

.detail-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-info .info-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.detail-info .info-item .key {
  font-size: 12px;
  color: var(--slate-400);
}

.detail-info .info-item .val {
  font-size: 14px;
  color: var(--slate-700);
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 20px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--slate-200);
}

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

.timeline-item::before {
  content: '';
  position: absolute;
  left: -19px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--teal-500);
  border: 2px solid #fff;
}

.timeline-item .date {
  font-size: 12px;
  color: var(--slate-400);
  margin-bottom: 4px;
}

.timeline-item .content {
  font-size: 14px;
  color: var(--slate-700);
}

/* Review items within timeline */
.timeline-review {
  margin: 8px 0 4px 0;
  padding: 10px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 3px solid #f59e0b;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  color: #92400e;
  position: relative;
}
.timeline-review .review-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.timeline-review .review-author {
  font-weight: 600;
  font-size: 12px;
  color: #b45309;
}
.timeline-review .review-date {
  font-size: 11px;
  color: #d97706;
}
.timeline-review .review-content {
  line-height: 1.5;
  color: #78350f;
}
.timeline-review .review-delete {
  position: absolute;
  top: 4px;
  right: 6px;
  background: none;
  border: none;
  color: #d97706;
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  opacity: 0.5;
}
.timeline-review .review-delete:hover {
  opacity: 1;
}
.timeline-review-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: #d97706;
  background: #fffbeb;
  border: 1px dashed #fde68a;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.timeline-review-btn:hover {
  background: #fef3c7;
  border-color: #fbbf24;
}

/* 管理员删除跟进记录按钮 */
.timeline-record-delete {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  color: #ef4444;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.4;
  padding: 0 4px;
  line-height: 1;
  transition: opacity 0.15s;
}
.timeline-record-delete:hover {
  opacity: 1;
}

/* 评价折叠/展开按钮 */
.timeline-review-toggle {
  display: block;
  margin: 4px 0 2px 0;
  padding: 3px 10px;
  font-size: 12px;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.timeline-review-toggle:hover {
  background: #f1f5f9;
  color: #334155;
}

/* 评价列表容器 */
.timeline-reviews-list {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 评价回复数量角标 */
.review-reply-badge {
  background: #3b82f6;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  padding: 0 5px;
  flex-shrink: 0;
}
.review-reply-badge.summary {
  background: #3b82f6;
}

/* Reply styles - 嵌套在评价下方 */
.review-reply {
  margin: 4px 0 0 20px;
  padding: 6px 10px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-left: 3px solid #38bdf8;
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  color: #0c4a6e;
  position: relative;
}
/* 嵌套层级缩进 */
.review-reply.reply-depth-1 {
  margin-left: 36px;
  background: #f0fdf4;
  border-color: #bbf7d0;
  border-left-color: #4ade80;
}
.review-reply.reply-depth-2 {
  margin-left: 52px;
  background: #fefce8;
  border-color: #fef08a;
  border-left-color: #facc15;
}
.review-reply.reply-depth-3 {
  margin-left: 68px;
  background: #fdf2f8;
  border-color: #fbcfe8;
  border-left-color: #f472b6;
}
/* 回复前的连接线 */
.review-reply::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 12px;
  width: 10px;
  height: 1px;
  background: #bae6fd;
}
.review-reply:first-child::before {
  top: 12px;
}
.review-reply .reply-author {
  font-weight: 600;
  color: #0369a1;
  margin-right: 6px;
}
.review-reply .reply-date {
  font-size: 11px;
  color: #7dd3fc;
}
.review-reply .reply-content {
  margin-top: 2px;
  line-height: 1.5;
  color: #164e63;
}
.review-reply .reply-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.review-reply .reply-target {
  font-size: 11px;
  color: #3b82f6;
  font-weight: 500;
}
.review-reply .reply-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.review-reply .reply-action-btn {
  background: none;
  border: none;
  color: #0369a1;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}
.review-reply .reply-action-btn:hover {
  text-decoration: underline;
}
.review-reply .reply-delete {
  position: absolute;
  top: 2px;
  right: 4px;
  background: none;
  border: none;
  color: #7dd3fc;
  cursor: pointer;
  font-size: 13px;
  padding: 0 2px;
  opacity: 0.5;
}
.review-reply .reply-delete:hover {
  opacity: 1;
  color: #ef4444;
}

/* 未查看的回复高亮 */
.review-reply.reply-unviewed {
  background: #eff6ff;
  border-color: #93c5fd;
  border-left: 3px solid #3b82f6;
}
/* 未查看的评价高亮 */
.timeline-review.review-unviewed {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-left: 3px solid #3b82f6;
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
  margin: 8px 0 4px 0;
}
/* 未读标签 */
.unviewed-badge {
  display: inline-block;
  background: #3b82f6;
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 500;
  margin-left: 4px;
  vertical-align: middle;
}
/* 已读/未读状态标签 */
.status-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 500;
  margin-left: 4px;
  vertical-align: middle;
}
.status-read {
  background: #e2e8f0;
  color: #64748b;
}
.status-unread {
  background: #fef3c7;
  color: #92400e;
}
.review-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.reply-btn {
  background: #f0f9ff !important;
  border-color: #bae6fd !important;
  color: #0369a1 !important;
}
.reply-btn:hover {
  background: #e0f2fe !important;
  border-color: #7dd3fc !important;
}

/* Review page styles */
.review-summary-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  transition: box-shadow 0.15s;
}
.review-summary-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.review-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.review-summary-item {
  font-weight: 600;
  font-size: 14px;
  color: #1e293b;
  cursor: pointer;
}
.review-summary-item:hover {
  color: var(--teal-600);
}
.review-summary-meta {
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 8px;
}
.review-summary-content {
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
  padding: 8px 12px;
  background: #fffbeb;
  border-radius: 8px;
  border-left: 3px solid #f59e0b;
  margin-top: 6px;
}
.review-summary-record {
  font-size: 13px;
  color: #64748b;
  margin-top: 6px;
  padding: 6px 10px;
  background: #f8fafc;
  border-radius: 6px;
}
.review-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}

/* Stage badge */
.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid;
  flex-shrink: 0;
}

/* 列表视图（所有阶段混排） */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 20px;
}

.list-card {
  width: 100%;
}

.filter-count {
  font-size: 12px;
  color: var(--slate-500);
  white-space: nowrap;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -260px;
    transition: left 0.3s;
    z-index: 50;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 45;
  }
  .sidebar-overlay.show { display: block; }
  .funnel-section { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-info { grid-template-columns: 1fr; }
  .kanban-search input { width: 120px; }
  .kanban-toolbar-left { flex-wrap: wrap; gap: 6px; }
  .filter-count { display: none; }

  /* 手机：卡片改为竖条小方块 */
  .kanban-card {
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px 12px;
  }
  .card-title {
    max-width: 100%;
    font-size: 14px;
    margin: 0;
  }
  .card-meta {
    font-size: 11px;
  }
  .card-footer {
    margin-left: auto;
    border-top: none;
    padding-top: 0;
  }
  .card-footer .value {
    font-size: 13px;
  }
}

/* Mobile menu toggle */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--slate-600);
  padding: 8px 12px;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; }
}

/* Scrollbar */
.kanban-board::-webkit-scrollbar { height: 6px; }
.kanban-board::-webkit-scrollbar-track { background: transparent; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--slate-200); border-radius: 3px; }

/* ============================================================
   新增样式：省份筛选 / Topbar 用户角色 / 月度报表
   ============================================================ */

/* ===== Kanban Toolbar 内嵌省份筛选 ===== */
.kanban-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  height: 36px;
}

.filter-box .filter-icon {
  font-size: 14px;
}

.province-select {
  border: none;
  background: transparent;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  padding: 2px 4px;
  font-family: inherit;
  color: var(--slate-700);
  min-width: 0;
  max-width: 100%;
}

.province-select:focus {
  color: var(--teal-700);
}

/* ===== Topbar 用户角色标签 ===== */
.user-role {
  display: inline-block;
  background: rgba(20, 184, 166, 0.1);
  color: var(--teal-700);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  margin: 0 4px;
  font-weight: 500;
}

/* ===== 月度报表 ===== */
.monthly-report {
  /* 容器：复用 content-area 的 padding */
}

.report-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.month-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--slate-700);
}

.month-picker .picker-icon {
  font-size: 18px;
}

.month-picker label {
  font-weight: 500;
  color: var(--slate-600);
}

.month-picker input[type="month"] {
  padding: 6px 10px;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  color: var(--slate-700);
}

.month-picker input[type="month"]:focus {
  border-color: var(--teal-500);
}

.month-picker .month-display {
  font-size: 16px;
  font-weight: 600;
  color: var(--slate-900);
  margin-left: 6px;
}

.report-tip {
  font-size: 12px;
  color: var(--slate-500);
  max-width: 480px;
  text-align: right;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-left: 4px solid var(--slate-400);
  border-radius: 10px;
  padding: 18px 20px;
  transition: box-shadow 0.2s;
}

.summary-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.summary-card.teal   { border-left-color: var(--teal-500); }
.summary-card.purple { border-left-color: var(--purple-500); }
.summary-card.amber  { border-left-color: #f59e0b; }
.summary-card.green  { border-left-color: #22c55e; }

.summary-card .label {
  font-size: 13px;
  color: var(--slate-500);
  margin-bottom: 6px;
}

.summary-card .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1.2;
}

.summary-card .change {
  font-size: 12px;
  color: var(--slate-500);
  margin-top: 6px;
}

.summary-card .change.up { color: #16a34a; }

.report-section {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.report-section h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--slate-900);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--slate-100);
}

.report-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  word-break: break-word;
}

.report-table th,
.report-table td {
  text-align: left;
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}

.report-table th {
  background: var(--slate-50);
  color: var(--slate-600);
  font-weight: 500;
  font-size: 12px;
}

.report-table tbody tr:last-child td {
  border-bottom: none;
}

.report-table tbody tr:hover {
  background: var(--slate-50);
}

.report-table .stage-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.client-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  margin: 2px 4px 2px 0;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}

.client-chip:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.empty-tip {
  text-align: center;
  color: var(--slate-400);
  font-size: 13px;
  padding: 20px;
}

.new-tag {
  display: inline-block;
  padding: 1px 8px;
  background: #dcfce7;
  color: #166534;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

/* ===== 跟进记录添加表单 ===== */
.followup-form {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 16px;
}

.followup-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.followup-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.followup-field label {
  font-size: 12px;
  color: var(--slate-600);
  font-weight: 500;
}

.followup-field input,
.followup-field textarea {
  padding: 7px 10px;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  background: #fff;
  color: var(--slate-700);
  transition: border-color 0.15s;
}

.followup-field input:focus,
.followup-field textarea:focus {
  border-color: var(--teal-500);
}

.followup-field textarea {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}

.followup-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* ===== 关联信息展示 ===== */
.relation-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.relation-box:hover {
  background: #f8fafc;
  border-color: var(--teal-500);
  transform: translateX(2px);
}

.relation-box:last-child {
  margin-bottom: 0;
}

.relation-box .relation-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.relation-info {
  flex: 1;
  min-width: 0;
}

.relation-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-800);
  margin-bottom: 2px;
}

.relation-meta {
  font-size: 12px;
  color: var(--slate-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relation-arrow {
  color: var(--slate-400);
  font-size: 16px;
  flex-shrink: 0;
}

.relation-stage {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}

.relation-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ===== 响应式补充 ===== */
@media (max-width: 768px) {
  .followup-row { grid-template-columns: 1fr; }
  .report-tip { text-align: left; }
  .month-picker { flex-wrap: wrap; }
}

/* ============================================================
   V2 新增样式 — 用户切换器 / 仪表盘图表 / 矩阵热力图
   ============================================================ */

/* ===== Topbar 用户切换下拉 ===== */
.user-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 8px 4px 4px;
  border-radius: 18px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}

.user-trigger:hover {
  background: var(--slate-50);
  border-color: var(--slate-200);
}

.user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  line-height: 1.3;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-800);
}

.user-role-tag {
  font-size: 11px;
  color: var(--teal-700);
  background: rgba(20, 184, 166, 0.1);
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 500;
  display: inline-block;
  width: fit-content;
}

.user-prov {
  font-size: 11px;
  color: var(--slate-400);
}

.user-trigger .user-avatar {
  width: 34px;
  height: 34px;
  background: var(--teal-500);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.user-trigger .caret {
  font-size: 11px;
  color: var(--slate-400);
  margin-left: -4px;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 280px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
  z-index: 100;
  overflow: hidden;
  display: none;
  max-height: 460px;
  overflow-y: auto;
}

.user-dropdown.open {
  display: block;
}

.user-dropdown .dd-header {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--slate-400);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-100);
}

.user-dropdown .dd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid var(--slate-50);
}

.user-dropdown .dd-item:last-child {
  border-bottom: none;
}

.user-dropdown .dd-item:hover {
  background: var(--slate-50);
}

.user-dropdown .dd-item.current {
  background: rgba(20, 184, 166, 0.05);
}

.user-dropdown .dd-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--slate-200);
  color: var(--slate-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.user-dropdown .dd-item.current .dd-avatar {
  background: var(--teal-500);
  color: #fff;
}

.user-dropdown .dd-info {
  flex: 1;
  min-width: 0;
}

.user-dropdown .dd-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-800);
}

.user-dropdown .dd-role {
  font-size: 11px;
  color: var(--slate-500);
  margin-top: 1px;
}

.user-dropdown .dd-check {
  color: var(--teal-600);
  font-size: 14px;
  font-weight: 700;
}

@media (max-width: 768px) {
  .user-meta { display: none; }
  .user-trigger { padding: 4px; }
}

/* ===== Dashboard 图表卡片 ===== */
.dash-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 960px) {
  .dash-row { grid-template-columns: 1fr; }
}

.dash-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: clamp(12px, 3vw, 22px) clamp(12px, 3vw, 24px);
  margin-bottom: 20px;
  width: 100%;
  max-width: 100%;
  overflow: visible;
  min-width: 0;
}

.dash-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--slate-900);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--slate-100);
}

.chart-wrap {
  width: 100%;
  overflow: visible;
  max-width: 100%;
}

.chart-vbar {
  overflow-x: auto;
}

/* ===== 矩阵热力图 ===== */
.matrix-wrap {
  overflow-x: auto;
  border: 1px solid var(--slate-100);
  border-radius: 8px;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 720px;
}

.matrix-table th,
.matrix-table td {
  text-align: center;
  padding: 10px 8px;
  border: 1px solid var(--slate-100);
  vertical-align: middle;
  height: 38px;
}

.matrix-table th {
  background: var(--slate-50);
  color: var(--slate-600);
  font-weight: 600;
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.matrix-table .sticky-col {
  position: sticky;
  left: 0;
  background: #fff;
  text-align: left;
  z-index: 3;
  box-shadow: 2px 0 0 var(--slate-100);
  padding-left: 14px;
}

.matrix-table th.sticky-col {
  background: var(--slate-50);
  z-index: 4;
}

.matrix-table tbody tr:hover td {
  opacity: 0.92;
}

/* 矩阵单元格颜色由 inline style 提供（rgba teal） */
.matrix-table td { transition: transform 0.12s; }
.matrix-table tbody tr:hover td.sticky-col { background: var(--slate-50); }

/* ===== 可视化编辑模式 ===== */
.edit-mode-toggle {
  position: fixed; bottom: 24px; right: 24px; z-index: 1000;
  background: #3b82f6; color: #fff; border: none; border-radius: 24px;
  padding: 10px 20px; font-size: 13px; font-weight: 600;
  cursor: pointer; box-shadow: 0 2px 8px rgba(59,130,246,0.4);
  transition: background 0.2s;
}
.edit-mode-toggle:hover { background: #2563eb; }
.edit-mode-toggle.active { background: #f59e0b; }
.edit-mode-toggle.active:hover { background: #d97706; }

.edit-outline {
  outline: 2px dashed #3b82f6 !important;
  outline-offset: 2px;
  cursor: grab;
  position: relative;
  transition: outline-color 0.15s;
}
.edit-outline:hover { outline-color: #f59e0b !important; }
.edit-outline.dragging { opacity: 0.4; outline-style: solid; }
.edit-outline.drag-over { outline: 3px solid #10b981 !important; outline-offset: 2px; }

.edit-panel {
  position: fixed; right: 0; top: 0; bottom: 0; width: 300px;
  background: #fff; border-left: 1px solid #e2e8f0;
  box-shadow: -4px 0 12px rgba(0,0,0,0.08);
  z-index: 1001; overflow-y: auto; padding: 20px;
  transform: translateX(100%); transition: transform 0.25s ease;
}
.edit-panel.open { transform: translateX(0); }
.edit-panel h3 {
  font-size: 15px; font-weight: 600; color: #0f172a;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
  display: flex; justify-content: space-between; align-items: center;
}
.edit-panel .close-btn {
  background: none; border: none; font-size: 18px;
  cursor: pointer; color: #64748b; padding: 4px;
}
.edit-panel .close-btn:hover { color: #0f172a; }
/* 编辑面板分组 */
.edit-group {
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 8px; padding: 12px; margin-bottom: 14px;
}
.edit-group-title {
  font-size: 12px; font-weight: 600; color: #475569;
  margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px;
}
.edit-field { margin-bottom: 10px; }
.edit-field:last-child { margin-bottom: 0; }
.edit-field label {
  display: block; font-size: 12px; color: #64748b; margin-bottom: 4px;
}
.edit-field input[type="color"] {
  width: 100%; height: 32px; border: 1px solid #e2e8f0;
  border-radius: 6px; cursor: pointer; padding: 2px;
}
.edit-field input[type="number"],
.edit-field input[type="text"],
.edit-field select {
  width: 100%; height: 32px; border: 1px solid #e2e8f0;
  border-radius: 6px; padding: 0 8px; font-size: 13px;
}
/* 行内编辑字段（阶段颜色） */
.edit-field-inline {
  display: flex; align-items: center; gap: 8px;
}
.edit-field-inline label {
  flex: 1; margin-bottom: 0; font-size: 12px; color: #334155;
}
.edit-field-inline input[type="color"] {
  width: 40px; height: 28px; flex-shrink: 0; padding: 2px;
}
.edit-reset-btn {
  width: 24px; height: 24px; flex-shrink: 0;
  border: 1px solid #e2e8f0; background: #fff;
  border-radius: 4px; cursor: pointer; font-size: 12px;
  color: #64748b; padding: 0; line-height: 1;
}
.edit-reset-btn:hover { background: #f1f5f9; color: #0f172a; }
.edit-panel .btn-reset {
  width: 100%; margin-top: 12px; padding: 10px;
  background: #f1f5f9; border: 1px solid #e2e8f0;
  border-radius: 8px; font-size: 13px; cursor: pointer;
}
.edit-panel .btn-reset:hover { background: #e2e8f0; }

/* ===== Flat filter buttons ===== */
.flat-filter-group {
  display: inline-flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--slate-200);
  flex-wrap: wrap;
}
.flat-btn {
  background: #fff;
  border: none;
  border-right: 1px solid var(--slate-200);
  border-bottom: none;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--slate-600);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.flat-btn:hover { background: var(--slate-50); }
.flat-btn.active {
  background: var(--teal-500);
  color: #fff;
  font-weight: 500;
}

/* ===== Batch select / delete ===== */
.batch-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--slate-700);
}
.batch-bar .batch-count { font-weight: 600; color: var(--teal-600); }
.batch-bar button {
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid var(--slate-200);
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.batch-bar button:hover { background: var(--slate-50); }
.batch-bar .btn-batch-delete {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}
.batch-bar .btn-batch-delete:hover { background: #fecaca; }
.kanban-card { position: relative; }
.card-checkbox {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 16px;
  height: 16px;
  accent-color: var(--teal-500);
  cursor: pointer;
  z-index: 2;
}

.card-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: #fee2e2;
  color: #dc2626;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: all 0.15s;
  opacity: 0.6;
}
.card-delete-btn:hover { background: #fecaca; transform: scale(1.15); opacity: 1; }

/* ===== 卡片上写跟进按钮 ===== */
.card-follow-up-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--teal-600);
  background: var(--teal-50);
  border: 1px solid var(--teal-200);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.card-follow-up-btn:hover {
  background: var(--teal-100);
  border-color: var(--teal-300);
  transform: translateY(-1px);
}

/* ===== 详情页铅笔编辑图标 ===== */
.btn-edit-pencil {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--teal-50);
  color: var(--teal-600);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-edit-pencil:hover {
  background: var(--teal-100);
  transform: scale(1.1);
}
.btn-edit-pencil:active {
  transform: scale(0.95);
}

/* ===== Import button ===== */
.import-section {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.import-section input[type="file"] { display: none; }
.import-section label {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--slate-200);
  background: #fff;
  font-size: 12px;
  color: var(--slate-600);
  cursor: pointer;
  transition: all 0.15s;
}
.import-section label:hover { background: var(--slate-50); color: var(--teal-600); border-color: var(--teal-500); }

.btn-export {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--slate-200);
  background: #fff;
  font-size: 12px;
  color: var(--slate-600);
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-export:hover { background: var(--slate-50); color: var(--teal-600); border-color: var(--teal-500); }

/* ============================================================
   V5.5 对比页 — 分组柱形图样式
   ============================================================ */
.compare-page { padding: 4px 0 24px; }
.compare-section {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 20px 24px 28px;
  margin-top: 16px;
  position: relative;  /* 编辑模式铅笔标志需要 */
}
.compare-section h3 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--slate-800);
}
.compare-section h3 .count {
  margin-left: 8px;
  font-size: 12px;
  color: var(--slate-400);
  font-weight: 400;
}
.cmp-filters {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
.cmp-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 6px 0;
}
.cmp-filter-row + .cmp-filter-row { border-top: 1px dashed var(--slate-200); }
.cmp-filter-row > strong {
  font-size: 13px;
  color: var(--slate-700);
  margin-right: 4px;
  min-width: 70px;
}
.cmp-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 14px;
  border: 1px solid var(--slate-200);
  background: #fff;
  font-size: 12px;
  color: var(--slate-600);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}
.cmp-chip:hover { border-color: var(--teal-500); color: var(--teal-600); }
.cmp-chip.on {
  background: var(--teal-50);
  border-color: var(--teal-500);
  color: var(--teal-700);
  font-weight: 600;
}

/* 图例 */
.cmp-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 8px 0 16px;
  font-size: 12px;
  color: var(--slate-600);
}
.cmp-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cmp-legend-color {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

/* 分组柱形图 */
.gbar-chart {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 8px;
  padding: 30px 8px 44px 44px;
  border-left: 1px solid var(--slate-200);
  border-bottom: 1px solid var(--slate-200);
  background: linear-gradient(to bottom, #fff 0%, #fafbfc 100%);
  overflow-x: auto;
  overflow-y: hidden;
}
.gbar-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed var(--slate-200);
  pointer-events: none;
}
.gbar-grid-val {
  position: absolute;
  left: -36px;
  top: -7px;
  font-size: 11px;
  color: var(--slate-400);
}
.gbar-group {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  flex: 1 1 0;
  min-width: 40px;
  height: 100%;
  justify-content: center;
  position: relative;
}
.gbar {
  flex: 1 1 0;
  min-width: 10px;
  max-width: 24px;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
  position: relative;
}
.gbar:hover {
  filter: brightness(1.12);
  transform: translateY(-2px);
}
.gbar-val {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--slate-600);
  white-space: nowrap;
}
.gbar-label {
  position: absolute;
  bottom: -26px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--slate-700);
  white-space: nowrap;
  font-weight: 500;
}
.gbar-empty-tip {
  text-align: center;
  padding: 40px 0;
  color: var(--slate-400);
  font-size: 14px;
}

/* V5.5b：阶段筛选 chip（兼图例）+ 阶段行 */
.cmp-stage-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 10px 0 14px;
  border-bottom: 1px dashed var(--slate-200);
  margin-bottom: 16px;
}
.cmp-stage-row .cmp-chip-color {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
  transition: opacity 0.15s;
}
.cmp-chip:not(.on) .cmp-chip-color { opacity: 0.35; }
.cmp-chip:not(.on) { opacity: 0.6; }
.cmp-chip-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: 4px;
}

/* V5.5e：AI 设置页 — 预设按钮按平台分组 */
.preset-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--slate-200);
}
.preset-group:last-child { border-bottom: none; }
.preset-provider {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
  min-width: 70px;
  flex-shrink: 0;
}
.preset-btn {
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--slate-200);
  background: #fff;
  font-size: 12px;
  color: var(--slate-600);
  cursor: pointer;
  transition: all 0.15s;
}
.preset-btn:hover {
  background: var(--teal-50);
  border-color: var(--teal-500);
  color: var(--teal-700);
  font-weight: 500;
}

/* ============================================================
   V6 移动端自适应修复 — 覆盖所有溢出源
   ============================================================ */

@media (max-width: 768px) {
  /* ===== 移动端基础字体增大 ===== */
  body {
    font-size: 16px;
    line-height: 1.5;
  }

  /* ===== 全局防溢出 ===== */
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
  }

  .app-layout {
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
  }

  .main-content {
    min-width: 0;
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
  }

  .content-area {
    padding: 12px 12px;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* ===== Topbar ===== */
  .topbar {
    padding: 16px 12px;
    flex-wrap: nowrap;
    gap: 8px;
    min-height: 64px;
  }

  .topbar h1 {
    font-size: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar .user-info span {
    display: none;
  }

  .topbar .user-info {
    gap: 0;
  }

  /* ===== 柱形图自适应 ===== */
  .chart-wrap {
    overflow: visible;
    max-width: 100%;
  }

  .bar-chart-wrap {
    padding: 30px 2px 40px 20px;
    height: 200px;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
  }

  .bar-cols {
    gap: 2px;
  }

  .bar-col {
    min-width: 0;
  }

  .bar-track {
    max-width: 32px;
  }

  .bar-label {
    font-size: 11px;
    bottom: -28px;
    white-space: normal;
    word-break: break-all;
    line-height: 1.1;
    transform: none;
    text-align: center;
    max-height: 26px;
    overflow: hidden;
    left: 0;
    right: 0;
  }

  .bar-value {
    font-size: 12px;
  }

  .bar-grid-val {
    font-size: 8px;
    left: -18px;
  }

  /* 图表卡片容器 */
  .manage-charts {
    flex-direction: column !important;
    gap: 10px;
    display: flex !important;
  }

  .manage-charts .dash-card,
  .manage-charts > div {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: 100% !important;
    overflow: hidden;
    box-sizing: border-box;
  }

  /* 覆盖 inline style 的 grid 布局 */
  .manage-charts[style*="grid"] {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .dash-card {
    padding: 12px;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 10px;
  }

  .dash-card h3 {
    font-size: 16px;
    margin-bottom: 10px;
    word-break: break-word;
    line-height: 1.4;
  }

  /* ===== 弹窗/表单自适应 ===== */
  .modal-overlay {
    padding: 8px;
    align-items: flex-start;
    padding-top: 12px;
  }

  .modal-box {
    max-width: calc(95vw - 16px) !important;
    width: calc(95vw - 16px) !important;
    max-height: 84vh;
    border-radius: 10px;
    overflow-x: hidden !important;
    overflow-y: auto;
  }

  .modal-box[style*="max-width"] {
    max-width: calc(95vw - 16px) !important;
    width: calc(95vw - 16px) !important;
  }

  .modal-box.large {
    max-width: calc(95vw - 16px) !important;
    width: calc(95vw - 16px) !important;
  }

  .modal-header {
    padding: 12px 14px;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
    border-bottom: 1px solid var(--slate-200);
  }

  .modal-header h2 {
    font-size: 17px;
    word-break: break-word;
  }

  .modal-body {
    padding: 12px 14px;
    overflow-x: hidden;
  }

  .modal-footer {
    padding: 10px 14px;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .form-field {
    min-width: 0;
  }

  .form-field input,
  .form-field select,
  .form-field textarea {
    width: 100% !important;
    max-width: 100% !important;
    font-size: 16px;
    box-sizing: border-box !important;
    min-width: 0 !important;
  }

  .form-field label {
    font-size: 15px;
  }

  /* 覆盖 inline style 中的 min-width */
  .form-field[style*="min-width"] {
    min-width: 0 !important;
  }

  input[style*="min-width"],
  textarea[style*="min-width"] {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* 产品复选框组 - 手机端隐藏，改用下拉 */
  .product-checkbox-group {
    display: none !important;
  }
  .mobile-product-select {
    display: block !important;
  }

  .product-checkbox {
    font-size: 15px;
  }

  /* 意向资料块 */
  .intent-info-block {
    padding: 10px;
    overflow: hidden;
  }

  .intent-info-block .form-grid {
    grid-template-columns: 1fr !important;
  }

  /* ===== 筛选器自适应 ===== */
  .manage-filters {
    padding: 10px;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    margin-bottom: 10px;
  }

  .filter-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px;
  }

  .filter-row > div {
    margin-left: 0 !important;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .filter-group {
    flex-wrap: wrap;
    width: 100%;
    min-width: 0;
  }

  .filter-group[style*="margin-left"] {
    margin-left: 0 !important;
  }

  .flat-filter-group {
    flex-wrap: wrap;
    gap: 4px;
  }

  .flat-btn {
    font-size: 13px;
    padding: 4px 8px;
  }

  .search-input {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    font-size: 16px;
    padding: 10px 14px;
  }

  .kanban-search input {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    font-size: 16px;
    padding: 10px 14px;
  }

  /* 时间按钮组移动端换行 */
  .time-btn-group {
    flex-wrap: wrap;
  }

  .time-btn {
    padding: 6px 10px;
    font-size: 13px;
  }

  /* 导入/新增按钮区域 */
  .import-section {
    max-width: 100%;
  }

  .import-section label {
    font-size: 13px;
    padding: 6px 12px;
  }

  .btn-export {
    font-size: 13px;
    padding: 6px 12px;
  }

  .btn-add {
    white-space: nowrap;
    font-size: 14px;
    padding: 8px 14px;
  }

  .btn-reset {
    font-size: 13px;
    padding: 6px 12px;
  }

  .btn-primary,
  .btn-secondary {
    font-size: 15px;
    padding: 10px 20px;
  }

  .filter-label {
    font-size: 14px;
  }

  .column-header .title {
    font-size: 15px;
  }

  .column-header .count-badge {
    font-size: 13px;
  }

  /* 侧边栏导航 */
  .nav-item {
    font-size: 16px;
    padding: 14px 20px;
  }

  .sidebar-header .logo {
    font-size: 18px;
  }

  .activity-item .content .title {
    font-size: 15px;
  }

  .activity-item .content .date {
    font-size: 13px;
  }

  .detail-section h4 {
    font-size: 16px;
  }

  .suggest-item {
    font-size: 15px;
    padding: 10px 14px;
  }

  .suggest-meta {
    font-size: 13px;
  }

  .checkbox-item {
    font-size: 15px;
    padding: 10px 12px;
  }

  .dist-modal-option {
    font-size: 15px;
    padding: 12px 16px;
  }

  .btn-stage-pick {
    font-size: 15px;
  }

  .user-dropdown .dd-name {
    font-size: 14px;
  }

  .user-dropdown .dd-role {
    font-size: 12px;
  }

  .user-dropdown .dd-item {
    padding: 10px 16px;
  }

  /* 评价视图 */
  .review-summary-card {
    font-size: 15px;
  }

  .review-summary-meta span {
    font-size: 13px !important;
  }

  .review-filter-bar select {
    font-size: 15px !important;
    padding: 8px 12px !important;
  }

  .review-filter-bar > span {
    font-size: 14px !important;
  }

  /* 回复相关 */
  .review-reply .reply-author {
    font-size: 14px;
  }

  .review-reply .reply-date {
    font-size: 12px;
  }

  .review-reply .reply-content {
    font-size: 14px;
  }

  /* 用户管理视图 */
  .user-card {
    font-size: 15px;
  }

  .user-card .stage-badge {
    font-size: 13px !important;
  }

  .filter-order-item {
    font-size: 15px !important;
    padding: 8px 12px !important;
  }

  /* 仪表盘视图 */
  .stat-card .change {
    font-size: 13px;
  }

  .report-table td div {
    font-size: 13px !important;
  }

  .report-table td strong {
    font-size: 15px;
  }

  .chart-sort-btn {
    font-size: 12px;
  }

  /* 详情弹窗 */
  .relation-box {
    font-size: 15px;
  }

  .relation-name {
    font-size: 15px;
  }

  .relation-box div {
    font-size: 13px !important;
  }

  .stage-history-row input,
  .stage-history-row select {
    font-size: 15px !important;
    padding: 8px 10px !important;
  }

  .detail-section p {
    font-size: 15px !important;
  }

  /* 表单视图 */
  .other-product-input {
    font-size: 15px !important;
    padding: 8px 10px !important;
  }

  .dist-modal-search {
    font-size: 15px !important;
    padding: 10px 14px !important;
  }

  .interested-selector-value {
    font-size: 15px !important;
  }

  .intent-info-block h4 {
    font-size: 15px !important;
  }

  .intent-info-block p {
    font-size: 13px !important;
  }

  /* 管理视图 */
  .batch-bar span {
    font-size: 14px !important;
  }

  .batch-bar label span {
    font-size: 14px !important;
  }

  /* 对比视图 */
  .cmp-chip {
    font-size: 14px;
  }

  .gbar-label {
    font-size: 12px;
  }

  .gbar-val {
    font-size: 12px;
  }

  /* AI助手 */
  #ai-prompt-input {
    font-size: 15px !important;
    padding: 8px 14px !important;
  }

  .ai-analysis-result {
    font-size: 15px !important;
  }

  /* ===== 统计卡片自适应 ===== */
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }

  .stat-card {
    padding: 12px;
    min-width: 0;
  }

  .stat-card .value {
    font-size: 24px;
  }

  .stat-card .label {
    font-size: 13px;
  }

  .stat-card .icon-box {
    width: 36px;
    height: 36px;
    font-size: 18px;
    margin-bottom: 8px;
  }

  /* 管理视图统计卡 */
  .manage-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 10px;
  }

  .stat-mini {
    padding: 8px 6px;
    min-width: 0;
  }

  .stat-mini-num {
    font-size: 20px;
  }

  .stat-mini-label {
    font-size: 12px;
  }

  /* ===== 表格自适应 ===== */
  .report-table {
    font-size: 14px;
    width: 100%;
    table-layout: auto;
  }

  .report-table th,
  .report-table td {
    padding: 5px 3px;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100px;
  }

  /* 表格内的固定宽度覆盖 */
  .report-table th[style*="width"],
  .report-table td[style*="width"] {
    max-width: 80px !important;
  }

  /* 含表格的卡片允许内部滚动 */
  .dash-card:has(.report-table),
  .modal-body:has(.report-table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ===== 卡片列表自适应 ===== */
  .card-list {
    width: 100%;
  }

  .kanban-card {
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    padding: 8px 10px;
    gap: 6px;
  }

  .card-title {
    max-width: 100%;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .card-meta {
    font-size: 13px;
    flex-wrap: wrap;
  }

  .card-meta .tag {
    font-size: 12px;
    padding: 2px 6px;
  }

  .card-footer {
    font-size: 13px;
  }

  .stage-badge {
    font-size: 12px;
    padding: 2px 6px;
    white-space: nowrap;
  }

  /* ===== 管理视图操作栏 ===== */
  .manage-section-title {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 6px;
  }

  .manage-section-title h3 {
    font-size: 16px;
  }

  .batch-bar {
    flex-wrap: wrap;
    gap: 6px;
    font-size: 14px;
  }

  /* ===== Kanban board ===== */
  .kanban-board {
    gap: 10px;
  }

  .kanban-column {
    min-width: 240px;
  }

  /* ===== 详情弹窗 ===== */
  .detail-info {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }

  .detail-info .info-item .val {
    font-size: 15px;
    word-break: break-word;
  }

  .detail-info .info-item .key {
    font-size: 13px;
  }

  .timeline-item .content {
    font-size: 15px;
  }

  .timeline-item .date {
    font-size: 13px;
  }

  .timeline-review {
    font-size: 14px;
  }

  .timeline-review .review-author {
    font-size: 13px;
  }

  .timeline-review .review-date {
    font-size: 12px;
  }

  /* ===== 漏斗图 ===== */
  .funnel-section {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .funnel-bar .stage-name {
    width: 60px;
    font-size: 13px;
  }

  .funnel-bar .count {
    font-size: 14px;
  }

  .funnel-bar .bar-fill {
    font-size: 13px;
  }

  /* ===== 矩阵热力图 ===== */
  .matrix-table {
    min-width: 600px;
    font-size: 13px;
  }

  .matrix-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ===== 日期输入框覆盖 inline width ===== */
  input[type="date"][style*="width:140px"],
  input[type="date"][style*="width: 140px"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  /* ===== 用户切换器 ===== */
  .user-meta {
    display: none;
  }

  .user-trigger {
    padding: 4px;
  }

  /* ===== 对比视图 ===== */
  .modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    box-sizing: border-box;
  }

  .modal-content[style*="max-width"] {
    max-width: calc(100vw - 16px) !important;
  }

  /* ===== 修改密码卡片 ===== */
  .dash-card[style*="max-width:480px"] {
    max-width: 100% !important;
  }

  /* ===== 通知提示 ===== */
  div[style*="position:fixed"][style*="bottom:20px"] {
    max-width: calc(100vw - 32px) !important;
    left: 16px !important;
    right: 16px !important;
  }
}
