/* AI智能连接型CRM - 公共样式 */
/* 设计令牌与 readme-d.md「全局设计规范」保持同步 */
/* 详情抽屉 Tab + details 折叠：docs/WEB2-详情抽屉-Tab与折叠规范.md */
/* 主内容滚动区：外层 flex-1 overflow-y-auto，内层第一子节点用 .crm-workspace（web2 内 40+ 页已统一） */

/* ========== 设计令牌（颜色 · 字体尺度 · 间距 · 圆角 · 阴影）========== */
:root {
  /* —— 品牌与功能色（与各页 tailwind.config extend.colors 对齐）—— */
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --ai-accent: #7c3aed;
  --connect: #059669;
  /* 协同详情等场景「政企蓝」主按钮/里程碑高亮，与 Tailwind `brand` 一致 */
  --brand: #1890ff;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #059669;

  /* —— 文本色（对应 slate 阶梯，正文对比度 ≥ 4.5:1 建议）—— */
  --text-primary: #0f172a;
  --text-heading: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  /* —— 表面与描边 —— */
  --surface: #f1f5f9;
  --surface-canvas: #f1f5f9;
  --surface-canvas-alt: #f4f6f8;
  --surface-card: #ffffff;
  --border-default: #e2e8f0;
  --border-muted: #f1f5f9;
  --glass: rgba(255, 255, 255, 0.88);

  --sidebar: #1e1b4b;
  --sidebar-light: #f8fafc;

  /* —— 字体族（页面请继续用 Tailwind `font-sans`，与此变量一致）—— */
  --font-sans: "Outfit", "DM Sans", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, monospace;

  /* —— 字号阶梯（rem，基准 16px）—— */
  --text-display: 1.5rem;
  --text-display-lg: 1.65rem;
  --text-heading: 1.125rem;
  --text-subheading: 1rem;
  --text-body: 0.875rem;
  --text-small: 0.8125rem;
  --text-caption: 0.75rem;
  --text-overline: 0.6875rem;

  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* —— 间距（4px 网格；页面 Tailwind 的 4=1rem 与此兼容）—— */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  /* 主工作区：与简报/待办 `px-6 py-6` 一致 */
  --space-page-x: 1.5rem;
  --space-page-y: 1.5rem;
  --space-section-gap: 1.5rem;
  --space-card-padding: 1.25rem;
  --space-card-padding-lg: 1.5rem;

  /* —— 圆角 —— */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;

  /* —— 阴影（卡片层级）—— */
  --shadow-card: 0 4px 24px -4px rgba(15, 23, 42, 0.08), 0 2px 8px -2px rgba(15, 23, 42, 0.04);
  --shadow-card-hover: 0 8px 28px -6px rgba(15, 23, 42, 0.1), 0 2px 10px -4px rgba(24, 144, 255, 0.06);
  --shadow-glass-legacy: 0 4px 24px -1px rgba(79, 70, 229, 0.06);
}

/* 字号基准，避免移动端自动缩放导致比例漂移 */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

/* 全站抗锯齿（链入了本文件的页面均生效） */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== 布局（与 workbench 简报/待办对齐）========== */
.sidebar-logo-area {
  height: 3.5rem;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.secondary-sidebar-header {
  height: 3.5rem;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
}

/** 主滚动区内层：等同 `px-6 py-6`，新页可优先用此类减少魔法数 */
.crm-workspace {
  padding: var(--space-page-y) var(--space-page-x);
}

/** 区块纵向堆叠间距：等同 `space-y-6` 量级 */
.crm-stack-section > * + * {
  margin-top: var(--space-section-gap);
}

/* ========== 排版工具类（可选，与 Tailwind 并存）========== */
.crm-text-display {
  font-size: var(--text-display-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: var(--leading-tight);
}

.crm-text-heading {
  font-size: var(--text-heading);
  font-weight: 600;
  color: var(--text-heading);
  line-height: var(--leading-tight);
}

.crm-text-subheading {
  font-size: var(--text-subheading);
  font-weight: 600;
  color: var(--text-heading);
  line-height: var(--leading-snug);
}

.crm-text-body {
  font-size: var(--text-body);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}

.crm-text-muted {
  font-size: var(--text-body);
  color: var(--text-muted);
  line-height: var(--leading-normal);
}

.crm-text-caption {
  font-size: var(--text-caption);
  color: var(--text-muted);
  line-height: var(--leading-normal);
}

.crm-text-overline {
  font-size: var(--text-overline);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ========== 焦点环（键盘可达性）========== */
.crm-focus:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.crm-focus-brand:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ========== 卡片表面（可选）========== */
.crm-surface-canvas {
  background-color: var(--surface-canvas);
}

.crm-surface-canvas-alt {
  background-color: var(--surface-canvas-alt);
}

.crm-shadow-card {
  box-shadow: var(--shadow-card);
}

.glass-card {
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-glass-legacy);
}

/* 赢单下列表主表区：去掉外阴影，减轻主工作区右侧视觉厚度（与 border 保留层次） */
.glass-card.crm-list-surface {
  box-shadow: none;
}

.nav-item {
  color: rgba(255, 255, 255, 0.9);
}
.nav-item .nav-arrow {
  display: none;
}
.nav-item.nav-active {
  background: var(--sidebar-light);
  color: #1e293b;
}
.nav-item.nav-active .nav-arrow {
  display: block;
}
.nav-item:not(.nav-active):hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.ai-glow {
  box-shadow: 0 0 24px -4px rgba(124, 58, 237, 0.25);
}

.connect-pulse {
  animation: connect-pulse 2s ease-in-out infinite;
}
@keyframes connect-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.connect-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--connect);
  animation: connect-pulse 2s infinite;
}

@media (prefers-reduced-motion: reduce) {
  .transition,
  .connect-pulse,
  .connect-dot {
    transition: none !important;
    animation: none !important;
  }
}

/* ========== 主区滚动条（与协同项目详情等页视觉对齐：细轨 + 透明轨道 + 悬停偏政企蓝）========== */
.crm-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.48) transparent;
}
.crm-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.crm-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.crm-scrollbar::-webkit-scrollbar-thumb {
  background-color: rgba(148, 163, 184, 0.38);
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.crm-scrollbar::-webkit-scrollbar-thumb:hover {
  background-color: rgba(24, 144, 255, 0.42);
  background-clip: padding-box;
}

/* 商机阶段条：燕尾分段（订单 / 商机 / 合同抽屉共用） */
.opp-chevron-bar {
  display: flex;
  width: 100%;
  min-height: 2.875rem;
  align-items: stretch;
  filter: drop-shadow(0 1px 2px rgb(15 23 42 / 0.06));
}
.opp-chevron-step {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem 1.35rem 0.5rem 1.6rem;
  font-size: 0.75rem;
  line-height: 1.2;
  font-weight: 600;
  margin-left: -13px;
  position: relative;
  transition: background-color 0.2s ease, color 0.2s ease;
  clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 50%, calc(100% - 13px) 100%, 0 100%, 13px 50%);
}
.opp-chevron-step:first-child {
  margin-left: 0;
  padding-left: 0.875rem;
  clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 50%, calc(100% - 13px) 100%, 0 100%);
}
.opp-chevron-step:last-child {
  padding-right: 0.875rem;
  clip-path: polygon(13px 0, 100% 0, 100% 100%, 13px 100%, 0 50%);
}
.opp-chevron-step:only-child {
  margin-left: 0;
  padding-left: 0.875rem;
  padding-right: 0.875rem;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}
