/* ============================================================
   能源环境工程技术助手平台 · Beta 2.0
   视觉规范：参照集团官网（国家电投）蓝绿主色、白色留白、
             细线分隔、稳重字号；主色 深蓝 #0a4a86 / 辅色 生态绿 #00a05a
   ============================================================ */
:root {
  --spic-blue-900: #052b52;
  --spic-blue-800: #083d70;
  --spic-blue-700: #0a4a86;
  --spic-blue-600: #0e5fa8;
  --spic-blue-500: #1a74bd;
  --spic-green: #00a05a;
  --spic-green-2: #8cc63f;
  --spic-green-dark: #06814a;
  --gold: #c8a45c;

  --blue-900: var(--spic-blue-900);
  --blue-800: var(--spic-blue-700);
  --blue-700: var(--spic-blue-600);
  --blue-600: var(--spic-blue-500);
  --blue-100: #e9f1f9;
  --blue-050: #f4f7fb;
  --line: #dde6f0;
  --text: #1d2c3c;
  --text-sub: #62758a;
  --ok: #0d8a55;
  --warn: #c78612;
  --err: #c93a3a;
  --radius: 6px;
  --shadow: 0 2px 12px rgba(10, 74, 134, 0.07);
  --shadow-lg: 0 14px 44px rgba(5, 43, 82, 0.18);
}

* { box-sizing: border-box; }
[v-cloak] { display: none; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #eef4fa 0, #f7f9fc 280px, #f7f9fc 100%);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--spic-blue-600); }
mark { background: #ffe58f; padding: 0 2px; border-radius: 2px; }

/* ---------------- 顶部品牌条 ---------------- */
.top-strip {
  background: var(--spic-blue-900);
  color: rgba(255, 255, 255, 0.72);
  border-bottom: 2px solid var(--spic-green);
}
.strip-inner {
  max-width: 1560px; margin: 0 auto; padding: 0 24px;
  height: 32px; display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; letter-spacing: 0.5px;
}
.strip-left { color: rgba(255, 255, 255, 0.9); letter-spacing: 2px; }
.strip-right { font-size: 10px; letter-spacing: 1.2px; color: rgba(255, 255, 255, 0.55); }

/* ---------------- 站点名称 ---------------- */
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.header-inner {
  max-width: 1560px; margin: 0 auto; padding: 0 24px;
  height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark {
  width: 46px; height: 46px; flex: none; border-radius: 4px;
  background: linear-gradient(140deg, var(--spic-blue-700) 0%, var(--spic-blue-600) 55%, var(--spic-green) 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(10, 74, 134, 0.24);
  position: relative; overflow: hidden;
}
.brand-mark::after {
  content: ''; position: absolute; right: -12px; bottom: -14px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(140, 198, 63, 0.45);
}
.brand-mark span {
  position: relative; z-index: 1;
  color: #fff; font-size: 23px; font-weight: 700; letter-spacing: 1px;
}
.brand-text { min-width: 0; }
.brand-text h1 {
  font-size: 23px; font-weight: 700; color: var(--spic-blue-700);
  letter-spacing: 1.2px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.beta-tag {
  display: inline-flex; align-items: center; height: 21px; padding: 0 9px;
  border-radius: 11px; font-size: 11px; font-weight: 600; letter-spacing: 0.6px;
  color: #fff; background: linear-gradient(100deg, var(--spic-green-dark), var(--spic-green-2));
  box-shadow: 0 2px 8px rgba(0, 160, 90, 0.25);
}
.brand-text .sub {
  font-size: 11.5px; color: var(--text-sub); margin-top: 5px;
  letter-spacing: 1.6px; text-transform: uppercase;
}
.header-meta { display: flex; align-items: center; gap: 14px; flex: none; }
.meta-item {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-sub);
}
.meta-item .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--spic-green);
  box-shadow: 0 0 0 3px rgba(0, 160, 90, 0.14);
}
.meta-sep { width: 1px; height: 18px; background: var(--line); }

/* ---------------- 五大板块导航 ---------------- */
.nav-bar {
  background: linear-gradient(90deg, var(--spic-blue-800) 0%, var(--spic-blue-700) 48%, #0b5773 100%);
  border-top: 3px solid var(--spic-green);
  position: sticky; top: 0; z-index: 60;
  box-shadow: 0 3px 12px rgba(5, 43, 82, 0.2);
}
.nav-inner {
  max-width: 1560px; margin: 0 auto; padding: 0 24px;
  height: 48px; display: flex; align-items: stretch;
}
.nav-tab {
  position: relative; background: transparent; border: none;
  color: rgba(255, 255, 255, 0.86); padding: 0 26px; font-size: 15px;
  letter-spacing: 1px; transition: all .16s;
}
.nav-tab:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.nav-tab.active { color: #fff; font-weight: 600; background: rgba(255, 255, 255, 0.13); }
.nav-tab.active::after {
  content: ''; position: absolute; left: 18px; right: 18px; bottom: 0;
  height: 3px; background: linear-gradient(90deg, var(--spic-green-2), #fff);
}
.nav-right {
  margin-left: auto; display: flex; align-items: center;
  font-size: 10px; letter-spacing: 2px; color: rgba(255, 255, 255, 0.42);
}

/* ---------------- 主体 ---------------- */
.main { max-width: 1560px; margin: 0 auto; padding: 22px 24px 46px; min-height: calc(100vh - 280px); }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 16px;
}
.section-title {
  font-size: 16px; font-weight: 700; color: var(--spic-blue-700);
  display: flex; align-items: center; gap: 9px; margin-bottom: 15px;
  letter-spacing: 0.6px;
}
.section-title::before {
  content: ''; width: 4px; height: 17px; border-radius: 2px;
  background: linear-gradient(180deg, var(--spic-green), var(--spic-blue-600));
}

/* ---------------- 通用控件 ---------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
input[type="text"], input[type="search"], select {
  height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 4px;
  font-size: 14px; color: var(--text); background: #fff; outline: none; min-width: 140px;
}
input:focus, select:focus { border-color: var(--spic-blue-600); box-shadow: 0 0 0 2px rgba(14, 95, 168, .12); }
.grow { flex: 1; min-width: 220px; }
.btn {
  height: 38px; padding: 0 18px; border-radius: 4px; border: 1px solid var(--spic-blue-600);
  background: var(--spic-blue-600); color: #fff; font-size: 14px; transition: all .15s;
  display: inline-flex; align-items: center; text-decoration: none;
}
.btn:hover { background: var(--spic-blue-700); border-color: var(--spic-blue-700); }
.btn.ghost { background: #fff; color: var(--spic-blue-700); border-color: #c3d5e8; }
.btn.ghost:hover { background: var(--blue-100); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.tag {
  display: inline-block; padding: 1px 9px; border-radius: 2px; font-size: 12px;
  background: var(--blue-100); color: var(--spic-blue-700); border: 1px solid #cfe0f2;
}
.tag.cat { background: #eaf6ef; color: var(--spic-green-dark); border-color: #cdebd9; }
.muted { color: var(--text-sub); }
.small { font-size: 12px; }

/* ---------------- 状态条 ---------------- */
.banner { border-radius: 4px; padding: 9px 14px; font-size: 13px; margin-bottom: 12px; }
.banner.info { background: var(--blue-100); color: var(--spic-blue-700); border: 1px solid #cfe0f2; }
.banner.ok { background: #eaf7f1; color: #0d7a4b; border: 1px solid #cbe9d9; }
.banner.err { background: #fdecec; color: #b03030; border: 1px solid #f6cfcf; }
.banner.warn { background: #fff8e8; color: #a17000; border: 1px solid #ffe2ad; }
.spin { display: inline-block; animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 结果列表 ---------------- */
.result-item {
  border: 1px solid var(--line); border-radius: 4px; padding: 13px 15px; margin-bottom: 10px;
  transition: all .15s;
}
.result-item:hover { border-color: var(--spic-blue-600); box-shadow: var(--shadow); }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.result-name { font-size: 15px; font-weight: 600; color: var(--spic-blue-700); word-break: break-all; }
.result-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.snippet {
  margin-top: 8px; color: #3c4b5a; background: #f7fafd; border-left: 3px solid var(--spic-green);
  padding: 8px 11px; border-radius: 0 3px 3px 0; line-height: 1.65; word-break: break-all;
}

/* ---------------- 分页 ---------------- */
.pager { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 16px; }
.pager .num {
  min-width: 30px; height: 30px; border: 1px solid var(--line); background: #fff;
  border-radius: 3px; color: var(--text);
}
.pager .num.active { background: var(--spic-blue-700); border-color: var(--spic-blue-700); color: #fff; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 4px; }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; white-space: nowrap; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 9px 12px; text-align: left; }
table.grid thead th {
  background: #eef3f9; color: var(--spic-blue-700); font-weight: 600; position: sticky; top: 0;
  cursor: pointer; user-select: none;
}
table.grid thead th.no-sort { cursor: default; }
table.grid tbody tr:hover { background: #f5f9fd; cursor: pointer; }
table.grid .sort-ind { color: var(--spic-green); margin-left: 4px; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(5, 30, 55, 0.6);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: 6px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 960px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal.wide { max-width: 1200px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px; border-bottom: 1px solid var(--line);
  background: #f5f8fc; border-top: 3px solid var(--spic-green);
}
.modal-head h3 { font-size: 15px; color: var(--spic-blue-700); word-break: break-all; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.close-x { background: none; border: none; font-size: 22px; color: var(--text-sub); line-height: 1; }
iframe.pdf-view { width: 100%; height: 74vh; border: 1px solid var(--line); border-radius: 4px; background: #525659; }

/* 详情卡片 */
.detail-grid { display: grid; grid-template-columns: 120px 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.detail-grid.two { grid-template-columns: 120px 1fr; }
.detail-grid > div { padding: 9px 12px; border-bottom: 1px solid var(--line); }
.detail-grid .h { background: #f2f7fc; color: var(--spic-blue-700); font-weight: 600; }
.detail-grid .k { background: #fbfdff; color: var(--text-sub); }
.detail-group { margin-top: 16px; }
.detail-group h4 { font-size: 14px; color: var(--spic-blue-700); margin-bottom: 8px; }

/* ---------------- 上传区 ---------------- */
.dropzone {
  border: 2px dashed #b9cee2; border-radius: 6px; background: #f6fafe;
  padding: 32px; text-align: center; color: var(--text-sub); transition: all .18s; cursor: pointer;
}
.dropzone:hover, .dropzone.drag { border-color: var(--spic-blue-600); background: #edf5fc; color: var(--spic-blue-700); }
.dropzone .big { font-size: 30px; display: block; margin-bottom: 8px; color: var(--spic-blue-600); }
.progress { height: 8px; background: var(--blue-100); border-radius: 6px; overflow: hidden; margin-top: 12px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--spic-blue-600), var(--spic-green)); width: 0; transition: width .2s; }

/* 状态徽标 */
.badge { display: inline-block; padding: 2px 10px; border-radius: 2px; font-size: 12px; border: 1px solid; }
.badge.st-wait { background: #f1f5f9; color: #52606d; border-color: #dbe4ec; }
.badge.st-run  { background: #fff7e6; color: #a97400; border-color: #ffe0a8; }
.badge.st-done { background: #eafaf1; color: #1a7d4e; border-color: #c9eedb; }
.badge.st-fail { background: #fdecec; color: #b03030; border-color: #f6cfcf; }

.empty { text-align: center; color: var(--text-sub); padding: 40px 0; }
.footer { border-top: 1px solid var(--line); background: #fff; }
.footer-inner {
  max-width: 1560px; margin: 0 auto; padding: 20px 24px 26px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  color: var(--text-sub); font-size: 12px;
}
.footer-sep { width: 1px; height: 12px; background: var(--line); }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ============================================================
   预留板块（知识图谱 / 设备选型）
   ============================================================ */
.hero-card {
  background: linear-gradient(120deg, #ffffff 0%, #f4f9fd 55%, #eef7f2 100%);
  border-top: 3px solid var(--spic-blue-700);
}
.hero-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.hero-title { font-size: 20px; color: var(--spic-blue-700); font-weight: 700; letter-spacing: 0.6px; }
.reserved-badge {
  display: inline-block; margin-left: 10px; padding: 2px 9px; border-radius: 2px;
  font-size: 11px; font-weight: 500; color: var(--spic-green-dark);
  background: #e8f7ef; border: 1px solid #c3e8d4; vertical-align: middle;
}
.hero-desc { margin-top: 9px; color: var(--text-sub); line-height: 1.7; max-width: 920px; }
.hero-mark {
  width: 66px; height: 66px; flex: none; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; letter-spacing: 1px; color: var(--spic-blue-700);
  background: linear-gradient(140deg, #e8f2fb, #eaf7f0);
  border: 1px solid #d4e6f4;
}
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 22px; }
.stat-cell {
  background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--spic-blue-600);
  border-radius: 3px; padding: 13px 16px; display: flex; flex-direction: column; gap: 4px;
}
.stat-cell strong { font-size: 22px; color: var(--spic-blue-700); font-weight: 700; line-height: 1.1; }
.stat-cell span { font-size: 12px; color: var(--text-sub); }
.graph-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 14px; }
.graph-panel { background: #f8fbfe; border: 1px solid var(--line); border-radius: 4px; padding: 16px 18px; }
.graph-panel h4 { margin: 0 0 12px; font-size: 14px; color: var(--spic-blue-700); }
.bar-list { display: flex; flex-direction: column; gap: 9px; }
.bar-item { display: grid; grid-template-columns: 92px 1fr 46px; align-items: center; gap: 10px; font-size: 12px; }
.bar-label { color: var(--text-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; background: #e6eef6; border-radius: 4px; overflow: hidden; }
.bar-track > i { display: block; height: 100%; background: linear-gradient(90deg, var(--spic-blue-600), var(--spic-green)); }
.bar-value { text-align: right; color: var(--spic-blue-700); font-weight: 600; }
.api-contract { display: flex; flex-direction: column; gap: 8px; }
.api-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.api-method {
  flex: none; padding: 2px 7px; border-radius: 2px; font-size: 10px; letter-spacing: 0.5px;
  color: #fff; background: var(--spic-blue-600);
}
.api-row code { color: #44586b; background: #fff; border: 1px solid var(--line); border-radius: 3px; padding: 4px 8px; font-size: 12px; word-break: break-all; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chip {
  padding: 6px 14px; border-radius: 16px; font-size: 12.5px; color: var(--spic-blue-700);
  background: #fff; border: 1px solid #cfe0f2;
}
.dim-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.dim-cell {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 3px; background: #f9fbfe; color: #34495c;
}
.dim-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--spic-green); flex: none; }

/* ============================================================
   知识图谱可视化
   ============================================================ */
.kg-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.kg-toolbar input[type="search"] { width: 260px; max-width: 100%; }
.kg-layer-btn {
  padding: 6px 12px; border-radius: 16px; font-size: 12.5px; cursor: pointer;
  color: var(--spic-blue-700); background: #fff; border: 1px solid #cfe0f2;
}
.kg-layer-btn.active { color: #fff; background: var(--spic-blue-700); border-color: var(--spic-blue-700); }
.kg-wrap { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(290px, 1fr); gap: 18px; margin-top: 16px; }
.kg-canvas {
  position: relative; border: 1px solid var(--line); border-radius: 4px; overflow: hidden;
  background: radial-gradient(circle at 50% 50%, #ffffff 0%, #f4f9fd 65%, #eaf2f9 100%);
}
.kg-svg { display: block; width: 100%; height: auto; }
.kg-link { stroke: #c6d8e8; stroke-width: 1; }
.kg-node circle { cursor: pointer; }
.kg-label {
  font-size: 12px; fill: #123a5c; paint-order: stroke; stroke: #fff;
  stroke-width: 3px; stroke-linejoin: round; pointer-events: none;
}
.kg-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 10px 14px; font-size: 12px; color: var(--text-sub); border-top: 1px solid var(--line); background: rgba(255, 255, 255, 0.75); }
.kg-legend span { display: inline-flex; align-items: center; gap: 6px; }
.kg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.kg-side { min-width: 0; }
.kg-detail { border: 1px solid var(--line); border-radius: 4px; background: #f9fcff; padding: 16px 18px; }
.kg-detail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.kg-detail-head h4 { margin: 0; font-size: 15px; color: var(--spic-blue-700); }
.kg-rel { margin-top: 16px; }
.kg-rel h4 { margin: 0 0 8px; font-size: 12.5px; color: var(--text-sub); font-weight: 600; }
.kg-chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.kg-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px;
  font-size: 12.5px; color: var(--spic-blue-700); background: #fff;
  border: 1px solid #cfe0f2; border-radius: 14px; cursor: pointer;
}
.kg-chip:hover { border-color: var(--spic-blue-600); background: #f2f8ff; }
.kg-chip-w { font-size: 11px; color: var(--spic-green-dark); font-weight: 600; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 12px; color: #55697c; }


/* ============================================================
   数字人「超哥」
   ============================================================ */
.digital-human { position: fixed; right: 26px; bottom: 24px; z-index: 120; }
.dh-launcher {
  position: relative; width: 84px; height: 84px; border: none; padding: 0;
  background: transparent; display: block;
}
.dh-face-wrap {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden;
  border: 3px solid #fff; background: #eef3f8;
  box-shadow: 0 8px 24px rgba(5, 43, 82, 0.28), 0 0 0 3px rgba(0, 160, 90, 0.18);
  transition: transform .2s, box-shadow .2s;
}
/* 三视图原图按正面视图裁切：放大 2.9 倍，水平定位到正面人物 */
.dh-face {
  position: absolute; inset: 0;
  background-image: url('/api/kb/avatar');
  background-repeat: no-repeat;
  background-size: 300% auto;
  background-position: 7% 12%;
}
.dh-launcher:hover .dh-face-wrap {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(5, 43, 82, 0.34), 0 0 0 3px rgba(0, 160, 90, 0.28);
}
.dh-ring {
  position: absolute; inset: -7px; border-radius: 50%;
  border: 1px solid rgba(0, 160, 90, 0.4);
  animation: dh-ring 2.6s ease-out infinite;
}
@keyframes dh-ring {
  0% { transform: scale(.94); opacity: .85; }
  70% { transform: scale(1.12); opacity: 0; }
  100% { transform: scale(1.12); opacity: 0; }
}
.dh-pulse {
  position: absolute; right: 3px; bottom: 12px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--spic-green); border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(0, 160, 90, 0.18);
}
.dh-name {
  position: absolute; left: 50%; bottom: -21px; transform: translateX(-50%);
  white-space: nowrap; font-size: 12px; font-weight: 600; color: #fff;
  background: linear-gradient(90deg, var(--spic-blue-700), var(--spic-green-dark));
  padding: 2px 12px; border-radius: 10px; letter-spacing: 1px;
  box-shadow: 0 3px 10px rgba(5, 43, 82, 0.25);
}
.dh-hint {
  position: absolute; right: 96px; top: 50%; transform: translateY(-50%);
  white-space: nowrap; font-size: 12px; color: var(--spic-blue-700);
  background: #fff; border: 1px solid #d7e6f3; padding: 7px 12px; border-radius: 4px;
  box-shadow: 0 4px 14px rgba(5, 43, 82, 0.12);
  animation: dh-hint 3.6s ease-in-out infinite;
}
.dh-hint::after {
  content: ''; position: absolute; right: -6px; top: 50%; margin-top: -5px;
  width: 9px; height: 9px; background: #fff; border-right: 1px solid #d7e6f3;
  border-top: 1px solid #d7e6f3; transform: rotate(45deg);
}
@keyframes dh-hint {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50% { transform: translateY(-50%) translateX(-5px); }
}

/* 对话面板 */
.dh-panel {
  position: absolute; right: 0; bottom: 104px;
  width: 408px; height: 636px; max-height: calc(100vh - 150px);
  background: #f4f8fc; border-radius: 8px; overflow: hidden;
  box-shadow: var(--shadow-lg); border: 1px solid #cfdeed;
  display: flex; flex-direction: column;
  animation: dh-in .18s ease-out;
}
@keyframes dh-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.dh-head {
  flex: none; display: flex; align-items: center; gap: 11px;
  padding: 13px 16px 12px; color: #fff;
  background: linear-gradient(115deg, var(--spic-blue-800), var(--spic-blue-600) 62%, #0a7d6c);
  border-top: 3px solid var(--spic-green);
}
.dh-head-avatar {
  width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex: none;
  border: 2px solid rgba(255, 255, 255, 0.85); background: #eef3f8;
  position: relative;
}
.dh-head-avatar::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background-image: url('/api/kb/avatar');
  background-repeat: no-repeat; background-size: 300% auto; background-position: 7% 12%;
}
.dh-head-text { flex: 1; min-width: 0; }
.dh-head-text strong { font-size: 15px; letter-spacing: 0.6px; display: flex; align-items: center; gap: 7px; }
.dh-role {
  font-size: 10px; font-weight: 500; padding: 1px 6px; border-radius: 2px;
  background: rgba(255, 255, 255, 0.16); color: rgba(255, 255, 255, 0.9);
}
.dh-head-text p { font-size: 11px; color: rgba(255, 255, 255, 0.72); margin-top: 3px; }
.dh-close {
  width: 28px; height: 28px; flex: none; border: none; border-radius: 4px;
  background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 18px; line-height: 1;
}
.dh-close:hover { background: rgba(255, 255, 255, 0.24); }
.dh-status {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 7px 15px; font-size: 11.5px; background: #fff;
  border-bottom: 1px solid var(--line); color: var(--text-sub);
}
.dh-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--spic-blue-600); flex: none; }
.dh-status.ok .dh-status-dot { background: var(--spic-green); box-shadow: 0 0 0 2px rgba(0, 160, 90, .15); }
.dh-status.busy .dh-status-dot { background: var(--warn); animation: dh-blink 1.2s infinite; }
.dh-status.err .dh-status-dot { background: var(--err); }
@keyframes dh-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.dh-status-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dh-sync {
  flex: none; border: 1px solid #cfe0f2; background: #f5f9fd; color: var(--spic-blue-700);
  border-radius: 3px; font-size: 11px; padding: 2px 9px;
}
.dh-sync:hover { background: #e9f2fa; }
.dh-toast {
  flex: none; padding: 6px 15px; font-size: 11.5px; color: var(--spic-green-dark);
  background: #eaf7f0; border-bottom: 1px solid #cfe9da;
}
.dh-msgs { flex: 1; overflow-y: auto; padding: 14px 14px 6px; scroll-behavior: smooth; }
.dh-msg { display: flex; gap: 8px; margin-bottom: 13px; }
.dh-msg.user { flex-direction: row-reverse; }
.dh-avatar-mini {
  width: 28px; height: 28px; border-radius: 50%; overflow: hidden; flex: none;
  background: #eef3f8; border: 1px solid #d6e4f2; position: relative;
}
.dh-avatar-mini::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background-image: url('/api/kb/avatar');
  background-repeat: no-repeat; background-size: 300% auto; background-position: 7% 12%;
}
.dh-msg-body { max-width: 82%; min-width: 0; }
.dh-msg.user .dh-msg-body { max-width: 80%; }
.dh-bubble {
  background: #fff; border: 1px solid #dbe6f1; border-radius: 3px 10px 10px 10px;
  padding: 10px 13px; font-size: 13px; line-height: 1.72; color: #263849;
  word-break: break-word; box-shadow: 0 1px 3px rgba(5, 43, 82, .04);
}
.dh-msg.user .dh-bubble {
  background: linear-gradient(120deg, var(--spic-blue-700), var(--spic-blue-600));
  color: #fff; border-color: transparent; border-radius: 10px 3px 10px 10px;
}
.dh-bubble b { color: var(--spic-blue-700); }
.dh-msg.user .dh-bubble b { color: #fff; }
.dh-bubble code { background: #f1f5f9; padding: 1px 5px; border-radius: 2px; font-size: 12px; }
.dh-bubble pre { background: #f6f8fa; padding: 8px 10px; border-radius: 3px; overflow-x: auto; font-size: 12px; }
.dh-bubble .cite {
  display: inline-block; min-width: 16px; text-align: center; margin: 0 1px;
  font-size: 10px; color: var(--spic-green-dark); background: #eaf7f0;
  border-radius: 2px; vertical-align: super; padding: 0 2px;
}
.dh-msg.refused .dh-bubble { background: #fffaf0; border-color: #f0dfb8; color: #8a6210; }
.dh-msg.failed .dh-bubble { background: #fdf3f3; border-color: #f2d4d4; color: #a03d3d; }
.dh-source-toggle, .dh-src-toggle {
  margin-top: 6px; border: none; background: transparent; color: var(--spic-blue-600);
  font-size: 11px; padding: 2px 0; display: inline-flex; align-items: center; gap: 4px;
}
.dh-src-list {
  list-style: none; margin: 5px 0 0; padding: 0; background: #fff;
  border: 1px solid #dbe6f1; border-radius: 3px; overflow: hidden;
}
.dh-src-list li { padding: 8px 10px; border-bottom: 1px solid #eef3f9; font-size: 11.5px; line-height: 1.55; }
.dh-src-list li:last-child { border-bottom: none; }
.dh-src-index { color: var(--spic-green-dark); font-weight: 600; margin-right: 3px; }
.dh-src-type {
  display: inline-block; margin-right: 5px; padding: 0 5px; border-radius: 2px;
  font-size: 10px; background: #eef4fa; color: var(--spic-blue-700);
}
.dh-src-list b { color: #33475b; font-size: 11.5px; }
.dh-src-list p { margin: 3px 0 0; color: var(--text-sub); font-size: 11px; }
.dh-quick { padding: 4px 2px 8px; }
.dh-quick p { font-size: 11px; color: var(--text-sub); margin-bottom: 7px; }
.dh-quick button {
  display: block; width: 100%; text-align: left; margin-bottom: 6px;
  padding: 8px 11px; font-size: 12px; color: var(--spic-blue-700);
  background: #fff; border: 1px solid #d9e6f2; border-radius: 4px;
  transition: all .14s;
}
.dh-quick button:hover { border-color: var(--spic-blue-600); background: #f3f9fe; }
.dh-input {
  flex: none; display: flex; gap: 8px; padding: 10px 12px 6px;
  background: #fff; border-top: 1px solid var(--line);
}
.dh-input textarea {
  flex: 1; resize: none; border: 1px solid var(--line); border-radius: 4px;
  padding: 9px 11px; font-family: inherit; font-size: 13px; line-height: 1.5;
  min-height: 40px; max-height: 92px; outline: none; color: var(--text);
}
.dh-input textarea:focus { border-color: var(--spic-blue-600); box-shadow: 0 0 0 2px rgba(14, 95, 168, .1); }
.dh-send {
  flex: none; width: 64px; border: none; border-radius: 4px;
  background: linear-gradient(120deg, var(--spic-blue-700), var(--spic-green-dark));
  color: #fff; font-size: 13px; font-weight: 600;
}
.dh-send:disabled { opacity: .45; cursor: not-allowed; }
.dh-tip {
  flex: none; text-align: center; font-size: 10px; color: #9aa9b8;
  padding: 5px 0 8px; background: #fff;
}
.dh-bubble.typing { display: flex; gap: 5px; align-items: center; width: 60px; padding: 13px; }
.dh-bubble.typing i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--spic-blue-600);
  animation: dh-typing 1s infinite;
}
.dh-bubble.typing i:nth-child(2) { animation-delay: .16s; }
.dh-bubble.typing i:nth-child(3) { animation-delay: .32s; }
@keyframes dh-typing {
  0%, 60%, 100% { opacity: .25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ---------------- 响应式（1366×768 及以下）---------------- */
@media (max-width: 1440px) {
  .header-inner, .nav-inner, .main, .strip-inner, .footer-inner { padding-left: 16px; padding-right: 16px; }
  .brand-text h1 { font-size: 21px; }
  .nav-tab { padding: 0 20px; font-size: 14px; }
}
@media (max-width: 1100px) {
  .header-meta { display: none; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .graph-grid { grid-template-columns: 1fr; }
  .dim-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .strip-right { display: none; }
  .header-inner { height: auto; padding: 12px 14px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .brand-text h1 { font-size: 18px; }
  .brand-text .sub { display: none; }
  .brand-mark { width: 40px; height: 40px; }
  .nav-inner { padding: 0 6px; overflow-x: auto; height: 44px; }
  .nav-tab { padding: 0 14px; font-size: 13.5px; white-space: nowrap; }
  .nav-right { display: none; }
  .main { padding: 14px; }
  .card { padding: 15px; }
  .digital-human { right: 14px; bottom: 14px; }
  .dh-panel { position: fixed; right: 12px; left: 12px; bottom: 108px; width: auto; height: 72vh; }
  .dh-hint { display: none; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .dim-grid { grid-template-columns: 1fr; }
  .api-row { flex-wrap: wrap; }
  .kg-wrap { grid-template-columns: 1fr; }
  .kg-toolbar input[type="search"] { width: 100%; }
}
