/* 智能体对话区视觉（仿豆包）：单卡片输入、内嵌进度、双联阶段卡、细滚动条。
 * 只作用于 body.agent-bifang-host，不改 agent_from_v2 里的上游样式。
 */

body.agent-bifang-host {
  --agent-shell-text: #1b1b1f;
  --agent-shell-sub: #8a8f99;
  --agent-shell-line: #ececf1;
  --agent-shell-bg: #f7f7f8;
  --agent-shell-user: #eef2f7;
  --agent-shell-accent: #111114;
}

body.agent-bifang-host .agent-chat-body,
body.agent-bifang-host .agent-chat-panel {
  background: var(--agent-shell-bg);
}

/* 页面级滚动条也收细（对话页整页滚动时） */
html:has(body.agent-bifang-host),
body.agent-bifang-host {
  scrollbar-width: thin;
  scrollbar-color: rgba(17, 17, 20, 0.16) transparent;
}

html:has(body.agent-bifang-host)::-webkit-scrollbar,
body.agent-bifang-host::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

html:has(body.agent-bifang-host)::-webkit-scrollbar-track,
body.agent-bifang-host::-webkit-scrollbar-track {
  background: transparent;
}

html:has(body.agent-bifang-host)::-webkit-scrollbar-thumb,
body.agent-bifang-host::-webkit-scrollbar-thumb {
  background: rgba(17, 17, 20, 0.14);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

html:has(body.agent-bifang-host)::-webkit-scrollbar-thumb:hover,
body.agent-bifang-host::-webkit-scrollbar-thumb:hover {
  background: rgba(17, 17, 20, 0.3);
  background-clip: content-box;
}

/* ---------------- 对话流 ---------------- */

body.agent-bifang-host .agent-thread {
  gap: 14px;
  padding: 24px 20px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(17, 17, 20, 0.16) transparent;
}

body.agent-bifang-host .agent-thread::-webkit-scrollbar,
body.agent-bifang-host .agent-side-sessions::-webkit-scrollbar,
body.agent-bifang-host .agent-sessions-drawer-body::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body.agent-bifang-host .agent-thread::-webkit-scrollbar-track,
body.agent-bifang-host .agent-side-sessions::-webkit-scrollbar-track,
body.agent-bifang-host .agent-sessions-drawer-body::-webkit-scrollbar-track {
  background: transparent;
}

body.agent-bifang-host .agent-thread::-webkit-scrollbar-thumb,
body.agent-bifang-host .agent-side-sessions::-webkit-scrollbar-thumb,
body.agent-bifang-host .agent-sessions-drawer-body::-webkit-scrollbar-thumb {
  background: rgba(17, 17, 20, 0.14);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

body.agent-bifang-host .agent-thread::-webkit-scrollbar-thumb:hover,
body.agent-bifang-host .agent-side-sessions::-webkit-scrollbar-thumb:hover,
body.agent-bifang-host .agent-sessions-drawer-body::-webkit-scrollbar-thumb:hover {
  background: rgba(17, 17, 20, 0.3);
  background-clip: content-box;
}

body.agent-bifang-host .agent-msg {
  display: flex;
  width: 100%;
}

body.agent-bifang-host .agent-msg-user {
  justify-content: flex-end;
}

body.agent-bifang-host .agent-msg-assistant {
  justify-content: flex-start;
}

body.agent-bifang-host .agent-msg-assistant .agent-bubble {
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--agent-shell-text);
  font-size: 15px;
  line-height: 1.75;
}

body.agent-bifang-host .agent-msg-user .agent-bubble {
  max-width: min(76%, 560px);
  padding: 10px 14px;
  border: 0;
  border-radius: 18px 18px 6px 18px;
  background: var(--agent-shell-user);
  color: var(--agent-shell-text);
  font-size: 15px;
  line-height: 1.6;
}

body.agent-bifang-host .agent-user-text {
  white-space: pre-wrap;
  word-break: break-word;
}

/* 系统小字：默认弱化；模式/功能选择做成胶囊 */
body.agent-bifang-host .agent-note {
  align-self: center;
  max-width: min(88%, 640px);
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--agent-shell-sub);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

/* “理解：…”必须靠聊天列左侧；宿主通用 .agent-note 的 center 不能覆盖。 */
body.agent-bifang-host .agent-note.agent-note-understanding {
  align-self: flex-start;
  max-width: 92%;
  text-align: left;
}

body.agent-bifang-host .agent-note.agent-note-chip {
  padding: 5px 12px;
  border: 1px solid var(--agent-shell-line);
  border-radius: 999px;
  background: #fff;
  color: #4b5563;
  font-size: 12px;
}

body.agent-bifang-host .agent-typing {
  align-self: flex-start;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--agent-shell-sub);
  font-size: 13px;
}

body.agent-bifang-host .agent-typing-dots span {
  background: #b9bdc6;
}

/* 规划/理解卡：去掉内层双框 */
body.agent-bifang-host .agent-pipeline-plan-card {
  display: block;
}

body.agent-bifang-host .agent-pipeline-understand,
body.agent-bifang-host .agent-pipeline-plan-card .agent-pipeline-understand {
  padding: 14px 16px;
  border: 1px solid var(--agent-shell-line);
  border-radius: 16px;
  background: #fff;
  color: var(--agent-shell-text);
  font-size: 14px;
  line-height: 1.7;
}

body.agent-bifang-host .agent-pipeline-understand-block,
body.agent-bifang-host .agent-pipeline-understand-ops,
body.agent-bifang-host .agent-pipeline-understand-text {
  padding: 0;
  border: 0;
  background: transparent;
}

body.agent-bifang-host .agent-pipeline-understand-head strong {
  font-size: 14px;
  font-weight: 650;
  color: var(--agent-shell-text);
}

/* 出图卡 */
body.agent-bifang-host .agent-image-card {
  display: block;
  width: fit-content;
  max-width: min(340px, 100%);
  border: 0;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
}

/* 出图占位给出确定宽度，避免按 min-height 被 aspect-ratio 反推成小方块 */
body.agent-bifang-host .agent-msg-image-pending .agent-image-placeholder {
  width: 340px;
  max-width: 100%;
}

body.agent-bifang-host .agent-result-image {
  max-width: 100%;
}

body.agent-bifang-host .agent-result-image {
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(17, 17, 20, 0.08);
}

body.agent-bifang-host .agent-image-step-banner {
  white-space: pre-line;
  overflow-wrap: anywhere;
  border: 0;
  background: transparent;
  color: var(--agent-shell-sub);
  font-size: 12px;
  padding: 0 0 6px;
}

body.agent-bifang-host .agent-image-step-title {
  color: var(--agent-shell-text);
  font-weight: 600;
  margin-bottom: 4px;
}

body.agent-bifang-host .agent-stage-detail,
body.agent-bifang-host .agent-step-details {
  white-space: pre-line;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.7;
  color: var(--agent-shell-sub);
}

body.agent-bifang-host .agent-step-details > summary {
  cursor: pointer;
  list-style: none;
}

body.agent-bifang-host .agent-step-details > summary::-webkit-details-marker {
  display: none;
}

body.agent-bifang-host .agent-step-expand,
body.agent-bifang-host .agent-step-collapse {
  color: var(--agent-shell-text);
  font-weight: 500;
  margin-left: 6px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.agent-bifang-host .agent-step-details:not([open]) .agent-step-collapse,
body.agent-bifang-host .agent-step-details[open] .agent-step-expand,
body.agent-bifang-host .agent-step-details[open] .agent-step-preview {
  display: none;
}

body.agent-bifang-host .agent-image-placeholder {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body.agent-bifang-host .agent-image-placeholder-label {
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  color: #626575;
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  white-space: normal;
}

body.agent-bifang-host .agent-image-placeholder-label::before {
  content: "";
  flex: 0 0 64px;
  width: 64px;
  border: 1px solid #e3e0ed;
  border-radius: 20px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32' fill='none' stroke='%23857aab' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 5H8a3 3 0 0 0-3 3v16a3 3 0 0 0 3 3h16a3 3 0 0 0 3-3V14'/%3E%3Cpath d='m5 22 7-7 8 8 4-4 3 3'/%3E%3Ccircle cx='12' cy='11' r='1.5'/%3E%3Cpath d='m25 3 1.5 4.5L31 9l-4.5 1.5L25 15l-1.5-4.5L19 9l4.5-1.5Z'/%3E%3C/svg%3E") center / 32px 32px no-repeat;
  box-shadow: 0 6px 18px rgba(71, 57, 107, 0.05);
  animation: bifangPendingBreathe 3.6s ease-in-out infinite;
}

/* ---------------- 内嵌进度 ---------------- */

body.agent-bifang-host .agent-run-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  width: min(520px, 100%);
  margin: 2px 0 4px;
  padding: 12px 16px;
  border: 1px solid var(--agent-shell-line);
  border-radius: 16px;
  background: #fff;
  flex-shrink: 0;
}

body.agent-bifang-host .agent-run-progress.is-in-image {
  position: static;
  z-index: 2;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
  padding: 16px 18px;
  border: 0;
  border-top: 1px solid #eeedf2;
  border-radius: 0;
  background: #fff;
}

body.agent-bifang-host .agent-run-progress.is-in-image .image-uploader-progress {
  min-width: 0;
  background: #eeedf3;
}

body.agent-bifang-host .agent-run-progress.is-in-image .image-uploader-progress-bar {
  background: linear-gradient(90deg, #a79ac8, #80729f);
}

body.agent-bifang-host .agent-run-progress.is-in-image #agent-progress-text {
  flex-shrink: 0;
  min-width: 5ch;
  margin-left: 0;
  color: #626575;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

body.agent-bifang-host .agent-msg-image-pending .agent-image-card {
  position: relative;
  width: 340px;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
  isolation: isolate;
  border: 1px solid #e7e5ed;
  border-radius: 18px;
  background: #faf9fc;
  box-shadow: 0 4px 16px rgba(40, 34, 62, 0.04);
}

body.agent-bifang-host .agent-image-placeholder-shimmer {
  inset: 0;
  background:
    radial-gradient(ellipse at 12% 8%, #eeebf7 0%, transparent 60%),
    radial-gradient(ellipse at 100% 100%, #f3eee8 0%, transparent 60%);
  transform: none;
  animation: none;
  pointer-events: none;
}

@keyframes bifangPendingBreathe {
  0%, 100% {
    opacity: 0.65;
    transform: translateY(2px);
  }

  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.agent-bifang-host .agent-image-placeholder-label::before,
  body.agent-bifang-host .agent-msg-image-pending .agent-image-card {
    animation: none;
  }

  body.agent-bifang-host .agent-run-progress.is-in-image .image-uploader-progress-bar {
    transition: none;
  }
}

body.agent-bifang-host .agent-msg-image-pending .agent-image-placeholder {
  width: 100%;
  max-width: 100%;
}

body.agent-bifang-host .agent-run-progress.hidden {
  display: none !important;
}

body.agent-bifang-host .agent-run-progress .image-uploader-progress {
  position: relative;
  flex: 1 1 auto;
  min-width: 120px;
  height: 4px;
  min-height: 4px;
  border-radius: 999px;
  background: #eef0f3;
  overflow: hidden;
}

body.agent-bifang-host .agent-run-progress .image-uploader-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--agent-shell-accent);
  transition: width 0.3s ease;
}

body.agent-bifang-host .agent-run-progress #agent-progress-text {
  margin-left: 8px;
  color: var(--agent-shell-sub);
  font-size: 12px;
  line-height: 1;
}

body.agent-bifang-host .agent-run-progress #agent-queue-hint {
  flex: 1 1 100%;
  margin: 0;
  color: var(--agent-shell-sub);
  font-size: 12px;
  line-height: 1.5;
}

body.agent-bifang-host .agent-run-progress #agent-queue-hint:empty {
  display: none;
}

/* ---------------- 双联阶段卡 ---------------- */

body.agent-bifang-host .agent-stage-card {
  width: min(520px, 100%);
  padding: 14px 16px;
  border: 1px solid var(--agent-shell-line);
  border-radius: 16px;
  background: #fff;
}

body.agent-bifang-host .agent-stage-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

body.agent-bifang-host .agent-stage-card-title {
  color: var(--agent-shell-text);
  font-size: 13px;
  font-weight: 650;
}

body.agent-bifang-host .agent-stage-card-mode {
  color: var(--agent-shell-sub);
  font-size: 12px;
}

body.agent-bifang-host .agent-stage-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.agent-bifang-host .agent-stage-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

body.agent-bifang-host .agent-stage-icon {
  position: relative;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border: 1.5px solid #d7d9de;
  border-radius: 50%;
  box-sizing: border-box;
}

body.agent-bifang-host .agent-stage-item.is-running .agent-stage-icon {
  border-color: var(--agent-shell-accent);
  border-right-color: transparent;
  animation: agent-stage-spin 0.8s linear infinite;
}

body.agent-bifang-host .agent-stage-item.is-done .agent-stage-icon {
  border-color: var(--agent-shell-accent);
  background: var(--agent-shell-accent);
}

body.agent-bifang-host .agent-stage-item.is-done .agent-stage-icon::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 4px;
  height: 9px;
  border: solid #fff;
  border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg);
}

body.agent-bifang-host .agent-stage-item.is-error .agent-stage-icon {
  border-color: #dc2626;
}

body.agent-bifang-host .agent-stage-item.is-cancelled .agent-stage-icon {
  border-color: #c7c9ce;
  animation: none;
}
body.agent-bifang-host .agent-stage-item.is-cancelled .agent-stage-name,
body.agent-bifang-host .agent-stage-item.is-cancelled .agent-stage-state {
  color: #8b8f98;
}

body.agent-bifang-host .agent-stage-body {
  flex: 1 1 auto;
  min-width: 0;
}

body.agent-bifang-host .agent-stage-name {
  color: var(--agent-shell-text);
  font-size: 13px;
  line-height: 1.5;
}

body.agent-bifang-host .agent-stage-item.is-pending .agent-stage-name {
  color: #a4a8b1;
}

body.agent-bifang-host .agent-stage-state {
  flex: 0 0 auto;
  color: var(--agent-shell-sub);
  font-size: 12px;
  line-height: 1.6;
}

body.agent-bifang-host .agent-stage-summary {
  margin: 0 0 10px;
  color: var(--agent-shell-text);
  font-size: 13px;
  line-height: 1.6;
}

body.agent-bifang-host .agent-stage-detail {
  margin-top: 2px;
  color: var(--agent-shell-sub);
  font-size: 12px;
  line-height: 1.55;
}

/* 规划卡复用阶段卡排版：外壳气泡透明，卡片观感由 .agent-stage-card 承载 */
body.agent-bifang-host .agent-plan-inline .agent-bubble {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  /* 气泡的 pre-wrap 会把模板换行/缩进渲染成真实空隙（条目被撑高、文字错位），
     阶段卡内必须恢复正常空白折叠 */
  white-space: normal;
}

/* thread 为 flex 容器：规划外壳不得被拉伸到整屏高 */
body.agent-bifang-host .agent-plan-inline {
  align-self: flex-start;
  width: 100%;
}
body.agent-bifang-host .agent-plan-inline .agent-stage-card {
  height: fit-content;
}

body.agent-bifang-host .agent-stage-item.is-running .agent-stage-state {
  color: var(--agent-shell-accent);
}

body.agent-bifang-host .agent-stage-item.is-done .agent-stage-state {
  color: #16a34a;
}

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

/* ---------------- 反问 / 选择 dock ---------------- */

body.agent-bifang-host .agent-clarify {
  padding: 16px 18px;
  background: #fff;
}

body.agent-bifang-host .agent-clarify-dock {
  width: min(820px, calc(100% - 24px));
  margin: 0 auto 8px;
  border: 1px solid var(--agent-shell-line);
  border-top: 1px solid var(--agent-shell-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(17, 17, 20, 0.1);
  max-height: min(52vh, 520px);
}

body.agent-bifang-host .agent-clarify-dock:not(.hidden)::before {
  content: "需要你确认";
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--agent-shell-sub);
  margin-bottom: 10px;
}

body.agent-bifang-host .agent-clarify-q {
  margin-bottom: 10px;
  color: var(--agent-shell-text);
  /* 反问要简单明了：问题文字放大，不再用小字说明 */
  font-size: 16px;
  font-weight: 600;
  line-height: 1.55;
}

/* 反问区去掉小字观感：说明文字提到 13px，动作按钮加大到好点的触控目标 */
body.agent-bifang-host #agent-clarify .field-hint {
  font-size: 13px;
  line-height: 1.6;
}

body.agent-bifang-host #agent-clarify .btn-sm {
  min-height: 40px;
  padding: 0 16px;
  font-size: 14px;
}

body.agent-bifang-host .agent-options {
  gap: 8px;
  margin: 8px 0;
}

body.agent-bifang-host .agent-option {
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--agent-shell-line);
  border-radius: 14px;
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease;
}

body.agent-bifang-host .agent-option:hover {
  background: #fafafb;
  border-color: #dcdde3;
}

body.agent-bifang-host .agent-option.is-recommended {
  border-color: #c9cbd3;
  background: #fafafb;
}

body.agent-bifang-host .agent-option.is-recommended .agent-option-tag {
  background: var(--agent-shell-accent);
  border-color: var(--agent-shell-accent);
  color: #fff;
}

body.agent-bifang-host .agent-option-tag {
  width: 20px;
  height: 20px;
  font-size: 11px;
  background: #f2f3f5;
  border: 1px solid #e3e4e8;
  color: #6b7280;
}

body.agent-bifang-host .agent-option-label {
  color: var(--agent-shell-text);
  font-size: 14px;
  line-height: 1.5;
}

body.agent-bifang-host .agent-option-detail {
  color: var(--agent-shell-sub);
  font-size: 12px;
  line-height: 1.55;
}

body.agent-bifang-host .agent-clarify-actions {
  gap: 8px;
  margin: 12px 0 0;
}

body.agent-bifang-host .agent-clarify-actions .btn-primary,
body.agent-bifang-host .agent-clarify-actions .btn-secondary,
body.agent-bifang-host .agent-clarify-actions .btn-ghost {
  width: auto;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

body.agent-bifang-host .agent-clarify-actions .btn-primary {
  background: var(--agent-shell-accent);
  border: 0;
  color: #fff;
}

body.agent-bifang-host .agent-clarify-actions .btn-secondary,
body.agent-bifang-host .agent-clarify-actions .btn-ghost {
  background: #fff;
  border: 1px solid var(--agent-shell-line);
  color: #374151;
}

/* 输入区：只保留一层卡片。
 * 上游规则用 .agent-layout:not(.agent-input-collapsed) #agent-chat-composer 隐藏底部输入，
 * 这里用 #agent-layout 多拿一个 ID 权重，保证对话区输入常驻。 */

body.agent-bifang-host #agent-layout #agent-chat-composer {
  display: block !important;
  width: min(920px, calc(100% - 48px));
  margin: 0 auto 14px;
  padding: 0;
  border: 0;
  background: transparent;
}

/* 对话流与输入卡同宽，宽屏下更整齐 */
@media (min-width: 961px) {
  body.agent-bifang-host .agent-thread {
    width: min(920px, 100%);
    margin-left: auto;
    margin-right: auto;
  }
}

/* 全端只有这一张输入卡（#agent-chat-composer） */
body.agent-bifang-host .agent-inspire-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 10px 12px 8px;
  border: 1px solid var(--agent-shell-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(17, 17, 20, 0.06);
  position: relative;
}

/* 拖拽图片到对话区：输入卡高亮并给出"松开即可上传"提示 */
body.agent-bifang-host .agent-inspire-card.is-drag-over {
  border-color: #111;
  box-shadow: 0 0 0 2px rgba(17, 17, 20, 0.08), 0 8px 28px rgba(17, 17, 20, 0.1);
}

body.agent-bifang-host .agent-inspire-card.is-drag-over::after {
  content: "松开即可上传图像";
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  color: #111;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}

body.agent-bifang-host .agent-inspire-card .agent-chat-input,
body.agent-bifang-host .agent-inspire-card #agent-chat-input {
  min-height: 42px;
  max-height: 160px;
  padding: 8px 6px 4px;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  outline: 0 !important;
  color: var(--agent-shell-text);
  font-size: 15px;
  line-height: 1.5;
  resize: none;
}

body.agent-bifang-host .agent-inspire-card .agent-chat-input:focus,
body.agent-bifang-host .agent-inspire-card .agent-chat-input:focus-visible,
body.agent-bifang-host .agent-inspire-card #agent-chat-input:focus,
body.agent-bifang-host .agent-inspire-card #agent-chat-input:focus-visible {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

body.agent-bifang-host .agent-inspire-card .agent-chat-input::placeholder {
  color: #a4a8b1;
}

body.agent-bifang-host .agent-inspire-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 2px;
}

body.agent-bifang-host .agent-inspire-upload {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--agent-shell-line);
  border-radius: 999px;
  background: #fff;
  color: #374151;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: 1;
  box-sizing: border-box;
  list-style: none;
  cursor: pointer;
}

body.agent-bifang-host summary.agent-inspire-upload::-webkit-details-marker {
  display: none;
}

body.agent-bifang-host .agent-inspire-upload:hover {
  background: #f5f5f7;
}

body.agent-bifang-host .agent-inspire-upload svg {
  width: 18px;
  height: 18px;
}

body.agent-bifang-host #btn-agent-chat-send {
  margin-inline-start: auto;
  min-width: 64px;
  min-height: 36px;
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--agent-shell-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

body.agent-bifang-host #btn-agent-chat-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

body.agent-bifang-host #btn-agent-chat-send.is-stop {
  background: #fff;
  color: #c2410c;
  border: 1px solid #f1d4c4;
}

body.agent-bifang-host #btn-agent-chat-send.is-stopping {
  opacity: 0.6;
}

body.agent-bifang-host .agent-inspire-card #agent-general-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 4px;
}

body.agent-bifang-host .agent-inspire-card #agent-general-grid .field-hint {
  display: none;
}

/* 上传缩略图圆角统一 */
body.agent-bifang-host .agent-general-thumb,
body.agent-bifang-host .agent-task-media-item img,
body.agent-bifang-host .agent-user-img {
  border-radius: 12px;
}

/* 手机与触屏：按钮不小于 44px，方便拇指点 */
@media (max-width: 960px), (hover: none) and (pointer: coarse) {
  body.agent-bifang-host .agent-inspire-upload,
  body.agent-bifang-host #btn-agent-chat-send {
    min-height: 44px;
    height: 44px;
  }

  body.agent-bifang-host #btn-agent-chat-send {
    min-width: 72px;
  }

  body.agent-bifang-host .agent-inspire-upload svg {
    width: 20px;
    height: 20px;
  }
}

/* 手机端：同一张输入卡收窄，底部留安全区 */
@media (max-width: 960px) {
  body.agent-bifang-host #agent-layout #agent-chat-composer {
    width: calc(100% - 24px);
    margin-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  }

  body.agent-bifang-host .agent-inspire-card {
    border-radius: 16px;
    padding: 8px 10px 6px;
  }

  body.agent-bifang-host .agent-inspire-card .agent-chat-input,
  body.agent-bifang-host .agent-inspire-card #agent-chat-input {
    min-height: 40px;
    max-height: 120px;
    padding: 6px 4px 4px;
    font-size: 16px;
    line-height: 1.45;
  }

  body.agent-bifang-host .agent-thread {
    padding: 16px 14px 8px;
  }

  body.agent-bifang-host .agent-msg-user .agent-bubble {
    max-width: 86%;
  }

  body.agent-bifang-host .agent-stage-card {
    width: 100%;
  }
}

/* ---------------- 出图下方操作按钮：文字不许竖排/溢出 ---------------- */

body.agent-bifang-host .agent-image-actions,
body.agent-bifang-host .agent-bubble .agent-image-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: min(340px, 100%);
  margin-top: 10px;
}

body.agent-bifang-host .agent-image-actions > button,
body.agent-bifang-host .agent-image-actions > .btn,
body.agent-bifang-host .agent-image-actions > a {
  flex: 0 0 auto;
  width: auto;
  min-width: max-content;
  min-height: 32px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  letter-spacing: 0;
  font-size: 13px;
  line-height: 1;
  box-sizing: border-box;
}

body.agent-bifang-host .agent-image-actions > button.btn-primary,
body.agent-bifang-host .agent-image-actions > .btn-primary {
  background: var(--agent-shell-accent);
  border: 0;
  color: #fff;
}

body.agent-bifang-host .agent-image-actions > button:not(.btn-primary),
body.agent-bifang-host .agent-image-actions > .btn:not(.btn-primary) {
  background: #fff;
  border: 1px solid var(--agent-shell-line);
  color: #374151;
}

/* 智能体选定模式/工作流：做成醒目的选择标签 */
.agent-note.agent-note-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 6px 0;
  padding: 6px 12px 6px 8px;
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.12), rgba(37, 99, 235, 0.04));
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.1);
  color: #1e40af;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.agent-note.agent-note-chip::before {
  content: "已选";
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.agent-note.agent-note-chip[data-pick-kind="模式"]::before { content: "模式"; }
.agent-note.agent-note-chip[data-pick-kind="功能"]::before { content: "功能"; }
.agent-note.agent-note-chip[data-pick-kind="工作流"]::before { content: "工作流"; }

body.agent-bifang-host #btn-agent-chat-send.is-processing-locked {
  background: #b9bec6 !important;
  border-color: #b9bec6 !important;
  color: #fff !important;
  opacity: 1;
  cursor: not-allowed;
}
