/* AI Agent 悬浮面板：右下角球，展开后可悬浮拖动或固定停靠。 */
:root { --agent-dock-w: 400px; }

.agent-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 50%;
  background: var(--accent, #2563eb);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgb(0 0 0 / 22%);
  transition: transform .18s ease, box-shadow .18s ease;
}

.agent-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgb(0 0 0 / 26%); }
.agent-fab svg { width: 24px; height: 24px; }
.agent-fab[hidden] { display: none; }

.agent-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 61;
  width: 400px;
  height: 560px;
  max-height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  background: var(--surface, #fff);
  color: var(--ink, #1b1d1b);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgb(0 0 0 / 24%);
  overflow: hidden;
}

.agent-panel[hidden] { display: none; }
.agent-panel.is-pinned { width: var(--agent-dock-w); border-radius: 16px 0 0 16px; right: 0; bottom: 0; height: 100vh; max-height: 100vh; }

/* 停靠时左侧后台压缩，像分屏一样让出面板宽度，不再被面板盖住。 */
body.agent-docked { min-width: 0; }
body.agent-docked .admin-shell { width: calc(100% - var(--agent-dock-w)); }
@media (max-width: 900px) {
  body.agent-docked { min-width: 1100px; }
  body.agent-docked .admin-shell { width: 100%; }
}

.agent-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 10px 11px 14px;
  border-bottom: 1px solid var(--line, #e5e7eb);
  cursor: move;
  user-select: none;
  background: var(--surface-2, #faf9f6);
}

.agent-panel.is-pinned .agent-head { cursor: default; }
.agent-title { font-weight: 700; font-size: 15px; margin-right: auto; min-width: 0; }
.agent-title small { display: block; font-weight: 400; font-size: 11px; opacity: .6; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-head-actions { display: flex; align-items: center; gap: 1px; flex: 0 0 auto; }

.agent-icon-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .62;
  transition: background .15s ease, opacity .15s ease;
}
.agent-icon-btn:hover { background: var(--hover, rgb(0 0 0 / 6%)); opacity: 1; }
.agent-icon-btn svg { width: 17px; height: 17px; }
.agent-icon-btn.is-on { color: var(--accent, #2563eb); opacity: 1; background: var(--accent-soft, rgb(37 99 235 / 10%)); }

/* 窗口形态菜单 */
.agent-mode { position: relative; }
.agent-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 6;
  min-width: 218px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 14px 36px rgb(0 0 0 / 16%);
}
.agent-menu[hidden] { display: none; }
.agent-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  padding: 8px 9px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.agent-menu-item:hover { background: var(--hover, rgb(0 0 0 / 5%)); }
.agent-menu-icon { flex: 0 0 auto; display: flex; opacity: .6; }
.agent-menu-item.is-active .agent-menu-icon { opacity: 1; color: var(--accent, #2563eb); }
.agent-menu-icon svg { width: 17px; height: 17px; }
.agent-menu-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.agent-menu-text b { font-size: 13px; font-weight: 600; }
.agent-menu-text i { font-style: normal; font-size: 11px; opacity: .55; }
.agent-menu-check { flex: 0 0 auto; margin-left: auto; width: 15px; height: 15px; color: var(--accent, #2563eb); opacity: 0; }
.agent-menu-check svg { width: 15px; height: 15px; }
.agent-menu-item.is-active .agent-menu-check { opacity: 1; }

.agent-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overscroll-behavior: contain;
}

.agent-msg {
  max-width: 92%; line-height: 1.65; font-size: 13.5px; word-break: break-word;
  display: flex; flex-direction: column; align-items: flex-start;
}
.agent-msg.me { align-self: flex-end; align-items: flex-end; }
/* 模型输出不用气泡：直接占满可用宽度，跟随窗口自适应（用户消息保留气泡） */
.agent-msg.ai { align-self: stretch; width: 100%; }
/* 操作条在气泡外：气泡只装消息本体，按钮和模型名贴在下面 */
.agent-bubble { max-width: 100%; }
.agent-msg.me .agent-bubble { padding: 9px 13px; border-radius: 14px 14px 3px 14px; background: var(--accent, #2563eb); color: #fff; max-width: 100%; }
.agent-msg.ai p { margin: 0 0 8px; }
.agent-msg.ai p:last-child { margin-bottom: 0; }

@keyframes agent-pulse { 50% { opacity: .3; } }

.agent-empty { margin: auto; text-align: center; opacity: .55; font-size: 13px; line-height: 1.8; padding: 30px 10px; }

.agent-foot { flex: 0 0 auto; position: relative; border-top: 1px solid var(--line, #e5e7eb); padding: 10px 12px; }
.agent-input-row { display: flex; gap: 8px; align-items: flex-end; }
.agent-input-wrap { flex: 1 1 auto; min-width: 0; display: flex; }
.agent-input {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  max-height: 140px;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line, #d1d5db);
  border-radius: 10px;
  background: var(--surface, #fff);
  color: inherit;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.6;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}
.agent-input:empty::before { content: attr(data-placeholder); color: var(--muted, #9ca3af); pointer-events: none; }
.agent-input:focus { border-color: var(--accent, #2563eb); }
.agent-send {
  flex: 0 0 auto;
  border: 0;
  border-radius: 10px;
  background: var(--accent, #2563eb);
  color: #fff;
  padding: 0 14px;
  height: 40px;
  cursor: pointer;
  font-weight: 600;
}
.agent-send:disabled { opacity: .45; cursor: not-allowed; }
/* v4.58：停止态要保留可视的按钮形体。v4.34 曾改成纯文字（透明底），
   结果在输入框旁边看着像一句悬空的「停止」二字，没有可点的感觉。
   改用 danger-soft 浅底 + danger 文字：仍是文字按钮，但有明确边界。 */
.agent-send.is-stop {
  background: var(--danger-soft, rgba(176, 68, 54, .08));
  color: var(--danger, #b04436);
  padding: 0 14px;
  font-weight: 600;
}
.agent-send.is-stop:hover { background: var(--danger-soft, rgba(176, 68, 54, .08)); opacity: .82; }
/* 底部快捷键提示行已删（v4.28）；flash 改用独立浮动通知 */
.agent-flash {
  position: fixed; right: 18px; bottom: 90px; z-index: 12500; max-width: min(420px, 80vw);
  padding: 8px 12px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px;
  background: var(--surface, #fff); color: var(--ink, #1b1d1b); font-size: 12.5px; line-height: 1.5;
  box-shadow: 0 10px 30px rgb(0 0 0 / 16%);
}
.agent-flash.is-error { border-color: var(--danger, #dc2626); color: var(--danger, #dc2626); }
.agent-flash[hidden] { display: none; }

/* 设置页 */
.agent-settings { flex: 1 1 auto; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.agent-settings[hidden] { display: none; }
.agent-set-title { font-size: 13px; font-weight: 700; margin: 0 0 10px; }
.agent-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.agent-field label { font-size: 12px; opacity: .8; }
.agent-field input, .agent-field select {
  border: 1px solid var(--line, #d1d5db);
  border-radius: 9px;
  padding: 9px 10px;
  background: var(--surface, #fff);
  color: inherit;
  font: inherit;
  font-size: 13px;
  outline: none;
}
.agent-field input:focus, .agent-field select:focus { border-color: var(--accent, #2563eb); }
.agent-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.agent-preset {
  border: 1px solid var(--line, #d1d5db);
  border-radius: 8px;
  padding: 5px 9px;
  background: transparent;
  color: inherit;
  font-size: 12px;
  cursor: pointer;
}
.agent-preset:hover { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); }

.agent-perm { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
.agent-perm input { width: 17px; height: 17px; accent-color: var(--accent, #2563eb); }
.agent-perm b { font-size: 13px; }
.agent-perm span { display: block; font-size: 11px; opacity: .6; margin-top: 2px; }
.agent-actions { display: flex; gap: 8px; }
.agent-actions .btn { flex: 1 1 auto; }

@media (max-width: 520px) {
  .agent-panel { right: 8px; bottom: 8px; left: 8px; width: auto; height: 78vh; }
}

/* ============ 供应商选择（悬浮面板与全屏页共用） ============ */
.agent-provider-row { margin-bottom: 8px; }
.agent-provider-row[hidden] { display: none; }
.agent-provider-row select {
  width: 100%;
  border: 1px solid var(--line, #d1d5db);
  border-radius: 9px;
  padding: 7px 9px;
  background: var(--surface, #fff);
  color: inherit;
  font: inherit;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}
.agent-provider-row select:focus { border-color: var(--accent, #2563eb); }

/* ============ 对话框下方：单行左功能 / 右模型与上下文 ============ */
.agent-quick { display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.agent-quick-left, .agent-quick-right { display: flex; flex-wrap: nowrap; align-items: center; gap: 5px; min-width: 0; }
/* 输入框左下角：当前工作区（点击切换归属，不选则归到任务） */
.agent-ws-pick {
  display: inline-flex; align-items: center; gap: 4px;
  height: 30px; padding: 0 7px; max-width: 132px; min-width: 0;
  border: 1px solid var(--line, #e5e7eb); border-radius: 8px;
  background: var(--surface, #fff); color: inherit;
  font: inherit; font-size: 11.5px; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.agent-ws-pick svg { width: 14px; height: 14px; opacity: .7; flex: 0 0 auto; }
.agent-ws-pick #agent-ws-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-ws-pick .agent-ws-caret { display: inline-flex; opacity: .45; }
.agent-ws-pick .agent-ws-caret svg { width: 11px; height: 11px; opacity: 1; }
.agent-ws-pick:hover { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); }
.agent-ws-pick.is-set { border-color: color-mix(in srgb, var(--accent, #2563eb) 42%, var(--line, #e5e7eb)); color: var(--accent, #2563eb); background: color-mix(in srgb, var(--accent, #2563eb) 7%, var(--surface, #fff)); }
/* 悬浮面板较窄，只留文件夹图标 */
.agent-panel .agent-ws-pick { width: 30px; padding: 0; justify-content: center; }
.agent-panel .agent-ws-pick #agent-ws-label,
.agent-panel .agent-ws-pick .agent-ws-caret { display: none; }
.agent-quick-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border: 1px solid var(--line, #e5e7eb); border-radius: 8px;
  background: var(--surface, #fff); color: inherit;
  font: inherit; line-height: 1; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.agent-quick-icon { display: inline-flex; }
.agent-quick-btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.agent-quick-btn:hover { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); }
.agent-quick-btn.is-on { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); background: color-mix(in srgb, var(--accent, #2563eb) 8%, transparent); }
.agent-quick-btn.is-perm { border-color: color-mix(in srgb, var(--accent, #2563eb) 45%, var(--line, #e5e7eb)); }
.agent-model-pick {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 6px 0 4px; min-width: 0;
  border: 1px solid var(--line, #e5e7eb); border-radius: 8px;
  background: var(--surface, #fff); color: inherit; font: inherit; font-size: 11.5px; cursor: pointer;
}
.agent-model-pick #agent-model-label { max-width: 106px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-model-caret { opacity: .5; font-size: 13px; line-height: 1; }
.agent-ctx {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 29px; padding: 0 8px;
  border: 1px solid var(--line, #e5e7eb); border-radius: 8px;
  background: var(--surface, #fff); font-size: 11.5px;
}
.agent-model-pick svg, .agent-ctx svg { width: 14px; height: 14px; opacity: .75; flex: 0 0 auto; }
.agent-ctx input[type="range"] { width: 84px; accent-color: var(--accent, #2563eb); cursor: pointer; }
.agent-ctx output { min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; opacity: .75; }
.agent-panel .agent-foot-hint { display: none; }

.agent-quick-pop {
  position: absolute; left: 12px; bottom: calc(100% - 2px); z-index: 40;
  width: min(560px, calc(100vw - 40px));
  padding: 14px; border: 1px solid var(--line, #e5e7eb); border-radius: 12px;
  background: var(--surface, #fff); box-shadow: 0 18px 48px rgba(15, 23, 42, .18);
}
.agent-quick-pop[hidden], .agent-approval[hidden] { display: none; }
.agent-quick-pop-title { display: flex; align-items: baseline; gap: 8px; font-size: 11px; opacity: .7; margin: 0 0 8px; }
.agent-quick-pop-title b { font-size: 13px; opacity: 1; }
.agent-quick-pop-title i { font-style: normal; margin-left: auto; opacity: .7; }
.agent-quick-pop-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.agent-quick-pop-mode, .agent-quick-pop-group {
  text-align: left; border: 1px solid var(--line, #e5e7eb); border-radius: 10px;
  background: transparent; color: inherit; font: inherit; cursor: pointer; padding: 9px 10px;
}
.agent-quick-pop-mode b, .agent-quick-pop-group b { display: block; font-size: 12.5px; }
.agent-quick-pop-mode span, .agent-quick-pop-group i { font-style: normal; font-size: 11px; opacity: .7; margin-left: 6px; }
.agent-quick-pop-mode i { display: block; font-style: normal; font-size: 10.5px; opacity: .55; margin-top: 5px; line-height: 1.4; }
.agent-quick-pop-mode.is-active { border-color: var(--accent, #2563eb); background: color-mix(in srgb, var(--accent, #2563eb) 8%, transparent); }
.agent-quick-pop-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.agent-quick-pop-group { position: relative; padding: 8px 10px 8px 24px; }
.agent-quick-pop-group small { display: block; font-size: 10.5px; opacity: .55; margin-top: 4px; line-height: 1.35; }
.agent-quick-pop-group .agent-perm-dot { position: absolute; left: 9px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--line, #d1d5db); }
.agent-quick-pop-group.is-on .agent-perm-dot { background: var(--accent, #2563eb); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #2563eb) 18%, transparent); }

.agent-approval {
  display: flex; align-items: center; gap: 9px; margin-top: 9px; padding: 9px 10px;
  border: 1px solid color-mix(in srgb, #f59e0b 45%, var(--line, #e5e7eb)); border-radius: 10px;
  background: color-mix(in srgb, #f59e0b 8%, var(--surface, #fff));
}
.agent-approval-icon { display: inline-flex; color: #d97706; }
.agent-approval-icon svg { width: 18px; height: 18px; }
.agent-approval-text { flex: 1 1 auto; min-width: 0; }
.agent-approval-text b { display: block; font-size: 12px; }
.agent-approval-text i { display: block; font-style: normal; font-size: 10.5px; opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-approval-btn {
  flex: 0 0 auto;
  border: 1px solid var(--line, #d1d5db); border-radius: 8px; background: var(--surface, #fff);
  color: inherit; font: inherit; font-size: 11.5px; padding: 5px 11px; cursor: pointer;
  white-space: nowrap;
}
.agent-approval-btn:hover { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); }
.agent-approval-btn.is-deny:hover { border-color: var(--danger, #dc2626); color: var(--danger, #dc2626); }

@media (max-width: 560px) {
  .agent-quick-pop-modes, .agent-quick-pop-groups { grid-template-columns: 1fr; }
  .agent-quick-right { width: 100%; }
}

/* ============ 全屏工作台（/admin/agent） ============ */
.agent-full-page { margin: 0; }
.wb-shell { display: flex; height: 100vh; background: var(--bg, #fbfbf9); color: var(--ink, #1b1d1b); }

/* 侧栏定宽：不随内容自己变，宽度由 .wb-side-resize 拖动决定（存在 localStorage） */
.wb-side {
  position: relative;
  flex: 0 0 264px;
  width: 264px;
  min-width: 0;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  background: var(--surface, #fff);
  border-right: 1px solid var(--line, #e5e7eb);
  min-height: 0;
  overflow: hidden;
}
.wb-side-resize {
  position: absolute; top: 0; right: 0; z-index: 5;
  width: 7px; height: 100%; cursor: col-resize; touch-action: none;
}
.wb-side-resize::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 1px;
  background: transparent; transition: background .15s;
}
.wb-side-resize:hover::after, .wb-side-resize:focus-visible::after { background: var(--accent, #2563eb); opacity: .55; }
body.wb-resizing { cursor: col-resize; user-select: none; }
body.wb-resizing * { cursor: col-resize !important; }
.wb-side-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 14px 12px;
}
.wb-side-head strong { font-size: 16px; margin-right: auto; }
.wb-new {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--accent, #2563eb);
  color: var(--accent, #2563eb);
  background: transparent;
  border-radius: 8px;
  padding: 6px 10px 6px 8px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.wb-new svg { width: 14px; height: 14px; }
.wb-new:hover { background: var(--accent, #2563eb); color: #fff; }

.agent-add-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.agent-add-btn svg { width: 15px; height: 15px; }

.wb-sessions { flex: 1 1 auto; overflow-y: auto; padding: 0 8px 8px; min-height: 0; }
.wb-sessions-empty { font-size: 12px; opacity: .5; padding: 14px; text-align: center; }
.wb-session {
  display: flex;
  align-items: center;
  border-radius: 9px;
  margin-bottom: 2px;
}
.wb-session:hover { background: var(--hover, rgb(0 0 0 / 4%)); }
.wb-session.is-active { background: var(--accent-soft, rgb(37 99 235 / 10%)); }
.wb-session-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 9px 8px 9px 10px;
  cursor: pointer;
}
.wb-session-title { flex: 1 1 auto; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-session-time { flex: 0 0 auto; font-size: 11px; opacity: .45; font-variant-numeric: tabular-nums; }

.wb-side-foot {
  flex: 0 0 auto;
  border-top: 1px solid var(--line, #e5e7eb);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wb-side-model { font-size: 11px; opacity: .55; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* v4.78：侧栏底部不再显示供应商名，空节点不占位（悬浮窗里的同名元素不受影响） */
.wb-side-foot .wb-side-model:empty { display: none; }
.wb-side-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  padding: 8px 9px;
  border-radius: 8px;
  font-size: 13px;
  text-align: left;
}
.wb-side-btn:hover { background: var(--hover, rgb(0 0 0 / 5%)); }
.wb-side-btn svg { width: 17px; height: 17px; opacity: .7; }

/* v4.80：侧栏底部用户条 —— 头像 + 昵称 + 设置/深色模式两个图标按钮。
   参照常见 IM 客户端布局：左边身份、右边操作，整条高度紧凑只占一行。 */
.wb-user {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 6px 7px;
  border-radius: 10px;
}
.wb-user:hover { background: var(--hover, rgb(0 0 0 / 4%)); }
.wb-user-avatar {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  overflow: hidden;
  background: color-mix(in srgb, var(--accent, #2563eb) 14%, transparent);
  color: var(--accent, #2563eb);
  font-size: 12px; font-weight: 600;
  text-transform: uppercase;
}
.wb-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.wb-user-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wb-user-ops { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 2px; }
.wb-user-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0;
  border: 0; border-radius: 7px;
  background: transparent; color: inherit;
  opacity: .55; cursor: pointer;
  transition: opacity .15s, background .15s;
}
.wb-user-btn svg { width: 15px; height: 15px; }
.wb-user-btn:hover { opacity: 1; background: var(--hover, rgb(0 0 0 / 6%)); }

/* 助手登录 / 首次建号页 */
.agent-auth-mask {
  position: fixed; inset: 0; z-index: 21000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--surface, #fbfbf9);
}
.agent-auth-card {
  width: min(360px, 100%);
  display: flex; flex-direction: column; gap: 12px;
  padding: 26px 24px;
  border: 1px solid var(--line, #e5e7eb); border-radius: 14px;
  background: var(--surface, #fff);
  box-shadow: 0 18px 50px rgb(0 0 0 / 10%);
}
.agent-auth-brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 700;
}
.agent-auth-brand svg { width: 20px; height: 20px; opacity: .8; }
.agent-auth-sub { margin: 0 0 4px; font-size: 12px; line-height: 1.6; opacity: .6; }
.agent-auth-field { display: flex; flex-direction: column; gap: 5px; }
.agent-auth-field span { font-size: 11.5px; opacity: .6; }
.agent-auth-field input {
  height: 36px; padding: 0 10px;
  border: 1px solid var(--line, #e5e7eb); border-radius: 9px;
  background: var(--surface-2, transparent); color: inherit;
  font: inherit; font-size: 13px; outline: none;
}
.agent-auth-field input:focus { border-color: var(--accent, #2563eb); }
.agent-auth-error { margin: 0; font-size: 12px; color: var(--danger, #dc2626); }
.agent-auth-submit { height: 38px; margin-top: 4px; }

.wb-main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.wb-head {
  flex: 0 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--line, #e5e7eb);
  background: var(--surface, #fff);
}
.wb-title { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wb-body { padding: 24px max(24px, calc((100% - 860px) / 2)); gap: 16px; }
/* 用户消息保留气泡并限宽；模型输出占满内容列宽度，不随内容忽宽忽窄 */
.wb-body { --agent-me-max: 82%; }
.wb-body .agent-msg { font-size: 14px; }
.wb-body .agent-msg.me { max-width: var(--agent-me-max); }
.wb-body .agent-msg.ai { max-width: 100%; }
.wb-foot { padding: 14px max(24px, calc((100% - 860px) / 2)) 18px; }
.wb-foot .agent-input { min-height: 52px; font-size: 14px; }
.wb-foot .agent-send { height: 52px; padding: 0 22px; }

.wb-settings {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px max(24px, calc((100% - 860px) / 2));
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wb-settings[hidden] { display: none; }
.wb-settings .agent-set-title,
.wb-settings .agent-set-head h2 { font-size: 15px; }
.agent-set-head { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.agent-set-head h2 { margin: 0; font-size: 15px; font-weight: 700; margin-right: auto; }
/* v4.72：标题说明收进 wb-help；动态统计作为 meta 紧跟问号右侧。 */
.agent-set-meta { margin-left: 8px; font-size: 11.5px; font-weight: 400; opacity: .55; line-height: 1.4; }
.agent-set-head h2 .wb-help, .wb-card-title .wb-help { font-weight: 400; }
.agent-actions--end { justify-content: flex-end; margin-top: 8px; }

/* 供应商卡片 */
.agent-providers { display: flex; flex-direction: column; gap: 12px; }
.agent-provider {
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface, #fff);
}
.agent-provider-top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.agent-provider-top select {
  flex: 1 1 auto;
  border: 1px solid var(--line, #d1d5db);
  border-radius: 8px;
  padding: 7px 9px;
  background: var(--surface-2, #faf9f6);
  color: inherit;
  font: inherit;
  font-size: 13px;
  outline: none;
}
.agent-provider-test { flex: 0 0 auto; padding: 6px 12px; font-size: 12px; }
.agent-provider-del {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: .45;
  cursor: pointer;
  padding: 6px;
  border-radius: 7px;
}
.agent-provider-del svg { width: 15px; height: 15px; }
.agent-provider-del:hover { opacity: 1; color: var(--danger, #dc2626); }
.agent-provider .agent-field { margin-bottom: 9px; }

@media (max-width: 720px) {
  .wb-side { flex-basis: 200px; }
  .wb-body, .wb-foot, .wb-settings { padding-left: 16px; padding-right: 16px; }
}

/* ============ 侧栏：全部任务 ============ */
/* 顶部分类 tab 已移除：侧栏固定展示所有未归档任务，归档在「设置 → 会话与归档」里管理。 */

.wb-select-bar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 12px 4px;
  padding: 10px;
  border: 1px solid var(--accent-soft, rgb(37 99 235 / 22%));
  border-radius: 12px;
  background: var(--accent-soft, rgb(37 99 235 / 8%));
}
.wb-select-bar[hidden] { display: none; }
.wb-select-head { display: flex; align-items: center; gap: 6px; }
.wb-select-count { font-size: 11.5px; opacity: .72; margin-right: auto; padding-left: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wb-select-count b { font-size: 14px; font-weight: 700; color: var(--accent, #2563eb); }
.wb-select-count i { font-style: normal; opacity: .55; margin-left: 3px; }
.wb-select-mini {
  display: inline-flex; align-items: center; gap: 3px;
  border: 0; background: transparent; color: inherit; font: inherit;
  font-size: 11px; padding: 4px 6px; border-radius: 7px; cursor: pointer;
  white-space: nowrap;
}
.wb-select-mini svg { width: 12px; height: 12px; }
.wb-select-mini:hover:not(:disabled) { background: var(--hover, rgb(0 0 0 / 6%)); }
.wb-select-mini:disabled { opacity: .35; cursor: default; }
.wb-select-actions { display: flex; gap: 5px; }
.wb-select-btn {
  flex: 1 1 0; min-width: 0;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 1px solid var(--line, #e5e7eb);
  background: var(--surface, #fff);
  color: inherit; font: inherit; font-size: 11px;
  padding: 7px 2px; border-radius: 9px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, filter .15s;
  white-space: nowrap;
}
.wb-select-btn svg { width: 16px; height: 16px; }
.wb-select-btn:hover:not(:disabled) { background: var(--hover, rgb(0 0 0 / 5%)); border-color: var(--accent, #2563eb); }
.wb-select-btn:disabled { opacity: .38; cursor: default; }
.wb-select-btn.is-danger { color: var(--danger, #dc2626); border-color: rgb(220 38 38 / 30%); }
.wb-select-btn.is-danger:hover:not(:disabled) { background: rgb(220 38 38 / 8%); border-color: var(--danger, #dc2626); }
.wb-select-btn.is-primary { background: var(--accent, #2563eb); border-color: var(--accent, #2563eb); color: #fff; font-weight: 600; }
.wb-select-btn.is-primary:hover:not(:disabled) { filter: brightness(1.08); }

.wb-session-check {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-left: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1.5px solid var(--line, #cbd5e1);
  border-radius: 6px;
  background: var(--surface, #fff);
  color: #fff;
  cursor: pointer;
}
.wb-session-check svg { width: 13px; height: 13px; }
.wb-session.is-selected .wb-session-check { background: var(--accent, #2563eb); border-color: var(--accent, #2563eb); }
.wb-session.is-selected { box-shadow: inset 0 0 0 1px var(--accent, #2563eb); }
/* 多选模式下收起「更多」按钮，点击行为统一为勾选 */
body.wb-selecting .wb-session-ops { display: none; }

.wb-session.is-archived .wb-session-title { opacity: .7; }

.wb-search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 8px 12px 6px;
}
.wb-search svg { position: absolute; left: 9px; width: 14px; height: 14px; opacity: .4; pointer-events: none; }
.wb-search input {
  width: 100%;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px;
  background: var(--surface-2, #faf9f6);
  color: inherit;
  font: inherit;
  font-size: 12px;
  padding: 7px 9px 7px 28px;
  outline: none;
}
.wb-search input:focus { border-color: var(--accent, #2563eb); background: var(--surface, #fff); }
.wb-search input::-webkit-search-cancel-button { cursor: pointer; }
.wb-hit { padding: 9px 10px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; }
.wb-hit:hover { background: var(--hover, rgb(0 0 0 / 4%)); }
.wb-hit-title { font-size: 12.5px; display: flex; gap: 6px; align-items: center; }
.wb-hit-snippet { font-size: 11.5px; opacity: .6; margin-top: 3px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wb-session-ops { display: flex; align-items: center; flex: 0 0 auto; }
/* 只剩「更多」，删除收进菜单里；常显，不靠悬停 */
.wb-session-more,
.wb-folder-more,
.wb-folder-add {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: .38;
  cursor: pointer;
  padding: 5px;
  border-radius: 7px;
}
.wb-session-more svg, .wb-folder-more svg, .wb-folder-add svg { width: 14px; height: 14px; }
.wb-folder-add svg { width: 13px; height: 13px; }
.wb-session-more:hover, .wb-folder-more:hover, .wb-folder-add:hover { opacity: 1 !important; background: var(--hover, rgb(0 0 0 / 6%)); }
/* v4.46：工作区行的「+ / ⋯」只在悬停（或键盘聚焦、菜单展开）时出现 */
.wb-folder-ops {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0;
  opacity: 0;
  transition: opacity .12s;
}
.wb-folder-head:hover .wb-folder-ops,
.wb-folder-head:focus-within .wb-folder-ops { opacity: 1; }

/* ===== v4.21：分类（文件夹） ===== */
.wb-group { margin-bottom: 6px; }
.wb-group-head { display: flex; align-items: center; gap: 2px; padding: 2px 2px 2px 4px; }
.wb-group-toggle {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 5px;
  border: 0; background: transparent; color: inherit; cursor: pointer;
  padding: 5px 4px; border-radius: 7px; font-size: 11.5px; opacity: .55; text-align: left;
}.wb-group-toggle:hover { opacity: .85; background: var(--hover, rgb(0 0 0 / 4%)); }
.wb-group-count { font-variant-numeric: tabular-nums; opacity: .7; }
.wb-group-add {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border: 0; border-radius: 7px; background: transparent;
  color: inherit; cursor: pointer; opacity: .4;
}
.wb-group-add:hover { opacity: .8; background: var(--hover, rgb(0 0 0 / 5%)); }
.wb-group-add svg { width: 13px; height: 13px; }
/* v4.46：分组标题上的「+」已移除，分组头只留折叠箭头 */
/* 折叠箭头：默认朝右，展开时朝下 */
.wb-caret { width: 12px; height: 12px; flex: 0 0 auto; opacity: .7; transform: rotate(-90deg); transition: transform .15s; }
.wb-caret.is-open { transform: rotate(0); }

.wb-folder { margin: 1px 0 3px; }
.wb-folder-head { display: flex; align-items: center; gap: 1px; border-radius: 8px; }
.wb-folder-head:hover { background: var(--hover, rgb(0 0 0 / 3%)); }
.wb-folder-toggle {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 5px;
  border: 0; background: transparent; color: inherit; cursor: pointer;
  padding: 7px 4px 7px 4px; border-radius: 8px; font-size: 12.5px; text-align: left;
}
.wb-folder-toggle > svg:nth-of-type(2) { width: 14px; height: 14px; flex: 0 0 auto; opacity: .55; }
.wb-folder-name { flex: 0 1 auto; min-width: 4em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
/* 目录尾段让位给工作区名：加号占位后侧栏更窄，先牺牲路径 */
.wb-folder-dir { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; opacity: .45; direction: rtl; text-align: left; }
.wb-folder-time { flex: 0 0 auto; font-size: 10.5px; opacity: .45; font-variant-numeric: tabular-nums; }
.wb-folder-body { display: none; padding-left: 14px; }
.wb-folder.is-open > .wb-folder-body { display: block; }
.wb-folder-body .wb-session-main { padding-top: 7px; padding-bottom: 7px; }
.wb-folder-collapse {
  width: 100%; border: 0; background: transparent; color: inherit; cursor: pointer;
  font-size: 11px; text-align: left; padding: 5px 8px 5px 10px; border-radius: 7px; opacity: .45;
}
.wb-folder-collapse:hover { opacity: .8; background: var(--hover, rgb(0 0 0 / 4%)); }
.wb-folder-body .wb-sessions-empty { padding: 6px 10px; text-align: left; }
.wb-menu-title { padding: 6px 10px 3px; font-size: 10.5px; opacity: .45; }
.wb-menu button.is-active { color: var(--accent, #2563eb); font-weight: 600; }

.wb-menu {
  position: fixed;
  z-index: 80;
  min-width: 150px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  box-shadow: 0 14px 36px rgb(0 0 0 / 18%);
}
.wb-menu[hidden] { display: none; }
.wb-menu button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.wb-menu button:hover { background: var(--hover, rgb(0 0 0 / 5%)); }
.wb-menu button.is-danger { color: var(--danger, #dc2626); }

/* ============ 顶栏右侧 ============ */
.wb-head { gap: 12px; }
.wb-head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.wb-chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2, #faf9f6);
  border: 1px solid var(--line, #e5e7eb);
  opacity: .7;
  white-space: nowrap;
}
.wb-chip[hidden] { display: none; }
.wb-head-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line, #d1d5db);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  padding: 5px 10px 5px 8px;
  cursor: pointer;
  white-space: nowrap;
}
.wb-head-btn svg { width: 14px; height: 14px; opacity: .7; }
.wb-head-btn:hover { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); }

/* ============ 能力中心（设置） ============ */
.wb-settings {
  display: flex;
  flex-direction: row;
  padding: 0;
  gap: 0;
  overflow: hidden;
}
.wb-set-nav {
  flex: 0 0 196px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 10px;
  border-right: 1px solid var(--line, #e5e7eb);
  overflow-y: auto;
  background: var(--surface-2, #faf9f6);
}
.wb-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  text-align: left;
  padding: 9px 10px;
  cursor: pointer;
  opacity: .78;
}
.wb-nav-item:hover { background: var(--hover, rgb(0 0 0 / 5%)); opacity: 1; }
.wb-nav-item.is-active { background: var(--surface, #fff); box-shadow: 0 1px 3px rgb(0 0 0 / 8%); opacity: 1; font-weight: 600; }
.wb-nav-item svg { width: 16px; height: 16px; opacity: .65; }
.wb-nav-item.is-active svg { opacity: 1; color: var(--accent, #2563eb); }
.wb-nav-item span.count { margin-left: auto; font-size: 11px; opacity: .5; font-weight: 400; }
.wb-set-body {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  padding: 24px max(24px, calc((100% - 720px) / 2));
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wb-set-body > * { flex: 0 0 auto; }

.wb-card {
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface, #fff);
}
.wb-card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.wb-card-head:last-child { margin-bottom: 0; }
.wb-card-title { font-size: 13.5px; font-weight: 600; min-width: 0; }
.wb-card-sub { font-size: 11.5px; opacity: .55; margin-top: 2px; line-height: 1.5; }
.wb-card-actions { margin-left: auto; display: flex; gap: 6px; flex: 0 0 auto; }
.wb-list { display: flex; flex-direction: column; gap: 8px; }
.wb-empty { text-align: center; opacity: .5; font-size: 12.5px; padding: 26px 12px; line-height: 1.7; }

/* v4.49：归档页按「工作区 / 任务」两类分组。分组标题借用侧栏那个淡色小标题的质感
   （图标 + 名称 + 计数），让设置里的分类口径跟左侧栏完全一致。 */
.wb-arc-group + .wb-arc-group { margin-top: 20px; }
.wb-arc-group-head {
  display: flex; align-items: center; gap: 6px;
  padding: 0 2px 9px; font-size: 11.5px; font-weight: 500; opacity: .55;
}
.wb-arc-group-head svg { width: 13px; height: 13px; flex: 0 0 auto; }
.wb-arc-group-head b { font-weight: 600; font-variant-numeric: tabular-nums; }
.wb-arc-list { display: flex; flex-direction: column; gap: 8px; }
.wb-arc-list > .wb-empty { padding: 14px 12px; }

/* v4.51：归档的工作区可以展开，看到里面每条会话并逐条恢复/删除。
   卡片本身不再用内联 padding，改成 卡片 > 头 + 可选的子列表，展开时子列表贴底。 */
.wb-arc-folder {
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 9px;
  overflow: hidden;
}
.wb-arc-folder-head { padding: 2px 11px 2px 4px; gap: 4px; }
.wb-arc-folder-head:hover { background: var(--hover, rgb(0 0 0 / 2%)); }
.wb-arc-toggle {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 7px;
  border: 0; background: transparent; color: inherit; font: inherit; text-align: left;
  padding: 8px 7px; border-radius: 7px; cursor: pointer;
}
.wb-arc-folder-name { font-size: 13px; flex: 0 1 auto; min-width: 4em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-arc-folder-meta { font-size: 12px; opacity: .55; flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 展开出来的会话列表：左侧缩进 + 细竖线，视觉上明确「属于上面这个工作区」 */
.wb-arc-kids {
  display: flex; flex-direction: column; gap: 6px;
  margin: 0 11px 9px 27px; padding-left: 11px;
  border-left: 2px solid var(--line, #e5e7eb);
}
.wb-arc-kids > .wb-empty { padding: 10px 4px; text-align: left; }
/* 子会话用「surface-2 淡底 + 低对比描边」分出层级，避免和外层工作区卡片抢同一个视觉强度 */
.wb-arc-session {
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface-2, #faf9f6);
}
/* 深色下 --line 偏亮，子会话描边再压一档，免得一排小方框比工作区卡片还显眼 */
html[data-theme="dark"] .wb-arc-session { border-color: rgb(255 255 255 / 8%); }
.wb-arc-title { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* v4.55：归档页的删除**一直显示**，不做悬停（用户明确要求：归档页里悬停才显示没意义，
   能删就该看得见）。任务行与工作区行统一。
   注意必须用 `.wb-btn-icon.wb-arc-folder-del` 两个类——单类会被 `.wb-btn-icon` 的规则盖掉。 */
.wb-arc-session > .wb-btn-icon[data-del] { opacity: .75; }
.wb-arc-session > .wb-btn-icon[data-del]:hover { opacity: 1; }

.wb-btn-icon.wb-arc-folder-del { flex: 0 0 auto; opacity: .75; margin-left: 2px; }
.wb-btn-icon.wb-arc-folder-del:hover { opacity: 1; }
/* 卡片里的删除比其他图标按钮小一号（24px），否则在 13px 文字那一行里显得头重。
   注意 svg 必须 flex:0 0 auto 且显式 width/height：按钮是 inline-flex 容器，不固定的话
   svg 会被边框和 padding 挤扁，画出来只剩图标左上角一小块（踩过）。 */
.wb-arc-folder-head .wb-btn-icon.wb-arc-folder-del {
  width: 24px; height: 24px; padding: 0; border-radius: 6px;
}
.wb-arc-folder-head .wb-btn-icon.wb-arc-folder-del svg {
  width: 13px; height: 13px; flex: 0 0 auto; display: block;
}

/* v4.55：「恢复 / 移回」按钮带恢复图标（回转箭头），和右侧垃圾桶形成对称的「图标 + 文字」按钮组。
   .btn 本身就是 inline-flex + gap:6px，这里只要管图标尺寸。
   14px 是量出来的：13px 时箭头笔画在小尺寸下糊成一团，14px 才清楚，又不至于比文字高。 */
.btn.wb-arc-restore svg {
  width: 14px; height: 14px; flex: 0 0 auto; display: block; opacity: .8;
}

.btn.wb-btn-sm { padding: 5px 10px; font-size: 12px; line-height: 1.4; height: auto; }
.wb-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line, #d1d5db);
  border-radius: 7px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: .6;
}
.wb-btn-icon svg { width: 14px; height: 14px; }
.wb-btn-icon:hover { opacity: 1; border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); }
.wb-btn-icon.is-on { opacity: 1; border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); background: var(--accent-soft, rgb(37 99 235 / 10%)); }
.wb-btn-icon.is-danger:hover { border-color: var(--danger, #dc2626); color: var(--danger, #dc2626); }
.is-danger { color: var(--danger, #dc2626); }

.wb-tag {
  display: inline-block;
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2, #faf9f6);
  border: 1px solid var(--line, #e5e7eb);
  opacity: .8;
  margin-right: 5px;
}
.wb-tag.is-on { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); opacity: 1; }

.wb-row { display: flex; align-items: center; gap: 8px; }
.wb-row--wrap { flex-wrap: wrap; }
.wb-grow { flex: 1 1 auto; min-width: 0; }
.wb-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; opacity: .75; overflow-wrap: anywhere; }
.wb-muted { opacity: .55; font-size: 12px; }
.wb-mem-text { font-size: 13px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }

.wb-textarea {
  width: 100%;
  min-height: 240px;
  border: 1px solid var(--line, #d1d5db);
  border-radius: 10px;
  padding: 11px 12px;
  background: var(--surface, #fff);
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  outline: none;
  resize: vertical;
}
.wb-textarea:focus { border-color: var(--accent, #2563eb); }
.wb-textarea--sm { min-height: 96px; }

.wb-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.wb-stat {
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  padding: 11px 12px;
  background: var(--surface-2, #faf9f6);
}
.wb-stat b { display: block; font-size: 17px; line-height: 1.3; }
.wb-stat span { font-size: 11.5px; opacity: .6; }
.wb-kv { display: grid; grid-template-columns: 128px 1fr; gap: 6px 12px; font-size: 12px; align-items: baseline; }
.wb-kv dt { opacity: .55; }
.wb-kv dd { margin: 0; word-break: break-all; }

.wb-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; }
.wb-switch input { width: 16px; height: 16px; accent-color: var(--accent, #2563eb); }

/* 消息内附加块 */
.wb-todo {
  align-self: flex-start;
  max-width: 82%;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  background: var(--surface, #fff);
}
.wb-todo-title { font-size: 11.5px; opacity: .55; margin-bottom: 6px; }
.wb-todo-item { display: flex; gap: 7px; align-items: flex-start; padding: 2px 0; line-height: 1.55; }
.wb-todo-item .box { flex: 0 0 auto; width: 13px; height: 13px; margin-top: 3px; border-radius: 4px; border: 1.4px solid var(--line, #cbd5e1); }
.wb-todo-item.is-done .box { background: var(--accent, #2563eb); border-color: var(--accent, #2563eb); }
.wb-todo-item.is-done { opacity: .5; text-decoration: line-through; }
.wb-todo-item.is-doing .box { border-color: var(--accent, #2563eb); box-shadow: inset 0 0 0 2px var(--accent-soft, rgb(37 99 235 / 25%)); }

.wb-note {
  align-self: flex-start;
  font-size: 11.5px;
  opacity: .6;
  padding: 2px 4px;
  border-left: 2px solid var(--line, #d1d5db);
  padding-left: 8px;
}
.wb-note.is-warn { color: #b45309; opacity: .9; border-color: #f59e0b; }

.wb-msg-tools { display: flex; gap: 6px; margin-top: 6px; opacity: 0; transition: opacity .15s ease; }
.agent-msg:hover .wb-msg-tools { opacity: 1; }
.wb-msg-tool {
  border: 0;
  background: transparent;
  color: inherit;
  opacity: .55;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.wb-msg-tool:hover { opacity: 1; background: var(--hover, rgb(0 0 0 / 6%)); }

@media (max-width: 860px) {
  .wb-set-nav { flex-basis: 64px; }
  .wb-set-nav .wb-nav-item span { display: none; }
  .wb-set-nav .wb-nav-item { justify-content: center; padding: 10px 0; }
  .wb-set-body { padding: 18px 16px; }
}

/* 供应商 → 模型两级配置 */
.wb-model-head { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 8px; padding-top: 12px; border-top: 1px solid var(--line, #e5e7eb); }
.wb-model-head b { font-size: 12px; }
.wb-model-count { display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: 4px; border-radius: 10px; background: var(--hover, rgba(0 0 0 / 6%)); text-align: center; font-weight: 500; }
.wb-models { display: flex; flex-direction: column; gap: 10px; }
.wb-model { padding: 10px 12px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; background: var(--surface-2, transparent); }
/* 模型表单：固定两列，标签不换行，控件等高对齐 */
.wb-model-name-field { margin-bottom: 2px; }
.wb-model-name-wrap { display: flex; align-items: center; gap: 8px; }
.wb-model-name-wrap input { flex: 1 1 auto; min-width: 0; height: 30px; padding: 6px 9px; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; background: var(--surface, #fff); color: var(--ink, #111); font: inherit; font-size: 12px; }
.wb-model-del { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; background: transparent; color: var(--ink, #111); cursor: pointer; opacity: .6; }
.wb-model-del svg { width: 15px; height: 15px; }
.wb-model-del:hover { opacity: 1; color: var(--danger, #dc2626); border-color: var(--danger, #dc2626); }
.wb-model-fetch {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px;
  height: 30px; padding: 0 8px; border: 1px solid var(--line, #e5e7eb); border-radius: 8px;
  background: transparent; color: inherit; font: inherit; font-size: 11.5px;
  cursor: pointer; opacity: .78; white-space: nowrap;
}
.wb-model-fetch svg { width: 13px; height: 13px; flex: 0 0 auto; }
.wb-model-fetch:hover:not(:disabled) { opacity: 1; color: var(--accent, #2563eb); border-color: var(--accent, #2563eb); }
.wb-model-fetch:disabled { opacity: .5; cursor: wait; }
.wb-model-picker { margin-top: 8px; border: 1px solid var(--line, #e5e7eb); border-radius: 9px; overflow: hidden; }
.wb-model-picker[hidden] { display: none; }
/* v4.59：面板现在横跨整行，列表也放开一点高度，一屏能多看几条 */
.wb-model-picker-list { max-height: 260px; overflow-y: auto; padding: 5px; }
.wb-model-picker-head { display: flex; align-items: center; gap: 7px; padding: 6px 7px; border-bottom: 1px solid var(--line, #e5e7eb); }
.wb-model-picker-search { flex: 1 1 auto; display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border: 1px solid var(--line, #e5e7eb); border-radius: 7px; }
.wb-model-picker-search svg { width: 13px; height: 13px; opacity: .55; flex: 0 0 auto; }
.wb-model-picker-search input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; font-size: 12px; }
.wb-model-picker-close { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: inherit; opacity: .5; cursor: pointer; }
.wb-model-picker-close:hover { opacity: 1; background: var(--hover, rgb(0 0 0 / 5%)); }
.wb-model-picker-close svg { width: 14px; height: 14px; }
.wb-model-picker-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: 7px; background: transparent; color: inherit; text-align: left; cursor: pointer; font: inherit; font-size: 12px; }
.wb-model-picker-item:hover { background: var(--hover, rgb(0 0 0 / 5%)); }
.wb-model-picker-item b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-model-picker-item i { margin-left: auto; max-width: 40%; font-style: normal; font-size: 10.5px; opacity: .5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-model-picker .wb-empty { margin: 6px; font-size: 12px; }
.wb-model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; margin-top: 10px; }
.wb-model-grid .agent-field { margin-bottom: 12px; }
.wb-model-grid .agent-field label, .wb-model-name-field label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-model-grid .agent-field input, .wb-model-grid .agent-field select { width: 100%; height: 30px; padding: 6px 9px; font-size: 12px; }

/* 用量详情弹窗 */
.wb-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0, 0, 0, .42); }
.wb-modal-card { width: min(480px, 100%); background: var(--surface, #fff); color: var(--ink, #111); border: 1px solid var(--line, #e5e7eb); border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .22); overflow: hidden; }
.wb-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line, #e5e7eb); }
.wb-modal-head b { font-size: 14px; }
.wb-modal-close { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; background: transparent; color: var(--ink, #111); cursor: pointer; }
.wb-modal-close svg { width: 16px; height: 16px; }
.wb-modal-close:hover { color: var(--danger, #dc2626); border-color: var(--danger, #dc2626); }
.wb-modal-body { padding: 16px 18px; }
.wb-usage-bar { height: 8px; margin-bottom: 14px; border-radius: 6px; background: var(--hover, rgba(0 0 0 / 6%)); overflow: hidden; }
.wb-usage-bar i { display: block; height: 100%; background: var(--accent, #2563eb); }

/* ============ 设置弹窗：中间设置、周围模糊 ============ */
.agent-settings-mask {
  position: fixed; inset: 0; z-index: 12000;
  display: flex; align-items: center; justify-content: center;
  padding: 4vh 4vw;
  background: rgb(14 16 20 / 40%);
  backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px);
}
.agent-settings-mask[hidden] { display: none; }
.agent-settings {
  flex: 0 0 auto;
  width: min(1180px, 100%);
  height: min(820px, 92vh); max-height: 92vh;
  border: 1px solid var(--line, #e5e7eb); border-radius: 16px;
  background: var(--surface, #fff); color: var(--ink, #1b1d1b);
  box-shadow: 0 24px 70px rgb(0 0 0 / 30%);
  overflow: hidden;
  flex-direction: column;
}
.wb-set-main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: row; overflow: hidden; }
.agent-settings .wb-set-body { padding: 20px 26px; }
.wb-set-topbar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 11px 18px; border-bottom: 1px solid var(--line, #e5e7eb); font-size: 14px;
}
.wb-set-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px; background: transparent; color: var(--ink, #111); cursor: pointer; opacity: .7;
}
.wb-set-close svg { width: 16px; height: 16px; }
.wb-set-close:hover { opacity: 1; color: var(--danger, #dc2626); border-color: var(--danger, #dc2626); }

/* 模型卡片内的分组：通栏标题 + 整行分隔线 */
.wb-model-sub { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line, #e5e7eb); }
.wb-model-sub-title { font-size: 12px; font-weight: 700; margin-bottom: 10px; }
.wb-switch { margin: 2px 0 0; }
.wb-model-compact-preview { margin: 2px 0 0; }
.wb-provider-models { margin-top: 10px; font-size: 11.5px; opacity: .55; }
.wb-model-provider-pick { max-width: 320px; margin-bottom: 2px; }

/* 对话附件：待发缩略图 + 消息内图片 */
.agent-attach {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; margin-bottom: 1px;
  border: 1px solid var(--line, #e5e7eb); border-radius: 9px;
  background: var(--surface, #fff); color: var(--ink, #111); cursor: pointer; opacity: .72;
}
.agent-attach svg { width: 18px; height: 18px; }
.agent-attach:hover { opacity: 1; border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); }
.agent-pending { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.agent-pending[hidden] { display: none; }
.agent-pending-item { position: relative; display: inline-block; }
.agent-pending-item img {
  display: block; width: 54px; height: 54px; object-fit: cover;
  border: 1px solid var(--line, #e5e7eb); border-radius: 9px; background: var(--surface-2, #faf9f6);
}
.agent-pending-del {
  position: absolute; top: -6px; right: -6px; display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; padding: 0; border: 1px solid var(--line, #e5e7eb); border-radius: 50%;
  background: var(--surface, #fff); color: var(--ink, #111); cursor: pointer;
}
.agent-pending-del svg { width: 11px; height: 11px; }
.agent-pending-del:hover { color: var(--danger, #dc2626); border-color: var(--danger, #dc2626); }
.agent-attach-gallery { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.agent-attach-gallery img {
  display: block; max-width: 180px; max-height: 140px; object-fit: cover;
  border: 1px solid rgba(0, 0, 0, .1); border-radius: 9px; background: var(--surface-2, #faf9f6);
}
.wb-vision-row { display: flex; align-items: center; gap: 6px; }
.wb-vision-row select { flex: 1 1 auto; min-width: 0; }
.wb-vision-detect {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; border: 1px solid var(--line, #e5e7eb); border-radius: 8px;
  background: var(--surface, #fff); color: var(--ink, #111); cursor: pointer; opacity: .7;
}
.wb-vision-detect svg { width: 16px; height: 16px; }
.wb-vision-detect:hover { opacity: 1; color: var(--accent, #2563eb); border-color: var(--accent, #2563eb); }
.wb-vision-detect:disabled { opacity: .4; cursor: not-allowed; }

@media (max-width: 720px) {
  .agent-settings-mask { padding: 0; }
  .agent-settings { width: 100%; height: 100vh; max-height: 100vh; border: 0; border-radius: 0; }
  .wb-set-nav { flex-basis: 66px; }
  .wb-set-nav .wb-nav-item span { display: none; }
  .wb-set-nav .wb-nav-item { justify-content: center; padding: 10px 0; }
}

/* ===== 供应商二级侧栏 + 模型列表 + 模型详情弹窗 ===== */
.agent-settings .wb-set-body.wb-set-body--provider { padding: 0; }
.wb-provider-layout {
  align-self: stretch; flex: 1 1 auto !important; min-height: 0;
  display: flex; flex-direction: row;
}
.wb-provider-side {
  flex: 0 0 208px; display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line, #e5e7eb);
  background: var(--surface-2, #faf9f6);
}
.wb-provider-side-title {
  flex: 0 0 auto; padding: 16px 14px 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; opacity: .55;
}
.wb-provider-side-list {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px; padding: 0 8px 8px;
}
.wb-provider-item {
  position: relative;
  display: flex; flex-direction: column; gap: 3px; width: 100%;
  padding: 9px 34px 9px 10px; border: 0; border-radius: 9px; background: transparent;
  color: var(--ink, #111); font: inherit; text-align: left; cursor: pointer;
}
.wb-provider-item-edit {
  position: absolute; top: 50%; right: 7px; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: inherit; opacity: 0; cursor: pointer;
}
.wb-provider-item-edit svg { width: 14px; height: 14px; }
.wb-provider-item:hover .wb-provider-item-edit,
.wb-provider-item.is-active .wb-provider-item-edit { opacity: .6; }
.wb-provider-item-edit:hover { opacity: 1 !important; background: var(--hover, rgb(0 0 0 / 6%)); }
.wb-provider-item:hover { background: var(--hover, rgb(0 0 0 / 5%)); }
.wb-provider-item.is-active { background: var(--surface, #fff); box-shadow: 0 1px 3px rgb(0 0 0 / 8%); }
.wb-provider-item-name {
  font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wb-provider-item-meta {
  font-size: 10.5px; opacity: .55;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wb-provider-add {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; margin: 8px auto 14px; padding: 0;
  border: 1px dashed var(--line-strong, var(--line, #e5e7eb)); border-radius: 50%;
  background: var(--surface, #fff); color: var(--ink, #111); cursor: pointer;
}
.wb-provider-add svg { width: 18px; height: 18px; }
.wb-provider-add:hover { color: var(--accent, #2563eb); border-color: var(--accent, #2563eb); }
.wb-empty--side { padding: 14px 6px; font-size: 11.5px; }
.wb-provider-main { flex: 1 1 auto; min-width: 0; min-height: 0; overflow-y: auto; padding: 20px 24px; }
.wb-provider-empty { display: flex; align-items: center; justify-content: center; height: 100%; }
.wb-provider-detail { display: flex; flex-direction: column; gap: 14px; }
.wb-provider-detail .agent-provider { margin-bottom: 0; }

/* 模型只列一行，详细设置进二级弹窗 */
.wb-model-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px;
  background: var(--surface-2, transparent); cursor: pointer;
}
.wb-model-row:hover { border-color: var(--accent, #2563eb); background: var(--hover, rgb(0 0 0 / 3%)); }
.wb-model-row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.wb-model-row-main b { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-model-row-meta { font-size: 11px; opacity: .55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-model-row-del, .wb-model-row-edit {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; border: 0; border-radius: 7px;
  background: transparent; color: inherit; opacity: .5;
}
.wb-model-row-del svg, .wb-model-row-edit svg { width: 15px; height: 15px; }
.wb-model-row-del:hover { opacity: 1; color: var(--danger, #dc2626); background: var(--hover, rgb(0 0 0 / 5%)); }
.wb-model-row:hover .wb-model-row-edit { opacity: .9; }

/* 联网搜索：服务列表（设置页） */
.wb-search-list { display: flex; flex-direction: column; gap: 8px; }
.wb-search-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px;
  background: var(--surface-2, transparent); cursor: pointer;
}
.wb-search-row:hover { border-color: var(--accent, #2563eb); background: var(--hover, rgb(0 0 0 / 3%)); }
.wb-search-row.is-active {
  border-color: color-mix(in srgb, var(--accent, #2563eb) 42%, var(--line, #e5e7eb));
  background: color-mix(in srgb, var(--accent, #2563eb) 6%, transparent);
}
.wb-search-logo { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; }
.wb-search-logo .wb-provider-logo { width: 26px; height: 26px; border-radius: 7px; }
.wb-search-logo-icon, .agent-web-logo-icon {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px; background: var(--hover, rgb(0 0 0 / 6%)); color: var(--ink, #1b1d1b);
}
.wb-search-logo-icon svg, .agent-web-logo-icon svg { width: 15px; height: 15px; }
.wb-search-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.wb-search-main b { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-search-main span { font-size: 11px; opacity: .55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-search-current {
  flex: 0 0 auto; padding: 2px 7px; border: 1px solid color-mix(in srgb, var(--accent, #2563eb) 30%, var(--line, #e5e7eb));
  border-radius: 999px; color: var(--accent, #2563eb); font-size: 10.5px;
}
.wb-search-use { flex: 0 0 auto; }
.wb-search-edit {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; border: 0; border-radius: 7px;
  background: transparent; color: inherit; opacity: .45;
}
.wb-search-edit svg { width: 15px; height: 15px; }
.wb-search-edit:hover { opacity: 1; color: var(--accent, #2563eb); background: var(--hover, rgb(0 0 0 / 5%)); }
.wb-search-row:hover .wb-search-edit { opacity: .9; }
.wb-search-editor .wb-note { margin-top: 4px; }

/* v4.73：默认模型岗位列表 */
.wb-role-list { display: flex; flex-direction: column; gap: 8px; }
.wb-role-row {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 12px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px;
  background: var(--surface-2, transparent); color: inherit; font: inherit;
  text-align: left; cursor: pointer;
}
.wb-role-row:hover { border-color: var(--accent, #2563eb); background: var(--hover, rgb(0 0 0 / 3%)); }
.wb-role-icon {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--hover, rgb(0 0 0 / 6%));
}
.wb-role-icon svg { width: 15px; height: 15px; }
.wb-role-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.wb-role-main b { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.wb-role-main span { font-size: 11px; opacity: .55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-role-required {
  padding: 1px 5px; border: 1px solid var(--line, #e5e7eb); border-radius: 999px;
  font-size: 9.5px; font-style: normal; font-weight: 500; opacity: .55;
}
.wb-role-state {
  flex: 0 0 auto; max-width: 38%; font-size: 11.5px; opacity: .7;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wb-role-state.is-muted { opacity: .4; }
.wb-role-edit {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; opacity: .45;
}
.wb-role-edit svg { width: 15px; height: 15px; }
.wb-role-row:hover .wb-role-edit { opacity: .9; }

/* 供应商 / 模型共用的二级弹窗 */
.wb-sub-mask {
  position: fixed; inset: 0; z-index: 13000;
  display: flex; align-items: center; justify-content: center; padding: 4vh 4vw;
  background: rgb(14 16 20 / 45%);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.wb-sub-mask[hidden] { display: none; }
.wb-sub-dialog {
  display: flex; flex-direction: column; overflow: hidden;
  width: min(760px, 100%); max-height: 90vh;
  border: 1px solid var(--line, #e5e7eb); border-radius: 14px;
  background: var(--surface, #fff); color: var(--ink, #1b1d1b);
  box-shadow: 0 20px 60px rgb(0 0 0 / 35%);
}
.wb-sub-dialog-head {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; border-bottom: 1px solid var(--line, #e5e7eb); font-size: 13.5px;
}
.wb-sub-dialog-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 18px; }
.wb-sub-dialog-foot {
  flex: 0 0 auto; display: flex; justify-content: flex-end; gap: 8px;
  padding: 11px 16px; border-top: 1px solid var(--line, #e5e7eb);
}
.wb-sub-dialog .wb-model-del { display: none; }
.wb-sub-dialog .wb-model { border: 0; padding: 0; background: transparent; }

@media (max-width: 720px) {
  .wb-provider-side { flex-basis: 132px; }
  .wb-provider-main { padding: 14px; }
  .wb-sub-dialog-body { padding: 12px; }
}

/* ===== v4.4：权限三档 / 模型菜单 / 行内附件 / 上下文用量面板 / 供应商 logo ===== */

/* 权限弹层：三档纵向列表，对齐参考图 */
.agent-quick-pop { padding: 8px; min-width: 268px; }
.agent-quick-pop-modes { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.agent-quick-pop-mode {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: inherit; cursor: pointer;
}
.agent-quick-pop-mode:hover { background: var(--hover, rgb(0 0 0 / 5%)); }
.agent-quick-pop-mode.is-active { border-color: color-mix(in srgb, var(--accent, #2563eb) 45%, var(--line, #e5e7eb)); background: color-mix(in srgb, var(--accent, #2563eb) 6%, transparent); }
.agent-mode-icon { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 1px; opacity: .75; }
.agent-mode-icon svg { width: 20px; height: 20px; }
.agent-quick-pop-mode.is-active .agent-mode-icon { color: var(--accent, #2563eb); opacity: 1; }
.agent-mode-text { flex: 1 1 auto; min-width: 0; }
.agent-mode-text b { display: block; font-size: 12.5px; font-weight: 600; }
.agent-mode-text i { display: block; font-style: normal; font-size: 10.5px; opacity: .6; margin-top: 3px; line-height: 1.4; }
.agent-mode-check { flex: 0 0 auto; color: var(--accent, #2563eb); }
.agent-mode-check svg { width: 16px; height: 16px; }
.agent-quick-pop-mode.is-active .agent-mode-text i { color: #d14343; opacity: .85; }

/* 右侧两个选择按钮：模型带供应商 logo，上下文用圆环 */
.agent-model-pick, .agent-ctx-pick {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 7px 0 4px;
  border: 1px solid var(--line, #e5e7eb); border-radius: 8px;
  background: var(--surface, #fff); color: inherit; font: inherit; font-size: 11.5px;
  cursor: pointer; white-space: nowrap; min-width: 0;
}
.agent-model-pick:hover, .agent-ctx-pick:hover { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); }
.agent-model-logo { display: inline-flex; flex: 0 0 auto; }
.agent-model-logo .wb-provider-logo { width: 20px; height: 20px; border-radius: 5px; }
.agent-model-pick #agent-model-label { max-width: 104px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-model-caret { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 12px; height: 12px; margin-left: -1px; opacity: .5; }
.agent-model-caret svg { display: block; width: 12px; height: 12px; opacity: 1; }
.agent-ctx-pick { width: 30px; padding: 0; justify-content: center; }
.agent-ctx-ring { width: 21px; height: 21px; transform: rotate(-90deg); }
.agent-ctx-ring-track, .agent-ctx-ring-fill { fill: none; stroke-width: 4.2; }
.agent-ctx-ring-track { stroke: var(--line, #e5e7eb); }
.agent-ctx-ring-fill { stroke: var(--ink, #1b1d1b); stroke-linecap: round; transition: stroke-dasharray .25s ease; }

/* 模型选择菜单：搜索 + 分组 + logo + 当前项打勾 + 管理入口 */
.agent-model-menu {
  position: fixed; z-index: 10002;
  width: min(340px, calc(100vw - 20px)); max-height: min(440px, 70vh);
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line, #e5e7eb); border-radius: 13px;
  background: var(--surface, #fff); color: var(--ink, #1b1d1b);
  box-shadow: 0 14px 40px rgb(0 0 0 / 18%);
}
.agent-model-menu[hidden] { display: none; }
.agent-model-menu-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line, #e5e7eb); }
.agent-model-menu-search { flex: 1 1 auto; display: flex; align-items: center; gap: 7px; padding: 0 9px; height: 32px; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; }
.agent-model-menu-search svg { width: 15px; height: 15px; opacity: .55; flex: 0 0 auto; }
.agent-model-menu-search input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; font-size: 12px; }
.agent-model-menu-icon { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; background: transparent; color: inherit; cursor: pointer; opacity: .65; }
.agent-model-menu-icon:hover { opacity: 1; color: var(--accent, #2563eb); }
.agent-model-menu-icon svg { width: 16px; height: 16px; }
.agent-model-menu-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px; }
.agent-model-group { margin-bottom: 6px; }
.agent-model-group[hidden] { display: none; }
.agent-model-group-title { display: flex; align-items: center; gap: 7px; padding: 6px 8px; font-size: 11.5px; font-weight: 600; opacity: .8; }
.agent-model-group-title i { margin-left: auto; font-style: normal; font-size: 10px; opacity: .6; font-weight: 400; }
.agent-model-option {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 8px 10px 8px 33px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: inherit; font: inherit; font-size: 12px; cursor: pointer;
}
.agent-model-option:hover { background: var(--hover, rgb(0 0 0 / 5%)); }
.agent-model-option.is-active { background: color-mix(in srgb, var(--accent, #2563eb) 9%, transparent); border-color: color-mix(in srgb, var(--accent, #2563eb) 30%, transparent); color: var(--accent, #2563eb); }
.agent-model-option-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-model-option-meta { font-size: 10.5px; opacity: .55; }
.agent-model-empty { padding: 10px 12px; font-size: 11px; opacity: .5; }
.agent-model-manage {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 14px; border: 0; border-top: 1px solid var(--line, #e5e7eb);
  background: transparent; color: inherit; font: inherit; font-size: 12px; cursor: pointer;
}
.agent-model-manage:hover { background: var(--hover, rgb(0 0 0 / 4%)); color: var(--accent, #2563eb); }
.agent-model-manage svg { width: 15px; height: 15px; opacity: .7; }
.agent-model-manage-arrow { margin-left: auto; font-size: 16px; opacity: .5; }

/* 联网搜索菜单：顶部开关 + 搜索服务列表 + 设置入口 */
.agent-web-menu {
  position: fixed; z-index: 10002;
  width: min(318px, calc(100vw - 20px));
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line, #e5e7eb); border-radius: 13px;
  background: var(--surface, #fff); color: var(--ink, #1b1d1b);
  box-shadow: 0 14px 40px rgb(0 0 0 / 18%);
}
.agent-web-menu[hidden] { display: none; }
.agent-web-menu-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 13px; border-bottom: 1px solid var(--line, #e5e7eb);
}
.agent-web-menu-title { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.agent-web-menu-title b { font-size: 13px; font-weight: 600; }
.agent-web-menu-title i {
  font-style: normal; font-size: 10.5px; opacity: .55;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agent-web-menu-label {
  padding: 9px 14px 4px; font-size: 10px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; opacity: .42;
}
.agent-web-menu-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 260px; overflow-y: auto; padding: 2px 6px 7px;
}
.agent-web-option {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 9px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: inherit; text-align: left; font: inherit; cursor: pointer;
}
.agent-web-option:hover { background: var(--hover, rgb(0 0 0 / 5%)); }
.agent-web-option.is-active {
  border-color: color-mix(in srgb, var(--accent, #2563eb) 38%, var(--line, #e5e7eb));
  background: color-mix(in srgb, var(--accent, #2563eb) 7%, transparent);
}
.agent-web-option-logo { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; }
.agent-web-option-logo .wb-provider-logo { width: 22px; height: 22px; border-radius: 5px; }
.agent-web-option-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.agent-web-option-main b { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-web-option-main i { font-style: normal; font-size: 10.5px; opacity: .52; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 行内附件 chip */
.agent-attach-chip {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: middle;
  margin: 0 2px; padding: 2px 5px 2px 2px; border: 1px solid color-mix(in srgb, var(--accent, #2563eb) 35%, var(--line, #e5e7eb));
  border-radius: 7px; background: color-mix(in srgb, var(--accent, #2563eb) 7%, transparent);
  font-size: 11.5px; line-height: 1.2; max-width: 190px; user-select: none;
}
.agent-attach-chip img { width: 20px; height: 20px; object-fit: cover; border-radius: 4px; }
.agent-attach-chip-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-attach-chip-del { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: inherit; cursor: pointer; opacity: .55; }
.agent-attach-chip-del:hover { opacity: 1; color: var(--danger, #dc2626); }
.agent-attach-chip-del svg { width: 11px; height: 11px; }

/* 上下文用量菜单：锚在圆环旁的下拉菜单，无遮罩 */
.wb-usage-menu {
  position: fixed; z-index: 10001; width: min(330px, calc(100vw - 20px));
  border: 1px solid var(--line, #e5e7eb); border-radius: 12px;
  background: var(--surface, #fff); color: var(--ink, #1b1d1b);
  box-shadow: 0 16px 42px rgba(15, 23, 42, .2);
  overflow: hidden;
}
.wb-usage-menu-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 13px; border-bottom: 1px solid var(--line, #e5e7eb); font-size: 12.5px; }
.wb-usage-close { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; opacity: .55; }
.wb-usage-close:hover { opacity: 1; background: var(--hover, rgb(0 0 0 / 6%)); }
.wb-usage-close svg { width: 14px; height: 14px; }
.wb-usage-menu-body { padding: 13px 14px 10px; }
.wb-usage-sum { display: flex; align-items: baseline; gap: 9px; margin-bottom: 9px; }
.wb-usage-sum b { font-size: 24px; font-weight: 700; letter-spacing: -.5px; }
.wb-usage-sum span { font-size: 11.5px; opacity: .6; }
.wb-usage-bar { height: 7px; border-radius: 6px; background: var(--hover, rgba(0 0 0 / 7%)); overflow: hidden; margin-bottom: 12px; }
.wb-usage-bar i { display: block; height: 100%; border-radius: 6px; background: var(--ink, #1b1d1b); }
.wb-usage-split { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wb-usage-split li { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.wb-usage-split li b { margin-left: auto; font-variant-numeric: tabular-nums; opacity: .7; font-weight: 500; }
.wb-usage-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.wb-usage-slider { padding: 10px 0 2px; border-top: 1px solid var(--line, #e5e7eb); }
.wb-usage-slider-head { display: flex; justify-content: space-between; font-size: 11px; opacity: .7; margin-bottom: 6px; }
.wb-usage-slider input[type="range"] { width: 100%; accent-color: var(--accent, #2563eb); cursor: pointer; }
.wb-usage-slider output { display: block; text-align: right; font-size: 11px; opacity: .6; margin-top: 2px; font-variant-numeric: tabular-nums; }
.wb-usage-menu-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 9px 14px; border-top: 1px solid var(--line, #e5e7eb); }
.wb-usage-menu-foot .btn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.wb-usage-menu-foot .btn svg { width: 15px; height: 15px; }

/* 供应商 logo：真实品牌图形，自定义网关退回首字 */
.wb-provider-logo {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  border-radius: 7px; background: var(--logo-bg, #eef0f3); color: var(--logo-fg, #6b7280);
  font-weight: 700; line-height: 1; letter-spacing: -.3px;
}
.wb-provider-logo svg { display: block; width: 70%; height: 70%; }
.wb-provider-logo img { display: block; width: 76%; height: 76%; object-fit: contain; }
.wb-provider-logo.is-text { font-weight: 700; }
.wb-provider-item { display: flex; align-items: center; gap: 8px; }
.wb-provider-item-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.wb-provider-item-name, .wb-provider-item-meta { text-align: left; }

/* 供应商项：横向 logo + 左对齐文字（覆盖上面的竖向 column） */
.wb-provider-item { flex-direction: row; align-items: center; gap: 9px; padding: 9px 32px 9px 10px; }
.wb-provider-item .wb-provider-item-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; text-align: left; }
.wb-provider-item .wb-provider-item-name, .wb-provider-item .wb-provider-item-meta { text-align: left; }

/* ===== v4.7：模型管理卡片 / 能力开关 / 上下文挡位 / 思考强度按钮 ===== */
/* 说明：hero 的纵向布局见下方（与 .wb-model 同一段），此处只管横向尺寸 */
.wb-model-hero-main { flex: 1 1 auto; min-width: 0; }
.wb-model-hero-label { display: block; margin-bottom: 5px; font-size: 11px; font-weight: 600; opacity: .6; letter-spacing: .4px; }
.wb-model-hero .wb-model-name-wrap { gap: 6px; }
.wb-model-hero .wb-model-name { height: 34px; font-size: 13px; }
.wb-model-hero .wb-model-fetch, .wb-model-hero .wb-model-del { height: 34px; }
.wb-model-detect-all {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 10px;
  border: 1px solid var(--line, #e5e7eb); border-radius: 8px; background: transparent;
  color: inherit; font: inherit; font-size: 11.5px; cursor: pointer; opacity: .8;
  /* 与「模型名称」输入框底对齐，而不是跟整块 hero 底对齐 —— 否则选择面板一展开，
     这个按钮就被拽到底部、跑到列表右边去了 */
  align-self: end; margin-bottom: 0;
}
.wb-model-detect-all:hover { opacity: 1; color: var(--accent, #2563eb); border-color: var(--accent, #2563eb); }
.wb-model-detect-all svg { width: 14px; height: 14px; }

.wb-cap-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.wb-cap-card {
  display: flex; align-items: center; gap: 8px; min-width: 0; height: 44px; padding: 0 10px;
  border: 1px solid var(--line, #e5e7eb); border-radius: 9px; background: var(--surface, #fff);
}
.wb-cap-icon { flex: 0 0 auto; display: inline-flex; opacity: .7; }
.wb-cap-icon svg { width: 17px; height: 17px; }
.wb-cap-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.wb-cap-body b { font-size: 12px; font-weight: 600; white-space: nowrap; }
.wb-cap-auto { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 25px; height: 25px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: inherit; opacity: .5; cursor: pointer; }
.wb-cap-auto:hover { opacity: 1; background: var(--hover, rgb(0 0 0 / 6%)); color: var(--accent, #2563eb); }
.wb-cap-auto svg { width: 14px; height: 14px; }
.wb-cap-switch { position: relative; flex: 0 0 auto; width: 34px; height: 20px; margin: 0; }
.wb-cap-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.wb-cap-switch > span { position: relative; display: block; width: 34px; height: 20px; border-radius: 10px; background: var(--line, #d8dce3); transition: background .18s; }
.wb-cap-switch > span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 20%); transition: transform .18s; }
.wb-cap-switch input:checked + span { background: var(--accent, #2563eb); }
.wb-cap-switch input:checked + span::after { transform: translateX(14px); }

.wb-model-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 4px 0 12px; }
.wb-model-block { min-width: 0; }
.wb-model-panel { min-width: 0; padding: 12px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; background: color-mix(in srgb, var(--hover, rgb(0 0 0 / 4%)) 45%, transparent); }
.wb-model-sub-title { margin-bottom: 8px; font-size: 12px; font-weight: 600; }
.wb-model-panel .agent-field { margin-bottom: 10px; }
.wb-model-panel .agent-field input, .wb-model-panel .agent-field select { width: 100%; height: 30px; padding: 6px 8px; font-size: 12px; }
.wb-think-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; max-height: 172px; overflow-y: auto; }
.wb-think-row { display: grid; grid-template-columns: 26px minmax(56px, 1fr) minmax(62px, .9fr) minmax(54px, .8fr) 64px; align-items: center; gap: 5px; }
/* 停用档只暗内容，开关本身保持亮，方便看清当前状态 */
.wb-think-row.is-disabled .wb-think-name, .wb-think-row.is-disabled .wb-think-mode, .wb-think-row.is-disabled .wb-think-effort, .wb-think-row.is-disabled .wb-think-budget { opacity: .45; }
.wb-think-row input, .wb-think-row select { min-width: 0; height: 29px; padding: 4px 6px; border: 1px solid var(--line, #e5e7eb); border-radius: 7px; background: var(--surface, #fff); color: inherit; font: inherit; font-size: 11px; }
.wb-think-row .wb-think-toggle-wrap { justify-content: center; }

/* 输入框右下：思考强度按钮与菜单 */
.agent-think-pick {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 7px;
  border: 1px solid var(--line, #e5e7eb); border-radius: 8px;
  background: var(--surface, #fff); color: inherit; font: inherit; font-size: 11px;
  cursor: pointer; white-space: nowrap; max-width: 112px;
}
.agent-think-pick:hover { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); }
.agent-think-pick svg { width: 14px; height: 14px; opacity: .75; flex: 0 0 auto; }
.agent-think-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-think-menu {
  position: fixed; z-index: 10002; width: min(260px, calc(100vw - 20px));
  border: 1px solid var(--line, #e5e7eb); border-radius: 12px;
  background: var(--surface, #fff); color: var(--ink, #1b1d1b);
  box-shadow: 0 16px 42px rgb(15 23 42 / 20%); overflow: hidden;
}
.agent-think-menu[hidden] { display: none; }
.agent-think-list { max-height: 280px; padding: 6px; }
.agent-think-option {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 6px 8px;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: inherit; text-align: left; cursor: pointer; font: inherit; font-size: 12px;
}
.agent-think-option:hover { background: var(--hover, rgb(0 0 0 / 6%)); }
.agent-think-option.is-active { border-color: color-mix(in srgb, var(--accent, #2563eb) 45%, var(--line, #e5e7eb)); background: color-mix(in srgb, var(--accent, #2563eb) 7%, transparent); }
.agent-think-option span { font-weight: 600; }
.agent-think-option svg { width: 14px; height: 14px; margin-left: auto; color: var(--accent, #2563eb); }

/* 上下文菜单里的自定义挡位 */
.wb-usage-tiers { padding: 9px 0; border-top: 1px solid var(--line, #e5e7eb); }
.wb-usage-tier-list { display: flex; flex-wrap: wrap; gap: 6px; }
.wb-usage-tier {
  min-width: 48px; height: 27px; padding: 0 9px; border: 1px solid var(--line, #e5e7eb); border-radius: 7px;
  background: var(--surface, #fff); color: inherit; font: inherit; font-size: 11px; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.wb-usage-tier:hover { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); }
.wb-usage-tier.is-active { border-color: var(--accent, #2563eb); background: color-mix(in srgb, var(--accent, #2563eb) 10%, transparent); color: var(--accent, #2563eb); font-weight: 600; }

@media (max-width: 720px) {
  .wb-cap-grid, .wb-model-two { grid-template-columns: 1fr; }
  .agent-think-pick { max-width: 34px; padding: 0 8px; }
  .agent-think-pick span { display: none; }
}

/* ===== v4.19：运行流水（查看 WorkBuddy 的呈现：一条状态行 + 折叠的过程条目） =====
   运行中：整条展开，正在思考 / 正在调用的那一条自动展开，跑完立即折起。
   跑完：全部收起，只剩一行「已完成 2m33s」，下面直接是最终总结。 */
.agent-run { margin: 1px 0 6px; }
.agent-run-head {
  display: flex; align-items: center; gap: 6px; width: 100%;
  min-height: 26px; padding: 2px 2px; margin: 0 0 2px; border: 0; background: none;
  color: inherit; font: inherit; font-size: 12px; text-align: left; opacity: .62;
  cursor: default; user-select: none;
}
.agent-run:not(.is-live) .agent-run-head { cursor: pointer; }
.agent-run:not(.is-live) .agent-run-head:hover { opacity: .85; }
.agent-run-state { font-variant-numeric: tabular-nums; }
.agent-run-head svg { flex: 0 0 auto; }
.agent-run-head svg:last-child {
  width: 13px; height: 13px; margin-left: 1px; opacity: .6;
  transform: rotate(-90deg); transition: transform .15s;
}
.agent-run.is-open .agent-run-head svg:last-child { transform: rotate(0); }
/* 状态点：运行中转圈，完成变实心点，失败变红 */
.agent-run-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto;
  background: currentColor; opacity: .45;
}
.agent-run.is-live .agent-run-dot { background: #f59e0b; opacity: 1; animation: agent-pulse 1.1s infinite; }
.agent-run.is-fail .agent-run-dot { background: #dc2626; opacity: 1; }
.agent-run-body { display: none; flex-direction: column; gap: 2px; padding: 1px 0 3px 1px; }
.agent-run.is-open .agent-run-body { display: flex; }

/* 条目：极简，无边框；左缩进对齐状态点 */
.agent-seg { font-size: 12.5px; line-height: 1.6; }
/* 中间说明就是正文，和最终总结同一号字、同一个颜色；靠折叠区分，不靠变灰 */
.agent-seg.seg-text {
  padding: 3px 0 5px 14px; color: inherit; font-size: 13.5px; line-height: 1.65;
}
.agent-seg.seg-text > :first-child { margin-top: 0; }
.agent-seg.seg-text > :last-child { margin-bottom: 0; }
.agent-seg summary,
.seg-tool-head {
  display: flex; align-items: center; gap: 6px; min-height: 24px;
  padding: 1px 2px 1px 0; list-style: none; cursor: pointer; user-select: none;
  color: inherit; opacity: .68;
}
.agent-seg summary:hover, .seg-tool-head:hover { opacity: .92; }
.agent-seg.is-live > summary, .seg-tool.is-live > .seg-tool-head { opacity: .95; }
.agent-seg summary::-webkit-details-marker { display: none; }
.agent-seg summary svg { width: 13px; height: 13px; flex: 0 0 auto; opacity: .8; }
.agent-seg summary svg:last-child {
  margin-left: 2px; transform: rotate(-90deg); transition: transform .15s; opacity: .55;
}
.agent-seg[open] > summary svg:last-child { transform: rotate(0); }

/* 思考正文：缩进一块浅色文字，最多 300px 高 */
.seg-thought-body {
  margin: 0 0 5px 20px; padding: 5px 10px;
  border-left: 2px solid color-mix(in srgb, var(--line, #e5e7eb) 80%, transparent);
  max-height: 300px; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
  font-size: 12.5px; line-height: 1.7; opacity: .62;
}

/* 工具条目：一行「查看文件 · AGENTS.md」，点开看参数/结果 */
.seg-tool-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto;
  background: #16a34a; opacity: .55;
}
.seg-tool.is-live .seg-tool-dot { background: #f59e0b; opacity: 1; animation: agent-pulse 1.1s infinite; }
.seg-tool.is-fail .seg-tool-dot { background: #dc2626; opacity: 1; }
.seg-tool-label { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg-tool-flag { flex: 0 0 auto; font-size: 11px; color: #dc2626; opacity: .85; }
.seg-tool-flag:empty { display: none; }
.seg-tool-head svg { width: 12px; height: 12px; flex: 0 0 auto; opacity: .5; }
.seg-tool-body { display: none; margin: 0 0 5px 14px; }
.seg-tool.open .seg-tool-body { display: block; }
.seg-tool-body pre {
  margin: 0; padding: 7px 9px; border-radius: 7px;
  background: color-mix(in srgb, var(--hover, rgb(0 0 0 / 5%)) 70%, transparent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
  line-height: 1.55; white-space: pre-wrap; word-break: break-all;
  max-height: 240px; overflow: auto; opacity: .8;
}
.agent-stopped-tag {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 99px;
  border: 1px solid var(--line, #e5e7eb); font-size: 11px; opacity: .65;
  vertical-align: middle; white-space: nowrap;
}

/* ===== v4.9：消息操作条 / 代码块 / 失败重试 / 编辑弹窗 / 回到底部 ===== */
.agent-msg-actions {
  display: flex; align-items: center; gap: 2px; justify-content: flex-end;
  flex-wrap: wrap; margin-top: 3px; opacity: 1;
}
.agent-msg.is-live .agent-msg-actions { display: none; }
.agent-msg-time { margin-left: 4px; font-size: 10px; opacity: .45; font-variant-numeric: tabular-nums; }
.agent-msg-act {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: inherit; cursor: pointer; opacity: .5;
}
.agent-msg-act:hover { opacity: 1; background: rgb(0 0 0 / 7%); }
.agent-msg-act svg { width: 14px; height: 14px; }
/* 这条回答用的是哪个模型，跟按钮同一行、贴最右；带用量时悬停显示 token 明细 */
.agent-msg-model { margin-left: 6px; font-size: 11px; opacity: .45; white-space: nowrap; }
.agent-msg-model:empty { display: none; }

.agent-text code {
  padding: 1px 5px; border-radius: 5px; background: rgb(0 0 0 / 7%);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em;
}
.agent-msg.me .agent-text code { background: rgb(255 255 255 / 20%); }
.agent-text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.agent-h { margin: 8px 0 4px; font-weight: 700; }
.agent-text .agent-h:first-child { margin-top: 0; }
.agent-li { padding-left: 4px; }
.agent-quote { margin: 4px 0; padding-left: 9px; border-left: 3px solid var(--line, #e5e7eb); opacity: .8; }
.agent-hr { border: 0; border-top: 1px solid var(--line, #e5e7eb); margin: 10px 0; opacity: .7; }
.agent-text del { opacity: .6; }
.agent-text em { font-style: italic; }
.agent-table-wrap { margin: 8px 0; overflow-x: auto; }
.agent-table { border-collapse: collapse; font-size: 12.5px; min-width: 40%; }
.agent-table th, .agent-table td { border: 1px solid var(--line, #e5e7eb); padding: 5px 9px; text-align: left; vertical-align: top; }
.agent-table th { background: rgb(0 0 0 / 5%); font-weight: 600; white-space: nowrap; }
.agent-msg.me .agent-table th { background: rgb(255 255 255 / 16%); }
.agent-msg.me .agent-table th, .agent-msg.me .agent-table td { border-color: rgb(255 255 255 / 35%); }

/* 引用 chip：出现在输入框最前面，contenteditable=false，整体随消息发出 */
.agent-quote-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  margin: 2px 6px 2px 0; padding: 4px 6px 4px 9px;
  border: 1px solid var(--line, #e5e7eb); border-left: 3px solid var(--accent, #2563eb);
  border-radius: 8px; background: var(--surface-2, #faf9f6);
  font-size: 11.5px; vertical-align: middle;
}
.agent-quote-chip-tag { display: inline-flex; color: var(--accent, #2563eb); opacity: .75; }
.agent-quote-chip-tag svg { width: 13px; height: 13px; }
.agent-quote-chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .8; }
.agent-quote-chip-del { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: inherit; cursor: pointer; opacity: .5; }
.agent-quote-chip-del:hover { opacity: 1; background: rgb(0 0 0 / 8%); }
.agent-quote-chip-del svg { width: 11px; height: 11px; }
.agent-code { margin: 8px 0; border: 1px solid var(--line, #e5e7eb); border-radius: 9px; overflow: hidden; background: #f7f8fa; }
.agent-code-head { display: flex; align-items: center; justify-content: space-between; padding: 5px 10px; border-bottom: 1px solid var(--line, #e5e7eb); font-size: 10.5px; opacity: .75; }
.agent-code-copy { border: 0; background: transparent; color: inherit; font: inherit; font-size: 10.5px; cursor: pointer; padding: 2px 6px; border-radius: 5px; }
.agent-code-copy:hover { background: rgb(0 0 0 / 8%); }
.agent-code pre { margin: 0; padding: 10px 12px; overflow-x: auto; }
.agent-code code { padding: 0; background: transparent; font-size: 12px; line-height: 1.55; white-space: pre; }
.agent-error { margin-top: 8px; padding: 9px 11px; border: 1px solid color-mix(in srgb, var(--danger, #dc2626) 35%, transparent); border-radius: 9px; background: color-mix(in srgb, var(--danger, #dc2626) 6%, transparent); }
.agent-error b { display: block; font-size: 12px; color: var(--danger, #dc2626); }
.agent-error p { margin: 4px 0 8px; font-size: 12px; line-height: 1.5; word-break: break-word; }
.agent-error-actions { display: flex; gap: 6px; }
.agent-error-actions .btn { height: 26px; padding: 0 10px; font-size: 11.5px; }

.agent-edit-mask { position: fixed; inset: 0; z-index: 14000; display: flex; align-items: center; justify-content: center; padding: 5vh 5vw; background: rgb(14 16 20 / 45%); backdrop-filter: blur(3px); }
.agent-edit-mask[hidden] { display: none; }
.agent-edit-box { width: min(680px, 100%); display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 13px; background: var(--surface, #fff); box-shadow: 0 20px 60px rgb(0 0 0 / 35%); }
.agent-edit-title { font-size: 13px; font-weight: 600; }
.agent-edit-text { min-height: 120px; max-height: 50vh; padding: 10px 12px; border: 1px solid var(--line, #e5e7eb); border-radius: 9px; background: var(--surface-2, #faf9f6); color: inherit; font: inherit; font-size: 13px; line-height: 1.6; resize: vertical; }
.agent-edit-foot { display: flex; justify-content: flex-end; gap: 8px; }

/* 通用输入 / 确认弹窗（新建分类、重命名、删除确认），替代浏览器原生 prompt / confirm */
.agent-ask-mask {
  position: fixed; inset: 0; z-index: 14100; display: flex; align-items: center; justify-content: center;
  padding: 5vh 5vw; background: rgb(14 16 20 / 45%); backdrop-filter: blur(3px);
}
.agent-ask {
  width: min(340px, 100%); display: flex; flex-direction: column; gap: 10px;
  padding: 16px; border: 0; border-radius: 13px; background: var(--surface, #fff);
  box-shadow: 0 20px 60px rgb(0 0 0 / 35%); color: inherit;
}
.agent-ask-title { font-size: 13.5px; font-weight: 600; }
.agent-ask-msg { margin: 0; font-size: 12.5px; line-height: 1.65; color: var(--muted, #6b7280); }
.agent-ask-input {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line, #e5e7eb); border-radius: 8px;
  background: var(--surface-2, #faf9f6); color: inherit; font: inherit; font-size: 13px;
}
.agent-ask-input:focus { outline: none; border-color: var(--accent, #2563eb); box-shadow: 0 0 0 2px rgb(37 99 235 / 14%); }
.agent-ask-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }
.agent-ask-foot .btn { height: 30px; padding: 0 14px; font-size: 12.5px; }

/* 兜底：悬浮面板本身是 fixed 浮层，绝不能因为被加上 wrap 类而退回文档流（v4.44 修的 bug）。 */
.agent-body-wrap:not(.agent-panel) { position: relative; }
.agent-jump { position: absolute; right: 14px; bottom: 122px; z-index: 20; display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border: 1px solid var(--line, #e5e7eb); border-radius: 999px; background: var(--surface, #fff); color: inherit; font: inherit; font-size: 11px; cursor: pointer; box-shadow: 0 6px 18px rgb(0 0 0 / 12%); }
.agent-jump[hidden] { display: none; }
.agent-jump svg { width: 13px; height: 13px; }

/* ===== v4.9：编辑模型弹窗重排（分区整宽、字段对齐） ===== */
.wb-sub-dialog.is-wide { width: min(880px, 100%); }
.wb-model { display: flex; flex-direction: column; gap: 16px; }
/* v4.59：hero 改网格两行。第一行 = 输入区 + 「自动识别」，第二行 = 模型选择面板横跨整行。
   以前是 flex + align-items:flex-end，选择面板挂在 hero-main 里，一展开就把主列撑高、
   按钮被顶到底部，而且面板只到主列右缘，右侧正好空出按钮那一块，看着像按钮压在列表上。 */
.wb-model-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "main detect"
    "picker picker";
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
}
.wb-model-hero-main { grid-area: main; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wb-model-detect-all { grid-area: detect; }
.wb-model-picker { grid-area: picker; }
.wb-model-hero .wb-model-name-wrap { display: flex; align-items: center; gap: 6px; }
.wb-model-hero .wb-model-name { flex: 1 1 auto; min-width: 0; height: 34px; font-size: 13px; }
.wb-model .agent-field label { display: block; margin-bottom: 5px; font-size: 11.5px; opacity: .68; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-model .agent-field input, .wb-model .agent-field select { width: 100%; height: 32px; padding: 6px 9px; font-size: 12px; }
.wb-model-two { grid-template-columns: 1fr; gap: 12px; }
.wb-model-panel { padding: 14px; border-radius: 12px; }
.wb-model-panel .agent-field { margin-bottom: 12px; }
.wb-model-panel .agent-field:last-of-type { margin-bottom: 6px; }
.wb-model-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.wb-cap-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.wb-cap-card { height: 46px; }
.wb-think-head { display: grid; grid-template-columns: 28px minmax(64px, 1fr) 104px 104px 96px; gap: 8px; padding: 0 2px 6px; font-size: 10.5px; color: color-mix(in srgb, currentColor 55%, transparent); }

/* 灰圈问号提示的样式与事件绑定已上移到共用的 admin.css / theme.js，供后台所有页面（含登录页）使用。 */
.agent-msg-model.has-usage { cursor: help; }
.wb-think-row { grid-template-columns: 28px minmax(64px, 1fr) 104px 104px 96px; gap: 8px; }
.wb-think-row input, .wb-think-row select { height: 32px; font-size: 12px; padding: 4px 8px; }
.wb-think-list { max-height: 260px; overflow-y: auto; padding-right: 2px; }
.wb-model-sub { margin-top: 2px; padding-top: 14px; }
.wb-model-sub-title { margin-bottom: 12px; }
@media (max-width: 860px) {
  .wb-cap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wb-model-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wb-think-head, .wb-think-row { grid-template-columns: 28px minmax(56px, 1fr) 92px 92px 80px; }
}

@media (hover: none) {
  .agent-msg-actions { opacity: 1; }
}

.agent-msg.ai.has-error { width: 100%; }
.agent-error-actions .btn { flex: 0 0 auto; white-space: nowrap; }

.agent-error-actions .btn { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border: 1px solid var(--line, #e5e7eb); border-radius: 7px; background: var(--surface, #fff); color: inherit; font: inherit; font-size: 12px; cursor: pointer; }
.agent-error-actions .btn.is-primary { background: var(--accent, #2563eb); border-color: transparent; color: #fff; }

/* ===== 任务会话队列（v4.34）：输入框上方的等待队列卡片 ===== */
.agent-queue {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 8px; padding: 8px 10px;
  border: 1px solid var(--line, #e5e7eb); border-radius: 12px;
  background: var(--surface, #fff);
  max-height: 190px; overflow-y: auto;
}
.agent-queue-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--muted, #6b7280);
}
.agent-queue-head > span:first-child { display: inline-flex; align-items: center; gap: 5px; }
.agent-queue-head svg { width: 13px; height: 13px; }
.agent-queue-count { font-size: 11px; opacity: .8; }
.agent-queue-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border: 1px solid var(--line, #e5e7eb); border-radius: 9px;
  background: var(--surface-2, #f9fafb); cursor: grab; font-size: 12.5px;
}
.agent-queue-item:active { cursor: grabbing; }
.agent-queue-item.is-dragging { opacity: .45; }
.agent-queue-item.is-drop-target { border-color: var(--accent, #2563eb); box-shadow: inset 0 0 0 1px var(--accent, #2563eb); }
.agent-q-grip { flex: 0 0 auto; color: var(--muted, #9ca3af); line-height: 0; }
.agent-q-grip svg { width: 15px; height: 15px; fill: currentColor; stroke: none; }
.agent-q-index {
  flex: 0 0 auto; min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; background: var(--accent-soft, #eff6ff); color: var(--accent, #2563eb);
  font-size: 11px; font-weight: 600;
}
.agent-q-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-q-ops { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 2px; }
.agent-q-op {
  border: 0; background: transparent; color: var(--muted, #6b7280);
  width: 26px; height: 26px; padding: 5px; border-radius: 6px; cursor: pointer; line-height: 0;
}
.agent-q-op:hover { background: var(--hover, #f1f5f9); color: var(--ink, #111827); }
.agent-q-op.is-danger:hover { color: var(--danger, #dc2626); }
.agent-q-op svg { width: 15px; height: 15px; }

/* ===== 模型 ID / 自定义显示名 两列（v4.37） ===== */
.wb-model-ids { display: grid; grid-template-columns: 1.35fr 1fr; gap: 10px; width: 100%; }
.wb-model-ids .wb-model-name-field { min-width: 0; margin-bottom: 0; }
.wb-model-ids .wb-model-name-field > label { display: block; margin-bottom: 5px; font-size: 11px; font-weight: 600; opacity: .72; }
.wb-model-ids .wb-model-name-wrap { gap: 6px; }
.wb-model-ids .wb-model-label { height: 34px; font-size: 13px; }
/* 窄弹窗退化为单列 */
@media (max-width: 620px) { .wb-model-ids { grid-template-columns: 1fr; } }
/* 模型列表里自定义名的辅助 ID 小字 */
.wb-model-row-id { font-style: normal; font-weight: 400; font-size: 10.5px; opacity: .55; margin-left: 4px; }

/* ===== 新建对话：工作区选择面板（v4.38） ===== */
.wb-ws-picker {
  position: fixed; z-index: 90;
  width: 264px; max-height: 440px;
  display: flex; flex-direction: column;
  padding: 6px;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgb(0 0 0 / 18%);
}
.wb-ws-search { position: relative; display: flex; align-items: center; margin: 2px 2px 6px; }
.wb-ws-search svg { position: absolute; left: 9px; width: 14px; height: 14px; opacity: .4; pointer-events: none; }
.wb-ws-search input {
  width: 100%; height: 32px; padding: 0 10px 0 30px;
  border: 1px solid var(--line, #e5e7eb); border-radius: 8px;
  background: var(--surface-2, #f9fafb); color: inherit; font: inherit; font-size: 12.5px;
}
.wb-ws-search input:focus { outline: none; border-color: var(--accent, #2563eb); background: var(--surface, #fff); }
.wb-ws-list { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; max-height: 270px; padding: 1px; }
/* v4.54：工作区条目从 <button> 改成 <div role=button>——条目里要再放一个「删除」按钮，
   按钮嵌按钮是非法 HTML，浏览器会把它拆开导致打叉点不到。 */
.wb-ws-list button, .wb-ws-list .wb-ws-item, .wb-ws-foot button {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: inherit; font: inherit; font-size: 13px;
  text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden;
}
.wb-ws-list button:hover, .wb-ws-list .wb-ws-item:hover, .wb-ws-foot button:hover { background: var(--hover, rgb(0 0 0 / 5%)); }
.wb-ws-list button span, .wb-ws-list .wb-ws-item span, .wb-ws-foot button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-ws-list button svg, .wb-ws-list .wb-ws-item svg, .wb-ws-foot button svg { flex: 0 0 auto; width: 16px; height: 16px; opacity: .6; }
/* 条目名字占满剩余宽度，把打叉推到右边 */
.wb-ws-name { flex: 1 1 auto; min-width: 0; }
/* 打叉：平时不占位（opacity 0），悬停或键盘聚焦才露面。
   注意必须写成 `.wb-ws-list button.wb-ws-del`：上面的 `.wb-ws-list button` 带了 width:100%
   且优先级更高（0,1,1 vs 0,1,0），只写 `.wb-ws-del` 会被它撑成整行宽、把工作区名字挤成 0 宽（踩过）。 */
.wb-ws-list button.wb-ws-del {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; min-width: 22px; padding: 0; margin-left: 2px;
  border: 0; border-radius: 6px; background: transparent; color: inherit;
  cursor: pointer; opacity: 0; transition: opacity .12s;
}
.wb-ws-del svg { width: 13px !important; height: 13px !important; opacity: .75; }
.wb-ws-item:hover .wb-ws-del, .wb-ws-item:focus-within .wb-ws-del { opacity: 1; }
.wb-ws-del:hover { background: var(--danger-soft, rgb(176 68 54 / 10%)); color: var(--danger, #b04436); }
.wb-ws-del:hover svg { opacity: 1; }
.wb-ws-empty { margin: 0; padding: 14px 10px; text-align: center; font-size: 12px; opacity: .5; }
.wb-ws-foot { display: flex; flex-direction: column; gap: 1px; margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--line, #e5e7eb); }
.wb-ws-foot [data-ws-new], .wb-ws-foot [data-ws-new] svg { color: var(--accent, #2563eb); opacity: 1; }
/* 当前归属项：边框框住 + 变色，不再用右侧对勾 */
.wb-ws-list button.is-active, .wb-ws-list .wb-ws-item.is-active, .wb-ws-foot button.is-active { color: var(--accent, #2563eb); font-weight: 600; border-color: color-mix(in srgb, var(--accent, #2563eb) 30%, transparent); }
.wb-ws-list button.is-active svg, .wb-ws-list .wb-ws-item.is-active svg, .wb-ws-foot button.is-active svg { opacity: 1; }

/* 新建工作区：名称 + 位置同框 */
.agent-ws-form { width: min(400px, 100%); }
.agent-ws-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.agent-ws-field > span { opacity: .75; }
.agent-ws-field .agent-ask-input { height: 36px; }
.agent-ws-hint { margin: 0; font-size: 11px; line-height: 1.6; color: var(--muted, #6b7280); }
.agent-ws-hint b { color: var(--accent, #2563eb); font-weight: 500; word-break: break-all; }

/* 位置：输入框 + 图形化选目录 */
.agent-ws-dir { display: flex; align-items: center; gap: 6px; }
.agent-ws-dir .agent-ask-input { flex: 1 1 auto; min-width: 0; }
.agent-ws-browse {
  flex: 0 0 auto; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line, #e5e7eb); border-radius: 8px; background: var(--surface-2, #faf9f6);
  color: inherit; cursor: pointer; padding: 0;
}
.agent-ws-browse:hover { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); }
.agent-ws-browse svg { width: 17px; height: 17px; }

/* 目录选择器：叠在新建工作区弹窗之上 */
.agent-dir-mask { z-index: 14150; }
.agent-dir-form { gap: 9px; }
/* v4.56：面包屑与「新建文件夹」同一行；窄的时候工具栏按钮自动换行 */
.agent-dir-bar { display: flex; align-items: center; gap: 8px; }
.agent-dir-crumbs {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; flex-wrap: wrap; gap: 1px;
  font-size: 11.5px; line-height: 1.6; padding: 6px 8px; border-radius: 8px;
  background: var(--surface-2, #faf9f6); border: 1px solid var(--line, #e5e7eb);
}
.agent-dir-crumbs button {
  border: 0; background: none; color: var(--accent, #2563eb); font: inherit; font-size: 11.5px;
  padding: 1px 2px; border-radius: 4px; cursor: pointer; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.agent-dir-crumbs button:hover { background: var(--hover, rgb(0 0 0 / 5%)); }
.agent-dir-crumbs i { font-style: normal; opacity: .4; }
/* 新建文件夹：跟侧栏「+」同一套语义，用强调色描边强调它是主动作 */
.agent-dir-new {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 10px; border: 1px solid var(--line-strong, #d3d1ca); border-radius: 8px;
  background: var(--surface, #fff); color: var(--accent, #2563eb);
  font: inherit; font-size: 11.5px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.agent-dir-new:hover { background: var(--accent-soft, rgb(37 99 235 / 8%)); border-color: var(--accent, #2563eb); }
.agent-dir-new svg { width: 13px; height: 13px; flex: 0 0 auto; }
.agent-dir-list {
  min-height: 128px; max-height: 240px; overflow: auto; display: flex; flex-direction: column; gap: 1px;
  border: 1px solid var(--line, #e5e7eb); border-radius: 9px; padding: 5px;
  background: var(--surface, #fff);
}
/* 行是 div[role=button]（里面要嵌「⋯」按钮），所以这里不能用 button 选择器 */
.agent-dir-row {
  display: flex; align-items: center; gap: 7px; width: 100%;
  border: 0; border-radius: 7px; background: none; color: inherit; font: inherit; font-size: 12.5px;
  padding: 7px 8px; cursor: pointer; text-align: left;
}
.agent-dir-row:hover { background: var(--hover, rgb(0 0 0 / 5%)); }
.agent-dir-row svg { width: 15px; height: 15px; flex: 0 0 auto; opacity: .65; }
.agent-dir-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-dir-row i { font-style: normal; margin-left: auto; opacity: .3; }
.agent-dir-row.is-up { color: var(--muted, #6b7280); }
.agent-dir-name { flex: 1 1 auto; min-width: 0; }
/* 「⋯」：平时不显示（悬停/聚焦整行才出来），点开是重命名 / 删除。
   必须写成 `.agent-dir-row button.agent-dir-more`，单类会被 `.agent-dir-row svg` 之类规则干扰。 */
.agent-dir-row button.agent-dir-more {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0; margin-left: 2px;
  border: 0; border-radius: 6px; background: transparent; color: inherit;
  cursor: pointer; opacity: 0; transition: opacity .12s;
}
.agent-dir-row button.agent-dir-more svg { width: 13px; height: 13px; opacity: .75; }
.agent-dir-row:hover button.agent-dir-more,
.agent-dir-row:focus-within button.agent-dir-more { opacity: 1; }
.agent-dir-row button.agent-dir-more:hover { background: var(--hover, rgb(0 0 0 / 8%)); }
/* 目录行的右键式小菜单（固定定位挂 body，避免被列表的 overflow 裁掉） */
.agent-dir-menu {
  position: fixed; z-index: 14200; min-width: 132px; padding: 4px;
  display: flex; flex-direction: column; gap: 1px;
  border: 1px solid var(--line, #e5e7eb); border-radius: 9px;
  background: var(--surface, #fff); box-shadow: 0 10px 28px rgb(0 0 0 / 16%);
}
.agent-dir-menu button {
  display: flex; align-items: center; gap: 7px; width: 100%;
  border: 0; border-radius: 6px; background: none; color: inherit;
  font: inherit; font-size: 12.5px; text-align: left; padding: 7px 8px; cursor: pointer;
}
.agent-dir-menu button svg { width: 13px; height: 13px; flex: 0 0 auto; opacity: .65; }
.agent-dir-menu button:hover { background: var(--hover, rgb(0 0 0 / 6%)); }
.agent-dir-menu button.is-danger { color: var(--danger, #b04436); }
.agent-dir-menu button.is-danger svg { opacity: .85; }
.agent-dir-menu button.is-danger:hover { background: var(--danger-soft, rgb(176 68 54 / 10%)); }
/* v4.56：新建 / 重命名文件夹的小输入框要盖在「选择位置」弹窗之上。
   .agent-dir-mask 是 14150，普通 .agent-ask-mask 只有 14100，不提高会被目录列表压住、点不到保存。 */
.agent-dir-prompt-mask { z-index: 14250; }
.agent-dir-prompt { width: min(360px, 100%); }
.agent-dir-empty { margin: 0; padding: 16px 8px; text-align: center; font-size: 12px; opacity: .5; }
.agent-dir-sub {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: inherit;
  padding: 2px 1px; cursor: pointer; line-height: 1.5;
}
.agent-dir-sub[hidden] { display: none; }
.agent-dir-sub input { margin: 0; accent-color: var(--accent, #2563eb); }
.agent-dir-sub b { font-weight: 600; }

/* v4.80：图片点击预览。铺满视口的遮罩 + 居中大图，点图片本身不关、点遮罩/Esc 关闭。 */
.agent-img-mask {
  position: fixed; inset: 0; z-index: 20000;
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  background: rgb(12 14 13 / 72%);
  /* 默认就是可见的：淡入只是锦上添花，绝不能依赖脚本加 class，
     否则一旦调用方忘了加 / 加了被清掉，整层就变成完全透明（点了像没反应）。 */
  opacity: 1;
  animation: agent-img-in .16s ease;
}
@keyframes agent-img-in { from { opacity: 0; } to { opacity: 1; } }
.agent-img-figure {
  position: relative;
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.agent-img-full {
  display: block;
  max-width: min(92vw, 1400px);
  max-height: 88vh;
  border-radius: 10px;
  background: var(--surface, #fff);
  box-shadow: 0 24px 60px rgb(0 0 0 / 45%);
  cursor: default;
}
.agent-img-close {
  position: absolute; top: -14px; right: -14px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border: 1px solid rgb(255 255 255 / 28%); border-radius: 50%;
  background: rgb(20 22 21 / 78%); color: #fff; cursor: pointer;
  transition: background .15s, transform .15s;
}
.agent-img-close svg { width: 15px; height: 15px; }
.agent-img-close:hover { background: rgb(20 22 21 / 92%); transform: scale(1.05); }
/* 可点击的缩略图给个明确的可点反馈 */
.agent-attach-gallery img[data-preview-src],
.agent-attach-chip img[data-preview-src] { cursor: zoom-in; }
.agent-attach-gallery img[data-preview-src]:hover { opacity: .9; }

/* v4.80：设置 → 用户，当前账户卡片头 */
.wb-acc-head { display: flex; align-items: center; gap: 11px; margin: 2px 0 14px; }
.wb-acc-avatar {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 50%; overflow: hidden;
  background: color-mix(in srgb, var(--accent, #2563eb) 14%, transparent);
  color: var(--accent, #2563eb); font-size: 18px; font-weight: 600; text-transform: uppercase;
}
.wb-acc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.wb-acc-id { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wb-acc-id b { font-size: 14px; }
.wb-acc-id span { font-size: 11.5px; opacity: .55; }
