:root {
  --bg: #f5f7fa;
  --card: #fff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --border: #e5e7eb;
  --green: #10b981;
  --red: #ef4444;
  --orange: #f59e0b;
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  line-height: 1.6;
}
.container { max-width: 1320px; margin: 0 auto; padding: 0 16px; }
header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  color: #fff;
  padding: 28px 0;
}
header h1 { margin: 0; font-size: 24px; }
header p { margin: 6px 0 0; opacity: .9; font-size: 14px; }
.tabs {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  overflow-x: auto;
}
.tab-btn {
  background: #eef2f7;
  border: none;
  padding: 10px 28px;
  border-radius: 24px;
  cursor: pointer;
  color: #374151;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  transition: all .15s;
}
.tab-btn:hover { background: #dbe6f5; color: #1e3a5f; }
.tab-btn.active {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .35);
}
main { padding: 24px 16px 40px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.filters input, .filters select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  min-width: 140px;
  height: 38px;
  flex-shrink: 0;
}
.filters input#tutorOrg { min-width: 160px; }
.filter-chip {
  background: #fff; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; height: 38px; min-width: 110px;
  font-size: 14px; cursor: pointer; flex-shrink: 0;
}
.filter-chip:hover { border-color: var(--primary); }
.filter-chip.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.date-panel {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
}
.date-panel input[type="date"] { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; height: 34px; min-width: 140px; }
.date-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.date-range input[type="date"] { min-width: 140px; }
.filters .date-sep {
  color: var(--muted);
  font-size: 14px;
  line-height: 38px;
  user-select: none;
}
.filter-actions {
  display: inline-flex;
  gap: 8px;
}
.filters button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 14px;
  height: 38px;
}
.filters button:hover { background: var(--primary-hover); }
.filters button.secondary { background: #fff; color: var(--muted); border: 1px solid var(--border); }
.filters button.secondary:hover { background: #f3f4f6; color: var(--text); }
.summary {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.table-wrap { width: 100% !important; overflow-x: auto; background: var(--card); border-radius: 12px; border: 1px solid var(--border); }
table { width: 100%; min-width: 100%; border-collapse: collapse; font-size: 14px; table-layout: auto; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: #f9fafb; font-weight: 600; }
td { white-space: normal; } /* 允许非 hl-cell 列换行 */
tr:hover { background: #f9fafb; }
.pager { margin-top: 16px; display: flex; gap: 10px; align-items: center; justify-content: center; }
.pager button {
  background: #fff;
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
}
.pager button:disabled { opacity: .5; cursor: not-allowed; }
.card-list { display: grid; gap: 12px; }
.change-item {
  background: var(--card);
  border-left: 4px solid var(--primary);
  border-radius: 0 12px 12px 0;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.change-item.NEW { border-left-color: var(--green); }
.change-item.STATE_CHANGED { border-left-color: var(--orange); }
.change-item.ORG_CHANGED { border-left-color: var(--red); }
.change-item .title { font-weight: 600; margin-bottom: 4px; }
.change-item .meta { color: var(--muted); font-size: 13px; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  border: 1px solid var(--border);
}
.stat-card .num { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-card .label { color: var(--muted); font-size: 13px; margin-top: 6px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }
ul.stats { list-style: none; padding: 0; margin: 0; }
ul.stats li {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
ul.stats li:last-child { border-bottom: none; }
ul.stats .bar-wrap { flex: 1; margin: 0 12px; background: #edf2f7; border-radius: 4px; height: 8px; }
ul.stats .bar { background: var(--primary); height: 100%; border-radius: 4px; }
footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 16px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.error { color: var(--red); }

/* 状态标签（按辅导阶段着色） */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: #e5e7eb;
  color: #374151;
  white-space: nowrap;
}
.phase-filing { background: #dbeafe; color: #1e40af; }
.phase-tutoring { background: #d1fae5; color: #065f46; }
.phase-exam { background: #ffedd5; color: #9a3412; }
.phase-done { background: #ede9fe; color: #6d28d9; }
.phase-term { background: #fee2e2; color: #991b1b; }
.phase-other { background: #f3f4f6; color: #4b5563; }

/* 统计看板状态列表对齐 */
#stateStats li { align-items: center; }
#stateStats .tag { margin-right: 8px; }

/* 详情弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex;
  align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: min(640px, 100%); max-height: 86vh;
  overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #e5e7eb; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-close { border: none; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: #6b7280; }
.modal-body { padding: 16px 20px 22px; }
.detail-row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #eef0f3; }
.detail-label { flex: 0 0 132px; color: #6b7280; font-size: 13px; padding-top: 2px; }
.detail-value { flex: 1; font-size: 14px; line-height: 1.6; word-break: break-word; }
.detail-value .muted, .muted { color: #b6bcc6; }
.link-btn { border: none; background: none; color: #2563eb; cursor: pointer; padding: 0; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

/* AI 智能分析按钮 + 结果区 */
.ai-btn {
  background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 8px;
  transition: all .15s;
}
.ai-btn:hover { opacity: .85; transform: scale(1.02); }
.ai-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.ai-result-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; padding-bottom: 10px;
  border-bottom: 1px dashed #e5e7eb;
}
.ai-result-header .title { font-weight: 700; font-size: 14px; color: #1e3a5f; }
.ai-result-header .meta { font-size: 12px; color: #6b7280; }
.ai-section { margin-bottom: 18px; padding: 14px 16px; background: #fff; border-radius: 10px; border: 1px solid #e8ecf2; }
.ai-section h4 {
  font-size: 13px; font-weight: 700; color: #2563eb;
  margin: 0 0 10px; padding-left: 10px;
  border-left: 3px solid #2563eb;
  line-height: 1.4;
}
.ai-body { display: flex; flex-direction: column; gap: 4px; }
.ai-body p {
  font-size: 13px; line-height: 1.7; color: #374151;
  margin: 0; word-break: break-word; padding: 6px 10px;
  background: #f8fafc; border-radius: 6px;
}
.ai-kv {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 13px; line-height: 1.6; color: #374151;
  padding: 5px 10px; border-radius: 6px;
}
.ai-kv:nth-child(odd) { background: #f8fafc; }
.ai-kv-label {
  flex: 0 0 auto; font-weight: 700; color: #1e3a5f;
  min-width: 0;
}
.ai-kv-val { flex: 1; color: #4b5563; word-break: break-word; }
.ai-subheading {
  font-size: 12px; font-weight: 700; color: #6366f1;
  padding: 8px 10px 4px; margin-top: 2px;
}
.ai-result {
  border-top: 1px solid #e5e7eb;
  padding: 16px 20px 22px;
  background: #f3f6fa;
}
.ai-loading {
  display: flex; align-items: center; gap: 10px;
  padding: 20px; text-align: center; color: #6b7280; font-size: 13px;
}
.ai-loading-text { flex: 1; }
.ai-loading-time { font-weight: 700; color: #2563eb; font-size: 13px; font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }
.ai-spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid #e5e7eb; border-top-color: #2563eb;
  border-radius: 50%; animation: ai-spin .6s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-error { color: #ef4444; font-size: 13px; padding: 12px; background: #fef2f2; border-radius: 8px; }

/* 项目列表：业务亮点列限宽省略，悬停 title 看全文 */
td.hl-cell { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 表格下方免责注脚 */
p.disclaimer { margin: 10px 0 4px; font-size: 12px; color: #9aa1ab; line-height: 1.6; }

/* ========== 移动端响应式 (≤720px) ========== */
@media (max-width: 720px) {
  .container { padding: 0 10px; }
  header { padding: 18px 0; }
  header h1 { font-size: 18px; }
  header p { font-size: 12px; margin-top: 4px; }
  .tab-btn { padding: 8px 16px; font-size: 15px; }
  .tabs { padding: 8px; gap: 8px; }

  /* 筛选区：两列紧凑网格，缩小控件 */
  .filters { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .filters input, .filters select, .filters .filter-chip {
    width: auto; flex: 1 1 44%; min-width: 0;
    font-size: 12px; padding: 6px 8px; height: 32px;
  }
  .filters input#q { flex: 1 1 100%; }
  .filter-actions { width: 100%; gap: 8px; }
  .filter-actions button { flex: 1; height: 32px; font-size: 13px; }
  .date-panel input[type="date"] { flex: 1; min-width: 0; }
  .date-range { width: 100%; flex-wrap: wrap; gap: 4px; }
  .date-range input[type="date"] { flex: 1; min-width: 0; }

  /* 表格：缩字号、缩 padding；隐藏次要列（业务亮点、融资估值信息） */
  table { font-size: 12px; }
  th, td { padding: 8px 6px; }
  th:nth-child(6), th:nth-child(7),
  td:nth-child(6), td:nth-child(7) { display: none; }
  td.hl-cell { max-width: 160px; }

  /* 详情弹窗：占满宽度 */
  .modal { width: 100%; max-height: 100vh; border-radius: 0; }
  .modal-head { padding: 12px 16px; }
  .modal-body { padding: 12px 16px 20px; }
  .detail-label { flex: 0 0 100px; font-size: 12px; }
  .detail-value { font-size: 13px; }

  /* 统计看板：双列 */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card .num { font-size: 22px; }
  .stat-card .label { font-size: 11px; }
  .two-col { grid-template-columns: 1fr; }

  /* 注脚缩小 */
  p.disclaimer { font-size: 11px; margin: 8px 0 4px; }

  /* footer 字号 */
  footer { font-size: 12px; }
}

/* 统计看板：券商新增辅导排名 */
#stats .filters { justify-content: flex-start; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.range-tabs { display: inline-flex; gap: 6px; }
.range-btn {
  border: 1px solid var(--border); background: #fff; color: #374151;
  padding: 6px 16px; border-radius: 20px; cursor: pointer; font-size: 13px;
}
.range-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.rank-list { list-style: none; padding: 0; margin: 0; }
.rank-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; min-width: 0; }
.rank-cols .rank-list { min-width: 0; }
.rank-cols .rank-list + .rank-list { border-left: 1px solid var(--border); padding-left: 24px; }
/* 移动端保持双列：字号略小避免换行 */
@media (max-width: 720px) {
  .rank-cols { gap: 0 10px; }
  .rank-cols .rank-list + .rank-list { padding-left: 10px; }
  .rank-item { padding: 8px 2px; gap: 5px; min-width: 0; }
  .rank-org { font-size: 12px; max-width: 64px; overflow: hidden; text-overflow: ellipsis; flex: 0 0 auto; }
  .rank-bar { margin: 0 4px; flex: 1 1 auto; min-width: 0; }
  .rank-c { width: 24px; font-size: 12px; flex: 0 0 24px; text-align: right; }
  .rank-no { width: 16px; font-size: 11px; flex: 0 0 16px; }
  #rankTitle { font-size: 15px; }
}
.rank-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.rank-item:hover { background: #f9fafb; }
.rank-no { width: 28px; text-align: center; font-weight: 600; color: #9aa1ab; font-size: 13px; }
.rank-item:nth-child(1) .rank-no { color: #f59e0b; }
.rank-item:nth-child(2) .rank-no { color: #94a3b8; }
.rank-item:nth-child(3) .rank-no { color: #b45309; }
.rank-org { font-size: 14px; white-space: nowrap; flex: 0 0 auto; }
.rank-key { font-weight: 800; color: #1e3a8a; }
.rank-key::after { content: ' ★'; color: #d97706; font-size: 11px; }
.range-total { font-size: 14px; color: #1e3a8a; font-weight: 600; margin: 0 0 12px; padding: 8px 12px; background: #eff6ff; border-radius: 8px; }
.stats-meta { color: var(--text); font-weight: 500; }
#rankTitle { text-align: center; font-size: 18px; margin-bottom: 16px; }
.rank-bar { flex: 1; }
.rank-c { width: 36px; text-align: right; font-weight: 600; color: #2563eb; font-size: 14px; }

/* 统计看板：券商详情 行业/区域可视化（纯 CSS 横向条形图） */
.viz-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.viz-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fbfdff; }
.viz-card h4 { margin: 0 0 10px; font-size: 14px; color: var(--text); }
.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.bar-label { flex: 0 0 96px; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; background: #edf2f7; border-radius: 4px; height: 14px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #2563eb, #4f8df9); border-radius: 4px; min-width: 2px; }
.bar-val { flex: 0 0 28px; text-align: right; font-weight: 600; color: #2563eb; }
@media (max-width: 720px) {
  .viz-row { grid-template-columns: 1fr; gap: 12px; }
  .bar-label { flex-basis: 72px; font-size: 12px; }
}

