/* ============================================================
   chain.css —— 产业链分级页样式
   复用 qing「AI制药产业大脑」设计语言（配合 companies.css 基座）
   配色沿用 qing：算力=橙 / 数据=紫 / 算法=蓝 / 应用=绿
   ============================================================ */

/* ---------- 总览统计（4 列） ---------- */
.ov-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.ov-stats .stat-num { color: var(--color-primary); }

/* ---------- 详情页统计（5 列，取分类主色） ---------- */
.det-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.det-stats .stat-num { color: var(--ac, var(--color-primary)); }

/* ---------- L1 总览卡片 ---------- */
.l1-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.l1-card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.l1-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--ac, var(--color-primary));
}
.l1-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-border-blue);
}
.l1-card-hd { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.l1-card-icon {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: var(--acbg, var(--color-primary-50));
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.l1-card-hd h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; color: var(--color-text); margin-bottom: 3px; }
.l1-card-hd .cdesc { font-size: 12px; color: var(--color-text-secondary); line-height: 1.6; }
.l1-card-stats {
  display: flex; gap: 8px; justify-content: space-between;
  padding: 12px 0 0; border-top: 1px dashed var(--color-border);
  margin-bottom: 12px;
}
.l1-card-stats .k { font-size: 10.5px; color: var(--color-text-muted); margin-bottom: 2px; white-space: nowrap; }
.l1-card-stats .v { font-size: 16px; font-weight: 600; color: var(--ac, var(--color-primary)); font-variant-numeric: tabular-nums; }
.l1-card-l2 { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ov-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--acbg, var(--color-primary-50));
  color: var(--ac, var(--color-primary));
}
.l1-card-btn {
  font-size: 12px; color: var(--color-primary); font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px; transition: gap 0.2s;
  margin-top: auto;
}
.l1-card:hover .l1-card-btn { gap: 8px; }

/* ---------- 详情页：二级分类卡片行（少则撑宽，多则横向滚动） ---------- */
.l2-cards {
  display: flex; gap: 16px;
  overflow-x: auto; overflow-y: hidden;
  padding-bottom: 10px;
}
.l2-cards > .l1-card { flex: 1 1 0; min-width: 260px; }
.l2-cards::-webkit-scrollbar { height: 8px; }
.l2-cards::-webkit-scrollbar-thumb { background: #D8DEE7; border-radius: 999px; }
.l2-cards::-webkit-scrollbar-thumb:hover { background: #C2CBD8; }
.l2-cards::-webkit-scrollbar-track { background: transparent; }
.l1-card-icon.l2-badge { font-size: 12px; font-weight: 600; letter-spacing: -0.2px; color: var(--ac, var(--color-primary)); }
html { scroll-behavior: smooth; }

/* ---------- 详情页头部 ---------- */
.l1-head {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-left: 4px solid var(--ac, var(--color-primary));
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  display: flex; gap: 16px; align-items: flex-start;
  margin-bottom: 24px;
}
.l1-head .h-icon {
  width: 52px; height: 52px; border-radius: 12px; flex: none;
  background: var(--acbg, var(--color-primary-50));
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.l1-head h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.4px; color: var(--color-text); margin-bottom: 6px; }
.l1-head .h-desc { font-size: 13px; color: var(--color-text-secondary); line-height: 1.7; }
.l1-head .h-stats { display: flex; gap: 30px; margin-top: 14px; }
.l1-head .h-stats .k { font-size: 11px; color: var(--color-text-muted); margin-bottom: 2px; }
.l1-head .h-stats .v { font-size: 20px; font-weight: 700; color: var(--ac, var(--color-primary)); font-variant-numeric: tabular-nums; }

/* ---------- L2 区块 ---------- */
.l2-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
}
.l2-hd {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  background: #F8FAFC;
  border-bottom: 1px solid var(--color-border-light);
}
.l2-code {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: var(--radius-sm);
  background: var(--ac, var(--color-primary)); color: #fff;
  font-variant-numeric: tabular-nums;
}
.l2-name { font-size: 15px; font-weight: 600; color: var(--color-text); }
.l2-stat { margin-left: auto; font-size: 12px; color: var(--color-text-muted); }
.l2-stat b { color: var(--color-text-secondary); font-weight: 600; }

/* ---------- L3 分类 ---------- */
.l3-list { padding: 14px 18px; }
.l3-block {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  margin-bottom: 12px;
}
.l3-block:last-child { margin-bottom: 0; }
.l3-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.l3-code { font-size: 12px; font-weight: 600; color: var(--ac, var(--color-primary)); min-width: 48px; font-variant-numeric: tabular-nums; }
.l3-name { font-size: 14px; font-weight: 500; color: var(--color-text); }
.l3-nums { margin-left: auto; font-size: 12px; color: var(--color-text-muted); }
.l3-nums b { color: var(--color-text); font-weight: 600; }

/* ---------- 企业列表 ---------- */
.comp-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 6px;
}
.comp-li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  font-size: 13px;
  transition: all 0.15s;
}
.comp-li:hover { border-color: var(--color-border-blue); background: var(--color-primary-50); }
.comp-li .cn { flex: 1; min-width: 0; font-weight: 500; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 企业名 = 可点击链接 → 企业详情页 */
a.cn { cursor: pointer; transition: color 0.15s; }
a.cn:hover { color: var(--color-primary); text-decoration: underline; }
.comp-li:hover a.cn { color: var(--color-primary); }
.comp-li .cr { flex: none; font-size: 11px; padding: 1px 7px; border-radius: 999px; }
.comp-li .cr.cn-tag { background: var(--color-tag-1-bg); color: var(--color-tag-1-text); }
.comp-li .cr.intl-tag { background: var(--color-tag-2-bg); color: var(--color-tag-2-text); }
.comp-li .cc { flex: none; font-size: 11px; color: var(--color-text-muted); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 侧边栏当前项高亮（补充） ---------- */
.sub-nav a.active { color: var(--color-primary); font-weight: 500; }

/* ============================================================
   总览页统计模块
   ============================================================ */

/* KPI 指标行（6 列） */
.ov-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.ov-kpis .stat-card { padding: 16px 18px; }
.ov-kpis .stat-num { font-size: 30px; margin-bottom: 6px; }
.ov-kpis .stat-label { font-size: 12px; }

/* 面板卡片 */
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.panel-hd { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.panel-hd h3 { font-size: 15px; font-weight: 600; color: var(--color-text); letter-spacing: -0.2px; }
.panel-hd .hint { font-size: 12px; color: var(--color-text-muted); }

.ov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

/* 横向条形行 */
.bar-row {
  display: grid;
  grid-template-columns: 176px 1fr 76px;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}
.struct-row {
  display: grid;
  grid-template-columns: 110px 1fr 76px;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.bar-row .bl, .struct-row .bl {
  font-size: 13px; font-weight: 500; color: var(--color-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.struct-row .bl { white-space: normal; line-height: 1.35; overflow: visible; }
.struct-row .bl small { display: block; font-size: 11px; color: var(--color-text-muted); font-weight: 400; margin-top: 2px; white-space: nowrap; }
.bar-track { display: block; height: 14px; background: #F1F4F8; border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--bc, var(--color-primary)); min-width: 3px; transition: width 0.4s; }
.bar-row .bv, .struct-row .bv { font-size: 13px; font-weight: 600; color: var(--color-text); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.bar-row .bv small { color: var(--color-text-muted); font-weight: 400; font-size: 11px; }

/* 分类结构下钻：分组标题 / 子标题 / 滚动区 */
.scroll-y { max-height: 440px; overflow-y: auto; padding-right: 6px; }
.scroll-y::-webkit-scrollbar { width: 6px; }
.scroll-y::-webkit-scrollbar-thumb { background: #D8DEE7; border-radius: 999px; }
.scroll-y::-webkit-scrollbar-track { background: transparent; }
.scroll-y::-webkit-scrollbar-thumb:hover { background: #C2CBD8; }
.struct-group {
  display: flex; align-items: center; gap: 7px; margin: 16px 0 4px;
  font-size: 12px; font-weight: 600; color: var(--color-text-secondary); letter-spacing: 0.2px;
}
.struct-group:first-child { margin-top: 2px; }
.struct-group .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.struct-group .cnt { font-size: 11px; font-weight: 400; color: var(--color-text-muted); }
.struct-subhd { position: relative; padding-left: 14px; margin: 9px 0 1px; font-size: 11.5px; color: var(--color-text-muted); }
.struct-subhd::before { content: '▸'; position: absolute; left: 2px; top: 0; }
.scroll-y .struct-row { grid-template-columns: 138px 1fr 62px; padding: 5px 0; }
.scroll-y .struct-row .bl { font-size: 12.5px; }

/* 堆叠条（国内 / 国际） */
.legend { display: flex; gap: 18px; font-size: 12px; color: var(--color-text-secondary); margin-bottom: 14px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.stack { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: #F1F4F8; }
.stack .s1 { background: var(--color-tag-1-text); }
.stack .s2 { background: var(--color-tag-2-text); }
.loc-row { display: grid; grid-template-columns: 56px 1fr 108px; align-items: center; gap: 12px; padding: 7px 0; }
.loc-row .bl { font-size: 13px; font-weight: 500; color: var(--color-text); }
.loc-row .bv { font-size: 12px; color: var(--color-text-secondary); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.loc-row.total { border-top: 1px dashed var(--color-border); margin-top: 6px; padding-top: 12px; }

/* 分段切换控件 + 属地柱状图 */
.ov-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 16px; }
.seg { display: inline-flex; background: #F1F4F8; border-radius: 999px; padding: 3px; }
.seg button {
  font-size: 12.5px; color: var(--color-text-secondary); padding: 5px 14px;
  border-radius: 999px; transition: all 0.15s; line-height: 1.4; white-space: nowrap;
}
.seg button:hover { color: var(--color-primary); }
.seg button.active { background: #fff; color: var(--color-primary); font-weight: 500; box-shadow: var(--shadow-sm); }
.loc-empty { font-size: 13px; color: var(--color-text-muted); padding: 18px 0; text-align: center; }
.panel-note { font-size: 12px; line-height: 19px; min-height: 38px; color: var(--color-text-muted); margin: -6px 0 14px; }

/* 排行榜 */
.rank { display: flex; flex-direction: column; gap: 2px; }.rank .r-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13px; transition: background 0.15s; }
.rank .r-item:hover { background: var(--color-primary-50); }
.rank .no { width: 22px; height: 22px; border-radius: 6px; background: #F1F4F8; color: var(--color-text-muted); font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex: none; }
.rank .no.top { background: var(--color-primary); color: #fff; }
.rank .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.rank .nm b { color: var(--color-text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .nm small { color: var(--color-text-muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.rank .tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; flex: none; background: var(--color-primary-50); color: var(--color-primary); }
.rank .val { font-size: 12px; color: var(--color-text-secondary); font-variant-numeric: tabular-nums; flex: none; white-space: nowrap; }

/* 排行 / 跨分类 两栏等高：面板拉伸，内容区自适应（超出则滚动） */
.ov-grid--eq { align-items: stretch; }
.ov-grid--eq > .panel { display: flex; flex-direction: column; }
.ov-grid--eq > .panel > #ov-rank-bars { flex: 1 1 auto; min-height: 0; }
.ov-grid--eq > .panel > .scroll-y { flex: 1 1 auto; min-height: 0; max-height: 520px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .ov-kpis { grid-template-columns: repeat(3, 1fr); }
  .ov-grid { grid-template-columns: 1fr; }
  .l1-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .l1-cards { grid-template-columns: 1fr; }
  .ov-stats { grid-template-columns: repeat(2, 1fr); }
  .det-stats { grid-template-columns: repeat(2, 1fr); }
  .comp-list { grid-template-columns: 1fr; }
  .l1-head .h-stats { flex-wrap: wrap; gap: 18px; }
  .ov-kpis { grid-template-columns: repeat(2, 1fr); }
  .bar-row, .loc-row { grid-template-columns: 48px 1fr 84px; }
}
