/* ==========================================================================
   新能源汽车功率电子专利知识库 — 设计系统
   ========================================================================== */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f0f2f5;
  --border: #e2e6ea;
  --border-strong: #cbd2d9;
  --text: #14181d;
  --text-2: #4a5560;
  --text-3: #7b8794;
  --accent: #2563eb;
  --accent-soft: #e8efff;
  --accent-text: #1d4ed8;
  --shadow-sm: 0 1px 2px rgba(20, 24, 29, .06);
  --shadow-md: 0 4px 16px rgba(20, 24, 29, .10);
  --shadow-lg: 0 12px 40px rgba(20, 24, 29, .18);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;

  /* 技术维度 */
  --c-structure: #2563eb;
  --c-process: #7c3aed;
  --c-mechanical: #0891b2;
  --c-thermal: #dc2626;
  --c-seal: #059669;
  --c-emc: #d97706;
  --c-material: #65a30d;
  --c-assembly: #db2777;
  --c-integration: #4f46e5;

  /* 部件域 */
  --d-obc: #2563eb;
  --d-dcdc: #7c3aed;
  --d-mcu: #dc2626;
  --d-integrated: #059669;
  --d-common: #d97706;

  /* 机会评级 */
  --g-a: #dc2626;
  --g-b: #d97706;
  --g-c: #64748b;
}

html[data-theme="dark"] {
  --bg: #0f1216;
  --surface: #171b21;
  --surface-2: #1c2128;
  --surface-3: #232931;
  --border: #2b323b;
  --border-strong: #3d4551;
  --text: #e8ecf1;
  --text-2: #a8b3c0;
  --text-3: #74808f;
  --accent: #5b8cff;
  --accent-soft: #1a2540;
  --accent-text: #8fb0ff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .5);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- 布局 */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  padding: 0 8px 14px;
  border-bottom: 1px solid var(--border);
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.2px;
  line-height: 1.4;
}

.brand-sub {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 3px;
  letter-spacing: .3px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  text-align: left;
  width: 100%;
  transition: background .12s, color .12s;
}

.nav-item:hover { background: var(--surface-3); color: var(--text); }

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

.nav-icon { width: 16px; text-align: center; font-size: 14px; flex: none; }

.nav-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 20px;
  font-variant-numeric: tabular-nums;
}

.nav-item.active .nav-count { background: rgba(37, 99, 235, .15); color: var(--accent-text); }

.sidebar-foot {
  margin-top: auto;
  font-size: 11px;
  color: var(--text-3);
  padding: 12px 8px 0;
  border-top: 1px solid var(--border);
  line-height: 1.6;
}

.main { min-width: 0; padding: 24px 30px 80px; max-width: 1600px; }

.topbar {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-title { font-size: 22px; font-weight: 700; letter-spacing: -.4px; margin: 0; }
.page-desc { color: var(--text-3); font-size: 13px; margin-top: 4px; max-width: 900px; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- 控件 */
.btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  transition: all .12s;
  white-space: nowrap;
}

.btn:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }

.input, .select {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  width: 100%;
}

.input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-wrap { position: relative; }
.search-wrap .input { padding-left: 32px; }
.search-wrap::before {
  content: "⌕";
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 16px;
  pointer-events: none;
}

/* ---------------------------------------------------------------- 卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.card-title { font-size: 14px; font-weight: 650; margin: 0; letter-spacing: -.1px; }
.card-sub { font-size: 12px; color: var(--text-3); }
.card-actions { margin-left: auto; display: flex; gap: 6px; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* ---------------------------------------------------------------- KPI */
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.kpi::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--kpi-color, var(--accent));
}

.kpi-label { font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.8px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-note { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

/* ---------------------------------------------------------------- 标签 */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1.7;
}

.chip.cat { background: color-mix(in srgb, var(--chip-c) 12%, transparent); color: var(--chip-c); border-color: color-mix(in srgb, var(--chip-c) 26%, transparent); font-weight: 600; }
.chip.dom { background: color-mix(in srgb, var(--chip-c) 12%, transparent); color: var(--chip-c); border-color: color-mix(in srgb, var(--chip-c) 26%, transparent); font-weight: 600; }
.chip.topic { background: var(--surface-3); color: var(--text-2); }
.chip.grade { background: var(--chip-c); color: #fff; font-weight: 700; }
.chip.ghost { background: transparent; border-color: var(--border-strong); color: var(--text-3); }

.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }

/* ---------------------------------------------------------------- 专利列表 */
.patent-list { display: flex; flex-direction: column; gap: 10px; }

.patent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--dom-c, var(--accent));
  border-radius: var(--radius);
  padding: 13px 16px;
  cursor: pointer;
  transition: all .13s;
  box-shadow: var(--shadow-sm);
}

.patent-card:hover {
  border-color: var(--border-strong);
  border-left-color: var(--dom-c, var(--accent));
  transform: translateX(2px);
  box-shadow: var(--shadow-md);
}

.patent-card-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.patent-no {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--dom-c, var(--accent));
  background: color-mix(in srgb, var(--dom-c, var(--accent)) 10%, transparent);
  padding: 1px 7px;
  border-radius: 5px;
}

.patent-title { font-size: 14.5px; font-weight: 650; line-height: 1.45; flex: 1; min-width: 240px; letter-spacing: -.15px; }
.patent-meta { font-size: 12px; color: var(--text-3); display: flex; gap: 12px; flex-wrap: wrap; margin-top: 3px; }
.patent-problem { color: var(--text-2); font-size: 13px; margin: 8px 0 0; }
.patent-foot { display: flex; gap: 8px; align-items: center; margin-top: 9px; flex-wrap: wrap; }

.status-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  margin-right: 5px;
}
.status-dot.active { background: #16a34a; }
.status-dot.ceased { background: #dc2626; }
.status-dot.pending { background: #d97706; }

/* ---------------------------------------------------------------- 筛选栏 */
.filters {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: .3px; text-transform: uppercase; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.filter-chip {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  padding: 4px 11px;
  border-radius: 20px;
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  transition: all .12s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.filter-chip:hover { border-color: var(--chip-c, var(--accent)); color: var(--chip-c, var(--accent-text)); }

.filter-chip.on {
  background: var(--chip-c, var(--accent));
  border-color: var(--chip-c, var(--accent));
  color: #fff;
  font-weight: 600;
}

.filter-chip .n { opacity: .65; font-size: 11px; font-variant-numeric: tabular-nums; }

.result-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 10px;
  font-size: 13px;
  color: var(--text-3);
  flex-wrap: wrap;
}

.result-bar strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 抽屉 */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 22, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s;
  z-index: 40;
  backdrop-filter: blur(1.5px);
}

.drawer-mask.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(780px, 94vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.4, 0, .2, 1);
  z-index: 41;
  display: flex;
  flex-direction: column;
}

.drawer.open { transform: translateX(0); }

.drawer-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface-2);
}

.drawer-body { overflow-y: auto; padding: 20px 22px 60px; flex: 1; }

.drawer-close {
  border: none;
  background: var(--surface-3);
  color: var(--text-2);
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  flex: none;
}

.drawer-close:hover { background: var(--border-strong); color: var(--text); }

.section { margin-bottom: 20px; }

.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: .6px;
  text-transform: uppercase;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.section-body { font-size: 13.5px; color: var(--text-2); line-height: 1.75; }
.section-body.highlight {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 11px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
}

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text-2); }

.link-out {
  color: var(--accent-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}
.link-out:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- 技术树 */
.tree { font-size: 13.5px; }

.tree-node { border-left: 1px solid var(--border); margin-left: 9px; padding-left: 0; }
.tree-node.root { border-left: none; margin-left: 0; }

.tree-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s;
}

.tree-row:hover { background: var(--surface-3); }
.tree-row.l1 { font-weight: 650; font-size: 14px; }
.tree-row.l2 { font-weight: 550; }
.tree-toggle {
  width: 15px; flex: none;
  color: var(--text-3);
  font-size: 10px;
  transition: transform .15s;
  text-align: center;
}
.tree-toggle.open { transform: rotate(90deg); }
.tree-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--bar-c, var(--accent));
  opacity: .8;
  min-width: 3px;
  flex: none;
}
.tree-n {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.tree-row.is-empty > span:not(.tree-toggle):not(.tree-n) { color: var(--text-3); }
.tree-row.is-empty .tree-n { color: var(--text-3); opacity: .6; }

.chip.blank {
  background: color-mix(in srgb, var(--g-b) 15%, transparent);
  color: var(--g-b);
  border-color: color-mix(in srgb, var(--g-b) 35%, transparent);
  border-style: dashed;
  border-width: 1px;
  font-weight: 700;
  margin-left: 6px;
}

.blank-legend {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-strong);
}

/* ---------------------------------------------------------------- 机会离散矩阵 */
/* 评分是 1–5 的整数，同一坐标会堆很多机会点，所以不用散点气泡而用「格子列出」。 */
.om-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 264px; gap: 20px; align-items: start; }

.om-plot { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 6px 8px; }

.om-ytitle {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: .3px;
}

.om-xtitle {
  grid-column: 2;
  text-align: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: .3px;
  margin-top: 2px;
}

.om-grid { display: grid; grid-template-columns: 24px repeat(5, minmax(0, 1fr)); gap: 4px; }

.om-tick {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.om-tick-x { padding-top: 2px; }

.om-cell {
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-content: flex-start;
}
.om-cell.om-void { background: transparent; border-style: dashed; opacity: .4; }
.om-cell[data-quad="tr"] { border-color: var(--border-strong); }

.om-chip {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  background: var(--chip-c, var(--accent));
  border-radius: 999px;
  padding: 2px 7px;
  font-variant-numeric: tabular-nums;
  transition: filter .12s, transform .12s;
}
.om-chip:hover { filter: brightness(1.12); transform: translateY(-1px); }
.om-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.om-side { min-width: 0; }
.om-legend { display: grid; gap: 7px; margin-top: 6px; }
.om-leg { display: flex; gap: 7px; align-items: flex-start; font-size: 12px; line-height: 1.45; }
.om-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-top: 4px; }
.om-quad { margin: 6px 0 0; padding-left: 17px; font-size: 12px; line-height: 1.65; color: var(--text-2); }

/* ---------------------------------------------------------------- 机会卡 */
.opp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--grade-c, var(--accent));
  border-radius: var(--radius);
  padding: 15px 18px;
  box-shadow: var(--shadow-sm);
}

.opp-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-bottom: 3px; }
.opp-id {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
}
.opp-title { font-size: 15px; font-weight: 650; letter-spacing: -.2px; flex: 1; min-width: 220px; }
.opp-body { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.opp-block-label { font-size: 11px; font-weight: 700; color: var(--text-3); letter-spacing: .4px; margin-bottom: 3px; text-transform: uppercase; }
.opp-block-body { font-size: 13px; color: var(--text-2); line-height: 1.7; }
.opp-block-body ul { margin: 0; padding-left: 17px; }
.opp-block-body li { margin-bottom: 2px; }

.meter-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.meter-label { width: 62px; color: var(--text-3); flex: none; }
.meter-track { flex: 1; height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--meter-c, var(--accent)); border-radius: 4px; }
.meter-val { width: 30px; text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; flex: none; }

.claim-box {
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.7;
  margin-top: 8px;
}

.risk-box {
  background: color-mix(in srgb, var(--g-b) 8%, transparent);
  border-left: 3px solid var(--g-b);
  padding: 9px 13px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 10px;
}

/* ---------------- 原文附图（官方 PDF 渲染） ---------------- */

.fig-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  margin-top: 8px;
  scrollbar-width: thin;
}
.fig-thumb {
  flex: none;
  width: 148px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
  cursor: zoom-in;
  transition: border-color .15s, transform .15s;
}
.fig-thumb:hover, .fig-thumb:focus-visible {
  border-color: var(--accent);
  transform: translateY(-2px);
  outline: none;
}
.fig-thumb img {
  display: block;
  width: 100%;
  height: 196px;
  object-fit: cover;
  object-position: top center;
  background: #fff;
}
.fig-thumb figcaption {
  font-size: 10.5px;
  color: var(--text-3);
  padding: 5px 7px;
  border-top: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 同族分布 ─────────────────────────────────────────────────────────────
   展示「本发明在哪些国家/组织、以哪种文献性质公开」。它是同族信息，不是本库
   已核实的专利记录，因此视觉上刻意做得比专利卡片轻，避免被误读为收录内容。 */
.fam-list { display: flex; flex-direction: column; gap: 6px; }

.fam-country { display: flex; align-items: flex-start; gap: 8px; }

.fam-cc {
  flex: 0 0 auto;
  min-width: 34px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--text-3);
  padding: 2px 0;
  text-align: right;
}

.fam-items { display: flex; flex-wrap: wrap; gap: 5px; }

.fam-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 11px;
  line-height: 1.5;
  padding: 2px 7px;
  border: 1px dashed var(--border);
  border-radius: 5px;
  background: transparent;
  color: var(--text-2);
  cursor: default;
}

/* 已被本库独立收录的同族件：实线边框 + 可点击 */
.fam-item.in-kb {
  border-style: solid;
  border-color: var(--accent, #2563eb);
  color: var(--accent, #2563eb);
  background: color-mix(in srgb, var(--accent, #2563eb) 8%, transparent);
  cursor: pointer;
}
.fam-item.in-kb:hover { filter: brightness(1.08); }

.fam-kind {
  font-family: inherit;
  font-size: 10px;
  color: var(--text-3);
  border-left: 1px solid var(--border);
  padding-left: 5px;
}
.fam-item.in-kb .fam-kind { border-left-color: color-mix(in srgb, var(--accent, #2563eb) 40%, transparent); }

.figviewer {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 23, 42, .93);
  display: none;
  flex-direction: column;
  padding: 14px 18px 18px;
}
.figviewer.open { display: flex; }
.figviewer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #e2e8f0;
  padding: 0 4px 12px;
  flex: none;
}
.figviewer-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: .92;
}
.figviewer-nav { display: flex; align-items: center; gap: 8px; flex: none; }
.figviewer-nav span { color: #cbd5e1; min-width: 132px; text-align: center; }
.figviewer-nav button {
  background: rgba(255, 255, 255, .12);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 6px;
  width: 34px;
  height: 32px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.figviewer-nav button:hover { background: rgba(255, 255, 255, .24); }
.figviewer-stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: #fff;
  border-radius: 6px;
  padding: 10px;
}
.figviewer-stage img { max-width: 100%; height: auto; display: block; }

/* ---------------- 机会点结构示意图（本地绘制） ---------------- */

.sch-wrap {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px;
  overflow-x: auto;
}
.sch-wrap img { display: block; width: 100%; min-width: 560px; height: auto; }
.sch-note {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
}
.sch-badge {
  display: inline-block;
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-text);
  border: 1px solid var(--border);
  margin-left: 6px;
  vertical-align: 1px;
}

/* ---------------- 机会点结构配图：生成配图 / 矢量示意图 双页签 ---------------- */

.oppfig-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.oppfig-tab {
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 5px 11px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  text-align: left;
  line-height: 1.25;
}
.oppfig-tab:hover { border-color: var(--accent); color: var(--text); }
.oppfig-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
.oppfig-tag { display: block; font-size: 10px; font-weight: 400; color: var(--text-3); margin-top: 1px; }
.oppfig-tab.active .oppfig-tag { color: var(--accent-text); opacity: 0.85; }

.oppfig-wrap { margin-top: 8px; }
.oppfig-pane[hidden] { display: none; }
.oppfig-img {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px;
}
.oppfig-img img { display: block; width: 100%; height: auto; border-radius: 4px; }
.oppfig-note { font-size: 11px; color: var(--text-3); margin-top: 6px; }

.related-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }.related-link {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 5px;
  cursor: pointer;
  border: none;
  font-weight: 600;
}
.related-link:hover { filter: brightness(.94); }

/* ---------------------------------------------------------------- 表格 */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-3);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  white-space: nowrap;
}
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

/* ---------------------------------------------------------------- 图表 */
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 42px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-label { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--surface-3); border-radius: 4px; height: 17px; overflow: hidden; }
.bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--bar-c, var(--accent));
  opacity: .85;
  transition: width .3s;
  min-width: 2px;
}
.bar-val { text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 12px; }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 96px; }
.spark-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.spark-bar {
  width: 100%;
  background: var(--bar-c, var(--accent));
  border-radius: 3px 3px 0 0;
  opacity: .85;
  min-height: 2px;
  transition: height .3s;
}
.spark-lbl { font-size: 10px; color: var(--text-3); writing-mode: horizontal-tb; white-space: nowrap; }

.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.legend { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; flex: 1; min-width: 150px; }
.legend-item { display: flex; align-items: center; gap: 7px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-val { margin-left: auto; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 提示条 */
.notice {
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.7;
  border: 1px solid;
  margin-bottom: 16px;
}
.notice.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--text); }
.notice.warn { background: color-mix(in srgb, #d97706 9%, transparent); border-color: color-mix(in srgb, #d97706 32%, transparent); color: var(--text); }
.notice strong { font-weight: 700; }

/* ---------------------------------------------------------------- 空状态 */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty-icon { font-size: 34px; opacity: .5; margin-bottom: 10px; }

/* ---------------------------------------------------------------- 其它 */
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-14 { margin-bottom: 14px; }
.mb-20 { margin-bottom: 20px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1180px) {
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: 1fr 1fr; }
  .om-wrap { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .brand { border-bottom: none; padding-bottom: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { display: none; }
  .main { padding: 18px 16px 60px; }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .opp-body { grid-template-columns: 1fr; }
  .om-grid { gap: 3px; }
  .om-cell { min-height: 46px; }
  .om-chip { padding: 2px 6px; }
}

@media print {
  .sidebar, .topbar-actions, .filters, .drawer-close { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .drawer { position: static; transform: none; width: 100%; box-shadow: none; }
}
