/* ============================================================
   设计 Token 系统（基于 Claude Code 桌面端官方规范）
   来源: cc-haha(MIT) 逐像素提取 + 产品业务定制
   ============================================================ */
:root {
  /* —— Claude 官方品牌色 Token —— */
  --claude:            rgb(215, 119, 87);  /* 品牌橙：主色 / Logo / 吉祥物 */
  --claude-hover:      rgb(199, 105, 75);
  --claude-soft:       rgba(215, 119, 87, 0.12);
  --on-brand:          #1F1F1F;            /* 橙色表面文字，与品牌橙对比度 6.67:1 */
  --permission:        rgb(87, 105, 247);  /* 权限蓝：审批 / 闸门指示灯 */
  --permission-soft:   rgba(87, 105, 247, 0.12);

  /* —— 语义状态色 —— */
  --success:           rgb(44, 122, 57);
  --success-soft:      rgba(44, 122, 57, 0.12);
  --error:             rgb(171, 43, 63);
  --error-soft:        rgba(171, 43, 63, 0.12);
  --warning:           rgb(150, 108, 30);
  --warning-soft:      rgba(150, 108, 30, 0.14);

  /* —— Light 主题：界面底色 —— */
  --bg-app:            #FFFFFF;            /* 主背景 */
  --bg-sidebar:        #FAF9F7;            /* 侧栏 / 状态栏 暖白 */
  --bg-tab-active:     #F0EDE8;            /* 标题栏活跃标签 */
  --bg-user-bubble:    rgb(240, 240, 240); /* 用户消息气泡 */
  --bg-actions:        rgb(232, 236, 244); /* 消息操作栏背景 */
  --bg-input:          #FFFFFF;
  --bg-hover:          rgba(0, 0, 0, 0.04);
  --bg-card:           #FFFFFF;
  --bg-code-block:     #F7F6F3;
  --bg-canvas-dark:    #1F1F1F;            /* 图谱画布深色 */

  /* —— Light 文本 —— */
  --text-primary:      rgb(0, 0, 0);
  --text-inactive:     rgb(102, 102, 102);
  --text-subtle:       rgb(175, 175, 175);

  /* —— 边线 / 分隔 —— */
  --border-prompt:     rgb(153, 153, 153); /* 输入框聚焦边 */
  --border-divider:    #E5E3DE;
  --border-soft:       rgba(0, 0, 0, 0.08);
  --selection-bg:      rgb(180, 213, 255);

  /* —— 按钮 / 卡片 —— */
  --btn-primary-bg:    #3D3D3D;
  --btn-primary-text:  #FFFFFF;

  /* —— 阴影 —— */
  --shadow-sm:         0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow-md:         0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:         0 10px 24px -6px rgba(0,0,0,0.16);
  /* Open Props 多层柔和阴影叠加（vendor/open-props-shadow.min.css） */
  --shadow-card:       var(--shadow-2, var(--shadow-md));
  --shadow-float:      var(--shadow-4, var(--shadow-lg));
  --ease-soft:         var(--ease-out-3, cubic-bezier(0.25, 1, 0.5, 1));

  /* —— 圆角 —— */
  --r-btn:             8px;
  --r-card:            12px;
  --r-input:           16px;
  --r-modal:           16px;
  --r-pill:            999px;

  /* —— 间距（8 点栅格） —— */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-6: 24px; --sp-8: 32px; --sp-12: 48px;

  /* —— 字号层级 —— */
  --fs-h1:    24px;  --lh-h1: 32px;
  --fs-h2:    18px;  --lh-h2: 24px;
  --fs-h3:    16px;  --lh-h3: 22px;
  --fs-body:  14px;  --lh-body: 20px;
  --fs-small: 13px;  --lh-small: 18px;
  --fs-cap:   12px;  --lh-cap: 16px;
  --fs-code:  13px;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Fira Code", Consolas, monospace;

  /* —— 布局尺寸 —— */
  --h-titlebar: 40px;
  --w-sidebar:  280px;
  --h-statusbar: 36px;
  --w-kb-panel: 380px;

  --transition-fast:   150ms ease;
  --transition-normal: 300ms ease;
}

/* —— Dark 主题覆写 —— */
[data-theme="dark"] {
  --claude:            rgb(215, 119, 87);
  --permission:        rgb(177, 185, 249);

  --bg-app:            #1F1F1F;
  --bg-sidebar:        #181818;
  --bg-tab-active:     #2A2A2A;
  --bg-user-bubble:    rgb(55, 55, 55);
  --bg-actions:        rgb(44, 50, 62);
  --bg-input:          #2A2A2A;
  --bg-hover:          rgba(255, 255, 255, 0.06);
  --bg-card:           #262626;
  --bg-code-block:     #1A1A1A;
  --bg-canvas-dark:    #111111;

  --text-primary:      #FFFFFF;
  --text-inactive:     rgb(180, 180, 180);
  --text-subtle:       rgb(110, 110, 110);

  --border-divider:    #2E2E2E;
  --border-soft:       rgba(255, 255, 255, 0.08);
  --border-prompt:     rgb(120, 120, 120);
  --selection-bg:      rgba(120, 150, 220, 0.35);

  --btn-primary-bg:    #E8E6E1;
  --btn-primary-text:  #1F1F1F;

  --bg-user-bubble:    rgb(55, 55, 55);
}

/* ============================================================
   基础重置
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
button, input, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--claude); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--selection-bg); }

/* 键盘焦点（WCAG AA 可见焦点） */
:focus-visible {
  outline: 2px solid var(--permission);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-divider);
  border-radius: 8px;
  border: 2px solid var(--bg-app);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

/* ============================================================
   整体布局
   ============================================================ */
.app {
  display: grid;
  grid-template-rows: var(--h-titlebar) 1fr;
  height: 100vh;
  min-width: 900px;
  min-height: 600px;
}

/* —— Title Bar (40px) —— */
.titlebar {
  display: flex;
  align-items: center;
  height: var(--h-titlebar);
  padding: 0 12px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-divider);
  -webkit-app-region: drag;
  user-select: none;
  gap: 12px;
}
.nav-arrows { display: flex; gap: 2px; -webkit-app-region: no-drag; }
.nav-btn {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
  color: var(--text-inactive);
  transition: background var(--transition-fast);
}
.nav-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.title-tabs {
  display: flex; gap: 2px; margin-left: 8px;
  -webkit-app-region: no-drag;
}
.title-tab {
  padding: 4px 12px;
  border-radius: var(--r-btn);
  font-size: var(--fs-small);
  color: var(--text-inactive);
  display: inline-flex; align-items: center; gap: 6px;
  transition: background var(--transition-fast);
}
.title-tab.active {
  background: var(--bg-tab-active);
  color: var(--text-primary);
}
.title-tab:hover:not(.active) { background: var(--bg-hover); }

.titlebar-spacer { flex: 1; }
.titlebar-actions {
  display: flex; align-items: center; gap: 4px;
  -webkit-app-region: no-drag;
}

/* —— 主区：侧栏 + 内容 + 知识库 —— */
.workspace {
  display: grid;
  grid-template-columns: var(--w-sidebar) 1fr var(--w-kb-panel);
  overflow: hidden;
  background: var(--bg-app);
}
.workspace.kb-collapsed { grid-template-columns: var(--w-sidebar) 1fr 0; }
.workspace.kb-collapsed .kb-panel { transform: translateX(100%); }

/* ============================================================
   侧栏 Sidebar
   ============================================================ */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-divider);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar-top {
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  border-bottom: 1px solid var(--border-divider);
}
.new-chat-btn {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: var(--claude);
  color: var(--on-brand);
  border-radius: var(--r-btn);
  font-size: var(--fs-body);
  font-weight: 500;
  transition: background var(--transition-fast);
}
.new-chat-btn:hover { background: var(--claude-hover); }
.new-chat-btn .left { display: flex; align-items: center; gap: 8px; }
.new-chat-btn .kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  background: rgba(255,255,255,0.18);
  border-radius: 4px;
}

.tasks-dropdown {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px;
  font-size: var(--fs-small);
  color: var(--text-inactive);
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.tasks-dropdown:hover { background: var(--bg-hover); color: var(--text-primary); }

.sidebar-search {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--bg-app);
  border: 1px solid var(--border-divider);
  border-radius: 8px;
  margin-top: 4px;
}
.sidebar-search input {
  flex: 1; border: none; background: none; outline: none;
  font-size: var(--fs-small); color: var(--text-primary);
}
.sidebar-search input::placeholder { color: var(--text-subtle); }

/* 会话分组 */
.session-list {
  flex: 1; overflow-y: auto;
  padding: 8px 6px;
}
.session-group {
  margin-bottom: 8px;
}
.session-group-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
  text-transform: uppercase;
  padding: 8px 10px 4px;
}
.session-item {
  position: relative;
  padding: 10px 12px 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition-fast);
  display: flex; flex-direction: column; gap: 4px;
}
.session-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-width: 0;
  text-align: start;
  padding: 0;
}
.session-item:hover { background: var(--bg-hover); }
.session-item.active { background: var(--bg-hover); }
.session-item.active::before {
  content: '';
  position: absolute;
  left: 6px; top: 12px; bottom: 12px;
  width: 3px;
  background: var(--claude);
  border-radius: 2px;
}
.session-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.session-title {
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1;
  padding-inline-end: 24px;
}
.session-delete {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-end: 10px;
  opacity: 0;
  width: 20px; height: 20px;
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-subtle);
  transition: opacity var(--transition-fast), background var(--transition-fast);
}
.session-item:hover .session-delete { opacity: 1; }
.session-delete:hover { background: var(--error-soft); color: var(--error); }
.session-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--text-inactive);
}
.session-degree {
  padding: 1px 6px;
  background: var(--claude-soft);
  color: var(--claude);
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 600;
}
.session-progress-text {
  font-family: var(--font-mono);
  font-size: 11px;
}
.session-progress-bar {
  height: 3px;
  background: var(--border-divider);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}
.session-progress-fill {
  height: 100%;
  background: var(--claude);
  border-radius: 2px;
  transition: width var(--transition-normal);
}

/* 侧栏底部 */
.sidebar-foot {
  padding: 10px 12px;
  border-top: 1px solid var(--border-divider);
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.foot-user {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-small); color: var(--text-inactive);
}
.foot-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--claude), #c97c5a);
  color: var(--on-brand);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}
/* theme-toggle 已移除 */


/* ============================================================
   主区 Main
   ============================================================ */
.main {
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg-app);
  position: relative;
}

/* —— 阶段进度条（对话级） —— */
.stage-bar {
  padding: 12px 24px 12px;
  border-bottom: 1px solid var(--border-divider);
  background: linear-gradient(180deg, var(--bg-app) 62%, var(--bg-sidebar));
  display: flex; align-items: flex-start; gap: 0;
  overflow-x: auto;
}
.stage-node {
  display: flex; flex-direction: column; align-items: center;
  position: relative;
  flex-shrink: 0;
  min-width: 72px;
  gap: 6px;
}
.stage-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-app);
  border: 1.5px solid var(--border-divider);
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
  z-index: 2;
  transition: background var(--transition-normal) var(--ease-soft),
    border-color var(--transition-normal) var(--ease-soft),
    box-shadow var(--transition-normal) var(--ease-soft),
    transform var(--transition-normal) var(--ease-soft);
}
.stage-label {
  font-size: 11px;
  line-height: 16px;
  color: var(--text-subtle);
  white-space: nowrap;
  padding: 1px 8px;
  border-radius: 999px;
  transition: color var(--transition-normal) var(--ease-soft),
    background var(--transition-normal) var(--ease-soft);
}

.stage-dot .stage-icon {
  width: 14px; height: 14px;
  stroke-width: 2;
  color: var(--text-subtle);
  transition: color var(--transition-normal) var(--ease-soft);
}
.stage-node.done .stage-dot {
  background: var(--success);
  box-shadow: 0 0 0 1px var(--success);
}
.stage-node.done .stage-icon { color: #fff; }
.stage-node.done .stage-label { color: var(--text-inactive); }
.stage-node.done-limited .stage-dot {
  background: var(--warning);
  box-shadow: 0 0 0 1px var(--warning);
}
.stage-node.done-limited .stage-icon { color: #fff; }
.stage-node.done-limited .stage-label { color: var(--warning); font-weight: 600; }
.stage-node.current .stage-dot {
  background: var(--claude);
  border-color: var(--claude);
  box-shadow: 0 0 0 5px var(--claude-soft), var(--shadow-card);
  transform: scale(1.06);
  animation: pulse 2s ease-in-out infinite;
}
.stage-node.current .stage-icon { color: #fff; }
.stage-node.current .stage-label {
  color: var(--claude);
  font-weight: 600;
  background: var(--claude-soft);
}
.stage-node.revert .stage-dot {
  background: var(--warning);
  box-shadow: 0 0 0 1px var(--warning);
}
.stage-node.revert .stage-icon { color: #fff; }
.stage-node.revert .stage-label { color: var(--warning); font-weight: 600; }
.stage-node.gate .stage-dot {
  background: var(--bg-app);
  border: 2px dashed var(--permission);
}
.stage-node.gate .stage-icon { color: var(--permission); }
.stage-node.gate .stage-dot::after {
  content: '';
  position: absolute;
  inset: -6px;
  border: 1.5px dashed var(--permission);
  border-radius: 50%;
  animation: spin 8s linear infinite;
}
.stage-node.gate .stage-label {
  color: var(--permission);
  font-weight: 600;
  background: rgba(87, 105, 247, 0.08);
}
.stage-line {
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: var(--border-divider);
  margin-top: 14px;
  min-width: 8px;
}
.stage-line.done { background: var(--success); }
.stage-line.done-limited { background: var(--warning); }

.resume-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 12px 24px 0;
  padding: 12px 14px;
  border: 1px solid var(--permission);
  border-radius: 12px;
  background: var(--permission-soft);
}
.resume-banner[hidden] { display: none; }
.resume-banner-copy { min-width: 0; }
.resume-banner h2 { font-size: 13px; line-height: 18px; }
.resume-banner p { margin: 3px 0 0; color: var(--text-subtle); font-size: 12px; line-height: 17px; }
.resume-banner .resume-next { color: var(--text-primary); }

@media (max-width: 700px) {
  .resume-banner { align-items: stretch; flex-direction: column; margin-inline: 12px; }
  .resume-banner .btn { width: 100%; }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 5px var(--claude-soft), var(--shadow-card); }
  50%      { box-shadow: 0 0 0 9px var(--claude-soft), var(--shadow-card); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* —— 对话流 —— */
.chat-flow {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0 8px;
  scroll-behavior: smooth;
}
.chat-inner { max-width: 820px; margin: 0 auto; padding: 0 24px 80px; }

.msg {
  margin-bottom: 24px;
  display: flex; flex-direction: column;
}
.msg.user { align-items: flex-end; }
.msg.ai { align-items: flex-start; }

.bubble {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-primary);
  word-wrap: break-word;
}
.msg.user .bubble {
  background: var(--bg-user-bubble);
  border-top-right-radius: 4px;
}
.msg.ai .bubble {
  background: transparent;
  padding-left: 0; padding-right: 0;
  max-width: 100%;
}
.msg.ai .bubble p { margin-bottom: 10px; }
.msg.ai .bubble p:last-child { margin-bottom: 0; }
.msg.ai .bubble code {
  font-family: var(--font-mono);
  font-size: var(--fs-code);
  background: var(--bg-code-block);
  padding: 1px 5px;
  border-radius: 4px;
}
.msg-meta {
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 4px;
  display: flex; align-items: center; gap: 8px;
}

/* —— 工具调用卡 —— */
.tool-card {
  margin: 12px 0;
  background: var(--bg-card);
  border: 1px solid var(--border-divider);
  border-radius: var(--r-card);
  overflow: hidden;
  font-size: var(--fs-small);
  transition: box-shadow var(--transition-fast);
}
.tool-card:hover { box-shadow: var(--shadow-sm); }
.tool-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
}
.tool-card-head .left { display: flex; align-items: center; gap: 8px; }
.tool-icon {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--claude);
}
.tool-name {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--text-primary);
  font-weight: 500;
}
.tool-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
}
.tool-status.done   { background: var(--success-soft); color: var(--success); }
.tool-status.run    { background: var(--claude-soft); color: var(--claude); }
.tool-status.fail   { background: var(--error-soft); color: var(--error); }
.tool-chevron {
  color: var(--text-subtle);
  transition: transform var(--transition-fast);
}
.tool-card.open .tool-chevron { transform: rotate(90deg); }
.tool-card-body {
  display: none;
  padding: 0 14px 12px;
  border-top: 1px solid var(--border-divider);
  margin-top: 0;
  padding-top: 10px;
}
.tool-card.open .tool-card-body { display: block; }
.tool-card-body pre {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-code-block);
  padding: 10px 12px;
  border-radius: 8px;
  overflow-x: auto;
  color: var(--text-inactive);
  line-height: 1.6;
}

/* —— 文献检索结果卡 —— */
.ref-card {
  margin: 12px 0;
  background: var(--bg-card);
  border: 1px solid var(--border-divider);
  border-left: 3px solid var(--claude);
  border-radius: var(--r-card);
  padding: 12px 14px;
  font-size: var(--fs-small);
}
.ref-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.ref-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--fs-body);
  line-height: 1.4;
}
.ref-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  color: var(--text-inactive);
  font-size: 11px;
  margin-bottom: 8px;
}
.ref-citation {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-inactive);
  background: var(--bg-code-block);
  padding: 6px 8px;
  border-radius: 6px;
  line-height: 1.55;
}
.ref-actions {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px;
}

/* —— 可靠度徽章 —— */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.verified  { background: var(--success-soft); color: var(--success); }
.badge.matched   { background: var(--permission-soft); color: var(--permission); }
.badge.discovery { background: var(--border-divider); color: var(--text-inactive); }
.badge.uncertain { background: var(--warning-soft); color: var(--warning); }
.literature-relevance { font-variant-numeric: tabular-nums; }

/* —— 链接按钮（跳转下载） —— */
.link-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px;
  background: var(--claude-soft);
  color: var(--claude);
  border-radius: var(--r-btn);
  font-size: 12px;
  font-weight: 500;
  transition: background var(--transition-fast);
}
.link-btn:hover { background: var(--claude); color: var(--on-brand); }

/* —— 警告卡（评审未通过） —— */
.warn-card {
  margin: 12px 0;
  background: var(--warning-soft);
  border: 1px solid var(--warning);
  border-radius: var(--r-card);
  padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 10px;
}
.warn-card .warn-icon {
  color: var(--warning);
  flex-shrink: 0;
  margin-top: 1px;
}
.warn-card .warn-body { flex: 1; font-size: var(--fs-small); }
.warn-card .warn-title {
  font-weight: 600;
  color: var(--warning);
  margin-bottom: 4px;
}
.warn-card .warn-actions {
  display: flex; gap: 8px;
  margin-top: 10px;
}

/* —— 确认闸门块 —— */
.gate-block {
  margin: 16px 0 8px;
  padding: 14px 16px;
  background: linear-gradient(180deg, var(--claude-soft) 0%, transparent 100%);
  border: 1px solid var(--claude);
  border-radius: var(--r-card);
}
.gate-hint {
  font-size: 12px;
  color: var(--text-inactive);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.gate-hint .gate-dot {
  width: 6px; height: 6px;
  background: var(--permission);
  border-radius: 50%;
  animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.3; }
}
.gate-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.gate-label {
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--text-primary);
}

/* —— 按钮 —— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-btn);
  font-size: var(--fs-small);
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}
.btn-primary:hover:not(:disabled) {
  background: var(--text-primary);
  color: var(--bg-app);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-primary:disabled {
  opacity: 0.5; cursor: not-allowed;
}
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-divider);
}
.btn-secondary:hover { background: var(--bg-hover); }
.btn-ghost {
  background: transparent;
  color: var(--text-inactive);
  padding: 6px 10px;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* —— 产物卡 —— */
.artifact-card {
  margin: 12px 0;
  background: var(--bg-card);
  border: 1px solid var(--border-divider);
  border-radius: var(--r-card);
  overflow: hidden;
}
.artifact-head {
  padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-divider);
  background: var(--bg-code-block);
}
.artifact-title {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-small);
  font-weight: 500;
}
.artifact-type {
  font-size: 11px;
  color: var(--text-subtle);
  font-family: var(--font-mono);
}
.artifact-preview {
  padding: 12px 14px;
  font-size: var(--fs-small);
  color: var(--text-inactive);
  line-height: 1.6;
}

/* —— 输入区 —— */
.input-area {
  padding: 12px 24px 16px;
  background: var(--bg-app);
  border-top: 1px solid var(--border-divider);
}
.input-inner { max-width: 820px; margin: 0 auto; }
.input-box {
  position: relative;
  border: 1px solid var(--border-divider);
  border-radius: var(--r-input);
  background: var(--bg-input);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input-box:focus-within {
  border-color: var(--border-prompt);
  box-shadow: 0 0 0 3px rgba(153, 153, 153, 0.12);
}
.input-box textarea {
  width: 100%;
  border: none; outline: none; resize: none;
  background: transparent;
  padding: 14px 56px 14px 16px;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-primary);
  min-height: 52px;
  max-height: 200px;
  font-family: var(--font-sans);
}
.input-box textarea::placeholder { color: var(--text-subtle); }

/* —— 发送按钮（图片4风格的回车弯箭头图标） —— */
.input-send {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-subtle);
  background: transparent;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.input-send:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.input-send:disabled {
  opacity: 0.45; cursor: not-allowed;
}
.input-box textarea {
  padding-right: 50px;
}

/* —— 输入区下方一行控件（确认模式 + 模型选择） —— */
.input-controls {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px;
  font-size: var(--fs-small);
  gap: 12px;
}
.input-controls-left, .input-controls-right {
  display: flex; align-items: center; gap: 6px;
}
.input-controls-right { gap: 10px; }

/* —— 确认模式 chip —— */
.perm-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px 5px 8px;
  background: rgba(220, 190, 110, 0.18);  /* 淡黄 */
  color: rgb(150, 108, 30);                /* warning 同色系 */
  border: 1px solid rgba(220, 190, 110, 0.35);
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 500;
  transition: background var(--transition-fast);
}
.perm-chip:hover { background: rgba(220, 190, 110, 0.28); }
.perm-chip svg { color: rgb(150, 108, 30); }
.perm-add {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-inactive);
  border-radius: 50%;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.perm-add:hover { background: var(--bg-hover); color: var(--text-primary); }

/* —— 模型 chip —— */
.model-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px 5px 10px;
  background: transparent;
  border-radius: var(--r-pill);
  color: var(--text-inactive);
  font-size: 12px;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.model-chip:hover { background: var(--bg-hover); color: var(--text-primary); }
.model-chip .model-name { color: inherit; }
.model-chip .model-cap {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-hover);
  padding: 1px 6px;
  border-radius: var(--r-pill);
  color: var(--text-subtle);
}
.model-chip .model-chev { opacity: 0.6; }
.model-chip.subtle { color: var(--text-subtle); }
.model-chip[aria-pressed="true"] {
  background: var(--claude-soft);
  color: var(--claude);
}
.model-chip[aria-pressed="true"] svg { color: var(--claude); }

/* —— 主题切换（图片4右侧的圆形图标按钮） —— */
/* theme-toggle 已移除 */


[data-theme="dark"] .perm-chip {
  background: rgba(220, 190, 110, 0.22);
  border-color: rgba(220, 190, 110, 0.4);
}

/* ============================================================
   通用 Dropdown 组件（模型 / 模式 / +号 三个下拉复用）
   ============================================================ */
.dd-menu {
  position: fixed;
  z-index: 200;
  min-width: 240px;
  max-width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-divider);
  border-radius: 10px;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.06);
  padding: 6px;
  display: none;
  transform-origin: bottom left;
  animation: ddIn 160ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.dd-menu.show { display: block; }
.dd-menu.align-right { transform-origin: bottom right; }
@keyframes ddIn {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.dd-head {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-subtle);
  letter-spacing: 0.02em;
  padding: 8px 10px 6px;
}
.dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: var(--fs-small);
  color: var(--text-primary);
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background var(--transition-fast);
}
.dd-item:hover { background: var(--bg-hover); }
.dd-item.active { background: var(--bg-hover); }
.dd-item .dd-icon {
  width: 14px; height: 14px;
  color: var(--text-inactive);
  flex-shrink: 0;
}
.dd-item:hover .dd-icon,
.dd-item.active .dd-icon { color: var(--text-primary); }
.dd-item .dd-label { flex: 1; }
.dd-item .dd-kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-subtle);
  min-width: 28px; text-align: right;
}
.dd-item .dd-check {
  color: var(--claude);
  font-weight: 600;
  font-size: 12px;
  min-width: 12px;
}
.dd-item .dd-chevron {
  width: 12px; height: 12px;
  color: var(--text-subtle);
}

/* ============================================================
   Ultracode 思考深度滑块（紫色→橙色渐变 + thumb）
   ============================================================ */
.uc-slider {
  display: inline-flex; align-items: center;
  padding: 4px 10px 4px 12px;
  background: transparent;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--transition-fast);
  user-select: none;
}
.uc-slider:hover { background: var(--bg-hover); }
.uc-slider.active {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.18), rgba(244, 114, 182, 0.18), rgba(251, 146, 60, 0.18));
}
.uc-label {
  font-size: 12px;
  font-weight: 500;
  background: linear-gradient(90deg, #A78BFA, #F472B6, #FB923C);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-right: 8px;
}
.uc-slider.active .uc-label {
  font-weight: 600;
}
.uc-track {
  position: relative;
  width: 80px;
  height: 16px;
  display: flex; align-items: center;
  margin-left: 4px;
}
.uc-track::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 4px;
  background: var(--border-divider);
  border-radius: 2px;
}
.uc-slider.active .uc-track::before {
  background: linear-gradient(90deg, #A78BFA, #F472B6, #FB923C);
  opacity: 0.45;
}
.uc-thumb {
  position: relative;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25), 0 0 0 1px var(--border-divider);
  transition: left 200ms cubic-bezier(0.2, 0.9, 0.3, 1), background 200ms ease, box-shadow 200ms ease;
}
.uc-slider.active .uc-thumb {
  left: calc(100% - 14px) !important;
  background: linear-gradient(135deg, #A78BFA, #FB923C);
  box-shadow: 0 0 0 1px rgba(251, 146, 60, 0.5), 0 0 12px rgba(251, 146, 60, 0.5);
}
.uc-slider.smarter .uc-thumb {
  box-shadow: 0 0 0 2px rgba(251, 146, 60, 0.3), 0 0 16px rgba(244, 114, 182, 0.4);
}

/* ============================================================
   上下文窗口进度卡片
   ============================================================ */
.context-card {
  margin: 0 auto 12px;
  max-width: 820px;
  background: var(--bg-card);
  border: 1px solid var(--border-divider);
  border-radius: 10px;
  padding: 10px 14px 12px;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.context-card:hover {
  border-color: var(--border-prompt);
  box-shadow: var(--shadow-sm);
}
.cc-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.cc-label {
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--text-primary);
}
.cc-meta {
  display: flex; align-items: center; gap: 4px;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--text-inactive);
}
.cc-meta .chev { color: var(--text-subtle); }
.cc-bar {
  height: 4px;
  background: var(--border-divider);
  border-radius: 2px;
  overflow: hidden;
}
.cc-bar-fill {
  height: 100%;
  width: 54%;
  background: #3B82F6;
  border-radius: 2px;
  transition: width var(--transition-normal);
}
[data-theme="dark"] .cc-bar-fill { background: #60A5FA; }

/* 模型 chip 触发器箭头旋转 */
.model-chip[aria-expanded="true"] .model-chev { transform: rotate(180deg); }

/* ============================================================
   Popover 气泡弹窗组件（上下文详情 / Ultracode 弹窗复用）
   ============================================================ */
.popover {
  position: fixed;
  z-index: 250;
  background: var(--bg-card);
  border: 1px solid var(--border-divider);
  border-radius: 14px;
  box-shadow: 0 16px 40px -8px rgba(0,0,0,0.22), 0 2px 8px rgba(0,0,0,0.08);
  padding: 16px;
  display: none;
  transform-origin: bottom center;
  animation: popIn 200ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.popover.show { display: block; }
@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
/* 上方小三角（默认） */
.popover::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px; height: 12px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-divider);
  border-bottom: 1px solid var(--border-divider);
}
/* 下方小三角（当 popover 在触发器上方时） */
.popover.below {
  transform-origin: top center;
  animation: popInDown 200ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.popover.below::before {
  top: -6px;
  bottom: auto;
  border-right: none;
  border-bottom: none;
  border-left: 1px solid var(--border-divider);
  border-top: 1px solid var(--border-divider);
}
@keyframes popInDown {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* —— 上下文详细 Popover —— */
.ctx-pop {
  width: 360px;
}
.ctx-pop-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.ctx-pop-title {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--text-primary);
}
.ctx-pop-close {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-subtle);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.ctx-pop-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.ctx-big-num {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.ctx-big-pct {
  font-size: 13px;
  color: var(--text-inactive);
  margin-left: 4px;
}
.ctx-bar-smooth {
  position: relative;
  height: 8px;
  background: var(--border-divider);
  border-radius: 4px;
  overflow: hidden;
  margin: 14px 0 12px;
}
.ctx-bar-smooth::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(59,130,246,0.06) 50%, transparent 100%);
  animation: shimmer 2.4s linear infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}
.ctx-bar-fill-smooth {
  height: 100%;
  width: 54%;
  background: linear-gradient(90deg, #60A5FA, #3B82F6);
  border-radius: 4px;
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.ctx-bar-fill-smooth::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 12px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6));
  border-radius: 4px;
}
.ctx-legend {
  display: flex; gap: 12px;
  font-size: 11px;
  color: var(--text-inactive);
}
.ctx-legend .lg-it {
  display: inline-flex; align-items: center; gap: 4px;
}
.ctx-legend .lg-dot {
  width: 8px; height: 8px;
  border-radius: 2px;
}
.ctx-detail-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid var(--border-divider);
  font-size: var(--fs-small);
}
.ctx-detail-row:first-of-type { border-top: none; }
.ctx-detail-row .cdr-label { color: var(--text-inactive); }
.ctx-detail-row .cdr-val {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* —— 上下文卡片主视图：环形百分比 —— */
.context-card {
  margin: 0 auto 12px;
  max-width: 820px;
  background: var(--bg-card);
  border: 1px solid var(--border-divider);
  border-radius: 10px;
  padding: 10px 14px 12px;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.context-card:hover {
  border-color: var(--border-prompt);
  box-shadow: var(--shadow-sm);
}
.cc-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}
.cc-left {
  display: flex; align-items: center; gap: 12px;
}
.cc-ring {
  position: relative;
  width: 36px; height: 36px;
  flex-shrink: 0;
}
.cc-ring svg {
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}
.cc-ring .ring-bg {
  fill: none;
  stroke: var(--border-divider);
  stroke-width: 4;
}
.cc-ring .ring-fg {
  fill: none;
  stroke: var(--claude);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dasharray 600ms cubic-bezier(0.4, 0, 0.2, 1);
}
.cc-ring .ring-text {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-primary);
}
.cc-meta-stack {
  display: flex; flex-direction: column; gap: 2px;
}
.cc-label {
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--text-primary);
}
.cc-sub {
  font-size: 11px;
  color: var(--text-inactive);
  font-family: var(--font-mono);
}
.cc-right {
  display: flex; align-items: center; gap: 4px;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--text-inactive);
}
.cc-right .chev { color: var(--text-subtle); }
.cc-bar {
  height: 4px;
  background: var(--border-divider);
  border-radius: 2px;
  overflow: hidden;
}
.cc-bar-fill {
  height: 100%;
  width: 54%;
  background: linear-gradient(90deg, #60A5FA, #3B82F6);
  border-radius: 2px;
  transition: width var(--transition-normal);
}
[data-theme="dark"] .cc-bar-fill {
  background: linear-gradient(90deg, #93C5FD, #60A5FA);
}

/* —— Ultracode 弹窗 —— */
.uc-pop {
  width: 320px;
}
.uc-pop-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.uc-pop-title {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 6px;
}
.uc-pop-title .uc-name {
  background: linear-gradient(90deg, #A78BFA, #F472B6, #FB923C);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.uc-help-btn {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-subtle);
  border: 1px solid var(--border-divider);
  font-size: 10px;
  transition: all var(--transition-fast);
}
.uc-help-btn:hover { color: var(--text-primary); border-color: var(--text-subtle); }
.uc-ends {
  display: flex; justify-content: space-between;
  font-size: 11px;
  color: var(--text-inactive);
  margin-bottom: 8px;
}
.uc-track-big {
  position: relative;
  width: 100%;
  height: 26px;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}
.uc-track-big-track {
  position: absolute;
  inset: 0;
  height: 14px;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 999px;
  background: var(--bg-hover);
  overflow: hidden;
}
.uc-track-big-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #A855F7, #EC4899, #F97316);
  transition: width 0.18s ease;
  width: 0%;
}
.uc-track-big.active .uc-track-big-fill { width: 65%; }
.uc-track-big-stops {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 11px;
  pointer-events: none;
}
.uc-track-big-stops span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-subtle);
  opacity: 0.9;
}
.uc-track-big.active .uc-track-big-stops span.on { background: var(--text-primary); }
.uc-thumb-big {
  position: absolute;
  top: 50%;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-divider);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transform: translate(-50%, -50%);
  transition: left 0.18s ease;
  left: 0%;
}
.uc-track-ticks { display: none; }
.uc-value { display: none; }
.uc-value strong {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 600;
}

/* ============================================================
   知识库面板
   ============================================================ */
.kb-panel {
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-divider);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: transform var(--transition-normal);
}
.kb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-divider);
}
.kb-head-title {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-small);
  font-weight: 600;
  min-width: 0;
}
.kb-head-title > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-head-title .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
}
.kb-tabs {
  display: flex;
  padding: 0 8px;
  border-bottom: 1px solid var(--border-divider);
  overflow-x: auto;
  scrollbar-width: thin;
}
.kb-tab {
  flex: 0 0 auto;
  min-width: 58px;
  padding: 10px 8px;
  font-size: var(--fs-small);
  color: var(--text-inactive);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  text-align: center;
}
.kb-tab:hover { color: var(--text-primary); }
.kb-tab.active {
  color: var(--claude);
  border-bottom-color: var(--claude);
  font-weight: 500;
}
.kb-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.kb-pane { display: none; }
.kb-pane.active { display: block; }

/* 文献池 */
.kb-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 4px 4px 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.kb-section-title .count {
  font-weight: 500;
  color: var(--text-inactive);
}
.ref-item {
  padding: 10px 10px;
  border-radius: 8px;
  margin-bottom: 4px;
  transition: background var(--transition-fast);
  cursor: pointer;
}
.ref-item:hover { background: var(--bg-hover); }
.ref-item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 4px;
}
.ref-item-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px;
  color: var(--text-inactive);
}
.ref-item-actions {
  display: flex; gap: 4px;
  margin-top: 6px;
}
.icon-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-inactive);
  transition: all var(--transition-fast);
}
.icon-btn:hover {
  background: var(--claude-soft);
  color: var(--claude);
}

/* 笔记（TipTap 模拟） */
.note-editor {
  background: var(--bg-app);
  border: 1px solid var(--border-divider);
  border-radius: 8px;
  padding: 12px 14px;
  min-height: 240px;
  font-size: var(--fs-small);
  line-height: 1.7;
  color: var(--text-primary);
  outline: none;
}
.note-editor h2 { font-size: 16px; font-weight: 600; margin: 6px 0 4px; }
.note-editor p { margin-bottom: 6px; }
.note-bilink {
  color: var(--permission);
  background: var(--permission-soft);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
}
.note-bilink:hover { text-decoration: underline; }
.note-toolbar {
  display: flex; gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-divider);
  background: var(--bg-sidebar);
  border-radius: 8px 8px 0 0;
}
.note-toolbar .tb-btn {
  width: 26px; height: 26px;
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-inactive);
  font-size: 12px;
}
.note-toolbar .tb-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* 图谱 */
.graph-wrap {
  position: relative;
  background: var(--bg-canvas-dark);
  border-radius: 8px;
  height: 320px;
  overflow: hidden;
}
.graph-wrap svg { width: 100%; height: 100%; display: block; }
.graph-legend {
  position: absolute;
  bottom: 8px; left: 8px;
  background: rgba(0,0,0,0.5);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  color: #fff;
  display: flex; gap: 12px;
}
.graph-legend .lg {
  display: inline-flex; align-items: center; gap: 4px;
}
.graph-legend .lg::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
}
.graph-legend .lg.theme::before { background: var(--claude); }
.graph-legend .lg.method::before { background: var(--success); }
.graph-legend .lg.data::before { background: #6FB7FF; }

/* ============================================================
   Status Bar
   ============================================================ */
.statusbar {
  display: flex; align-items: center;
  height: var(--h-statusbar);
  padding: 0 14px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-divider);
  font-size: 11px;
  color: var(--text-inactive);
  gap: 16px;
  user-select: none;
}
.sb-item {
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.sb-item .icon { color: var(--text-subtle); }
.sb-divider { width: 1px; height: 14px; background: var(--border-divider); }
.sb-spacer { flex: 1; }
.sb-item.clickable { cursor: pointer; transition: color var(--transition-fast); }
.sb-item.clickable:hover { color: var(--text-primary); }
.sb-item .pulse-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--claude);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

/* ============================================================
   侧栏底部触发器 + 弹出菜单（仿 Claude Code 桌面端）
   ============================================================ */
.foot-trigger {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: var(--fs-small);
  color: var(--text-inactive);
  transition: background var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
  min-width: 0;
}
.foot-trigger:hover { background: var(--bg-hover); color: var(--text-primary); }
.foot-trigger.open { background: var(--bg-hover); color: var(--text-primary); }
.foot-trigger .label {
  flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: left;
}
.foot-trigger .chevron {
  color: var(--text-subtle);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}
.foot-trigger.open .chevron { transform: rotate(180deg); }

/* —— 菜单弹层（仿 Claude Code） —— */
.foot-menu {
  position: fixed;
  left: 12px; bottom: 48px;
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border-divider);
  border-radius: 12px;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.06);
  z-index: 100;
  overflow: hidden;
  display: none;
  transform-origin: bottom left;
  animation: menuIn 180ms ease-out;
}
.foot-menu.show { display: block; }
@keyframes menuIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.menu-head {
  padding: 14px 14px 12px;
  display: flex; align-items: flex-start; gap: 10px;
}
.menu-head-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--claude), #c97c5a);
  color: var(--on-brand);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  flex-shrink: 0;
}
.menu-head-info {
  flex: 1; min-width: 0;
}
.menu-head-name {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.menu-head-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px;
  color: var(--text-inactive);
}
.menu-head-status .ok-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2px var(--success-soft);
  animation: pulse-dot 2s ease-in-out infinite;
}
.menu-list {
  padding: 4px 6px 6px;
}
.menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: var(--fs-body);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
  width: 100%;
  text-align: left;
  background: transparent;
}
.menu-item:hover { background: var(--bg-hover); }
.menu-item .mi-icon {
  width: 16px; height: 16px;
  color: var(--text-inactive);
  flex-shrink: 0;
}
.menu-item:hover .mi-icon { color: var(--text-primary); }
.menu-item .mi-label { flex: 1; }
.menu-item .mi-kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-inactive);
}
.menu-item .mi-chevron {
  width: 14px; height: 14px;
  color: var(--text-subtle);
  flex-shrink: 0;
}
.menu-divider {
  height: 1px;
  background: var(--border-divider);
  margin: 4px 6px;
}

/* —— 语言子菜单 —— */
.lang-submenu {
  position: fixed;
  left: 296px; bottom: 48px;
  width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border-divider);
  border-radius: 10px;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,0.18);
  z-index: 101;
  padding: 4px;
  display: none;
  animation: menuIn 180ms ease-out;
}
.lang-submenu.show { display: block; }
.lang-option {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: var(--fs-small);
  color: var(--text-primary);
  cursor: pointer;
  width: 100%;
  background: transparent;
  text-align: left;
}
.lang-option:hover { background: var(--bg-hover); }
.lang-option.active {
  background: var(--claude-soft);
  color: var(--claude);
  font-weight: 500;
}
.lang-option .flag {
  font-size: 14px;
  width: 16px; text-align: center;
}
.lang-option .check {
  margin-left: auto;
  color: var(--claude);
  opacity: 0;
}
.lang-option.active .check { opacity: 1; }

/* ============================================================
   设置面板（仿 Claude Code 桌面端）
   ============================================================ */
.settings-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.40);
  display: none;
  align-items: center; justify-content: center;
  z-index: 1100;
  backdrop-filter: blur(3px);
}
.settings-overlay.show { display: flex; animation: fadeIn 150ms ease; }

.settings-panel {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 24px 60px -12px rgba(0,0,0,0.30), 0 4px 12px rgba(0,0,0,0.10);
  width: 880px;
  max-width: 92vw;
  height: 640px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: scaleIn 220ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.settings-header {
  display: flex; align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-divider);
}
.settings-search {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-app);
  border: 1px solid var(--border-divider);
  border-radius: 8px;
  padding: 6px 10px;
  transition: border-color var(--transition-fast);
}
.settings-search:focus-within { border-color: var(--border-prompt); }
.settings-search svg { color: var(--text-subtle); flex-shrink: 0; }
.settings-search input {
  flex: 1;
  border: none; background: none; outline: none;
  font-size: var(--fs-small);
  color: var(--text-primary);
}
.settings-search input::placeholder { color: var(--text-subtle); }
.settings-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-inactive);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.settings-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.settings-body {
  flex: 1;
  display: grid;
  grid-template-columns: 220px 1fr;
  overflow: hidden;
}
.settings-nav {
  padding: 12px 8px;
  border-right: 1px solid var(--border-divider);
  overflow-y: auto;
  background: var(--bg-sidebar);
}
.settings-nav-group-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-subtle);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 12px 6px;
}
.settings-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: var(--fs-small);
  color: var(--text-inactive);
  cursor: pointer;
  width: 100%;
  background: transparent;
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.settings-nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.settings-nav-item.active {
  background: var(--bg-hover);
  color: var(--text-primary);
  font-weight: 500;
}
.settings-nav-item .ni-icon { width: 14px; height: 14px; flex-shrink: 0; color: inherit; }

.settings-content {
  padding: 24px 28px;
  overflow-y: auto;
  background: var(--bg-app);
}
.settings-content[hidden] { display: none; }
.settings-section-title {
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 18px;
}
.settings-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-divider);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 24px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label {
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.settings-row-desc {
  font-size: var(--fs-small);
  color: var(--text-inactive);
  line-height: 1.5;
  max-width: 460px;
}
.settings-row-control { display: flex; align-items: center; gap: 8px; }

/* 开关 */
.toggle {
  position: relative;
  width: 36px; height: 20px;
  background: var(--border-divider);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.on { background: var(--claude); }
.toggle.on::after { transform: translateX(16px); }

/* 选择器（Select） */
.select {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px 6px 12px;
  background: var(--bg-app);
  border: 1px solid var(--border-divider);
  border-radius: 6px;
  font-size: var(--fs-small);
  color: var(--text-primary);
  cursor: pointer;
  min-width: 140px;
  justify-content: space-between;
  transition: border-color var(--transition-fast);
}
.select:hover { border-color: var(--border-prompt); }
.select .chev {
  color: var(--text-subtle);
  flex-shrink: 0;
}

/* 字体输入框 */
.input-line {
  display: inline-flex; align-items: center;
  background: var(--bg-app);
  border: 1px solid var(--border-divider);
  border-radius: 6px;
  padding: 6px 12px;
  min-width: 220px;
  transition: border-color var(--transition-fast);
}
.input-line:focus-within { border-color: var(--border-prompt); box-shadow: 0 0 0 3px rgba(153,153,153,0.12); }
.input-line input {
  flex: 1;
  border: none; background: none; outline: none;
  font-size: var(--fs-small);
  color: var(--text-primary);
}
.input-line input::placeholder { color: var(--text-subtle); }

/* 转录文本大小分段 */
.segmented {
  display: inline-flex;
  background: var(--bg-app);
  border: 1px solid var(--border-divider);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.segmented button {
  padding: 5px 16px;
  font-size: var(--fs-small);
  color: var(--text-inactive);
  border-radius: 6px;
  transition: background var(--transition-fast), color var(--transition-fast);
  min-width: 44px;
}
.segmented button.active {
  background: var(--bg-hover);
  color: var(--text-primary);
  font-weight: 500;
}

/* 代码外观预览对 */
.code-preview-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}
.code-preview-card {
  display: flex; flex-direction: column; gap: 8px;
}
.code-preview-card .cp-head {
  display: flex; align-items: center; gap: 8px;
}
.code-preview-card .cp-body {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  padding: 12px 14px;
  border-radius: 8px;
  overflow: hidden;
}
.cp-light {
  background: #FFFFFF;
  border: 1px solid var(--border-divider);
  color: #1F1F1F;
}
.cp-light .ln-num { color: #B0B0B0; user-select: none; display: inline-block; width: 18px; }
.cp-light .kw { color: #AF00DB; }
.cp-light .fn { color: #0066CC; }
.cp-light .str { color: #C7254E; background: #F9F2F4; }
.cp-light .var { color: #1F1F1F; }
.cp-light .punct { color: #1F1F1F; }
.cp-light .brc { color: #1F1F1F; }
.cp-light .brace-op { background: rgba(255, 220, 210, 0.45); display: inline-block; width: 100%; }
.cp-light .brace-mod { background: rgba(220, 245, 220, 0.45); display: inline-block; width: 100%; }

.cp-dark {
  background: #1E1E1E;
  color: #D4D4D4;
  border: 1px solid #2A2A2A;
}
.cp-dark .ln-num { color: #6E6E6E; user-select: none; display: inline-block; width: 18px; }
.cp-dark .kw { color: #C586C0; }
.cp-dark .fn { color: #569CD6; }
.cp-dark .str { color: #CE9178; }
.cp-dark .var { color: #D4D4D4; }
.cp-dark .punct { color: #D4D4D4; }
.cp-dark .brc { color: #D4D4D4; }
.cp-dark .brace-op { background: rgba(180, 80, 60, 0.25); display: inline-block; width: 100%; }
.cp-dark .brace-mod { background: rgba(60, 110, 60, 0.25); display: inline-block; width: 100%; }

/* 设置分组小标题 */
.settings-sub {
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--text-primary);
  margin: 24px 0 8px;
}
.settings-sub:first-child { margin-top: 0; }

/* ============================================================
   模态
   ============================================================ */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.32);
  display: none;
  align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}
.modal-mask.show { display: flex; animation: fadeIn var(--transition-fast); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-card);
  border-radius: var(--r-modal);
  box-shadow: var(--shadow-lg);
  width: 420px;
  max-width: 90vw;
  padding: 20px 22px;
  animation: scaleIn var(--transition-normal);
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
.modal-title {
  font-size: var(--fs-h3);
  font-weight: 600;
  margin-bottom: 8px;
}
.modal-body {
  font-size: var(--fs-small);
  color: var(--text-inactive);
  line-height: 1.6;
  margin-bottom: 18px;
}
.modal-body strong { color: var(--text-primary); }
.modal-warn {
  background: var(--error-soft);
  border-left: 3px solid var(--error);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 10px 0 16px;
  font-size: 12px;
  color: var(--error);
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
}

/* —— Toast —— */
.toast {
  position: fixed;
  bottom: 60px; left: 50%;
  transform: translateX(-50%);
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  padding: 8px 16px;
  border-radius: var(--r-btn);
  font-size: var(--fs-small);
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: 1001;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* ============================================================
   UI 精化：Lucide 图标 / 空状态引导（2026-08-31）
   ============================================================ */
.icon-xs svg, svg.icon-xs { width: 12px; height: 12px; vertical-align: -2px; }
.icon-sm svg, svg.icon-sm { width: 14px; height: 14px; vertical-align: -2px; }

.chat-empty {
  margin: 56px auto 0;
  max-width: 480px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.chat-empty-icon {
  width: 64px; height: 64px;
  border-radius: 20px;
  background: var(--claude-soft);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--claude);
}
.chat-empty-icon svg { width: 30px; height: 30px; stroke-width: 1.75; }
.chat-empty h2 {
  font-size: var(--fs-h2); line-height: var(--lh-h2);
  margin: 0; color: var(--text-primary);
}
.chat-empty p {
  margin: 0; font-size: var(--fs-small); line-height: var(--lh-small);
  color: var(--text-inactive); max-width: 380px;
}
.chat-empty-actions {
  display: flex; gap: 10px; margin-top: 4px;
  flex-wrap: wrap; justify-content: center;
}

/* ============================================================
   iOS 主题层：毛玻璃 / 立体层次 / HIG 圆角（2026-08-31）
   圆角阶梯：控件10 · 按钮/输入14 · 卡片18 · 弹窗24（连 续曲率观感）
   ============================================================ */
:root {
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-btn: var(--r-md);
  --r-card: var(--r-lg);
  --r-input: var(--r-sm);
  --r-modal: var(--r-xl);
  --glass-bg:          rgba(255, 255, 255, 0.70);
  --glass-bg-strong:   rgba(255, 255, 255, 0.58);
  --glass-border:      rgba(255, 255, 255, 0.65);
  --glass-hairline:    rgba(0, 0, 0, 0.06);
  --glass-blur:        saturate(180%) blur(20px);
  --shadow-hairline:   inset 0 0 0 1px var(--glass-hairline);
}

/* 应用底色：给玻璃面板留可透出的底 */
body {
  background:
    radial-gradient(1200px 800px at 85% -10%, rgba(215, 119, 87, 0.05), transparent 60%),
    radial-gradient(1000px 700px at -10% 110%, rgba(87, 105, 247, 0.045), transparent 55%),
    var(--bg-app);
}

/* 顶栏：iOS 毛玻璃导航 */
.titlebar {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-hairline);
}
.title-tab { border-radius: var(--r-sm); }
.title-tab.active {
  background: rgba(0, 0, 0, 0.06);
  box-shadow: var(--shadow-hairline);
}

/* 侧栏 / 知识库面板：整面玻璃 */
.sidebar,
.kb-panel {
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-color: var(--glass-hairline);
}
.sidebar { box-shadow: 1px 0 0 var(--glass-hairline); }
.kb-panel { box-shadow: -1px 0 0 var(--glass-hairline); }
.sidebar-search input {
  background: rgba(255, 255, 255, 0.65);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-hairline);
}
.sidebar-search input:focus {
  outline: none;
  box-shadow: 0 0 0 3.5px rgba(215, 119, 87, 0.18), var(--shadow-hairline);
}

/* 阶段条：玻璃悬带 */
.stage-bar {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-hairline);
}
.stage-dot {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), var(--shadow-hairline);
}
.stage-node.current .stage-dot {
  box-shadow: 0 0 0 5px var(--claude-soft), 0 6px 16px -4px rgba(215, 119, 87, 0.45);
}

/* 对话气泡：浮起卡片 */
.bubble {
  background: rgba(255, 255, 255, 0.82);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card), var(--shadow-hairline);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}
.msg.user .bubble {
  background: linear-gradient(180deg, var(--claude) 0%, var(--claude-hover) 100%);
  box-shadow: 0 4px 14px -4px rgba(215, 119, 87, 0.5);
}

/* 通用卡片：玻璃浮层 */
.wb-card,
.tool-card,
.gate-block,
.trust-assessment {
  border-radius: var(--r-card);
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-card), var(--shadow-hairline);
}
.wb-card:hover { box-shadow: var(--shadow-float), var(--shadow-hairline); }

/* 按钮：iOS 按压感 */
.btn,
.btn-primary,
.btn-secondary {
  border-radius: var(--r-btn);
  transition: transform 120ms var(--ease-soft),
    box-shadow var(--transition-fast), background var(--transition-fast);
}
.btn-primary {
  background: linear-gradient(180deg, var(--claude) 0%, var(--claude-hover) 100%);
  color: var(--on-brand);
  box-shadow: 0 2px 8px -2px rgba(215, 119, 87, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--claude-hover) 0%, var(--claude) 100%);
  color: var(--on-brand);
}
.btn:active,
.btn-primary:active:not(:disabled) { transform: scale(0.965); }

/* 输入与文本域 */
input[type="text"], input[type="search"], input[type="password"],
input[type="number"], input[type="email"], textarea, select {
  border-radius: var(--r-sm);
}

/* 弹窗：iOS 大圆角 + 深阴影 */
.modal {
  border-radius: var(--r-modal);
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-float), var(--shadow-hairline);
}
.modal .form-field label { color: var(--text-inactive); }

/* Toast：玻璃胶囊 */
.toast {
  background: rgba(30, 30, 30, 0.78);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-float);
}

/* 知识库页签：iOS 分段控件 */
.kb-tabs {
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--r-sm);
  padding: 2px;
  gap: 2px;
}
.kb-tab {
  border-radius: calc(var(--r-sm) - 2px);
  transition: background var(--transition-fast) var(--ease-soft),
    box-shadow var(--transition-fast) var(--ease-soft);
}
.kb-tab.active {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), var(--shadow-hairline);
}

/* 恢复横幅：玻璃引导卡 */
.resume-banner {
  border-radius: var(--r-card);
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-card), var(--shadow-hairline);
  padding: 14px 16px;
}

/* 空状态图标：立体徽标 */
.chat-empty-icon {
  background: linear-gradient(180deg, rgba(215, 119, 87, 0.16) 0%, rgba(215, 119, 87, 0.08) 100%);
  box-shadow: 0 8px 24px -8px rgba(215, 119, 87, 0.4), var(--shadow-hairline);
}

/* —— 深色模式玻璃 —— */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glass-bg:        rgba(44, 44, 46, 0.68);
    --glass-bg-strong: rgba(28, 28, 30, 0.62);
    --glass-border:    rgba(255, 255, 255, 0.12);
    --glass-hairline:  rgba(255, 255, 255, 0.08);
  }
  .title-tab.active { background: rgba(255, 255, 255, 0.10); }
  .bubble { background: rgba(44, 44, 46, 0.82); }
  .kb-tabs { background: rgba(255, 255, 255, 0.07); }
  .kb-tab.active { background: rgba(70, 70, 74, 0.95); }
  .sidebar-search input { background: rgba(0, 0, 0, 0.3); }
}
:root[data-theme="dark"] {
  --glass-bg:        rgba(44, 44, 46, 0.68);
  --glass-bg-strong: rgba(28, 28, 30, 0.62);
  --glass-border:    rgba(255, 255, 255, 0.12);
  --glass-hairline:  rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] .title-tab.active { background: rgba(255, 255, 255, 0.10); }
:root[data-theme="dark"] .bubble { background: rgba(44, 44, 46, 0.82); }
:root[data-theme="dark"] .kb-tabs { background: rgba(255, 255, 255, 0.07); }
:root[data-theme="dark"] .kb-tab.active { background: rgba(70, 70, 74, 0.95); }
:root[data-theme="dark"] .sidebar-search input { background: rgba(0, 0, 0, 0.3); }

/* —— 笔记面板：iOS 化（工具栏 + 编辑器 + 列表） —— */
#wb-pane-notes #notes-list {
  border: 1px solid var(--glass-hairline);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.55);
}
.note-toolbar {
  gap: 3px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--glass-hairline);
  border-bottom: none;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.note-toolbar .tb-btn {
  width: 28px; height: 28px;
  border-radius: 7px;
  font-size: 13px;
  transition: background var(--transition-fast) var(--ease-soft),
    color var(--transition-fast) var(--ease-soft);
}
.note-toolbar .tb-btn:active { transform: scale(0.92); }
.note-editor {
  border: 1px solid var(--glass-hairline);
  border-top: none;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  background: rgba(255, 255, 255, 0.75);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  transition: box-shadow var(--transition-fast) var(--ease-soft);
}
.note-editor:focus {
  box-shadow: 0 0 0 3.5px rgba(215, 119, 87, 0.18);
}
:root[data-theme="dark"] #wb-pane-notes #notes-list,
:root[data-theme="dark"] .note-toolbar { background: rgba(0, 0, 0, 0.25); }
:root[data-theme="dark"] .note-editor { background: rgba(28, 28, 30, 0.75); }

/* 响应式 */
@media (max-width: 1100px) {
  :root { --w-kb-panel: 260px; }
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: var(--w-sidebar) 1fr 0; }
  .kb-panel { transform: translateX(100%); }
}

/* 减少动效（运动敏感用户） */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* —— 上下文用量指示器（conic pill，官方 ContextUsageIndicator 覆盖宽卡） —— */
.composer, .composer-row, .composer-attach, .composer-send, .composer-tools,
.composer-tools-left, .composer-tools-right { /* 占位 */ }
.context-card {
  display: inline-flex !important;
  align-items: center; gap: 7px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border-divider) !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: var(--text-subtle);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  margin: 0 !important;
  max-width: none !important;
}
.context-card:hover { background: var(--bg-hover) !important; border-color: var(--border-prompt) !important; color: var(--text-primary) !important; box-shadow: none !important; }
.context-card .cc-left { gap: 6px; }
.context-card .cc-ring {
  position: relative;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--permission) calc(var(--ctx-pct, 54) * 3.6deg), var(--bg-hover) 0deg) !important;
}
.context-card .cc-ring::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--bg-card); }
.context-card .cc-ring .ring-bg, .context-card .cc-ring .ring-fg { display: none; }
.context-card .cc-ring .ring-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 6px; font-weight: 700; color: var(--text-primary);
  z-index: 2;
}
.context-card .cc-ring-dot { position: relative; width: 5px; height: 5px; border-radius: 50%; background: var(--permission); z-index: 1; }
.context-card .cc-meta-stack { display: none !important; }
.context-card .cc-right, .context-card .cc-row, .context-card .cc-bar { display: none !important; }
.context-card .cc-pct { display: inline-block; font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: inherit; }

/* ============================================================
   Chat Composer（浮动磨砂卡片，照抄 Claude 桌面版）+ 上下文 conic pill
   ============================================================ */
.input-area { padding: 10px 24px 14px; background: var(--bg-app); }
.input-inner { max-width: 820px; margin: 0 auto; }

/* —— 上下文用量 pill（conic 环，官方 ContextUsageIndicator） —— */
.context-card {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border-divider);
  border-radius: 999px;
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  margin: 0 !important;
  max-width: none !important;
}
.context-card:hover { background: var(--bg-hover); border-color: var(--border-prompt); color: var(--text-primary); box-shadow: none !important; }
.context-card[data-open="true"] { background: var(--bg-hover); border-color: var(--border-prompt); color: var(--text-primary); }
.context-card .cc-left { display: flex; align-items: center; gap: 6px; }
.context-card .cc-ring {
  position: relative;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--permission) calc(var(--ctx-pct, 54) * 3.6deg), var(--bg-hover) 0deg) !important;
}
.context-card .cc-ring::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--bg-card); }
.context-card .cc-ring-dot { position: relative; width: 5px; height: 5px; border-radius: 50%; background: var(--permission); z-index: 1; }
.context-card .cc-meta-stack, .context-card .cc-right, .context-card .cc-row, .context-card .cc-bar { display: none !important; }
.context-card .cc-pct { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: inherit; }

/* —— Composer 浮动磨砂卡片 —— */
.composer {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-divider);
  border-radius: var(--r-input);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  padding: 12px;
}
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer-attach {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-subtle);
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}
.composer-attach:hover { color: var(--text-primary); background: var(--bg-hover); }
.composer textarea {
  flex: 1;
  border: none; outline: none; resize: none;
  background: transparent;
  padding: 8px 2px;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-primary);
  min-height: 36px;
  max-height: 200px;
  font-family: var(--font-sans);
}
.composer textarea::placeholder { color: var(--text-subtle); }
.composer-send {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--btn-primary-bg);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.composer-send:hover:not(:disabled) { opacity: 0.9; }
.composer-send:active:not(:disabled) { transform: scale(0.96); }
.composer-send:disabled { opacity: 0.3; cursor: not-allowed; }

/* —— 工具行 —— */
.composer-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 4px 0; }
.composer-tools-left, .composer-tools-right { display: flex; align-items: center; gap: 6px; }
.composer-tools-right { gap: 10px; }
.uc-label { font-size: 11px; }
.perm-add {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-subtle);
  border-radius: 50%;
  transition: background 0.15s ease, color 0.15s ease;
}
.perm-add:hover { background: var(--bg-hover); color: var(--text-primary); }
.model-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px 5px 10px;
  background: transparent;
  border-radius: 999px;
  color: var(--text-subtle);
  font-size: 11px;
  transition: background 0.15s ease, color 0.15s ease;
}
.model-chip:hover { background: var(--bg-hover); color: var(--text-primary); }
.model-chip .model-name { color: inherit; }
.model-chip .model-cap { font-family: var(--font-mono); font-size: 10px; background: var(--bg-hover); padding: 1px 6px; border-radius: 999px; color: var(--text-subtle); }
.model-chip .model-chev { opacity: 0.6; }
.uc-slider {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-subtle);
  transition: background 0.15s ease;
}
.uc-slider:hover { background: var(--bg-hover); }
.uc-track { width: 48px; height: 6px; border-radius: 999px; background: var(--border-divider); position: relative; }
.uc-thumb { position: absolute; top: 50%; left: 65%; transform: translate(-50%, -50%); width: 12px; height: 12px; border-radius: 50%; background: var(--claude); box-shadow: 0 0 0 3px var(--claude-soft); }
.perm-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px 5px 8px;
  background: rgba(220, 190, 110, 0.18);
  color: rgb(150, 108, 30);
  border: 1px solid rgba(220, 190, 110, 0.35);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.perm-chip:hover { background: rgba(220, 190, 110, 0.28); }
.perm-chip svg { color: rgb(150, 108, 30); }


/* ============================================================
   输入区（Claude 官方 1:1：大圆角输入框+内嵌发送 / 工具行）
   ============================================================ */
.input-area { padding: 10px 24px 14px; background: var(--bg-app); }
.input-inner { max-width: 820px; margin: 0 auto; }

/* —— 输入框：大圆角，发送箭头内嵌右下 —— */
.input-box {
  position: relative;
  border: 1px solid var(--border-divider);
  border-radius: 16px;
  background: var(--bg-input);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input-box:focus-within {
  border-color: var(--border-prompt);
  box-shadow: 0 0 0 3px rgba(153, 153, 153, 0.12);
}
.input-box textarea {
  width: 100%;
  border: none; outline: none; resize: none;
  background: transparent;
  padding: 14px 52px 14px 16px;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-primary);
  min-height: 52px;
  max-height: 200px;
  font-family: var(--font-sans);
}
.input-box textarea::placeholder { color: var(--text-subtle); }
.input-send {
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-subtle);
  border-radius: 8px;
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.input-send:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }
.input-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* —— 工具行 —— */
.input-controls {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px;
  padding: 0 2px;
  gap: 12px;
}
.input-controls-left, .input-controls-right {
  display: flex; align-items: center; gap: 6px;
}
.input-controls-right { gap: 12px; }

/* —— 金色"绕过权限"chip + 加号 —— */
.perm-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 9px;
  background: rgba(220, 190, 110, 0.20);
  color: rgb(150, 108, 30);
  border: 1px solid rgba(220, 190, 110, 0.38);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s ease;
}
.perm-chip:hover { background: rgba(220, 190, 110, 0.30); }
.perm-chip svg { color: rgb(150, 108, 30); }
.perm-add {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-subtle);
  border-radius: 50%;
  transition: background 0.15s ease, color 0.15s ease;
}
.perm-add:hover { background: var(--bg-hover); color: var(--text-primary); }

/* —— 模型 chip —— */
.model-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px 5px 10px;
  background: transparent;
  border-radius: 999px;
  color: var(--text-subtle);
  font-size: 12px;
  transition: background 0.15s ease, color 0.15s ease;
}
.model-chip:hover { background: var(--bg-hover); color: var(--text-primary); }
.model-chip .model-name { color: inherit; }
.model-chip .model-cap { font-family: var(--font-mono); font-size: 10px; background: var(--bg-hover); padding: 1px 6px; border-radius: 999px; color: var(--text-subtle); }
.model-chip .model-chev { opacity: 0.6; }

/* —— Ultracode —— */
.uc-slider {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-subtle);
  transition: background 0.15s ease;
}
.uc-slider:hover { background: var(--bg-hover); }
.uc-track { width: 48px; height: 6px; border-radius: 999px; background: var(--border-divider); position: relative; }
.uc-thumb { position: absolute; top: 50%; left: 65%; transform: translate(-50%, -50%); width: 12px; height: 12px; border-radius: 50%; background: var(--claude); box-shadow: 0 0 0 3px var(--claude-soft); }

/* —— 上下文环形进度（蓝色 conic 环，官方 ContextUsageIndicator） —— */
.context-ring {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.15s ease;
}
.context-ring:hover { opacity: 0.85; }
.ctx-ring {
  position: relative;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--permission) calc(var(--ctx-pct, 54) * 3.6deg), var(--bg-hover) 0deg);
}
.ctx-ring::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--bg-card); }
.ctx-ring-dot { position: relative; width: 5px; height: 5px; border-radius: 50%; background: var(--permission); z-index: 1; }


/* —— 执行当前环节栏 —— */
.run-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: center;
  padding: 8px 24px 4px;
  background: linear-gradient(transparent, var(--bg-app) 40%);
  z-index: 5;
}
.run-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--claude);
  color: var(--on-brand);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(215,119,87,0.3);
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.run-btn:hover:not(:disabled) { opacity: 0.9; }
.run-btn:active:not(:disabled) { transform: scale(0.97); }
.run-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.run-loading { font-size: 12px; opacity: 0.9; }


/* —— 新建对话表单 —— */
.form-field { margin-bottom: 12px; }
.form-field label { display: block; font-size: 12px; color: var(--text-subtle); margin-bottom: 5px; font-weight: 500; }
.form-field input, .form-field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-divider);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-input);
  outline: none;
  transition: border-color 0.15s ease;
}
.form-field input:focus, .form-field select:focus { border-color: var(--claude); }
.form-field-row { display: flex; gap: 12px; }
.form-field-row .form-field { flex: 1; }


/* —— 图谱节点详情抽屉 —— */
.node-drawer {
  position: fixed;
  right: calc(var(--w-kb-panel) + 16px); top: 60px;
  width: 300px;
  background: var(--bg-card);
  border: 1px solid var(--border-divider);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);
  padding: 14px 16px;
  z-index: 900;
  display: none;
}
.node-drawer.show { display: block; animation: ddIn 160ms ease; }
.nd-head { display: flex; align-items: center; gap: 8px; }
.nd-link {
  padding: 4px 10px;
  border: 1px solid var(--border-divider);
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.nd-link:hover { border-color: var(--claude); }
/* —— depth 按钮 —— */
.dg-btn {
  padding: 3px 10px;
  border: 1px solid var(--border-divider);
  border-radius: 999px;
  background: transparent;
  color: var(--text-subtle);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.dg-btn:hover { border-color: var(--claude); color: var(--claude); }
.dg-btn.active { background: var(--claude); border-color: var(--claude); color: var(--on-brand); }

/* —— 文献池高亮（图谱跳转） —— */
@keyframes flashItem { 0%, 100% { background: transparent; } 50% { background: var(--claude-soft); } }
.ref-item.flash { animation: flashItem 1s ease 2; border-radius: 8px; }

/* —— 可信写作工作台（证据 / 分节 / 作业） —— */
.wb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.wb-toolbar h3 { font-size: 13px; line-height: 18px; }
.wb-card {
  min-width: 0;
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border-divider);
  border-radius: 10px;
  background: var(--bg-card);
}
.wb-card-title {
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.wb-card-meta {
  margin-top: 4px;
  color: var(--text-subtle);
  font-size: 11px;
  line-height: 16px;
  overflow-wrap: anywhere;
}
.wb-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.wb-empty, .wb-error {
  padding: 16px 10px;
  border: 1px dashed var(--border-divider);
  border-radius: 10px;
  color: var(--text-subtle);
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}
.wb-error { color: var(--error); border-color: var(--error); text-align: start; }
.wb-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 600;
  background: var(--bg-code-block);
  color: var(--text-inactive);
}
.wb-status.ok { color: var(--success); background: var(--success-soft); }
.wb-status.warn { color: var(--warning); background: var(--warning-soft); }
.wb-status.bad { color: var(--error); background: var(--error-soft); }
.academic-foundation-table-wrap { overflow-x: auto; }
.academic-foundation-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 11px;
}
.academic-foundation-table th,
.academic-foundation-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border-divider);
  text-align: start;
  vertical-align: top;
}
.academic-foundation-table thead th {
  color: var(--text-subtle);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.academic-foundation-table tbody th { font-weight: 600; white-space: nowrap; }
.section-contract-summary {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-divider);
  border-radius: 8px;
  font-size: 12px;
}
.section-contract-summary summary {
  cursor: pointer;
  font-weight: 600;
}
.section-contract-summary ul {
  margin: 8px 0;
  padding-left: 20px;
}
.section-contract-summary li + li { margin-top: 8px; }
.section-contract-summary li span {
  display: block;
  color: var(--text-subtle);
}
.trust-assessment {
  margin: 8px 0;
  padding: 9px;
  border: 1px solid var(--border-divider);
  border-radius: 9px;
  background: var(--bg-card);
}
.trust-assessment-head { margin-bottom: 7px; font-size: 12px; }
.trust-dimensions { display: grid; gap: 6px; }
.trust-dimension {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto;
  align-items: center;
  gap: 6px;
}
.trust-dimension-label { font-size: 11px; font-weight: 600; }
.trust-dimension-summary {
  grid-column: 1 / -1;
  color: var(--text-subtle);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.trust-author-review { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-size: 11px; }
.trust-warning {
  margin: 7px 0 0;
  color: var(--warning);
  font-size: 11px;
  line-height: 16px;
}
.trust-assessment.is-empty { color: var(--text-subtle); }
.wb-progress {
  height: 5px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--border-divider);
}
.wb-progress > span { display: block; height: 100%; background: var(--permission); }
.wb-budget-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.wb-field label { display: block; margin-bottom: 4px; color: var(--text-subtle); font-size: 11px; }
.wb-field input, .section-editor {
  width: 100%;
  border: 1px solid var(--border-divider);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 16px;
  padding: 8px;
}
.wb-field select, .wb-field textarea {
  width: 100%;
  border: 1px solid var(--border-divider);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 16px;
  padding: 8px;
}
.wb-field textarea { min-height: 76px; resize: vertical; line-height: 1.5; }
.wb-form { display: grid; gap: 10px; margin-top: 10px; }
.wb-form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.claim-builder-row {
  display: grid;
  grid-template-columns: minmax(70px, .7fr) minmax(70px, .7fr) minmax(0, 1fr);
  gap: 6px;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border-divider);
  border-radius: 8px;
}
.claim-builder-row .claim-text, .claim-builder-row .claim-evidence { grid-column: 1 / -1; }
.file-choice-list { display: grid; gap: 5px; margin-top: 8px; }
.file-choice {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  padding: 6px;
  border-radius: 7px;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.file-choice:hover { background: var(--bg-hover); }
.file-choice input { margin-top: 2px; }
.research-steps { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.research-step { padding: 3px 7px; border-radius: var(--r-pill); font-size: 10px; background: var(--bg-code-block); color: var(--text-inactive); }
.research-step.current { background: var(--permission-soft); color: var(--permission); font-weight: 600; }
.section-editor { min-height: 180px; resize: vertical; line-height: 1.6; font-family: var(--font-sans); }
.autosave-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
  margin-top: 6px;
  color: var(--text-subtle);
  font-size: 11px;
}
.autosave-status[data-state="saving"],
.autosave-status[data-state="dirty"] { color: var(--permission); }
.autosave-status[data-state="saved"],
.autosave-status[data-state="submitted"] { color: var(--success); }
.autosave-status[data-state="failed"],
.autosave-status[data-state="conflict"] { color: var(--error); }
.autosave-status[data-state="stale"] { color: var(--warning); }
.autosave-conflict {
  margin-top: 8px;
  padding: 9px;
  border: 1px solid var(--warning);
  border-radius: 8px;
  background: var(--warning-soft);
}
.autosave-conflict[hidden] { display: none; }
.autosave-conflict-title { color: var(--text-primary); font-size: 12px; font-weight: 600; }
.autosave-conflict-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.autosave-conflict-column {
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--border-divider);
  border-radius: 7px;
  background: var(--bg-card);
}
.autosave-conflict-column h4 { margin-bottom: 5px; font-size: 11px; }
.autosave-preview {
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 11px/16px var(--font-mono);
}
@media (max-width: 700px) {
  .autosave-conflict-grid { grid-template-columns: minmax(0, 1fr); }
}
.section-preview {
  margin-top: 8px;
  padding: 8px;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: 8px;
  background: var(--bg-code-block);
  font: 12px/1.6 var(--font-mono);
}
.section-diff-controls { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; gap: 6px; margin-top: 8px; }
.section-diff-controls select { min-width: 0; padding: 6px; border: 1px solid var(--border-divider); border-radius: 7px; background: var(--bg-input); color: var(--text-primary); }
.section-diff-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.diff-column { min-width: 0; max-height: 260px; overflow: auto; border: 1px solid var(--border-divider); border-radius: 8px; background: var(--bg-code-block); }
.diff-column h4 { position: sticky; top: 0; padding: 6px 8px; background: var(--bg-sidebar); border-bottom: 1px solid var(--border-divider); font-size: 11px; z-index: 1; }
.diff-line { min-height: 20px; padding: 2px 7px; white-space: pre-wrap; overflow-wrap: anywhere; font: 11px/16px var(--font-mono); }
.diff-line.added { background: var(--success-soft); color: var(--success); }
.diff-line.removed { background: var(--error-soft); color: var(--error); }
.wb-live { min-height: 18px; font-size: 11px; color: var(--text-subtle); }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media (max-width: 1080px) {
  .section-diff-grid, .wb-form-row { grid-template-columns: 1fr; }
  .section-diff-controls { grid-template-columns: 1fr; }
}
