/* ========== 设计语言 ==========
 * 配色走"专业工具感"：米色底 + 墨色主文字 + 靛青 accent + 暖橙 highlight
 * 字体：标题用 Fraunces（衬线有性格），正文用 Inter Tight，数据用 JetBrains Mono
 * 整体克制、干净，适合工作场景长时间使用
 */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,500;0,9..144,600&family=Inter+Tight:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --bg: #f7f3ea;
  --bg-card: #fbf8f1;
  --bg-accent: #fef6d8;
  --ink: #1a1a1a;
  --ink-2: #3d3d3d;
  --muted: #8a8275;
  --border: #e0d6c2;
  --border-strong: #b8a986;
  --accent: #1e4a5f;
  --accent-2: #d97533;
  --ok: #426b2f;
  --warn: #b85c00;
  --err: #8b2c2c;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter Tight', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.serif { font-family: 'Fraunces', Georgia, serif; }

button { font-family: inherit; }
input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

/* ========== 布局 ========== */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

/* ========== 顶部 ========== */
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1.5px solid var(--ink);
  margin-bottom: 28px;
  gap: 20px;
  flex-wrap: wrap;
}
.brand .eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.brand h1 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 32px;
  line-height: 1.05;
  margin: 0;
  letter-spacing: -0.01em;
}
.brand h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}
.topbar .nav { display: flex; gap: 10px; flex-wrap: wrap; }

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: transform .08s, box-shadow .15s;
  text-decoration: none;
}
.btn:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--accent-2);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
}
.btn.ghost:hover:not(:disabled) {
  background: var(--bg-accent);
  box-shadow: 3px 3px 0 var(--border-strong);
}
.btn.accent {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: white;
}
.btn.xs { padding: 5px 10px; font-size: 11.5px; }

/* ========== 步骤卡片 ========== */
.step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 18px;
  transition: opacity 0.2s;
}
.step.disabled { opacity: 0.5; pointer-events: none; }
.step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px dashed var(--border);
}
.step-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.step-title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -0.01em;
}
.step-badge {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.step-badge.done { color: var(--ok); border-color: var(--ok); }
.step-body { padding: 20px; }

/* ========== 上传区（紧凑条 + 文件卡片） ========== */
.upload-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.upload-hint {
  color: var(--muted);
  font-size: 11.5px;
}
.file-selected {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg-accent);
  border: 1px solid var(--border-strong);
  flex-wrap: wrap;
}
.file-selected .file-info { flex: 1; min-width: 0; }
.file-selected .file-label {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.file-selected .file-path {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
  word-break: break-all;
}
.file-selected .file-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.file-selected .file-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* 全屏拖拽覆盖层 */
.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.78);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.drop-overlay.hidden { display: none; }
.drop-overlay-inner {
  border: 2px dashed var(--bg);
  padding: 60px 80px;
  text-align: center;
  color: var(--bg);
}
.drop-overlay-icon {
  font-family: 'Fraunces', serif;
  font-size: 72px;
  font-style: italic;
  line-height: 1;
  margin-bottom: 12px;
  color: var(--accent-2);
}
.drop-overlay-text {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 6px;
}
.drop-overlay-hint {
  font-size: 12px;
  color: rgba(251, 248, 241, 0.7);
  letter-spacing: 0.1em;
}

/* ========== 识别结果 ========== */
.info-strip {
  display: flex;
  gap: 18px;
  padding: 10px 14px;
  background: var(--bg-accent);
  border: 1px solid var(--border);
  margin-top: 14px;
  font-size: 12.5px;
  flex-wrap: wrap;
  align-items: center;
}
.info-strip .item {
  display: flex;
  gap: 6px;
  align-items: center;
}
.info-strip .item .label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--muted);
}
.info-strip .item .val {
  font-weight: 600;
  color: var(--ink);
}
.info-strip .item .val.ok { color: var(--ok); }
.info-strip .item .val.warn { color: var(--warn); }

/* 字段映射预览 */
.mapping-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.field-cell {
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 11.5px;
  cursor: pointer;
  transition: transform .08s ease-out, box-shadow .12s ease-out, background .12s;
  user-select: none;
}
.field-cell:hover {
  transform: translate(-1px, -1px);
  box-shadow: 2px 2px 0 var(--border-strong);
  background: var(--bg-card);
}
.field-cell.unmatched:hover { box-shadow: 2px 2px 0 var(--warn); background: #ffe9cf; }
.field-cell.ignored:hover   { box-shadow: 2px 2px 0 var(--muted); }
.field-cell:active {
  transform: translate(1px, 1px);
  box-shadow: 0 0 0 transparent;
  background: var(--bg-accent);
  transition-duration: .04s;
}
.field-cell.unmatched:active { background: #ffd9a8; box-shadow: 0 0 0 transparent; }
.field-cell .source {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}
.field-cell .col-letter {
  display: inline-block;
  padding: 1px 5px;
  background: var(--ink);
  color: var(--bg);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  min-width: 14px;
  text-align: center;
  flex-shrink: 0;
}
.field-cell.unmatched .col-letter { background: var(--warn); }

/* 跨项目忽略次数徽章 */
.ignore-stat-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 6px;
  background: var(--muted);
  color: white;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  border-radius: 1px;
  flex-shrink: 0;
  transition: background .12s, transform .08s;
}
.ignore-stat-badge:hover {
  background: var(--ink);
  transform: translate(-1px, -1px);
}

/* 忽略详情弹窗 */
.ignore-detail-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 400px;
  overflow-y: auto;
}
.ignore-detail-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
  align-items: center;
}
.ignore-detail-list .proj-name { color: var(--ink); font-weight: 500; }
.ignore-detail-list .ignore-col { color: var(--ink-2); }
.ignore-detail-list .ignore-time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.field-cell .src-text {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.field-cell .target {
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
}
.field-cell.unmatched { background: #fff3e5; border-color: var(--warn); }
.field-cell.unmatched .target { color: var(--warn); }
.field-cell.ai { background: #e8f0f3; border-color: var(--accent); }

/* 手动指派：当前项目里由用户手动选定的字段。字典吸纳别名后下次上传将恢复普通样式 */
/* 手动指派：使用绿色系，和未识别（橙黄）+ AI 识别（蓝绿）清楚区分 */
.field-cell.manual {
  background: #e8f1de;
  border-color: var(--ok);
  border-left: 3px solid var(--ok);
}
.field-cell.manual .col-letter { background: var(--ok); }
.field-cell.manual .target { color: var(--ok); font-weight: 600; }
.field-cell.manual:hover { box-shadow: 2px 2px 0 var(--ok); background: #d9e9c7; }
.field-cell.manual:active { background: #c7dcaf; }
.manual-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  background: var(--ok);
  color: white;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.4;
  border-radius: 1px;
  vertical-align: 1px;
}

/* AI 基于手动说明识别的字段 */
.field-cell.has-note {
  border-left: 3px solid var(--accent);
  background: #eff4f7;
}
.field-cell.has-note .col-letter { background: var(--accent); }
.field-cell.has-note .target { color: var(--accent); font-weight: 600; }
.field-cell.has-note:hover { box-shadow: 2px 2px 0 var(--accent); background: #e1ecf1; }

/* 只有手动说明但 AI 没给出 key */
.field-cell.note-only {
  background: #f5f0e1;
  border-color: var(--border-strong);
  border-left: 3px dashed var(--accent);
}
.field-cell.note-only .target { color: var(--ink-2); }

.manual-note-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  background: var(--accent);
  color: white;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.4;
  border-radius: 1px;
  vertical-align: 1px;
  cursor: help;
}
.manual-note-badge.conf-high   { background: var(--ok); }
.manual-note-badge.conf-medium { background: var(--accent); }
.manual-note-badge.conf-low    { background: var(--muted); }
.field-cell.ignored {
  background: repeating-linear-gradient(-45deg, var(--bg), var(--bg) 6px, #ece4d2 6px, #ece4d2 7px);
  border-color: var(--border-strong);
  opacity: 0.85;
}
.field-cell.ignored .src-text { text-decoration: line-through; color: var(--muted); }
.field-cell.ignored .target { color: var(--muted); }
.field-cell.ignored .col-letter { background: var(--muted); }

/* target 行：左边目标 label，右边忽略/取消按钮 */
.field-cell .target-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.field-action {
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  padding: 2px 7px;
  cursor: pointer;
  letter-spacing: 0.05em;
  line-height: 1.3;
}
.field-cell.unmatched .field-action {
  border-color: var(--warn);
  color: var(--warn);
}
.field-cell.unmatched .field-action:hover {
  background: var(--warn);
  color: white;
}
.field-cell.ignored .field-action:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* 映射列表顶部的一行：警告 + 按钮（按钮最右） */
.mapping-header {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.mapping-header .unmatched-warn {
  color: var(--warn);
  font-size: 12px;
  flex: 1;
  min-width: 0;
}

/* ========== Brief 输入 ========== */
textarea.brief {
  width: 100%;
  min-height: 180px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink);
  resize: vertical;
}
textarea.brief:focus { border-color: var(--accent); background: #fff; }

/* 需求分组 */
.chip-group {
  margin-top: 14px;
  padding: 10px 12px 12px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.chip-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.chip-group-head .chip-group-title { flex: 0 0 auto; }
.chip-group-head .chip-group-hint { flex: 1; }
.chip-group-head .group-add-btn { flex: 0 0 auto; }
.chip-group-title {
  font-family: 'Fraunces', serif;
  font-size: 14px;
  font-weight: 500;
}
.chip-group-hint {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.05em;
}
.chip-group-hard    { border-left: 3px solid var(--ink); }
.chip-group-soft    { border-left: 3px solid var(--border-strong); }
.chip-group-exclude { border-left: 3px solid var(--err); background: #fff7f5; }
.chip-group-ai      { border-left: 3px solid var(--accent); background: #f1f6f9; }
.chip-group-condition { border-left: 3px solid var(--accent); }
.chip-group-exclusion { border-left: 3px solid var(--err); background: #fff7f5; }

/* ============ AI 解析 loading 动效 ============ */
.btn.is-loading {
  cursor: progress;
  opacity: 0.9;
  pointer-events: none;
  padding-left: 14px;
}
.btn .btn-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
}
.btn .btn-loading-text { margin-left: 2px; }
.btn .btn-loading-dots::after {
  display: inline-block;
  content: '';
  width: 14px;
  text-align: left;
  animation: loadingDots 1.2s steps(4, end) infinite;
}
@keyframes loadingDots {
  0%   { content: '';     }
  25%  { content: '.';    }
  50%  { content: '..';   }
  75%  { content: '...';  }
  100% { content: '';     }
}

.step-badge.is-loading {
  color: var(--accent);
  border-color: var(--accent);
  animation: badgePulse 1.2s ease-in-out infinite;
}
@keyframes badgePulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* 解析中占位区 */
.brief-loading {
  margin-top: 14px;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}
.brief-loading-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.loading-dot-row { display: inline-flex; gap: 4px; }
.loading-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  animation: bounceDot 1.2s ease-in-out infinite;
}
.loading-dot:nth-child(2) { animation-delay: 0.15s; }
.loading-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounceDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}
.loading-msg {
  font-size: 13px;
  color: var(--ink-2);
  flex: 1;
}
.loading-msg b { color: var(--accent); }
.loading-elapsed {
  font-size: 11px;
  color: var(--muted);
  padding: 2px 6px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.loading-skeleton { display: flex; flex-direction: column; gap: 8px; }
.sk-row { display: flex; gap: 6px; flex-wrap: wrap; }
.sk-chip {
  height: 24px;
  border-radius: 2px;
  background: linear-gradient(90deg, #eee7d7 0%, #f5efdf 50%, #eee7d7 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.sk-chip.w-sm { width: 70px; }
.sk-chip.w-md { width: 120px; }
.sk-chip.w-lg { width: 180px; }
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.loading-tip {
  margin-top: 14px;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.brief-ai-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fdf3f2;
  border: 1px solid var(--err);
  color: var(--err);
  font-size: 12.5px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.brief-ai-error span.mono { font-size: 11px; letter-spacing: 0.05em; }
.brief-ai-ok {
  margin-top: 10px;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.05em;
}

/* chip 的 label / value 都可编辑（虚线下划线） */
.chip.editable .chip-label,
.chip.editable .chip-value {
  cursor: text;
  border-bottom: 1px dotted var(--border-strong);
}
.chip.editable .chip-label:hover,
.chip.editable .chip-value:hover {
  background: rgba(0,0,0,0.05);
}
.chip.chip-condition { background: var(--bg); }
.chip.chip-exclusion { background: #ffe4e4; border-color: var(--err); color: var(--err); }
.chip.chip-exclusion .chip-label { color: var(--err); opacity: 0.7; }

/* 新增条件输入行（每组内置） */
.chip-add-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.chip-add-row input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  font-size: 12.5px;
}
.chip-add-row input:focus { border-color: var(--accent); background: #fff; }

/* 空组态 */
.chip-empty {
  font-size: 11px;
  color: var(--muted);
  padding: 4px 0;
}

/* 行内编辑 input（替代 chip-value 显示） */
.chip.editable .chip-value { cursor: text; border-bottom: 1px dotted var(--border-strong); }
.chip.editable .chip-value:hover { background: rgba(0,0,0,0.04); }
.chip-inline-edit {
  font-family: inherit;
  font-size: 12px;
  padding: 1px 4px;
  border: 1px solid var(--accent-2);
  background: #fff;
  min-width: 100px;
  max-width: 280px;
}
.chip-inline-edit:focus { outline: none; box-shadow: 0 0 0 2px rgba(217, 117, 51, 0.25); }

/* 需求下方的「筛选博主」按钮 */
.brief-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

/* 删除按钮 */
.chip .chip-remove {
  border: none;
  background: transparent;
  color: currentColor;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px 0 6px;
  margin-left: 2px;
  opacity: 0.4;
  transition: opacity .12s;
}
.chip:hover .chip-remove { opacity: 1; }
.chip .chip-remove:hover { color: var(--err); }

/* 条件芯片 */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip.custom { border-style: dashed; }
.chip {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--ink);
  display: inline-flex;
  gap: 6px;
}
.chip .chip-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--muted);
}
.chip.hard { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.hard .chip-label { color: rgba(255,255,255,0.65); }
.chip.soft { background: var(--bg-accent); border-color: var(--accent-2); }
.chip.exclude { background: #ffe4e4; border-color: var(--err); color: var(--err); }
.chip.exclude .chip-label { color: var(--err); opacity: 0.7; }
.chip.ai { background: #e8f0f3; border-color: var(--accent); }

/* ========== 候选表格 ========== */
.candidate-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 12px;
}
.candidate-toolbar .count { color: var(--accent); font-weight: 700; font-size: 13px; }

.candidate-wrap { overflow-x: auto; border: 1px solid var(--border); }
table.candidates {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 900px;
}
.candidates thead th {
  background: var(--ink);
  color: var(--bg);
  padding: 10px 12px;
  text-align: left;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.candidates tbody td {
  padding: 12px;
  border-top: 1px solid var(--border);
  vertical-align: top;
}
.candidates tbody tr:hover { background: var(--bg-accent); }
.candidates tbody tr.selected { background: #fff5e0; }
.candidates .mono-cell { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.candidates .name { font-weight: 600; font-size: 13.5px; }
.candidates .muted { color: var(--muted); font-size: 11.5px; }

/* 推荐等级 */
.grade {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 2px;
  letter-spacing: 0.05em;
  font-family: 'JetBrains Mono', monospace;
}
.grade.推荐 { background: var(--ok); color: white; }
.grade.可选 { background: var(--warn); color: white; }
.grade.备选 { background: var(--muted); color: white; }

.reasons {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 4px;
}
.reasons .pro { color: var(--ok); display: block; }
.reasons .con { color: var(--err); display: block; }

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

/* ========== 导出区 ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.stat-card {
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.stat-card .label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.stat-card .val {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  font-weight: 500;
}

/* ========== 项目列表页 ========== */
.project-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.project-card {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: box-shadow .15s, transform .08s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.project-card:hover {
  box-shadow: 3px 3px 0 var(--accent-2);
  transform: translate(-1px, -1px);
}
.project-card .p-title {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
}
.project-card .p-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.project-card .p-status {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10.5px;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid var(--border-strong);
  width: fit-content;
}
.project-card .p-status.draft { color: var(--muted); }
.project-card .p-status.in_progress { color: var(--warn); border-color: var(--warn); }
.project-card .p-status.completed { color: var(--ok); border-color: var(--ok); }

.project-card.new-project {
  background: var(--bg);
  border: 1.5px dashed var(--border-strong);
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 110px;
}
.project-card.new-project:hover { border-color: var(--accent-2); }
.project-card.new-project .plus {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  color: var(--accent);
  font-style: italic;
}
.project-card.new-project .text { color: var(--muted); font-size: 13px; }

/* ========== 对话框 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1.5px solid var(--ink);
  max-width: 500px;
  width: 100%;
  box-shadow: 6px 6px 0 rgba(26, 26, 26, 0.28), 0 24px 60px -20px rgba(26, 26, 26, 0.45);
  animation: modalRise .14s ease-out;
}
@keyframes modalRise {
  from { transform: translateY(6px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}
.modal-head {
  padding: 14px 20px;
  border-bottom: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-head .title {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 500;
}
.modal-close {
  background: transparent;
  color: var(--bg);
  border: none;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.modal-body { padding: 20px; }
.modal-body .field {
  margin-bottom: 14px;
}
.modal-body .field-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.modal-body input[type="text"],
.modal-body input[type="password"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  font-size: 13px;
}
.modal-body input:focus { border-color: var(--accent); background: #fff; }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ========== Toast ========== */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 300;
  max-width: 90%;
}
#toast.show { opacity: 1; }
#toast.err { background: var(--err); }
#toast.ok { background: var(--ok); }

/* ========== 空状态 ========== */
.empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--border);
  background: var(--bg);
}

/* ========== 达人单元格：头像 + 名字超链接 ========== */
.kol-cell {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.kol-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  color: var(--ink-2, #555);
}
.kol-avatar.fallback {
  background: var(--bg-accent, #fef6d8);
}
.kol-cell-text { min-width: 0; flex: 1; }
.kol-name-wrap { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.kol-name-link {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
}
.kol-name-link:hover {
  color: var(--accent, #1e4a5f);
  border-bottom-color: var(--accent, #1e4a5f);
}
.kol-link-tag {
  font-size: 11px;
  color: var(--muted);
  cursor: help;
}
/* 排重名单弹窗：每条 */
.bl-list .bl-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 5px 6px;
  font-size: 13px;
  border-bottom: 1px dashed var(--border);
}
.bl-list .bl-no {
  color: var(--muted);
  font-size: 11px;
  min-width: 32px;
  text-align: right;
}
.bl-list mark {
  background: #fff3a3;
  color: inherit;
  padding: 0 1px;
  font-weight: 600;
}

/* chip 编辑 popover */
.chip-edit-pop {
  position: absolute;
  z-index: 1000;
  min-width: 360px;
  max-width: 720px;
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 6px 22px rgba(0,0,0,0.18);
  padding: 10px 12px;
  font-size: 12.5px;
}
.chip-edit-pop .chip-edit-head {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}
.chip-edit-pop .chip-edit-body { margin-bottom: 8px; }
.chip-edit-pop .chip-edit-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

/* 候选 toolbar 搜索框 + 下拉 */
.kol-search-input {
  padding: 5px 10px;
  font-size: 12.5px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: #fff;
  width: 240px;
  outline: none;
  transition: border-color 120ms;
}
.kol-search-input:focus { border-color: var(--accent, #1e4a5f); }
.kol-search-pop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 100;
  width: 360px;
  max-height: 380px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.kol-search-empty {
  padding: 14px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.kol-search-item {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.kol-search-item:last-child { border-bottom: none; }
.kol-search-item:hover { background: var(--bg-accent, #fef6d8); }
.kol-search-item.in-list { opacity: 0.55; }
.kol-search-ava {
  width: 32px; height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid var(--border);
}
.kol-search-ava.fb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-accent, #fef6d8);
  color: var(--ink-2, #555);
  font-weight: 600;
  font-size: 13px;
}
.kol-search-meta { flex: 1; min-width: 0; }
.kol-search-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

/* 整行可点击 */
.candidates tbody tr { cursor: pointer; }
.candidates tbody tr a, .candidates tbody tr button, .candidates tbody tr input { cursor: default; }
.candidates tbody tr a, .candidates tbody tr .kol-name-link { cursor: pointer; }

/* 手动添加博主: hover 显示删除按钮 */
.candidates td.td-check {
  position: relative;
  vertical-align: top;
  padding-top: 14px;
}
.cand-del-btn {
  display: none;
  position: absolute;
  left: 50%;
  top: 36px;
  transform: translateX(-50%);
  width: 22px; height: 22px;
  padding: 0;
  border: 1px solid #d97533;
  background: #fff5e0;
  color: #d97533;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  font-weight: 600;
}
.cand-del-btn:hover { background: #d97533; color: #fff; }
.candidates tbody tr.is-manual:hover .cand-del-btn { display: inline-flex; align-items: center; justify-content: center; }
.candidates tbody tr.is-manual {
  background: rgba(30, 74, 95, 0.04);
}
.candidates tbody tr.is-manual td:first-child::before {
  content: "+";
  position: absolute;
  left: 4px; top: 4px;
  font-size: 10px;
  color: var(--accent, #1e4a5f);
  font-weight: 700;
}

/* 排重清单命中：行、徽章 */
.candidates tbody tr.is-blocklisted {
  background: rgba(217, 117, 51, 0.06);
  outline: 1px solid rgba(217, 117, 51, 0.25);
  outline-offset: -1px;
}
.candidates tbody tr.is-blocklisted td { opacity: 0.78; }
.candidates tbody tr.is-blocklisted .kol-name-link {
  color: #b85525;
  border-bottom-color: transparent;
}
.kol-blocklist-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  margin-left: 4px;
  background: #fbe8d4;
  color: #b85525;
  border: 1px solid #f0c89a;
  border-radius: 2px;
  font-weight: 500;
  white-space: nowrap;
}

.kol-tags { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 3px; }
.kol-tags .chip {
  padding: 1px 6px;
  font-size: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink-2);
  border-radius: 2px;
}

/* ========== 达人详情 popover ========== */
.kol-detail-pop {
  position: absolute;
  z-index: 1000;
  width: 780px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 6px 22px rgba(0,0,0,0.18);
  padding: 0;
  font-size: 12px;
  line-height: 1.5;
}
/* 头部 145×145 头像右上角背景, 左侧文字 */
.kol-detail-pop .pop-head {
  display: flex;
  align-items: stretch;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.kol-detail-pop .pop-head-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
/* 头像：右上角固定 155×155 正方形(1:1)，不随内容拉伸 */
.kol-detail-pop .pop-head-avatar {
  flex: 0 0 auto;
  align-self: flex-start;
  width: 155px;
  height: 155px;
}
.kol-detail-pop .pop-head-avatar a { display: block; width: 155px; height: 155px; }
.kol-detail-pop .pop-head-avatar img,
.kol-detail-pop .pop-head-avatar .pop-avatar-fallback {
  width: 155px;
  height: 155px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}
.kol-detail-pop .pop-head-avatar .pop-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-accent);
  color: var(--muted);
  font-size: 38px;
  font-weight: 600;
}
.kol-detail-pop .pop-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.kol-detail-pop .pop-name {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kol-detail-pop .pop-subname {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}
.kol-detail-pop .pop-grade-line {
  display: flex;
  align-items: center;
  gap: 6px;
}
.kol-detail-pop .pop-grade {
  display: inline-block;
  padding: 1px 10px;
  border-radius: 10px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}
.kol-detail-pop .pop-score-pct { font-size: 13px; font-weight: 700; color: var(--ink); }
.kol-detail-pop .pop-score-raw { font-size: 10.5px; color: var(--muted); }

/* 头部右侧的"基础信息"小条 (多个 chip 横排) */
.kol-detail-pop .pop-basics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 6px;
}
.kol-detail-pop .pop-basic {
  font-size: 11.5px;
  color: var(--ink);
  white-space: nowrap;
}
.kol-detail-pop .pop-basic-k {
  color: var(--muted);
  margin-right: 3px;
  font-size: 10.5px;
}

/* 主体两列网格: 左窄右宽 (左侧字段标签简单, 右侧多是 type/tags 等长内容) */
.kol-detail-pop .pop-grid {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
}
.kol-detail-pop .pop-cell {
  padding: 10px 14px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.kol-detail-pop .pop-cell:nth-child(2n) { border-right: none; }
.kol-detail-pop .pop-cell:nth-last-child(-n+2) { border-bottom: none; }

/* 报价红字 */
.kol-detail-pop .pop-price-red {
  color: #d23a3a;
  font-weight: 700;
}

/* 通用 section（受众/评分明细单列） */
.kol-detail-pop .pop-section {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}
.kol-detail-pop .pop-section:last-child { border-bottom: none; }
.kol-detail-pop .pop-section-title,
.kol-detail-pop .pop-cell .pop-section-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
  padding-bottom: 2px;
  border-bottom: 1px dashed var(--border);
}
.kol-detail-pop table.pop-kv {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
}
.kol-detail-pop table.pop-kv td {
  padding: 1.5px 0;
  vertical-align: top;
  word-break: break-word;
}
.kol-detail-pop table.pop-kv td:first-child {
  width: 78px;
  color: var(--muted);
  white-space: nowrap;
  font-size: 10.5px;
}
.kol-detail-pop .pop-link { color: var(--accent, #1e4a5f); text-decoration: none; }
.kol-detail-pop .pop-aud-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}
.kol-detail-pop .pop-aud-tag {
  font-size: 10.5px;
  color: var(--muted);
  min-width: 30px;
}
.kol-detail-pop .pop-reasons .pop-reason {
  font-size: 11.5px;
  padding: 2px 0;
}
.kol-detail-pop .pop-reasons .pop-reason.pro { color: var(--ok, #2a8a4a); }
.kol-detail-pop .pop-reasons .pop-reason.con { color: var(--err, #d97533); }

/* 评分明细表 */
.kol-detail-pop .pop-bd {
  width: 100%;
  font-size: 11px;
  border-collapse: collapse;
}
.kol-detail-pop .pop-bd thead th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  padding: 3px 4px 3px 0;
  font-size: 10.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
/* 最后一列 (得分/权重) 右对齐 + 固定列宽不被压缩 */
.kol-detail-pop .pop-bd thead th:last-child,
.kol-detail-pop .pop-bd tbody td:last-child {
  text-align: right;
  white-space: nowrap;
  width: 78px;
  min-width: 78px;
  padding-left: 8px;
  padding-right: 4px;
}
.kol-detail-pop .pop-bd tbody td {
  padding: 3px 4px 3px 0;
  vertical-align: top;
  border-bottom: 1px dashed var(--border);
}
.kol-detail-pop .pop-bd tr.g-pos { background: rgba(42,138,74,0.04); }
.kol-detail-pop .pop-bd tr.g-neg { background: rgba(217,117,51,0.06); }
.kol-detail-pop .pop-bd .bd-dim { font-weight: 600; color: var(--ink); white-space: nowrap; }
.kol-detail-pop .pop-bd .bd-actual { color: var(--ink); }
.kol-detail-pop .pop-bd .bd-expected { color: var(--muted); font-size: 10.5px; }
.kol-detail-pop .pop-bd .bd-gain {
  text-align: right;
  white-space: nowrap;
  font-weight: 600;
}
.kol-detail-pop .pop-bd tr.g-pos .bd-gain { color: var(--ok, #2a8a4a); }
.kol-detail-pop .pop-bd tr.g-neg .bd-gain { color: var(--err, #d97533); }
.kol-detail-pop .pop-bd .bd-weight {
  font-weight: 400;
  color: var(--muted);
  margin-left: 1px;
}

/* 头像点击链接 */
.kol-avatar-link {
  display: inline-block;
  flex-shrink: 0;
  text-decoration: none;
  border-radius: 50%;
  transition: transform 120ms;
}
.kol-avatar-link:hover { transform: scale(1.05); }
.kol-avatar-link .kol-avatar { cursor: pointer; }

/* ========== 粉丝年龄堆叠条 ========== */
.age-bar {
  display: inline-flex;
  width: 700px;
  min-width: 700px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  cursor: help;
  font-family: 'JetBrains Mono', monospace;
}
.age-seg {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #fff;
  font-size: 10px;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  transition: filter 120ms ease;
}
.age-seg:hover { filter: brightness(1.1); }
.age-seg .age-seg-pct {
  font-size: 11px;
  font-weight: 600;
}
.age-seg .age-seg-key {
  font-size: 8.5px;
  opacity: 0.85;
}

/* ========== 导出预览表格 ========== */
.preview-table {
  border-collapse: collapse;
  font-size: 12px;
  width: max-content;
  min-width: 100%;
}
.preview-table th, .preview-table td {
  border: 1px solid var(--border);
  padding: 5px 8px;
  text-align: left;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-table th {
  background: var(--ink);
  color: var(--bg);
  position: sticky;
  top: 0;
  z-index: 1;
}
.preview-table th .ph-text {
  font-weight: 500;
  font-size: 12px;
}
.preview-table th .ph-key {
  font-size: 10px;
  color: rgba(255,255,255,0.65);
  font-weight: 400;
  margin-top: 1px;
}
.preview-table tbody tr:nth-child(even) { background: rgba(0,0,0,0.02); }
.preview-table .cell-empty {
  color: var(--muted);
  background: repeating-linear-gradient(
    45deg, transparent, transparent 4px,
    rgba(0,0,0,0.03) 4px, rgba(0,0,0,0.03) 8px
  );
}

/* ========== 候选 toolbar：sticky 始终可见 ========== */
.candidate-toolbar.sticky-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-card, #fff);
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* ========== 候选表头：可点击排序 + 阈值徽章 ========== */
/* 表头本身是深色底白色字（见 .candidates thead th），所以 hover/active 都要在深底上做高亮，
   不能用浅色，否则白字会消失。 */
.candidates th.th-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: relative;
  transition: background 120ms ease, color 120ms ease;
}
.candidates th.th-sort:hover {
  background: var(--ink-2);                 /* 比 ink 略亮的深色 */
  color: var(--bg-accent);                  /* 暖白色，比纯白更醒目 */
}
.candidates th.th-sort:hover .th-thr {
  color: var(--bg-accent);
  opacity: 0.85;
}
.candidates th.sort-active {
  background: var(--accent-2);              /* 当前排序列：橙色高亮 */
  color: #fff;
}
.candidates th.sort-active:hover {
  background: var(--accent-2);
  color: #fff;
  filter: brightness(1.08);
}
.candidates th.sort-active .th-thr {
  color: rgba(255, 255, 255, 0.82);
}
.candidates th .th-thr {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
  letter-spacing: 0.04em;
  text-transform: none;
}

/* ========== Brief 新增条件：标签下拉 + 值多选 ========== */
.chip-add-row select.group-add-label {
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  min-width: 160px;
  margin-right: 8px;
}
.chip-add-row .group-add-value-wrap {
  display: inline-block;
  margin-right: 8px;
}
.chip-add-row .group-add-value-wrap input[type="text"] {
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 4px;
  min-width: 220px;
}
.vchk-shell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  background: #fafafa;
  max-width: 760px;
}
.vchk-search {
  padding: 4px 10px;
  font-size: 12.5px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 120ms;
}
.vchk-search:focus { outline: none; border-color: var(--accent, #1e4a5f); }
.vchk-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: flex-start;
  /* 容下 ≈ 200 个常见标签的折行后高度; 超出再滚 */
  max-height: 420px;
  overflow-y: auto;
  padding: 2px;
}
.vchk-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.vchk mark {
  background: #fff3a3;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
  font-weight: 600;
}
/* 搜索时：命中项加底色边框、未命中淡化但仍可见 */
.vchk.vchk-hit {
  background: #fff8d6;
  outline: 1px solid #f0c84e;
  border-radius: 3px;
}
.vchk.vchk-dim { opacity: 0.45; }
.vchk.vchk-dim:hover { opacity: 1; }   /* 鼠标悬停恢复, 方便 still 选 */

/* ========== 数值输入 + 快捷符号按钮 ========== */
.num-shell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: 720px;
}
.num-shell input.group-add-value {
  flex: 1 1 240px;
  min-width: 220px;
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
}
.num-quick {
  display: inline-flex;
  gap: 2px;
}
.num-quick button {
  padding: 3px 9px;
  font-size: 13px;
  font-family: 'JetBrains Mono', 'PingFang SC', monospace;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  border-radius: 3px;
  min-width: 30px;
  user-select: none;
}
.num-quick button:hover {
  background: var(--bg-accent);
  border-color: var(--accent, #1e4a5f);
}
.num-hint {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 11.5px;
  padding-top: 2px;
  line-height: 1.4;
}
.vchk {
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}
.vchk input { margin: 0; }
.vthr-hint {
  font-size: 11px;
  color: var(--muted);
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}
/* 达人类型 AND/OR 切换 */
.vchk-mode {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  margin-left: 12px;
  padding: 2px 8px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  background: #fff;
}
.vchk-mode:hover { background: var(--bg-accent, #fef6d8); }
.vchk-mode input[type=checkbox] { margin: 0; }

/* ========== Error panel（异常展示） ========== */
.err-panel {
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid #fbb6b6;
  background: #fff5f5;
  border-radius: 6px;
  color: #5a1f1f;
  font-size: 13px;
}
.err-panel .err-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: #b91c1c;
}
.err-panel .err-msg {
  margin: 4px 0 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.err-panel .err-line {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 2px 0;
  font-size: 12px;
}
.err-panel .err-line .err-k {
  flex: 0 0 64px;
  color: #88595d;
}
.err-panel code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  background: #fde8e8;
  padding: 1px 6px;
  border-radius: 3px;
  word-break: break-all;
}
.err-panel .err-details {
  margin-top: 10px;
}
.err-panel .err-details summary {
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: #88595d;
}
.err-panel .err-details pre {
  margin-top: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid #f3c8c8;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
  color: #4a1717;
}
.err-panel .err-foot {
  margin-top: 10px;
  font-size: 11.5px;
  color: #88595d;
}

/* ========== Utilities ========== */
.hidden { display: none !important; }
.loading {
  display: inline-block;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 登录页 ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-card);
  border: 1.5px solid var(--ink);
  padding: 32px 28px;
  box-shadow: 6px 6px 0 var(--border);
}
.login-card .field-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  font-size: 13px;
  box-sizing: border-box;
}
.login-card input:focus { border-color: var(--accent); background: #fff; outline: none; }

/* ============ 顶栏用户区 ============ */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
}
.user-chip .user-name {
  font-size: 12px;
  color: var(--ink-2);
  padding: 3px 8px;
  background: var(--bg-accent);
  border: 1px solid var(--border);
}

/* ============ 详情浮层：标签区 ============ */
.pop-tags .tagrow { margin-bottom: 8px; }
.pop-tags .tagrow:last-child { margin-bottom: 0; }
.tagrow-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.tagrow-k {
  font-family: 'JetBrains Mono', monospace; font-size: 10.5px;
  color: var(--muted); letter-spacing: 0.04em;
}
.tag-edit-btn {
  border: 1px solid var(--border-strong); background: var(--bg);
  color: var(--accent); font-size: 10.5px; padding: 1px 7px; cursor: pointer;
  border-radius: 3px; line-height: 1.5;
}
.tag-edit-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.tagrow-v { display: flex; flex-wrap: wrap; gap: 4px; }
.tagchip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-accent); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 7px; font-size: 11.5px; color: var(--ink-2);
}

/* ============ 详情浮层：受众画像紧凑网格 ============ */
.pop-aud-time {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--muted); font-weight: 400; margin-left: 6px;
}
.aud-grid { display: flex; flex-direction: column; gap: 5px; }
.aud-row { display: flex; align-items: baseline; gap: 8px; }
.aud-k {
  flex: 0 0 48px; font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; color: var(--muted); text-align: right;
}
.aud-v { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.aud-chip {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 3px; padding: 0 6px; font-size: 11.5px; color: var(--ink-2);
}
.aud-chip b { font-weight: 600; color: var(--ink); }
.gender-mini { display: inline-flex; align-items: center; gap: 8px; }
.gm-bar {
  display: inline-block; width: 70px; height: 7px; border-radius: 4px;
  background: #5b8fb9; overflow: hidden; position: relative;
}
.gm-bar i { display: block; height: 100%; background: #d96b9a; }
.gm-txt { font-size: 11.5px; color: var(--ink-2); }

/* 表格里的紧凑年龄 */
.age-mini { font-size: 12px; white-space: nowrap; }
.age-mini b { font-weight: 600; }

/* ============ 标签编辑弹层 ============ */
.tag-selected-box {
  display: flex; flex-wrap: wrap; gap: 5px; min-height: 34px;
  padding: 6px 8px; border: 1px solid var(--border-strong); background: var(--bg);
}
.tagchip.removable { background: var(--bg-accent); border-color: var(--border-strong); }
.tagchip .tc-x {
  border: none; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 14px; line-height: 1; padding: 0 0 0 2px;
}
.tagchip .tc-x:hover { color: var(--err); }
.tag-options-box {
  display: flex; flex-wrap: wrap; gap: 5px; max-height: 240px; overflow-y: auto;
  padding: 8px; border: 1px solid var(--border); background: var(--bg-card);
}
.tagchip.selectable { cursor: pointer; }
.tagchip.selectable:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.tagchip.selectable:hover .tc-n { color: #e6eef2; }
.tagchip .tc-n {
  font-family: 'JetBrains Mono', monospace; font-size: 9.5px;
  color: var(--muted); margin-left: 3px;
}
.tagchip.addnew {
  cursor: pointer; background: #eaf4ee; border-color: var(--ok); color: var(--ok);
}
.tagchip.addnew:hover { background: var(--ok); color: #fff; }
#tagEditModal input[type="text"] {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong);
  background: var(--bg); font-size: 13px; box-sizing: border-box;
}
#tagEditModal input[type="text"]:focus { border-color: var(--accent); background: #fff; outline: none; }

/* ============ 头部左侧内联标签（名称✎：chip 自然换行） ============ */
.kol-detail-pop .pop-tags-inline {
  margin-top: 7px; display: flex; flex-direction: column; gap: 4px;
}
.kol-detail-pop .tagline { display: flex; align-items: baseline; gap: 2px; font-size: 12px; line-height: 1.6; }
.kol-detail-pop .tagline-k {
  flex: 0 0 auto; white-space: nowrap;
  font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--muted);
}
.kol-detail-pop .tagk { color: var(--muted); }
.kol-detail-pop .tagk.edit { cursor: pointer; color: var(--accent); }
.kol-detail-pop .tagk.edit:hover { color: var(--accent-2); }
.kol-detail-pop .tagk-ico { margin-left: 2px; font-size: 10px; opacity: 0.75; }
.kol-detail-pop .tagline-v { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

/* ============ 受众画像 mini 柱状图 ============ */
.kol-detail-pop .pop-aud-hint {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--muted); font-weight: 400; margin-left: 6px;
}
/* 画像卡片：单行横向滚动，不换行（省竖向空间，滚轮可左右滑） */
.kol-detail-pop .aud-cards {
  display: flex; flex-wrap: nowrap; gap: 8px;
  overflow-x: auto; overflow-y: hidden; padding-bottom: 5px;
  scrollbar-width: thin;
}
.kol-detail-pop .aud-cards::-webkit-scrollbar { height: 6px; }
.kol-detail-pop .aud-cards::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.kol-detail-pop .aud-card {
  flex: 0 0 auto; padding: 3px 8px 3px; border: 1px solid var(--border);
  border-top: 2px solid var(--border-strong);   /* 顶部色条=维度配色(内联覆盖) */
  border-radius: 3px; background: var(--bg-card);
}
/* 标题=image 概览("上海居多"), 居中、维度配色(内联) */
.kol-detail-pop .aud-card-img {
  font-size: 10.5px; font-weight: 600; text-align: center; max-width: 120px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 3px;
}
/* 柱状图方块：相对定位 + 顶部预留 16px 色带，类别名浮在右上角(距角 2px) */
.kol-detail-pop .aud-bars {
  position: relative; display: flex; align-items: flex-end;
  gap: 6px; height: 64px; padding-top: 16px; box-sizing: border-box;
}
.kol-detail-pop .aud-cat {
  position: absolute; top: 2px; right: 2px; z-index: 2; pointer-events: none;
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  color: var(--muted); line-height: 1; white-space: nowrap;
  background: var(--bg-card); padding: 0 1px; border-radius: 2px;
}
.kol-detail-pop .mb-col {
  display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; min-width: 28px;
}
.kol-detail-pop .mb-pct {
  font-family: 'JetBrains Mono', monospace; font-size: 9.5px;
  color: var(--ink-2); line-height: 1; margin-bottom: 2px;
}
.kol-detail-pop .mb-bar {
  width: 16px; background: linear-gradient(180deg, var(--accent), #3d7a93);
  border-radius: 2px 2px 0 0;
}
.kol-detail-pop .mb-key {
  font-size: 9px; color: var(--muted); margin-top: 3px;
  max-width: 44px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 受众画像 跟随光标的即时浮层 */
.aud-tip {
  position: fixed; z-index: 1200; pointer-events: none;
  background: #1f1f1f; color: #fff; border-radius: 5px;
  padding: 7px 10px; font-size: 11.5px; line-height: 1.55;
  box-shadow: 0 6px 18px rgba(0,0,0,0.32);
  max-width: 260px; max-height: 60vh; overflow: hidden;
}
.aud-tip .audtip-h { font-weight: 600; margin-bottom: 4px; color: #ffd9a8; }
.aud-tip .audtip-row { display: flex; justify-content: space-between; gap: 18px; }
.aud-tip .audtip-row .mono { color: #ffd9a8; font-family: 'JetBrains Mono', monospace; }

/* ============ 搜索条件历史（筛选按钮前的 5 个版本） ============ */
.brief-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-history { display: flex; align-items: center; gap: 6px; flex: 1; flex-wrap: wrap; min-width: 0; }
.search-history .sh-title {
  font-size: 10.5px; color: var(--muted); letter-spacing: 0.04em; white-space: nowrap;
}
.sh-chip {
  display: inline-flex; align-items: center; gap: 5px;
  max-width: 200px; padding: 3px 8px; font-size: 11.5px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--ink-2);
  border-radius: 3px; line-height: 1.4; overflow: hidden; white-space: nowrap;
}
.sh-chip:hover { border-color: var(--accent); color: var(--accent); }
.sh-chip.active { border-color: var(--accent-2); background: var(--bg-accent); color: var(--ink); font-weight: 600; }
.sh-chip .sh-ts { font-size: 9.5px; color: var(--muted); }
.sh-chip.active .sh-ts { color: var(--accent-2); }
.sh-chip .sh-meta { font-size: 9.5px; color: var(--muted); }

/* 撤销按钮（在「新增」旁） */
.group-undo-btn { color: var(--accent-2); }
.group-undo-btn:disabled { color: var(--muted); opacity: 0.5; cursor: default; }

/* 画像浮层里的 description 一行 */
.aud-tip .audtip-desc { color: #e8d9c0; margin-bottom: 5px; max-width: 240px; white-space: normal; }
