/* ============================================================
   enhance.css — 干净高对比视觉层 v=42
   设计目标（凯哥反馈"字看不清 / 太丑"后全面重做）:
     · 文字全部高对比中性灰(slate-900/600/500), ≥4.5:1
     · 白底卡片 + 1px 细边 + 轻阴影, 无模糊、无渐变文字
     · 去掉一切遮数据的流光层 / conic 光晕 / 暖色调
     · 保留: KPI 网格布局、渠道分段环(中心数字+网格图例)、
       环图转动(由 anim.js ringAutoSpin plugin 驱动, 本层不旋转)
   ============================================================ */

/* ---------- 1) 设计 token（中性 + 高对比） ---------- */
:root {
  /* 默认 accent（蓝） */
  --accent: #2563eb;
  --accent-2: #3b82f6;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --glow: rgba(37, 99, 235, 0.18);

  /* 文字（slate 系，全部高对比） */
  --ink: #0f172a;        /* 主文  slate-900 */
  --ink-2: #475569;      /* 次文  slate-600  (7:1 on #fff) */
  --ink-3: #64748b;      /* 弱文  slate-500  (4.6:1 on #fff, 仅小字) */

  /* 表面 / 边框（中性冷灰） */
  --line: #e2e8f0;       /* slate-200 */
  --line-strong: #cbd5e1;/* slate-300 */
  --panel: #ffffff;
  --panel-soft: #f8fafc; /* slate-50 */
  --bg: #f1f5f9;         /* slate-100 */

  /* 圆角 */
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* 缓动 */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* 轻阴影 */
  --sh-1: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.06);
  --sh-2: 0 2px 6px rgba(15, 23, 42, 0.05), 0 8px 20px -12px rgba(15, 23, 42, 0.12);
  --sh-hover: 0 6px 16px -8px rgba(15, 23, 42, 0.14), 0 16px 40px -18px rgba(15, 23, 42, 0.18);
}

/* 各视图 accent — 干净、饱和、专业，文字仍统一走中性灰 */
:root[data-view="overview"]  { --accent:#2563eb; --accent-2:#3b82f6; --accent-soft:rgba(37,99,235,.08); }
:root[data-view="flow"]      { --accent:#0891b2; --accent-2:#06b6d4; --accent-soft:rgba(8,145,178,.08); }
:root[data-view="anchors"]   { --accent:#7c3aed; --accent-2:#8b5cf6; --accent-soft:rgba(124,58,237,.08); }
:root[data-view="channels"]  { --accent:#ea580c; --accent-2:#f97316; --accent-soft:rgba(234,88,12,.08); }
:root[data-view="tasks"]     { --accent:#d97706; --accent-2:#f59e0b; --accent-soft:rgba(217,119,6,.08); }
:root[data-view="bonuses"]   { --accent:#db2777; --accent-2:#ec4899; --accent-soft:rgba(219,39,119,.08); }
:root[data-view="task"]      { --accent:#dc2626; --accent-2:#ef4444; --accent-soft:rgba(220,38,38,.08); }
:root[data-view="workbench"] { --accent:#16a34a; --accent-2:#22c55e; --accent-soft:rgba(22,163,74,.08); }
:root[data-view="recruiters"]{ --accent:#4f46e5; --accent-2:#6366f1; --accent-soft:rgba(79,70,229,.08); }
:root[data-view="resources"] { --accent:#0d9488; --accent-2:#14b8a6; --accent-soft:rgba(13,148,136,.08); }

/* ---------- 2) 背景：干净浅灰，无光晕 ---------- */
body { background: var(--bg) !important; }

/* ---------- 3) 关键帧（仅入场淡入，无持续装饰动画） ---------- */
@keyframes fadeUp   { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes chipPop  { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: scale(1); } }
@keyframes slideGrow{ from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes reveal   { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes urgentPulse { 0% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); } 100% { box-shadow: 0 0 0 12px rgba(220,38,38,0); } }

/* ---------- 4) 视图头：实色标题 + 左侧细色条 + 生长下划线 ---------- */
.view-header {
  display: flex; align-items: center; gap: 20px;
  margin-bottom: 24px; position: relative;
}
.view-body { display: flex; align-items: center; gap: 18px; flex: 1; min-width: 0; }
.view-header > div:not(.actions):not(.view-chip):not(.view-body) {
  display: flex; align-items: center; gap: 18px; flex: 1; min-width: 0;
}

.view-chip {
  width: 46px; height: 46px; flex: 0 0 auto; border-radius: 13px;
  display: grid; place-items: center; font-size: 22px;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent), var(--sh-1);
  color: var(--accent);
  animation: chipPop 0.5s var(--spring) both;
}

.view-title {
  font-size: 22px !important;
  font-weight: 800 !important;
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink) !important;
  background: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  letter-spacing: -0.02em !important;
  line-height: 1.25 !important;
  margin: 0; position: relative; padding-bottom: 9px;
}
.view-title::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  height: 3px; width: 48px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: left; animation: slideGrow 0.7s var(--ease-out) 0.12s both;
}
.view-subtitle {
  font-size: 13px !important;
  color: var(--ink-3) !important;
  margin-top: 7px !important;
  font-weight: 400;
}

/* ---------- 5) 卡片：白底 + 1px 细边 + 轻阴影 + 顶部细色条 ---------- */
.card {
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  position: relative; overflow: hidden;
  animation: fadeUp 0.55s var(--ease-out) both;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), border-color 0.3s var(--ease-out);
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0.9;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--sh-hover); border-color: var(--line-strong); }

.card-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px !important;
  font-weight: 700 !important;
  color: var(--ink) !important;
  margin: 0 0 14px !important;
}
.card-title::before {
  content: ""; width: 4px; height: 15px; border-radius: 4px;
  background: linear-gradient(var(--accent), var(--accent-2));
}

.grid > * { animation: fadeUp 0.55s var(--ease-out) both; }
.grid > *:nth-child(1) { animation-delay: 0.03s; }
.grid > *:nth-child(2) { animation-delay: 0.07s; }
.grid > *:nth-child(3) { animation-delay: 0.11s; }
.grid > *:nth-child(4) { animation-delay: 0.15s; }
.grid > *:nth-child(5) { animation-delay: 0.19s; }
.grid > *:nth-child(n+6) { animation-delay: 0.23s; }

/* ---------- 6) KPI 卡片：图标 + 标题 + 大数字（v=38 网格布局保留） ---------- */
.kpi-card {
  display: grid;
  grid-template-areas:
    "icon label"
    "value value"
    "trend trend"
    "trend2 trend2";
  grid-template-columns: auto 1fr;
  align-items: center; column-gap: 12px; row-gap: 6px;
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  padding: 18px 22px 16px;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), border-color 0.3s var(--ease-out);
}
.kpi-card::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--kc, var(--accent)), var(--kc-2, var(--accent-2)));
  z-index: 1;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--sh-hover); border-color: var(--line-strong); }
.kpi-card.brand   { --kc:#db2777; --kc-2:#ec4899; }
.kpi-card.warning { --kc:#d97706; --kc-2:#f59e0b; }
.kpi-card.success { --kc:#16a34a; --kc-2:#22c55e; }
.kpi-card.info    { --kc:#0891b2; --kc-2:#06b6d4; }

.kpi-icon {
  grid-area: icon;
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center; font-size: 16px;
  background: color-mix(in srgb, var(--kc, var(--accent)) 11%, #fff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--kc, var(--accent)) 20%, transparent);
  color: var(--kc, var(--accent));
  animation: chipPop 0.5s var(--spring) both;
  position: relative; z-index: 1; justify-self: start;
}
.kpi-label {
  grid-area: label;
  font-size: 13px !important; font-weight: 600 !important;
  color: var(--ink-2) !important;
  margin: 0 !important; line-height: 1.2 !important;
  align-self: center; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi-value {
  grid-area: value;
  font-size: 30px !important; font-weight: 800 !important;
  color: var(--ink) !important;
  letter-spacing: -0.5px !important; line-height: 1.05 !important;
  margin-top: 4px;
}
.kpi-value .unit { font-size: 13px !important; color: var(--ink-3) !important; margin-left: 4px; font-weight: 500; }
.kpi-trend {
  grid-area: trend;
  font-size: 12px !important; color: var(--ink-3) !important;
  line-height: 1.5 !important; margin: 0 !important; align-self: end;
}
.kpi-trend.biweekly { grid-area: trend2; margin-top: 8px !important; padding-top: 9px; border-top: 1px dashed var(--line); }

/* ---------- 7) 图表容器：干净浅底 + 细边，去除流光扫光层 ---------- */
.card > div[style*="height:"],
.card .chart-canvas {
  position: relative;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  margin-top: 10px;
}
/* 图表容器内不再叠加任何遮数据的伪元素 */

/* 环图外圈装饰类（anim.js 会注入）— 全部置为无装饰，仅保留 plugin 驱动的真实旋转 */
.doughnut-spin::before,
.doughnut-spin::after { content: none !important; display: none !important; }
.ring-self-spin canvas { position: relative; z-index: 2; }
.ring-arc { display: none !important; }

/* ---------- 8) 表格：白底 sticky 头 + 高对比字阶 ---------- */
.card table, table.table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 14px !important;
}
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--panel-soft);
  color: var(--ink-2) !important;
  font-size: 12px !important; font-weight: 700 !important;
  letter-spacing: 0.04em; text-transform: uppercase;
  text-align: left; padding: 12px 14px;
  border-bottom: 1.5px solid var(--line-strong); line-height: 1.4;
}
tbody td {
  padding: 12px 14px !important;
  border-bottom: 1px solid var(--line);
  color: var(--ink) !important;
  font-size: 14px !important; line-height: 1.6 !important;
  transition: background 0.2s var(--ease-out);
}
tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* ---------- 9) 徽章 / 状态药丸：圆点 + 静态 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--radius-pill);
  font-size: 12px !important; font-weight: 600 !important;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, currentColor 24%, transparent);
  background: color-mix(in srgb, currentColor 9%, #fff);
  color: var(--ink-2);
  box-shadow: var(--sh-1);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- 10) 排行榜：奖牌数字 + 悬停位移 ---------- */
.rank-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: 12px;
  transition: transform 0.25s var(--ease-out), background 0.25s var(--ease-out);
}
.rank-item:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); transform: translateX(4px); }
.rank-num {
  width: 32px; height: 32px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center;
  font-weight: 700 !important; font-size: 14px !important;
  background: var(--accent-soft); color: var(--accent);
}
.rank-num.gold   { background: linear-gradient(140deg, #fde68a, #f59e0b); color: #7c2d12; }
.rank-num.silver { background: linear-gradient(140deg, #e2e8f0, #cbd5e1); color: #334155; }
.rank-num.bronze { background: linear-gradient(140deg, #fdba74, #ea580c); color: #fff; }

/* ---------- 11) 渠道图标：静态渐变环 + hover 微动 ---------- */
.channel-icon {
  width: 46px; height: 46px; border-radius: 13px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 22px;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent), var(--sh-1);
  color: var(--accent);
  transition: transform 0.35s var(--spring);
}
.channel-card:hover .channel-icon, .ch-card:hover .channel-icon { transform: scale(1.06) rotate(-3deg); }

/* ---------- 12) 侧边栏导航：深色冷调（slate），高对比 ---------- */
.sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 50%, #0f172a 100%) !important;
  color: #cbd5e1; display: flex; flex-direction: column;
  box-shadow: 6px 0 30px -18px rgba(15, 23, 42, 0.6);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.sidebar-header { padding: 24px 22px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); position: relative; z-index: 1; }
.logo {
  font-size: 18px !important; font-weight: 800 !important;
  color: #fff !important; display: flex; align-items: center; gap: 10px; letter-spacing: -0.01em;
}
.logo .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent), 0 0 12px color-mix(in srgb, var(--accent) 50%, transparent);
}
.subtitle { font-size: 12px; color: #94a3b8; margin-top: 8px; }

.nav { position: relative; z-index: 1; flex: 1; padding: 16px 14px; overflow-y: auto; }
.nav-item {
  position: relative; padding: 11px 14px; border-radius: 11px;
  display: flex; align-items: center; gap: 11px;
  cursor: pointer; color: #94a3b8;
  font-size: 14px !important; font-weight: 500 !important;
  margin-bottom: 5px;
  transition: color 0.25s, background 0.25s, transform 0.25s var(--ease-out);
}
.nav-item::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%) scaleY(0);
  width: 3px; height: 58%; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  transition: transform 0.3s var(--ease-out);
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; transform: translateX(2px); }
.nav-item:hover .nav-icon { transform: scale(1.15) rotate(-4deg); }
.nav-item .nav-icon { font-size: 17px; width: 22px; text-align: center; transition: transform 0.3s var(--spring); }
.nav-item.active {
  color: #fff; font-weight: 600 !important;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
}
.nav-item.active::before { transform: translateY(-50%) scaleY(1); }
.nav-item.active::after {
  content: ""; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 7px; height: 7px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), #fff);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-2) 22%, transparent);
}
.nav-item.user-mgmt { margin-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 16px; }
.sidebar-footer { position: relative; z-index: 1; padding: 16px 22px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 12px; color: #64748b; }
.role-super { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--accent) 60%, transparent); }
.role-admin { background: rgba(255, 255, 255, 0.14); color: #cbd5e1; }

/* ---------- 13) 按钮 ---------- */
.btn-primary {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)) !important;
  color: #fff !important;
  box-shadow: 0 10px 24px -12px var(--accent) !important;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), filter 0.3s var(--ease-out) !important;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -10px var(--accent) !important; filter: brightness(1.04); }

/* ---------- 14) 进度条 / 分层行 ---------- */
.progress { height: 8px; border-radius: var(--radius-pill); background: var(--line); overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.tm-row, .tier-row { transition: background 0.25s var(--ease-out), transform 0.25s var(--ease-out); border-radius: 12px; }
.tm-row:hover, .tier-row:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* ---------- 15) 紧急徽章脉冲 ---------- */
.urgent-badge { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); animation: urgentPulse 2.5s ease-out infinite; }

/* ---------- 16) 登录 / 模态：干净质感 ---------- */
.login-overlay {
  background:
    radial-gradient(circle at 28% 18%, rgba(37, 99, 235, 0.18), transparent 60%),
    radial-gradient(circle at 82% 82%, rgba(8, 145, 178, 0.14), transparent 60%),
    rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.login-card, .modal {
  border-radius: 20px;
  background: var(--panel) !important;
  box-shadow: 0 28px 70px -20px rgba(15, 23, 42, 0.5);
  border: 1px solid var(--line-strong);
}
.login-brand { color: var(--ink) !important; }
.login-btn { background: linear-gradient(135deg, var(--accent), var(--accent-2)) !important; color: #fff !important; }

/* ---------- 17) 正文 / 标签字号统一（高对比） ---------- */
body, .main-content { font-size: 14px; line-height: 1.6; color: var(--ink); }
p, li { line-height: 1.6; }
small, .text-muted { font-size: 13px !important; color: var(--ink-3) !important; }

/* ---------- 18) 滚动揭示 ---------- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- 19) 渠道招募分布:v=44 —— 高级感配色 + 扁平图例
      · 配色:同色相深浅 + 1 accent(按占比递进,不放 7 个不同色相)
      · 中心:Canvas 中心 text plugin 画 2 行(label + 大数字带 unit 内联)
      · 图例:去掉扁平灰底卡,改为单行列表(色点+名称+数字+%),行间细 1px 线
      · 主力信息挪到 .card-title 副文案(不会再被环遮挡)
      ---------- */
.channel-chart-shell {
  position: relative; width: 320px; height: 320px;
  margin: 12px auto 8px;
  display: flex; align-items: center; justify-content: center;
}
.channel-chart-shell > canvas {
  position: relative; max-width: 320px; max-height: 320px;
  width: 320px !important; height: 320px !important;
}
/* 取消 v=41 留下的 HTML 中心层 */
.channel-chart-center, .cc-num, .cc-label, .cc-pct { display: none !important; }

/* v=44 — 扁平列表图例(单行:色点 + 名称 + 数量 + 百分比,行间 1px 细线分隔)
   去掉 v=43 的:扁平灰底卡 / 序号 / 胶囊百分比 / 双行 body */
.ch-legend-list {
  display: flex; flex-direction: column;
  margin-top: 14px; padding: 4px 0 0;
  border-top: 1px solid var(--line);
}
.ch-legend-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; cursor: pointer; user-select: none;
  border-bottom: 1px solid var(--line);
  transition: background 0.18s ease, padding-left 0.18s ease;
  position: relative;
}
.ch-legend-row:last-child { border-bottom: none; }
.ch-legend-row:hover { background: rgba(15, 23, 42, 0.025); padding-left: 8px; }
.ch-legend-row:active { background: rgba(15, 23, 42, 0.04); }
.ch-legend-dot {
  width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 0 2px #fff;
}
.ch-legend-name {
  flex: 1; min-width: 0;
  font-size: 14px; font-weight: 500; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ch-legend-count {
  font-size: 15px; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums; letter-spacing: -0.1px;
  white-space: nowrap; display: inline-flex; align-items: baseline; gap: 3px;
}
.ch-legend-count em {
  font-style: normal; font-weight: 400; color: var(--ink-3); font-size: 11.5px;
  letter-spacing: 0;
}
.ch-legend-pct {
  flex-shrink: 0;
  min-width: 38px; text-align: right;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  font-variant-numeric: tabular-nums; letter-spacing: 0.2px;
}
.ch-legend-row.active .ch-legend-name { color: var(--accent); font-weight: 600; }
.ch-legend-row.active .ch-legend-pct { color: var(--accent); }
.ch-legend-row.active::before {
  content: ""; position: absolute; left: -2px; top: 25%; bottom: 25%;
  width: 2px; background: var(--accent); border-radius: 1px;
}

/* 兼容旧类名,避免任何残留 */
.ch-legend-grid, .ch-legend-item, .ch-legend-body, .ch-legend-meta,
.ch-legend-meta-sep, .ch-legend-meta-pct, .ch-legend-idx { display: none !important; }

/* 原 .ch-dist-foot 已被 .ch-legend-list 替代 */
.ch-dist-foot { display: none; }

/* ---------- 20) 减少动效兜底 ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
