/* 中科SCRM · 市场活动样式 · 2026-07-06 */

#campaignsView { padding: 16px 20px; background: #f7f8fa; min-height: 100%; }

.cp-head { background: #fff; border: 1px solid #eef0f4; border-radius: 8px; padding: 14px 18px; margin-bottom: 12px; }
.cp-title-line { display: flex; align-items: center; justify-content: space-between; }
.cp-title { margin: 0; font-size: 16px; color: #1f2937; }
.cp-actions { display: flex; gap: 8px; }

.cp-filter { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.cp-filter label { color: #4b5563; font-size: 13px; }
.cp-input {
  height: 32px; padding: 4px 10px; border: 1px solid #d0d7de; border-radius: 6px;
  background: #fff; font-size: 13px; color: #1f2937; outline: none;
  min-width: 180px;
}
.cp-input:focus { border-color: #2f6feb; box-shadow: 0 0 0 2px rgba(47,111,235,0.14); }
.cp-textarea { min-width: unset; min-height: 60px; padding: 8px 10px; line-height: 1.5; resize: vertical; }
.cp-filter .cp-input { min-width: 220px; }

.cp-table-wrap { background: #fff; border: 1px solid #eef0f4; border-radius: 8px; overflow: auto; max-height: calc(100vh - 260px); }
.cp-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.cp-table thead th {
  background: #f5f7fa; color: #374151; font-weight: 500;
  padding: 10px 12px; text-align: left; white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
  border-bottom: 1px solid #eef0f4;
}
.cp-table tbody td { padding: 10px 12px; border-bottom: 1px solid #f2f4f7; color: #1f2937; }
.cp-table tbody tr:hover { background: #fafbfc; }
.cp-link { color: #2f6feb; cursor: pointer; }
.cp-link:hover { text-decoration: underline; }
.cp-truncate { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-money { text-align: right; font-variant-numeric: tabular-nums; color: #374151; }

.cp-status { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; }
.cp-status-draft { background: #e5e7eb; color: #4b5563; }
.cp-status-active { background: #dbeafe; color: #1e40af; }
.cp-status-done { background: #d1fae5; color: #065f46; }
.cp-status-paused { background: #fef3c7; color: #92400e; }

.cp-row-actions { white-space: nowrap; }
.cp-mini {
  background: transparent; border: 1px solid transparent; padding: 2px 6px;
  border-radius: 4px; cursor: pointer; font-size: 14px; margin-right: 4px;
}
.cp-mini:hover { border-color: #d0d7de; background: #f6f8fa; }

.cp-foot { padding: 10px 16px; color: #6b7280; font-size: 12.5px; }

/* 空态 */
.cp-empty { background: #fff; border: 1px solid #eef0f4; border-radius: 8px; padding: 60px 40px; text-align: center; }
.cp-empty-icon { font-size: 42px; margin-bottom: 12px; }
.cp-empty h3 { margin: 6px 0 8px; color: #1f2937; }
.cp-empty p { color: #6b7280; font-size: 13.5px; max-width: 480px; margin: 0 auto 16px; }

/* ---------------- 编辑器（在 openFormModal 弹窗内） ---------------- */
.cp-editor { max-width: 900px; }
.cp-section {
  background: #fff; border: 1px solid #eef0f4; border-radius: 8px;
  padding: 14px 18px; margin-bottom: 14px;
}
.cp-section-title {
  font-size: 14px; font-weight: 600; color: #1f2937;
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #eef0f4;
  display: flex; align-items: center; gap: 10px;
}

.cp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.cp-fld { display: flex; flex-direction: column; gap: 4px; }
.cp-fld-full { grid-column: 1 / -1; }
.cp-fld label { color: #4b5563; font-size: 12.5px; }
.cp-fld .cp-input { width: 100%; min-width: unset; }

.cp-hint { color: #6b7280; font-size: 12px; margin: 4px 0; }

.cp-editor-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  padding-top: 8px; border-top: 1px solid #eef0f4; margin-top: 8px;
}

/* 关联问卷行 */
.cp-survey-row {
  display: grid; grid-template-columns: 40px 1fr 160px 30px;
  gap: 8px; align-items: center; margin-bottom: 8px;
}
.cp-idx { color: #9ca3af; font-size: 12px; text-align: center; }
.cp-empty-small { color: #9ca3af; font-size: 12px; padding: 6px 4px; }

/* 开关 */
.cp-switch { display: inline-block; position: relative; width: 34px; height: 18px; margin-left: auto; }
.cp-switch input { opacity: 0; width: 0; height: 0; }
.cp-switch span {
  position: absolute; inset: 0; background: #d0d7de; border-radius: 999px; cursor: pointer;
  transition: 0.2s;
}
.cp-switch span::before {
  content: ''; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px;
  background: #fff; border-radius: 50%; transition: 0.2s;
}
.cp-switch input:checked + span { background: #2f6feb; }
.cp-switch input:checked + span::before { transform: translateX(16px); }

.is-hidden { display: none !important; }

/* 小按钮 */
.wk-btn-sm { padding: 3px 10px; font-size: 12px; }

/* ---------------- 抽屉版编辑器（与 surveys 编辑器同风格） ---------------- */
#campaignEditor.cp-editor-page .cp-drawer-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
#campaignEditor.cp-editor-page .cp-editor { max-width: none; }
#campaignEditor.cp-editor-page .cp-editor-heading {
  font-size: 15px; font-weight: 600; color: #1f2937;
}
/* 抽屉里避免 cp-section 撑得太宽 */
#campaignEditor.cp-editor-page .cp-section { max-width: 100%; }
#campaignEditor.cp-editor-page .cp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 14px; }
@media (max-width: 720px) {
  #campaignEditor.cp-editor-page .cp-grid { grid-template-columns: 1fr; }
}

/* ============ 6.1 ROI 看板 · 2026-07-06 ============ */
.cp-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.cp-kpi {
  background: linear-gradient(135deg, #fafbfc 0%, #f3f5f8 100%);
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  transition: transform .15s, box-shadow .15s;
}
.cp-kpi:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.cp-kpi-accent {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #93c5fd;
}
.cp-kpi-label { font-size: 12px; color: #6b7280; }
.cp-kpi-val { font-size: 22px; font-weight: 700; color: #111827; margin-top: 4px; letter-spacing: -.01em; }
.cp-kpi-sub { font-size: 11px; color: #9ca3af; margin-top: 3px; }

/* 漏斗 */
.cp-funnel-wrap {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
  text-align: center;
}
.cp-funnel-title {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  text-align: left;
  margin-bottom: 8px;
}
.cp-funnel-wrap svg { max-width: 100%; height: auto; }

/* 渠道柱状 */
.cp-chart-wrap, .cp-surveys-wrap {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.cp-chart-title {
  font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 10px;
}
.cp-chart-body { display: flex; flex-direction: column; gap: 8px; }
.cp-chart-row {
  display: grid;
  grid-template-columns: 100px 1fr 60px;
  gap: 10px;
  align-items: center;
}
.cp-chart-label {
  font-size: 12px; color: #374151;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cp-chart-track {
  position: relative;
  height: 24px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
}
.cp-chart-bar-leads {
  position: absolute; left: 0; top: 0; height: 100%;
  background: linear-gradient(90deg, #60a5fa 0%, #3b82f6 100%);
  transition: width .5s ease-out;
}
.cp-chart-bar-conv {
  position: absolute; left: 0; top: 0; height: 100%;
  background: linear-gradient(90deg, #34d399 0%, #10b981 100%);
  transition: width .5s ease-out;
}
.cp-chart-num {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: #ffffff; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,0.15);
  z-index: 2; pointer-events: none;
}
.cp-chart-rate {
  font-size: 13px; font-weight: 600; text-align: right;
}
.cp-chart-legend {
  margin-top: 10px; padding-top: 8px;
  border-top: 1px dashed #e5e7eb;
  font-size: 11px; color: #6b7280;
  display: flex; align-items: center;
}
.cp-legend-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px;
}
.cp-legend-leads { background: #3b82f6; }
.cp-legend-conv  { background: #10b981; }

/* 表单表格 */
.cp-survey-tbl {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.cp-survey-tbl thead th {
  padding: 6px 10px; background: #f9fafb; color: #6b7280; text-align: left; font-weight: 500;
  border-bottom: 1px solid #e5e7eb;
}
.cp-survey-tbl tbody td { padding: 8px 10px; border-bottom: 1px solid #f3f4f6; }
.cp-survey-tbl tbody tr:hover { background: #fafbfc; }

/* ============ 6.2 活动线索抽屉 · 2026-07-06 ============ */
.cp-leads-drawer-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 9999;
  display: flex; justify-content: flex-end;
  opacity: 0; transition: opacity .2s ease-out;
}
.cp-leads-drawer-mask.is-open { opacity: 1; }
.cp-leads-drawer {
  width: min(920px, 88vw);
  height: 100vh;
  background: #ffffff;
  display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  transform: translateX(100%);
  transition: transform .25s ease-out;
}
.cp-leads-drawer-mask.is-open .cp-leads-drawer { transform: translateX(0); }
.cp-leads-drawer-head {
  padding: 14px 20px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 16px; font-weight: 600; color: #111827;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(90deg, #f9fafb 0%, #ffffff 100%);
}
.cp-leads-close {
  background: transparent; border: 0; font-size: 20px; color: #6b7280;
  cursor: pointer; padding: 4px 8px; border-radius: 4px;
}
.cp-leads-close:hover { background: #f3f4f6; color: #111827; }
.cp-leads-drawer-toolbar {
  padding: 12px 20px;
  border-bottom: 1px solid #f3f4f6;
  display: flex; gap: 8px; align-items: center;
}
.cp-leads-drawer-body { flex: 1; overflow: auto; padding: 0; }
.cp-leads-summary {
  padding: 10px 20px;
  font-size: 13px; color: #6b7280;
  background: #fafbfc; border-bottom: 1px solid #f3f4f6;
}
.cp-leads-tbl {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.cp-leads-tbl thead th {
  position: sticky; top: 0; z-index: 1;
  background: #f9fafb; padding: 10px 12px;
  text-align: left; font-weight: 500; color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
}
.cp-leads-tbl tbody td {
  padding: 12px; border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}
.cp-leads-tbl tbody tr:hover { background: #fafbfc; }
.cp-lead-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

/* ============ 6.3 落地页预览器 · 2026-07-06 ============ */
.cp-preview-mask {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s ease-out;
  padding: 20px;
}
.cp-preview-mask.is-open { opacity: 1; }
.cp-preview-shell {
  width: min(1400px, 96vw);
  height: min(940px, 94vh);
  background: #f8fafc;
  border-radius: 12px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  transform: scale(0.95);
  transition: transform .2s ease-out;
}
.cp-preview-mask.is-open .cp-preview-shell { transform: scale(1); }
.cp-preview-head {
  padding: 12px 20px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px; color: #374151;
  display: flex; align-items: center; justify-content: space-between;
}
.cp-preview-toolbar {
  padding: 10px 20px;
  background: #ffffff;
  border-bottom: 1px solid #f3f4f6;
  display: flex; align-items: center; gap: 12px;
}
.cp-preview-devices { display: flex; gap: 6px; }
.cp-preview-device {
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  border-radius: 6px;
  font-size: 12px; color: #374151;
  cursor: pointer;
  line-height: 1.4;
  min-width: 78px;
  transition: all .15s;
}
.cp-preview-device:hover { border-color: #93c5fd; }
.cp-preview-device.is-active {
  background: #eff6ff; border-color: #3b82f6; color: #1e40af; font-weight: 600;
}
.cp-preview-stage {
  flex: 1;
  background: #e2e8f0;
  display: flex; flex-direction: column; align-items: center;
  padding: 20px;
  overflow: auto;
}
.cp-preview-frame {
  background: #000000;
  border: 12px solid #1e293b;
  border-radius: 32px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  position: relative;
  overflow: hidden;
  transition: width .25s, height .25s;
  flex-shrink: 0;
}
.cp-preview-frame iframe {
  width: 100%; height: 100%; border: 0;
  background: #ffffff;
}
.cp-preview-url {
  margin-top: 12px;
  padding: 6px 12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font-size: 11px;
  color: #6b7280;
  font-family: monospace;
  max-width: 90%;
  word-break: break-all;
}

/* 桌面型号取消手机外壳 */
.cp-preview-frame[style*="1280"] {
  border: 8px solid #334155;
  border-radius: 8px;
}

/* =============================================================
 * 9.2A · 跨活动 ROI 总览卡（2026-07-07）
 * ============================================================= */
.cp-dashboard {
  margin: 12px 0 16px;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.cp-dash-loading, .cp-dash-error {
  padding: 20px;
  text-align: center;
  color: #6b7280;
  font-size: 13px;
}
.cp-dash-error { color: #dc2626; }

.cp-dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
@media (max-width: 1100px) {
  .cp-dash-kpi-row { grid-template-columns: repeat(3, 1fr); }
}
.cp-dash-kpi {
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  transition: all 0.2s;
}
.cp-dash-kpi:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.cp-dash-kpi-label { font-size: 11px; color: #6b7280; margin-bottom: 4px; letter-spacing: 0.2px; }
.cp-dash-kpi-val { font-size: 20px; font-weight: 700; color: #111827; line-height: 1.2; }
.cp-dash-kpi-sub { font-size: 11px; color: #9ca3af; margin-top: 3px; }
.cp-dash-mini { font-size: 12px; color: #6b7280; font-weight: 500; margin-left: 4px; }

.cp-dash-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
}
@media (max-width: 1100px) {
  .cp-dash-grid { grid-template-columns: 1fr; }
}
.cp-dash-panel {
  background: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
}
.cp-dash-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f3f4f6;
}

/* 活动排行榜 */
.cp-dash-rank-row {
  display: grid;
  grid-template-columns: 40px 1fr auto 200px 100px;
  gap: 10px;
  align-items: center;
  padding: 8px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.cp-dash-rank-row:hover { background: #f9fafb; }
.cp-dash-rank-idx { font-size: 15px; font-weight: 700; text-align: center; }
.cp-dash-rank-name { font-size: 13px; font-weight: 500; color: #111827; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-dash-rank-status { font-size: 11px; }
.cp-dash-rank-bar {
  position: relative;
  height: 20px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
}
.cp-dash-rank-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 4px;
  transition: width 0.4s ease;
}
.cp-dash-rank-bar-num {
  position: absolute; top: 0; left: 6px;
  font-size: 11px; line-height: 20px; color: #374151; font-weight: 500;
  text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}
.cp-dash-rank-roi { font-size: 13px; font-weight: 700; text-align: right; }
.cp-dash-more { font-size: 11px; color: #9ca3af; text-align: center; padding: 6px 0 0; }

/* 全渠道对比 */
.cp-dash-chan-row {
  display: grid;
  grid-template-columns: 80px 1fr 60px;
  gap: 8px;
  align-items: center;
  padding: 6px 4px;
}
.cp-dash-chan-label { font-size: 12px; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-dash-chan-track {
  position: relative; height: 18px;
  background: #f3f4f6;
  border-radius: 4px; overflow: hidden;
}
.cp-dash-chan-leads {
  position: absolute; top: 0; left: 0; height: 100%;
  background: linear-gradient(90deg, #93c5fd, #60a5fa);
}
.cp-dash-chan-conv {
  position: absolute; top: 0; left: 0; height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
}
.cp-dash-chan-num {
  position: absolute; top: 0; left: 6px;
  font-size: 10px; line-height: 18px; color: #1f2937; font-weight: 500;
  text-shadow: 0 1px 2px rgba(255,255,255,0.9);
}
.cp-dash-chan-rate { font-size: 12px; font-weight: 700; text-align: right; }

/* =============================================================
 * 9.2C · 财务与 ROI 面板（编辑抽屉，2026-07-07）
 * ============================================================= */
.cp-fin-box {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fafbfc 0%, #f3f4f6 100%);
}
.cp-fin-head {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px dashed #e5e7eb;
}
.cp-fin-title { font-size: 14px; font-weight: 700; color: #111827; }
.cp-fin-hint { font-size: 11px; color: #6b7280; line-height: 1.5; }
.cp-fin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 720px) {
  .cp-fin-grid { grid-template-columns: 1fr; }
}
.cp-fin-col {
  background: #fff;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}
.cp-fin-plan { border-left: 3px solid #3b82f6; }
.cp-fin-actual { border-left: 3px solid #10b981; }
.cp-fin-col-title { font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 8px; }
.cp-fin-col .cp-fld { margin-bottom: 8px; }
.cp-fin-col .cp-fld:last-child { margin-bottom: 0; }
.cp-fin-col label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: #4b5563; margin-bottom: 3px;
}
.cp-fin-tag {
  font-size: 9px;
  background: #dbeafe;
  color: #1e40af;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 500;
  letter-spacing: 0.3px;
}
.cp-fin-tag-actual { background: #d1fae5; color: #065f46; }

/* 实时 KPI 面板 */
.cp-fin-live {
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
}
.cp-fin-live-title { font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 8px; }
.cp-fin-live-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 720px) {
  .cp-fin-live-grid { grid-template-columns: repeat(2, 1fr); }
}
.cp-fin-mini {
  padding: 8px 10px;
  border-radius: 6px;
  background: #f9fafb;
}
.cp-fin-mini-label {
  font-size: 11px; color: #6b7280; margin-bottom: 4px;
  display: flex; align-items: center; gap: 4px;
}
.cp-fin-mini-val { font-size: 16px; font-weight: 700; line-height: 1.2; }
.cp-fin-mini-sub { font-size: 10px; color: #9ca3af; margin-top: 3px; line-height: 1.3; }
.cp-fin-delta { font-size: 10px; font-weight: 600; margin-left: 4px; }

/* 排行榜实际 ROI（9.2C 联动） */
.cp-dash-rank-roi-act {
  font-size: 12px;
  font-weight: 600;
  min-width: 62px;
  text-align: right;
  padding-left: 4px;
}
.cp-dash-rank-roi-pending { color: #cbd5e1; font-weight: 400; }
