:root {
  --color-primary: #1E88E5;
  --color-primary-dark: #1565C0;
  --color-primary-deep: #0D47A1;
  --color-primary-light: #E3F2FD;
  --color-primary-50: #F3F9FD;
  --color-primary-100: #BBDEFB;

  --color-text: #1F2A37;
  --color-text-secondary: #4B5563;
  --color-text-muted: #9CA3AF;
  --color-text-faint: #B0B7C0;

  --color-bg: #F5F7FA;
  --color-surface: #FFFFFF;
  --color-border: #E5E7EB;
  --color-border-light: #F0F2F5;
  --color-border-blue: #BBDEFB;

  --color-success: #2E7D32;
  --color-warning: #ED6C02;
  --color-danger: #D32F2F;

  /* 主题色：团队方法 + 主题领域 */
  --c-louvain: #1E88E5;
  --c-louvain-bg: #E3F2FD;
  --c-lead-core: #2E7D32;
  --c-lead-core-bg: #E8F5E9;
  --c-spectral: #E65100;
  --c-spectral-bg: #FFF3E0;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 2px 6px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 4px 16px rgba(15, 23, 42, 0.08);

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;

  --sidebar-w: 200px;
  --header-h: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum";
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: transparent; }
input, select { font-family: inherit; }

/* ============== Top Header ============== */
.app-header {
  height: var(--header-h);
  background: white;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: var(--sidebar-w);
}
.brand-logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 18px;
  position: relative;
  overflow: hidden;
}
.brand-logo::after {
  content: '';
  position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(255,255,255,0.2));
  pointer-events: none;
}
.brand-text h1 {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.brand-text p {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.top-nav {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 40px;
}
.top-nav a {
  font-size: 14px;
  color: var(--color-text-secondary);
  padding: 0 4px;
  position: relative;
  height: var(--header-h);
  display: flex; align-items: center;
  transition: color 0.15s;
  white-space: nowrap;
}
.top-nav a.active {
  color: var(--color-primary);
  font-weight: 500;
}
.top-nav a.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 28px; height: 3px;
  background: var(--color-primary);
  border-radius: 2px 2px 0 0;
}

.user-zone {
  display: flex; align-items: center; gap: 10px;
  color: var(--color-text-secondary);
  font-size: 13px;
}
.user-avatar {
  width: 32px; height: 32px;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* ============== Body Layout ============== */
.app-body {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--header-h));
}

/* ============== Sidebar ============== */
.sidebar {
  background: white;
  border-right: 1px solid var(--color-border-light);
  padding: 16px 0;
}

.nav-group {
  margin-bottom: 8px;
}
.nav-group.has-active {
  background: var(--color-primary-50);
  border-left: 3px solid var(--color-primary);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  cursor: pointer;
  color: var(--color-text-secondary);
  font-size: 14px;
  transition: all 0.15s;
  position: relative;
}
.nav-item:hover {
  background: var(--color-primary-50);
  color: var(--color-primary);
}
.nav-item .icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.nav-item:hover .icon,
.nav-item.active .icon {
  color: var(--color-primary);
}
.nav-item.active {
  background: var(--color-primary-50);
  color: var(--color-primary);
  font-weight: 500;
}

.nav-item .label-stack {
  flex: 1;
  display: flex; flex-direction: column;
  line-height: 1.4;
}
.nav-item .label-main { font-size: 14px; }
.nav-item .label-sub {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 1px;
}
.nav-item.active .label-sub { color: var(--color-primary); opacity: 0.7; }

.nav-item .arrow {
  color: var(--color-text-muted);
  font-size: 12px;
  transition: transform 0.2s;
}
.nav-item.expanded .arrow { transform: rotate(180deg); }

.badge-dot {
  background: var(--color-danger);
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 1px 7px;
  min-width: 18px;
  text-align: center;
}

.sub-nav {
  padding: 0 24px 8px 56px;
  display: none;
}
.nav-item.expanded + .sub-nav { display: block; }
.sub-nav a {
  display: block;
  font-size: 13px;
  color: var(--color-text-secondary);
  padding: 6px 0;
  transition: color 0.15s;
}
.sub-nav a:hover { color: var(--color-primary); }
.sub-nav a.active { color: var(--color-primary); font-weight: 500; }

/* ============== Main Content ============== */
.main {
  padding: 24px 32px 40px;
  overflow-x: auto;
}

.breadcrumb {
  font-size: 13px;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.page-desc {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 20px;
}

.divider {
  height: 1px;
  background: var(--color-border-light);
  margin-bottom: 20px;
}

/* ============== 页头徽章 ============== */
.masthead {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.masthead .kicker {
  font-size: 12px;
  color: var(--color-text-muted);
  letter-spacing: 2px;
  margin-bottom: 4px;
}
.masthead h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}
.masthead .sub {
  font-size: 13px;
  color: var(--color-text-secondary);
}
.badges {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.badge {
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
}
.badge b { color: var(--color-primary); font-weight: 600; }

/* ============== 控制条 ============== */
.ctrl {
  position: sticky;
  top: var(--header-h);
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(4px);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  box-shadow: var(--shadow-sm);
}
.seg {
  display: inline-flex;
  background: #F1F4F8;
  border-radius: 999px;
  padding: 3px;
}
.seg button {
  font-size: 13px;
  color: var(--color-text-secondary);
  padding: 6px 16px;
  border-radius: 999px;
  transition: all 0.15s;
  white-space: nowrap;
  background: transparent;
}
.seg button:hover { color: var(--color-primary); }
.seg button.on {
  background: #fff;
  color: var(--color-primary);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-secondary);
}
.field select, .field input {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  font-size: 13px;
  background: #fff;
  color: var(--color-text);
  outline: none;
  transition: all 0.15s;
}
.field select:focus, .field input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.12);
}
.field input { width: 70px; }
.btn {
  border: 0;
  border-radius: var(--radius-md);
  padding: 7px 22px;
  font-size: 13px;
  cursor: pointer;
  background: var(--color-primary);
  color: #fff;
  font-weight: 500;
  transition: all 0.15s;
}
.btn:hover { background: var(--color-primary-dark); }
.btn:disabled { opacity: 0.5; cursor: wait; }

.mdesc {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: -6px 0 16px;
  padding: 0 2px;
}

/* ============== 概览统计卡 ============== */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  position: relative;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 32px; height: 3px;
  background: var(--color-primary);
  border-radius: 0 0 3px 0;
}
.stat-num {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 8px;
}
.stat-label {
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* ============== 区块标题 ============== */
.sec {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 24px 0 12px;
}
.sec h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.sec .cnt { font-size: 12px; color: var(--color-text-muted); }
.sec .sp { flex: 1; }
.sec .hint { font-size: 12px; color: var(--color-text-muted); }

/* ============== 团队卡片 ============== */
.team {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}
.team:hover {
  border-color: var(--color-border-blue);
  box-shadow: var(--shadow-md);
}
.team .row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  cursor: pointer;
  transition: background 0.15s;
}
.team .row:hover { background: var(--color-primary-50); }
.rank {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--c-louvain-bg);
  color: var(--c-louvain);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.team[data-m="lead-core"] .rank { background: var(--c-lead-core-bg); color: var(--c-lead-core); }
.team[data-m="spectral"] .rank { background: var(--c-spectral-bg); color: var(--c-spectral); }
.t-main { flex: 1; min-width: 0; }
.t-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}
.t-name .inst {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 400;
  margin-left: 8px;
}
.t-meta {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 3px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.t-meta b { color: var(--color-text-secondary); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #EEF2F7;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}
.chip.act {
  background: var(--c-lead-core-bg);
  color: var(--c-lead-core);
  border-color: #BFE3D5;
}
.t-score { text-align: right; flex-shrink: 0; }
.t-score .s {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
}
.t-score .sl { font-size: 11px; color: var(--color-text-muted); }
.t-score .if { font-size: 12px; color: var(--color-warning); font-weight: 600; }

/* 详情 */
.detail {
  display: none;
  border-top: 1px dashed var(--color-border);
  padding: 16px 18px;
  background: #FBFCFE;
}
.team.open .detail { display: block; }
.dgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}
.dcard {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background: #fff;
}
.dcard h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--color-text);
}
table.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th, .tbl td {
  padding: 5px 7px;
  border-bottom: 1px solid #EEF2F6;
  text-align: left;
  white-space: nowrap;
}
.tbl th { color: var(--color-text-muted); font-weight: 500; background: #F6F8FB; }
.tbl td { overflow: hidden; text-overflow: ellipsis; max-width: 220px; }

.bar {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 68px;
  padding-top: 4px;
}
.bar div {
  flex: 1;
  background: var(--color-primary);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  position: relative;
}
.bar span {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.plist { max-height: 240px; overflow: auto; }
.plist li {
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px dashed #EEF2F6;
  list-style: none;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.plist .pm { font-size: 10px; color: var(--color-primary); white-space: nowrap; }
.plist .lead { color: var(--c-lead-core); font-size: 10px; white-space: nowrap; }
.plist .if { color: var(--color-warning); font-size: 11px; white-space: nowrap; }
.plist .jy { color: var(--color-text-muted); font-size: 11px; white-space: nowrap; }

/* Rising stars */
#rs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
#rs .card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}
#rs .card:hover { border-color: var(--color-border-blue); box-shadow: var(--shadow-md); }
#rs .nm { font-size: 14px; font-weight: 600; color: var(--color-text); }
#rs .org {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#rs .kv {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--color-text-muted);
  flex-wrap: wrap;
}
#rs .kv b { color: var(--color-text-secondary); }
#rs .tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #EEEDFE;
  color: #534AB7;
  margin-top: 8px;
}

/* 状态 */
.msg {
  padding: 28px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13px;
}
.err {
  color: var(--color-danger);
  background: #FCEBEB;
  border: 1px solid #F3C1C1;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 12px 0;
  font-size: 13px;
}

.foot {
  margin-top: 28px;
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.8;
}
.foot b { color: var(--color-text-secondary); }
.foot ul { margin-left: 18px; }

/* ============== 产业链分类分布（团队详情） ============== */
.dcard h4 .sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-left: 8px;
}
.cdot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 2px;
  margin-right: 7px;
  vertical-align: middle;
}
.trow {
  display: grid;
  grid-template-columns: minmax(150px, 300px) minmax(0, 1fr) 108px;
  gap: 10px;
  align-items: center;
  padding: 5px 0;
}
.trow .bl {
  font-size: 12.5px;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trow .btrack {
  display: block;
  height: 12px;
  background: var(--color-border-light);
  border-radius: 4px;
  overflow: hidden;
}
.trow .bfill {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--bc, var(--color-primary));
}
.trow .bv {
  font-size: 12px;
  color: var(--color-text-secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chsec {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--color-border);
}
.chsec .chh {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}
.ch3wrap { display: flex; gap: 6px; flex-wrap: wrap; }
.ch3 {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #EEF2F7;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}
.ch3 b { font-weight: 600; }
.chx { font-size: 12px; color: var(--color-text-muted); }

/* ============== 响应式 ============== */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .dgrid { grid-template-columns: 1fr; }
  .trow { grid-template-columns: minmax(96px, 150px) minmax(0, 1fr) 94px; }
}
@media (max-width: 768px) {
  .app-body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stats { grid-template-columns: 1fr; }
  .top-nav { display: none; }
  .main { padding: 16px; }
  .stat-num { font-size: 26px; }
}
