/* Agent 工作台 — 类主流助手：全屏壳 + 左侧会话列表 + 主聊天区 */

.agent-wb-toggle {
    position: fixed;
    left: 16px;
    bottom: 88px;
    z-index: 9990;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(99, 102, 241, 0.45);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.96), rgba(124, 58, 237, 0.92));
    color: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.4);
}
.agent-wb-toggle:hover {
    filter: brightness(1.07);
}

/* 全屏壳 */
.agent-wb-shell {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    flex-direction: row;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(6px);
}
.agent-wb-shell.hidden {
    display: none;
}

/* 独立整页（非弹层）：铺满视口，覆盖 index.css 的 body 居中 flex */
html.agent-workbench-doc {
    height: 100%;
}
html.agent-workbench-doc body.agent-workbench-page {
    margin: 0;
    display: block;
    width: 100%;
    max-width: none;
    min-height: 100%;
    height: auto;
    overflow: hidden;
    background: var(--card-bg, #0f172a);
    background-attachment: scroll;
}
html.agent-workbench-doc body.agent-workbench-page::before {
    display: none;
}
.agent-wb-shell.agent-wb-shell--page {
    position: static;
    z-index: auto;
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    background: var(--card-bg, #0f172a);
    backdrop-filter: none;
}
.agent-wb-shell.agent-wb-shell--page .agent-wb-inner {
    max-width: none;
    width: 100%;
    margin: 0;
    box-shadow: none;
}
/* 全屏主栏：消息行占满聊天区宽度（不再按 720px 收窄） */
.agent-wb-shell.agent-wb-shell--page .agent-wb-row {
    max-width: 100%;
}
.agent-wb-shell.agent-wb-shell--page .agent-wb-msg {
    max-width: 100%;
}

.agent-wb-inner {
    flex: 1;
    display: flex;
    flex-direction: row;
    margin: 0 auto;
    width: 100%;
    max-width: 1280px;
    height: 100%;
    background: var(--card-bg, #0f172a);
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.5);
}

/* 左侧边栏 */
.agent-wb-sidebar {
    width: 270px;
    min-width: 220px;
    max-width: 86vw;
    border-right: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.2);
}
.agent-wb-sidebar-head {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.agent-wb-sidebar-head-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.agent-wb-sidebar-head-top .agent-wb-brand {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}
.agent-wb-sidebar-close {
    display: none;
}
.agent-wb-sidebar-scrim {
    display: none;
}
.agent-wb-brand {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary, #f1f5f9);
    margin-bottom: 10px;
}
.agent-wb-new-chat {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px dashed rgba(99, 102, 241, 0.5);
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.agent-wb-new-chat:hover {
    background: rgba(99, 102, 241, 0.2);
}
.agent-wb-hint {
    font-size: 11px;
    color: var(--text-secondary, #94a3b8);
    margin-top: 8px;
    line-height: 1.4;
}

/* 多步计划（LCC s03） */
.agent-wb-plan {
    flex-shrink: 0;
    margin: 0 6px 10px;
    padding: 10px 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.45);
    max-height: min(38vh, 280px);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.agent-wb-plan-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.agent-wb-plan-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary, #e2e8f0);
    letter-spacing: 0.02em;
}
.agent-wb-plan-clear {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 8px;
    border: none;
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary, #94a3b8);
    cursor: pointer;
}
.agent-wb-plan-clear:hover {
    background: rgba(148, 163, 184, 0.28);
    color: #e2e8f0;
}
.agent-wb-plan-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    max-height: 200px;
    font-size: 12px;
}
.agent-wb-plan-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 4px;
    border-radius: 8px;
    line-height: 1.35;
}
.agent-wb-plan-item:hover {
    background: rgba(99, 102, 241, 0.08);
}
.agent-wb-plan-cb {
    margin-top: 2px;
    flex-shrink: 0;
}
.agent-wb-plan-text {
    flex: 1;
    min-width: 0;
    color: var(--text-primary, #e2e8f0);
}
.agent-wb-plan-text--active {
    color: #a5b4fc;
    font-weight: 600;
}
.agent-wb-plan-empty {
    margin: 0;
    font-size: 11px;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.45;
}
.agent-wb-plan-empty.hidden {
    display: none;
}

.agent-wb-session-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 6px;
}
.agent-wb-session-item {
    padding: 8px 8px;
    margin-bottom: 4px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary, #e2e8f0);
    border: 1px solid transparent;
}
.agent-wb-session-item:hover {
    background: rgba(99, 102, 241, 0.12);
}
.agent-wb-session-item.active {
    background: rgba(99, 102, 241, 0.22);
    border-color: rgba(99, 102, 241, 0.35);
}
.agent-wb-session-item-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
.agent-wb-session-body {
    flex: 1;
    min-width: 0;
}
.agent-wb-session-del {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    margin: -2px -2px 0 0;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.agent-wb-session-del:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #fecaca;
}
.agent-wb-session-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.agent-wb-session-meta {
    font-size: 11px;
    opacity: 0.65;
    margin-top: 4px;
}

/* 主列 */
.agent-wb-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.agent-wb-topbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    background: var(--card-bg, rgba(15, 23, 42, 0.98));
}
.agent-wb-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.agent-wb-sb-toggle {
    display: none;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 16px;
}
.agent-wb-chat-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #f1f5f9);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.agent-wb-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}
.agent-wb-btn {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(51, 65, 85, 0.4);
    color: var(--text-primary, #e2e8f0);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}
.agent-wb-btn.primary {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}
.agent-wb-btn:hover {
    filter: brightness(1.08);
}
.agent-wb-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 18px;
    gap: 12px;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.12);
}
.agent-wb-row {
    display: flex;
    flex-direction: column;
    max-width: min(720px, 92%);
    gap: 4px;
}
.agent-wb-row.user {
    align-self: flex-end;
    align-items: flex-end;
}
.agent-wb-row.assistant {
    align-self: flex-start;
    align-items: flex-start;
}
.agent-wb-label {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.55;
}
.agent-wb-msg {
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}
/* Markdown 富文本（助手 / 用户） */
.agent-wb-msg.agent-wb-md {
    white-space: normal;
}
.agent-wb-md > :first-child {
    margin-top: 0;
}
.agent-wb-md > :last-child {
    margin-bottom: 0;
}
.agent-wb-md h1,
.agent-wb-md h2,
.agent-wb-md h3,
.agent-wb-md h4 {
    margin: 0.85em 0 0.4em;
    font-weight: 700;
    line-height: 1.35;
}
.agent-wb-md h1 {
    font-size: 1.35rem;
}
.agent-wb-md h2 {
    font-size: 1.2rem;
}
.agent-wb-md h3 {
    font-size: 1.08rem;
}
.agent-wb-md h4 {
    font-size: 1rem;
}
.agent-wb-md p {
    margin: 0.5em 0;
}
.agent-wb-md ul,
.agent-wb-md ol {
    margin: 0.45em 0;
    padding-left: 1.35em;
}
.agent-wb-md li {
    margin: 0.2em 0;
}
.agent-wb-md blockquote {
    margin: 0.6em 0;
    padding: 0.35em 0 0.35em 0.85em;
    border-left: 3px solid rgba(129, 140, 248, 0.55);
    background: rgba(15, 23, 42, 0.35);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary, #cbd5e1);
}
.agent-wb-md hr {
    border: none;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    margin: 1em 0;
}
.agent-wb-md a {
    color: #a5b4fc;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.agent-wb-row.user .agent-wb-md a {
    color: #e0e7ff;
}
.agent-wb-md img.agent-wb-md-img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 0.5em 0;
    display: block;
}
.agent-wb-md table {
    border-collapse: collapse;
    margin: 0.65em 0;
    font-size: 13px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    display: block;
}
.agent-wb-md table tbody,
.agent-wb-md table thead {
    display: table;
    width: 100%;
}
.agent-wb-md th,
.agent-wb-md td {
    border: 1px solid rgba(148, 163, 184, 0.28);
    padding: 6px 10px;
    text-align: left;
}
.agent-wb-md th {
    background: rgba(51, 65, 85, 0.65);
    font-weight: 600;
}
.agent-wb-md pre {
    margin: 0.65em 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.2);
    overflow-x: auto;
    font-size: 12.5px;
    line-height: 1.45;
}
.agent-wb-md code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-size: 0.92em;
}
.agent-wb-md :not(pre) > code {
    padding: 0.12em 0.4em;
    border-radius: 6px;
    background: rgba(51, 65, 85, 0.75);
}
.agent-wb-md .katex-display {
    margin: 0.75em 0;
    overflow-x: auto;
    overflow-y: hidden;
}
.agent-wb-md .katex {
    font-size: 1em;
}

/* 流式会话：模型分段 + 工具执行区（工具内 chunk 写入 .agent-wb-tool-log） */
.agent-wb-md .agent-wb-stream-md {
    margin: 0.4em 0;
}
.agent-wb-md .agent-wb-stream-md:first-child {
    margin-top: 0;
}
.agent-wb-tool-exec {
    margin: 0.65em 0;
}
.agent-wb-tool-line {
    font-size: 0.85rem;
    opacity: 0.88;
    margin-bottom: 0.35rem;
}
.agent-wb-tool-log {
    min-height: 4.5rem;
    max-height: 260px;
    overflow: auto;
    font-size: 0.8rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(148, 163, 184, 0.15);
    color: var(--text-secondary, #cbd5e1);
}

/* 流式异常结束 / 服务端 error 行：与模型正文区分的系统提示 */
.agent-wb-md .agent-wb-stream-system-note {
    margin-top: 0.65rem;
    padding: 0.45rem 0.55rem;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-secondary, #cbd5e1);
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 8px;
}

.agent-wb-bookmark-http-dl-wrap {
    margin-top: 0.55rem;
    padding: 0.5rem 0.55rem;
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.28);
}
.agent-wb-bookmark-http-dl-hint {
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-secondary, #cbd5e1);
    margin-bottom: 0.45rem;
}
.agent-wb-bookmark-http-dl-a {
    display: inline-block;
    margin-right: 0.65rem;
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #86efac;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.agent-wb-bookmark-http-dl-a:hover {
    color: #bbf7d0;
}

/* 流式 done 后追加：不依赖工具 preview，确保可见的保存按钮 + 绝对 HTTP 链 */
/* 财经模式：输入区上方常驻风险提示 */
.agent-wb-finance-disclaimer {
    margin: 0 0 8px;
    padding: 8px 11px;
    font-size: 12px;
    line-height: 1.5;
    color: rgba(251, 191, 36, 0.95);
    background: rgba(120, 53, 15, 0.28);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 10px;
}
.agent-wb-finance-disclaimer strong {
    color: rgba(254, 243, 199, 0.98);
}
/* 与流程图等一致：仅靠 class="hidden" 无全局 display:none，须与组件类组合 */
.agent-wb-finance-disclaimer.hidden {
    display: none;
}

/* 助手消息内 Markdown 表格 → Excel */
.agent-wb-table-export-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin: 0.75em 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(30, 41, 59, 0.72);
    border: 1px solid rgba(129, 140, 248, 0.28);
}
.agent-wb-table-export-btn {
    flex-shrink: 0;
}
.agent-wb-table-export-hint {
    font-size: 12px;
    color: rgba(203, 213, 225, 0.92);
    line-height: 1.45;
    flex: 1 1 160px;
}

.agent-wb-bookmark-done-strip {
    margin-top: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.22), rgba(124, 58, 237, 0.18));
    border: 1px solid rgba(165, 180, 252, 0.45);
}
.agent-wb-bookmark-done-strip-h {
    font-weight: 700;
    font-size: 0.88rem;
    color: #e0e7ff;
    margin-bottom: 0.5rem;
}
.agent-wb-bookmark-done-row {
    margin-bottom: 0.4rem;
}
.agent-wb-bookmark-done-btn {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: #f8fafc;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.95), rgba(139, 92, 246, 0.92));
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.agent-wb-bookmark-done-btn:hover {
    filter: brightness(1.08);
}
.agent-wb-bookmark-done-http {
    margin-top: 0.5rem;
    padding-top: 0.45rem;
    border-top: 1px solid rgba(165, 180, 252, 0.25);
}
.agent-wb-bookmark-done-http-a {
    display: inline-block;
    font-size: 0.86rem;
    font-weight: 600;
    color: #93c5fd;
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
}
.agent-wb-bookmark-done-http-a:hover {
    color: #bfdbfe;
}
.agent-wb-bookmark-done-http-hint {
    margin-top: 0.35rem;
    font-size: 0.76rem;
    line-height: 1.45;
    color: var(--text-secondary, #cbd5e1);
    opacity: 0.92;
}

.agent-wb-bookmark-redownload-wrap {
    margin-top: 0.55rem;
    padding-top: 0.45rem;
    border-top: 1px solid rgba(99, 102, 241, 0.2);
}
.agent-wb-bookmark-redownload-btn {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #f8fafc;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.95), rgba(124, 58, 237, 0.9));
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.agent-wb-bookmark-redownload-btn:hover {
    filter: brightness(1.06);
}
.agent-wb-bookmark-redownload-hint {
    margin-top: 0.35rem;
    font-size: 0.78rem;
    line-height: 1.4;
    opacity: 0.88;
}

/* 联网搜索：工具块内结构化结果列表 */
.agent-wb-search-results {
    margin-top: 0.4rem;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(99, 102, 241, 0.2);
    font-size: 0.82rem;
    line-height: 1.45;
}
.agent-wb-search-results-h {
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
    margin-bottom: 0.45rem;
    font-size: 0.8rem;
    opacity: 0.95;
}
.agent-wb-search-results-list {
    margin: 0;
    padding: 0 0 0 1.1rem;
    list-style: disc;
    color: var(--text-secondary, #cbd5e1);
}
.agent-wb-search-results-list li {
    margin: 0.35rem 0;
}
.agent-wb-search-results-list a {
    color: #a5b4fc;
    text-decoration: none;
    font-weight: 500;
}
.agent-wb-search-results-list a:hover {
    text-decoration: underline;
}
.agent-wb-search-snippet {
    display: block;
    font-size: 0.78rem;
    opacity: 0.85;
    margin-top: 0.2rem;
    white-space: normal;
    word-break: break-word;
}
.agent-wb-search-results-err,
.agent-wb-search-results-empty {
    font-size: 0.8rem;
    color: #fca5a5;
    opacity: 0.95;
}
.agent-wb-search-nohref {
    opacity: 0.9;
    word-break: break-all;
}

.agent-wb-search-grounding {
    margin-top: 0.65rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-secondary, #cbd5e1);
}
.agent-wb-search-grounding-h {
    font-weight: 600;
    color: #86efac;
    margin-bottom: 0.35rem;
    font-size: 0.76rem;
}
.agent-wb-search-grounding-link {
    display: inline-block;
    color: #a5b4fc;
    text-decoration: none;
    margin-bottom: 0.35rem;
    word-break: break-all;
}
.agent-wb-search-grounding-link:hover {
    text-decoration: underline;
}
.agent-wb-search-grounding-excerpt {
    white-space: pre-wrap;
    word-break: break-word;
    opacity: 0.92;
    max-height: 200px;
    overflow-y: auto;
}

/* 助手气泡内 Mermaid：流程图 / 代码 切换 + 渲染 */
.agent-wb-mermaid-block {
    margin: 0.75rem 0;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.65);
    overflow: hidden;
}
.agent-wb-mermaid-toolbar {
    display: flex;
    gap: 4px;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    background: rgba(2, 6, 23, 0.5);
}
.agent-wb-mermaid-tab {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    color: var(--text-secondary, #94a3b8);
}
.agent-wb-mermaid-tab.is-active {
    background: rgba(99, 102, 241, 0.28);
    color: #e2e8f0;
}
.agent-wb-mermaid-diagram {
    padding: 12px;
    min-height: 48px;
    max-height: min(55vh, 420px);
    overflow: auto;
}
.agent-wb-mermaid-diagram svg {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}
.agent-wb-mermaid-code pre {
    margin: 0;
    padding: 12px;
    max-height: min(50vh, 380px);
    overflow: auto;
    background: rgba(2, 6, 23, 0.55);
    border-radius: 0;
}
.agent-wb-mermaid-fail {
    margin: 0;
    font-size: 12px;
    color: #fca5a5;
    padding: 4px 2px 8px;
    line-height: 1.45;
}
.agent-wb-mermaid-fallback-pre {
    margin: 8px 0 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary, #cbd5e1);
}

.agent-wb-flowchart {
    flex-shrink: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    padding: 12px 14px;
    background: rgba(2, 6, 23, 0.72);
}
.agent-wb-flowchart.hidden {
    display: none;
}

/* 底部流程图区：流程图预览 / 源代码 切换 */
.agent-wb-flowchart-view-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.agent-wb-flowchart-view-tab {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary, #94a3b8);
}
.agent-wb-flowchart-view-tab.is-active {
    background: rgba(99, 102, 241, 0.35);
    color: #f8fafc;
}
.agent-wb-flowchart-view-pane.hidden {
    display: none;
}

.agent-wb-flowchart-diagram-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}
.agent-wb-flowchart-diagram-tools .agent-wb-btn {
    font-size: 12px;
    padding: 6px 10px;
}

.agent-wb-flowchart--collapsed .agent-wb-flowchart-body {
    display: none;
}
.agent-wb-flowchart-toggle {
    font-size: 12px;
    padding: 6px 10px;
}
.agent-wb-flowchart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.agent-wb-flowchart-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary, #f8fafc);
}
.agent-wb-flowchart-actions {
    display: flex;
    gap: 6px;
}
.agent-wb-flowchart-meta {
    font-size: 12px;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 10px;
    line-height: 1.45;
}
.agent-wb-flowchart-preview {
    min-height: 72px;
    max-height: 240px;
    overflow: auto;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.82);
}
.agent-wb-flowchart-preview svg {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

/* 全屏：必须用 #id —— 该节点 class 为 agent-wb-flowchart-view-pane，无 .agent-wb-flowchart-pane-diagram */
html.agent-wb-flowchart-doc-fs {
    overflow: hidden !important;
}
#agent-wb-flowchart-pane-diagram:fullscreen,
#agent-wb-flowchart-pane-diagram:-webkit-full-screen {
    background: #0f172a;
    box-sizing: border-box;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    max-height: 100vh;
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    padding: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
#agent-wb-flowchart-pane-diagram:fullscreen .agent-wb-flowchart-diagram-tools,
#agent-wb-flowchart-pane-diagram:-webkit-full-screen .agent-wb-flowchart-diagram-tools {
    flex-shrink: 0;
}
#agent-wb-flowchart-pane-diagram:fullscreen .agent-wb-flowchart-preview,
#agent-wb-flowchart-pane-diagram:-webkit-full-screen .agent-wb-flowchart-preview {
    flex: 1 1 0;
    min-height: 0;
    max-height: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
/* 纯文本回退时仍允许滚动阅读 */
#agent-wb-flowchart-pane-diagram:fullscreen .agent-wb-flowchart-preview:has(.agent-wb-flowchart-fallback),
#agent-wb-flowchart-pane-diagram:-webkit-full-screen .agent-wb-flowchart-preview:has(.agent-wb-flowchart-fallback) {
    display: block;
    overflow: auto;
    align-items: stretch;
    justify-content: flex-start;
}
#agent-wb-flowchart-pane-diagram:fullscreen .agent-wb-flowchart-preview svg,
#agent-wb-flowchart-pane-diagram:-webkit-full-screen .agent-wb-flowchart-preview svg {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    flex-shrink: 1;
    margin: 0;
}

.agent-wb-flowchart-fallback {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    line-height: 1.5;
}
.agent-wb-flowchart-code {
    width: 100%;
    min-height: 88px;
    max-height: 220px;
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.76);
    color: var(--text-primary, #f8fafc);
    font-size: 12px;
    line-height: 1.5;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* 助手表格 → Excel：只读预览（与流程图区同为折叠主列下方条带） */
.agent-wb-table-preview {
    flex-shrink: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.88);
}
.agent-wb-table-preview.hidden {
    display: none;
}
.agent-wb-table-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.agent-wb-table-preview-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary, #f8fafc);
}
.agent-wb-table-preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.agent-wb-table-preview-meta {
    font-size: 12px;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 10px;
    line-height: 1.45;
}
.agent-wb-table-preview-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.agent-wb-table-preview-tab {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(30, 41, 59, 0.65);
    color: var(--text-secondary, #cbd5e1);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.agent-wb-table-preview-tab.is-active {
    border-color: rgba(129, 140, 248, 0.65);
    background: rgba(79, 70, 229, 0.35);
    color: #e0e7ff;
}
.agent-wb-table-preview-tabs-singleton {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #94a3b8);
}
.agent-wb-table-preview-body {
    max-height: min(48vh, 420px);
    overflow: auto;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(129, 140, 248, 0.22);
    background: rgba(2, 6, 23, 0.55);
}
/* 克隆自助手气泡：保留 thead/th；斑马纹 + 表头强调（较接近表格软件观感） */
.agent-wb-table-preview-pane .agent-wb-table-preview-clone {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    line-height: 1.45;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(99, 102, 241, 0.35);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}
.agent-wb-table-preview-pane .agent-wb-table-preview-clone caption {
    caption-side: top;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.95);
    background: rgba(49, 46, 129, 0.45);
    border-bottom: 1px solid rgba(129, 140, 248, 0.25);
    text-align: left;
}
.agent-wb-table-preview-pane .agent-wb-table-preview-clone thead th {
    background: linear-gradient(180deg, rgba(79, 70, 229, 0.55), rgba(67, 56, 202, 0.5));
    color: #f8fafc;
    font-weight: 700;
    border-bottom: 2px solid rgba(165, 180, 252, 0.45);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}
.agent-wb-table-preview-pane .agent-wb-table-preview--no-thead > tbody > tr:first-child > th,
.agent-wb-table-preview-pane .agent-wb-table-preview--no-thead > tbody > tr:first-child > td {
    background: linear-gradient(180deg, rgba(79, 70, 229, 0.55), rgba(67, 56, 202, 0.5));
    color: #f8fafc;
    font-weight: 700;
    border-bottom: 2px solid rgba(165, 180, 252, 0.45);
    padding: 10px 12px;
}
.agent-wb-table-preview-pane .agent-wb-table-preview-clone tbody td,
.agent-wb-table-preview-pane .agent-wb-table-preview-clone tbody th {
    padding: 9px 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    color: rgba(241, 245, 249, 0.96);
}
/* 有 thead：tbody 内奇偶行斑马纹 */
.agent-wb-table-preview-pane .agent-wb-table-preview-clone:not(.agent-wb-table-preview--no-thead) tbody tr:nth-child(even) td,
.agent-wb-table-preview-pane .agent-wb-table-preview-clone:not(.agent-wb-table-preview--no-thead) tbody tr:nth-child(even) th {
    background: rgba(15, 23, 42, 0.72);
}
.agent-wb-table-preview-pane .agent-wb-table-preview-clone:not(.agent-wb-table-preview--no-thead) tbody tr:nth-child(odd) td,
.agent-wb-table-preview-pane .agent-wb-table-preview-clone:not(.agent-wb-table-preview--no-thead) tbody tr:nth-child(odd) th {
    background: rgba(30, 41, 59, 0.42);
}
/* 无 thead：首行已是表头样式，斑马从第二行起 */
.agent-wb-table-preview-pane .agent-wb-table-preview--no-thead tbody tr:nth-child(n + 2):nth-child(even) td,
.agent-wb-table-preview-pane .agent-wb-table-preview--no-thead tbody tr:nth-child(n + 2):nth-child(even) th {
    background: rgba(15, 23, 42, 0.72);
}
.agent-wb-table-preview-pane .agent-wb-table-preview--no-thead tbody tr:nth-child(n + 2):nth-child(odd) td,
.agent-wb-table-preview-pane .agent-wb-table-preview--no-thead tbody tr:nth-child(n + 2):nth-child(odd) th {
    background: rgba(30, 41, 59, 0.42);
}
.agent-wb-table-preview-btn {
    flex-shrink: 0;
}

.agent-wb-math-err,
.agent-wb-math-raw {
    font-size: 0.9em;
    opacity: 0.9;
}
.agent-wb-row.user .agent-wb-msg {
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: #f8fafc;
    border-bottom-right-radius: 4px;
}
.agent-wb-row.assistant .agent-wb-msg {
    background: rgba(51, 65, 85, 0.85);
    color: var(--text-primary, #e2e8f0);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-bottom-left-radius: 4px;
}
.agent-wb-typing {
    display: inline-flex;
    gap: 5px;
    padding: 6px 0;
}
.agent-wb-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    animation: agent-wb-dot 1.2s infinite ease-in-out;
}
.agent-wb-typing span:nth-child(2) {
    animation-delay: 0.15s;
}
.agent-wb-typing span:nth-child(3) {
    animation-delay: 0.3s;
}
@keyframes agent-wb-dot {
    0%, 80%, 100% {
        opacity: 0.35;
        transform: scale(0.85);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}
.agent-wb-composer {
    flex-shrink: 0;
    padding: 12px 14px 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--card-bg, rgba(15, 23, 42, 0.98));
}
.agent-wb-composer-modes {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.agent-wb-mode-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #94a3b8);
    flex-shrink: 0;
}
.agent-wb-mode-select {
    flex: 1;
    min-width: 140px;
    max-width: 320px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.75);
    color: var(--text-primary, #f1f5f9);
    font-size: 13px;
    cursor: pointer;
}
.agent-wb-mode-select:focus-visible {
    outline: 2px solid rgba(129, 140, 248, 0.55);
    outline-offset: 2px;
}
.agent-wb-composer-inner {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.agent-wb-input {
    flex: 1;
    min-height: 48px;
    max-height: 160px;
    resize: vertical;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-primary, #f1f5f9);
    font-size: 14px;
    font-family: inherit;
}
.agent-wb-input:focus {
    outline: none;
}
.agent-wb-input:focus-visible {
    outline: 2px solid rgba(129, 140, 248, 0.55);
    outline-offset: 2px;
    border-color: rgba(129, 140, 248, 0.38);
}
.agent-wb-send {
    padding: 12px 20px;
    border-radius: 12px;
    border: none;
    background: #6366f1;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
}
.agent-wb-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.agent-wb-hint-login-btn {
    margin-left: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid rgba(129, 140, 248, 0.55);
    background: rgba(99, 102, 241, 0.2);
    color: #c7d2fe;
    cursor: pointer;
}
.agent-wb-hint-login-btn:hover {
    filter: brightness(1.12);
}

.agent-wb-auth-inline {
    max-width: 100%;
    padding: 14px 16px !important;
    background: rgba(30, 41, 59, 0.95) !important;
    border: 1px solid rgba(129, 140, 248, 0.35) !important;
}
.agent-wb-auth-lead {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary, #cbd5e1);
}
.agent-wb-auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.agent-wb-auth-tab {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: transparent;
    color: var(--text-secondary, #94a3b8);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.agent-wb-auth-tab.active {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.55);
    color: #e0e7ff;
}
.agent-wb-auth-field {
    margin-bottom: 10px;
}
.agent-wb-auth-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 4px;
}
.agent-wb-auth-input {
    width: 100%;
    max-width: 320px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.85);
    color: var(--text-primary, #f1f5f9);
    font-size: 14px;
}
.agent-wb-auth-err {
    font-size: 12px;
    color: #fca5a5;
    margin-bottom: 8px;
}
.agent-wb-auth-err.hidden {
    display: none;
}
.agent-wb-auth-submit {
    margin-top: 4px;
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    background: #6366f1;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}
.agent-wb-auth-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* 语音 + 数字人 MVP：聊天区与侧栏形象并排 */
.agent-wb-chat-stage {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
}
.agent-wb-chat-stage .agent-wb-messages {
    flex: 1 1 auto;
    min-width: 0;
}
.agent-wb-shell.agent-wb-shell--page .agent-wb-chat-stage .agent-wb-messages {
    max-width: none;
}
.agent-wb-avatar-aside {
    flex: 0 0 400px;
    width: 400px;
    max-width: 52vw;
    border-left: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(0, 0, 0, 0.18);
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
}
.agent-wb-avatar-aside-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}
.agent-wb-avatar-aside-head {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary, #94a3b8);
}
.agent-wb-avatar-expand-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(129, 140, 248, 0.45);
    background: rgba(99, 102, 241, 0.15);
    color: #c7d2fe;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.agent-wb-avatar-expand-btn:hover {
    filter: brightness(1.08);
}
.agent-wb-avatar-expand-btn.is-active {
    background: rgba(99, 102, 241, 0.38);
    border-color: rgba(165, 180, 252, 0.72);
    color: #eef2ff;
}
/* 窄屏「展开/收起数字人预览」：桌面隐藏，由 @media 打开 */
.agent-wb-avatar-mobile-preview-toggle {
    display: none;
}
.agent-wb-avatar-mode-toggle {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--text-secondary, #94a3b8);
}
.agent-wb-avatar-mode-btn {
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(51, 65, 85, 0.35);
    color: #e2e8f0;
    font-size: 11px;
    cursor: pointer;
}
.agent-wb-avatar-mode-btn.is-active {
    border-color: rgba(99, 102, 241, 0.65);
    background: rgba(99, 102, 241, 0.25);
    color: #e0e7ff;
}
.agent-wb-avatar-hint {
    font-size: 10px;
    line-height: 1.35;
    color: var(--text-secondary, #64748b);
    opacity: 0.9;
}
.agent-wb-avatar-2d {
    flex: 1;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    position: relative;
}
.agent-wb-avatar-preview-wrap {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    gap: 8px;
}
.agent-wb-avatar-3d-preview-wrap {
    flex: 1;
    min-height: 300px;
}
.agent-wb-avatar-load-overlay {
    display: none;
    flex-direction: column;
    position: absolute;
    inset: 0;
    z-index: 6;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(4px);
}
.agent-wb-avatar-load-caption {
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
    text-align: center;
}
.agent-wb-avatar-load-track {
    height: 6px;
    border-radius: 4px;
    background: rgba(51, 65, 85, 0.85);
    overflow: hidden;
}
.agent-wb-avatar-load-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    background: linear-gradient(90deg, #6366f1, #a5b4fc);
    transition: width 0.22s ease-out;
}
.agent-wb-avatar-load-overlay.is-indeterminate .agent-wb-avatar-load-fill {
    width: 40% !important;
    animation: agent-wb-load-shimmer 1s ease-in-out infinite;
}
@keyframes agent-wb-load-shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(350%);
    }
}
.agent-wb-avatar-2d-canvas-host {
    flex: 1;
    min-height: 260px;
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.35);
}
.agent-wb-avatar-2d-canvas-host canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}
.agent-wb-avatar-2d-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}
.agent-wb-avatar-face {
    position: relative;
    width: 100px;
    height: 120px;
    border-radius: 48% 48% 44% 44%;
    background: linear-gradient(165deg, rgba(99, 102, 241, 0.45), rgba(30, 27, 75, 0.85));
    box-shadow: inset 0 -8px 24px rgba(0, 0, 0, 0.25);
}
.agent-wb-avatar-eye {
    position: absolute;
    top: 36px;
    width: 14px;
    height: 18px;
    border-radius: 50%;
    background: #0f172a;
    opacity: 0.9;
}
.agent-wb-avatar-eye:first-of-type {
    left: 22px;
}
.agent-wb-avatar-eye:nth-of-type(2) {
    right: 22px;
}
.agent-wb-avatar-mouth {
    position: absolute;
    left: 50%;
    bottom: 22px;
    width: 32px;
    height: 10px;
    margin-left: -16px;
    border-radius: 0 0 16px 16px;
    background: rgba(15, 23, 42, 0.85);
    transform-origin: center top;
    transform: scaleY(0.45);
    transition: transform 0.08s ease;
}
.agent-wb-avatar-mouth.is-speaking {
    animation: agent-wb-mouth-pulse 0.22s ease-in-out infinite;
}
@keyframes agent-wb-mouth-pulse {
    0%,
    100% {
        transform: scaleY(0.45);
    }
    50% {
        transform: scaleY(1);
    }
}
.agent-wb-avatar-3d {
    flex: 1;
    min-height: 320px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
}
.agent-wb-vrma-presets {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.agent-wb-vrma-presets-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #94a3b8);
    letter-spacing: 0.02em;
}
.agent-wb-vrma-presets-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.agent-wb-vrma-preset-btn {
    padding: 4px 8px;
    font-size: 11px;
    line-height: 1.2;
    border-radius: 8px;
    border: 1px solid rgba(129, 140, 248, 0.35);
    background: rgba(99, 102, 241, 0.12);
    color: #c7d2fe;
    cursor: pointer;
}
.agent-wb-vrma-preset-btn:hover:not(:disabled) {
    filter: brightness(1.12);
    border-color: rgba(165, 180, 252, 0.55);
}
.agent-wb-vrma-preset-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}
.agent-wb-vrma-preset-btn.is-active {
    background: rgba(99, 102, 241, 0.38);
    border-color: rgba(165, 180, 252, 0.75);
    color: #eef2ff;
}
.agent-wb-avatar-3d-host {
    width: 100%;
    min-height: 600px;
    height: 600px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.5);
}
.agent-wb-avatar-3d-host canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    cursor: grab;
    touch-action: none;
}
.agent-wb-avatar-3d-host canvas:active {
    cursor: grabbing;
}
.agent-wb-voice-mic {
    flex-shrink: 0;
    width: 44px;
    height: 48px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid rgba(129, 140, 248, 0.45);
    background: rgba(99, 102, 241, 0.15);
    color: #c7d2fe;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    align-self: flex-end;
}
.agent-wb-voice-mic:hover {
    filter: brightness(1.1);
}
.agent-wb-voice-mic.is-listening {
    background: rgba(239, 68, 68, 0.35);
    border-color: rgba(248, 113, 113, 0.65);
    color: #fecaca;
}
.agent-wb-voice-mic.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.agent-wb-tts-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary, #94a3b8);
    cursor: pointer;
    user-select: none;
    margin-left: auto;
}
.agent-wb-tts-toggle input {
    accent-color: #6366f1;
}

/* 工作台内「全屏」分栏：左侧聊天约 20%，右侧数字人约 80%（宽屏） */
@media (min-width: 721px) {
    .agent-wb-chat-stage--avatar-expanded .agent-wb-messages {
        flex: 0 0 20%;
        width: 20%;
        max-width: 20%;
        min-width: 0;
        padding: 12px 10px;
    }
    .agent-wb-chat-stage--avatar-expanded .agent-wb-avatar-aside {
        flex: 1 1 80%;
        width: auto;
        max-width: none;
        min-width: 0;
    }
    .agent-wb-chat-stage--avatar-expanded .agent-wb-avatar-3d {
        min-height: 0;
    }
    .agent-wb-chat-stage--avatar-expanded .agent-wb-avatar-3d-preview-wrap {
        flex: 1 1 auto;
        min-height: 300px;
    }
    .agent-wb-chat-stage--avatar-expanded .agent-wb-avatar-3d-host {
        flex: 1 1 auto;
        min-height: min(82vh, 980px);
        height: auto;
    }
    .agent-wb-chat-stage--avatar-expanded .agent-wb-avatar-2d-canvas-host {
        min-height: min(68vh, 720px);
    }
}

@media (max-width: 720px) {
    .agent-wb-chat-stage {
        flex-direction: column;
    }
    .agent-wb-avatar-aside {
        flex: 0 0 auto;
        width: 100%;
        max-width: none;
        border-left: none;
        border-top: 1px solid rgba(148, 163, 184, 0.18);
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
    /* 窄屏：工作台内「全屏分栏」无意义，隐藏以免与「展开数字人」混淆 */
    .agent-wb-avatar-aside-head-row .agent-wb-avatar-expand-btn:not(.agent-wb-avatar-mobile-preview-toggle) {
        display: none !important;
    }
    .agent-wb-avatar-mobile-preview-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
    .agent-wb-avatar-aside-head-row {
        flex: 1 1 100%;
        width: 100%;
    }
    .agent-wb-avatar-mode-toggle {
        flex: 1 1 100%;
        width: 100%;
    }
    /* 默认收起：隐藏 2D/3D 画布区（由 JS 类 agent-wb-avatar-aside--preview-collapsed 控制） */
    .agent-wb-avatar-aside--preview-collapsed .agent-wb-avatar-hint,
    .agent-wb-avatar-aside--preview-collapsed .agent-wb-avatar-2d,
    .agent-wb-avatar-aside--preview-collapsed .agent-wb-avatar-3d {
        display: none !important;
    }
    .agent-wb-avatar-2d,
    .agent-wb-avatar-3d {
        min-height: 120px;
    }
    .agent-wb-avatar-3d-host {
        min-height: 380px;
        height: 380px;
    }
    .agent-wb-chat-stage--avatar-expanded .agent-wb-avatar-3d-host {
        min-height: 400px;
        height: min(62vh, 640px);
    }
    .agent-wb-sb-toggle {
        display: inline-block;
    }
    .agent-wb-sidebar {
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 101;
        transform: translateX(-102%);
        transition: transform 0.2s ease;
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.3);
    }
    .agent-wb-inner.sidebar-open .agent-wb-sidebar {
        transform: translateX(0);
    }
    .agent-wb-inner {
        position: relative;
    }
    /* 点击主区遮罩收起侧栏（侧栏盖住顶栏汉堡时仍可关闭） */
    .agent-wb-sidebar-scrim {
        display: none;
        position: absolute;
        inset: 0;
        z-index: 100;
        margin: 0;
        padding: 0;
        border: none;
        background: rgba(15, 23, 42, 0.52);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .agent-wb-inner.sidebar-open .agent-wb-sidebar-scrim {
        display: block;
    }
    .agent-wb-sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 36px;
        height: 36px;
        padding: 0;
        border-radius: 10px;
        border: 1px solid rgba(148, 163, 184, 0.35);
        background: rgba(51, 65, 85, 0.45);
        color: #e2e8f0;
        font-size: 18px;
        line-height: 1;
        cursor: pointer;
    }
    .agent-wb-sidebar-close:hover {
        background: rgba(71, 85, 105, 0.55);
        color: #f8fafc;
    }
}

/* 书签 HTML 上传（与生成模式同区） */
.agent-wb-bookmark-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 0 12px 8px;
    font-size: 12px;
    color: rgba(148, 163, 184, 0.95);
}
.agent-wb-bookmark-hint {
    margin-right: 4px;
}
.agent-wb-bookmark-btn {
    padding: 6px 12px;
    font-size: 12px;
}
