:root {
  --bg: #f4f5f9;
  --card: #ffffff;
  --text: #17181c;
  --text-secondary: #6f7684;
  --border: #e8eaf0;
  --primary: #ff2442;
  --primary-deep: #e11d3a;
  --primary-light: #fff0f2;
  --primary-grad: linear-gradient(135deg, #ff2442 0%, #ff5e3a 100%);
  --ink: #1b1d29;
  --ink-2: #23263a;
  --success: #0e9f6e;
  --warning: #c27803;
  --danger: #d92638;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(23, 24, 28, 0.04), 0 4px 16px rgba(23, 24, 28, 0.06);
  --shadow-hover: 0 4px 8px rgba(23, 24, 28, 0.06), 0 12px 32px rgba(23, 24, 28, 0.12);
  --shadow-red: 0 6px 18px rgba(255, 36, 66, 0.32);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(255, 36, 66, 0.05), transparent 60%),
    radial-gradient(900px 420px at -10% 30%, rgba(83, 74, 183, 0.05), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

::selection { background: rgba(255, 36, 66, 0.18); }

.app {
  display: flex;
  min-height: 100vh;
}

/* ===== 侧边栏：深色玻璃质感 ===== */
.sidebar {
  width: 248px;
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 10;
  box-shadow: 4px 0 24px rgba(20, 22, 35, 0.18);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); }

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(400px 220px at 20% -5%, rgba(255, 36, 66, 0.22), transparent 65%),
    radial-gradient(300px 260px at 110% 105%, rgba(255, 94, 58, 0.12), transparent 60%);
  pointer-events: none;
}

.brand {
  padding: 22px 22px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  position: relative;
  z-index: 1;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: var(--primary-grad);
  color: white;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  box-shadow: var(--shadow-red);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.brand-title-wrap {
  flex: 1;
  min-width: 0;
}

.brand p {
  margin: 3px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
}

.nav {
  padding: 16px 12px;
  flex: 1;
  position: relative;
  z-index: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border-radius: 11px;
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  margin-bottom: 5px;
  transition: all 0.2s ease;
  font-size: 14px;
  position: relative;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  transform: translateX(2px);
}

.nav-item.active {
  background: var(--primary-grad);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-red);
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.sidebar-footer .btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.78);
}

.sidebar-footer .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.sidebar-footer .btn-danger {
  background: rgba(255, 36, 66, 0.12);
  border-color: rgba(255, 36, 66, 0.35);
  color: #ff8095;
}

.sidebar-footer .btn-danger:hover {
  background: rgba(255, 36, 66, 0.22);
  color: #ffa3b2;
}

/* ===== 数据备份面板（仅 admin） ===== */
.backup-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 10px 8px;
  margin: 4px 0;
}
.backup-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}
.backup-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.3px;
}
.backup-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.backup-list::-webkit-scrollbar { width: 6px; }
.backup-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
.backup-empty {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  padding: 8px 4px;
}
.backup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 7px;
  padding: 6px 8px;
}
.backup-item-info { min-width: 0; flex: 1; }
.backup-item-name {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}
.backup-item-meta {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 2px;
  line-height: 1.4;
}
.backup-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}
.tag-manual { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.tag-auto { background: rgba(37, 99, 235, 0.18); color: #93c5fd; }
.tag-restored { background: rgba(251, 191, 36, 0.18); color: #fcd34d; }
.backup-hint {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 6px;
  line-height: 1.45;
}
.btn-xs {
  padding: 4px 9px;
  font-size: 11px;
  border-radius: 6px;
}

/* ===== 主区域 ===== */
.main {
  margin-left: 248px;
  flex: 1;
  padding: 32px 36px 48px;
  max-width: calc(100vw - 248px);
}

.section { display: none; }
.section.active { display: block; animation: sectionIn 0.32s ease; }

@keyframes sectionIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  margin-bottom: 26px;
}

.section-header h2 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.3px;
  position: relative;
  display: inline-block;
}

.section-header h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 38px;
  height: 4px;
  border-radius: 4px;
  background: var(--primary-grad);
}

.section-header p { margin-top: 14px; }

.text-muted {
  color: var(--text-secondary);
  margin: 0;
}

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 26px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.25s ease;
}

.mt-4 { margin-top: 24px; }

.chart-wrap {
  position: relative;
  height: 340px;
  margin-top: 16px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chart-header h3 { margin: 0; }

.form-select-sm {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  max-width: 160px;
}

/* ===== 指标卡 ===== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.metric-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 22px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-grad);
  opacity: 0.9;
}

.metric-card:nth-child(2)::before { background: linear-gradient(135deg, #6a5af9, #a48bff); }
.metric-card:nth-child(3)::before { background: linear-gradient(135deg, #0e9f6e, #34d399); }
.metric-card:nth-child(4)::before { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.metric-card:nth-child(5)::before { background: linear-gradient(135deg, #ec4899, #f472b6); }
.metric-card:nth-child(6)::before { background: linear-gradient(135deg, #06b6d4, #22d3ee); }
.metric-card:nth-child(7)::before { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.metric-card:nth-child(8)::before { background: linear-gradient(135deg, #f97316, #fb923c); }

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.metric-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-weight: 500;
}

.metric-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.metric-value-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 24px;
  line-height: 1.25;
}

.metric-value-sub {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.metric-trend {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ===== 账号卡 ===== */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 16px;
}

.account-card {
  background: linear-gradient(180deg, #fbfbfd 0%, #f5f6fa 100%);
  border-radius: 18px;
  padding: 26px;
  border: 1px solid var(--border);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  position: relative;
  overflow: hidden;
}

.account-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--primary-grad);
}

.account-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* 三账号卡片颜色区分 */
.account-card-renxiao {
  background: linear-gradient(180deg, #fff8f9 0%, #fff0f2 100%);
  border-color: rgba(255, 80, 110, 0.22);
}
.account-card-renxiao::before { background: linear-gradient(90deg, #ff2442, #ff6b6b); }
.account-card-renxiao:hover { border-color: rgba(255, 36, 66, 0.4); }
.account-card-renxiao h4::before {
  background: linear-gradient(135deg, #ff2442, #ff6b6b);
  box-shadow: 0 0 0 3px rgba(255, 36, 66, 0.16);
}
.account-card-renxiao .account-stat-value { color: #d91e3a; }

.account-card-hegui {
  background: linear-gradient(180deg, #f5f8ff 0%, #e8efff 100%);
  border-color: rgba(66, 133, 244, 0.22);
}
.account-card-hegui::before { background: linear-gradient(90deg, #4285f4, #5c9dff); }
.account-card-hegui:hover { border-color: rgba(66, 133, 244, 0.4); }
.account-card-hegui h4::before {
  background: linear-gradient(135deg, #4285f4, #5c9dff);
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.16);
}
.account-card-hegui .account-stat-value { color: #2b6de6; }

.account-card-out2china {
  background: linear-gradient(180deg, #fffaf3 0%, #fff2e0 100%);
  border-color: rgba(255, 152, 0, 0.22);
}
.account-card-out2china::before { background: linear-gradient(90deg, #ff9800, #ffc46b); }
.account-card-out2china:hover { border-color: rgba(255, 152, 0, 0.4); }
.account-card-out2china h4::before {
  background: linear-gradient(135deg, #ff9800, #ffc46b);
  box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.16);
}
.account-card-out2china .account-stat-value { color: #e68600; }

.account-card h4 {
  margin: 0 0 18px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-card h4::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary-grad);
  box-shadow: 0 0 0 4px rgba(255, 36, 66, 0.14);
}

.account-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px 14px;
}

.account-stat { display: flex; flex-direction: column; gap: 4px; }

.account-stat-value {
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.account-stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* 账号卡内板块分隔 */
.account-section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 22px 0;
}

.account-section-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  color: #d91e3a;
  background: rgba(255, 36, 66, 0.08);
  white-space: nowrap;
}

.section-tag-natural {
  color: #0e9f6e;
  background: rgba(14, 159, 110, 0.08);
}

.section-tip {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
  min-width: 200px;
}

.account-stats-sub {
  gap: 14px 10px;
}

.account-stats-sub .account-stat-value {
  font-size: 20px;
  font-weight: 700;
}

.account-stats-sub .account-stat-label {
  font-size: 12px;
}

/* ===== 上传区 ===== */
.upload-area {
  border: 2px dashed #d8dce6;
  border-radius: var(--radius);
  padding: 42px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.22s ease;
  margin-bottom: 20px;
  background:
    radial-gradient(300px 120px at 50% 0%, rgba(255, 36, 66, 0.035), transparent 70%),
    #fcfcfe;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 36, 66, 0.10);
}

.upload-icon {
  font-size: 30px;
  color: #fff;
  margin: 0 auto 12px;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--primary-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-red);
}

.upload-area p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.upload-row .upload-area { margin-bottom: 0; }

/* ===== 工具栏 / 表单控件 ===== */
.toolbar {
  display: flex;
  gap: 12px;
  margin: 22px 0;
  align-items: center;
  flex-wrap: wrap;
}

.review-range-label {
  margin-left: auto;
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.form-input,
.form-select {
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: #fff;
  color: var(--text);
  min-width: 140px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 36, 66, 0.10);
}

/* ===== 按钮 ===== */
.btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary-grad);
  color: white;
  box-shadow: 0 4px 14px rgba(255, 36, 66, 0.28);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(255, 36, 66, 0.42);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: white;
  border-color: #dcdfe8;
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.btn-danger {
  background: #fff0f1;
  border-color: #ffd2d8;
  color: var(--danger);
}

.btn-danger:hover { background: #ffe4e7; }

.btn-sm { padding: 7px 13px; font-size: 13px; }

/* ===== 表格 ===== */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.data-table {
  width: auto;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}

.data-table th,
.data-table td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table th {
  background: #f8f9fc;
  font-weight: 700;
  color: var(--text-secondary);
  position: sticky;
  top: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 11px 12px;
}

/* 线索表「咨询方向」列：宽度上限 + 溢出 ellipsis；hover 通过 title 看完整内容 */
.data-table td.consult_direction {
  cursor: help;
  width: 100px;
  max-width: 110px;
}
.data-table td.consult_direction .cell-ellipsis,
.data-table td.plan_name .cell-ellipsis {
  display: block;
  width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 计划名称选中提示徽章 */
#plan-date-hint.form-hint,
#creative-date-hint.form-hint {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #E0F2FE;
  color: #0369A1;
  font-size: 12px;
  line-height: 1.6;
}
#plan-date-hint.form-hint[data-out="1"],
#creative-date-hint.form-hint[data-out="1"] {
  background: #FEF3C7;
  color: #92400E;
}

/* 线索表「相关性」列：着色区分强/相/弱/错配 */
.data-table td.relevance {
  font-weight: 600;
  white-space: nowrap;
}
.data-table td.relevance.rel-strong { color: #10B981; }
.data-table td.relevance.rel-ok { color: #2563EB; }
.data-table td.relevance.rel-weak { color: #F97316; }
.data-table td.relevance.rel-mismatch { color: #EF4444; }

/* 发布表「笔记主题」下拉宽度收敛，避免撑破布局 */
.pub-topic-select { min-width: 96px; padding: 4px 6px; font-size: 13px; }

/* 复盘 D3 笔记标题下的主题标签 + 相关性细胞 */
.chain-table .note-topic {
  display: inline-block;
  margin-top: 2px;
  font-size: 11px;
  color: #2563EB;
  background: #EFF4FF;
  border-radius: 4px;
  padding: 1px 6px;
}
.chain-table .rel-cell { white-space: nowrap; color: #666; font-size: 12px; }

/* 发布数据：列宽严格按内容自适应，只在必要列留极小保底 */
.data-table td:first-child,
.data-table th:first-child { min-width: 90px; }
/* 笔记标题列：约可显示 20 个中文字符 */
.data-table td:nth-child(2),
.data-table th:nth-child(2) { min-width: 250px; max-width: 340px; }
.data-table td:last-child,
.data-table th:last-child { min-width: 40px; width: 40px; }

.data-table tbody tr { transition: background 0.15s ease; }
.data-table tbody tr:hover { background: var(--primary-light); }

/* 让短内容列紧紧贴合文字，input 默认宽度不再撑开列 */
.data-table td {
  width: 0.1%;
}

/* ===== 登录页 ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #162545 0%, #2D456D 100%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px;
  width: 340px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.login-brand-title { font-size: 22px; margin: 0; font-weight: 700; color: var(--ink); letter-spacing: 0.3px; line-height: 1.2; }
.login-card-subtitle { font-size: 12px; color: var(--text-secondary); margin: 0 0 18px 50px; line-height: 1.5; }
.login-card h3 { margin: 16px 0 14px; font-size: 15px; color: var(--ink); }
.login-card .form-input { width: 100%; margin-bottom: 12px; box-sizing: border-box; }
.login-card .btn-block { width: 100%; }
.login-msg { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ===== 当前用户角标 ===== */
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: center;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
}
.user-badge .badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

.data-table td input {
  width: auto;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 5px 6px;
  font-size: 13px;
  white-space: nowrap;
  box-sizing: border-box;
  /* 让 input 宽度完全跟随文字内容 */
  field-sizing: content;
}

/* 笔记标题 input 允许显示约 20 个字符 */
.data-table td:nth-child(2) input {
  min-width: 240px;
}

.data-table td select {
  width: auto;
  min-width: 0;
  padding: 5px 6px;
  font-size: 12px;
}

/* 账号标签：只读展示 */
.account-tag {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 20px;
  background: #f3f4f6;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.account-tag.tag-renxiao { background: #fff0f2; color: #ff2442; }
.account-tag.tag-hegui { background: #e8f0ff; color: #4285f4; }
.account-tag.tag-out2china { background: #fff2e0; color: #ff9800; }

.data-table td.first_contact_time {
  white-space: nowrap;
  width: 0.1%;
}

.data-table td input:focus {
  outline: none;
  background: white;
  box-shadow: inset 0 0 0 1.5px var(--primary);
  border-radius: 6px;
}

.data-table .actions { display: flex; gap: 6px; }

.data-table .actions button {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
}

.data-table .actions button:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* ===== 表单布局 ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

.form-group label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

/* ===== 推广计划卡 ===== */
.promotion-card {
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--border);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.22s ease, border-color 0.22s ease;
}

.promotion-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: rgba(255, 36, 66, 0.22);
}

.promotion-header {
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: var(--card);
  border-left: 4px solid transparent;
  transition: border-color 0.2s ease;
}

.promotion-card:hover .promotion-header,
.promotion-card.expanded .promotion-header {
  border-left-color: var(--primary);
}

.promotion-title { font-weight: 700; font-size: 14px; }

.promotion-meta {
  display: flex;
  gap: 22px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  flex-wrap: wrap;
}

.promotion-meta span strong {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.promotion-body { display: none; padding: 0 18px 18px; }
.promotion-card.expanded .promotion-body { display: block; animation: sectionIn 0.25s ease; }

.promotion-toggle {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--primary-light);
  white-space: nowrap;
}

.promotion-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.plan-delete-btn {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 8px;
  line-height: 1;
}

.creative-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: #fafbfd;
  border-radius: 10px;
  overflow: hidden;
}

.creative-table th,
.creative-table td {
  padding: 9px 11px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.creative-table th {
  background: #f0f2f7;
  font-weight: 700;
  color: var(--text-secondary);
}

/* 创意表「操作」列：窄列 + 紧凑删除按钮 */
.creative-table .creative-op-col {
  width: 64px;
  text-align: center;
}
.creative-table .creative-delete-btn {
  padding: 4px 9px;
  font-size: 12px;
  border-radius: 7px;
  line-height: 1;
}

/* ===== 复盘 ===== */
.review-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.review-card {
  background: #fbfbfd;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 18px;
}

.review-card h4 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-card h4::before {
  content: "";
  width: 4px;
  height: 14px;
  border-radius: 4px;
  background: var(--primary-grad);
}

.review-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.review-table th,
.review-table td {
  padding: 9px 11px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.review-table th {
  background: #f0f2f7;
  font-weight: 700;
  color: var(--text-secondary);
}

/* ===== 标签页 ===== */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  background: #eef0f5;
  padding: 5px;
  border-radius: 12px;
  width: fit-content;
}

.tab {
  padding: 9px 18px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.tab:hover { color: var(--text); }

.tab.active {
  background: #fff;
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(23, 24, 28, 0.08);
}

.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-secondary);
}

/* ===== 徽章 ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success { background: #e3f7ef; color: #0b6b4b; }
.badge-warning { background: #fdf0dc; color: #8a5306; }
.badge-danger { background: #ffe8ea; color: #ab1626; }
.badge-info { background: #e5f0fd; color: #1355a8; }
.badge-video { background: #ffe6f2; color: #b31572; }
.badge-mixed { background: #efe7fd; color: #5a2e91; }
.badge-article { background: #e3f2fd; color: #0d5a9e; }
.badge-default { background: #eef0f5; color: var(--text-secondary); }
.badge-date { background: #e8f0ff; color: #2f62c9; }

/* ===== 吐司 ===== */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 13px 22px;
  background: var(--ink);
  color: white;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(20, 22, 35, 0.3);
  z-index: 1000;
  display: none;
  font-weight: 500;
}

.toast.show { display: block; animation: toastIn 0.28s ease; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== 灵感雷达 ===== */
.radar-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 8px;
}

.radar-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.radar-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(255, 36, 66, 0.22);
}

.radar-card-video {
  flex-direction: row;
  align-items: flex-start;
  gap: 14px;
}

.radar-cover {
  flex-shrink: 0;
  width: 160px;
  height: 90px;
  border-radius: 10px;
  overflow: hidden;
  background: #eceef3;
  box-shadow: 0 4px 12px rgba(23, 24, 28, 0.12);
}

.radar-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.radar-card:hover .radar-cover img { transform: scale(1.06); }

.radar-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.radar-play { color: var(--primary); font-weight: 600; }

.radar-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.radar-source {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: auto;
}

.radar-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
}

.radar-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.radar-topic {
  font-size: 12px;
  color: var(--primary-deep);
  background: var(--primary-light);
  padding: 7px 11px;
  border-radius: 8px;
  font-weight: 500;
}

.radar-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  font-size: 12px;
  color: #9aa1af;
}

.card-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.card-link:hover { text-decoration: underline; }

/* ===== 内容拆解 · 二创工坊 ===== */
.dec-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.dec-head { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.dec-title { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.dec-preview { font-size: 13px; margin: 0 0 8px; color: var(--text-secondary); }

.dec-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed #dde1ea;
}

.dec-section h5 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--primary-deep);
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
}

.dec-list { margin: 0; padding-left: 18px; }
.dec-list li { margin-bottom: 7px; line-height: 1.65; }
.dec-titles li { display: flex; align-items: center; gap: 8px; justify-content: space-between; }

.btn-mini {
  padding: 3px 12px;
  font-size: 12px;
  border: 1px solid #dcdfe8;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  font-weight: 500;
  transition: all 0.16s ease;
}

.btn-mini:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.dec-angle {
  background: #fafbfd;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 15px;
  margin-bottom: 9px;
  transition: border-color 0.18s ease;
}

.dec-angle:hover { border-color: rgba(255, 36, 66, 0.3); }
.dec-angle-rec {
  background: linear-gradient(135deg, #fff5f6, #fff);
  border-color: rgba(255, 36, 66, 0.35);
}

.dec-angle p { margin: 4px 0 0; font-size: 13px; color: #5b6270; line-height: 1.65; }

.dec-outline-item { display: flex; gap: 11px; margin-bottom: 11px; align-items: flex-start; }

.dec-step {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-grad);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  box-shadow: 0 3px 8px rgba(255, 36, 66, 0.28);
}

.dec-outline-item p { margin: 2px 0 0; font-size: 13px; color: #5b6270; line-height: 1.65; }

/* ===== 内容复盘建议 ===== */
.review-suggestions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: #fafbfd;
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.18s ease;
}

.review-item:hover { border-color: rgba(255, 36, 66, 0.25); }
.review-item .badge { flex-shrink: 0; white-space: nowrap; }

.review-tip {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
}

.radar-card, .review-item { animation: fadeIn 0.25s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 数据新鲜度（总览账号卡） ===== */
.account-freshness { margin-top: 10px; padding-top: 8px; border-top: 1px dashed #e3e7ee; font-size: 12px; color: #6b7686; }
.freshness-warn { color: #d97706; font-weight: 600; }
.freshness-ok { color: #0f9d6e; }

/* ===== 复盘内容归因 ===== */
.attr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.attr-col h5 { margin: 0 0 10px; }
.attr-card { border: 1px solid #e3e7ee; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.attr-good { border-left: 4px solid #0f9d6e; }
.attr-bad { border-left: 4px solid #e23e57; }
.attr-head { font-weight: 600; font-size: 13.5px; }
.attr-head a { color: #1f2733; text-decoration: none; }
.attr-head a:hover { color: #e23e57; }
.attr-meta { color: #6b7686; font-size: 12px; margin: 4px 0 6px; }
.attr-row { font-size: 12.5px; margin: 4px 0; }
.attr-tips { margin: 4px 0; padding-left: 18px; font-size: 12px; }
.attr-titles { margin: 4px 0 0; padding-left: 18px; font-size: 12.5px; }
@media (max-width: 900px) { .attr-grid { grid-template-columns: 1fr; } }

/* ===== 推广计划 - 上传前置设置 ===== */
.import-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 22px;
  padding: 16px 18px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, #fff8f9 0%, #f8faff 100%);
  border: 1.5px dashed rgba(255, 36, 66, 0.3);
  border-radius: 13px;
}

.import-step { display: flex; align-items: center; gap: 9px; }

.import-step label {
  font-size: 13px;
  color: #4a5568;
  white-space: nowrap;
  font-weight: 500;
}

.import-step .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-grad);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(255, 36, 66, 0.28);
}

.import-step.step-hint label { color: #8a94a6; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #d3d7e0;
  border-radius: 8px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #b8bdc9; }

/* ===== 响应式 ===== */
@media (max-width: 1200px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: repeat(3, 1fr); }
  .account-grid { grid-template-columns: repeat(2, 1fr); }
  .account-stats { grid-template-columns: repeat(2, 1fr); }
  .review-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .radar-grid { grid-template-columns: 1fr; }
}

/* ===== 每周复盘 · AI 分析卡片 ===== */
.weekly-analysis-root { margin-top: 24px; }

.weekly-analysis-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.weekly-analysis-header h4 { margin: 0; font-size: 16px; }

.weekly-analysis-loading {
  padding: 26px;
  text-align: center;
  color: var(--text-secondary);
  background: linear-gradient(180deg, #fbfbfd 0%, #f5f6fa 100%);
  border-radius: 14px;
  border: 1px dashed var(--border);
}

.weekly-analysis-error {
  padding: 26px;
  text-align: center;
  color: var(--danger);
  background: linear-gradient(180deg, #fff5f5 0%, #fff0f0 100%);
  border-radius: 14px;
  border: 1px dashed var(--danger);
}

.weekly-analysis-error p {
  margin: 10px 0 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

.weekly-analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.weekly-analysis-card {
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.weekly-analysis-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.weekly-analysis-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.analysis-renxiao { background: linear-gradient(180deg, #fff8f9 0%, #ffffff 100%); border-color: rgba(255, 80, 110, 0.2); }
.analysis-renxiao::before { background: linear-gradient(90deg, #ff2442, #ff6b6b); }

.analysis-hegui { background: linear-gradient(180deg, #f5f8ff 0%, #ffffff 100%); border-color: rgba(66, 133, 244, 0.2); }
.analysis-hegui::before { background: linear-gradient(90deg, #4285f4, #5c9dff); }

.analysis-out2china { background: linear-gradient(180deg, #fffaf3 0%, #ffffff 100%); border-color: rgba(255, 152, 0, 0.2); }
.analysis-out2china::before { background: linear-gradient(90deg, #ff9800, #ffc46b); }

.analysis-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.analysis-card-header h5 { margin: 0; font-size: 15px; }
.analysis-card-header .text-muted { font-size: 12px; }

.analysis-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.badge-lead { background: #e6f7ed; color: #1e8b4c; }
.badge-mid { background: #eef4ff; color: #2b6de6; }
.badge-weak { background: #fff0f1; color: #c41e35; }

.analysis-summary {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.analysis-metrics {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.analysis-metrics div {
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,0.7);
  border-radius: 9px;
  padding: 8px 4px;
  text-align: center;
  border: 1px solid rgba(0,0,0,0.04);
}
.analysis-metrics b { font-size: 15px; color: var(--text); }
.analysis-metrics span { font-size: 11px; color: var(--text-secondary); white-space: nowrap; }

.analysis-section { margin-bottom: 14px; }
.analysis-section:last-child { margin-bottom: 0; }
.analysis-section h6 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.analysis-section ul {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-secondary);
}
.analysis-section li { margin-bottom: 4px; }

/* ===== 转化漏斗 ===== */
.funnel-wrap { margin: 4px 0 8px; }
.funnel-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.funnel-label {
  width: 78px; flex: 0 0 78px; display: flex; flex-direction: column; align-items: flex-end;
}
.funnel-label span { font-size: 11px; color: var(--text-secondary); }
.funnel-label b { font-size: 14px; color: var(--text); }
.funnel-bar-track {
  flex: 1; position: relative; height: 26px; background: #f3f4f6; border-radius: 6px; overflow: hidden;
}
.funnel-bar {
  height: 100%; border-radius: 6px; transition: width .3s ease; min-width: 2px;
}
.funnel-rate {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: #fff; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.funnel-bottleneck {
  font-size: 12px; color: #b45309; background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 8px; padding: 8px 10px; line-height: 1.6;
}
.funnel-bottleneck b { color: #b45309; }

/* ===== 推广消费分析 ===== */
.spend-insight {
  font-size: 12px; line-height: 1.7; color: var(--text-secondary);
  background: #f0f7ff; border: 1px solid #cfe3ff; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px;
}
.spend-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.spend-table th {
  text-align: left; padding: 5px 6px; color: var(--text-secondary); font-weight: 600;
  border-bottom: 1px solid var(--border); background: #fafafa;
}
.spend-table td { padding: 5px 6px; border-bottom: 1px solid #f0f0f0; color: var(--text); }
.spend-table .spend-name {
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600;
}

/* ===== 每日推广联动表：卡片式数据面板 ===== */
.daily-overview-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  table-layout: fixed;
}

.daily-overview-table th,
.daily-overview-table td {
  padding: 14px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.daily-overview-table th {
  background: #fff;
  font-weight: 700;
  color: var(--text);
  padding: 16px 10px;
}

.daily-overview-table tbody tr:last-child td { border-bottom: none; }

.daily-overview-table tbody tr { transition: background 0.15s ease; }
.daily-overview-table tbody tr:hover { background: #fafbfc; }

/* 表头：日期 */
.daily-date-head {
  width: 90px;
  background: #f8f9fc !important;
  color: var(--text-secondary);
  font-size: 12px;
  letter-spacing: 0.4px;
}

/* 表头：账号列 */
.daily-account-head {
  position: relative;
  width: 18%;
  padding: 14px 10px;
}
.daily-account-head::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  border-radius: 2px 2px 0 0;
}
.daily-account-head.daily-account-renxiao {
  background: linear-gradient(180deg, #fff0f2 0%, #fff5f6 60%, #fff 100%);
}
.daily-account-head.daily-account-renxiao::before { background: linear-gradient(90deg, #ff2442, #ff6b6b); }
.daily-account-head.daily-account-hegui {
  background: linear-gradient(180deg, #e8f0ff 0%, #f0f6ff 60%, #fff 100%);
}
.daily-account-head.daily-account-hegui::before { background: linear-gradient(90deg, #4285f4, #5c9dff); }
.daily-account-head.daily-account-out2china {
  background: linear-gradient(180deg, #fff2e0 0%, #fff7ed 60%, #fff 100%);
}
.daily-account-head.daily-account-out2china::before { background: linear-gradient(90deg, #ff9800, #ffc46b); }

.daily-account-head .daily-account-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 4px;
}
.daily-account-head .daily-account-title::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.8);
}
.daily-account-head.daily-account-renxiao .daily-account-title::before { background: linear-gradient(135deg, #ff2442, #ff6b6b); }
.daily-account-head.daily-account-hegui .daily-account-title::before { background: linear-gradient(135deg, #4285f4, #5c9dff); }
.daily-account-head.daily-account-out2china .daily-account-title::before { background: linear-gradient(135deg, #ff9800, #ffc46b); }

.daily-account-sub {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* 表头：合计 */
.daily-total-head {
  width: 16%;
  background: linear-gradient(180deg, #1b1d29 0%, #2a2d42 100%) !important;
  color: #fff !important;
  font-size: 14px;
}

/* 日期单元格 */
.daily-date-cell {
  background: #f8f9fc;
  width: 90px;
}
.daily-weekday {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.daily-day {
  font-size: 12px;
  color: var(--text-secondary);
}

/* 今天高亮 */
.daily-overview-table tbody tr.daily-today .daily-date-cell {
  background: #eef6ff;
}
.daily-overview-table tbody tr.daily-today .daily-weekday {
  color: #2563eb;
}
.daily-overview-table tbody tr.daily-today {
  box-shadow: inset 4px 0 0 #2563eb;
}

/* 数据单元格 */
.daily-account-cell {
  width: 18%;
}
.daily-total-cell {
  width: 16%;
  background: #f8f9fc;
}

.daily-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.daily-cost {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.daily-total-cell .daily-cost { color: var(--text); }

.daily-valid-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 20px;
  background: #e6f7f1;
  color: #0e9f6e;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.daily-empty {
  color: #c4c8d0;
  font-size: 13px;
  font-weight: 500;
}

/* 账号数据列 subtle 左边色条 */
.daily-account-cell.daily-account-renxiao { border-left: 3px solid rgba(255, 36, 66, 0.12); }
.daily-account-cell.daily-account-hegui { border-left: 3px solid rgba(66, 133, 244, 0.12); }
.daily-account-cell.daily-account-out2china { border-left: 3px solid rgba(255, 152, 0, 0.12); }

/* 单账号视图：每日推广明细（lead 一眼看到每天的消费/客资） */
.daily-metric-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  padding: 14px 20px;
  letter-spacing: 0.4px;
}
.daily-metric-cell {
  text-align: center;
  padding: 18px 20px;
  vertical-align: middle;
}
.daily-metric-cell.daily-metric-cost {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: -0.2px;
}
.daily-metric-cell.daily-metric-valid {
  font-size: 18px;
  font-weight: 700;
  color: #0e9f6e;
  letter-spacing: -0.2px;
}
.daily-cost-val {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  color: #1f2937;
}
.daily-valid-badge {
  display: inline-block;
  min-width: 28px;
  padding: 4px 10px;
  background: linear-gradient(135deg, #10b981, #0e9f6e);
  color: #fff;
  border-radius: 12px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.18);
  margin-right: 4px;
}
.daily-valid-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* 让单账号视图的"日期"列也居中更醒目 */
.daily-overview-table.is-single .daily-date-cell {
  text-align: center;
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
}
.daily-overview-table.is-single .daily-weekday {
  font-size: 14px;
  color: var(--text);
  font-weight: 700;
}
.daily-overview-table.is-single .daily-day {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.daily-overview-table.is-single tr.daily-today .daily-date-cell {
  background: linear-gradient(135deg, #eef2ff 0%, #fef9ec 100%);
  color: #1d4ed8;
}
.daily-overview-table.is-single tr.daily-today .daily-weekday {
  color: #1d4ed8;
}

/* 卡片头部行 */
.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.card-header-row h3 { margin-bottom: 4px; }
.card-header-row .text-muted { margin: 0; }

.daily-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.daily-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.daily-legend span::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.daily-legend-cost::before { background: #6b7280; }
.daily-legend-valid::before { background: #0e9f6e; }

/* ===== 分页控件 ===== */
.pagination-wrap { margin-top: 14px; }

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.pagination-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-btns .btn {
  min-width: 64px;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pagination-btns .btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.pagination-btns .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f8f9fc;
}

.pagination-current {
  min-width: 32px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 6px 10px;
  border-radius: 8px;
}

@media (max-width: 1200px) {
  .weekly-analysis-grid { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { width: 100%; position: relative; height: auto; }
  .main { margin-left: 0; max-width: 100%; padding: 20px; }
  .app { flex-direction: column; }
  .metrics-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: 1fr; }
  .upload-row { grid-template-columns: 1fr; }
  .radar-card-video { flex-direction: column; }
  .radar-cover { width: 100%; height: auto; aspect-ratio: 16/9; }
  .weekly-analysis-grid { grid-template-columns: 1fr; }
}

/* ============ 横向对比 ============ */
.compare-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.compare-table th, .compare-table td { padding: 10px 12px; text-align: center; border-bottom: 1px solid #eef0f4; }
.compare-table thead th { background: #f7f8fc; color: #444; font-weight: 700; position: sticky; top: 0; }
.compare-table th.cmp-metric { text-align: left; background: #fbfbfe; color: #333; font-weight: 600; white-space: nowrap; }
.compare-table tbody tr:hover td { background: #fafbff; }
.compare-table .text-muted { font-weight: 400; font-size: 12px; }

/* ============ 改进计划 上周 vs 本周 ============ */
.plan-wow-block { margin-top: 28px; }
.plan-wow-block > h4 { font-size: 17px; margin-bottom: 4px; }
.plan-wow-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 12px; }
.plan-wow-card { border: 1px solid #eceef3; border-radius: 12px; padding: 14px; background: #fff; }
.plan-wow-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.plan-wow-head b { font-size: 15px; }
.plan-wow-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plan-wow-col-title { font-size: 13px; font-weight: 700; color: #555; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px dashed #e3e6ee; }
.plan-wow-col ul { margin: 0; padding-left: 18px; }
.plan-wow-col li { font-size: 13px; line-height: 1.7; color: #333; }
.wow-new { color: #b8430f; }
.wow-keep { color: #1f7a4d; }
.wow-drop { color: #9aa0aa; text-decoration: line-through; }
.wow-tag { font-size: 11px; padding: 0 5px; border-radius: 6px; margin-left: 4px; font-weight: 700; }
.wow-tag.wow-tag-new { background: #fde8d8; color: #b8430f; }
.wow-tag.wow-tag-drop { background: #eef0f4; color: #8a909a; }
.wow-tag.wow-tag-keep { background: #e3f5ec; color: #1f7a4d; }
.analysis-renxiao { border-left: 4px solid #ff2442; }
.analysis-hegui { border-left: 4px solid #3b82f6; }
.analysis-out2china { border-left: 4px solid #f59e0b; }

/* ============ 全链路诊断 D1-D7 模块 ============ */
.chain-block {
  margin-top: 24px;
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px 22px;
  box-shadow: 0 2px 12px rgba(20, 22, 35, 0.06);
}
.chain-block-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
  padding-left: 10px;
  border-left: 4px solid #162545;
}
.chain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
}
.chain-card {
  background: #f8fafc;
  border: 1px solid #eef0f4;
  border-radius: 10px;
  padding: 12px 14px;
}
.chain-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed #d1d8e3;
}
.chain-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
  background: #fafbfd;
  border: 1px dashed #e6e9ef;
  border-radius: 8px;
}
.chain-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 12px;
}
.chain-table caption {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 0;
  caption-side: top;
}
.chain-table th, .chain-table td {
  padding: 5px 6px;
  text-align: left;
  border-bottom: 1px solid #eef0f4;
}
.chain-table th {
  background: #f1f4f9;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11px;
}
.chain-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.chain-table .danger { color: #ef4444; font-weight: 700; }
.chain-table .success { color: #10b981; font-weight: 700; }
.chain-table .muted { color: #9aa0aa; font-size: 11px; }
.chain-table .note-title {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chain-bottleneck {
  margin-top: 6px;
  padding: 6px 10px;
  background: #fff7ed;
  border-left: 3px solid #f97316;
  font-size: 12px;
  color: #9a3412;
  border-radius: 4px;
}
.chain-tail {
  margin-top: 10px;
  padding: 8px 12px;
  background: #f0f9ff;
  border-left: 3px solid #2563eb;
  font-size: 12px;
  color: #1e40af;
  border-radius: 4px;
}
.funnel-row.danger .funnel-bar { box-shadow: 0 0 0 1px #ef4444; }

/* D4-D6 客户画像分布 mini bar */
.dist-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.dist-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.dist-name {
  flex: 0 0 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.dist-track {
  flex: 1;
  position: relative;
  background: #eef0f4;
  border-radius: 8px;
  height: 22px;
  overflow: hidden;
}
.dist-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  border-radius: 8px;
}
.dist-count {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 700;
  color: #fff;
  font-size: 11px;
  padding-left: 4px;
}
.dist-valid {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: #10b981;
  font-weight: 600;
  background: rgba(255,255,255,.85);
  padding: 0 4px;
  border-radius: 3px;
}
.dist-total {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed #d1d8e3;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: right;
}

/* D7 节奏 */
.rhythm-table .rhythm-day { font-weight: 600; color: var(--ink-2); }
.rhythm-table td.rhythm-bar { min-width: 140px; padding-right: 8px; position: relative; }
.rhythm-table td.rhythm-bar::before { content: ''; display: block; }
.rhythm-pub, .rhythm-lead {
  display: inline-block;
  height: 10px;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 2px;
}
.rhythm-pub { background: linear-gradient(90deg, #a5b4fc, #6366f1); }
.rhythm-lead { background: linear-gradient(90deg, #fde68a, #f59e0b); }


/* 运营贡献榜 / 归因对账 */
.contribution-card { overflow: hidden; }
.reconcile-strip {
  display:flex; flex-wrap:wrap; gap:6px; margin:8px 0 12px;
}
.reconcile-strip span {
  padding:5px 8px; background:#f6f7f9; border:1px solid #e5e7eb;
  border-radius:6px; font-size:11px; color:var(--text-secondary);
}
.reconcile-strip b { color:var(--text); margin-left:2px; }
.contrib-badge {
  display:inline-block; padding:2px 6px; border-radius:10px; font-size:10px; font-weight:700;
  white-space:nowrap;
}
.contrib-badge.good { background:#ecfdf3; color:#047857; }
.contrib-badge.mid { background:#fff7ed; color:#b45309; }
.contrib-badge.weak { background:#fef2f2; color:#b91c1c; }
.reconcile-note {
  margin-top:10px; padding:8px 10px; background:#f8fafc; border-left:3px solid #94a3b8;
  color:var(--text-secondary); font-size:11px; line-height:1.6;
}
