/* ===== 智能问答页 ===== */
.rag-root {
  /* 浅蓝→白的柔和渐变底，比灰白更有层次 */
  background: radial-gradient(1200px 500px at 10% -10%, rgba(37, 99, 235, 0.1), transparent 60%), radial-gradient(1000px 460px at 110% 0%, rgba(79, 209, 197, 0.08), transparent 55%), linear-gradient(180deg, #eef3fc 0%, #f7f9fd 260px, #f6f8fc 100%);
}
/* 侧边装饰改用轻量"开花"（见 BlossomDecor + 文件底部样式），窄屏自动隐藏 */
.rag-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 32px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 #eef2f8, 0 8px 24px rgba(30, 80, 180, 0.06);
  /* 顶部一条渐变"彩带"，增加识别度 */
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, #2563eb, #22d3ee, #4ade80) 1;
  /* 用 fixed 彻底固定顶部（sticky 在部分滚动容器下会失效/跑动） */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}
.rag-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(90deg, #1d4ed8, #2563eb, #0ea5e9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #2563eb;
}
.rag-content {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  /* 顶部导航改为 fixed → 内容区需预留导航高度，否则被遮住 */
  padding: 96px 16px 24px;
}
/* ===== 聊天面板 ===== */
.chat-panel {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #eef2f8;
  box-shadow: 0 6px 24px rgba(30, 80, 180, 0.06);
  padding: 16px;
  /* 视口高度填满(顶部 fixed 导航已预留)；滚动收敛到消息列表内部 */
  height: calc(100vh - 150px);
  min-height: 420px;
  display: flex;
  flex-direction: column;
}
.chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
/* 顶栏右侧：身份 ID 控件 */
.chat-id {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-id .chat-id-label {
  font-size: 12px;
  color: #8c8c8c;
  white-space: nowrap;
}
.chat-id .chat-id-input {
  width: 200px;
}
/* 顶栏下方的身份语义说明（把 短期/长期、同/异 ID 讲清楚） */
.chat-id-caption {
  font-size: 12px;
  color: #a6a6a6;
  line-height: 1.6;
  padding: 0 2px 10px;
  border-bottom: 1px dashed #f0f0f0;
  margin-bottom: 8px;
}
.chat-id-caption b {
  color: #595959;
}
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 4px;
}
.chat-empty {
  text-align: center;
  color: #8c8c8c;
  padding-top: 80px;
}
.chat-empty p {
  margin: 8px 0;
}
.chat-empty .chat-hint {
  font-size: 13px;
  color: #bfbfbf;
}
.chat-bubble {
  margin-bottom: 14px;
  /* 气泡宽度随内容收缩（几个字就几个字宽），太长再由 max-width 换行 */
  width: fit-content;
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 10px;
  line-height: 1.7;
}
.chat-bubble.user {
  background: linear-gradient(135deg, #2563eb 0%, #4f8dff 100%);
  color: #fff;
  margin-left: auto;
  border-top-right-radius: 2px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.18);
}
.chat-bubble.assistant {
  background: linear-gradient(180deg, #ffffff 0%, #f3f7ff 100%);
  border: 1px solid #e8effb;
  border-top-left-radius: 2px;
}
.chat-role {
  font-size: 12px;
  color: #8c8c8c;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-bubble.user .chat-role {
  color: rgba(255, 255, 255, 0.85);
}
.chat-time {
  margin-left: auto;
  font-size: 12px;
}
.chat-text {
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-refs {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #e8e8e8;
}
.hit-list {
  max-height: 240px;
  overflow-y: auto;
}
.hit-item {
  background: #fafafa;
  border: 1px solid #f0f0f0;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.hit-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 12px;
  color: #8c8c8c;
}
.hit-text {
  font-size: 13px;
  color: #595959;
}
.chat-input {
  display: flex;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}
/* ===== 轻量"开花"装饰（BlossomDecor）：整列错落向上，柔和自然色，窄屏自动隐藏 ===== */
.bloss {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.bloss-side {
  position: fixed;
  top: 104px;
  bottom: 0;
  width: 100px;
  pointer-events: none;
}
.bloss-side.is-left {
  left: 0;
}
.bloss-side.is-right {
  right: 0;
}
/* 每个"株"占一格，天然隔开，不缠 */
.bl-item {
  position: absolute;
  left: 0;
  width: 100px;
  height: 150px;
  pointer-events: none;
}
.bloom {
  position: absolute;
  left: 18px;
  top: 0;
  width: 64px;
  height: 150px;
}
/* 花头（花瓣 + 花心） */
.bl-head {
  position: absolute;
  left: 0;
  top: 0;
  width: 64px;
  height: 64px;
  animation: bloss-sway 5s ease-in-out 1.6s infinite alternate;
}
.bl-petals {
  position: absolute;
  inset: 0;
  animation: bloss-pop 0.9s 0.3s cubic-bezier(0.2, 0.8, 0.3, 1.1) both;
}
.bl-petal {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 30px;
  margin: -15px 0 0 -13px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(circle at 50% 30%, #ffe4ef, #f9a8d4 80%);
  opacity: 0.98;
}
.bloom.is-cream .bl-petal {
  background: radial-gradient(circle at 50% 30%, #fffbeb, #fde68a 82%);
}
.bl-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  border-radius: 50%;
  background: radial-gradient(#f59e0b, #fbbf24);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}
/* 花茎 + 叶：从花头往下伸一小段 */
.bl-stem {
  position: absolute;
  left: 50%;
  top: 58px;
  width: 3px;
  height: 78px;
  margin-left: -1.5px;
  transform-origin: top center;
  background: linear-gradient(#4ade80, #bbf7d0);
  border-radius: 2px;
  animation: bloss-grow 0.9s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.bl-leaf {
  position: absolute;
  left: calc(50% - 11px);
  width: 22px;
  height: 13px;
  background: radial-gradient(#86efac, #dcfce7);
  border-radius: 0 60% 0 60%;
  opacity: 0.92;
}
.bl-leaf.l1 {
  top: 76px;
  transform: rotate(-16deg);
}
.bl-leaf.l2 {
  top: 108px;
  transform: rotate(160deg);
}
@keyframes bloss-grow {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}
@keyframes bloss-pop {
  from {
    transform: scale(0.15) rotate(-8deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}
@keyframes bloss-sway {
  from {
    transform: rotate(-3deg);
  }
  to {
    transform: rotate(3deg);
  }
}
@media (max-width: 1320px) {
  .bloss {
    display: none;
  }
}

/* ===== 知识库管理页 ===== */
.kb-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #eef2f8;
  box-shadow: 0 6px 24px rgba(30, 80, 180, 0.05);
  padding: 16px;
}
/* 全量/刷新 操作栏 */
.kb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}
/* 上传条：左说明 + 右「上传并索引」，干净不挤 */
.kb-upload {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(90deg, #f7faff, #fbfcff);
  border: 1px dashed #b7cdf5;
  border-left: 4px solid #2563eb;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.kb-upload-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.kb-upload-ic {
  font-size: 22px;
  color: #1677ff;
  line-height: 26px;
}
.kb-upload-title {
  font-weight: 600;
  font-size: 15px;
  line-height: 22px;
}
.kb-upload-sub {
  color: #595959;
  font-size: 12px;
  line-height: 18px;
  margin-top: 2px;
}
.kb-upload-fmts {
  color: #999;
  font-size: 12px;
  margin-top: 2px;
}
.kb-upload-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.kb-upload-status {
  color: #1677ff;
  font-size: 12px;
}

/* ===== 监控台页 ===== */
.monitor-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #eef2f8;
  box-shadow: 0 6px 24px rgba(30, 80, 180, 0.05);
  margin-bottom: 16px;
}

