Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

26.4 KB
Raw Blame
@use "../util/tokens";

.agent-chat {
  min-height: 0;
}

.sy__agentChat:not(.sy__agentChat--mobile) > .block__icons {
  > [data-type="session-menu"] svg,
  > [data-type="fullscreen"] svg {
    width: 14px;
    height: 14px;
    margin: 1px;
  }
}

.agent-chat__title {
  font-size: 14px;
  color: var(--b3-theme-on-background);
}

.agent-chat__tokens {
  // 圆环轨道(背景灰圈)。用比 hover 背景更深的灰,避免悬浮时轨道被吃掉。
  .agent-chat__tokens-track {
    fill: none;
    stroke: var(--b3-scroll-color);
  }

  // 圆环弧度(按占用率描边),统一主色,rotate -90 让起点在顶部。
  .agent-chat__tokens-arc {
    fill: none;
    stroke: var(--b3-theme-primary);
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
  }
}

.agent-chat__messages-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

.agent-chat__messages {
  overflow-y: auto;
  // scrollbar-gutter 预留滚动条槽位,避免出现/消失滚动条时内容横向抖动;
  // 右侧 padding 相应减去滚动条宽度(10px),保证与 input-area(margin 16px)内容左右对齐。
  scrollbar-gutter: stable;
  padding: 12px 6px 12px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  user-select: text;
  transition: var(--b3-transition);
}

.agent-chat__messages--switching {
  opacity: 0;
}

.agent-chat__scroll-bottom {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--b3-theme-background);
  border: 1px solid var(--b3-border-color);
  box-shadow: var(--b3-tooltips-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: var(--b3-transition);
  z-index: 5;

  svg {
    width: 14px;
    height: 14px;
  }

  &--visible {
    opacity: 1;
    visibility: visible;
  }
}

.agent-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 24px;
  gap: 12px;
  margin: auto 0;
}

.agent-welcome__icon {
  font-size: 48px;
  line-height: 1;
}

.agent-welcome__title {
  font-size: 20px;
  font-weight: 600;
  color: var(--b3-theme-on-surface);
}

.agent-welcome__greeting {
  font-size: 16px;
  font-weight: 600;
  color: var(--b3-theme-on-surface);
  margin-bottom: 4px;
  white-space: pre-line;
}

.agent-welcome__desc {
  font-size: 14px;
  color: var(--b3-theme-on-surface-light);
  max-width: 280px;
  line-height: 1.5;
}

.agent-welcome__examples {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: max-content;
  max-width: min(100%, 300px);
  margin-top: 8px;
}

.agent-welcome__example {
  padding: 8px 12px;
  background: var(--b3-theme-surface);
  border: 1px solid var(--b3-border-color);
  border-radius: var(--b3-border-radius);
  font-size: 13px;
  color: var(--b3-theme-on-surface);
  cursor: pointer;
  text-align: left;
  overflow-wrap: anywhere;
  transition: var(--b3-transition);
}

.agent-welcome__example:hover {
  background: var(--b3-theme-surface-light);
  border-color: var(--b3-theme-primary);
}

// 无模型提示块:引导用户去 设置 - 人工智能 配置。
.agent-welcome__no-model {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  margin-top: 12px;
  padding: 20px 16px;
  background: var(--b3-theme-surface);
  border: 1px solid var(--b3-border-color);
  border-radius: var(--b3-border-radius);
  text-align: center;
}

.agent-welcome__no-model-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--b3-theme-on-surface);
}

.agent-welcome__no-model-tip {
  font-size: 13px;
  color: var(--b3-theme-on-surface-light);
  line-height: 1.5;
}

// 未配置模型时的「去配置」按钮:复用 b3-button 主色实心样式,仅微调尺寸。
.agent-welcome__go-setting {
  margin-top: 4px;
  padding: 4px 14px;
  font-size: 13px;
}

.agent-chat__msg {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  user-select: text;
}

.agent-chat__msg--user {
  align-items: flex-end;
}

.agent-chat__msg--user .agent-chat__body,
.agent-chat__msg--ai .agent-chat__body {
  min-width: 0;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--b3-theme-on-background);
  border-radius: 0;
  word-break: break-word;
  line-height: 1.5;
}

.agent-chat__msg--user .agent-chat__body {
  border-radius: var(--b3-border-radius-b);
  background: var(--b3-theme-surface);
  padding: 8px 12px;
  width: auto;
  max-width: 80%;
  box-sizing: border-box;
}

.agent-chat__msg--editing .agent-chat__body {
  width: min(100%, 560px);
}

.agent-chat__edit-editor {
  background-color: transparent;
  max-height: 40vh;
  min-height: 96px;
  width: 100%;
}

.agent-chat__edit-editor .protyle-wysiwyg {
  min-height: 96px;
}

.agent-chat__msg--editing .agent-chat__msg-actions {
  margin-top: 4px;
  opacity: 1;
}

.agent-chat__msg-meta {
  font-size: 13px;
  color: var(--b3-theme-on-surface-light);
  align-self: center;
}

.agent-chat__msg-time--ai {
  flex-shrink: 0;
  opacity: 0.6;
}

.agent-chat__msg--ai {
  align-items: flex-start;
}

.agent-chat__msg-actions {
  align-self: flex-end;
  display: flex;
  gap: 4px;
  width: 100%;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity .2s cubic-bezier(0, 0, .2, 1) 0ms;
}

.agent-chat__msg--ai:hover .agent-chat__msg-actions,
.agent-chat__msg--user:hover .agent-chat__msg-actions {
  opacity: 1;
}

.agent-chat__msg--user .agent-chat__msg-actions {
  width: auto;
  justify-content: flex-end;
}

.agent-chat__body--streaming {
  min-height: 20px;
  // 纯文本流式输出保留换行和空白,Markdown 预览使用正常排版。
  white-space: pre-wrap;
  word-break: break-word;

  &.agent-chat__body--streaming-markdown {
    white-space: normal;
  }
}

.agent-chat__body {
  user-select: text;

  .code-block {
    position: relative;
  }
}

// 覆盖消息排版的基础字号:b3-typography 和 protyle-wysiwyg 默认使用编辑器字号,
// 在 dock 面板里偏大。压回面板级 14px,与大纲/书签等其他 dock 面板对齐。
// 行高、段落间距等仍沿用各自的全局排版规范。
.agent-chat__msg--user .agent-chat__body.protyle-wysiwyg,
.agent-chat__body.b3-typography,
.agent-chat__thinking-chat.b3-typography {
  font-size: var(--b3-font-size);

  span[data-type~="tag"] {
    padding-left: 1px;
    padding-right: 1px;
    border-bottom: 1px solid;
    color: var(--b3-protyle-inline-tag-color);
    transition: var(--b3-transition);
    cursor: pointer;

    &:hover {
      background-color: var(--b3-theme-surface-lighter);
    }
  }
}

// 消息正文复用全局 b3-typography 排版(与导出预览/编辑器预览一致),
// 仅保留 AgentChat 特有的代码块增强:hover 显示语言标签 + 复制按钮。
// pre 需 position:relative 作为复制按钮(absolute)和语言标签(::before)的定位上下文。
.agent-chat__body--mirror pre {
  position: relative;
  // 左右 padding 统一变量,::before 语言标签用同值 left 保证左对齐代码正文。
  padding: 8px tokens.token("--agent-code-pad");
  margin: 0.5em 0;
  border: 0;
  border-radius: var(--b3-border-radius);
  background-color: var(--b3-protyle-code-background);
  overflow: auto;

  // 覆盖 hljs 主题的 .hljs padding(其特异性 0,1,0 高于 pre code),用 !important 确保对齐语言标签。
  code.hljs,
  code {
    padding: 0 !important;
    background: none !important;
    display: block;
  }
}

// 有语言标签的代码块顶部留空间,避免 ::before 语言标签与正文重叠。
.agent-chat__body--mirror pre[data-language] {
  padding-top: 24px;
}

.agent-chat__body--mirror pre[data-language]::before {
  content: attr(data-language);
  position: absolute;
  top: 4px;
  left: tokens.token("--agent-code-pad");
  font-size: 12px;
  color: var(--b3-theme-on-surface-light);
}

.agent-chat__body .protyle-icons {
  display: flex;
}

.agent-chat__msg--user .agent-chat__body .protyle-icons {
  display: none;
}

// hover 显隐:对齐原 agent-chat__copy-wrap 行为,opacity 渐显。
.agent-chat__body pre:hover .protyle-icons,
.agent-chat__body [data-subtype="math"]:hover .protyle-icons {
  opacity: .86;
}

.agent-chat__msg--error .agent-chat__body {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--b3-card-error-color);
  background: var(--b3-card-error-background);
  word-break: break-word;
  padding: 4px 8px;
  border-radius: var(--b3-border-radius);
}

.agent-chat__error-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-chat__snapshot-body {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--b3-theme-on-surface-light);
}

.agent-chat__snapshot-icon {
  flex-shrink: 0;

  svg {
    display: block;
    width: 14px;
    height: 14px;
  }
}

.agent-chat__snapshot-text {
  flex: 1;
}

.agent-chat__snapshot-rollback {
  flex-shrink: 0;
  color: var(--b3-theme-on-surface-light);

  svg {
    width: 14px;
    height: 14px;
  }

  &:hover {
    background: var(--b3-list-hover);
  }
}

.agent-chat__msg--tool {
  align-items: stretch;
}

.agent-chat__tool-card,
.agent-chat__confirm-card,
.agent-chat__question-card,
.agent-chat__tool-card--todo {
  border: 1px solid var(--b3-border-color);
  border-radius: var(--b3-border-radius);
  overflow: hidden;
}

.agent-chat__tool-card {
  font-size: 13px;
}

.agent-chat__msg--thinking {
  align-items: stretch;
}

.agent-chat__msg--retry {
  align-items: stretch;
}

.agent-chat__thinking-card {
  border: none;
  border-radius: var(--b3-border-radius);
}

.agent-chat__msg--thinking-done {
  opacity: 0.6;
}

.agent-chat__thinking-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 13px;
  cursor: pointer;
  color: var(--b3-theme-on-surface-light);
  user-select: none;
}

.agent-chat__thinking-text {
  flex-shrink: 0;
}

.agent-chat__thinking-latest {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--b3-theme-on-surface);
  white-space: nowrap;
}

.agent-chat__thinking-arrow {
  flex-shrink: 0;
  color: var(--b3-theme-on-surface-light);

  svg {
    display: block;
    width: 14px;
    height: 14px;
  }
}

.agent-chat__thinking-body {
  font-size: var(--b3-font-size);
  max-height: 0;
  overflow: hidden;
  contain: layout paint;
  border-top: 1px solid transparent;
  padding: 0;
  transition: max-height .2s cubic-bezier(0, 0, .2, 1), padding .2s cubic-bezier(0, 0, .2, 1), border-color .2s cubic-bezier(0, 0, .2, 1);

  & > *:last-child {
    margin-bottom: 0;
  }
}

.agent-chat__thinking-body--preview {
  max-height: 120px;
  overflow-y: auto;
  contain: none; // 覆盖 base 的 contain:layout paint,该值会阻止 JS 设置 scrollTop 生效

  // 隐藏滚动条,保持预览态视觉干净(内容通过 JS 自动滚到底部)。
  scrollbar-width: none;

  &::-webkit-scrollbar {
    display: none;
  }
}

.agent-chat__thinking-body--expanded {
  // 展开内容随对话统一滚动,避免长篇思考产生独立的滚动区域。
  max-height: none;
  overflow-y: auto;
  padding: 8px 0;
  border-top-color: var(--b3-border-color);
}

.agent-chat__thinking-reasoning-text {
  color: var(--b3-theme-on-surface);
  line-height: 1.5;
  margin-bottom: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.agent-chat__thinking-chat {
  color: var(--b3-theme-on-surface);
  line-height: 1.5;
  margin-bottom: 8px;
  border: none;
  border-radius: 0;

  &:last-child {
    margin-bottom: 0;
  }
}

.agent-chat__thinking-chat--streaming {
  min-height: 20px;
  // 流式期是纯文本(textContent),保留换行;富渲染在结束后进行。
  white-space: pre-wrap;
  word-break: break-word;
}

.agent-chat__thinking-summary {
  font-size: 12px;
  color: var(--b3-theme-on-surface-light);
}

.agent-chat__thinking-tools-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin-bottom: 8px;
}

.agent-chat__thinking-tool {
  font-size: 12px;
  color: var(--b3-theme-on-surface-light);
  white-space: nowrap;
}

.agent-chat__thinking-tool--running::after {
  content: "...";
  display: inline-block;
  width: 1.2em;
  margin-left: 3px;
  overflow: hidden;
  vertical-align: bottom;
  animation: agent-tool-running 1.2s steps(4, end) infinite;
}

@keyframes agent-tool-running {
  0% {
    clip-path: inset(0 100% 0 0);
  }

  100% {
    clip-path: inset(0 0 0 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .agent-chat__thinking-tool--running::after {
    animation: none;
    opacity: 0.65;
  }
}

.agent-chat__confirm-card {
  font-size: 13px;
}

.agent-chat__confirm-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  color: var(--b3-theme-on-background);
  line-height: 1.5;

  .agent-chat__confirm-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.agent-chat__confirm-args {
  margin: 0;
  padding: 4px 8px;
  background: var(--b3-theme-surface);
  color: var(--b3-theme-on-surface);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 120px;
  overflow-y: auto;
  border-top: 1px solid var(--b3-border-color);
}

.agent-chat__confirm-effects {
  margin: 0;
  padding: 8px 12px 8px 30px;
  border-top: 1px solid var(--b3-border-color);
  background: var(--b3-theme-surface);
  background: color-mix(in srgb, var(--b3-card-warning-color) 10%, transparent);
  color: var(--b3-theme-on-background);
  font-size: 12px;
  line-height: 1.6;
}

.agent-chat__confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--b3-border-color);
}

.agent-chat__confirm-done {
  padding: 4px 8px;
  font-size: 12px;
  color: var(--b3-theme-on-surface-light);
  font-style: italic;
}

.agent-chat__msg--confirmed {
  opacity: 0.7;
}

.agent-chat__tool-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-chat__tool-title {
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-chat__input-area {
  background: var(--b3-theme-background);
  border: 1px solid var(--b3-border-color);
  border-radius: var(--b3-border-radius-b);
  margin: 0 16px 12px;
  padding: 8px;
  flex-shrink: 0;

  &:hover .agent-chat__input-resize .protyle-block-resize {
    opacity: 1;
  }
}

.agent-chat__input-resize {
  position: relative;
  height: 0;

  .protyle-block-resize[data-resize-axis="height"] {
    top: -16px;
    bottom: auto;
  }
}

.agent-chat__composer-host {
  // 一行正文、段落边距与上下滚动留白。
  min-height: calc(var(--b3-font-size) * 1.625 + 44px);
  max-height: min(240px, 40vh);
  overflow: hidden;
  cursor: text;

  .protyle-content {
    min-height: 0;
    flex: 1 1 auto;
    padding: 8px 0 24px;
    scroll-padding-block: 8px 24px;
    box-sizing: border-box;
  }

  .protyle-wysiwyg .img {
    & > span:nth-child(2) {
      width: 96px !important;
      height: 96px;

      img {
        width: 100%;
        height: 100%;
        object-fit: contain;
      }
    }

    .protyle-action__drag {
      display: none !important;
    }
  }
}

.agent-chat__composer-host--disabled {
  pointer-events: none;
  opacity: 0.5;
}

.agent-chat__buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  min-width: 0;
}

.agent-chat__button-options {
  display: flex;
  flex: 1;
  gap: 8px;
  min-width: 0;
  overflow: auto;

  &::-webkit-scrollbar {
    display: none;
  }
}

.agent-chat__button-options--compact {
  .agent-chat__model-picker,
  .agent-chat__permission,
  .agent-chat__reasoning-effort {
    flex: 0 0 auto;
  }

  .agent-chat__model-picker-label,
  .agent-chat__permission-label,
  .agent-chat__reasoning-effort-label {
    display: none;
  }
}

.agent-chat__send,
.agent-chat__stop {
  flex-shrink: 0;
}

.agent-chat__model-picker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background-image: none;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 30px;

  &-icon {
    height: 14px;
    width: 14px;
    color: var(--b3-theme-on-surface);
    flex-shrink: 0;
  }

  &-label {
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
}

.agent-chat__permission {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background-image: none;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 30px;

  &-icon {
    height: 14px;
    width: 14px;
    color: var(--b3-theme-on-surface);
    flex-shrink: 0;
  }

  &-label {
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
}

// 思考强度:使用菜单按钮,避免底部原生 select 向视口外展开。
.agent-chat__reasoning-effort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background-image: none;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 30px;

  &-icon {
    height: 14px;
    width: 14px;
    color: var(--b3-theme-on-surface);
    flex-shrink: 0;
  }

  &-label {
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
}

// 停止按钮:常显悬浮背景色,图标主色填充。
.agent-chat__stop {
  background: var(--b3-list-hover);
  color: var(--b3-theme-primary);
}

// token 分类明细弹层:hover 底部 tokens 数字时弹出,复用 b3-menu 基础样式。
.agent-token-popup {
  position: fixed;
  width: 280px;
  padding: 8px 0;

  .b3-menu__items {
    display: flex;
    flex-direction: column;
  }
}

// 总数行(第一行):加粗,与其他分类区分。
.agent-token-popup__total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 14px;
  font-weight: 600;
  color: var(--b3-theme-on-background);
}

// 各分类行:两端对齐,左标签右百分比。
.agent-token-popup__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 14px;
  font-size: 13px;
  color: var(--b3-theme-on-surface);
}

.agent-token-popup__label {
  flex-shrink: 0;
}

.agent-token-popup__value {
  margin-left: 12px;
  flex-shrink: 0;
  color: var(--b3-theme-on-surface-light);
}

// 总数行与分类之间、分类与缓存命中之间的分隔线。
.agent-token-popup__divider {
  height: 1px;
  margin: 4px 10px;
  background: var(--b3-border-color);
}

// 第一行下方的上下文占用横条:总长 = 模型上限,填充宽度 = 已用占比,
// 填充色统一主色(与底部圆环一致);未填充为轨道灰。
.agent-token-popup__bar {
  height: 4px;
  margin: 6px 10px 4px;
  border-radius: 2px;
  background: var(--b3-border-color);
  overflow: hidden;

  & > span {
    display: block;
    height: 100%;
    border-radius: 2px;
    background: var(--b3-theme-primary);
  }
}

.agent-session-popup {
  width: 280px;
  max-height: 360px;
  display: flex;
  flex-direction: column;
}

.agent-session-popup__search {
  margin: 0 8px 4px;
}

@keyframes agent-session-status-pulse {
  0%, 100% {
    opacity: .35;
  }

  50% {
    opacity: 1;
  }
}

.agent-session-status {
  width: 7px;
  height: 7px;
  margin: 0 7px 0 3px;
  border-radius: 50%;
  background-color: var(--b3-theme-primary);
  flex-shrink: 0;

  &--running {
    animation: 1.2s ease-in-out infinite agent-session-status-pulse;
  }

  &--unread {
    background-color: var(--b3-theme-secondary);
  }
}

// 会话条目"更多"按钮的子菜单定位:使用 position: fixed(默认),位置由 JS 动态计算。
.agent-session-more {
  position: relative;

  &.b3-menu__item--show {
    display: flex;
  }

  .b3-menu__submenu {
    white-space: nowrap;
  }
}

// Todo list styles

.agent-chat__todo-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--b3-theme-on-surface);
  border-bottom: 1px solid var(--b3-border-color);
}

.agent-chat__todo-items {
  padding: 4px 0;
}

.agent-chat__todo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--b3-theme-on-surface);
}

.agent-chat__todo-item--completed {
  color: var(--b3-theme-on-surface-light);
  text-decoration: line-through;
}

.agent-chat__todo-item--in-progress {
  color: var(--b3-theme-primary);
}

.agent-chat__todo-item--pending {
  color: var(--b3-theme-on-surface);
}

.agent-chat__todo-item--cancelled {
  color: var(--b3-theme-on-surface-light);
  text-decoration: line-through;
}

.agent-chat__todo-status {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

// Question card styles
.agent-chat__question-card {
  font-size: 13px;
}

.agent-chat__question-item {
  padding: 12px;

  + .agent-chat__question-item {
    border-top: 1px solid var(--b3-border-color);
  }
}

.agent-chat__question-header {
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--b3-theme-on-background);
}

.agent-chat__question-text {
  white-space: pre-wrap;
  margin-bottom: 10px;
  color: var(--b3-theme-on-surface);
  line-height: 1.5;
}

.agent-chat__question-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.agent-chat__question-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--b3-border-radius);
  cursor: pointer;
  transition: var(--b3-transition);

  &:hover {
    background: var(--b3-theme-surface-light);
  }

  input {
    flex-shrink: 0;
    margin-top: 2px;
  }
}

.agent-chat__question-option-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.agent-chat__question-option-label {
  font-weight: 500;
  white-space: nowrap;
  color: var(--b3-theme-on-surface);
}

.agent-chat__question-option-desc {
  font-size: 12px;
  color: var(--b3-theme-on-surface-light);
  line-height: 1.5;
}

.agent-chat__question-custom {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 8px;
  margin-top: 8px;
  border: 1px solid var(--b3-border-color);
  border-radius: var(--b3-border-radius);
  font-size: 13px;
  outline: none;
  background: var(--b3-theme-background);
  color: var(--b3-theme-on-background);

  &::placeholder {
    color: var(--b3-theme-on-surface-light);
  }

  &:focus {
    border-color: var(--b3-theme-primary);
  }
}

.agent-chat__question-submit {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--b3-border-color);
}

.agent-chat__nav-rail {
  position: absolute;
  right: 12px;
  top: 8px;
  box-sizing: border-box;
  width: 24px;
  max-height: calc(100% - 56px);
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--nav-gap, 3px);
  z-index: 6;
  padding: 4px 2px;
}

.agent-chat__nav-rail-marker {
  box-sizing: content-box;
  width: 10px;
  height: 2px;
  flex-shrink: 0;
  padding: 3px 5px;
  background-clip: content-box;
  background-color: var(--b3-theme-on-surface);
  opacity: 0.3;
  cursor: pointer;
  border-radius: var(--b3-border-radius-b);
  transition: opacity 150ms ease-out;

  &:hover {
    opacity: 1;
  }
}

.agent-chat__nav-rail-marker--active {
  background-color: var(--b3-theme-primary);
  opacity: 0.7;
}

.tooltip--agent-nav {
  pointer-events: none;
  max-height: min(160px, 90vh);
  overflow: hidden;
}

.agent-chat__msg--jumped .agent-chat__body {
  animation: agent-msg-jump 1.5s ease-out;
}

@keyframes agent-msg-jump {
  20% {
    background-color: var(--b3-theme-primary-lightest);
  }
}

.agent-chat__msg--mirror {
  justify-content: center;
}

.agent-chat__body--mirror {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--b3-theme-on-surface-light);
  font-size: 14px;
}

.agent-chat__mirror-spinner {
  align-self: center;
}

// 发送框和历史消息编辑器复用相同排版,尺寸和滚动按使用场景分别约束。
.agent-chat__composer-host .protyle-wysiwyg,
.agent-chat__edit-editor .protyle-wysiwyg {
  outline: none;
  font-size: var(--b3-font-size);
  line-height: 1.6;
  color: var(--b3-theme-on-background);
  padding: 0 !important;
}

.agent-chat__composer-host .protyle-wysiwyg {
  min-height: 24px;
}

.agent-chat__composer-host,
.agent-chat__msg--user {
  span[data-type~="text"][custom-agent-skill="true"] {
    margin: 0 4px;
    padding: 2px 4px;
    border: 1px solid var(--b3-theme-primary-lighter);
    border-radius: var(--b3-border-radius-b);
    background-color: var(--b3-theme-primary-lightest);
    color: var(--b3-theme-primary);

    &::before {
      content: "✦ ";
    }

    &:hover {
      border-color: var(--b3-theme-primary-light);
    }
  }
}

.protyle-hint--agent-overlay,
.protyle-hint--lite-overlay {
  font-size: var(--b3-font-size);
}

.sy__agentChat--mobile {
  position: relative;
  box-sizing: border-box;
  height: 100%;
  min-height: 0;
  background: var(--b3-theme-background);

  .block__icons {
    min-height: 48px;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(4px, env(safe-area-inset-right));
    -webkit-user-select: none;
    user-select: none;
  }

  .agent-chat__title {
    min-height: 30px;
    font-size: 17px;
    font-weight: normal;
    line-height: 30px;
  }

  .block__icon {
    box-sizing: border-box;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    justify-content: center;
    opacity: 1;
  }

  .agent-chat__messages {
    padding: 12px max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left));
    scrollbar-gutter: auto;
  }

  .agent-chat__msg-actions {
    opacity: 1;
  }

  .agent-chat__body .protyle-icons {
    opacity: .86;
  }

  .agent-chat__nav-rail {
    display: none;
  }

  .agent-chat__input-area {
    margin: 0 max(8px, env(safe-area-inset-right)) max(16px, calc(env(safe-area-inset-bottom) + 8px)) max(8px, env(safe-area-inset-left));
  }

  .agent-chat__button-options {
    gap: 4px;
  }

  .agent-chat__confirm-actions,
  .agent-chat__question-submit {
    flex-wrap: wrap;

    .b3-button {
      min-height: 40px;
    }
  }

  .agent-session-popup--mobile {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    z-index: 20;
    background: var(--b3-theme-background);

    .agent-session-popup__search {
      margin: 8px;
      min-height: 36px;
    }

    .b3-list-item {
      min-height: 44px;
    }

    > .b3-list {
      min-height: 0;
      overflow-y: auto;
    }
  }
}

.agent-menu-status--warning {
  color: var(--b3-theme-error);
}