/* 工作台 v2 版式 —— 仅作用于 #tab-cockpit，不影响其他页面
   引入顺序在 crm-shell.css / shell.css 之后，通过同名变量作用域覆盖旧样式 */

#tab-cockpit {
  --ck-line: rgba(15, 23, 42, 0.09);
  --ck-line-soft: rgba(15, 23, 42, 0.06);
  --ck-card: #ffffff;
  --ck-sunken: #f4f7f9;
  --ck-text: #0f172a;
  --ck-muted: #5b6b7f;
  --ck-faint: #94a3b8;
  --ck-accent: #0891b2;
  --ck-accent-deep: #0e7490;
  --ck-accent-soft: rgba(8, 145, 178, 0.1);
  --ck-deep: #0c1e36;
  --ck-danger: #b42318;
  --ck-danger-soft: #fdecea;
  --ck-warn: #a15c0a;
  --ck-warn-soft: #fdf3e2;
  --ck-ok: #0f6e56;
  --ck-ok-soft: #e6f4ef;
  --ck-radius: 14px;
  --ck-radius-sm: 10px;
}

#tab-cockpit .page-content {
  padding-bottom: 32px;
}

/* ── 页头 ───────────────────────────────── */
#tab-cockpit .ck-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

#tab-cockpit .ck-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#tab-cockpit .ck-head-actions .btn {
  height: 30px;
  min-width: 70px;
  border-radius: 4px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
}

#tab-cockpit .ck-head-actions .ck-btn-primary {
  background: var(--ck-accent);
  border: 1px solid var(--ck-accent);
  color: #fff;
}

#tab-cockpit .ck-head-actions .ck-btn-primary:hover {
  background: var(--ck-accent-deep);
  border-color: var(--ck-accent-deep);
}

/* ── KPI 横排 ───────────────────────────── */
#tab-cockpit .ck-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 0;
}

#tab-cockpit .ck-kpis .today-card {
  display: block;
  text-align: left;
  background: var(--ck-card);
  border: 1px solid var(--ck-line);
  border-radius: var(--ck-radius);
  padding: 10px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#tab-cockpit .ck-kpis .today-card:hover {
  border-color: var(--ck-accent);
  box-shadow: 0 1px 0 var(--ck-accent-soft);
}

#tab-cockpit .ck-kpis .today-label {
  font-size: 11px;
  color: var(--ck-muted);
  letter-spacing: 0.1px;
}

#tab-cockpit .ck-kpis .today-num {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ck-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.4px;
}

#tab-cockpit .ck-kpis .today-hint {
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--ck-faint);
}

@media (max-width: 1100px) {
  #tab-cockpit .ck-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  #tab-cockpit .ck-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── 两栏骨架 ───────────────────────────── */
#tab-cockpit .ck-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

#tab-cockpit .ck-col-main,
#tab-cockpit .ck-col-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

@media (max-width: 1100px) {
  #tab-cockpit .ck-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── 卡片统一外观 ───────────────────────── */
#tab-cockpit .ck-card,
#tab-cockpit .ck-body > .crm-section {
  background: var(--ck-card);
  border: 1px solid var(--ck-line);
  border-radius: var(--ck-radius);
  padding: 16px 18px;
  margin: 0;
}

#tab-cockpit .ck-card > h3,
#tab-cockpit .ck-body > .crm-section > h3 {
  margin: 0 0 12px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ck-text);
  letter-spacing: 0.1px;
}

#tab-cockpit .ck-card .ck-note,
#tab-cockpit .ck-body > .crm-section > .crm-note {
  margin: 0 0 10px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ck-faint);
}

/* ── 管道摘要（JS 生成 metric-grid / funnel） ── */
#tab-cockpit .metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

#tab-cockpit .metric-card {
  display: block;
  text-align: left;
  background: var(--ck-sunken);
  border: 1px solid var(--ck-line-soft);
  border-radius: var(--ck-radius-sm);
  padding: 10px 12px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

#tab-cockpit .metric-card:hover {
  border-color: var(--ck-accent);
  background: var(--ck-accent-soft);
}

#tab-cockpit .metric-label {
  display: block;
  font-size: 11.5px;
  color: var(--ck-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#tab-cockpit .metric-num {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  font-weight: 600;
  color: var(--ck-text);
  font-variant-numeric: tabular-nums;
}

#tab-cockpit .funnel {
  display: flex;
  gap: 3px;
  margin-top: 12px;
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--ck-sunken);
}

#tab-cockpit .funnel i {
  display: block;
  height: 100%;
  background: var(--ck-accent);
  opacity: 0.85;
}

#tab-cockpit .funnel i:last-child {
  background: #0f6e56;
  opacity: 1;
}

/* ── 行列表（最近访问 / 待关注 / 关注） ── */
#tab-cockpit .crm-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#tab-cockpit .crm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--ck-radius-sm);
  background: transparent;
  transition: background 0.12s ease, border-color 0.12s ease;
}

#tab-cockpit .crm-row:hover {
  background: var(--ck-sunken);
  border-color: var(--ck-line-soft);
}

#tab-cockpit .crm-row .exc-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ck-text);
}

#tab-cockpit .crm-row .suggest-names,
#tab-cockpit .crm-row .exc-reason {
  margin-top: 2px;
  font-size: 11px;
  color: var(--ck-faint);
}

#tab-cockpit .crm-row .chip-warn {
  flex-shrink: 0;
}

/* ── 卡片内的小号信息卡（本周摘要 / 线索漏斗） ── */
#tab-cockpit .ck-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

#tab-cockpit .ck-cards .today-card {
  display: block;
  text-align: left;
  background: var(--ck-sunken);
  border: 1px solid var(--ck-line-soft);
  border-radius: var(--ck-radius-sm);
  padding: 12px 14px;
}

#tab-cockpit .ck-cards .today-card:hover {
  border-color: var(--ck-accent);
}

#tab-cockpit .ck-cards .today-label {
  font-size: 11.5px;
  color: var(--ck-muted);
}

#tab-cockpit .ck-cards .today-num {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 600;
  color: var(--ck-text);
  font-variant-numeric: tabular-nums;
}

#tab-cockpit .ck-cards .today-hint {
  margin-top: 4px;
  font-size: 11px;
  color: var(--ck-faint);
}

/* ── 沉默阈值 ───────────────────────────── */
#tab-cockpit .ck-inline {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

#tab-cockpit .ck-inline .search-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#tab-cockpit .ck-inline label {
  font-size: 11.5px;
  color: var(--ck-muted);
}

#tab-cockpit .ck-inline input {
  width: 68px;
  padding: 7px 10px;
  font-size: 13px;
  border-radius: var(--ck-radius-sm);
  border: 1px solid var(--ck-line);
  background: var(--ck-card);
  color: var(--ck-text);
}

#tab-cockpit .ck-inline .btn {
  height: 30px;
  min-width: 70px;
  border-radius: 4px;
  padding: 0 12px;
  font-size: 13px;
}

#tab-cockpit #silenceDaysNote {
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--ck-faint);
}

/* ── 空状态与提示 ───────────────────────── */
#tab-cockpit .empty-card {
  border: 1px dashed var(--ck-line);
  border-radius: var(--ck-radius-sm);
  background: transparent;
  padding: 18px 16px;
  text-align: left;
}

#tab-cockpit .empty-card strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--ck-text);
}

#tab-cockpit .empty-card p {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: var(--ck-faint);
  line-height: 1.5;
}

#tab-cockpit .crm-card {
  border: 1px solid var(--ck-line-soft);
  border-radius: var(--ck-radius-sm);
  padding: 12px 14px;
  background: var(--ck-sunken);
}

/* ── 深色主题 ───────────────────────────── */
html[data-theme="dark"] #tab-cockpit {
  --ck-line: rgba(148, 163, 184, 0.22);
  --ck-line-soft: rgba(148, 163, 184, 0.14);
  --ck-card: #111827;
  --ck-sunken: #0f172a;
  --ck-text: #e2e8f0;
  --ck-muted: #94a3b8;
  --ck-faint: #7c8ba1;
  --ck-accent: #22d3ee;
  --ck-accent-deep: #0891b2;
  --ck-accent-soft: rgba(34, 211, 238, 0.12);
  --ck-danger: #f09595;
  --ck-danger-soft: rgba(226, 75, 74, 0.16);
  --ck-warn: #fac775;
  --ck-warn-soft: rgba(250, 199, 117, 0.14);
  --ck-ok: #5dcaa5;
  --ck-ok-soft: rgba(93, 202, 165, 0.14);
}

html[data-theme="dark"] #tab-cockpit .ck-head-actions .ck-btn-primary {
  color: #04212b;
}

html[data-theme="dark"] #tab-cockpit .funnel i {
  opacity: 0.9;
}

/* ── v2.1 效果图对齐：需要您处理（深紫锚点卡） ── */
#tab-cockpit .ck-attn {
  background: linear-gradient(160deg, #4c3a8f 0%, #38296b 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--ck-radius);
  padding: 16px 18px;
  box-shadow: 0 6px 18px rgba(56, 41, 107, 0.25);
  width: 100%;
}

#tab-cockpit .ck-attn > h3 {
  margin: 0 0 10px;
  font-size: 14.5px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.3px;
}

#tab-cockpit .ck-attn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 12px;
  margin-top: 4px;
  border: 1px solid transparent;
  border-radius: var(--ck-radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: #ece9fa;
  font-size: 12.5px;
  text-align: left;
  transition: background 0.12s ease;
}

#tab-cockpit .ck-attn-row:hover {
  background: rgba(255, 255, 255, 0.16);
}

#tab-cockpit .ck-attn-row strong {
  font-size: 13px;
  font-weight: 700;
  color: #ffd9a8;
  font-variant-numeric: tabular-nums;
}

/* ── v2.1 KPI 图标徽章与状态色 ── */
#tab-cockpit .ck-kpis .today-card {
  position: relative;
}

#tab-cockpit .ck-kpis .today-card::after {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  background: var(--ck-accent-soft);
  color: var(--ck-accent-deep);
}

#tab-cockpit .ck-kpis .today-card[data-today="todos"]::after { content: "✓"; }
#tab-cockpit .ck-kpis .today-card[data-today="snooze"]::after { content: "◷"; background: var(--ck-warn-soft); color: var(--ck-warn); }
#tab-cockpit .ck-kpis .today-card[data-today="silent"]::after { content: "☾"; background: var(--ck-warn-soft); color: var(--ck-warn); }
#tab-cockpit .ck-kpis .today-card[data-today="queue"]::after { content: "⚑"; background: rgba(76, 58, 143, 0.12); color: #4c3a8f; }
#tab-cockpit .ck-kpis .today-card[data-today="overdue"]::after { content: "!"; background: var(--ck-danger-soft); color: var(--ck-danger); }
#tab-cockpit .ck-kpis .today-card[data-today="followup"]::after { content: "↻"; }

#tab-cockpit .ck-kpis .today-card.ck-tone-danger .today-num { color: var(--ck-danger); }
#tab-cockpit .ck-kpis .today-card.ck-tone-warn .today-num { color: var(--ck-warn); }
#tab-cockpit .ck-kpis .today-card.ck-tone-info .today-num { color: #4c3a8f; }

/* ── v2.2 商机阶段分布表格 ── */
#tab-cockpit .ck-stage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#tab-cockpit .ck-stage-table th {
  text-align: left;
  font-weight: 600;
  color: var(--ck-muted);
  font-size: 12px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--ck-line);
}

#tab-cockpit .ck-stage-table td {
  padding: 8px 10px;
  color: var(--ck-text);
  border-bottom: 1px solid var(--ck-line-soft);
}

#tab-cockpit .ck-stage-table tbody tr:last-child td {
  border-bottom: none;
}

#tab-cockpit .ck-stage-table th:nth-child(2),
#tab-cockpit .ck-stage-table th:nth-child(3),
#tab-cockpit .ck-stage-table td:nth-child(2),
#tab-cockpit .ck-stage-table td:nth-child(3) {
  text-align: center;
}

#tab-cockpit .ck-stage-table td:nth-child(2) {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

#tab-cockpit .ck-stage-table td:nth-child(3) {
  color: var(--ck-muted);
}

/* ── v2.1 最近访问双列头像卡 ── */
#tab-cockpit .ck-visits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 560px) {
  #tab-cockpit .ck-visits { grid-template-columns: 1fr; }
}

#tab-cockpit .ck-visit {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  background: var(--ck-card);
  border: 1px solid var(--ck-line-soft);
  border-radius: var(--ck-radius-sm);
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#tab-cockpit .ck-visit:hover {
  border-color: var(--ck-accent);
  box-shadow: 0 2px 8px var(--ck-accent-soft);
}

#tab-cockpit .ck-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

#tab-cockpit .ck-av-0 { background: #185fa5; }
#tab-cockpit .ck-av-1 { background: #0e7490; }
#tab-cockpit .ck-av-2 { background: #0f6e56; }
#tab-cockpit .ck-av-3 { background: #4c3a8f; }
#tab-cockpit .ck-av-4 { background: #a15c0a; }

#tab-cockpit .ck-visit-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#tab-cockpit .ck-visit-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ck-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#tab-cockpit .ck-visit-sub {
  font-size: 11px;
  color: var(--ck-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── v2.1 待关注行强调 ── */
#tab-cockpit #cockpitWatch .crm-row {
  border-left: 3px solid var(--ck-warn);
  background: var(--ck-warn-soft);
  border-radius: 0 var(--ck-radius-sm) var(--ck-radius-sm) 0;
}

#tab-cockpit .chip-warn {
  background: var(--ck-warn-soft);
  color: var(--ck-warn);
  border: 1px solid rgba(161, 92, 10, 0.25);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
}

/* ── v2.1 深色主题补充 ── */
html[data-theme="dark"] #tab-cockpit .ck-attn {
  background: linear-gradient(160deg, #3b2d72 0%, #2a1e52 100%);
  box-shadow: none;
}

html[data-theme="dark"] #tab-cockpit .ck-attn-row { background: rgba(255, 255, 255, 0.07); }
html[data-theme="dark"] #tab-cockpit .ck-attn-row:hover { background: rgba(255, 255, 255, 0.14); }
html[data-theme="dark"] #tab-cockpit .ck-attn-row strong { color: #ffd9a8; }
html[data-theme="dark"] #tab-cockpit .ck-kpis .today-card[data-today="queue"]::after { background: rgba(139, 116, 218, 0.2); color: #b7a6ef; }

/* ── v2.3 工作台小组件弹窗 ── */
.ck-widget-modal {
  width: min(520px, 94vw);
}

.ck-widget-head {
  padding: 18px 24px 14px;
}

.ck-widget-head h2 {
  font-size: 17px;
  font-weight: 600;
  color: #0f172a;
}

.ck-widget-head .ck-widget-sub {
  margin: 5px 0 0;
  font-size: 12.5px;
  color: #64748b;
}

.ck-widget-head .modal-close {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
}

.ck-widget-head .modal-close:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.04);
}

.ck-widget-body {
  padding: 12px 24px 20px;
}

.ck-widget-fields {
  gap: 4px 24px;
  margin-top: 0;
}

.ck-widget-fields label {
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.ck-widget-fields label:hover {
  background: rgba(15, 23, 42, 0.04);
}

.ck-widget-fields input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: #185fa5;
}

.ck-widget-fields label span,
.ck-widget-fields label {
  white-space: nowrap;
}

.ck-widget-fields label span {
  font-size: 13px;
  color: #0f172a;
}

.ck-widget-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
}

.ck-widget-footer .ck-widget-actions {
  display: flex;
  gap: 10px;
}

.ck-widget-footer .btn {
  height: 30px;
  min-width: 70px;
  border-radius: 4px;
  padding: 0 12px;
  font-size: 13px;
}

.ck-widget-footer .ck-btn-primary {
  background: #185fa5;
  border: 1px solid #185fa5;
  color: #fff;
}

.ck-widget-footer .ck-btn-primary:hover {
  background: #0c447c;
  border-color: #0c447c;
}

/* ── 工作台：所有按钮统一改为可点击文字（#0891b2） ── */
#tab-cockpit .page-content .btn,
#tab-cockpit .page-content .btn-default,
#tab-cockpit .page-content .btn-secondary,
#tab-cockpit .page-content .btn-plain,
#tab-cockpit .page-content .btn-toolbar,
#tab-cockpit .page-content .btn-link,
#tab-cockpit .page-content .btn-sm {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  height: auto;
  min-width: 0;
  color: #0891b2;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
}

#tab-cockpit .page-content .btn:hover,
#tab-cockpit .page-content .btn-default:hover,
#tab-cockpit .page-content .btn-secondary:hover,
#tab-cockpit .page-content .btn-plain:hover,
#tab-cockpit .page-content .btn-toolbar:hover,
#tab-cockpit .page-content .btn-link:hover {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #066b86;
  text-decoration: underline;
}

/* 紫色「需要您处理」卡内的三行：也改为文字链接 */
#tab-cockpit .ck-attn-row {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 6px 0;
  margin-top: 0;
  color: #0891b2;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

#tab-cockpit .ck-attn-row:hover {
  background: transparent;
  color: #0891b2;
  text-decoration: underline;
}

#tab-cockpit .ck-attn-row strong {
  color: #0891b2;
  font-weight: 600;
}

/* 深色主题下同样保持文字形态，去掉深色底框 */
html[data-theme="dark"] #tab-cockpit .page-content .btn,
html[data-theme="dark"] #tab-cockpit .page-content .btn-default,
html[data-theme="dark"] #tab-cockpit .page-content .btn-secondary,
html[data-theme="dark"] #tab-cockpit .page-content .btn-plain,
html[data-theme="dark"] #tab-cockpit .page-content .btn-toolbar,
html[data-theme="dark"] #tab-cockpit .page-content .btn-link {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #22c3e0;
}

html[data-theme="dark"] #tab-cockpit .ck-attn-row,
html[data-theme="dark"] #tab-cockpit .ck-attn-row strong {
  background: transparent;
  color: #22c3e0;
}

/* ── v2.4 右栏：商机阶段分布 + 输单原因分布（窄栏适配） ── */
#tab-cockpit #cockpitBody,
#tab-cockpit #cockpitTeam {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

#tab-cockpit #cockpitTeam:empty { display: none; }
#tab-cockpit #cockpitTeam[hidden] { display: none; }

/* 窄栏表格：固定布局 + 压缩内边距，避免横向滚动和挤压 */
#tab-cockpit .ck-col-side .ck-stage-table {
  table-layout: fixed;
  font-size: 12.5px;
}

#tab-cockpit .ck-col-side .ck-stage-table th {
  padding: 6px 8px;
  font-size: 11.5px;
}

#tab-cockpit .ck-col-side .ck-stage-table td {
  padding: 7px 8px;
}

/* 三列等宽 */
#tab-cockpit .ck-col-side .ck-stage-table th,
#tab-cockpit .ck-col-side .ck-stage-table td {
  width: 33.333%;
}

#tab-cockpit .ck-col-side .ck-stage-table th:first-child,
#tab-cockpit .ck-col-side .ck-stage-table td:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 输单原因卡：强制排成一行，等分不换行 */
#tab-cockpit .ck-col-side .metric-grid {
  display: flex;
  gap: 6px;
}

#tab-cockpit .ck-col-side .metric-card {
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 6px;
  text-align: center;
}

#tab-cockpit .ck-col-side .metric-label {
  font-size: 10.5px;
}

#tab-cockpit .ck-col-side .metric-num {
  margin-top: 2px;
  font-size: 15px;
}

/* ── v2.6 卡片标题行右侧备注 ───────────────────────────── */
#tab-cockpit .ck-card > h3.ck-h3-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 10px;
  row-gap: 2px;
}

#tab-cockpit .ck-card > h3.ck-h3-row .ck-h3-note {
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ck-faint);
  letter-spacing: 0;
}

#tab-cockpit .ck-card > h3.ck-h3-row .ck-h3-note:empty {
  display: none;
}

html[data-theme="dark"] #tab-cockpit .ck-card > h3.ck-h3-row .ck-h3-note {
  color: var(--ck-faint);
}


/* ── 工作台日历 + 日程（2026-11-11） ── */
#tab-cockpit .ck-calendar { padding-bottom: 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cal-title { font-size: 15px; font-weight: 600; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav-btn { width: 28px; height: 28px; padding: 0; border: 1px solid var(--border, #e2e8f0); border-radius: 6px; background: var(--surface, #fff); color: var(--text, #0f172a); cursor: pointer; font-size: 18px; line-height: 1; }
.cal-nav-btn:hover { background: var(--card-head-bg, rgba(8, 145, 178, .12)); }
/* 工作台 .page-content .btn 有条 height:auto/min-width:0 的旧规则，选择器要压过它 */
#tab-cockpit .page-content .ck-calendar .btn.cal-today-btn { min-width: 70px; height: 30px; padding: 0 10px; line-height: 1; box-sizing: border-box; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-week span { text-align: center; font-size: 11px; color: var(--muted, #64748b); padding: 4px 0; }
.cal-cell { height: 36px; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text, #0f172a); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12.5px; line-height: 1.2; }
.cal-cell:hover { background: rgba(8, 145, 178, .08); }
.cal-cell.is-out { opacity: .45; }
.cal-cell.is-today .cal-num { color: #0891b2; font-weight: 700; }
.cal-cell.is-selected { background: var(--card-head-bg, rgba(8, 145, 178, .12)); border-color: rgba(8, 145, 178, .35); }
.cal-dots { display: flex; gap: 2px; height: 5px; margin-top: 2px; }
.cal-dot { display: block; width: 4px; height: 4px; border-radius: 50%; background: #94a3b8; }
.cal-dot-personal { background: #2563eb; }
.cal-dot-followup { background: #0891b2; }
.cal-dot-close { background: #ea580c; }
.cal-dot-lead { background: #7c3aed; }
.cal-dot-customer { background: #059669; }
.cal-dot-todo { background: #94a3b8; }
.cal-schedule { border-top: 1px solid var(--border, #e2e8f0); margin-top: 12px; padding-top: 10px; }
.cal-schedule-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.cal-schedule-title { font-size: 13px; font-weight: 600; margin-right: auto; }
.cal-view-switch { display: flex; border: 1px solid var(--border, #e2e8f0); border-radius: 6px; overflow: hidden; }
.cal-view-btn { height: 26px; padding: 0 10px; border: 0; background: transparent; color: var(--text, #0f172a); cursor: pointer; font-size: 12px; }
.cal-view-btn.is-active { background: var(--card-head-bg, rgba(8, 145, 178, .12)); color: #0891b2; font-weight: 600; }
#tab-cockpit .page-content .ck-calendar .btn.cal-add-btn { min-width: 70px; height: 30px; padding: 0 10px; line-height: 1; box-sizing: border-box; }
.cal-item { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 2px; border-bottom: 1px dashed var(--border, #e2e8f0); font-size: 12.5px; }
.cal-item-time { flex: 0 0 42px; font-size: 11.5px; color: var(--muted, #64748b); }
.cal-tag { flex: 0 0 auto; padding: 1px 6px; border-radius: 4px; font-size: 10.5px; white-space: nowrap; }
.cal-tag-personal { background: rgba(37, 99, 235, .12); color: #1d4ed8; }
.cal-tag-followup { background: rgba(8, 145, 178, .12); color: #0e7490; }
.cal-tag-close { background: rgba(234, 88, 12, .12); color: #c2410c; }
.cal-tag-lead { background: rgba(124, 58, 237, .12); color: #6d28d9; }
.cal-tag-customer { background: rgba(5, 150, 105, .12); color: #047857; }
.cal-tag-todo { background: rgba(100, 116, 139, .14); color: #475569; }
.cal-item-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item-actions { flex: 0 0 auto; display: flex; gap: 4px; }
.cal-item-btn { padding: 0 2px; border: 0; background: transparent; color: #0891b2; cursor: pointer; font-size: 11.5px; }
.cal-empty { padding: 10px 2px; font-size: 12.5px; color: var(--muted, #64748b); }
.cal-day-label { padding: 6px 2px 2px; font-size: 11.5px; font-weight: 600; color: var(--muted, #64748b); }
.cal-error { margin: 6px 0 0; font-size: 12px; color: #dc2626; }
.cal-form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
#calendarEventModal .form-field > input { width: 100%; height: var(--btn-h, 32px); padding: 0 10px; box-sizing: border-box; }
#calendarEventModal .form-field > textarea { width: 100%; min-height: 64px; padding: 8px 10px; box-sizing: border-box; resize: vertical; }
html[data-theme="dark"] .cal-nav-btn,
html[data-theme="dark"] .cal-view-btn { background: #1f2937; color: #e2e8f0; }
html[data-theme="dark"] .cal-cell { color: #e2e8f0; }
