/* ==========================================================================
   MyBo 故障处理智能体 —— 共享样式表
   深色科技风主题（深蓝 / 近黑背景 + 蓝色强调色），无外部字体与 CDN 依赖。
   login.html 与 index.html 均引用本文件。
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 设计令牌（CSS 变量）
   -------------------------------------------------------------------------- */
:root {
  /* 背景层级：越靠上层越亮 */
  --bg-root: #070b14;      /* 页面最底层背景 */
  --bg-base: #0b1220;      /* 主体区域背景 */
  --bg-panel: #101a2c;     /* 卡片 / 面板背景 */
  --bg-elev: #16223a;      /* 悬浮 / 选中态背景 */
  --bg-input: #0d1727;     /* 输入框背景 */

  /* 边框 */
  --border: #1e2d47;
  --border-strong: #2a3d5e;

  /* 文本 */
  --text: #e6edf7;
  --text-dim: #9fb0ca;
  --text-faint: #6c7f9c;

  /* 强调色 */
  --accent: #2f81f7;       /* 主强调（蓝） */
  --accent-soft: rgba(47, 129, 247, 0.14);
  --accent-line: rgba(47, 129, 247, 0.38);
  --accent-hi: #58a6ff;

  /* 语义色 */
  --danger: #f0554d;
  --danger-soft: rgba(240, 85, 77, 0.12);
  --ok: #2ea46a;
  --warn: #d29922;

  /* 尺寸 */
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.55);

  /* 布局 */
  --header-h: 60px;
  --sidebar-w: 30%;

  /* 字体：全部使用系统自带字体栈，离线可用 */
  --font-sans: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Hiragino Sans GB",
    "Source Han Sans SC", "Noto Sans CJK SC", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, "Courier New",
    monospace;
}

/* --------------------------------------------------------------------------
   2. 基础重置
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  background:
    radial-gradient(1200px 620px at 12% -8%, rgba(47, 129, 247, 0.14), transparent 62%),
    radial-gradient(900px 520px at 92% 4%, rgba(31, 96, 200, 0.10), transparent 60%),
    var(--bg-root);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  font-weight: 600;
  line-height: 1.35;
}

p {
  margin: 0 0 0.75em;
}

a {
  color: var(--accent-hi);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code, pre, kbd {
  font-family: var(--font-mono);
}

/* 通用按钮 */
button {
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #223354;
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #2c436c;
  background-clip: padding-box;
}

/* 通用小工具类 */
.hidden {
  display: none !important;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   3. 登录页
   ========================================================================== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 38px 36px 32px;
  background: linear-gradient(180deg, rgba(22, 34, 58, 0.92), rgba(11, 18, 32, 0.94));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

/* 卡片顶部的品牌色装饰条 */
.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #58a6ff 55%, rgba(88, 166, 255, 0));
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #1b5fbf);
  box-shadow: 0 6px 18px rgba(47, 129, 247, 0.35);
}

.brand-name {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0.3px;
}

.brand-sub {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 1px;
}

.login-title {
  margin: 26px 0 4px;
  font-size: 17px;
  font-weight: 600;
}

.login-desc {
  margin: 0 0 24px;
  color: var(--text-dim);
  font-size: 13px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  color: var(--text-dim);
  font-weight: 500;
}

.field input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

.field input::placeholder {
  color: #55698a;
}

.field input:focus {
  border-color: var(--accent);
  background: #0f1c30;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--bg-elev);
  color: var(--text);
  transition: background 0.16s, border-color 0.16s, transform 0.08s;
}

.btn:hover:not(:disabled) {
  background: #1c2c49;
  border-color: var(--border-strong);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary {
  width: 100%;
  height: 44px;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  border-color: rgba(88, 166, 255, 0.5);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(47, 129, 247, 0.28);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #6fb2ff, #3a8bfb);
  border-color: rgba(88, 166, 255, 0.7);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-elev);
  color: var(--text);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

/* 错误提示区 */
.alert {
  display: none;
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid rgba(240, 85, 77, 0.42);
  background: var(--danger-soft);
  color: #ffb3ad;
}

.alert.show {
  display: block;
}

.login-foot {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
}

/* ==========================================================================
   4. 应用骨架（index.html）
   ========================================================================== */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* 顶栏 */
.app-header {
  flex: 0 0 auto;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: rgba(11, 18, 32, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(6px);
}

.app-header .brand {
  min-width: 150px;
}

.app-header .brand-mark {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  font-size: 13px;
  border-radius: 9px;
}

.app-header .brand-name {
  font-size: 17px;
}

/* 页签 */
.tabs {
  display: flex;
  gap: 4px;
  margin: 0 auto;
  background: rgba(7, 11, 20, 0.6);
  padding: 4px;
  border-radius: 9px;
  border: 1px solid var(--border);
}

.tab {
  padding: 6px 18px;
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--text-dim);
  transition: background 0.16s, color 0.16s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  background: var(--accent-soft);
  color: var(--accent-hi);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

/* 右侧用户区 */
.user-box {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 150px;
  justify-content: flex-end;
}

.user-name {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.user-name b {
  color: var(--text);
  font-weight: 600;
}

/* 视图容器 */
.app-main {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
}

.view.active {
  display: flex;
}

/* ==========================================================================
   5. 故障诊断页：主对话区 + 右侧来源栏
   ========================================================================== */
.chat-wrap {
  display: flex;
  width: 100%;
  min-height: 0;
}

.chat-main {
  flex: 1 1 70%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px 28px 8px;
  scroll-behavior: smooth;
}

.chat-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* 欢迎卡片 */
.welcome {
  padding: 26px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(22, 34, 58, 0.7), rgba(11, 18, 32, 0.6));
}

.welcome h2 {
  font-size: 17px;
  margin-bottom: 8px;
}

.welcome ul {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--text-dim);
  font-size: 13px;
}

.welcome li {
  margin-bottom: 5px;
}

/* 消息 */
.msg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.msg-avatar {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.msg.user .msg-avatar {
  background: linear-gradient(135deg, #35507d, #24395c);
}

.msg.assistant .msg-avatar {
  background: linear-gradient(135deg, var(--accent), #1b5fbf);
}

.msg-body {
  flex: 1 1 auto;
  min-width: 0;
}

.msg-role {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 5px;
}

.bubble {
  padding: 12px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-panel);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.msg.user .bubble {
  background: rgba(21, 32, 54, 0.9);
}

.msg.assistant .bubble {
  background: var(--bg-panel);
}

.bubble.error {
  border-color: rgba(240, 85, 77, 0.45);
  background: var(--danger-soft);
  color: #ffb3ad;
}

/* 打字指示器 */
.typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 4px 0;
}

.typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  animation: blink 1.25s infinite ease-in-out;
}

.typing i:nth-child(2) {
  animation-delay: 0.18s;
}

.typing i:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes blink {
  0%, 80%, 100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* 输入区 */
.composer {
  flex: 0 0 auto;
  padding: 12px 28px 18px;
  border-top: 1px solid var(--border);
  background: rgba(9, 14, 24, 0.8);
}

.composer-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.composer textarea {
  flex: 1 1 auto;
  min-height: 44px;
  max-height: 190px;
  padding: 11px 14px;
  resize: none;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  line-height: 1.55;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.composer textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.composer textarea::placeholder {
  color: #55698a;
}

.composer .btn-primary {
  width: auto;
  height: 44px;
  min-width: 92px;
}

.composer-hint {
  max-width: 860px;
  margin: 7px auto 0;
  font-size: 11.5px;
  color: var(--text-faint);
}

/* 右侧来源栏 */
.side-panel {
  flex: 0 0 var(--sidebar-w);
  max-width: var(--sidebar-w);
  min-width: 260px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: rgba(9, 14, 24, 0.55);
  min-height: 0;
}

.side-title {
  flex: 0 0 auto;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.4px;
}

.side-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 14px;
}

.source-item {
  margin-bottom: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  overflow: hidden;
  transition: border-color 0.16s;
}

.source-item:hover {
  border-color: var(--border-strong);
}

.source-head {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.source-id {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent-hi);
  word-break: break-all;
}

.source-title {
  font-size: 12.5px;
  color: var(--text-dim);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.source-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-faint);
}

.score-bar {
  flex: 1 1 auto;
  height: 4px;
  border-radius: 2px;
  background: #1c2a44;
  overflow: hidden;
}

.score-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hi));
}

.score-num {
  font-family: var(--font-mono);
  flex: 0 0 auto;
}

.source-detail {
  display: none;
  padding: 0 12px 11px;
  font-size: 12.5px;
  color: var(--text-dim);
  border-top: 1px dashed var(--border);
  padding-top: 9px;
  margin-top: 2px;
}

.source-item.open .source-detail {
  display: block;
}

.source-detail .source-path {
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  word-break: break-all;
}

.side-empty {
  padding: 20px 6px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12.5px;
}

/* 知识库统计（侧栏底部） */
.kb-stats {
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
  padding: 12px 16px 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.kb-stat {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.kb-stat-label {
  font-size: 11px;
  color: var(--text-faint);
}

.kb-stat-value {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--accent-hi);
  line-height: 1.4;
}

.kb-stat-note {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--text-faint);
}

/* ==========================================================================
   6. 知识库页
   ========================================================================== */
.kb-wrap {
  display: flex;
  width: 100%;
  min-height: 0;
}

.kb-left {
  flex: 0 0 46%;
  max-width: 46%;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
}

.kb-toolbar {
  flex: 0 0 auto;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

.kb-toolbar input {
  flex: 1 1 auto;
  height: 38px;
  padding: 0 13px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}

.kb-toolbar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.kb-results {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 16px;
}

.kb-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  padding: 11px 13px;
  margin-bottom: 9px;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s;
}

.kb-item:hover {
  border-color: var(--border-strong);
  background: var(--bg-elev);
}

.kb-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-line);
}

.kb-item-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.kb-item-id {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent-hi);
}

.kb-item-score {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
}

.kb-item-title {
  margin-top: 3px;
  font-size: 13.5px;
  font-weight: 500;
}

.kb-item-summary {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 知识库详情面板 */
.kb-detail {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  padding: 20px 26px 28px;
}

.kb-detail-inner {
  max-width: 760px;
}

.kb-detail h3 {
  font-size: 17px;
  margin-bottom: 4px;
}

.kb-detail-id {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent-hi);
  margin-bottom: 14px;
}

.kb-path {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  margin-bottom: 18px;
  word-break: break-all;
}

/* 条目类型徽标（报警码 / 厂家手册 / 处置指南） */
.kb-kind {
  display: inline-block;
  font-size: 11.5px;
  line-height: 1.6;
  padding: 1px 9px;
  margin-bottom: 10px;
  border-radius: 999px;
  color: var(--accent-hi);
  background: rgba(47, 129, 247, 0.12);
  border: 1px solid rgba(47, 129, 247, 0.32);
}

/* 回答下方的生成模式 / 耗时标注 */
.msg-meta {
  font-size: 11.5px;
  color: var(--text-faint);
  margin: -6px 0 10px 44px;
  font-family: var(--font-mono);
}

.kb-section {
  margin-bottom: 20px;
}

.kb-section h4 {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.4px;
  margin-bottom: 7px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}

.kb-section p {
  font-size: 13.5px;
  color: var(--text);
  margin: 0;
}

.kb-section ul {
  margin: 0;
  padding-left: 20px;
  font-size: 13.5px;
}

.kb-section li {
  margin-bottom: 5px;
}

.kb-placeholder {
  color: var(--text-faint);
  font-size: 13px;
  padding: 40px 0;
  text-align: center;
}

/* ==========================================================================
   7. 历史记录页
   ========================================================================== */
.history-wrap {
  width: 100%;
  overflow-y: auto;
  padding: 22px 28px 40px;
}

.history-inner {
  max-width: 880px;
  margin: 0 auto;
}

.history-day {
  margin-bottom: 26px;
}

.history-day-label {
  font-size: 12px;
  color: var(--text-faint);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  letter-spacing: 0.4px;
}

.history-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.history-item .msg-avatar {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  font-size: 11px;
}

.history-item .bubble {
  padding: 10px 14px;
  font-size: 13.5px;
}

.history-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 4px;
}

/* ==========================================================================
   8. 轻量 Markdown 渲染结果样式
   ========================================================================== */
.md h2,
.md h3 {
  font-size: 15px;
  margin: 14px 0 6px;
  color: var(--accent-hi);
}

.md h2:first-child,
.md h3:first-child {
  margin-top: 0;
}

.md p {
  margin: 0 0 9px;
}

.md ul {
  margin: 0 0 9px;
  padding-left: 20px;
}

.md li {
  margin-bottom: 3px;
}

.md strong {
  color: #fff;
  font-weight: 650;
}

.md code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(47, 129, 247, 0.14);
  color: #a5d6ff;
  font-size: 12.5px;
}

.md pre {
  margin: 0 0 9px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: #060a12;
  border: 1px solid var(--border);
  overflow-x: auto;
}

.md pre code {
  padding: 0;
  background: none;
  color: #cfe3ff;
  font-size: 12.5px;
  line-height: 1.6;
}

.md table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 10px;
  font-size: 13px;
}

.md th,
.md td {
  border: 1px solid var(--border);
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}

.md th {
  background: rgba(22, 34, 58, 0.9);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.md tr:nth-child(even) td {
  background: rgba(16, 26, 44, 0.5);
}

.md blockquote {
  margin: 0 0 9px;
  padding: 6px 12px;
  border-left: 3px solid var(--accent-line);
  color: var(--text-dim);
  background: rgba(47, 129, 247, 0.06);
}

/* ==========================================================================
   9. 响应式：窄屏时侧栏折叠到下方
   ========================================================================== */
@media (max-width: 1080px) {
  :root {
    --sidebar-w: 34%;
  }
}

@media (max-width: 860px) {
  .app-header {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 10px;
  }

  .app-header .brand {
    min-width: 0;
  }

  .tabs {
    order: 3;
    width: 100%;
    margin: 0;
    justify-content: center;
  }

  .tab {
    flex: 1 1 auto;
    text-align: center;
    padding: 6px 8px;
  }

  .user-box {
    min-width: 0;
    margin-left: auto;
  }

  .user-name {
    max-width: 96px;
  }

  .chat-wrap,
  .kb-wrap {
    flex-direction: column;
  }

  /* 侧栏折叠到主区下方 */
  .side-panel {
    flex: 0 0 auto;
    max-width: none;
    width: 100%;
    max-height: 42vh;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .kb-left {
    flex: 0 0 auto;
    max-width: none;
    width: 100%;
    max-height: 46vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .kb-detail {
    flex: 1 1 auto;
    padding: 16px 18px 26px;
  }

  .chat-scroll {
    padding: 16px 16px 6px;
  }

  .composer {
    padding: 10px 16px 14px;
  }
}

@media (max-width: 560px) {
  .kb-stats {
    grid-template-columns: 1fr 1fr;
  }

  .composer .btn-primary {
    min-width: 68px;
    padding: 0 12px;
  }
}
